Withdrawal
The withdrawal process in the TON network using the Staking API can be done following these steps:
- Create an unstake transaction.
- Sign and broadcast the transaction to withdraw staked tokens from the pool.
Please note
For single nominator pools, the unstake transaction could only be performed by the pool owner. It is also crucial to use the wallet version of the pool owner for the unstake request.
1. Create Unstake Transaction
Depending on the type of your staking pool, send a POST request either to /api/v1/ton/{network}/staking/single-nominator/unstake or to /api/v1/ton/{network}/staking/ton-whales/unstake. A special memo message for withdrawal will be created.
Example request (for the single nominator pool in the testnet
network):
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": 200,
"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 nominator pool can perform the transaction, mind specifying the current wallet version of the active pool owner.
Example response:
{
"error": null,
"result": {
"unsignedTransaction": "b5ee9c7241010101003800006b000010000000000000000001000000039fedeab7a2b56b38f19f60b5b9f70b2f1ba2d89b9c5a756036c7cfad73571fb281887735940193456f7e",
"publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
"amount": "2"
}
}
unsignedTransaction
— unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to create an unstake request.publicKey
— public key of the nominator for the TON network.amount
— amount of tokens to unstake in TON.
2. Sign and Broadcast Transaction
Sign and broadcast the unsignedTransaction
to the TON network.
What's Next?
- Getting Started.
- Staking API reference.
Updated 1 day ago