Staking
Track stake, rewards and unstaking obligations through completion.
On this page
Return shape
Every account snapshot includes block, holdings and liabilities. Use actual venue data, with owners bound to the Credit Account. Optional public actions must be declared in the definition; a schema-supported capability does not mean every integration offers it.
PluginStates["staking"]
{
block: context.block, holdings: [], liabilities: [],
positions: [{
position_id: "7", market_id: "MON-STAKING", owner: context.account,
assets: [{ asset: native_mon, amount: 1_000_000_000_000_000_000n }],
liability: 0n, recoverable_value: 900_000n,
staked: 1_000_000_000_000_000_000n, rewards: 0n,
}],
requests: [],
}Staked quantities use asset units; recoverable_value and liability use settlement valuation units. Account for slashing risk, withdrawal delays and admitted reward assets.
Capabilities
| Capability | Parameters | Purpose |
|---|---|---|
| stake | market_id, amount_in, optional min_receipt_out | Stake assets with applicable receipt protection. |
| claim_rewards | position_id | Claim rewards. |
| request_unstake | position_id, amount | Create an unstaking request. |
| complete_unstake | request_id | Complete a claimable request. |
| withdraw_to_credit_account | position_id, amount | Withdraw through an admitted account-controlled path. |
Stake
stake
termbook.open({
action: {
"use_case": "staking",
"capability": "stake",
"params": {
"market_id": "MON-STAKING",
"amount_in": 1000000000000000000n,
"min_receipt_out": 990000000000000000n
}
},
});Exit requirements
Request unstaking once, wait for the claim time, complete the request and collect recoverable rewards. Recovery must function without the borrower and retain the request identity across retries.