The Staking API's DOT unstaking flow will walk your application through the process of unbonding DOT, and optional processes of chilling and withdrawing. There are a few different routes through this process:

  • Withdraw from delegated account
  • Unbond from the delegated account

Before unbonding:

  • If the user selects the maximum amount and the delegation has active nominators, the account will first be chilled.

After unbonding:

  • If an unbonded entry does not exist, then it is considered rebonded and we are done
  • If there are no funds to withdraw, then it is considered unbonded and we are done
  • If there are funds to withdraw, we proceed to withdraw funds and are done

In the following guide we will illustrate the entire flow from chilling to withdrawing.

Create New Unstaking Flow

To initiate the undelegation process, create a new flow with a POST request to /flows.

From a newly initialized flow you can either jump right to create_withdraw_tx or perform assign_unstaking_data.

If you assign the unstaking data, you may need to create, sign, and broadcast a chill transaction, followed by an unbonding transaction.

After unbonding, you can either be done with the flow, or if there is a balance to withdraw, you can create, sign, and broadcast the withdraw transaction.

URL

https://api.figment.io/flows

Request

  • protocol* : string Protocol this flow operates on (ex. polkadot).
  • network* : string Network this flow operates on (ex. westend).
  • operation* : string The operation to perform (ex. unstaking).
{
  "protocol": "polkadot",
  "network": "westend",
  "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 the name & inputs of all next possible actions.
    • assign_unstaking_data : Use this action if you want to unbond. Chill first if needed. Optionally used to withdraw.
      • stash_account_address : The wallet DOT is bonded to.
      • controller_account_address : The account that controls the staking/unstaking actions. This is the account that will sign transactions.
      • controller_proxy_account_address : A proxy account that can sign on behalf of the controller account.
      • amount : The amount of DOT to be unbonded from the controller. This field should be in full DOT, not in Planck (i.e., if you want to stake 5 DOT, return "amount": 5.0). The Staking API will translate the amount to Plancks so you do not have to worry about the conversion factor.
      • maximum : This boolean indicates if all bonded funds should be unbonded.
    • create_withdraw_tx : Use this action if you want to withdraw without unbonding.
  • data : object Flow & transaction data.
{
  "id": "86d4a5d4-1c75-4c6a-926d-ab930e57f504",
  "state": "initialized",
  "actions": [
    {
      "name": "assign_unstaking_data",
      "inputs": [
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ]
        },
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ]
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": []
        },
        {
          "name": "amount",
          "display": "Amount",
          "description": "",
          "type": "decimal",
          "validations": [
            {
              "type": "presence",
              "options": {
                "unless": "maximum"
              }
            },
            {
              "type": "precision",
              "options": {
                "unless": "maximum",
                "max": 12
              }
            }
          ]
        },
        {
          "name": "maximum",
          "display": "Maximum",
          "description": "",
          "type": "boolean",
          "validations": []
        }
      ]
    },
    {
      "name": "create_withdraw_tx",
      "inputs": [
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ]
        },
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ]
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": []
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": null,
    "controller_proxy_account_address": null,
    "stash_account_address": null,
    "amount": null,
    "maximum": null,
    "chill_transaction": null,
    "estimated_chilled_at": null,
    "unbond_transaction": null,
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2022-10-06T16:15:36.383Z",
  "updated_at": "2022-10-06T16:15:36.383Z"
}

Assign Unstaking Data

After collecting the required Inputs, we PUT /flows/[:flow_id]/next to move on to the next step.

URL

https://api.figment.io/flows/[:flow_id]/next

