Withdrawal

The withdrawal process in the TON network using the Staking API can be done following these steps:

  1. Create an unstake transaction.
  2. Sign and broadcast the transaction to withdraw staked tokens from the pool.

🚧

Please note

The unstake transaction could only be performed by the single nominator pool owner. It is also crucial to use for the request the wallet version of the pool owner.


To create an unstake transaction:

  1. Send a POST request to /api/v1/ton/{network}/staking/single-nominator/unstake to create a special memo message for withdrawal.

    Example request (for testnet):

    curl --request POST \
      --url https://api.p2p.org/api/v1/ton/testnet/staking/single-nominator/unstake \
      --header 'accept: application/json' \
      --header 'authorization: Bearer <token>' \
      --header 'content-type: application/json' \
      --data '
    {
      "publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
      "amount": 1,
      "walletVersion": "V4"
    }
    
    • publicKey — public key of the nominator for the TON network.
    • amount — amount of tokens to unstake in TON.
    • walletVersion — version of the smart contract used by the wallet in the TON blockchain. V4 is used by default.

    Since only an owner of the single pool can perform the transaction, mind specifying the wallet version of the current active pool owner.

    Example response:

    {
      "error": null,
      "result": {
        "unsignedTransaction": "b5ee9c7241010101003800006b000010000000000000000001000000039fedeab7a2b56b38f19f60b5b9f70b2f1ba2d89b9c5a756036c7cfad73571fb281887735940193456f7e",
        "seqno": 4,
        "nominatorPoolAddress": "",
        "stakerAddress": "",
        "publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
        "amount": "1"
      }
    }
    
    • unsignedTransaction — unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to create an unstake request.
    • seqno — sequence number of the masterchain block.
    • nominatorPoolAddress — Single Nominator Pool address.
    • stakerAddress — main account address of the bounceable type which keeps tokens.
    • publicKey — public key of the nominator for the TON network.
    • amount — amount of tokens to unstake in TON.
  2. Sign and broadcast the unsignedTransaction to the TON network.

What's Next?