Quote a stake or unstake, build the transaction, and send it through the connected wallet.Documentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-feature-fumodocs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
TheStakingManager routes each quote and build call to a single registered staking provider — by default the first one you registered, or the one you pass as providerId. setDefaultProvider on the manager overrides the default; an unknown providerId throws. A quote describes the intent (direction: 'stake' | 'unstake', amount, optional unstakeMode), and useBuildStakeTransaction turns an accepted quote into a TransactionRequest.
The protocol shape — derivative jetton, unstake modes, settlement timing, pool model — is provider-specific. Tonstakers, the bundled provider, issues tsTON and supports INSTANT, WHEN_AVAILABLE, and ROUND_END unstake modes. Read the user’s staked-token balance with useStakedBalance, or query the jetton balance directly. apy and instantUnstakeAvailable from useStakingProviderInfo are provider-supplied display data, not guarantees of future yield or withdrawal timing.
Before you begin
You need a connected wallet and a staking provider registered on the AppKit instance. Tonstakers ships bundled — see Providers → How they are registered.Hooks
| Hook | Purpose |
|---|---|
useStakingProviders | List registered staking provider IDs. |
useStakingProviderInfo | Read APY and instant-unstake liquidity for a provider. |
useStakedBalance | Read the user’s staked-token balance (e.g. tsTON). |
useStakingQuote | Quote a stake or unstake intent. |
useBuildStakeTransaction | Build a TransactionRequest from a quote. |
{ data, isLoading, isError, refetch }); the last two are mutation/query pair used together. The built TransactionRequest is handed to <Send /> from @ton/appkit-react, which exposes loading/error state.
Read the user’s staking balance
useStakedBalance returns StakingBalance for the given user address. The shape is { stakedBalance, rawStakedBalance, instantUnstakeAvailable, rawInstantUnstakeAvailable, providerId }. Render stakedBalance as the user’s tsTON amount and instantUnstakeAvailable as the pool’s liquid TON.
Quote a stake or unstake
useStakingQuote takes the intent and returns settlement amounts. For an unstake, pass unstakeMode (UnstakeMode.INSTANT, UnstakeMode.WHEN_AVAILABLE, or UnstakeMode.ROUND_END) when the provider supports more than one.
direction and add unstakeMode:
Build and send the transaction
useBuildStakeTransaction is the mutation that turns an accepted quote into a TransactionRequest. Hand it to <Send /> through a request callback.
After the send
After the send completes, pass the response togetTransactionStatus to confirm settlement, then refetch useStakedBalance to see the new staked-token balance. The response carries either a boc or a normalizedHash; pass whichever is set.
Tips
- The user’s stake is a derivative jetton (e.g.
tsTON), not an opaque AppKit object. Refresh withuseStakedBalance(or a jetton balance read) after sends. - APY and instant-unstake liquidity from
useStakingProviderInfoare provider-supplied display data, not guarantees of future yield or withdrawal timing. - Unstake mechanics (instant, delayed, round-end) are provider-specific. Pass
unstakeModeon the quote when the provider supports more than one.