Staking API - NEAR
API AuthenticationClick to view API Authentication details
Authorization
request header or URL
property. Calls are made to one of the Near Staking API endpoints found in your app's dashboard. For example:
https://near-slate.datahub.figment.io
- Fetch with Header
- Fetch with Parameter
- CURL with Header
- CURL with Parameter
fetch("https://near-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://near-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://near-slate.datahub.figment.io/api/v1/flows' \
--header 'Content-Type: application/json' \
--header 'Authorization: <api_key>' \
--data '{
// JSON Payload
}'
curl -X POST 'https://near-slate.datahub.figment.io/apikey/{{apikey}}/api/v1/flows' \
--header 'Content-Type: application/json' \
--data '{
// JSON Payload
}'
Available Methods
Create New Delegation Flow
To initiate the staking process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "aeb7503c-27c8-4184-8537-8f4a77f694a9",
"state": "initialized",
"actions": [
{
"name": "create_delegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "account_balance",
"options": {
"on": "with_on_chain_validations",
"greater_than_or_equal_to": null
}
}
]
},
{
"name": "delegator_pubkey",
"display": "Delegator Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
]
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "is_validator",
"options": {
"on": "with_on_chain_validations"
}
}
]
},
{
"name": "amount",
"display": "Amount",
"description": "",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
]
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "",
"type": "decimal",
"validations": []
}
]
}
],
"data": {
"delegator_address": null,
"delegator_pubkey": null,
"validator_address": null,
"amount": null,
"max_gas": null,
"delegate_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2022-09-26T15:24:43.720Z",
"updated_at": "2022-09-26T15:24:43.720Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.near
) (required).chain_code
—string
Chain this flow operates on (ex.mainnet
) (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 NEAR.validator_address
— Figment validator address.delegator_address
— The delegating address.delegator_pubkey
— The public key of the signing account. Must start withed25519:
.amount
— The amount of NEAR to be delegated.max_gas
— Adjust if you wish to limit the possible transaction fee.
data
—object
Delegation flow & transaction data.
Submit Delegate Data
After creating a new staking flow, submit the staking account data. Collect the required inputs. Send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
{
"id": "11cbb22a-3505-4d9d-aa82-61a9d865dfdd",
"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": "136df0c876f120f3b823754f57dee6064c18a9f9560081d3.testnet"
},
{
"name": "delegator_pubkey",
"display": "Delegator Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "ed25519:46c3btaWiBB2DCieDnQffBN4DixAHU69qYWqNzCBBgsQ"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "legends.pool.f863973.m0"
},
{
"name": "amount",
"display": "Amount",
"description": "in NEAR",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "10.0"
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "in NEAR",
"type": "decimal",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
}
]
},
{
"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": [
"ed25519:46c3btaWiBB2DCieDnQffBN4DixAHU69qYWqNzCBBgsQ"
],
"transaction_payload": "380000003133366466306338373666313230663362383233373534663537646565363036346331386139663935363030383164332e746573746e6574002e0297153490ddde81b8f300b1a96598bc13e5c8c2f0b61d8eaf27ff40db20b741c1d946ab690000170000006c6567656e64732e706f6f6c2e663836333937332e6d3013c8809bd8dc4670762fff3fc5988e682c51f63a60013cba9d8ae6a78722f61d0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"ed25519:46c3btaWiBB2DCieDnQffBN4DixAHU69qYWqNzCBBgsQ"
],
"transaction_payload": "380000003133366466306338373666313230663362383233373534663537646565363036346331386139663935363030383164332e746573746e6574002e0297153490ddde81b8f300b1a96598bc13e5c8c2f0b61d8eaf27ff40db20b741c1d946ab690000170000006c6567656e64732e706f6f6c2e663836333937332e6d3013c8809bd8dc4670762fff3fc5988e682c51f63a60013cba9d8ae6a78722f61d0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000",
"signing_payload": "dd74125fef57262cbe445e13cceb5073873605aa0e6019ce7502c51a3e3cd8bf",
"inputs": {
"input_klass": "Workflows::Signature",
"input_instance": {
"account_address": null,
"signature": null
},
"flow": {
"workflow_state": "delegate_tx_signature",
"id": 3803,
"customer_id": 40,
"chain_id": 7,
"data": {
"delegator_address": "136df0c876f120f3b823754f57dee6064c18a9f9560081d3.testnet",
"delegator_pubkey": "ed25519:46c3btaWiBB2DCieDnQffBN4DixAHU69qYWqNzCBBgsQ",
"validator_address": "legends.pool.f863973.m0",
"amount": "10.0",
"max_gas": null,
"delegate_transaction": {
"raw": "380000003133366466306338373666313230663362383233373534663537646565363036346331386139663935363030383164332e746573746e6574002e0297153490ddde81b8f300b1a96598bc13e5c8c2f0b61d8eaf27ff40db20b741c1d946ab690000170000006c6567656e64732e706f6f6c2e663836333937332e6d3013c8809bd8dc4670762fff3fc5988e682c51f63a60013cba9d8ae6a78722f61d0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000",
"signing_payload": "dd74125fef57262cbe445e13cceb5073873605aa0e6019ce7502c51a3e3cd8bf",
"signed": null,
"hash": "FuTkq5oYo9t8rUoGphpcuE1sEcJzYBU7QQbgY2Ah8L1U",
"status": null,
"error": null,
"signatures": null
}
},
"created_at": "2023-02-24T22:48:42.104Z",
"updated_at": "2023-02-24T22:48:53.366Z",
"id_public": "11cbb22a-3505-4d9d-aa82-61a9d865dfdd",
"supported_operation_id": 20
},
"flow_attributes": {},
"empty_input": {
"account_address": null,
"signature": 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": "136df0c876f120f3b823754f57dee6064c18a9f9560081d3.testnet",
"delegator_pubkey": "ed25519:46c3btaWiBB2DCieDnQffBN4DixAHU69qYWqNzCBBgsQ",
"validator_address": "legends.pool.f863973.m0",
"amount": "10.0",
"max_gas": null,
"delegate_transaction": {
"raw": "380000003133366466306338373666313230663362383233373534663537646565363036346331386139663935363030383164332e746573746e6574002e0297153490ddde81b8f300b1a96598bc13e5c8c2f0b61d8eaf27ff40db20b741c1d946ab690000170000006c6567656e64732e706f6f6c2e663836333937332e6d3013c8809bd8dc4670762fff3fc5988e682c51f63a60013cba9d8ae6a78722f61d0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000",
"signing_payload": "dd74125fef57262cbe445e13cceb5073873605aa0e6019ce7502c51a3e3cd8bf",
"signed": null,
"hash": "FuTkq5oYo9t8rUoGphpcuE1sEcJzYBU7QQbgY2Ah8L1U",
"status": null,
"error": null,
"signatures": null
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-24T22:48:42.104Z",
"updated_at": "2023-02-24T22:48:53.366Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The delegating address (required).delegator_pubkey
—string
The public key of the signing account (required).validator_address
—string
Address of the validator you want to delegate your tokens to (required).amount
—number
— The amount of NEAR to be delegated (required).max_gas
—string
Adjust if you wish to limit the possible transaction fee (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.
data
—object
Delegation 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
with the signed payload. The Staking API will broadcast the transaction to the Ethereum network.
{
"id": "549db585-874f-4b5d-b1a2-67b7d9a3df15",
"state": "delegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-27T17:48:51.908Z",
"inputs": []
}
],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"amount": "10.0",
"max_gas": null,
"delegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa412e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d3060877de2656b98d64e2cecadb55050ee8aa435e81dc657911adc65bb569bf7fb0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000",
"signing_payload": "c9f587150ebf9aa0d8c20510a71574a094224c636a1d40e9c80e13f7d0ed04ea",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa412e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d3060877de2656b98d64e2cecadb55050ee8aa435e81dc657911adc65bb569bf7fb0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000007a3f50c131f084dc733fc56e16c888fc7f42a0e49000e8948065e1663d1f57849788b40dfbabdc1e6734d78f6fe4e7803372a251fb9c9473ca443575102b1303",
"hash": "EbN6QPxd81V8CGViBFMtTjoqnoPV5bH34kyiV5vu9XvH",
"status": null,
"error": null,
"signatures": []
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:46:45.944Z",
"updated_at": "2023-02-27T17:47:51.535Z"
}
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 confirming.delegated
— Transaction has been confirmed and the delegation is active.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Delegation 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": "549db585-874f-4b5d-b1a2-67b7d9a3df15",
"state": "delegated",
"actions": [],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"amount": "10.0",
"max_gas": null,
"delegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa412e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d3060877de2656b98d64e2cecadb55050ee8aa435e81dc657911adc65bb569bf7fb0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000",
"signing_payload": "c9f587150ebf9aa0d8c20510a71574a094224c636a1d40e9c80e13f7d0ed04ea",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa412e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d3060877de2656b98d64e2cecadb55050ee8aa435e81dc657911adc65bb569bf7fb0100000002110000006465706f7369745f616e645f7374616b65020000007b7d00e057eb481b00000000004a480114169545080000000000007a3f50c131f084dc733fc56e16c888fc7f42a0e49000e8948065e1663d1f57849788b40dfbabdc1e6734d78f6fe4e7803372a251fb9c9473ca443575102b1303",
"hash": "EbN6QPxd81V8CGViBFMtTjoqnoPV5bH34kyiV5vu9XvH",
"status": "confirmed",
"error": null,
"signatures": []
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:46:45.944Z",
"updated_at": "2023-02-27T17:48:05.958Z"
}
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 confirming.delegated
— Transaction has been confirmed and the delegation is active.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Delegation flow & transaction data.
Create New Undelegation Flow
To initiate the undelegation process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"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": "delegator_pubkey",
"display": "Delegator Pubkey",
"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": {}
}
],
"array": false,
"default_value": null
},
{
"name": "withdraw_amount",
"display": "Withdraw Amount",
"description": "",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {
"unless": "withdraw_maximum"
}
},
{
"type": "numericality",
"options": {
"unless": "withdraw_maximum",
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "withdraw_maximum",
"display": "Withdraw Maximum",
"description": "",
"type": "boolean",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "in NEAR",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
}
]
},
{
"name": "create_undelegate_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "delegator_pubkey",
"display": "Delegator Pubkey",
"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": {}
}
],
"array": false,
"default_value": null
},
{
"name": "undelegate_amount",
"display": "Undelegate Amount",
"description": "",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {
"unless": "undelegate_maximum"
}
},
{
"type": "numericality",
"options": {
"unless": "undelegate_maximum",
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "undelegate_maximum",
"display": "Undelegate Maximum",
"description": "",
"type": "boolean",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "in NEAR",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"delegator_pubkey": null,
"validator_address": null,
"max_gas": null,
"undelegate_amount": null,
"undelegate_maximum": null,
"undelegate_transaction": null,
"estimated_inactive_at": null,
"withdraw_amount": null,
"withdraw_maximum": null,
"withdraw_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-02-27T17:51:08.550Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.near
) (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 NEAR.delegator_address
— The delegator address.delegator_pubkey
— The public key of the signing account.validator_address
— Validator address from which NEAR will be undelegated.undelegate_amount
— The amount of NEAR to be undelegated.undelegate_maximum
— Set totrue
if you wish to unbond the full delegated balance without needing to know the exact delegated balance.max_gas
— Adjust if you wish to limit the possible transaction fee.
data
—object
Undelegation flow & transaction data.
Submit Undelegate Data
After collecting the required inputs, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
{
"id": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"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": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet"
},
{
"name": "delegator_pubkey",
"display": "Delegator Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "legends.pool.f863973.m0"
},
{
"name": "undelegate_amount",
"display": "Undelegate Amount",
"description": "",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {
"unless": "undelegate_maximum"
}
},
{
"type": "numericality",
"options": {
"unless": "undelegate_maximum",
"greater_than": 0
}
}
],
"array": false,
"default_value": "5.0"
},
{
"name": "undelegate_maximum",
"display": "Undelegate Maximum",
"description": "",
"type": "boolean",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "in NEAR",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
}
]
},
{
"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": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"inputs": {
"input_klass": "Workflows::Signature",
"input_instance": {
"account_address": null,
"signature": null
},
"flow": {
"workflow_state": "undelegate_tx_signature",
"id": 3808,
"customer_id": 40,
"chain_id": 7,
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": null,
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": null,
"error": null,
"signatures": null
},
"estimated_inactive_at": null,
"withdraw_amount": null,
"withdraw_maximum": null,
"withdraw_transaction": null
},
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-02-27T18:01:39.469Z",
"id_public": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"supported_operation_id": 31
},
"flow_attributes": {},
"empty_input": {
"account_address": null,
"signature": 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": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": null,
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": null,
"error": null,
"signatures": null
},
"estimated_inactive_at": null,
"withdraw_amount": null,
"withdraw_maximum": null,
"withdraw_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-02-27T18:01:39.469Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The delegator address (required).delegator_pubkey
—string
The pubkey of the signing account (required).validator_address
—string
Validator address from which NEAR will be undelegated (required).undelegate_amount
—number
The amount of NEAR to be undelegated (required).undelegate_maximum
—boolean
Set totrue
if you wish to unbond the full delegated balance without needing to know the exact delegated balance (optional).max_gas
—null
Adjust if you wish to limit the possible transaction fee (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.
data
—object
Undelegation 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
with the signed payload. The Staking API will broadcast the transaction to the NEAR network
{
"id": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"state": "undelegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-27T18:30:37.767Z",
"inputs": []
}
],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000006be83dd7cd920e48058cad0e8962b5abff1641ec07f0b5dd9e6f218e6f0d783b2f799113d87da39febaabda95e0bfdce07fabfc6583af55525b6a9ef6f9dfb01 ",
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": null,
"error": null,
"signatures": []
},
"estimated_inactive_at": null,
"withdraw_amount": null,
"withdraw_maximum": null,
"withdraw_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-02-27T18:29:37.321Z"
}
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 has been broadcast and is waiting confirmation.cool_down
— Transaction has been confirmed and the delegation is unbonding.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegation 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": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"state": "cool_down",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-01T18:29:48.741Z",
"inputs": []
}
],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000006be83dd7cd920e48058cad0e8962b5abff1641ec07f0b5dd9e6f218e6f0d783b2f799113d87da39febaabda95e0bfdce07fabfc6583af55525b6a9ef6f9dfb01 ",
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": "confirmed",
"error": null,
"signatures": []
},
"estimated_inactive_at": "2023-03-01T18:29:48.741Z",
"withdraw_amount": null,
"withdraw_maximum": null,
"withdraw_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-02-27T18:29:48.743Z"
}
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 has been broadcast and is waiting for confirmation.cool_down
— Transaction has been confirmed and the delegation is unbonding.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegation flow & transaction data.
Submit Withdraw Data
After collecting the required inputs, send a PUT
request to /api/v1/flows/[:flow_id]/next
to move on to the next step.
{
"id": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"operation": "unstaking",
"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": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet"
},
{
"name": "delegator_pubkey",
"display": "Delegator Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "legends.pool.f863973.m0"
},
{
"name": "withdraw_amount",
"display": "Withdraw Amount",
"description": "",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {
"unless": "withdraw_maximum"
}
},
{
"type": "numericality",
"options": {
"unless": "withdraw_maximum",
"greater_than": 0
}
}
],
"array": false,
"default_value": "5.0"
},
{
"name": "withdraw_maximum",
"display": "Withdraw Maximum",
"description": "",
"type": "boolean",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "max_gas",
"display": "Max Gas",
"description": "in NEAR",
"type": "decimal",
"validations": [],
"array": false,
"default_value": null
}
]
},
{
"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": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "3d86e4c351bc002fd7fbdb0686cc872393c87ffe3a4470cb010857bc739d6784",
"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": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000006be83dd7cd920e48058cad0e8962b5abff1641ec07f0b5dd9e6f218e6f0d783b2f799113d87da39febaabda95e0bfdce07fabfc6583af55525b6a9ef6f9dfb01 ",
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": null
},
"estimated_inactive_at": "2023-03-01T18:29:48.741Z",
"withdraw_amount": "5.0",
"withdraw_maximum": null,
"withdraw_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "3d86e4c351bc002fd7fbdb0686cc872393c87ffe3a4470cb010857bc739d6784",
"signed": null,
"hash": "59BAsPfQtJEzaNJghq6HYDhTBupTUvm63FRNdXG447vb",
"status": null,
"error": null,
"signatures": null,
"block_time": null
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-03-01T18:14:38.809Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The delegator address (required).delegator_pubkey
—string
The pubkey of the signing account (required).validator_address
—string
Validator address from which NEAR will be undelegated (required).withdraw_amount
—number
The amount of NEAR to be withdrawn (required).withdraw_maximum
—boolean
Set totrue
if you wish to withdraw the full available balance without needing to know the exact available balance. (optional).max_gas
—number
Adjust if you wish to limit the possible transaction fee (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., if the nonce needs to be updated)sign_withdraw_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Undelegation flow & transaction data.
Submit a Signed Withdraw 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
(as always!) and the Staking API will broadcast the transaction to the NEAR network.
{
"id": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"operation": "unstaking",
"state": "withdraw_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-01T18:23:50.088Z",
"inputs": []
}
],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000006be83dd7cd920e48058cad0e8962b5abff1641ec07f0b5dd9e6f218e6f0d783b2f799113d87da39febaabda95e0bfdce07fabfc6583af55525b6a9ef6f9dfb01 ",
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": null
},
"estimated_inactive_at": "2023-03-01T18:29:48.741Z",
"withdraw_amount": "5.0",
"withdraw_maximum": null,
"withdraw_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "3d86e4c351bc002fd7fbdb0686cc872393c87ffe3a4470cb010857bc739d6784",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000002a6cea608a947eabef4ae001074c91d02ce9ba57247d741d927fa342513b585f243b3cb6a326922cadbd528a6b5e1b2b4ad5f7e1791dc3e5623f01d1e0917c0c",
"hash": "59BAsPfQtJEzaNJghq6HYDhTBupTUvm63FRNdXG447vb",
"status": null,
"error": null,
"signatures": [],
"block_time": null
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-03-01T18:22:49.608Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
transaction_payload
—string
Signed transaction payload from the previous step's response (required).
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.withdrawn
— Transaction has been confirmed and the withdrawal is complete.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegation 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": "4f866b7f-2e79-4c61-9bb4-398777c12a0b",
"operation": "unstaking",
"state": "withdrawn",
"actions": [],
"data": {
"delegator_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"delegator_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"validator_address": "legends.pool.f863973.m0",
"max_gas": null,
"undelegate_amount": "5.0",
"undelegate_maximum": null,
"undelegate_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "ab06236a0916604347fbbfc0c803d374fd28e6eb69f2edce3c2e6ac23e1f0452",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa422e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30f95da7beed58598a6e813c1303a2374028fe6cfe76f467ee656899c7400c640d010000000207000000756e7374616b65260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000006be83dd7cd920e48058cad0e8962b5abff1641ec07f0b5dd9e6f218e6f0d783b2f799113d87da39febaabda95e0bfdce07fabfc6583af55525b6a9ef6f9dfb01 ",
"hash": "CWc9R6SdHVwVHj1rhYiwBgK2sqkVdbBj1wG4QniUXwqT",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": null
},
"estimated_inactive_at": "2023-03-01T18:29:48.741Z",
"withdraw_amount": "5.0",
"withdraw_maximum": null,
"withdraw_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000",
"signing_payload": "3d86e4c351bc002fd7fbdb0686cc872393c87ffe3a4470cb010857bc739d6784",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa442e4c11c36b0000170000006c6567656e64732e706f6f6c2e663836333937332e6d30d7d1c76dbf0debe82e9e8c6a11ecb54be99e1d288ca1993e5071a2c68cdfaeed0100000002080000007769746864726177260000007b22616d6f756e74223a2235303030303030303030303030303030303030303030303030227d00e057eb481b000000000000000000000000000000000000002a6cea608a947eabef4ae001074c91d02ce9ba57247d741d927fa342513b585f243b3cb6a326922cadbd528a6b5e1b2b4ad5f7e1791dc3e5623f01d1e0917c0c",
"hash": "59BAsPfQtJEzaNJghq6HYDhTBupTUvm63FRNdXG447vb",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": "2023-03-01T18:22:50.630Z"
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T17:51:08.550Z",
"updated_at": "2023-03-01T18:23:01.589Z"
}
SpecificationView Specification
Parameters
- None
Response
id
—string
ID of the flow.state
—string
The current state of the flow.withdraw_tx_broadcasting
— Transaction has been broadcast and is waiting for confirmation.withdrawn
— Transaction has been confirmed and the withdrawal is complete.actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegation flow & transaction data.
Create New Transfer Flow
To initiate the transfer process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "79d4a437-e964-4f90-ba19-998d0de8c1cb",
"state": "initialized",
"actions": [
{
"name": "create_transfer_tx",
"inputs": [
{
"name": "from_account_pubkey",
"display": "From Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"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 NEAR",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"from_account_pubkey": null,
"from_account_address": null,
"to_account_address": null,
"amount": null,
"transfer_transaction": null
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T18:35:44.613Z",
"updated_at": "2023-02-27T18:35:44.613Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.near
) (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 NEAR.from_account_address
— The address from which NEAR will be transferred.from_account_pubkey
— The account that will sign the transaction.to_account_address
— The address to which NEAR will be transferred.amount
— The amount of NEAR to be transferred.
data
—object
Transfer flow & transaction data.
Submit Transfer Data
After collecting the required inputs, send a PUT
request to /api/v1/flows/[:flow_id]/next
to move on to the next step.
{
"id": "79d4a437-e964-4f90-ba19-998d0de8c1cb",
"state": "transfer_tx_signature",
"actions": [
{
"name": "refresh_transfer_tx",
"inputs": [
{
"name": "from_account_pubkey",
"display": "From Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
},
{
"name": "from_account_address",
"display": "From Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet"
},
{
"name": "to_account_address",
"display": "To Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "slate-demo.testnet"
},
{
"name": "amount",
"display": "Amount",
"description": "in NEAR",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "50.0"
}
]
},
{
"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": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV"
],
"transaction_payload": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000",
"signing_payload": "87050c63e63a1269228176a458743c99d23ca12ad9c9758a42c10e56799dc8c3",
"inputs": {
"input_klass": "Workflows::Signature",
"input_instance": {
"account_address": null,
"signature": null
},
"flow": {
"workflow_state": "transfer_tx_signature",
"id": 3810,
"customer_id": 40,
"chain_id": 7,
"data": {
"from_account_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"from_account_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"to_account_address": "slate-demo.testnet",
"amount": "50.0",
"transfer_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000",
"signing_payload": "87050c63e63a1269228176a458743c99d23ca12ad9c9758a42c10e56799dc8c3",
"signed": null,
"hash": "A64WEYru3xv7jQsCDn9JV4RYK4frvNWtfAUUMYQmcVLn",
"status": null,
"error": null,
"signatures": null
}
},
"created_at": "2023-02-27T18:35:44.613Z",
"updated_at": "2023-02-27T18:40:29.791Z",
"id_public": "79d4a437-e964-4f90-ba19-998d0de8c1cb",
"supported_operation_id": 19
},
"flow_attributes": {},
"empty_input": {
"account_address": null,
"signature": 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_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"from_account_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"to_account_address": "slate-demo.testnet",
"amount": "50.0",
"transfer_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000",
"signing_payload": "87050c63e63a1269228176a458743c99d23ca12ad9c9758a42c10e56799dc8c3",
"signed": null,
"hash": "A64WEYru3xv7jQsCDn9JV4RYK4frvNWtfAUUMYQmcVLn",
"status": null,
"error": null,
"signatures": null
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T18:35:44.613Z",
"updated_at": "2023-02-27T18:40:29.791Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute -create_transfer_tx
.inputs
—object
from_account_pubkey
—string
The account that will sign the transaction (required).from_account_address
—string
the address which NEAR will be transferred from (required).to_account_address
—string
The address to which NEAR will be transferred (required).amount
—number
The amount of NEAR to be transferred (required).
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_deposit_tx
— If you need to get a fresh version of the transaction payload (i.e., the nonce has increased).sign_deposit_tx
— Submit a signed transaction payload ready to be broadcast to the network.
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
with the signed payload. The Staking API will broadcast the transaction to the NEAR network.
{
"id": "79d4a437-e964-4f90-ba19-998d0de8c1cb",
"state": "transfer_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-27T18:45:13.315Z",
"inputs": []
}
],
"data": {
"from_account_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"from_account_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"to_account_address": "slate-demo.testnet",
"amount": "50.0",
"transfer_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000",
"signing_payload": "87050c63e63a1269228176a458743c99d23ca12ad9c9758a42c10e56799dc8c3",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b2900000000000069cab19548fcac9253ef66fde2853aa46611ac42aeae30d4109fae9a026de1ba67a4c55fe576a019898e8a1b817c93d02779dfd1be63fde390e0bf576cb67404",
"hash": "A64WEYru3xv7jQsCDn9JV4RYK4frvNWtfAUUMYQmcVLn",
"status": null,
"error": null,
"signatures": []
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T18:35:44.613Z",
"updated_at": "2023-02-27T18:44:12.803Z"
}
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 confirmation.transfered
— 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": "79d4a437-e964-4f90-ba19-998d0de8c1cb",
"state": "transfered",
"actions": [],
"data": {
"from_account_pubkey": "ed25519:NUbTcj78nHFFm1J8a1GFjenAnCKV32ZdBeeqem8oyLV",
"from_account_address": "0b81cc09294fc074814ad0de50f31644e5669f856105399b.testnet",
"to_account_address": "slate-demo.testnet",
"amount": "50.0",
"transfer_transaction": {
"raw": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b290000000000",
"signing_payload": "87050c63e63a1269228176a458743c99d23ca12ad9c9758a42c10e56799dc8c3",
"signed": "380000003062383163633039323934666330373438313461643064653530663331363434653536363966383536313035333939622e746573746e657400058065d39e25bf5038afbacc1b7312c5dc3761770626288020d783f8685058aa432e4c11c36b000012000000736c6174652d64656d6f2e746573746e657415143914926d227d21ea635e6ae70a967ad19ad74dd305ac3a556968fd9039170100000003000000726906646ee95b2900000000000069cab19548fcac9253ef66fde2853aa46611ac42aeae30d4109fae9a026de1ba67a4c55fe576a019898e8a1b817c93d02779dfd1be63fde390e0bf576cb67404",
"hash": "A64WEYru3xv7jQsCDn9JV4RYK4frvNWtfAUUMYQmcVLn",
"status": "confirmed",
"error": null,
"signatures": []
}
},
"network_code": "near",
"chain_code": "testnet",
"created_at": "2023-02-27T18:35:44.613Z",
"updated_at": "2023-02-27T18:44:24.567Z"
}
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 confirmation.transfered
— 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.