Sui
Unified API + Sui Integration Workflow
In the following guide, the integration process for the sui
chain is covered. The Sui integration aligns with the general Unified API process but with network-specific parameters.
Get an authentication token to start using the Unified API.
Request examples are provided using cURL.
To check the integration guides for other chains, refer to the Networks section.
Key Sui-specific details
chain
— always set tosui
for Sui-related requests.network
— environment in which the transaction is processed (testnet
ormainnet
).stakerAddress
— account address initiating staking, unstaking or withdrawal transactions (0x
-prefixed hex).amount
— amount to stake (in MIST, where 1 SUI = 1,000,000,000 MIST).
Staking Flow
1. Create Stake Request
Send a POST request to /api/v1/unified/staking/stake.
Example request (for testnet
network):
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/stake \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "sui",
"network": "testnet",
"stakerAddress": "0xe6c15e4ad58571dcad63aba77c5c03823074642512082ded0e8256ef73c406b6",
"amount": 1000000000
}'
chain
— blockchain network, always set tosui
for Sui-related requests.network
— environment in which the transaction is processed (mainnet
ortestnet
).stakerAddress
— account address initiating the staking transaction (0x
-prefixed hex).amount
— amount of tokens to stake (in MIST).
Example response:
{
"error": null,
"result": {
"amount": 1000,
"stakerAddress": "5DHyW8yCpJEAzFm1jyk5qbNXicd3Dg1tyNAEcPVLjTBCQEgG",
"unsignedTransactionData": "0x550104010208...",
"extraData": {
"targets": ["5G6Zhgm59oujA5UW8wMu4XHFP59uenjC2xp1zshyrWVa638J"],
"rewardDestinationType": "account",
"rewardDestination": "5DHyW8yCpJEAzFm1jyk5qbNXicd3Dg1tyNAEcPVLjTBCQEgG",
"createdAt": "2024-12-19T11:51:03.477Z"
}
}
}
unsignedTransactionData
— unsigned transaction in hex-encoded format. Sign this transaction using your Sui wallet/mnemonic before broadcasting.amount
— amount of tokens to stake (in MIST).stakerAddress
— staking account address.createdAt
— timestamp of the transaction in the ISO 8601 format.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign the transaction using the Sui-specific signing logic.
To broadcast the signed transaction to the Sui network, send a POST request to /api/v1/unified/transaction/broadcast.
Example request:
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/transaction/broadcast \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "sui",
"network": "testnet",
"stakerAddress": "0xe6c15e4ad58571dcad63aba77c5c03823074642512082ded0e8256ef73c406b6",
"signedTransaction": "signature",
"extra": { "unsignedTransaction": "0x000003000800ca9a3b00000000010100000000000000000000000000000000000000000000000000000000000000050100000000000000010020ab4fb3eeaa7b0ab4f91eedab33adf140c6750e60ca5e44b3df82491937d7bab4020200010100000000000000000000000000000000000000000000000000000000000000000000030a7375695f73797374656d11726571756573745f6164645f7374616b6500030101000200000102002c0def86e107ae6ca6a610b4188bb3c2802c30350ac01817be6a02d2a247faf5012a009f3cd4188b8363f5d6a9af5875a0ac663abd1c1bd706be6036d7c51d548d4400001800000000209f43be7aae4cb75d3995057ba075a5cfdc55c3fe6a6cfab5f034309807f5f6072c0def86e107ae6ca6a610b4188bb3c2802c30350ac01817be6a02d2a247faf5e803000000000000809698000000000000" }
}'
chain
— blockchain network.network
— environment in which the transaction is processed.stakerAddress
— account address initiating the transaction.signedTransaction
— signature produced for theunsignedTransactionData
.extra.unsignedTransaction
— original unsigned transaction payload that was signed.
Example response:
{
"error": null,
"result": {
"extraData": {
"transactionDigest": "9ugm8p16MZtDGuMz6uHq7cPJw9GY6mYaZqtyeyx1FJiD"
}
}
}
extraData.transactionDigest
— transaction hash. Use this value to view the transaction in Sui explorers.
Unstaking Flow
1. Create Withdrawal Request
Send a POST request to /api/v1/unified/staking/unstake.
Example request:
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/unstake \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "sui",
"network": "testnet",
"stakerAddress": "0xe6c15e4ad58571dcad63aba77c5c03823074642512082ded0e8256ef73c406b6"
}'
chain
— blockchain network.
network
— environment in which the transaction is processed.
stakerAddress
— account address initiating the withdrawal transaction.
Example response:
{
"error": null,
"result": {
"unsignedTransactionData": "0x000002010100000000000000000000000000000000000000000000000000000000000000050100000000000000010100421468e81f68bcce235e4d95e6bb318d7ed9a7f223edd4080f2c2c7fcc5ea6840f97531a0000000020300486c82d75f9d990e1238453677a9ef0f62104723a5bcbd7a9a300a07c7afc010000000000000000000000000000000000000000000000000000000000000000030a7375695f73797374656d16726571756573745f77697468647261775f7374616b650002010000010100e6c15e4ad58571dcad63aba77c5c03823074642512082ded0e8256ef73c406b601639ace0ef7601462aa3ee0babfccfdbd7972e30cb6b0990546b9678ff347b8fa9c955e1a00000000206fa50de99c02fd418f1df30f18f918f74d165eea343164ac39d98c2dbb1424f9e6c15e4ad58571dcad63aba77c5c03823074642512082ded0e8256ef73c406b6e803000000000000809698000000000000"
}
}
unsignedTransactionData
— unsigned transaction in hex-encoded format. Sign this transaction before broadcasting.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign and send the transaction following the Sui-specific signing logic.
What's Next?
Updated 1 day ago