Creating An Xki Unstaking Request
Basic Description
This endpoint is used to create an Unstaking Request in Taurus-PROTECT in the Kichain Network.
To understand what is a Staking, please refer to the following page in the Taurus User Guides.
This endpoint would accept a POST Request with a JSON payload containing the Unstaking Request details.
The amount
, fromAddressId
, and toValidatorAddressId
are the three required parameters that must be included within the JSON payload.
Staking Amount for XKI
It is important to note that in the Kichain Network, you are allowed to select the amount you want to stake.
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
- amount : the amount you would like to unstake
- toValidatorAddressId : the destination Validator Address used 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 should have already been used for Staking, otherwise the Unstaking Request will fail.
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 Unstaking Request from Address 421142 to Validator Address 1930 with 1 XKI as the specified amount to unstake and has assigned it a unique ID of 4268654.
export BASEURL=https://taurus-protect-instance.com
export APIToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXh0ZXJuYWxVc2VySUQiOiJ0ZWFtMUV4dGVybmFsVXNlcklEIiwidGVuYW50SUQiOjEsImNhcGl0YWxUZW5hbnRJRCI6MSwiZmlyc3RuYW1lIjoiSm9obiIsImxhc3RuYW1lIjoiRG9lIiwicm9sZXMiOlsidHB1c2VyIl0sImVtYWlsIjoidGVhbTFAYmFuay5jb20iLCJ1c2VybmFtZSI6InRlYW0xIiwiand0X3JlbmV3YWJsZV9hbW91bnQiOjAsImlzX3RvdHBfZW5hYmxlZCI6ZmFsc2UsImF1dGhfc3RhdHVzIjoiU1VDQ0VTUyIsImxhc3RfbG9naW4iOiIyMDIzLTAxLTAxVDAwOjAwOjAwLjE0OTc0NDIzMloiLCJsb2dnZWRfaW5fd2l0aF9zc28iOmZhbHNlLCJrZXkiOiIiLCJleHAiOjE2ODEyMTkyNzYsImlhdCI6MTY4MTIxNzQ3Nn0.K_85arIrigpkN1yHttCydpeT6oVg2c6PyQnuji907Og
curl --location "$BASEURL/api/rest/v1/requests/outgoing/cosmos/undelegate" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: Bearer $APIToken" \
--data '{
"fromAddressId": "421142",
"amount": "1000000",
"toValidatorAddressId": "1930"
}'
This piece of code sends a POST request to https://your-protect-instance.example.com/api/rest/v1/requests/outgoing/ftm/undelegate with the JSON string in the request body.
Call Result
A successful response for the POST call to create an Unstaking Request for XKI might look like this:
{
"result": {
"approvers": {
"parallel": [
{
"sequential": [
{
"externalGroupID": "team1",
"minimumSignatures": 1
}
]
}
]
},
"currency": "XKI",
"currencyInfo": {
"blockchain": "Kichain",
"decimals": "6",
"displayName": "Kichain - XKI",
"enabled": true,
"hasStaking": true,
"id": "195d61a493d1b456400d55de1392fb6ee060454caca885371c97a9ad20ff4006",
"isAccountBased": true,
"isToken": true,
"name": "Ki",
"network": "kichain",
"symbol": "XKI",
"type": "token"
},
"envelope": "Cgc0MjY4NjgwEIHpxqmh1c2uFxgSKroKCDQS/QEKYQoJa2ljaGFpbi0yEhkKE20vNDQnLzExOCcvMCcvMCcvMScY9ZsBGLTnDiIEdXhraSoCF7JKKzQ0MTE0Mjo4ODkyYzliNC03MjM2LTQ2YjktYjM1NS04M2IyN2NlMGFjZTESlwEKJS9jb3Ntb3Muc3Rha2luZy52MWJldGExLk1zZ1VuZGVsZWdhdGUSbgopa2kxOGw3cXU2Y2MzdDIwdXh4c3U4dTVyOG5kY2hmeHRnMGc1dThqazkSMGtpdmFsb3BlcjE0ZzR6dGszNnE1Mjl2eDhhc2g3eThocjA0N2tnenhsdnloMmNoNRoPCgR1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kyA0NIRjphCh12YWxpZGF0b3ItY29yZUB0YXVydXNncm91cC5jaBJAxsOUjEvZoFRtMxbnMeJmgHrD2uf3DtjSyUWBE8n5OtNrncsyC+ye6p1/RUKDcxKE3F4tVAcLDgwrPG6zQT4zqiIGYW1vdW50Ih0KEXRvdGFsX2ZpYXRfYW1vdW50EAEaBjAuMDkyMCISCglnYXNfbGltaXQQAhoDA7O0IhMKCWZlZV9kZW5vbRABGgR1eGtpIhEKCWZlZV9saW1pdBACGgJHFiIcChFpc19jYW5jZWxfcmVxdWVzdBABGgVmYWxzZSJCCg90cmFuc2FjdGlvbl9pZHMQBhotCis0NDExNDI6ODg5MmM5YjQtNzIzNi00NmI5LWIzNTUtODNiMjdjZTBhY2UxOgdraWNoYWlu",
"id": "4268680",
"rule": "rule = [source: any, validator: any, amount: 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: any, validator: any, amount: any], approvals = ['team1': 1 sig]",
"externalUserId": "[email protected]",
"requestStatus": "CREATED",
"userId": "1"
}
],
"type": "cosmos_undelegate"
}
}
Taurus-PROTECT responds with a JSON object containing the Unstaking 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 Unstaking Request.
You can find the Swagger-generated page for this endpoint in the following link.
Updated 22 days ago