Creates a FarmsStakedPosition instance from normalized position data.
Normalized object data for the user's position.
Optional timestamp override, in milliseconds.
Optionalconfig: CallerConfig
Optional network and API-host configuration.
Optionalapi: AftermathApi
Optional provider required by transaction builders.
Optional ReadonlyapiOptional provider required by transaction builders.
The mutable configuration used for subsequent requests.
Normalized object data for the user's position.
ReadonlytrueThe reward timestamp supplied by the constructor, or the position's stored last-harvest timestamp when no override was supplied.
Builds a version-aware transaction to deposit additional principal.
The position, pool, and stake coin IDs are taken from this instance. The amount is in stake-coin base units. The transaction does not submit itself.
Deposit amount, signing wallet, and optional sponsorship.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to harvest this position's rewards.
The builder includes only reward types with a positive locally claimable balance. It can request SUI as afSUI when that option is supported.
Matching pool view, signing wallet, and optional SUI-to-afSUI claim flag.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to lock this position for a duration.
The duration is in milliseconds and is validated against the pool's lock range when the transaction executes. V1 and V2 builders are selected from the position version.
Lock duration and signing wallet.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to renew this position's lock.
The on-chain command refreshes the lock without accepting a new duration.
Signing wallet.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to unlock this position.
The contract may reject the command while the position is still locked. Emission end and the pool's forced-open flag are part of the local lock checks used by the façade, but on-chain validation remains authoritative.
Signing wallet.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction that withdraws this entire position and destroys it.
The builder includes reward types with a positive claimable balance before it withdraws principal and appends the destroy command. Strict pools still require the position to be unlocked when the transaction executes.
Matching pool view, signing wallet, and optional SUI-to-afSUI claim flag.
An unsigned transaction that can be signed and executed.
Builds a version-aware transaction to withdraw part of the principal.
Unlike getUnstakeTransaction, this operation keeps the position object.
The amount is in stake-coin base units, and the matching pool view is used
by the on-chain validation path.
Withdraw amount, matching pool view, and signing wallet.
An unsigned transaction that can be signed and executed.
Checks whether this position has any claimable reward amount.
Contains a reference to the FarmsStakingPool.
true if there are unclaimed rewards; otherwise, false.
Checks whether the position stores a non-zero lock duration.
true if the position was created with a lock duration > 0.
Checks whether the position is currently locked for this pool.
The result is false when the lock has expired, the pool's emission period
has ended, or the pool is forcibly open. It uses Date.now() and does not
perform a network read.
Pool view used for emission-end and forced-unlock rules.
true if the position is locked; otherwise, false.
Checks whether the position is locked under relaxed pool enforcement.
Contains a FarmsStakingPool instance to check lock state and enforcement.
true if locked with relaxed enforcement; otherwise, false.
Checks whether the position is locked under strict pool enforcement.
Contains a FarmsStakingPool instance to check lock state and enforcement.
true if locked with strict enforcement; otherwise, false.
Returns reward coin types with a positive claimable balance.
Contains a reference to the FarmsStakingPool.
An array of CoinType strings that have pending rewards > 0.
Retrieves the local reward-accounting record for one coin type.
Reward coin type to look up.
The matching reward-accounting record.
Computes the claimable amount for each reward coin in this position.
The returned map uses reward coin types as keys and base-unit bigint
amounts as values. It applies the minimum claim threshold and available
pool balance checks used by rewardsEarned.
Pool view used to validate each reward balance.
A mapping from coinType to claimable base-unit balance.
Lists all reward coin types associated with this position.
An array of CoinType strings representing the reward coins.
Returns the currently claimable amount for one reward coin.
This local calculation adds base and multiplier rewards. It returns zero
when the pool has no actual balance, the amount is below
Farms.constants.minRewardsToClaim, or the amount exceeds the pool's
available balance. It does not call updatePosition() automatically.
Reward coin type and the matching pool view.
The claimable amount in reward-coin base units.
Computes the timestamp in milliseconds at which this position's lock ends.
The unlock timestamp (lock start + lock duration).
Updates this position's local reward accounting from a pool snapshot.
The method emits completed pool intervals, clamps a stale lock to the pool's maximum duration and multiplier, adds reward records introduced by the pool, updates reward debts, and records the current timestamp. It does not fetch from the network and does not automatically call the on-chain unlock operation when the lock expires.
Pool snapshot used for emission and per-share calculations.
Returns the farm contract version that produced this position.
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 one user's staked position.
The class exposes lock state, reward accounting, and version-aware builders for depositing, withdrawing, locking, unlocking, unstaking, and harvesting. Reward and lock calculations use the supplied pool view and do not fetch fresh data. Transaction builders require an
AftermathApiprovider and return unsigned transaction data.