In order to undelegate SOL, we will:
- Deactivate a given stake account
- Wait for the stake to become inactive (generally at the next epoch boundary)
- Withdraw the inactive SOL back to the funding account
In the following guide we will illustrate how to deactivate a stake account.
Create a new Unstaking Flow
To initiate the undelegation process, create a new flow with a POST
request to /flows
.
URL
https://api.figment.io/flows
Request
protocol
* :string
Protocol on which this flow operates (ex.solana
).network
* :string
Network on which this flow operates (ex.mainnet
,testnet
).operation
* :string
The operation to perform (ex.unstaking
).
{
"protocol": "solana",
"network": "devnet",
"operation": "unstaking"
}
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.actions
:array
It includes thename
&inputs
of all next possible actions.create_deactivate_tx
: Use this action to generate a stake deactivation transaction.create_withdraw_tx
: Use this action to generate a withdrawal transaction. This can be used to withdraw any deactivated stake or any balance in excess of the desired staking amount.
data
:object
Flow & transaction data.
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "initialized",
"actions": [
{
"name": "create_deactivate_tx",
"inputs": [
{
"name": "stake_account_pubkey",
"display": "Stake Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
},
{
"name": "create_withdraw_tx",
"inputs": [
{
"name": "stake_account_pubkey",
"display": "Stake Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "in SOL",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "recipient_pubkey",
"display": "Recipient Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"funding_account_pubkey": null,
"stake_account_pubkey": null,
"stake_authority_pubkey": null,
"withdraw_authority_pubkey": null,
"deactivate_transaction": null,
"delegation_active_amount": null,
"delegation_inactive_amount": null,
"delegation_status": null,
"delegation_status_error": null,
"recipient_pubkey": null,
"withdraw_amount": null,
"withdraw_transaction": null,
"withdraw_transaction_funding_account_pubkey": null,
"estimated_inactive_at": null
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-02T08:28:38.784Z"
}
Submit Deactivate Transaction Data
After collecting the required inputs, send a PUT
request to /flows/[:flow_id]/next
to proceed to the next step.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :create_deactivate_tx
inputs
* :object
funding_account_pubkey
* :string
The address of the stake account to be deactivated.stake_account_pubkey
* :string
The address of the wallet with signing rights to deactivate the stake account.
{
"name": "create_deactivate_tx",
"inputs": {
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
}
}
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.actions
:array
It includes thename
&inputs
of all next possible actions.refresh_deactivate_tx
: If you need to get a fresh version of the transaction payload (i.e., the recent blockhash has expired).sign_deactivate_tx
: Submit a signed transaction payload or an array of signatures to continue the flow. Refer to the guides Signing Transactions with Figment's npm Package and Signing Transactions with the Fireblocks API for details.confirm_deactivate_tx_by_hash
: Submit a previously completed transaction hash to continue the flow. Refer to the guide Advance Flows Using a Transaction Hash.
data
:object
Flow & transaction data.
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "deactivate_tx_signature",
"actions": [
{
"name": "refresh_deactivate_tx",
"inputs": [
{
"name": "stake_account_pubkey",
"display": "Stake Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x"
},
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
}
]
},
{
"name": "sign_deactivate_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_deactivate_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"deactivate_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"delegation_active_amount": null,
"delegation_inactive_amount": null,
"delegation_status": null,
"delegation_status_error": null,
"recipient_pubkey": null,
"withdraw_amount": null,
"withdraw_transaction": null,
"withdraw_transaction_funding_account_pubkey": null,
"estimated_inactive_at": null
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-02T08:30:09.009Z"
}
Submit Signed Deactivate Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Solana network.
The transaction signing window on Solana is sometimes less than 90 seconds.
If you encounter an error
"Transaction simulation failed: Blockhash not found"
, refresh the transaction, sign the newly created payload and submit it in < 90 seconds.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :sign_deactivate_tx
inputs
* :object
transaction_payload
* : Signed transaction payload from the previous step's response.signatures
:array
ofobject
The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
"name": "sign_deactivate_tx",
"inputs": {
"transaction_payload": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000"
}
}
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.deactivate_tx_broadcasting
: Transaction has been broadcast but not confirmed.cool_down
: Transaction is under cool-down period.
actions
:array
It includes thename
&inputs
of all next possible actions.data
:object
Flow & transaction data.
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "deactivate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-02T08:31:46.969Z",
"inputs": []
}
],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"deactivate_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signed": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"hash": "B5pqLyY3Wo8C3StMeqXSJZL8rxXLodr3sVvRqfeudGc87xNpiaB9GAcKVCBpBYpFeDk3SNUUFeZ8sejPPKNRCjj",
"status": null,
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": null
},
"delegation_active_amount": null,
"delegation_inactive_amount": null,
"delegation_status": null,
"delegation_status_error": null,
"recipient_pubkey": null,
"withdraw_amount": null,
"withdraw_transaction": null,
"withdraw_transaction_funding_account_pubkey": null,
"estimated_inactive_at": null
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-02T08:30:46.246Z"
}
Submit Withdrawal Transaction Data
After collecting the required inputs, send a PUT
request to /flows/[:flow_id]/next
to move on to the next step.
Note that the recipient of the withdrawal is not the originating address by default!
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :create_withdraw_tx
inputs
* :object
amount
* :string
The number of SOL to be withdrawn. Partial withdrawal is possible.funding_account_pubkey
* :string
The address of the account paying the transaction fee.recipient_pubkey
* :string
The address of the account which will receive the withdrawal.stake_account_pubkey
: The public key of the stake account from which to withdraw.
{
"name": "create_withdraw_tx",
"inputs": {
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"amount": 5.9,
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"recipient_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
}
}
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.actions
:array
It includes thename
&inputs
of all next possible actions.refresh_withdraw_tx
: If you need to get a fresh version of the transaction payload (i.e., the recent blockhash has expired)sign_withdraw_tx
: Submit a signed transaction payload or an array of signatures to continue the flow. Refer to the guides Signing Transactions with Figment's npm Package and Signing Transactions with the Fireblocks API for details.confirm_withdraw_tx_by_hash
: Submit a previously completed transaction hash to continue the flow. Refer to the guide Advance Flows Using a Transaction Hash.
data
:object
Flow & transaction data.
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "withdraw_tx_signature",
"actions": [
{
"name": "refresh_withdraw_tx",
"inputs": [
{
"name": "stake_account_pubkey",
"display": "Stake Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x"
},
{
"name": "amount",
"display": "Amount",
"description": "in SOL",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "5.9"
},
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
},
{
"name": "recipient_pubkey",
"display": "Recipient Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
}
]
},
{
"name": "sign_withdraw_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [],
"array": false,
"default_value": null,
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signing_payload": "01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_withdraw_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"deactivate_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signed": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"hash": "B5pqLyY3Wo8C3StMeqXSJZL8rxXLodr3sVvRqfeudGc87xNpiaB9GAcKVCBpBYpFeDk3SNUUFeZ8sejPPKNRCjj",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": "2023-03-02T08:30:46.000Z"
},
"delegation_active_amount": "0.0",
"delegation_inactive_amount": "5997717120.0",
"delegation_status": "inactive",
"delegation_status_error": null,
"recipient_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_amount": "5.9",
"withdraw_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signing_payload": "01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"withdraw_transaction_funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"estimated_inactive_at": "2023-03-04T03:25:51.870Z"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-06T04:28:09.951Z"
}
Submit Signed Withdrawal Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Solana network.
The transaction signing window on Solana is sometimes less than 90 seconds.
If you encounter an error
"Transaction simulation failed: Blockhash not found"
, refresh the transaction, sign the newly created payload and submit it in < 90 seconds.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :sign_withdraw_tx
inputs
* :object
transaction_payload
* : Signed transaction payload from the previous step's response.signatures
:array
ofobject
The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
"name": "sign_withdraw_tx",
"inputs": {
"transaction_payload": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000"
}
}
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.withdraw_tx_broadcasting
: Transaction broadcastingwithdrawn
: Transaction is confirmed and tokens are withdrawn
actions
:array
It includes thename
&inputs
of all next possible actions.data
:object
Flow & transaction data.
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "withdraw_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-06T04:29:51.974Z",
"inputs": []
}
],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"deactivate_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signed": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"hash": "B5pqLyY3Wo8C3StMeqXSJZL8rxXLodr3sVvRqfeudGc87xNpiaB9GAcKVCBpBYpFeDk3SNUUFeZ8sejPPKNRCjj",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": "2023-03-02T08:30:46.000Z"
},
"delegation_active_amount": "0.0",
"delegation_inactive_amount": "5997717120.0",
"delegation_status": "inactive",
"delegation_status_error": null,
"recipient_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_amount": "5.9",
"withdraw_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signing_payload": "01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signed": "012fd92132f4cd3e1fe8339f3aece9a757da1e7277d6c2cc10919c882d7c8aff03c123d3e720755c8a996919e127e219e31e268277019ee53d5dc24e0cecff960d01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"hash": "xV8ZSsWE4qRmW7Eu52xZCfLM1S5xjezjHDh7TP1FGTwTrQiTw9a6tfS8sKYmn6XKuxdnmPHrmKGVgxWQMg6BVV6",
"status": null,
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": null
},
"withdraw_transaction_funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"estimated_inactive_at": "2023-03-04T03:25:51.870Z"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-06T04:28:51.327Z"
}
Get Unstaking Flow Status
To get the current state of the existing flow, send a GET
request to /flows/[:flow_id]
using the flow ID from the previous step.
URL
https://api.figment.io/flows/[:flow_id]
Request
- None
Response
id
:string
ID of the flow.operation
:string
The Staking API operation being performed by this flow.state
:string
The current state of the flow.deactivate_tx_broadcasting
: Transaction has been broadcast but not confirmed.cool_down
: Transaction broadcasted and confirmed.deactivated
: The deactivation is complete.withdraw_tx_broadcasting
: The transaction has been broadcast to the network and is awaiting confirmation.withdrawn
: The transaction is confirmed and the stake account has been withdrawn.
actions
:array
It includes thename
&inputs
of all next possible actions.data
:object
Flow & transaction data.
Example of response at end of flow
{
"id": "0e42073a-1f7d-4997-a4f0-cab1130a9521",
"operation": "unstaking",
"state": "withdrawn",
"actions": [],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"deactivate_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signing_payload": "01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"signed": "0108b202d6415b02cf9db966eccf11da492a79d343de947b7e0775168e938eb43fdb6263ffb6dec528bd71c0d753833afa7eec1ef1a1603e4bdc26f1c6d9f8420a01000204f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000023652dc33a447d52fa6da4e090bb2c792e8bcff1a7af9a2d3ce91a994c8779e90102030103000405000000",
"hash": "B5pqLyY3Wo8C3StMeqXSJZL8rxXLodr3sVvRqfeudGc87xNpiaB9GAcKVCBpBYpFeDk3SNUUFeZ8sejPPKNRCjj",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": "2023-03-02T08:30:46.000Z"
},
"delegation_active_amount": "0.0",
"delegation_inactive_amount": "5997717120.0",
"delegation_status": "inactive",
"delegation_status_error": null,
"recipient_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_amount": "5.9",
"withdraw_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signing_payload": "01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"signed": "012fd92132f4cd3e1fe8339f3aece9a757da1e7277d6c2cc10919c882d7c8aff03c123d3e720755c8a996919e127e219e31e268277019ee53d5dc24e0cecff960d01000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f06a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b210000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff40000005d9445ea22a4f27189c9c66f69d4469f9fa6d5fc304aea386e1cf4fe5f30508d01020501000304000c0400000000dbaa5f01000000",
"hash": "xV8ZSsWE4qRmW7Eu52xZCfLM1S5xjezjHDh7TP1FGTwTrQiTw9a6tfS8sKYmn6XKuxdnmPHrmKGVgxWQMg6BVV6",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": "2023-03-06T04:28:51.000Z"
},
"withdraw_transaction_funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"estimated_inactive_at": "2023-03-04T03:25:51.870Z"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:28:38.784Z",
"updated_at": "2023-03-06T04:29:06.559Z"
}
Notes
While the flow state is cool_down
, the stake account is in the process of deactivating.
- This generally happens at the next epoch boundary (max 2.5 days), but if there is a large change in network wide delegation levels it is possible it will be subjected to a multi-epoch cooldown period.
- This would mean that a portion of the stake will deactivate at each epoch boundary for a few epochs, until it is fully deactivated.
Read more about the warmup and cooldown period.
At each epoch, a webhook can be used to notify you about how much of the stake has deactivated, until it is fully deactivated.