Sign Staking Transactions
Overview
Like spend transactions, you must sign and broadcast staking transactions. However, staking transactions don't follow the same integration flow for signing outlined in Wallets Overview. The number of staking transactions needed stake or unstake depends on the asset and requested amount. For example, since ETH validators can only stake multiples of 32 ETH, a staking request is for 64 ETH generates 2 transactions that you must sign and broadcast.
Prerequisites
Steps
1 2 3 4 5 6
const transactions = await stakingWallet.getTransactionsReadyToSign(stakingRequest.id); if (!transactions.allSigningComplete && transactions.transactions.length > 0) { transactions.transactions.forEach((transaction: StakingTransaction) => { await stakingWallet.buildSignAndSend({ walletPassphrase: 'walletPassphrase' }, transaction); }); }
Step Result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
{ "id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "clientId": "f054adbc-26a3-4acd-8a9d-726a05bca0dr", "requestUserId": "6092e75c451052000636831deb797bd1", "enterpriseId": "1032e75c451052000436831deb797af1", "walletId": "2032e75g451052000636831abd797bd3", "walletType": "hot", "type": "STAKE", "coin": "eth", "createdDate": "2022-01-10T14:32:28Z", "statusModifiedDate": "2022-01-10T14:32:28Z", "status": "NEW", "withdrawalAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecd7c", "delegations": [ { "id": "e0225adbc-66a3-4ccd-9a9d-726a05bca0cf", "delegationAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecdy5", "delegated": 3200000000000000000, "status": "PENDING", "rewards": 0, "pendingUnstake": 3200000000000000000, "apy": 8.3, "coin": "eth", "walletId": "2032e75g451052000636831abd797bd3", "unstakingFee": 100000000000000, "unstakingMin": 0 }, { "id": "e0225adbc-55b43-5tta-9a9d-726a05bca0ai", "delegationAddress": "0x3b6406c9710f588ca733360bfa8033d0ef9ecre4", "delegated": 3200000000000000000, "status": "PENDING", "rewards": 0, "pendingUnstake": 3200000000000000000, "apy": 8.3, "coin": "eth", "walletId": "2032e75g451052000636831abd797bd3", "unstakingFee": 1000000000000000, "unstakingMin": 0 } ], "transactions": [ { "stakingRequestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "createdDate": "2022-01-10T14:32:28Z", "statusModifiedDate": "2022-01-10T14:32:28Z", "status": "PENDING", "amount": 3200000000000000000, "transactionType": "delegate", "delegationId": "e0225adbc-66a3-4ccd-9a9d-726a05bca0cf", "buildParams": { "recipients": { "amount": 3200000000000000000, "address": "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b", "data": "fds0934rnnio390nw" }, "stakingParams": { "requestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "amount": 3200000000000000000, "validator": "0x5a6406c9710f588ca733360bfa8033d0ef9ecdy5", "actionType": "delegate" }, "gasPrice": 1000000000000000, "gasLimit": 3000000000000000 } }, { "stakingRequestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "createdDate": "2022-01-10T14:32:28Z", "statusModifiedDate": "2022-01-10T14:32:28Z", "status": "PENDING", "amount": 3200000000000000000, "transactionType": "delegate", "delegationId": "e0225adbc-55b43-5tta-9a9d-726a05bca0ai", "buildParams": { "recipients": { "amount": 3200000000000000000, "address": "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b", "data": "fds0934rnnio390nw" }, "stakingParams": { "requestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "amount": 3200000000000000000, "validator": "0x3b6406c9710f588ca733360bfa8033d0ef9ecre4", "actionType": "delegate" }, "gasPrice": 1000000000000000, "gasLimit": 3000000000000000 } } ], "amount": 6400000000000000000, "gasPrice": 1000000000000000 }
Next Steps
Approve Transactions (Optional) - If the unstaking transaction requires admin approval, it remains in a pending approval status until receiving final approval.