Creating An Xtz Staking Request
Basic Description
This endpoint is used to create a Staking Request in Taurus-PROTECT in the Tezos Ecosystem.
To understand what Staking is, please refer to the following page in the Taurus User Guides.
This endpoint would accept a POST Request with a JSON payload containing the Staking Request details.
The fromAddressId
and toBakerAddressId
are the only required parameters that must be included within the JSON payload.
Staking Amount for XTZ
It is important to note that in the Tezos Ecosystem, you are not allowed to select the amount you want to stake. In other words, all the funds within the originating address will be used for the Staking Request.
Prerequisites
Required Roles
Certain API endpoints require that the user has a specific role in order to access them. Roles are used to restrict access to certain functionality within the system and ensure that only authorized users are able to perform specific actions.
Here is the list of required Roles for this particular endpoint:
- RequestCreator
- TPUser
To find out more about roles, please refer to the following page in the Taurus User Guides.
Required Input Parameters
Certain API endpoints require specific input parameters. Here is the list of Required Input Parameters for this particular endpoint:
- fromAddressId : the originating Address
- toBakerAddressId: the destination Baker Address for Staking
Preconditions
It is important to note that the selected Addresses needs to pre-exist and be active in the system. In addition, the originating Address cannot have a zero balance for the Staking Request to succeed.
Call Example
You can find a basic example in cURL below.
Please note that you will need to update the BASEURL
and the APITOKEN
for the command to function.
In this example, Taurus-PROTECT has created a new Staking Request from Address 215326 to Baker Address 1306 and has assigned it a unique ID of 4235099.
export BASEURL=https://taurus-protect-instance.com
export APIToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXh0ZXJuYWxVc2VySUQiOiJ0ZWFtMUV4dGVybmFsVXNlcklEIiwidGVuYW50SUQiOjEsImNhcGl0YWxUZW5hbnRJRCI6MSwiZmlyc3RuYW1lIjoiSm9obiIsImxhc3RuYW1lIjoiRG9lIiwicm9sZXMiOlsidHB1c2VyIl0sImVtYWlsIjoidGVhbTFAYmFuay5jb20iLCJ1c2VybmFtZSI6InRlYW0xIiwiand0X3JlbmV3YWJsZV9hbW91bnQiOjAsImlzX3RvdHBfZW5hYmxlZCI6ZmFsc2UsImF1dGhfc3RhdHVzIjoiU1VDQ0VTUyIsImxhc3RfbG9naW4iOiIyMDIzLTAxLTAxVDAwOjAwOjAwLjE0OTc0NDIzMloiLCJsb2dnZWRfaW5fd2l0aF9zc28iOmZhbHNlLCJrZXkiOiIiLCJleHAiOjE2ODEyMTkyNzYsImlhdCI6MTY4MTIxNzQ3Nn0.K_85arIrigpkN1yHttCydpeT6oVg2c6PyQnuji907Og
curl --location "$BASEURL/api/rest/v1/requests/outgoing/xtz/delegate" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: Bearer $APIToken" \
--data '{
"fromAddressId":"215326",
"toBakerAddressId":"1306"
}'
This piece of code sends a POST request to https://your-protect-instance.example.com/api/rest/v1/requests/outgoing/xtz/delegate with the JSON string in the request body.
Call Result
A successful response for the POST call to create a Staking Request for XTZ might look like this:
{
"result": {
"approvers": {
"parallel": [
{
"sequential": [
{
"externalGroupID": "team1",
"minimumSignatures": 1
}
]
}
]
},
"currency": "XTZ",
"currencyInfo": {
"blockchain": "XTZ",
"coinTypeIndex": "1729",
"decimals": "6",
"displayName": "Tezos - XTZ",
"enabled": true,
"hasStaking": true,
"id": "38fd3c36af0c1de9e1ab4880ac18df83eb0c27be3f08ea60ee0805fdead40547",
"isAccountBased": true,
"name": "Tezos",
"network": "mainnet",
"symbol": "XTZ",
"type": "native"
},
"envelope": "Cgc0MjM1MDk5EJuqsvr3gcStFxgLKvwECA8ScApuCisyMTUzMjY6YzhkN2U4MmYtOTY5YS00ODkwLWFkNzUtYzhlNWE3OGFmNzZiGhVtLzQ0Jy8xNzI5Jy8wJy8wJy8xMScyAig8OiR0ejFkYmZwcExBQXhYWk50ZjJTRHBzN3JjaDNxZlV6bktTb0siFwoKcmVxdWVzdF9pZBABGgc0MjM1MDk5IhsKCXJ1bGVzX2tleRABGgxYVFpfRGVsZWdhdGUiEQoIY3VycmVuY3kQARoDWFRaIh4KDWN1cnJlbmN5X25hbWUQARoLVGV6b3MgLSBYVFoiUQoLY3VycmVuY3lfaWQQARpAMzhmZDNjMzZhZjBjMWRlOWUxYWI0ODgwYWMxOGRmODNlYjBjMjdiZTNmMDhlYTYwZWUwODA1ZmRlYWQ0MDU0NyJfCgZzb3VyY2UQBBpLCAESRwiekg0SJHR6MWFhQTZQYlFUd3l4cW1kTHg2OWFqY0pTb2tpRk5NVThGTRoEdGVzdCIVbS80NCcvMTcyOScvMCcvMCcvMTEnIgZzb3VyY2UiWwoIZGVsZWdhdGUQBRpDCAESPwiaChIkdHoxZGJmcHBMQUF4WFpOdGYyU0RwczdyY2gzcWZVem5LU29LGhRDb2luaG91c2UgLSAxMS4wMS4yMiIIZGVsZWdhdGUiFAoKZ2FzX2xpbWl0cxADGgQKAig8IhQKCmZlZV9saW1pdHMQAxoECgI88CIcChFpc19jYW5jZWxfcmVxdWVzdBABGgVmYWxzZSJCCg90cmFuc2FjdGlvbl9pZHMQBhotCisyMTUzMjY6YzhkN2U4MmYtOTY5YS00ODkwLWFkNzUtYzhlNWE3OGFmNzZiOgdtYWlubmV0",
"id": "4235099",
"rule": "rule = [source: m/44'/1729'/0', delegate: any], approvals = ['team1': 1 sig]",
"status": "CREATED",
"tenantId": "1",
"trails": [
{
"action": "created",
"externalUserId": "[email protected]",
"requestStatus": "CREATED",
"userId": "11"
},
{
"action": "approvers_assigned",
"comment": "rule = [source: m/44'/1729'/0', delegate: any], approvals = ['team1': 1 sig]",
"externalUserId": "[email protected]",
"requestStatus": "CREATED",
"userId": "1"
}
],
"type": "xtz_delegate"
}
}
Taurus-PROTECT responds with a JSON object containing the Staking Request details, including the Request status
and the newly assigned Requestid
.
Requirements for Future Use
For this particular endpoint, we need to store the Requestid
as it will be required in the next step where we will sign the Staking Request.
You can find the Swagger-generated page for this endpoint in the following link.
Updated 22 days ago