Staking MATIC tokens happens on the Ethereum network (not the Polygon network), and requires two steps:
- Allowance Transaction: This approves sending a specific amount of MATIC tokens to a staking contract on Ethereum.
- Delegation Transaction: This delegates MATIC to a specific validator via its associated smart contract. Figment's validator contract address is
0xb929B89153fC2eEd442e81E5A1add4e2fa39028f
.
NOTE
Before using this flow, please ensure that your MATIC tokens are on Ethereum mainnet or testnet. This may require you to withdraw your MATIC tokens from Polygon to Ethereum via the Polygon bridge.
There is a step-by-step guide for the withdrawal process available on the Polygon docs: https://wiki.polygon.technology/docs/develop/wallets/polygon-web-wallet/web-wallet-v3-guide/#step-by-step-guide-2.
For mainnet the contract address of the MATIC token is
0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0
— Etherscan - Mainnet MATIC TokenFor testnet the contract address of the MATIC token is
0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae
— Etherscan - Testnet MATIC Token
In the following guide we will illustrate how to stake MATIC tokens.
Create New Staking Flow
To initiate the delegation process, create a new flow with a POST
request to /flows
.
Request
protocol
* :string
Protocol on which this flow operates (ex.polygon
).network
* :string
Network on which this flow operates (ex.mainnet
,testnet
).operation
* :string
The operation to perform (ex.staking
).
{
"protocol": "polygon",
"network": "testnet",
"operation": "staking"
}
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
Flow & transaction data.
{
"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
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T17:41:45.248Z",
"updated_at": "2023-03-02T17:41:45.248Z"
}
Submit Staking Data
After creating a new staking flow, submit the staking account data. Collect the required inputs. Send a PUT
request to /flows/[:flow_id]/next
to proceed to the next step.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :assign_staking_data
inputs
* :object
delegator_address
* :string
The delegating address.validator_address
* :string
The address of the validator smart contract to which you want to delegate your tokens.amount
* :number
The amount of MATIC to be delegated.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.max_slippage_percentage
:number
The maximum slippage you are willing to accept.
{
"name": "assign_staking_data",
"inputs": {
"delegator_address": "0x542138451d0953Aa082dE659d2A1ca1e5EF452Bf",
"validator_address": "0x15ED57Ca28cbebb58d9c6C62F570046BC089bC66",
"amount": "1"
}
}
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
Flow & transaction data.gas_limit
: The gas limit for the transaction.gas_price
: The highest gas price you will pay for the transaction.
{
"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
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:24:18.140Z"
}
Submit Staking Allowance Data
After collecting the required inputs, send a PUT
request to /flows/[:flow_id]/next
to proceed to the next step.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :string
:create_allowance_tx
inputs
:object
gas_limit
:string
The gas limit for the transaction.gas_price
:string
The highest gas price you will pay for the transaction.
{
"name": "create_allowance_tx"
}
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 or an array of signatures to continue the flow. Refer to the guides Signing Transactions with Figment's npm Package and Signing Transactions with the Fireblocks API for details.confirm_allowance_tx_by_hash
: Submit a previously completed transaction hash to continue the flow. Refer to the guide Advance Flows Using a Transaction Hash.
data
:object
Flow & transaction data.
{
"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
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:28:00.947Z"
}
Submit 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 /flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Polygon network.
Request
name
* :sign_allowance_tx
inputs
* :object
transaction_payload
* : Signed transaction payload from the previous step's response.signatures
:array
ofobject
The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
"name": "sign_allowance_tx",
"inputs": {
"transaction_payload": "0x02f8af05808459682f00845994f6fa82b58394499d11e0b6eac7c0593d8fb292dcbbf815fb29ae80b844095ea7b300000000000000000000000000200ea4ee292e253e6ca07dba5edc07c8aa37a3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc001a08019145182b704f15aca2a95242e25abfe9382dd74d0c15e88087978beb476b1a05b4c37b70e316c91e6a19738208e7eae6b79dd2c8ef62aa229f76548490c26b7"
}
}
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
Flow & transaction data.
{
"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
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:44:17.076Z"
}
Submit Delegate Transaction Data
Now that the smart contract allowance is in place, submit a delegation transaction to delegate the MATIC.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :create_delegate_tx
inputs
:object
gas_limit
:string
The gas limit for the transaction.gas_price
:string
The highest gas price you will pay for the transaction.
{
"name": "create_delegate_tx"
}
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 or an array of signatures to continue the flow. Refer to the guides Signing Transactions with Figment's npm Package and Signing Transactions with the Fireblocks API for details.confirm_delegate_tx_by_hash
: Submit a previously completed transaction hash to continue the flow. Refer to the guide Advance Flows Using a Transaction Hash.
data
:object
Flow & transaction data.
{
"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
}
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:48:54.349Z"
}
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 /flows/[:flow_id]/next
and the Staking API will broadcast the transaction to the Polygon network.
URL
https://api.figment.io/flows/[:flow_id]/next
Request
name
* :sign_delegate_tx
inputs
* :object
transaction_payload
* : Signed transaction payload from the previous step's response.signatures
:array
ofobject
The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
"name": "sign_delegate_tx",
"inputs": {
"transaction_payload": "0x02f8b005018459682f0084598840d28303d2e19415ed57ca28cbebb58d9c6c62f570046bc089bc6680b8446ab150710000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000c001a0424cfeb222e8dda2207cfa4e3958e252c9d5b79af6ca9e356a9f736a1de31483a03d0d9acc2cec2dca7569bdfaaf29e598a61faf7ce488de658e9af354c0d21c1b"
}
}
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
Flow & transaction data.
{
"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
}
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:53:38.135Z"
}
Get Staking Flow Status
To get the current state of the existing flow, send a GET
request to /flows/[:flow_id]
using the flow ID from the previous step.
URL
https://api.figment.io/flows/[:flow_id]
Request
- 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
Flow & transaction data.
{
"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
}
},
"protocol": "polygon",
"network": "testnet",
"created_at": "2023-03-02T18:23:42.248Z",
"updated_at": "2023-03-02T18:53:50.297Z"
}