Stake APIs

GetAllStakes

This API returns all stake records.
REST Uri: /stake/all
Returns
stakes: json representation of the stakes
_id: the ID for the stake record
type: this stake is in the Validator candidate pool or the Lightning candidate pool
holder: the holder account's address
source: the source account's address
amount: the staked SPAYWei amount
withdrawn: true returns the stake is withdrawn, false returns the stake is not withdrawn
return_height: the expected height the tokens return to the staking wallet if a node withdraws its stake.
// Request
curl https://explorer.script.tv/api/stake/all
// Result
{
"type": "stake",
"body": [{
"_id": "5eb9f45d38696f556cc3334d",
"type": "vcp",
"holder": "0x80eab22e27d4b94511f5906484369b868d6552d2",
"source": "0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8",
"amount": "20000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
},{
"_id": "5eb9f45d38696f556cc3334e",
"type": "vcp",
"holder": "0x80eab22e27d4b94511f5906484369b868d6552d2",
"source": "0x747f15cac97b973290e106ef32d1b6fe65fef5a1",
"amount": "40000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
},{
"_id": "5eb9f45d38696f556cc33351",
"type": "vcp",
"holder": "0xa61abd72cdc50d17a3cbdceb57d3d5e4d8839bce",
"source": "0x0c9a45926a44a6fc9c8b6f9cb45c20483038698c",
"amount": "32000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
}
...
]
}

GetTotalStakedAmount

This API returns the total amount of stakes.
REST Uri: /stake/totalAmount
Returns
totalAmount: the total amount of staked SPAYWei
totalNodes: the total amount of stake nodes
// Request
curl https://explorer.script.tv/api/stake/totalAmount
// Result
{
"totalAmount": "317702156000000000000000000",
"totalNodes": 12
}

GetStakeByAddress

This API returns the stakes being queried with address.
REST Uri: /stake/:address
Returns
For each stake it is similar to the returns of the GetAllStakes API.
// Request
curl https://explorer.script.tv/api/stake/totalAmount
// Result
{
"type": "stake",
"body": {
"holderRecords": [],
"sourceRecords": [
{
"_id": "5eb9f60638696f556cc33aa3",
"type": "vcp",
"holder": "0xe2408dff7a1f9bc247c803e43efa2f0a37b10ba6",
"source": "0xc15149236229bd13f0aec783a9cc8e8059fb28da",
"amount": "30000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
},
{
"_id": "5eb9f60638696f556cc33aa5",
"type": "vcp",
"holder": "0x15cc4c3f21417c392119054c8fe5895146e1a493",
"source": "0xc15149236229bd13f0aec783a9cc8e8059fb28da",
"amount": "30000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
},
{
"_id": "5eb9f60638696f556cc33aa4",
"type": "vcp",
"holder": "0xa144e6a98b967e585b214bfa7f6692af81987e5b",
"source": "0xc15149236229bd13f0aec783a9cc8e8059fb28da",
"amount": "30000000000000000000000000",
"withdrawn": false,
"return_height": "18446744073709551615"
}
]
}
}
Last modified 6mo ago