The Split Stake Account flow allows you to break the balance of a given stake account up into two separate accounts. This way, you are able to partially unbond your SOL rather than needing to unbond the full balance of the stake account.
To break the balance of a stake account up into two separate accounts, you will need:
- The existing stake account from which partial SOL balance will be split
- The pubkey of the wallet which will pay the transaction fee
- The amount of SOL tokens you want to unbond
In the following guide we will illustrate how to split a stake account.
Create New Split Stake Account Flow
To initiate the split stake account process with Staking API, 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.testnet
).operation
* :string
The operation to perform (ex.split_stake_account
).
{
"protocol": "solana",
"network": "devnet",
"operation": "split_stake_account"
}
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_split_tx
: Use this Action to create a split stake account transaction.funding_account_pubkey
: The public key of the wallet which will pay the transaction fee.source_stake_account_pubkey
: The existing stake account from which partial SOL balance will be split.amount
: The amount of SOL to be transferred to a newly created stake account. This field should be in full SOL, not in lamports (ie. if you want to transfer 5 SOL, return"amount": 5.0
). The Staking API will translate the amount to lamports so you do not have to worry about the conversion factor. Lamports are fractional SOLs.
data
:object
Flow & transaction data.
{
"id": "81a57270-89b2-46d9-83b0-2b6138b556cd",
"operation": "split_stake_account",
"state": "initialized",
"actions": [
{
"name": "create_split_tx",
"inputs": [
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "source_stake_account_pubkey",
"display": "Source 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
}
]
}
],
"data": {
"funding_account_pubkey": null,
"source_stake_account_pubkey": null,
"amount": null,
"split_transaction": null,
"source_stake_authority_pubkey": null,
"destination_stake_account_pubkey": null
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:24:44.629Z",
"updated_at": "2023-03-02T08:24:44.629Z"
}
Submit Split Stake Account 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_split_tx
inputs
:object
funding_account_pubkey
* :string
The public key of the wallet which will pay the transaction fee.source_stake_account_pubkey
* :string
The existing stake account from which partial SOL balance will be split.amount
* :number
The amount of SOL to be transferred to the new stake account. This field should be in full SOL, not in lamports (ie. if you want to fund the new stake account with 5 SOL, return"amount": 5.0
). The Staking API will translate the amount to lamports so you do not have to worry about the conversion factor. Lamports are fractional SOLs.
{
"name": "create_split_tx",
"inputs": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"source_stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"amount": 1
}
}
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_split_tx
: If you need to get a fresh version of the transaction payload (i.e., the recent blockhash has expired).sign_split_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_split_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": "81a57270-89b2-46d9-83b0-2b6138b556cd",
"operation": "split_stake_account",
"state": "split_tx_signature",
"actions": [
{
"name": "refresh_split_tx",
"inputs": [
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
},
{
"name": "source_stake_account_pubkey",
"display": "Source 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": "1.0"
}
]
},
{
"name": "sign_split_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": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signing_payload": "02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"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_split_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",
"source_stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"amount": "1.0",
"split_transaction": {
"raw": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signing_payload": "02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"source_stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"destination_stake_account_pubkey": "XD7o3qSrZr6GJJnZ1s4ks3yDsHuso4Z9pSXy5VPLNLG"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:24:44.629Z",
"updated_at": "2023-03-02T08:26:08.885Z"
}
Submit Signed Split Stake Account 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 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_split_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_split_tx",
"inputs": {
"transaction_payload": "02d6acd5591a09401b3b20c3cb323d0c05bd9f64f5ed346795b5890e60aca150e4293c4f487c85475c141a6b443f746f3479473dcb2b61c33b39a30aa4c6c42107615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000"
}
}
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.split_tx_broadcasting
: Transaction has been broadcast and is awaiting confirmation.completed
: Transaction has been confirmed and split is complete.
actions
:array
It includes thename
&inputs
of all next possible actions.data
:object
Flow & transaction data.
{
"id": "81a57270-89b2-46d9-83b0-2b6138b556cd",
"operation": "split_stake_account",
"state": "split_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-02T08:27:37.929Z",
"inputs": []
}
],
"data": {
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"source_stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"amount": "1.0",
"split_transaction": {
"raw": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signing_payload": "02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signed": "02d6acd5591a09401b3b20c3cb323d0c05bd9f64f5ed346795b5890e60aca150e4293c4f487c85475c141a6b443f746f3479473dcb2b61c33b39a30aa4c6c42107615272813a0191838a4ed56c460df8411f77e6b18ed94554be36900d37d7d81675bd0fd8b1b235618ae7525f3008a1f5c383d33ad488e93f1647cdb76322220f02000205f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53407bd200aaa5a1b4ac8ea7e9fb1c13be7f0b0b161cce1065293381497f62ecf297de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000d56fb5fb2e873897e4cbff1e4b7038e7b64b82d27fd8dbd72310c047a7851f1d020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"hash": "5HwSBZggASZfGbSsfeaoSwTG4Kz8V7njWaBWYkD3c4sjDtvtJGKAvdRozk5CdnMvL9Z98rDR3MUcx6neYJyEXWte",
"status": null,
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": null
},
"source_stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"destination_stake_account_pubkey": "XD7o3qSrZr6GJJnZ1s4ks3yDsHuso4Z9pSXy5VPLNLG"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-03-02T08:24:44.629Z",
"updated_at": "2023-03-02T08:26:36.620Z"
}
Get Split Stake Account 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.split_stake_tx_broadcasting
: Transaction has been broadcast but not confirmed.completed
: Transaction broadcasted and confirmed.
actions
:array
It includes thename
&inputs
of all next possible actions.data
:object
Flow & transaction data.
{
"id": "35b29ecd-585d-4765-8df9-6308e1111d6a",
"operation": "split_stake_account",
"state": "completed",
"actions": [],
"data": {
"funding_account_pubkey": "ZWmvcfpjRJi12wPv2AaooXFDZtFVeXrk7WuAX5XTntN",
"source_stake_account_pubkey": "AKqCviCNHAk9qG8iWRnsqUemvsq4NnW3u5Rn6xwdWGcq",
"amount": "1.0",
"split_transaction": {
"raw": "0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000164c2010b087b6dfa7bf0ad29012f5775361c6658655341b0410d20af78f22a25304fd2d85d62e961b5624a5c8077196ddb17f15e516a95b0500574d4831490a02000205085440890ab57cf018e04cbe2d06f3a91c798e12b83c2df99b058b18d2ab8167dc65b9db875810a82c40f0c829762eca07b31312408e0e34a8b0159be2cad7038a8c24a6d037267874fce747fbdba294b1085d6f98bef48f57a098e29aa0c302000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000097a54d9657dae4764c2262719109840d9c6167557934c6fcbd3e78b15e5a84a7020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signing_payload": "02000205085440890ab57cf018e04cbe2d06f3a91c798e12b83c2df99b058b18d2ab8167dc65b9db875810a82c40f0c829762eca07b31312408e0e34a8b0159be2cad7038a8c24a6d037267874fce747fbdba294b1085d6f98bef48f57a098e29aa0c302000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000097a54d9657dae4764c2262719109840d9c6167557934c6fcbd3e78b15e5a84a7020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"signed": "02c3a8674b14549762c3ed7fe7c5a730047e3ae5c6b92dc20da3fcca959e8d8367927a3f924b821cd054048ed9d92471463e51ec6729167f09cd944fc2c92d2e09164c2010b087b6dfa7bf0ad29012f5775361c6658655341b0410d20af78f22a25304fd2d85d62e961b5624a5c8077196ddb17f15e516a95b0500574d4831490a02000205085440890ab57cf018e04cbe2d06f3a91c798e12b83c2df99b058b18d2ab8167dc65b9db875810a82c40f0c829762eca07b31312408e0e34a8b0159be2cad7038a8c24a6d037267874fce747fbdba294b1085d6f98bef48f57a098e29aa0c302000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000097a54d9657dae4764c2262719109840d9c6167557934c6fcbd3e78b15e5a84a7020302000134000000000000000000000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000004030201000c0300000000ca9a3b00000000",
"hash": "4utPKPY528nYqExr5RVQPKrbhwkxvrj16VrK4RJCQ6UJRe41ntWC9XMr5zZfnst2MpdpePA1WnDZ41U8NKGWLjur",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": "2023-07-04T16:35:22.000Z",
"block_number": null
},
"source_stake_authority_pubkey": "ZWmvcfpjRJi12wPv2AaooXFDZtFVeXrk7WuAX5XTntN",
"destination_stake_account_pubkey": "FqLfJw2zXUoiYBUgHjHB5C3LVpFZVxdT6Jfhnsn3jbQv"
},
"protocol": "solana",
"network": "devnet",
"created_at": "2023-07-04T16:32:36.824Z",
"updated_at": "2023-07-04T16:35:47.111Z"
}