Skip to main content

Staking Context

Developers typically need a way to gate staking actions, for example, the "stake" button should be enabled only if the user has enough balance to stake, or the "unstake" button should be enabled only if the user has enough staked balance etc.

This information can be unique for every protocol and can be very hard to get. To make accessing this data easier, we have introduced the concept of "staking context" that can be fetched via our ViewStakingContext endpoint. The staking context provides a point-in-time snapshot of the user's wallet's staking state. It has enough data for you to make decisions on how to go about enable/disabling UI elements representing these actions.

Here's an example of a user's wallet's "staking context" for partial eth staking:

{
"address": "0x87Bf57c3d7B211a100ee4d00dee08435130A62fA",
"ethereumKilnStakingContextDetails": {
"ethereumBalance": {
"value": "35802562641399502",
"currency": "ETH"
},
"integratorShareBalance": {
"value": "22139201596840575",
"currency": "SHARES"
},
"integratorShareUnderlyingBalance": {
"value": "22506410117065206",
"currency": "ETH"
},
"totalExitableEth": {
"value": "3341944410096998",
"currency": "ETH"
},
"totalSharesPendingExit": {
"value": "3284270185509832",
"currency": "SHARES"
},
"fulfillableShareCount": {
"value": "3284270185509832",
"currency": "SHARES"
}
}
}

The above API response shows how much ETH the user has that can be then used to gate the "stake" actions as an example.

Was this helpful?