Staking API - Polygon
API AuthenticationClick to view API Authentication details
Authorization
request header or URL
property. Calls are made to one of the Polygon Staking API endpoints found in your app's dashboard. For example:
https://polygon-slate.datahub.figment.io
- Fetch with Header
- Fetch with Parameter
- CURL with Header
- CURL with Parameter
fetch("https://polygon-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://polygon-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://polygon-slate.datahub.figment.io/api/v1/flows' \
--header 'Content-Type: application/json' \
--header 'Authorization: <api_key>' \
--data '{
// JSON Payload
}'
curl -X POST 'https://polygon-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 delegation process, create a new flow with a POST
request to /api/v1/flows
.
{
"id": "10f28009-6752-4405-a67a-b370f51cc196",
"operation": "staking",
"state": "initialized",
"actions": [
{
"name": "assign_staking_data",
"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": {}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "minimum_shares_to_mint",
"display": "Minimum Shares To Mint",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"less_than_or_equal_to": 100,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_address": null,
"amount": null,
"minimum_shares_to_mint": null,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": null,
"delegate_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T17:41:45.248Z",
"updated_at": "2023-03-02T17:41:45.248Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network on which this flow operates (ex.polygon
) (required).chain_code
—string
Chain on which this flow operates (ex.mainnet
,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.assign_staking_data
— provide the funding address, validator contract address, and amount of tokens to be staked. The Staking API will check on-chain to determine if an allowance transaction is needed.delegator_address
— The main wallet from which MATIC will originate.validator_address
— The validator smart contract address for delegation.amount
— The number of MATIC tokens to be delegated.minimum_shares_to_mint
— The minimum number of shares of the delegation pool to be minted. If the exchange rate results in fewer shares being minted, the transaction will fail.max_slippage_percentage
— The maximum slippage you are willing to accept.
data
—object
Delegation flow & transaction data.
Submit Staking 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": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "create_allowance_tx",
"actions": [
{
"name": "create_allowance_tx",
"inputs": [
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in GWEI",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"array": false,
"default_value": null
}
]
},
{
"name": "assign_staking_data",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66"
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "1.0"
},
{
"name": "minimum_shares_to_mint",
"display": "Minimum Shares To Mint",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": 0
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"less_than_or_equal_to": 100,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": null,
"delegate_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:24:18.140Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The delegating address (required).validator_address
—string
The address of the validator smart contract to which you want to delegate your tokens (required).amount
—number
— The amount of MATIC to be delegated (required).minimum_shares_to_mint
—string
The minimum number of shares of the delegation pool to be minted. If the exchange rate results in fewer shares being minted, the transaction will fail (optional).max_slippage_percentage
—number
The maximum slippage you are willing to accept (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_allowance_tx
— If an allowance transaction is needed.create_delegate_tx
— If no further allowance is needed.
data
—object
Delegation flow & transaction data.gas_limit
— The gas limit for the transaction.gas_price
— The highest gas price you will pay for the transaction.
Submit Staking Allowance Data
After collecting the required inputs, send a PUT
request to /api/v1/flows/[:flow_id]/next
to proceed to the next step.
{
"id": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "allowance_tx_signature",
"actions": [
{
"name": "refresh_allowance_tx",
"inputs": [
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in GWEI",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"array": false,
"default_value": null
}
]
},
{
"name": "sign_allowance_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"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_allowance_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
}
]
},
{
"name": "assign_staking_data",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66"
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "1.0"
},
{
"name": "minimum_shares_to_mint",
"display": "Minimum Shares To Mint",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": 0
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"less_than_or_equal_to": 100,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:28:00.947Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
gas_limit
—string
Adjust if you wish to limit the possible transaction fee (optional).gas_price
—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_allowance_tx
— If you need to get a fresh version of the transaction payload.sign_allowance_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Delegation flow & transaction data.
Submit a Signed Allowance 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 Polygon network.
{
"id": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "allowance_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-02T18:45:17.446Z",
"inputs": []
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"signed": "0x02f8b005808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a0a9cac4be7a0c56d6ed520814958b94d4385b1ac7d791485f85c6c58fa53e0d8aa002f14d836c1b5090b12ef16566056abd57e6fce013a759e444d925b8951633ea",
"hash": "0x754e90f50c9b656e469baea0b18bb8221b58170b0fb57556b62d51c60d494af9",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:44:17.076Z"
}
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.allowance_tx_broadcasting
— the transaction has been broadcast but not confirmed.create_delegate_tx
— the transaction has been confirmed, ready for the next step in the flow.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Delegation flow & transaction data.
Submit Delegate Transaction Data
Now that the smart contract allowance is in place, submit a delegation transaction to delegate the MATIC.
{
"id": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "delegate_tx_signature",
"actions": [
{
"name": "refresh_delegate_tx",
"inputs": [
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in GWEI",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"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": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86e05018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c0"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86e05018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c0",
"signing_payload": "0x1032c3301634d32b8da886c67a72346ecb7f9b818e43c5675797233d2e0ecdac",
"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
}
]
},
{
"name": "assign_staking_data",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66"
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "1.0"
},
{
"name": "minimum_shares_to_mint",
"display": "Minimum Shares To Mint",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": 0
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "integer",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"less_than_or_equal_to": 100,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"signed": "0x02f8b005808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a0a9cac4be7a0c56d6ed520814958b94d4385b1ac7d791485f85c6c58fa53e0d8aa002f14d836c1b5090b12ef16566056abd57e6fce013a759e444d925b8951633ea",
"hash": "0x754e90f50c9b656e469baea0b18bb8221b58170b0fb57556b62d51c60d494af9",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": {
"raw": "0x02f86e05018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c0",
"signing_payload": "0x1032c3301634d32b8da886c67a72346ecb7f9b818e43c5675797233d2e0ecdac",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null,
"gas_limit": null,
"gas_price": null
}
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:48:54.349Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
gas_limit
—string
Adjust if you wish to limit the possible transaction fee (optional).gas_price
—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.sign_delegate_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Delegation flow & transaction data.
Submit a 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 Polygon network.
{
"id": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "delegate_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-02T18:54:38.520Z",
"inputs": []
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"signed": "0x02f8b005808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a0a9cac4be7a0c56d6ed520814958b94d4385b1ac7d791485f85c6c58fa53e0d8aa002f14d836c1b5090b12ef16566056abd57e6fce013a759e444d925b8951633ea",
"hash": "0x754e90f50c9b656e469baea0b18bb8221b58170b0fb57556b62d51c60d494af9",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": {
"raw": "0x02f86e05018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c0",
"signing_payload": "0x1032c3301634d32b8da886c67a72346ecb7f9b818e43c5675797233d2e0ecdac",
"signed": "0x02f8b105018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c001a0d296fcf71df637b5642425980baa23ad635e18d8a321791a015a4458c53e3684a01eb9e8493d106997e66d065aa7a914b297bde333d7376c9f0869ce3d5bdc7388",
"hash": "0x6f3321969a9815c7a1274514a03fec5314ac60d1d66674455f8e1e1941f870d4",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
}
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:53:38.135Z"
}
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
— The transaction has been broadcast but not confirmed.completed
— The transaction has been confirmed.
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": "536921d0-d0f3-4887-8177-69c855cbcce3",
"operation": "staking",
"state": "completed",
"actions": [],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86d05808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": "0xd0c61a6d5d143d80f9f1455ec289275a096c65d4bfb89afb981857835c0106a6",
"signed": "0x02f8b005808459682f00850eaa6fba0e82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a0a9cac4be7a0c56d6ed520814958b94d4385b1ac7d791485f85c6c58fa53e0d8aa002f14d836c1b5090b12ef16566056abd57e6fce013a759e444d925b8951633ea",
"hash": "0x754e90f50c9b656e469baea0b18bb8221b58170b0fb57556b62d51c60d494af9",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": {
"raw": "0x02f86e05018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c0",
"signing_payload": "0x1032c3301634d32b8da886c67a72346ecb7f9b818e43c5675797233d2e0ecdac",
"signed": "0x02f8b105018459682f00850a82b48cc683039b269415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c001a0d296fcf71df637b5642425980baa23ad635e18d8a321791a015a4458c53e3684a01eb9e8493d106997e66d065aa7a914b297bde333d7376c9f0869ce3d5bdc7388",
"hash": "0x6f3321969a9815c7a1274514a03fec5314ac60d1d66674455f8e1e1941f870d4",
"status": "confirmed",
"error": null,
"signatures": [],
"block_time": "2023-03-02T18:53:48.000Z",
"gas_limit": null,
"gas_price": null
}
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:53:50.297Z"
}
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
— The transaction has been broadcast but not confirmed.completed
— The transaction has been confirmed.
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": "b46668f2-d6f3-4980-b3ca-c4957bbffd25",
"operation": "unstaking",
"state": "initialized",
"actions": [
{
"name": "create_unbond_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": {}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "max_shares_to_burn",
"display": "Max Shares To Burn",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"greater_than_or_equal_to": 0,
"less_than_or_equal_to": 100
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_address": null,
"amount": null,
"max_shares_to_burn": null,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"unbond_transaction": null,
"claim_transaction": null,
"estimated_unbonded_at": null,
"unbond_checkpoint": null,
"unbond_nonce": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T19:55:55.101Z",
"updated_at": "2023-03-02T19:55:55.101Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network on which this flow operates (ex.polygon
) (required).chain_code
—string
Chain on which this flow operates (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_unbond_tx
— Use this action to unstake MATIC.delegator_address
— The delegator address.validator_address
— The validator contract address from which MATIC will be undelegated.amount
— The amount of MATIC to be undelegated.max_shares_to_burn
— The maximum number of shares of the delegation to be burned. If the exchange rate results in more shares being burned, the transaction will fail.max_slippage_percentage
— The maximum slippage you are willing to accept.gas_limit
— Adjust gas limit for the transaction.gas_price
— Adjust gas price for the transaction.
data
—object
Undelegation flow & transaction data.
Submit Unbonding 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": "b46668f2-d6f3-4980-b3ca-c4957bbffd25",
"operation": "unstaking",
"state": "unbond_tx_signature",
"actions": [
{
"name": "refresh_unbond_tx",
"inputs": [
{
"name": "delegator_address",
"display": "Delegator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
},
{
"name": "validator_address",
"display": "Validator Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66"
},
{
"name": "amount",
"display": "Amount",
"description": "in MATIC",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "numericality",
"options": {
"greater_than": 0
}
}
],
"array": false,
"default_value": "1.0"
},
{
"name": "max_shares_to_burn",
"display": "Max Shares To Burn",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"greater_than_or_equal_to": 0
}
}
],
"array": false,
"default_value": 1000000000000000000
},
{
"name": "max_slippage_percentage",
"display": "Max Slippage Percentage",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_nil": true,
"only_integer": true,
"greater_than_or_equal_to": 0,
"less_than_or_equal_to": 100
}
}
],
"array": false,
"default_value": 0
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"array": false,
"default_value": null
}
]
},
{
"name": "sign_unbond_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86e05028459682f008503a935a902830478739415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed"
],
"transaction_payload": "0x02f86e05028459682f008503a935a902830478739415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": "0x93ebb0e6cdbc4583093448ab562e77c4ae1400e97c4a0fd5177434380e0dd249",
"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_unbond_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": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86e05028459682f008503a935a902830478739415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": "0x93ebb0e6cdbc4583093448ab562e77c4ae1400e97c4a0fd5177434380e0dd249",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"claim_transaction": null,
"estimated_unbonded_at": null,
"unbond_checkpoint": null,
"unbond_nonce": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T19:55:55.101Z",
"updated_at": "2023-03-02T20:01:17.608Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
validator_address
—string
The validator smart contract address from which MATIC will be undelegated (required).delegator_address
—string
The delegator address (required).amount
—number
The amount of MATIC to be undelegated (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_unbond_tx
— If you need to get a fresh version of the transaction payload (i.e., if the nonce needs to be updated).sign_unbond_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Undelegation flow & transaction data.
Submit a Signed Unbonding Transaction for Broadcast
Before broadcasting the transaction, you must sign the transaction_payload
you received in the previous step. After signing the transaction, you will PUT /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Polygon network.
{
"id": "b46668f2-d6f3-4980-b3ca-c4957bbffd25",
"operation": "unstaking",
"state": "unbond_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-03-02T20:08:24.698Z",
"inputs": []
}
],
"data": {
"delegator_address": "0x6BeA1177Ff310983f84D4Fc77b7467a3bD5626ed",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86e05028459682f008503a935a902830478739415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": "0x93ebb0e6cdbc4583093448ab562e77c4ae1400e97c4a0fd5177434380e0dd249",
"signed": "0x02f8b105028459682f008503a935a902830478739415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c001a07834830d929dc56ec6738fff963cca6339a2ca1bf5992aa3bf8025d0d5eb6069a035b4a9d5924392771ba9bad5bab438f9c641e6216b701f0817e3052ef9e2676f",
"hash": "0x8044468813d90c67522d28b86fad5732e7b4b9365f3cb42f6a2186790f447eed",
"status": null,
"error": null,
"signatures": [],
"block_time": null,
"gas_limit": null,
"gas_price": null
},
"claim_transaction": null,
"estimated_unbonded_at": null,
"unbond_checkpoint": null,
"unbond_nonce": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T19:55:55.101Z",
"updated_at": "2023-03-02T20:07:24.352Z"
}
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.unbond_tx_broadcasting
— The transaction has been broadcast and is waiting for confirmation.unbonding
— The 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 Claim Transaction 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": "07d6752c-c412-4cfa-a12c-65feab06acd6",
"state": "claim_tx_signature",
"actions": [
{
"name": "refresh_claim_tx",
"inputs": []
},
{
"name": "sign_claim_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [],
"signers": [
"0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf"
],
"transaction_payload": "0x02f84c05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c0"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"signers": [
"0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf"
],
"transaction_payload": "0x02f84c05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c0",
"signing_payload": null
}
]
}
],
"data": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": null,
"signed": "0x02f8b005028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c001a0f8462149f25c9942852611ea06820bf0b3f588f63aead9702225010b2e80a096a0765feade968806e16f36cadf533d779ceb071f54ca6cf4935f6464302c0873da",
"hash": "0x36c57e119ef341fb23f261a7a44d10d7fe4044ccbcd1b39d509730ee0b75797c",
"status": "confirmed",
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"claim_transaction": {
"raw": "0x02f84c05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c0",
"signing_payload": null,
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"gas_limit": null,
"gas_price": null
},
"estimated_unbonded_at": "2022-10-09T09:25:17.514Z",
"unbond_checkpoint": 78566,
"unbond_nonce": 1
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-10-06T23:40:33.826Z",
"updated_at": "2022-10-11T18:11:23.081Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
gas_limit
—number
Adjust if you wish to limit the possible transaction fee (optional).gas_price
—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_claim_tx
— If you need to get a fresh version of the transaction payload (for example, if the nonce needs to be updated).sign_claim_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Undelegation flow & transaction data.
Submit Signed Claim 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 Polygon network.
{
"id": "07d6752c-c412-4cfa-a12c-65feab06acd6",
"state": "claim_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2022-10-11T18:14:51.766Z",
"inputs": []
}
],
"data": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": null,
"signed": "0x02f8b005028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c001a0f8462149f25c9942852611ea06820bf0b3f588f63aead9702225010b2e80a096a0765feade968806e16f36cadf533d779ceb071f54ca6cf4935f6464302c0873da",
"hash": "0x36c57e119ef341fb23f261a7a44d10d7fe4044ccbcd1b39d509730ee0b75797c",
"status": "confirmed",
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"claim_transaction": {
"raw": "0x02f84c05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c0",
"signing_payload": null,
"signed": "0x02f88f05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c001a0818e02361da6e36a7d0093d385d1f13b0c5e539126023f8a4175ab1a375d0723a0571fabd4f32c978e1b17585f4df52d667ca9bd824204f43db0805a291c635c46",
"hash": "0x5a565cc0002c73655cbf976fa3a04d9b9d20bc196e88f414cbdbdaed70ab7af6",
"status": null,
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"estimated_unbonded_at": "2022-10-09T09:25:17.514Z",
"unbond_checkpoint": 78566,
"unbond_nonce": 1
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-10-06T23:40:33.826Z",
"updated_at": "2022-10-11T18:13:51.472Z"
}
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.claim_tx_broadcasting
— The transaction has been broadcast but not confirmed.done
— The transaction has been confirmed and the rewards have been claimed.
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": "07d6752c-c412-4cfa-a12c-65feab06acd6",
"state": "done",
"actions": [],
"data": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": null,
"signed": "0x02f8b005028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c001a0f8462149f25c9942852611ea06820bf0b3f588f63aead9702225010b2e80a096a0765feade968806e16f36cadf533d779ceb071f54ca6cf4935f6464302c0873da",
"hash": "0x36c57e119ef341fb23f261a7a44d10d7fe4044ccbcd1b39d509730ee0b75797c",
"status": "confirmed",
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"claim_transaction": {
"raw": "0x02f84c05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c0",
"signing_payload": null,
"signed": "0x02f88f05038459682f00849b6d87fe830278519415ed57ca28cbebb58d9c6c62f570046bc089bc6680a4e97fddc20000000000000000000000000000000000000000000000000000000000000001c001a0818e02361da6e36a7d0093d385d1f13b0c5e539126023f8a4175ab1a375d0723a0571fabd4f32c978e1b17585f4df52d667ca9bd824204f43db0805a291c635c46",
"hash": "0x5a565cc0002c73655cbf976fa3a04d9b9d20bc196e88f414cbdbdaed70ab7af6",
"status": null,
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"estimated_unbonded_at": "2022-10-09T09:25:17.514Z",
"unbond_checkpoint": 78566,
"unbond_nonce": 1
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-10-06T23:40:33.826Z",
"updated_at": "2022-10-11T18:13:51.472Z"
}
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.claim_tx_broadcasting
— The transaction has been broadcast but not confirmed.done
— The transaction has been confirmed and the rewards have been claimed.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Undelegation flow & transaction data.
Create New Claim Rewards Flow
To claim the staking rewards with Staking API firstly we need to create a new Flow with POST /api/v1/flows
.
{
"id": "faa0231b-b993-4fc2-9360-0cda96ef415c",
"operation": "claim_rewards",
"state": "initialized",
"actions": [
{
"name": "create_claim_rewards_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": {}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_limit",
"display": "Gas Limit",
"description": "",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"only_integer": true,
"greater_than": 0
}
}
],
"array": false,
"default_value": null
},
{
"name": "gas_price",
"display": "Gas Price",
"description": "in GWEI",
"type": "string",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": true,
"greater_than": 0
}
},
{
"type": "precision",
"options": {
"allow_blank": true,
"max": 9
}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"delegator_address": null,
"validator_address": null,
"claim_rewards_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2023-03-02T19:33:40.360Z",
"updated_at": "2023-03-02T19:33:40.360Z"
}
SpecificationView Specification
Parameters
flow
—object
network_code
—string
Network this flow operates on (ex.polygon
) (required).chain_code
—string
Chain this flow operates on (ex.mainnet
,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_claim_rewards_tx
— Use this action to claim staking rewards.delegator_address
— The address delegating MATIC.validator_address
— The Validator contract address to which MATIC is delegated.gas_limit
— Adjust the gas limit for the claim transaction.gas_price
— Adjust gas price for the claim transaction.
data
—object
Transfer flow & transaction data.
Submit Claim Rewards 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": "07d6752c-c412-4cfa-a12c-65feab06acd6",
"state": "claim_rewards_tx_signature",
"actions": [
{
"name": "refresh_claim_rewards_tx",
"inputs": []
},
{
"name": "sign_claim_rewards_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [],
"signers": [
"0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf"
],
"transaction_payload": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"signers": [
"0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf"
],
"transaction_payload": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": null
}
]
}
],
"data": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"max_shares_to_burn": 1000000000000000000,
"max_slippage_percentage": 0,
"exchange_rate": "100000000000000000000000000000.0",
"exchange_rate_precision": "100000000000000000000000000000.0",
"unbond_transaction": {
"raw": "0x02f86d05028459682f0084597a1b168304cf969415ed57ca28cbebb58d9c6c62f570046bc089bc6680b844c83ec04d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000c0",
"signing_payload": null,
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"gas_limit": null,
"gas_price": null
},
"claim_transaction": null,
"estimated_unbonded_at": null,
"unbond_checkpoint": null,
"unbond_nonce": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-10-06T23:40:33.826Z",
"updated_at": "2022-10-07T17:22:05.511Z"
}
SpecificationView Specification
Parameters
name
—string
Name of the action to execute (required).inputs
—object
delegator_address
—string
The address delegating MATIC (required).validator_address
—string
The Validator contract address to which MATIC are delegated (required).gas_limit
—number
Adjust gas limit for the claim transaction (optional).gas_price
—number
Adjust gas limit for the claim transaction (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_claim_rewards_tx
— If you need to get a fresh version of the transaction payload (for example, if the nonce needs to be updated).sign_claim_rewards_tx
— Submit a signed transaction payload ready to be broadcast to the network.
data
—object
Transfer flow & transaction data.
Submit a 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, you will PUT /api/v1/flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Polygon network.
{
"id": "e6dc662e-f77c-4235-9b28-7141d90c8ab8",
"state": "claim_rewards_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2022-10-07T17:16:44.809Z",
"inputs": []
}
],
"data": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1.0",
"minimum_shares_to_mint": 0,
"max_slippage_percentage": null,
"exchange_rate": null,
"exchange_rate_precision": null,
"allowance_transaction": {
"raw": "0x02f86c05808459682f00845994f6fa82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0",
"signing_payload": null,
"signed": "0x02f8af05808459682f00845994f6fa82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a08019145182b704f15aca2a95242e25abfe9382dd74d0c15e88087978beb476b1a05b4c37b70e316c91e6a19738208e7eae6b79dd2c8ef62aa229f76548490c26b7",
"hash": "0xb71295568a41375014cb4de57ffbdb489f9d81283b3d6647029424d72c176f6d",
"status": null,
"error": null,
"signatures": [],
"gas_limit": null,
"gas_price": null
},
"delegate_transaction": null
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-10-06T22:57:14.491Z",
"updated_at": "2022-10-07T17:15:43.981Z"
}
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.claim_rewards_tx_broadcasting
— the transaction has been broadcast but not confirmed.done
— the transaction has been confirmed and the rewards are claimed.
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": "72a981d4-419b-43c2-92eb-56497f9a23f6",
"state": "done",
"actions": [],
"data": {
"delegator_address": "0xD0D77667f64CAd06a4789497065F2aaF1636Ee31",
"validator_address": "0x0b764b080a67f9019677Ae2c9279F52485Fd4525",
"claim_rewards_transaction": {
"raw": "0x02ec05328459682f008459693e3283024d18940b764b080a67f9019677ae2c9279f52485fd45258084c7b8981cc0",
"signing_payload": null,
"signed": "0x02f86f05328459682f008459693e3283024d18940b764b080a67f9019677ae2c9279f52485fd45258084c7b8981cc080a033ac92a662cfb3c80721dd0d1481511d492da9a608821bee6ef7c0bfa58582ffa06f4015f4f36a7f5874273ea19f6fd81f1c0d8ab952cae2720f5bce1b6f6ac05c",
"hash": "0x0599175dd9e839111c46aaf766fbb8f1821273e53e269a451282e2a12e3b5689",
"status": null,
"error": null,
"signatures": [
{
"account_address": "0xD0D77667f64CAd06a4789497065F2aaF1636Ee31",
"signature": ""
}
],
"gas_limit": null,
"gas_price": null
}
},
"network_code": "polygon",
"chain_code": "testnet",
"created_at": "2022-09-15T13:00:32.982Z",
"updated_at": "2022-09-15T13:10:45.368Z"
}
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.claim_rewards_tx_broadcasting
— the transaction has been broadcast but not confirmed.done
— the transaction has been confirmed and the rewards are claimed.
actions
—array
It includes thename
&inputs
of all next possible actions.data
—object
Transfer flow & transaction data.