Request

  • name* : assign_unstaking_data
  • inputs* : object
    • controller_account_address* : string Address of the wallet to which DOT will be bonded.
    • controller_proxy_account_address : string A proxy account that will sign on behalf of the controller account.
    • stash_account_address* : string Primary wallet from which DOT will be bonded.
    • amount* : number The amount of DOT to be bonded to the controller. This field should be in full DOT, not in Planck (ie. if you want to stake 5 DOT, return "amount": 5.0). Staking API will translate the amount to Plancks so you do not have to worry about the conversion factor.
    • maximum : boolean Pass true if you want to unbond the maximum number of tokens.
{
  "name": "assign_unstaking_data",
  "inputs": {
    "stash_account_address": "5GQmooiNwLwjXnsNp3woVDD3xhkHzcifVVAmdWcb6FaRVA4L",
    "controller_account_address": "5GNhcVwpjND83kk6uqMeCjXNUnTSdz84SFyJmd3NmZe4uvrC",
    "maximum": true
  }
}

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 the name & inputs of all next possible actions.
    • create_unbond_tx This action has no inputs.
    • complete This action has no inputs.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "ready_to_unbond",
  "actions": [
    {
      "name": "create_unbond_tx",
      "inputs": []
    },
    {
      "name": "complete",
      "inputs": []
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": null,
    "estimated_chilled_at": null,
    "unbond_transaction": null,
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-02-28T21:09:19.882Z"
}

Notes

  • If chilling is required before unbonding, a chill transaction will automatically be created by the Staking API, and the flow state becomes chill_tx_signature. Proceed to sign and complete a chill transaction: Submit Signed Chill Transaction for Broadcast
  • If no chilling is required, proceed to create an unbond transaction: Create Unbond Transaction

Create Chill Transaction

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

All data is already input so the inputs object is empty: {}

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 the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "chill_tx_signature",
  "actions": [
    {
      "name": "refresh_chill_tx",
      "inputs": []
    },
    {
      "name": "sign_chill_tx",
      "inputs": [
        {
          "name": "transaction_payload",
          "display": "Transaction Payload",
          "description": "",
          "type": "signed_transaction",
          "validations": [
            {
              "type": "sign_payload",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null,
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004"
        },
        {
          "name": "signatures",
          "display": "Signatures",
          "description": "",
          "type": "array_of_signatures",
          "validations": [],
          "array": true,
          "default_value": null,
          "element_type": "signature_data",
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
          "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
          "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_chill_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
        }
      ]
    },
    {
      "name": "assign_unstaking_data",
      "inputs": [
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        },
        {
          "name": "amount",
          "display": "Amount",
          "description": "in DOT",
          "type": "decimal",
          "validations": [
            {
              "type": "presence",
              "options": {
                "unless": "maximum"
              }
            },
            {
              "type": "numericality",
              "options": {
                "unless": "maximum",
                "greater_than": 0
              }
            }
          ],
          "array": false,
          "default_value": "1.0"
        },
        {
          "name": "maximum",
          "display": "Maximum",
          "description": "",
          "type": "boolean",
          "validations": [],
          "array": false,
          "default_value": true
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": null,
      "hash": null,
      "status": null,
      "error": null,
      "signatures": null,
      "block_time": null,
      "block_number": null,
      "proxy": false
    },
    "estimated_chilled_at": null,
    "unbond_transaction": null,
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-02-28T21:09:20.687Z"
}

Submit Signed Chill 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 Polkadot network.

URL

https://api.figment.io/flows/[:flow_id]/next

Request

  • name* : sign_chill_tx
  • inputs* : object
    • transaction_payload* : Signed transaction payload from the previous step's response.
    • signatures : array of object 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_chill_tx",
  "inputs": {
    "transaction_payload": "0x290284009864ac6455584af3c38540ec03927eca126342d266d3c9b62e44b41844a3166601ee8b719a3b17e67a5918ccd7552ec57bfa9f2b1e94ef04121434f1fc10fb413df73dd29b931bb91612e87f6c9c3abaa2bfbb2d6e1a987c08e55d1dcf4edfd78500000006050400f268995cc38974ce0686df1364875f26f2c32b246ddc18835512c3f9969f5836"
  }
}

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.
    • chill_tx_broadcasting : The chill transaction has been broadcast and is awaiting confirmation.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "chill_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-02-28T21:21:04.250Z",
      "inputs": []
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xa1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e67901a80802082aebf10f18f617120553d717c9173f5c453ad4b3d84575f466ce6863f4e09541db117fd8b78cd057433ca5dd64cbe80b845525cbf8d138dd3200508d0004000606",
      "hash": "0x677b522703e763ca44273e69b4633bc38b03ad51dd55fdd169d5986190a8ca44",
      "status": null,
      "error": null,
      "signatures": [],
      "block_time": null,
      "block_number": 14839537,
      "proxy": false
    },
    "estimated_chilled_at": null,
    "unbond_transaction": null,
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-02-28T21:20:04.230Z"
}

Create Unbond Transaction

Now that the account is chilled, submit an unbond transaction to unbond from the stake.
Once again, there are no required inputs for this action.

URL

https://api.figment.io/flows/[:flow_id]/next

Request

  • name* : create_unbond_tx This action has no inputs.
{
  "name": "create_unbond_tx",
  "inputs": {}
}

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 the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "unbond_tx_signature",
  "actions": [
    {
      "name": "refresh_unbond_tx",
      "inputs": []
    },
    {
      "name": "sign_unbond_tx",
      "inputs": [
        {
          "name": "transaction_payload",
          "display": "Transaction Payload",
          "description": "",
          "type": "signed_transaction",
          "validations": [
            {
              "type": "sign_payload",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null,
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004"
        },
        {
          "name": "signatures",
          "display": "Signatures",
          "description": "",
          "type": "array_of_signatures",
          "validations": [],
          "array": true,
          "default_value": null,
          "element_type": "signature_data",
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
          "signing_payload": "0x0602070010a5d4e8000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
          "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_unbond_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
        }
      ]
    },
    {
      "name": "assign_unstaking_data",
      "inputs": [
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        },
        {
          "name": "amount",
          "display": "Amount",
          "description": "in DOT",
          "type": "decimal",
          "validations": [
            {
              "type": "presence",
              "options": {
                "unless": "maximum"
              }
            },
            {
              "type": "numericality",
              "options": {
                "unless": "maximum",
                "greater_than": 0
              }
            }
          ],
          "array": false,
          "default_value": "1.0"
        },
        {
          "name": "maximum",
          "display": "Maximum",
          "description": "",
          "type": "boolean",
          "validations": [],
          "array": false,
          "default_value": true
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xa1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e67901a80802082aebf10f18f617120553d717c9173f5c453ad4b3d84575f466ce6863f4e09541db117fd8b78cd057433ca5dd64cbe80b845525cbf8d138dd3200508d0004000606",
      "hash": "0x677b522703e763ca44273e69b4633bc38b03ad51dd55fdd169d5986190a8ca44",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:20:53.081Z",
      "block_number": 14839540,
      "proxy": false
    },
    "estimated_chilled_at": "2023-02-28T21:25:53.081Z",
    "unbond_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0602070010a5d4e8000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": null,
      "hash": null,
      "status": null,
      "error": null,
      "signatures": null,
      "block_time": null,
      "block_number": null,
      "proxy": false
    },
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-02-28T21:24:44.832Z"
}

Submit Signed Unbond Transaction for Broadcast

Before broadcasting the transaction, you must sign the transaction_payload you received in the previous step. After signing the transaction, you will PUT /flows/[:flow_id]/next and the Staking API will broadcast the transaction to the Polkadot network.

URL

https://api.figment.io/flows/[:flow_id]/next

Request

  • name* : sign_unbond_tx
  • inputs* : object
    • transaction_payload* : Signed transaction payload from the previous step's response.
    • signatures : array of object 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_unbond_tx",
  "inputs": {
    "transaction_payload": "0xb9018400beaa875b14abaeae2d1a55193ba6f175aa846b7e624dce1514fbf043638aa85801ac450cfe75472d098ead17ad661c282f65fabd0547359ced7118c3962b1aba5b6a23f2cd84aa3f09df44811a0ae9cf144be73aec333105e2f18bcdfd00a1e9840018000602070010a5d4e8"
  }
}

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 the name & inputs of all next possible actions.
    • create_withdraw_tx : This proceeds with withdrawing from the account.
    • complete : This will end the flow if we do not want to withdraw funds.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "unbond_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-02-28T21:29:16.900Z",
      "inputs": []
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xa1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e67901a80802082aebf10f18f617120553d717c9173f5c453ad4b3d84575f466ce6863f4e09541db117fd8b78cd057433ca5dd64cbe80b845525cbf8d138dd3200508d0004000606",
      "hash": "0x677b522703e763ca44273e69b4633bc38b03ad51dd55fdd169d5986190a8ca44",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:20:53.081Z",
      "block_number": 14839540,
      "proxy": false
    },
    "estimated_chilled_at": "2023-02-28T21:25:53.081Z",
    "unbond_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0602070010a5d4e8000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xb9018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e6790168ec300920dcc4fc99e920ddffffbee1b07e47d43c28219de8b58222f8e2953e9dda8850f371afefdaf5e32db748136da1d70dec871fdf3baf173cad7537cd800008000602070010a5d4e8",
      "hash": "0x10ed254dfe97bf01b5ca0961cd503f867b5df5b8016a8fee4d090640ccbb6c37",
      "status": null,
      "error": null,
      "signatures": [],
      "block_time": null,
      "block_number": 14839609,
      "proxy": false
    },
    "unbonding_era": null,
    "estimated_unbonded_at": null,
    "withdraw_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-02-28T21:28:16.877Z"
}

