Staking API - Cosmos
API AuthenticationClick to view API Authentication details
Authorization
request header or URL
property. Calls are made to one of the Cosmos Staking API endpoints found in your app's dashboard. For example:
https://cosmos-slate.datahub.figment.io
- Fetch with Header
- Fetch with Parameter
- CURL with Header
- CURL with Parameter
fetch("https://cosmos-slate.datahub.figment.io/api/v1/flows", {
method: 'POST', // can also be 'GET', 'PUT' or any appropriate method
headers: {
"Authorization" : "<api_key>",
"Content-Type": "application/json" // if method is 'POST'
},
body: JSON.stringify({
// JSON Payload
})
})
fetch("https://cosmos-slate.datahub.figment.io/apikey/{{apikey}}/api/v1/flows", {
method: 'POST', // can also be 'GET', 'PUT' or any appropriate method
headers: {
"Content-Type": "application/json" // if method is 'POST'
},
body: JSON.stringify({
// JSON Payload
})
})
curl -X POST 'https://cosmos-slate.datahub.figment.io/api/v1/flows' \
--header 'Content-Type: application/json' \
--header 'Authorization: <api_key>' \
--data '{
// JSON Payload
}'
curl -X POST 'https://cosmos-slate.datahub.figment.io/apikey/{{apikey}}/api/v1/flows' \
--header 'Content-Type: application/json' \
--data '{
// JSON Payload
}'
Available Methods
Create a New Staking Flow
To initiate the staking process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "1d823c7f-be8a-430e-85cf-7269206cd867",
"operation": "staking",
"state": "initialized",
"actions": [
{
"name": "create_delegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_address": null,
"amount": null,
"memo": null,
"gas_price": null,
"gas_limit": null,
"delegate_transaction": null,
"pubkey": null
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:45:13.156Z",
"updated_at": "2023-02-28T10:45:13.156Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.cosmos
) (required).chain_code
—string
Chain this flow operates on (ex.testnet
) (required).operation
—string
The operation to perform (ex.staking
) (required).version
—string
API version to use (ex.v1
) (optional).
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.create_delegate_tx
— Use this action to generate a delegation transaction to stake your ATOM.delegator_address
— The address from which ATOM will be delegated.validator_address
— The validator address to which ATOM will be delegated.amount
— The amount of ATOM to be delegated.memo
— an optional message to record on-chain with your transaction.gas_limit
— the total amount of gas you're willing to let this transaction consume.- If you do not include this, we'll use a Cosmos library to select a good default for you.
gas_price
— how many ATOM you're willing to pay per unit of gas consumed by this transaction.- If you do not include this, we'll use a Cosmos library to select a good default for you.
pubkey
— Pubkey value will be retrieved from the chain but if you're using a fresh account (that does not have any outgoing activity) then this information is not available and it requires the user to pass it.
data
—object
Staking flow & transaction data.
Submit Delegation Data
After collecting the required inputs, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
{
"id": "1d823c7f-be8a-430e-85cf-7269206cd867",
"operation": "staking",
"state": "delegate_tx_signature",
"actions": [
{
"name": "refresh_delegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": "2.0"
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
}
]
},
{
"name": "sign_delegate_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2232303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2235313037222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323034323434227d2c226d656d6f223a22227d"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2232303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2235313037222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323034323434227d2c226d656d6f223a22227d",
"signing_payload": "31a9a1e09389b219435eaf2b0dcbab6a1d6950d95545564be627f86c7dfed956",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_delegate_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "2.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"delegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2232303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2235313037222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323034323434227d2c226d656d6f223a22227d",
"signing_payload": "31a9a1e09389b219435eaf2b0dcbab6a1d6950d95545564be627f86c7dfed956",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:45:13.156Z",
"updated_at": "2023-02-28T10:50:21.660Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The address from which ATOM will be delegated (required).validator_address
—string
The validator address to which ATOM will be delegated (required).amount
—number
The amount of ATOM to be delegated (required).memo
—string
A message to record on-chain with your transfer (optional).gas_limit
—number
The total amount of gas you're willing to let this transaction consume (optional).gas_price
—number
How many ATOM you're willing to pay per unit of gas consumed by this transaction (optional).pubkey
—string
Required only if you're using a fresh account (that does not have any outgoing activity) else optional.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.refresh_delegate_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_delegate_tx
— Submit a signed transaction payload ready to be broadcast to the network.confirm_delegate_tx_by_hash
— Submit a previously completed transaction hash to continue the flow.
data
—object
Staking flow & transaction data.
Submit Signed Delegate Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the network.
{
"id": "1d823c7f-be8a-430e-85cf-7269206cd867",
"operation": "staking",
"state": "delegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T10:52:20.844Z",
"inputs": []
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "2.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"delegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2232303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2235313037222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323034323434227d2c226d656d6f223a22227d",
"signing_payload": "31a9a1e09389b219435eaf2b0dcbab6a1d6950d95545564be627f86c7dfed956",
"signed": "0aa1010a9e010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c656761746512770a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a100a057561746f6d12073230303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180612130a0d0a057561746f6d12043531303710d4bb0c1a4024d0155b8cf9f5fcacb15859b51fc1d895979fce08043362edacd7763e9b85a84c7e98b7390d3279e6b8d6629f60d67a1e6ae751a3ab9158a5350188aafd1166",
"hash": "09F1F2740CA9265E066299DBCB46DB6AF1A1DAB9CF0764499CFD5D421BB045BA",
"status": null,
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:45:13.156Z",
"updated_at": "2023-02-28T10:51:19.892Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
— Signed transaction payload from the previous step's response.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.delegate_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the delegation is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Staking flow & transaction data.
Get Flow Status
To get the current state of the existing flow, send a GET
request to /api/v1/flows/[:flow_id]
using the flow ID from the previous step.
{
"id": "1d823c7f-be8a-430e-85cf-7269206cd867",
"operation": "staking",
"state": "completed",
"actions": [],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "2.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"delegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2232303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2235313037222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323034323434227d2c226d656d6f223a22227d",
"signing_payload": "31a9a1e09389b219435eaf2b0dcbab6a1d6950d95545564be627f86c7dfed956",
"signed": "0aa1010a9e010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c656761746512770a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a100a057561746f6d12073230303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180612130a0d0a057561746f6d12043531303710d4bb0c1a4024d0155b8cf9f5fcacb15859b51fc1d895979fce08043362edacd7763e9b85a84c7e98b7390d3279e6b8d6629f60d67a1e6ae751a3ab9158a5350188aafd1166",
"hash": "09F1F2740CA9265E066299DBCB46DB6AF1A1DAB9CF0764499CFD5D421BB045BA",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": "2023-02-28T10:51:19.797Z"
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:45:13.156Z",
"updated_at": "2023-02-28T10:51:34.001Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.delegate_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the delegation is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Staking flow & transaction data.
Create a New Transfer Flow
To initiate the transfer process with Staking API, create a new flow with POST /api/v1/flows
.
{
"id": "1ff5d5ce-9716-441f-a197-5c264e16965b",
"operation": "transfer",
"state": "initialized",
"actions": [
{
"name": "create_transfer_tx",
"inputs": [
{
"name": "from_account_address",
"display": "From Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "to_account_address",
"display": "To Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"from_account_address": null,
"to_account_address": null,
"amount": null,
"gas_price": null,
"gas_limit": null,
"memo": null,
"transfer_transaction": null,
"pubkey": null
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:46:05.097Z",
"updated_at": "2023-02-28T11:46:05.097Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.cosmos
) (required).chain_code
—string
Chain this flow operates on (ex.testnet
) (required).operation
—string
The operation to perform (ex.transfer
) (required).version
—string
API version to use (ex.v1
) (optional).
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.create_transfer_tx
— Use this action to transfer ATOM.from_account_address
(required) — The address from which ATOM will be transferred.to_account_address
(required) — The address to which ATOM will be transferred.amount
(required) — The amount of ATOM to be transferred.memo
— an optional message to record on-chain with your transfer.gas_limit
— The total amount of gas you're willing to let this transaction consume.- If you do not include this, we'll use a Cosmos library to select a good default for you.
gas_price
— How many ATOM you're willing to pay per unit of gas consumed by this transaction.- If you do not include this, we'll use a Cosmos library to select a good default for you.
pubkey
— Pubkey value will be retrieved from the chain but if you're using a fresh account (that does not have any outgoing activity) then this information is not available and it requires the user to pass it.
data
—object
Transfer flow & transaction data.
Submit Transfer Data
After creating the new transfer flow, we need to submit the transfer data.
{
"id": "1ff5d5ce-9716-441f-a197-5c264e16965b",
"operation": "transfer",
"state": "transfer_tx_signature",
"actions": [
{
"name": "refresh_transfer_tx",
"inputs": [
{
"name": "from_account_address",
"display": "From Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
},
{
"name": "to_account_address",
"display": "To Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1vxhllask0nynh20htyfkpkfthy7k3395kz8y3c"
},
{
"name": "amount",
"display": "Amount",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": "0.1"
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "in ATOM",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
}
]
},
{
"name": "sign_transfer_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e62616e6b2e763162657461312e4d736753656e64222c2276616c7565223a7b2266726f6d41646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c22746f41646472657373223a22636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a38793363222c22616d6f756e74223a5b7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d5d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2231393637222c2264656e6f6d223a227561746f6d227d5d2c22676173223a223738363535227d2c226d656d6f223a22227d"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e62616e6b2e763162657461312e4d736753656e64222c2276616c7565223a7b2266726f6d41646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c22746f41646472657373223a22636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a38793363222c22616d6f756e74223a5b7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d5d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2231393637222c2264656e6f6d223a227561746f6d227d5d2c22676173223a223738363535227d2c226d656d6f223a22227d",
"signing_payload": "6c90440d3d80a938ec972ec744d87c0f7ecbb155e903737db885e1b71b321e9c",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_transfer_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"from_account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"to_account_address": "cosmos1vxhllask0nynh20htyfkpkfthy7k3395kz8y3c",
"amount": "0.1",
"gas_price": null,
"gas_limit": null,
"memo": "",
"transfer_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e62616e6b2e763162657461312e4d736753656e64222c2276616c7565223a7b2266726f6d41646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c22746f41646472657373223a22636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a38793363222c22616d6f756e74223a5b7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d5d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2231393637222c2264656e6f6d223a227561746f6d227d5d2c22676173223a223738363535227d2c226d656d6f223a22227d",
"signing_payload": "6c90440d3d80a938ec972ec744d87c0f7ecbb155e903737db885e1b71b321e9c",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:46:05.097Z",
"updated_at": "2023-02-28T11:51:00.312Z"
}
SpecificationView Specification
After collecting the required inputs as mentioned below, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
Parameters
name
—string
Name of the action to execute -create_transfer_tx
.inputs
—object
from_account_address
—string
The address from which ATOM will be transferred (required).to_account_address
—string
The address to which ATOM will be transferred (required).amount
—number
The amount of ATOM to be transferred (required).memo
—string
A message to record on-chain with your transfer (optional).gas_limit
—number
The total amount of gas you're willing to let this transaction consume (optional).gas_price
—number
How many ATOM you're willing to pay per unit of gas consumed by this transaction (optional).pubkey
—string
Required only if you're using a fresh account (that does not have any outgoing activity) else optional.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.refresh_transfer_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_transfer_tx
— Submit a signed transaction payload ready to be broadcast to the network.confirm_transfer_tx_by_hash
— Submit a previously completed transaction hash to continue the flow.
data
—object
Transfer flow & transaction data.
Submit Signed Transfer Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the network.
{
"id": "1ff5d5ce-9716-441f-a197-5c264e16965b",
"operation": "transfer",
"state": "transfer_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T11:52:51.637Z",
"inputs": []
}
],
"data": {
"from_account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"to_account_address": "cosmos1vxhllask0nynh20htyfkpkfthy7k3395kz8y3c",
"amount": "0.1",
"gas_price": null,
"gas_limit": null,
"memo": "",
"transfer_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e62616e6b2e763162657461312e4d736753656e64222c2276616c7565223a7b2266726f6d41646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c22746f41646472657373223a22636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a38793363222c22616d6f756e74223a5b7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d5d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2231393637222c2264656e6f6d223a227561746f6d227d5d2c22676173223a223738363535227d2c226d656d6f223a22227d",
"signing_payload": "6c90440d3d80a938ec972ec744d87c0f7ecbb155e903737db885e1b71b321e9c",
"signed": "0a92010a8f010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126f0a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c122d636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a387933631a0f0a057561746f6d120631303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180a12130a0d0a057561746f6d12043139363710bfe6041a408c4cc00ff79d497f98baa639ae673d84d21cda8d82109a93857c7d99cb016881297c6fe2d3b4a9e7328e7f242cb3f0f5abff668a8bde09b7fb8c051c4d287d87",
"hash": "01A6F459A7585A17285ADB953093F6D8EE47A67B4844E39FE192A0AE2E3B71E1",
"status": null,
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:46:05.097Z",
"updated_at": "2023-02-28T11:51:50.689Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
— Signed transaction payload from the previous step's response.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.transfer_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the transfer is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Transfer flow & transaction data.
Get Flow Status
To get the current state of the existing flow, send a GET
request to /api/v1/flows/[:flow_id]
using the flow ID from the previous step.
{
"id": "1ff5d5ce-9716-441f-a197-5c264e16965b",
"operation": "transfer",
"state": "completed",
"actions": [],
"data": {
"from_account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"to_account_address": "cosmos1vxhllask0nynh20htyfkpkfthy7k3395kz8y3c",
"amount": "0.1",
"gas_price": null,
"gas_limit": null,
"memo": "",
"transfer_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e62616e6b2e763162657461312e4d736753656e64222c2276616c7565223a7b2266726f6d41646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c22746f41646472657373223a22636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a38793363222c22616d6f756e74223a5b7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d5d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2231393637222c2264656e6f6d223a227561746f6d227d5d2c22676173223a223738363535227d2c226d656d6f223a22227d",
"signing_payload": "6c90440d3d80a938ec972ec744d87c0f7ecbb155e903737db885e1b71b321e9c",
"signed": "0a92010a8f010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126f0a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c122d636f736d6f73317678686c6c61736b306e796e683230687479666b706b66746879376b333339356b7a387933631a0f0a057561746f6d120631303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180a12130a0d0a057561746f6d12043139363710bfe6041a408c4cc00ff79d497f98baa639ae673d84d21cda8d82109a93857c7d99cb016881297c6fe2d3b4a9e7328e7f242cb3f0f5abff668a8bde09b7fb8c051c4d287d87",
"hash": "01A6F459A7585A17285ADB953093F6D8EE47A67B4844E39FE192A0AE2E3B71E1",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": "2023-02-28T11:51:49.908Z"
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:46:05.097Z",
"updated_at": "2023-02-28T11:52:06.359Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.transfer_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the transfer is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Transfer flow & transaction data.
Create a New Redelegate Flow
To initiate the redelegate process with Staking API, create a new flow with POST /api/v1/flows
.
{
"id": "8fc829e2-9e8a-40aa-8c2d-d6bd9125b7f0",
"operation": "redelegate",
"state": "initialized",
"actions": [
{
"name": "create_redelegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "source_validator_address",
"display": "Source Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": null
},
{
"name": "destination_validator_address",
"display": "Destination Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"source_validator_address": null,
"destination_validator_address": null,
"amount": null,
"memo": null,
"gas_price": null,
"gas_limit": null,
"redelegate_transaction": null,
"pubkey": null
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:55:32.660Z",
"updated_at": "2023-02-28T10:55:32.660Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.cosmos
) (required).chain_code
—string
Chain this flow operates on (ex.testnet
) (required).operation
—string
The operation to perform (ex.redelegate
) (required).version
—string
API version to use (ex.v1
) (optional).
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.create_redelegate_tx
— Use this action to generate a redelegation transaction to stake your ATOM.delegator_address
— The address from which ATOM will be redelegated.source_validator_address
— The validator address from which ATOM will be redelegated.destination_validator_address
— The validator address to which ATOM will be redelegated.amount
— The amount of ATOM to be redelegated.memo
— an optional message to record on-chain with your transaction.gas_limit
— the total amount of gas you're willing to let this transaction consume.- If you do not include this, we'll use a Cosmos library to select a good default for you.
gas_price
— how many ATOM you're willing to pay per unit of gas consumed by this transaction.- If you do not include this, we'll use a Cosmos library to select a good default for you.
pubkey
— Pubkey value will be retrieved from the chain but if you're using a fresh account (that does not have any outgoing activity) then this information is not available and it requires the user to pass it.
data
—object
Redelegate flow & transaction data.
Submit Redelegate Data
After creating the new redelegate flow, we need to submit the redelegate data.
{
"id": "8fc829e2-9e8a-40aa-8c2d-d6bd9125b7f0",
"operation": "redelegate",
"state": "redelegate_tx_signature",
"actions": [
{
"name": "refresh_redelegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
},
{
"name": "source_validator_address",
"display": "Source Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
},
{
"name": "destination_validator_address",
"display": "Destination Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": "cosmosvaloper1t8dv80kdq3t2g88kn8vtyeldvnf8xq5c4sklmx"
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": "0.1"
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
}
]
},
{
"name": "sign_redelegate_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7253726341646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c2276616c696461746f7244737441646472657373223a22636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2239333936222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22333735383232227d2c226d656d6f223a22227d"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7253726341646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c2276616c696461746f7244737441646472657373223a22636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2239333936222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22333735383232227d2c226d656d6f223a22227d",
"signing_payload": "e236c0d65b21f6b03bef964974bb4ba9ca8567405e6077b5fc5510b374005959",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_redelegate_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"source_validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"destination_validator_address": "cosmosvaloper1t8dv80kdq3t2g88kn8vtyeldvnf8xq5c4sklmx",
"amount": "0.1",
"memo": "",
"gas_price": null,
"gas_limit": null,
"redelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7253726341646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c2276616c696461746f7244737441646472657373223a22636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2239333936222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22333735383232227d2c226d656d6f223a22227d",
"signing_payload": "e236c0d65b21f6b03bef964974bb4ba9ca8567405e6077b5fc5510b374005959",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:55:32.660Z",
"updated_at": "2023-02-28T10:59:08.269Z"
}
SpecificationView Specification
After collecting the required inputs as mentioned below, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
Parameters
name
—string
Name of the action to execute -create_redelegate_tx
.inputs
—object
delegator_address
— The address from which ATOM will be redelegated (required).source_validator_address
— The validator address from which ATOM will be redelegated (required).destination_validator_address
— The validator address to which ATOM will be redelegated (required).amount
— The amount of ATOM to be redelegated (required).memo
—string
A message to record on-chain with your transfer (optional).gas_limit
—number
The total amount of gas you're willing to let this transaction consume (optional).gas_price
—number
How many ATOM you're willing to pay per unit of gas consumed by this transaction (optional).pubkey
—string
Required only if you're using a fresh account (that does not have any outgoing activity) else optional.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.refresh_redelegate_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_redelegate_tx
— Submit a signed transaction payload ready to be broadcast to the network.confirm_redelegate_tx_by_hash
— Submit a previously completed transaction hash to continue the flow.
data
—object
Redelegate flow & transaction data.
Submit Signed Redelegate Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the network.
{
"id": "8fc829e2-9e8a-40aa-8c2d-d6bd9125b7f0",
"operation": "redelegate",
"state": "redelegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T11:01:06.749Z",
"inputs": []
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"source_validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"destination_validator_address": "cosmosvaloper1t8dv80kdq3t2g88kn8vtyeldvnf8xq5c4sklmx",
"amount": "0.1",
"memo": "",
"gas_price": null,
"gas_limit": null,
"redelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7253726341646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c2276616c696461746f7244737441646472657373223a22636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2239333936222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22333735383232227d2c226d656d6f223a22227d",
"signing_payload": "e236c0d65b21f6b03bef964974bb4ba9ca8567405e6077b5fc5510b374005959",
"signed": "0ade010adb010a2a2f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c656761746512ac010a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a34636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78220f0a057561746f6d120631303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180712130a0d0a057561746f6d120439333936108ef8161a403d2b1b5f20403b842956a306f160484ed39ed091e624ada428a18fa630c6e9e551e20f0cd85649db0bad28e2fbfc608b837e33c1b3ceeac6fd5e798f2e286eb1",
"hash": "DFA204ACBEF03A3B3F2EAAAD98C55F14B0DFCD0425B1ECD3424CCFB0687026CB",
"status": null,
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": null
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:55:32.660Z",
"updated_at": "2023-02-28T11:00:05.766Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
— Signed transaction payload from the previous step's response.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.redelegate_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the redelegation is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Redelegate flow & transaction data.
Get Flow Status
To get the current state of the existing flow, send a GET
request to /api/v1/flows/[:flow_id]
using the flow ID from the previous step.
{
"id": "8fc829e2-9e8a-40aa-8c2d-d6bd9125b7f0",
"operation": "redelegate",
"state": "completed",
"actions": [],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"source_validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"destination_validator_address": "cosmosvaloper1t8dv80kdq3t2g88kn8vtyeldvnf8xq5c4sklmx",
"amount": "0.1",
"memo": "",
"gas_price": null,
"gas_limit": null,
"redelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7253726341646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c2276616c696461746f7244737441646472657373223a22636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a22313030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2239333936222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22333735383232227d2c226d656d6f223a22227d",
"signing_payload": "e236c0d65b21f6b03bef964974bb4ba9ca8567405e6077b5fc5510b374005959",
"signed": "0ade010adb010a2a2f636f736d6f732e7374616b696e672e763162657461312e4d7367426567696e526564656c656761746512ac010a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a34636f736d6f7376616c6f706572317438647638306b64713374326738386b6e38767479656c64766e66387871356334736b6c6d78220f0a057561746f6d120631303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180712130a0d0a057561746f6d120439333936108ef8161a403d2b1b5f20403b842956a306f160484ed39ed091e624ada428a18fa630c6e9e551e20f0cd85649db0bad28e2fbfc608b837e33c1b3ceeac6fd5e798f2e286eb1",
"hash": "DFA204ACBEF03A3B3F2EAAAD98C55F14B0DFCD0425B1ECD3424CCFB0687026CB",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": "2023-02-28T11:00:03.394Z"
},
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T10:55:32.660Z",
"updated_at": "2023-02-28T11:00:19.289Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.redelegate_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and the redelegation is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Redelegate flow & transaction data.
Create a New Undelegate Flow
To initiate the unstaking process with Staking API, create a new flow with POST /api/v1/flows
.
{
"id": "f624c185-afb0-46d5-aa63-4d7649a2690a",
"operation": "unstaking",
"state": "initialized",
"actions": [
{
"name": "create_undelegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_address": null,
"amount": null,
"memo": null,
"gas_price": null,
"gas_limit": null,
"undelegate_transaction": null,
"estimated_unbonded_at": null,
"pubkey": null
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:02:24.657Z",
"updated_at": "2023-02-28T11:02:24.657Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.cosmos
) (required).chain_code
—string
Chain this flow operates on (ex.testnet
) (required).operation
—string
The operation to perform (ex.unstaking
) (required).version
—string
API version to use (ex.v1
) (optional).
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.create_undelegate_tx
— Use this action to generate an undelegation transaction to unstake your ATOM.delegator_address
— The address from which ATOM was delegated.validator_address
— The validator address from which ATOM will be undelegated.amount
— The amount of ATOM to be undelegated.memo
— an optional message to record on-chain with your transaction.gas_limit
— the total amount of gas you're willing to let this transaction consume.- If you do not include this, we'll use a Cosmos library to select a good default for you.
gas_price
— how many ATOM you're willing to pay per unit of gas consumed by this transaction.- If you do not include this, we'll use a Cosmos library to select a good default for you.
pubkey
— Pubkey value will be retrieved from the chain but if you're using a fresh account (that does not have any outgoing activity) then this information is not available and it requires the user to pass it.
data
—object
Undelegate flow & transaction data.
Submit Undelegate Data
After creating the new undelegation flow, we need to submit the undelegate data.
{
"id": "f624c185-afb0-46d5-aa63-4d7649a2690a",
"operation": "unstaking",
"state": "undelegate_tx_signature",
"actions": [
{
"name": "refresh_undelegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "presence",
"options": {}
},
{
"type": "format",
"options": {
"with": "(?-mix:\\Acosmosvaloper.*)",
"message": "should start with `cosmosvaloper`"
}
}
],
"array": false,
"default_value": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": "1.0"
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "Value will be retrieved from the chain if available",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
}
]
},
{
"name": "sign_undelegate_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2231303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2236323937222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323531383435227d2c226d656d6f223a22227d"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2231303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2236323937222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323531383435227d2c226d656d6f223a22227d",
"signing_payload": "53ff624a7b8fb60956f3d88d249ff95e14202fe7185262802141cb3496a2e208",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_undelegate_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "1.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"undelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2231303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2236323937222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323531383435227d2c226d656d6f223a22227d",
"signing_payload": "53ff624a7b8fb60956f3d88d249ff95e14202fe7185262802141cb3496a2e208",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null,
"block_number": null
},
"estimated_unbonded_at": null,
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:02:24.657Z",
"updated_at": "2023-02-28T11:20:48.379Z"
}
SpecificationView Specification
After collecting the required inputs as mentioned below, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
Parameters
name
—string
Name of the action to execute -create_undelegate_tx
.inputs
—object
delegator_address
—string
The address from which ATOM was delegated (required).validator_address
—string
The validator address from which ATOM will be undelegated (required).amount
—number
The amount of ATOM to be undelegated (required).memo
—string
A message to record on-chain with your transfer (optional).gas_limit
—number
The total amount of gas you're willing to let this transaction consume (optional).gas_price
—number
How many ATOM you're willing to pay per unit of gas consumed by this transaction (optional).pubkey
—string
Required only if you're using a fresh account (that does not have any outgoing activity) else optional.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.refresh_undelegate_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_undelegate_tx
— Submit a signed transaction payload ready to be broadcast to the network.confirm_undelegate_tx_by_hash
— Submit a previously completed transaction hash to continue the flow.
data
—object
Undelegate flow & transaction data.
Submit Signed Undelegate Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the network.
{
"id": "f624c185-afb0-46d5-aa63-4d7649a2690a",
"operation": "unstaking",
"state": "undelegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T11:22:30.864Z",
"inputs": []
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "1.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"undelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2231303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2236323937222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323531383435227d2c226d656d6f223a22227d",
"signing_payload": "53ff624a7b8fb60956f3d88d249ff95e14202fe7185262802141cb3496a2e208",
"signed": "0aa3010aa0010a252f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c656761746512770a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a100a057561746f6d12073130303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180812130a0d0a057561746f6d12043632393710c5af0f1a4025126da1bb487a6a0e54081c6cde716f169b3c1e22247f147cf2d5eb244d189b220528ae3de60c2f04db07435eb893deb263fb315c00e238450c03221a53932e",
"hash": "C69560EAF192B82A6826972205A049CF80FF327E62737A246DEC4BC26EF4F6A2",
"status": null,
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": null,
"block_number": null
},
"estimated_unbonded_at": null,
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:02:24.657Z",
"updated_at": "2023-02-28T11:21:30.105Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
— Signed transaction payload from the previous step's response.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.undelegate_tx_broadcasting
— Transaction broadcasting and waiting for confirmation.unbonding
— Transaction successfully broadcasted and stake is under unbonding period.completed
— Unbonding period is over and tokens are successfully unstake.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegate flow & transaction data.
Get Flow Status
To get the current state of the existing flow, send a GET
request to /api/v1/flows/[:flow_id]
using the flow ID from the previous step.
{
"id": "f624c185-afb0-46d5-aa63-4d7649a2690a",
"operation": "unstaking",
"state": "completed",
"actions": [],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_address": "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3",
"amount": "1.0",
"memo": "",
"gas_price": null,
"gas_limit": null,
"undelegate_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533222c22616d6f756e74223a7b2264656e6f6d223a227561746f6d222c22616d6f756e74223a2231303030303030227d7d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2236323937222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22323531383435227d2c226d656d6f223a22227d",
"signing_payload": "53ff624a7b8fb60956f3d88d249ff95e14202fe7185262802141cb3496a2e208",
"signed": "0aa3010aa0010a252f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c656761746512770a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a3665657465331a100a057561746f6d12073130303030303012670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180812130a0d0a057561746f6d12043632393710c5af0f1a4025126da1bb487a6a0e54081c6cde716f169b3c1e22247f147cf2d5eb244d189b220528ae3de60c2f04db07435eb893deb263fb315c00e238450c03221a53932e",
"hash": "C69560EAF192B82A6826972205A049CF80FF327E62737A246DEC4BC26EF4F6A2",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": "2023-02-28T11:21:47.830Z",
"block_number": 14790440
},
"estimated_unbonded_at": "2023-03-02T11:21:30.000Z",
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:02:24.657Z",
"updated_at": "2023-02-28T11:21:48.108Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.undelegate_tx_broadcasting
— Transaction broadcasting and waiting for confirmation.unbonding
— Transaction successfully broadcasted and stake is under unbonding period.completed
— Unbonding period is over and tokens are successfully unstake.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Transfer flow & transaction data.
Create a New Claim Rewards Flow
To initiate the rewards claim process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "15a26af4-6c71-4d6a-9dc5-934ebdb095c7",
"operation": "claim_rewards",
"state": "initialized",
"actions": [
{
"name": "create_withdraw_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "validator_addresses",
"display": "Validator Addresses",
"description": "",
"type": "array_of_strings",
"validations": [
{
"type": "array",
"options": {
"allow_empty": true,
"allow_duplicates": false
}
}
],
"array": false,
"default_value": null
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "account_number",
"display": "Account Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_addresses": null,
"memo": null,
"gas_price": null,
"gas_limit": null,
"pubkey": null,
"withdraw_transaction": null
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:39:46.810Z",
"updated_at": "2023-02-28T11:39:46.810Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.cosmos
) (required).chain_code
—string
Chain this flow operates on (ex.testnet
) (required).operation
—string
The operation to perform (ex.claim_rewards
) (required).version
—string
API version to use (ex.v1
) (optional).
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.create_withdraw_tx
— Use this action to transfer ATOM.delegator_address
— The address from which ATOM was delegated.validator_addresses
— Validator addresses from which staking rewards to be withdrawn.memo
— an optional message to record on-chain with your transaction.gas_limit
— the total amount of gas you're willing to let this transaction consume.- If you do not include this, we'll use a Cosmos library to select a good default for you.
gas_price
— how many ATOM you're willing to pay per unit of gas consumed by this transaction.- If you do not include this, we'll use a Cosmos library to select a good default for you.
pubkey
— Pubkey value will be retrieved from the chain but if you're using a fresh account (that does not have any outgoing activity) then this information is not available and it requires the user to pass it.
data
—object
Claim rewards flow & transaction data.
Submit Claim Rewards Data
After creating the new claim rewards flow, we need to submit the claim rewards data.
{
"id": "15a26af4-6c71-4d6a-9dc5-934ebdb095c7",
"operation": "claim_rewards",
"state": "withdraw_tx_signature",
"actions": [
{
"name": "refresh_withdraw_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
},
{
"name": "validator_addresses",
"display": "Validator Addresses",
"description": "",
"type": "array_of_strings",
"validations": [
{
"type": "array",
"options": {
"allow_empty": true,
"allow_duplicates": false
}
}
],
"array": false,
"default_value": [
"cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
]
},
{
"name": "memo",
"display": "Memo",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "account_number",
"display": "Account Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "pubkey",
"display": "Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235"
}
]
},
{
"name": "sign_withdraw_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f72526577617264222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533227d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2233353931222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22313433363331227d2c226d656d6f223a22227d"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl"
],
"transaction_payload": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f72526577617264222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533227d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2233353931222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22313433363331227d2c226d656d6f223a22227d",
"signing_payload": "c67009f9018391e00842e4b793a2bb5e02b0f27713010960071a28356b30b0d7",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_withdraw_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_addresses": [
"cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
],
"memo": "",
"gas_price": null,
"gas_limit": null,
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235",
"withdraw_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f72526577617264222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533227d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2233353931222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22313433363331227d2c226d656d6f223a22227d",
"signing_payload": "c67009f9018391e00842e4b793a2bb5e02b0f27713010960071a28356b30b0d7",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
}
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:39:46.810Z",
"updated_at": "2023-02-28T11:41:23.208Z"
}
SpecificationView Specification
After collecting the required inputs as mentioned below, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
Parameters
name
—string
Name of the action to execute -create_withdraw_tx
.inputs
—object
delegator_address
— The address from which ATOM was delegated (required).validator_addresses
— Validator addresses from which staking rewards to be withdrawn (required).memo
—string
A message to record on-chain with your transfer (optional).gas_limit
—number
The total amount of gas you're willing to let this transaction consume (optional).gas_price
—number
How many ATOM you're willing to pay per unit of gas consumed by this transaction (optional).pubkey
—string
Required only if you're using a fresh account (that does not have any outgoing activity) else optional.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.actions
—array
It includes thename
&inputs
of all next possible actions.refresh_withdraw_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_withdraw_tx
— Submit a signed transaction payload ready to be broadcast to the network.confirm_withdraw_tx_by_hash
— Submit a previously completed transaction hash to continue the flow.
data
—object
Claim rewards flow & transaction data.
Submit Signed Claim Rewards Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, send a PUT
request to /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the network.
{
"id": "15a26af4-6c71-4d6a-9dc5-934ebdb095c7",
"operation": "claim_rewards",
"state": "withdraw_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T11:43:16.888Z",
"inputs": []
}
],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_addresses": [
"cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
],
"memo": "",
"gas_price": null,
"gas_limit": null,
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235",
"withdraw_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f72526577617264222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533227d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2233353931222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22313433363331227d2c226d656d6f223a22227d",
"signing_payload": "c67009f9018391e00842e4b793a2bb5e02b0f27713010960071a28356b30b0d7",
"signed": "0aa3010aa0010a372f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f7252657761726412650a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a36656574653312670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180912130a0d0a057561746f6d120433353931108fe2081a400f39e63b287138ece0e3d78f4bf8bfeb95b354191abc3545c61f78d1009083880648187192980f87aadfb94bb82f97ff9a5ba6b3d99fc38eb1adbdec2e12e3e4",
"hash": "62FBD6133C846A747E58983757545E301CF69D5916A65DC7C9CA755B455B605C",
"status": null,
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": null
}
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:39:46.810Z",
"updated_at": "2023-02-28T11:42:16.132Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
— Signed transaction payload from the previous step's response.
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.withdraw_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and rewards claimed successfully.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Claim rewards flow & transaction data.
Get Flow Status
To get the current state of the existing flow, send a GET
request to /api/v1/flows/[:flow_id]
using the flow ID from the previous step.
{
"id": "15a26af4-6c71-4d6a-9dc5-934ebdb095c7",
"operation": "claim_rewards",
"state": "completed",
"actions": [],
"data": {
"delegator_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"validator_addresses": [
"cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"
],
"memo": "",
"gas_price": null,
"gas_limit": null,
"pubkey": "02db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe235",
"withdraw_transaction": {
"raw": "7b226d65737361676573223a5b7b227479706555726c223a222f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f72526577617264222c2276616c7565223a7b2264656c656761746f7241646472657373223a22636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c222c2276616c696461746f7241646472657373223a22636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a366565746533227d7d5d2c22666565223a7b22616d6f756e74223a5b7b22616d6f756e74223a2233353931222c2264656e6f6d223a227561746f6d227d5d2c22676173223a22313433363331227d2c226d656d6f223a22227d",
"signing_payload": "c67009f9018391e00842e4b793a2bb5e02b0f27713010960071a28356b30b0d7",
"signed": "0aa3010aa0010a372f636f736d6f732e646973747269627574696f6e2e763162657461312e4d7367576974686472617744656c656761746f7252657761726412650a2d636f736d6f733175383575706b3276377072363567307776323937367a6c6575367638716a6c39717072767a6c1234636f736d6f7376616c6f7065723174666c6b33306d71357667716a646c7939326b6b686871337261657632686e7a36656574653312670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2102db33d72ee215f1a61e5f4ffa098b9325cc1da6f5c3557974ad0f21a5ec9fe23512040a020801180912130a0d0a057561746f6d120433353931108fe2081a400f39e63b287138ece0e3d78f4bf8bfeb95b354191abc3545c61f78d1009083880648187192980f87aadfb94bb82f97ff9a5ba6b3d99fc38eb1adbdec2e12e3e4",
"hash": "62FBD6133C846A747E58983757545E301CF69D5916A65DC7C9CA755B455B605C",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "cosmos1u85upk2v7pr65g0wv2976zleu6v8qjl9qprvzl",
"signature": ""
}
],
"block_time": "2023-02-28T11:42:14.902Z"
}
},
"network_code": "cosmos",
"chain_code": "testnet",
"created_at": "2023-02-28T11:39:46.810Z",
"updated_at": "2023-02-28T11:42:26.556Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.operation
—string
The Staking API operation being performed by this flow.state
—string
The current state of the flow.withdraw_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.completed
— Transaction has been confirmed and rewards claimed successfully.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Claim rewards flow & transaction data.