Creates a FarmsStakingPool instance from normalized pool data.
Normalized pool data returned by a farm object read.
Optionalconfig: CallerConfig
Optional network and API-host configuration for TVL reads.
Optionalapi: AftermathApi
Optional provider required by transaction builders.
Optional ReadonlyapiOptional provider required by transaction builders.
The mutable configuration used for subsequent requests.
Normalized pool data returned by a farm object read.
Computes an approximate APR for one reward coin.
The calculation annualizes the current discrete emission rate, converts the
rate to USD with price and decimals, divides by tvlUsd, and assumes
the pool's maximum lock multiplier. It returns zero when the price or TVL
is not positive, emissions have not started or have ended, or the actual
reward balance is below one emission amount.
Includes the coinType, its price and decimals, plus the total tvlUsd in the pool.
APR as a decimal fraction, such as 0.05 for 5%.
Calculates the lock multiplier for a duration in milliseconds.
The duration is clamped to the pool's minimum and maximum. The result is
linearly interpolated between 1.0 and maxLockMultiplier; if the pool's
minimum and maximum durations are equal, the result is 1.0.
An object containing the lockDurationMs for which to calculate a multiplier.
An 18-decimal fixed-point FarmsMultiplier; 1e18n represents 1.0.
Computes the sum of the approximate APR for every reward coin in the pool. Each component uses the maximum lock multiplier and the supplied price and decimal maps.
Contains price data (coinsToPrice), decimal data (coinsToDecimals), and the total TVL in USD.
The combined APR as a decimal fraction, such as 0.10 for 10%.
Applies completed emission intervals to this local pool view.
The method updates rewardsAccumulatedPerShare and each reward's last
checkpoint. It emits nothing when the pool has no stake, waits until a full
interval has elapsed, and caps emission at rewardsRemaining. It does not
fetch fresh pool data or submit a transaction.
Builds a transaction granting a one-time admin capability to another address.
The capability is scoped to the pool and reward coin supplied in inputs.
Only the current owner can grant it.
Owner capability, recipient, reward coin type, and signing wallet.
An unsigned transaction to be executed by the pool owner.
Builds a version-aware transaction to harvest rewards from multiple positions.
The reward coin types are derived from nonZeroRewardCoinTypes() and the
pool's stake coin type and ID are added automatically.
Position object IDs and the signing wallet address.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to increase emission schedules for reward coins.
The on-chain contract requires the owner capability and rejects updates that do not increase the configured emissions.
Owner capability, reward emission updates, and signing wallet.
An unsigned transaction to be signed by the owner-cap holder.
Builds a version-aware transaction to initialize a new reward coin in this pool.
The reward amount and rate are in the reward coin's base units. The schedule and delay timestamps are in milliseconds. V1 and V2 choose different Move entry points, and V2 can consume a one-time admin capability.
Reward amount, emission settings, reward type, authorizing capability, and wallet.
An unsigned transaction for reward initialization.
Builds a transaction to remove (withdraw) undistributed reward coins from the staking pool for one or more reward coin types in a single call.
Only the pool owner (via ownerCapId) can remove rewards. One-time admin caps
are not permitted for removals. This operation reduces the pool’s remaining
undistributed reward balances; it does not affect rewards already accrued/claimed
by stakers.
Versioning:
buildRemoveStakingPoolRewardTxV1buildRemoveStakingPoolRewardTxV2The effective stakingPoolId and stakeCoinType always come from this
instance's stakingPool.
Parameters for reward removal.
Object ID of the pool OwnerCap that authorizes the removal.
Array of removal entries. Each entry specifies:
rewardCoinType: Coin type to withdraw.rewardAmount: Amount to withdraw (base units).Address that will sign/submit the transaction.
A transaction object ready to sign and execute that removes the specified
undistributed rewards for each entry in inputs.rewards.
Fetches the total value locked (TVL) of the reward coins in this specific staking pool.
OptionalabortSignal: AbortSignal
Optional signal that cancels the API request.
A number representing this pool's reward TVL.
Builds a V2 transaction to set the pool's maximum lock duration.
lockDurationMs is in milliseconds. The owner capability must authorize
the mutation. V1 pools do not expose this entry point.
Owner capability, new duration, and signing wallet.
An unsigned transaction that can be signed and executed.
Builds a V2 transaction to set the pool's minimum lock duration.
lockDurationMs is in milliseconds. The owner capability must authorize
the mutation. V1 pools do not expose this entry point.
Owner capability, new duration, and signing wallet.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to stake tokens into this pool.
The pool ID and stake coin type come from this.stakingPool. The requested
duration is in milliseconds, and the amount is in stake-coin base units.
V1 and V2 builders are selected from version().
Principal, lock duration, sender address, and optional sponsorship.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to add balances to existing reward coins.
Each amount is in the corresponding reward coin's base units. The owner or one-time admin capability must authorize the operation.
Reward top-ups, authorizing capability, and signing wallet.
An unsigned transaction that can be signed and executed.
Fetches the total value locked (TVL) for this staking pool alone.
OptionalabortSignal: AbortSignal
Optional signal that cancels the API request.
A number representing this pool's TVL in the API's reporting currency.
Builds a transaction to update the pool's minimum stake amount.
The amount is in stake-coin base units, and the owner capability must authorize the mutation.
New minimum amount, owner capability, and signing wallet.
An unsigned transaction that can be signed and executed.
Returns whether this pool uses relaxed lock enforcement.
The on-chain contract permits relaxed-lock principal withdrawals while the position is locked and applies its relaxed-lock reward rules.
Returns whether this pool uses strict lock enforcement.
A strictly locked position must reach its unlock time, or the pool must be forcibly opened, before principal can be withdrawn.
Computes the maximum lock duration that remains valid in this pool.
The result is the smaller of the configured maximum and the time until
emission ends. It uses Date.now() and returns zero after emissions end.
The maximum possible lock duration in milliseconds, or 0 if the pool is effectively closed.
Lists reward coin types that can currently be included in harvest inputs.
A reward is included only when its actual pool balance is positive and at least one emission amount is available.
An array of eligible CoinType strings.
Retrieves the local record for a specific reward coin type in this pool.
Contains the coinType to look up.
The matching FarmsStakingPoolRewardCoin record.
Lists all reward coin types offered by this staking pool.
An array of CoinType strings.
Retrieves the version of this staking pool (1 or 2).
StaticapiReturns the canonical Aftermath API host for a Sui network.
To target a custom or local host, pass baseUrl in CallerConfig to the
constructor instead.
The Sui network whose host to return.
The network's HTTPS or local HTTP API host.
StaticdefaultReturns the canonical Sui fullnode URL for a network.
The network whose fullnode URL to return. undefined
defaults to mainnet.
The network's fullnode URL.
A local view of a staking pool, also called a vault on chain.
The class exposes pool state, reward and multiplier calculations, TVL reads, and version-aware transaction builders. Calculations mutate this instance's
stakingPoolobject but do not make network requests. Transaction builders require anAftermathApiprovider and return unsigned transaction data.