Notes

Upon transaction finalization, the unbond transaction will be complete. When the estimated_state_change_at has elapsed for a flow in the unbonding state, you can move on to one of the next steps:

  • If the unbonded entry does not exist in the era, then it is considered rebonded and it moves into the done state.
  • If the unbonded entry does exist and there are no funds to withdraw, it is considered unbonded and it moves into the done state.
  • If the unbonded entry does exist and there are funds to withdraw, it moves into the ready_to_withdraw state. The response indicates two possible actions:
    • create_withdraw_tx : This proceeds with withdrawing from the account.
    • complete : This will end the flow if we do not want to withdraw funds.

Create Withdrawal Transaction

This transaction be created directly from initializing or after the unbonding flow.

When creating this transaction directly after initializing, the inputs will be required for the stash account address, controller account address, and an optional controller proxy account address.
Otherwise, inputs will not be required.

If the information has not been collected:

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_withdraw_tx
  • inputs* : object
    • controller_account_address* : string Address of the wallet DOT will be bonded to (required).
    • controller_proxy_account_address : string A proxy account that will sign on behalf of the controller account.
    • stash_account_address* : string Primary wallet from which DOT will be bonded.
    • amount* : number The amount of DOT to be bonded to the controller. This field should be in full DOT, not in Planck (i.e., if you want to stake 5 DOT, return "amount": 5.0). Staking API will translate the amount to Plancks so you do not have to worry about the conversion factor.
    • maximum : boolean Set this to true if you want to unbond the maximum amount of tokens.
{
  "name": "create_withdraw_tx",
  "inputs": {
    "controller_account_address": "5GNhcVwpjND83kk6uqMeCjXNUnTSdz84SFyJmd3NmZe4uvrC",
    "stash_account_address": "5GQmooiNwLwjXnsNp3woVDD3xhkHzcifVVAmdWcb6FaRVA4L"
  }
}

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 the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "withdraw_tx_signature",
  "actions": [
    {
      "name": "refresh_withdraw_tx",
      "inputs": [
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        }
      ]
    },
    {
      "name": "sign_withdraw_tx",
      "inputs": [
        {
          "name": "transaction_payload",
          "display": "Transaction Payload",
          "description": "",
          "type": "signed_transaction",
          "validations": [
            {
              "type": "sign_payload",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null,
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000603000000001c77657374656e64387061726974792d77657374656e6402000000ae2400000000000044df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0400000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000018ef58a3b67ba7700100000013000000010004"
        },
        {
          "name": "signatures",
          "display": "Signatures",
          "description": "",
          "type": "array_of_signatures",
          "validations": [],
          "array": true,
          "default_value": null,
          "element_type": "signature_data",
          "signers": [
            "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
          ],
          "transaction_payload": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000603000000001c77657374656e64387061726974792d77657374656e6402000000ae2400000000000044df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0400000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000018ef58a3b67ba7700100000013000000010004",
          "signing_payload": "0x060300000000000c00ae24000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
          "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": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xa1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e67901a80802082aebf10f18f617120553d717c9173f5c453ad4b3d84575f466ce6863f4e09541db117fd8b78cd057433ca5dd64cbe80b845525cbf8d138dd3200508d0004000606",
      "hash": "0x677b522703e763ca44273e69b4633bc38b03ad51dd55fdd169d5986190a8ca44",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:20:53.081Z",
      "block_number": 14839540,
      "proxy": false
    },
    "estimated_chilled_at": "2023-02-28T21:25:53.081Z",
    "unbond_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0602070010a5d4e8000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xb9018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e6790168ec300920dcc4fc99e920ddffffbee1b07e47d43c28219de8b58222f8e2953e9dda8850f371afefdaf5e32db748136da1d70dec871fdf3baf173cad7537cd800008000602070010a5d4e8",
      "hash": "0x10ed254dfe97bf01b5ca0961cd503f867b5df5b8016a8fee4d090640ccbb6c37",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:29:26.517Z",
      "block_number": 14839612,
      "proxy": false
    },
    "unbonding_era": 6238,
    "estimated_unbonded_at": "2023-03-01T03:56:45.062Z",
    "withdraw_transaction": {
      "raw": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000603000000001c77657374656e64387061726974792d77657374656e6402000000ae2400000000000044df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0400000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000018ef58a3b67ba7700100000013000000010004",
      "signing_payload": "0x060300000000000c00ae24000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": null,
      "hash": null,
      "status": null,
      "error": null,
      "signatures": null,
      "block_time": null,
      "block_number": null,
      "proxy": false
    }
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-03-01T18:34:30.864Z"
}

Submit Signed Withdrawal Transaction for Broadcast

Before broadcasting the transaction, you must sign the transaction_payload you received in the previous step. AAfter signing the transaction, send a PUT request to /flows/[:flow_id]/next and the Staking API will broadcast the transaction to the Polkadot network.

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 of object 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": "0xb1018400beaa875b14abaeae2d1a55193ba6f175aa846b7e624dce1514fbf043638aa858012e6b1b07390a44705bc2630166187e6e1f0e35616dd51b09a9b4ca9549978237c5ecf39161c3764b06ff8dd79e261ee2b39df4a49d604766519f01e9eecbab85002400060300000000"
  }
}

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 : The transaction has been broadcast and is waiting for confirmation.
    • done : The transaction is complete and the stake has been withdrawn to the specified location.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "6c37da8a-4b69-44db-b0df-6fb9af75f24b",
  "operation": "unstaking",
  "state": "withdraw_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-03-01T18:42:02.544Z",
      "inputs": []
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "maximum": true,
    "chill_transaction": {
      "raw": "0x0004000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e0000000000000000000000000000000000000000000000000000000000000000000000000006061c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0606000400a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xa1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e67901a80802082aebf10f18f617120553d717c9173f5c453ad4b3d84575f466ce6863f4e09541db117fd8b78cd057433ca5dd64cbe80b845525cbf8d138dd3200508d0004000606",
      "hash": "0x677b522703e763ca44273e69b4633bc38b03ad51dd55fdd169d5986190a8ca44",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:20:53.081Z",
      "block_number": 14839540,
      "proxy": false
    },
    "estimated_chilled_at": "2023-02-28T21:25:53.081Z",
    "unbond_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000602070010a5d4e81c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x0602070010a5d4e8000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xb9018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e6790168ec300920dcc4fc99e920ddffffbee1b07e47d43c28219de8b58222f8e2953e9dda8850f371afefdaf5e32db748136da1d70dec871fdf3baf173cad7537cd800008000602070010a5d4e8",
      "hash": "0x10ed254dfe97bf01b5ca0961cd503f867b5df5b8016a8fee4d090640ccbb6c37",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T21:29:26.517Z",
      "block_number": 14839612,
      "proxy": false
    },
    "unbonding_era": 6238,
    "estimated_unbonded_at": "2023-03-01T03:56:45.062Z",
    "withdraw_transaction": {
      "raw": "0x000c000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e000000000000000000000000000000000000000000000000000000000000000000000000000603000000001c77657374656e64387061726974792d77657374656e6402000000ae2400000000000044df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0400000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000018ef58a3b67ba7700100000013000000010004",
      "signing_payload": "0x060300000000000c00ae24000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xb1018400246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679016681c585ae6b459faf8f71cd09e767b5830ff6b35a786f9feb6850cbe71a5d4665fb18ee507e7d6db45fceae016206406e8f210290e23c195cd98e936d5ec28b000c00060300000000",
      "hash": "0x0006ca8c2d684d19db3d275fb5fbd243cffff69f52a9036125f4d521f08bc9e4",
      "status": null,
      "error": null,
      "signatures": [],
      "block_time": null,
      "block_number": 14851755,
      "proxy": false
    }
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T21:04:29.799Z",
  "updated_at": "2023-03-01T18:41:02.512Z"
}

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.
    • withdraw_tx_broadcasting : Transaction has been broadcast and is confirming.
    • done : Withdrawal transaction confirmed.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "90a28f6e-09b4-4fe1-aeb4-c8e3720933ab",
  "operation": "staking",
  "state": "bonding_complete",
  "actions": [
    {
      "name": "create_nomination_tx",
      "inputs": [
        {
          "name": "validator_addresses",
          "display": "Validator Addresses",
          "description": "",
          "type": "array_of_strings",
          "validations": [
            {
              "type": "array",
              "options": {
                "allow_empty": false,
                "allow_duplicates": false
              }
            },
            {
              "type": "length",
              "options": {
                "maximum": 16,
                "message": "Cannot have more than 16 validators"
              }
            }
          ],
          "array": false,
          "default_value": null
        }
      ]
    },
    {
      "name": "create_bond_more_tx",
      "inputs": [
        {
          "name": "amount",
          "display": "Amount",
          "description": "in DOT",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            },
            {
              "type": "numericality",
              "options": {
                "greater_than": 0
              }
            }
          ],
          "array": false,
          "default_value": "1.0"
        }
      ]
    },
    {
      "name": "complete",
      "inputs": []
    },
    {
      "name": "assign_stash_and_controller_account",
      "inputs": [
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        },
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "stash_proxy_account_address",
          "display": "Stash Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "stash_proxy_account_address": null,
    "validator_addresses": null,
    "reward_destination": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "bonding_transaction": {
      "raw": "0x0000000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec7451c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745000000a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xc1028400ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745017e6fb8557959f7c8806aee19a18b54f42336f0f7c814514f66d8fa788b32902722ea6dc1bfe66cf6e402b8f139137900e63e20e72951b780abd3a6d80e640f8b000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745",
      "hash": "0xed90569932c9897bd0defbf763d8e9ab24fd849f9c627a5a50d6d622b3f37449",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T18:42:42.254Z",
      "block_number": 14838035,
      "proxy": false
    },
    "nomination_transaction": null,
    "bond_more_transaction": null
  },
  "protocol": "polkadot",
  "network": "westend",
  "created_at": "2023-02-28T17:41:14.880Z",
  "updated_at": "2023-02-28T18:42:42.261Z"
}