Creates a low-level staking adapter from a configured AftermathApi.
Construction is local and does not query the network. The provider must
include addresses.staking, including the liquid-staking package and its
shared objects. Use AftermathApi.Staking() to obtain an instance with
the correct address set.
Low-level provider containing the Sui client and staking package and object addresses.
ReadonlyaddressesPackage and shared-object IDs used by staking commands for this network.
Builds an unsigned transaction that calls epoch_was_changed for the afSUI
vault.
This wrapper creates a transaction, sets walletAddress as sender, and
delegates to epochWasChangedTx. It performs no network I/O and does not
execute the transaction.
Wallet address that signs and sends the crank transaction.
An unsigned Transaction ready for signing.
ReadonlycoinMove coin types used by staking transaction builders.
Fully qualified afSUI coin type derived from the configured package.
ReadonlyeventFully qualified Move event types for normalized staking events.
Type of an afSUI vault epoch-change event.
Type of a liquid-staking event.
Type of a completed afSUI-to-SUI unstake event.
Type of a queued afSUI-to-SUI unstake event.
ReadonlymoveRegistered Move abort translations for the staking package.
ReadonlyobjectMove object types used to identify staking-related objects.
Unverified validator operation-cap type from the events package.
Adds a Move inspection call that reads the afSUI-to-SUI exchange rate.
The Move call returns a u128 transaction argument. This method does not
execute the inspection or convert the result to a JavaScript number.
Transaction to mutate.
Transaction to mutate.
The raw transaction argument returned by the Move call. The method does not decode its protocol-specific rate representation.
Adds a Move inspection call that converts an afSUI amount to its SUI value.
The call returns a raw u64 transaction argument. It computes a value and
does not transfer or burn a coin.
Transaction to mutate and raw afSUI amount to convert.
afSUI amount in raw afSUI units.
Transaction to mutate.
The transaction argument containing the raw SUI result.
Adds the immediate afSUI-to-SUI atomic-unstake Move call.
This method mutates tx and performs no network I/O. The default entry
point is request_unstake_atomic; setting withTransfer selects
request_unstake_atomic_and_keep. The atomic call can fail with the Move
error Insufficient Sui Reserves when the vault lacks enough liquidity.
Transaction, afSUI coin argument, and optional alternate entry-point flag. The coin amount is already encoded in the supplied coin.
afSUI coin object or transaction argument to provide.
Transaction to mutate.
OptionalwithTransfer?: booleanSelects the request_unstake_atomic_and_keep entry point when true.
The transaction argument returned by the selected Move call. The default entry point returns the SUI coin for a later transfer command.
Builds an unsigned transaction that updates a validator fee.
This local builder creates a transaction, sets its sender, converts the
decimal ratio to an 18-decimal fixed-point integer, and adds
update_validator_fee. It performs no network I/O and does not execute the
transaction.
Wallet sender, operation-cap object ID, new decimal fee ratio, and optional sponsorship flag.
A promise for an unsigned Transaction ready for signing.
Adds the afSUI vault's epoch-processing Move call to a transaction.
This local builder mutates tx and performs no network I/O. It calls
epoch_was_changed with the configured vault, safe, Sui system state,
referral vault, treasury, and a fixed request batch size of 1000.
Transaction to mutate.
Transaction to mutate.
The transaction result returned by the Move call.
Builds a complete programmable transaction block for restaking native
StakedSui objects.
The builder creates a new transaction, sets the wallet sender, optionally updates the referral vault, creates a Move vector from the supplied object IDs, and transfers the returned afSUI to the wallet. It does not fetch coin balances, sign the transaction, or execute it. External fees are not added by this builder.
Wallet, native staked SUI object IDs, destination validator, and optional referral and sponsorship settings.
A promise for an unsigned Transaction ready for signing.
Builds a complete programmable transaction block for liquid staking.
This builder creates a new transaction, sets walletAddress as its sender,
optionally updates the referral vault, fetches a SUI coin through the
configured coin client, optionally transfers the external fee, stakes the
coin, and transfers the returned afSUI to the wallet. It performs coin
selection I/O but does not sign or execute the transaction.
Wallet, raw SUI amount, validator, and optional referral, external-fee, and sponsorship settings.
A promise for an unsigned Transaction ready for signing.
Builds a complete programmable transaction block for liquid unstaking.
This builder creates a new transaction, sets walletAddress as its sender,
optionally updates the referral vault, fetches an afSUI coin, optionally
transfers the external fee, and selects the atomic or queued Move call from
isAtomic. Atomic mode transfers the returned SUI to the wallet. Queued
mode creates an unstake request for the next epoch. The builder performs
coin-selection I/O but does not sign or execute the transaction.
Wallet, raw afSUI amount, atomic-mode flag, and optional referral, external-fee, and sponsorship settings.
A promise for an unsigned Transaction ready for signing.
Adds the Move call that restakes native StakedSui objects for afSUI.
The method creates a Move vector from stakedSuiIds, mutates tx, and
performs no network I/O. The default entry point is
request_stake_staked_sui_vec; withTransfer: true selects its
_and_keep variant. An empty vector or inactive validator can produce a
Move error.
Transaction, native staked SUI object IDs, destination validator, and optional alternate entry-point flag.
Native StakedSui object IDs to place in the Move vector.
Transaction to mutate.
Validator that receives the restaked objects.
OptionalwithTransfer?: booleanSelects the _and_keep Move entry point when true.
The transaction argument returned by the selected Move call. The default entry point returns the afSUI coin for a later transfer command.
Adds the liquid-staking Move call that converts a SUI coin to afSUI.
This method mutates tx and performs no network I/O. The default entry
point is request_stake; setting withTransfer selects
request_stake_and_keep. The selected Move call receives the configured
vault, safe, Sui system state, and referral vault objects.
Transaction, SUI coin argument, destination validator, and optional alternate entry-point flag. The coin amount is already encoded in the supplied coin object.
SUI coin object or transaction argument to stake.
Transaction to mutate.
Validator that receives the native stake.
OptionalwithTransfer?: booleanSelects the request_stake_and_keep Move entry point when true.
The transaction argument returned by the selected Move call. The default entry point returns the afSUI coin for a later transfer command.
Adds a Move inspection call that reads the SUI-to-afSUI exchange rate.
The Move call returns a u128 transaction argument. This method does not
execute the inspection or convert the result to a JavaScript number.
Transaction to mutate.
Transaction to mutate.
The raw transaction argument returned by the Move call. The method does not decode its protocol-specific rate representation.
Adds a Move inspection call that converts a SUI amount to its afSUI value.
The call returns a raw u64 transaction argument. It computes a value and
does not transfer or burn a coin.
Transaction to mutate and raw SUI amount to convert.
SUI amount in raw SUI units.
Transaction to mutate.
The transaction argument containing the raw afSUI result.
Adds a Move inspection call that reads the vault's total SUI amount.
The Move call returns a raw u64 transaction argument. The method mutates
tx and performs no network I/O.
Transaction to mutate.
Transaction to mutate.
The transaction argument containing total SUI in raw units.
Adds a queued afSUI-to-SUI unstake request to a transaction.
The protocol processes the request at the next epoch boundary. This method
mutates tx, performs no network I/O, and calls request_unstake.
Transaction to mutate and the afSUI coin to provide.
afSUI coin object or transaction argument to burn or convert.
Transaction to mutate.
The transaction result returned by the Move call, which represents the unit-valued request entry point.
Adds the Move call that updates a validator's fee.
This local builder mutates tx and performs no network I/O. newFee must
be an 18-decimal fixed-point integer. The operation-cap object must
authorize the validator being updated, and the Move contract enforces its
maximum validator fee.
Transaction, operation-cap object ID, and fixed-point fee.
New validator fee as an 18-decimal fixed-point integer.
Transaction to mutate.
Object ID of the validator operation cap.
The transaction result returned by the Move call.
StaticupdateApplies one normalized staking event to an existing position list.
This is a local state transition and performs no network I/O. A stake event
is appended as a new stake position. An unstake request is added as
state: "REQUEST", and a matching completion event replaces the request
with state: "SUI_MINTED" while retaining the request epoch. Matching uses
afSuiId. The returned list is sorted by descending timestamp; an absent
timestamp sorts after timestamped positions.
Existing positions and one normalized stake or unstake event.
Normalized stake, queued-unstake, or completed-unstake event.
Existing positions to update.
A new position array containing the event's state transition.
Low-level staking adapter for Move commands, complete transaction builders, event types, and staking-position updates.
StakingApiis created byAftermathApi.Staking()and requires the network-specificaddresses.stakingsection. The*Txmethods mutate a caller-ownedTransactionand perform no network I/O. The complete builders that start withfetchBuildcreate a new transaction; stake and unstake builders query the coin API to select an input coin. All balance arguments use raw SUI or afSUI units, and decimal percentages are converted to the protocol's 18-decimal fixed-point representation where required.Throws
The constructor throws when the supplied
AftermathApihas no staking addresses. Move calls can return protocol errors such as an inactive validator, an amount below the minimum threshold, an invalid operation cap, or insufficient atomic-unstake reserves.