Skip to content
On this page

Staking ​


This function returns stakeholders data based on their addresses, type, time of creation, stake, balance, rewards etc.

It can be used for filtering stakeholders based on required parameters and displaying information about the filtered stakeholders such as time of creation, frozen stake, reward, address, type etc.

Request parameters ​

Required body parameters:

NameExample valueComment
createdAtGe1640998800000Value representing bottom border of the date time stakeholder was created
createdAtLe1656032400000Value representing top border of the date time stakeholder was created
frozenStakeGe0Value representing bottom border of the frozen stake amount
frozenStakeLe20000000000Value representing top border of the frozen stake amount
lastRewardGe0Value representing bottom border of the last reward amount
lastRewardLe200000000000Value representing top border of the last reward amount
limit10Maximum number of stakeholders to be retrieved
offset0Offset
orderingupdateatascendingValue based on which the retrieved stakeholder data will be ordered
relayCreatedAtGe1640998800000Value representing bottom border of the date time relayer was created
relayCreatedAtLe1656032400000Value representing top border of the date time relayer was created
stakeholderAddresses"0:e75a9cdc1058e59d4ceb52f4cb276ee1d7e7f6180aad66e38ee607f9c8ca46d7","0:099341ccbe3f2db59432fc1cc794773b9da06048d14e43ae24ae224dd768145d","0:2e6d5fcecfcdd36c748de15d1dd7102728b528a3538582aa5a093e6088d79e28"Address of the stakeholder
stakeholderKindrelayStakeholder kind (ordinary, relayer…)
totalRewardGe0Value representing bottom border of the total reward amount
totalRewardLe200000000000Value representing top border of the total reward amount
untilFrozenGe0Value representing bottom border of the until frozen amount
untilFrozenLe100000000000Value representing top border of the until frozen amount
userBalanceGe0Value representing bottom border of the user’s balance amount
userBalanceLe200000000000Value representing top border of the user’s balance amount

Response fields explanation ​

NameExample valueComment
stakeholders: [List of stakeholders retrieved based on the value of body parameters
createdAt1654255227000Date time of stakeholder’s creation
frozenStakeBalance100000Amount of stakeholder’s frozen stake
lastReward0Amount of stakeholder’s reward form the last round
stakeBalance100000Amount of stake
totalReward0Total amount of reward
userAddress0:2e6d5fcecfcdd36c748de15d1dd7102728b528a3538582aa5a093e6088d79e28Stakeholder’s address
userTypeRelaytype of stakeholder (relayer, ordinary…)
totalCount3Total number of stakeholders retrieved

Example ​

java
app.post('/staking/search/stakeholders', (req, res) => {
    axios({
        method: 'post',
        url: `${apiUrl}/staking/search/stakeholders`,
        data: {
            createdAtGe: req.body.createdAtGe,
            createdAtLe: req.body.createdAtLe,
            frozenStakeGe: req.body.frozenStakeGe,
            frozenStakeLe: req.body.frozenStakeLe,
            lastRewardGe: req.body.lastRewardGe,
            lastRewardLe: req.body.lastRewardLe,
            limit: req.body.limit,
            offset: req.body.offset,
            ordering: req.body.ordering,
            relayCreatedAtGe: req.body.relayCreatedAtGe,
            relayCreatedAtLe: req.body.relayCreatedAtLe,
            stakeholderAddresses: req.body.stakeholderAddresses,
            stakeholderKind: req.body.stakeholderKind,
            totalRewardGe: req.body.totalRewardGe,
            totalRewardLe: req.body.totalRewardLe,
            untilFrozenGe: req.body.untilFrozenGe,
            untilFrozenLe: req.body.untilFrozenLe,
            userBalanceGe: req.body.userBalanceGe,
            userBalanceLe: req.body.userBalanceLe,
        }
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})

This function returns list of transactions based on their amount, kind, time of transaction, user that initiated transaction.

It can be used for filtering all transactions from a certain user based on the required parameters and displaying them with data such as total number of transactions, time of transaction, kind, amount, for each one of them.

Request parameters ​

Required body parameters:

NameExample valueComment
amountGe0Value representing bottom border of the amount spent in the transaction
amountLe10000000Value representing top border of the amount spent in the transaction
limit10Maximum number of stakeholders to be retrieved
offset0Offset
orderingamountascendingValue based on which the retrieved transaction data will be ordered
timestampBlockGe1654045200Value representing bottom border of the date time of transaction’s conclusion
timestampBlockLe1654822800Value representing top border of the date time of transaction’s conclusion
transactionKinddepositKind of transaction (deposit, withdraw…)
userAddress0:e5623ad7084d054fb326afaa1eb41288b4ef1f6891d6f4053e09b87e501f03daAddress of the user initiated the transaction

Response fields explanation ​

NameExample valueComment
totalCount1Total number of retrieved transactions
transactions: [List of retrieved transactions with following data
amountExec39.17627067Amount of the transaction
timestampBlock1654509651000Date time of transaction conclusion
transactionHash1a56f0984d31f42bc29ba4968fe9176eef6183a9e301cf9f942c562eb8dc1046Hash code of the transaction
transactionKindDepositKind of transaction (deposit, withdraw…)

Example ​

java
app.post('/staking/search/transactions', (req, res) => {
    axios({
        method: 'post',
        url: `${apiUrl}/staking/search/transactions`,
        data: {
            amountGe: req.body.amountGe,
            amountLe: req.body.amountLe,
            limit: req.body.limit,
            offset: req.body.offset,
            ordering: req.body.ordering,
            timestampBlockGe: req.body.timestampBlockGe,
            timestampBlockLe: req.body.timestampBlockLe,
            transactionKind: req.body.transactionKind,
            userAddress: req.body.userAddress,
        }
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})

This function returns all the data necessary for staking.

It can be used for displaying information interesting for stakeholders, such as average annual percentage rate, monthly reward, monthly reward change, total value locked and it’s change and number of stakeholders.

Request parameters ​

No required parameters

Response fields explanation ​

NameExample valueComment
averageApr0Average value of the Annual percentage rate (APR) in percents
reward30d0Reward amount for 30 days staking period
reward30dChange0Change of reward for 30 days of staking (in percents)
stakeholders127Number of stakeholders
tvl2941620.097043126000Total value locked in the staking pool
tvlChange0.0500Change of total value locked (in percents)

Example ​

java
app.get('/staking/main', (req, res) => {
    axios({
        method: 'get',
        url: `${apiUrl}/staking/main`
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})

This function returns staking data unique for a user based on its address.

It can be used for showing to a user his personal staking page with information about average percentage rate, his reward for the last month and monthly reward change, frozen stake, user’s tvl and tvl change.

Request parameters ​

Required body parameters:

NameExample valueComment
userAddress0:10252b69cc825be1f24a327cd091fa648e262ca78ab0f6ae67663b4fbbcf2136Address of a stakeholder

Response fields explanation ​

NameExample valueComment
averageApr0Average value of the Annual percentage rate (APR) in percents
user30dReward0.534055306000Reward amount for 30 days staking period
user30dRewardChange0Change of reward for 30 days of staking (in percents)
userFrozenStake0Amount of user’s frozen stake
userTvl100Total value locked in the staking pool
userTvlChange0Change of total value locked (in percents)

Example ​

java
app.post('/staking', (req, res) => {
    axios({
        method: 'post',
        url: `${apiUrl}/staking`,
        data: {
            userAddress: req.body.userAddress
        }
      })
    .then(function (response) {
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
})