-
Notifications
You must be signed in to change notification settings - Fork 225
Closed
Labels
ImprovementMark a PR as an improvement, for auto-generated CHANGELOGMark a PR as an improvement, for auto-generated CHANGELOG
Description
Context
When joining a stake pool, the process is as follows:
- Check if the account has already a registered stake key.
- Check if the requested pool can be joined (it exists and it's not retiring).
- Select coins to cover for either the delegation, or the delegation AND the key registration.
- Sign the delegation (provide a witness for the stake key).
- Submit the transaction.
The user wants to be able to:
- Stop after step 3
- Get the unsigned delegation certificate made by the wallet
- Do step 4 and 5 on the client side
This ticket is about 1. and 2.
Decision
Acceptance Criteria
- The endpoint
POST /wallets/{walletId}/coin-selections/random
should be extended to accept a new request body, either{ "action": "join", "pool": <pool id> }
or{ "action": "quit" }
. - Request bodies providing both "payments" and "action" should fail to parse with an appropriate error.
- Request bodies providing "pool" without "action" should fail to parse with an appropriate error.
- When provided with a poolId and an action the handler must verify that the action is valid and be consistent with the existing
POST /stake-pools/{poolId}/wallets/{walletId}
andDELETE
/stake-pools/*/wallets/{walletId}` handlers (i.e. re-use the same logic). - If valid, the request must be processed and return a list of resolved inputs, outputs, and a list of "certificates" depending on the scenario. Inputs and outputs should be already balanced to accommodate for the certificates.
- Certificates can be either: (1) a key deregistration certificate, (2) a key registration certificate AND a stake delegation certificate, (3) a stake delegation certificate.
- Certificate must be represented as JSON objects:
- Key registration certificates should include a tag identifying the certificate, a bech32 serialized public stake key (according to CIP-5) and the derivation path corresponding to that key. (e.g. { "type": "key_registration", "stake_public_key": { "key": "stake_xvk1____", "derivation_path": "1852H/1815H/0H/2/0" } })
- Key de-registration certificates should include a tag identifying the certificate, a bech32 serialized public stake key and the derivation path corresponding to that key.
- Stake Pool delegation certificates should include a tag identifying the certificate and a bech32 serialized pool id.
QA
- for the adjustment in the yaml schema check: https://github.com/input-output-hk/cardano-wallet/pull/2213/files#diff-d9433cbec16adf8a7dad1e1440a87cbee063b9fa9ebb7c6a631ce4a3482a4ed1
- Also on API doc edge: https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Coin-Selections
Example requestes:
{
"delegation_action": {
"action": "join",
"pool": "pool1wqaz0q0zhtxlgn0ewssevn2mrtm30fgh2g7hr7z9rj5856457mm"
}
}
{ "delegation_action": { "action": "quit" } }
integration test scenarios here: https://github.com/input-output-hk/cardano-wallet/pull/2213/files#diff-883f5d29ba439fce1114ee5d9fdf3acf37f84150d24429f2f2ff768de0564d99R561
Metadata
Metadata
Assignees
Labels
ImprovementMark a PR as an improvement, for auto-generated CHANGELOGMark a PR as an improvement, for auto-generated CHANGELOG