Claim $MATIC Reward
Claiming $MATIC rewards is instant with some considerations.
We will collect:
- The address from which MATIC is delegated
- The Validator contract to which they are delegated
- Optionally, the gas limit & gas price to be paid for the claim transaction
info
The amount of MATIC rewards must be greater than 1.0 MATIC before a Claim Rewards transaction is possible using the Staking API.
danger
Attempts to create a Claim Rewards transaction for a given delegator address when the pending reward balance is below 1.0 MATIC will result in error.
Step 1 - Initiate Flow
Endpoint : flow
Method : POST
Request
Body
service_code* -string: Service code, use service endpoint to get the servicecode.flow* -string: The operation to performclaim-reward.callback_url-string: Your callback url endpoint to get update ofstatefrom our systems.
Request Sample
{
"service_code": "staking-matic",
"flow": "claim-reward"
}
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-assign-data: Next you need to assign the staking data.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success",
"data": {
"id": "2556414e-d47e-477d-bbfc-d927a67278a5",
"service_code": "staking-matic",
"flow": "claim-rewards",
"inquiry_id": "1408705c-073a-474a-96e4-8d3b633f70fa",
"inquiry_identifier": "create-claim-rewards-tx",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "delegator_address",
"display": "Delegator Address",
"description": "Delegator address",
"validations": [
{
"type": "string",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "validator_code",
"display": "Validator Code",
"description": "Validator code",
"validations": [
{
"type": "string",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "gas_limit",
"display": "Gas Limit",
"description": "Gas limit",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0",
"only_integer": "1"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
},
{
"type": "string",
"name": "gas_price",
"display": "Gas Price",
"description": "Gas price in Gwei",
"validations": [
{
"type": "numericality",
"options": {
"allow_blank": "1",
"greater_than": "0"
}
},
{
"type": "precision",
"options": {
"allow_blank": "1",
"max": "9"
}
}
],
"array": 0,
"default_val": null,
"visibility": 1
}
],
"data": {
"callback_url": "",
"claim_rewards_tx": "",
"delegator_address": "",
"gas_limit": "",
"gas_price": "",
"validator_address": "",
"validator_code": ""
},
"created_at": "2024-03-12T18:26:20Z",
"updated_at": "2024-03-12T18:26:20Z",
"expired_at": "2024-03-12T20:26:20Z"
}
}
Step 2 - Create Claim Reward Transaction
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data-object* : Wrapped data objectvalidator_code-string: Validator code, use validator endpoint to get the validatorcode, we will set it automatically if you not send it.delegator_address* -string: Address which you want to use to claim-reward.gas_limit-float64: Set Gas Limit for transaction, if not provided, we will us onchain suggested price.gas_price-float64: Set Gas Price for transaction, if not provided, we will us onchain suggested price.
Sample Endpoint Request : flow/269407c3-315f-4006-95e2-30f2e70891cc/next
Request Sample
{
"inquiry_id":"1408705c-073a-474a-96e4-8d3b633f70fa",
"data": {
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"validator_code": "NOBIMMT01"
}
}
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.inquiry_id-string: ID For next Request Step Inquiry.inquiry_identifier-string: Next step identifier name.staking-claim-reward-tx: Next will be claim-reward tx.
state-string: Current state of your flow.inputs-Array<Object>: Next step inputs.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "2556414e-d47e-477d-bbfc-d927a67278a5",
"service_code": "staking-matic",
"flow": "claim-rewards",
"inquiry_id": "52bce362-2ead-4aa4-806f-40ec8b3db596",
"inquiry_identifier": "staking-claim-rewards-sign",
"state": "initialized",
"inputs": [
{
"type": "string",
"name": "signed_tx_payload",
"display": "Signed Tx Payload",
"description": "Signed transaction payload",
"validations": [
{
"type": "presence",
"options": {}
},
{
"type": "signed_transaction",
"options": {}
}
],
"array": 0,
"default_val": null,
"visibility": 0
}
],
"data": {
"callback_url": "",
"claim_rewards_tx": "0x02e780218002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f8084c7b8981cc0808080",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"gas_limit": "",
"gas_price": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T18:26:20Z",
"updated_at": "2024-03-12T18:26:20Z",
"expired_at": "2024-03-12T20:26:20Z"
}
}
Step 2.1 - Submit Signed Claim Reward Transaction
Endpoint : flow/{:id}/next
Method : POST
Request
Body
inquiry_id* -string: Your inquiry id from step 1data* -object: Wrapped data objectsigned_tx_payload* -string: Signed transaction payload
Sample Endpoint Request : flow/269407c3-315f-4006-95e2-30f2e70891cc/next
Request Sample
{
"inquiry_id":"52bce362-2ead-4aa4-806f-40ec8b3db596",
"data": {
"signed_tx_payload":"0x02f86701218002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f8084c7b8981cc080a0852bf34d4e5e206497c6e3c34cf285e32d923def67c99cac5e7a2cdb34be71caa020732f5945f5b04981eaf0025fb05c6bb816858133f9bada50b7c767c33d8cf5"
}
}
To retry the claim-reward signing transaction, just resubmit the inquiry.
Response
id-string: Flow ID.service_code-string: Current flow service code.flow-string: Current flow name.state-string: Current state of your flow.data-Object: Stored data of your flow.created_at-Timestamp RFC3339: Time when flow created.updated_at-Timestamp RFC3339: Last flow updated.expired_at-Timestamp RFC3339: Maximum time you have to finish the process before flow dropped by system, will always increment by your last action +2 hours.
Success Sample
{
"status": 1,
"status_service": "00",
"status_number": "F000001",
"status_code": "SSSSSS",
"message": "success create data",
"data": {
"id": "2556414e-d47e-477d-bbfc-d927a67278a5",
"service_code": "staking-matic",
"flow": "claim-rewards",
"state": "initialized",
"data": {
"callback_url": "",
"claim_rewards_tx": "0x02e780218002830493e094b929b89153fc2eed442e81e5a1add4e2fa39028f8084c7b8981cc0808080",
"delegator_address": "0xC5933308625306c2dAB7602b52b80dceEa133532",
"gas_limit": "",
"gas_price": "",
"validator_address": "0xb929B89153fC2eEd442e81E5A1add4e2fa39028f",
"validator_code": "NOBIMMT01"
},
"created_at": "2024-03-12T18:26:20Z",
"updated_at": "2024-03-12T18:26:20Z",
"expired_at": "2024-03-12T20:26:20Z"
}
}