I think you have to use the Gateway API like mentioned here: Getting Started
You can make a POST request to the /transaction/build endpoint of a Gateway (for example https://mainnet.radixdlt.com/transaction/build
using cURL or Postman or whatever you prefer) with this syntax: ReDoc Interactive Demo
Stake
It would look like this:
{
"network_identifier": {
"network": "mainnet"
},
"actions": [
{
"type": "StakeTokens",
"from_account": {
"address": "rdx11..."
},
"to_validator": {
"address": "rv1.."
},
"amount": {
"token_identifier": {
"rri": "xrd_rr1qy5wfsfh"
},
"value": "123000000000000000"
}
}
],
"fee_payer": {
"address": "rdx11.."
},
"disable_token_mint_and_burn": true
}
from_account’s address and fee_payer’s address should be the address where you want to delegate XRD from.
Save the response, you’re gonna need unsigned_transaction
and payload_to_sign
outputs.
Then, you have to sign the transaction locally, you can use Stuart’s python script here: How do I locally sign a transaction with a private key?
You have to insert payload_to_sign
in " HASH_OF_BLOB_TO_SIGN
".
Once signed, you should use unsigned_transaction’s output from the POST call and the signed output from Stuart’s script, as mentioned here: Getting Started
You can get your wallet’s public key (to finalize and submit the transaction, step 3) from, again, another of Stuarts scripts here: How to convert a Wallet Address into a Public Key
Unstake
To unstake, only the first POST call changes:
{
"network_identifier": {
"network": "mainnet"
},
"actions": [
{
"type": "UnstakeTokens",
"from_validator": {
"address": "rv1"
},
"to_account": {
"address": "rdx11.."
},
"amount": {
"token_identifier": {
"rri": "xrd_rr1qy5wfsfh"
},
"value": "123000000000000000"
}
}
],
"fee_payer": {
"address": "rdx11.."
},
"disable_token_mint_and_burn": true
}
You can use either amount
like above or unstake_percentage
:
{
"network_identifier": {
"network": "mainnet"
},
"actions": [
{
"type": "UnstakeTokens",
"from_validator": {
"address": "rv1"
},
"to_account": {
"address": "rdx11.."
},
"unstake_percentage": 100
}
],
"fee_payer": {
"address": "rdx11.."
},
"disable_token_mint_and_burn": true
}
Let me know if it helps.