Skip to content
CTRL K
    Staking

    Staking

    Use this module when users lock a product token from the catalog to earn rewards, unlock some or all of it, or claim pending rewards. Typical UI: stake form, “my stake” card, claim button.

    This is product-token staking — not native chain / consensus delegation (e.g. Cosmos validators). That is a different capability when offered.

    Amounts are display decimals. Writes use a Wallet adapter.

    Rules

    • Stake / unstake / claim are separate writes. You compose “stake then claim on a schedule” in your app.
    • Pass owner only when you need a specific address; omit it when a wallet is configured — Whose wallet (owner).
    • You may need balances.approve before stake if allowance is too low.
    • After a successful write, refresh stake or positions reads. Poll settlement.track until confirmed or failed if the handle is still running.
    • For a mixed portfolio table, prefer positions.listPositions with kinds: ['stake'].
    • Stake / unstake / claim can incur gas and the service fee when they run. The SDK does not return a costs list before those calls — Fees and costs.

    Reads

    staking.listStakePositions

    List stake rows for an owner (optionally one instrument).

    const rows = await sdk.staking.listStakePositions({
      instrumentId: 'evm:421018:instrument:42',
      ledgers: ['infinite-mainnet'],
    })

    Parameters — ListStakePositionsQuery

    FieldTypeDescription
    ownerstringOptional. Whose stakes to list. Omit to use the connected wallet — Whose wallet (owner).
    ledgersLedgerScope[]Optional. Limit to these ledgers (ID or alias).
    instrumentIdInstrumentIdOptional. Only this stake asset. Omit to list all product stakes for the owner.

    Returns — StakePosition[]

    FieldTypeDescription
    idPositionIdOpaque stake position id.
    instrumentIdInstrumentIdToken that is staked.
    ledgerLedgerIdCanonical ledger.
    ownerstringStaker address.
    amountstringStaked amount as a display decimal.
    claimableRewardobjectOptional. Pending reward: instrumentId + display amount.

    Example response:

    [
      {
        "id": "pos_stake_01…",
        "instrumentId": "evm:421018:instrument:42",
        "ledger": "evm:421018",
        "owner": "0xabc…",
        "amount": "250",
        "claimableReward": {
          "instrumentId": "evm:421018:instrument:42",
          "amount": "1.25"
        }
      }
    ]

    staking.getStakePosition

    One stake row for an instrument + owner (detail or refresh after stake/unstake/claim).

    const position = await sdk.staking.getStakePosition({
      instrumentId: 'evm:421018:instrument:42',
    })

    Parameters — GetStakePositionParams

    FieldTypeDescription
    instrumentIdInstrumentIdProduct token whose stake you want.
    ownerstringOptional. Omit to use the connected wallet — Whose wallet (owner).
    ledgersLedgerScope[]Optional ledger filter when the instrument could resolve on more than one.

    Returns — StakePosition

    Same fields as each element in listStakePositions.

    Example response:

    {
      "id": "pos_stake_01…",
      "instrumentId": "evm:421018:instrument:42",
      "ledger": "evm:421018",
      "owner": "0xabc…",
      "amount": "250",
      "claimableReward": {
        "instrumentId": "evm:421018:instrument:42",
        "amount": "1.25"
      }
    }

    Writes

    staking.stake

    Lock amount of a product token. Signing uses purpose: 'stake'.

    const handle = await sdk.staking.stake({
      instrumentId: 'evm:421018:instrument:42',
      amount: '100',
    })

    Parameters — StakeRequest

    FieldTypeDescription
    instrumentIdInstrumentIdProduct token to stake.
    amountstringHow much to stake, as a display decimal (what the user typed).
    deadlinenumberOptional. Unix time in milliseconds after which the stake should not proceed.
    ledgersLedgerScope[]Optional. Limit to these ledgers.

    Returns — ExecutionHandle

    Poll settlement.track until confirmed or failed if still running. Then refresh stake / positions reads.

    Example response:

    {
      "id": "exec_01HZZ…",
      "status": "confirmed",
      "ledger": "evm:421018",
      "txRef": "0xdef…"
    }

    staking.unstake

    Unlock amount of a previously staked product token. Signing uses purpose: 'unstake'.

    const handle = await sdk.staking.unstake({
      instrumentId: 'evm:421018:instrument:42',
      amount: '50',
    })

    Parameters — UnstakeRequest

    FieldTypeDescription
    instrumentIdInstrumentIdProduct token to unstake.
    amountstringHow much to unlock, as a display decimal.
    deadlinenumberOptional. Unix time in milliseconds.
    ledgersLedgerScope[]Optional.

    Returns — ExecutionHandle

    Same shape as staking.stake.

    Example response:

    {
      "id": "exec_01HZZ…",
      "status": "confirmed",
      "ledger": "evm:421018",
      "txRef": "0xabc…"
    }

    staking.claim

    Claim pending staking rewards for that instrument. Signing uses purpose: 'stake_claim'.

    const handle = await sdk.staking.claim({
      instrumentId: 'evm:421018:instrument:42',
    })

    Parameters — StakeClaimRequest

    FieldTypeDescription
    instrumentIdInstrumentIdStake asset whose rewards you are claiming.
    deadlinenumberOptional. Unix time in milliseconds.
    ledgersLedgerScope[]Optional.

    Returns — ExecutionHandle

    Same shape as staking.stake.

    Example response:

    {
      "id": "exec_01HZZ…",
      "status": "confirmed",
      "ledger": "evm:421018",
      "txRef": "0xclaim…"
    }

    Errors

    READ_ONLY_MODE, CAPABILITY_NOT_AVAILABLE, WALLET_REQUIRED, USER_REJECTED, LEDGER_NOT_SUPPORTED.

    Positions · Farming · Balances · Write operations