Create a new PerpetualsVault wrapper.
Raw on-chain vault object snapshot.
Optionalconfig: CallerConfig
Optional CallerConfig (network, auth, base URL).
Optionalapi: AftermathApi
Optional shared AftermathApi provider. When provided,
transaction builders will serialize Transactions into txKind.
Optional ReadonlyapiOptional shared AftermathApi provider. When provided,
transaction builders will serialize Transactions into txKind.
The mutable configuration used for subsequent requests.
ReadonlyvaultRaw on-chain vault object snapshot.
Fetch a PerpetualsAccount wrapper for the vault’s underlying account.
{ account } where account is a high-level PerpetualsAccount.
Fetch the underlying perpetuals account object for this vault.
{ account } where account is the on-chain PerpetualsAccountObject.
Fetch all withdraw requests for this vault.
ApiPerpetualsVaultsWithdrawRequestsResponse containing requests
scoped to this.vaultObject.objectId.
This currently calls the vaults/withdraw-requests endpoint with a single vault ID.
This may be moved to Perpetuals as a shared helper.
Build a user transaction to cancel an existing vault withdraw request.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Wallet canceling the request.
Transaction response containing tx.
Build a user transaction to create a vault withdraw request.
Withdrawals are request-based: the user specifies how much LP to redeem and a minimum collateral output amount.
Amount of LP to withdraw.
Minimum collateral out (slippage guard).
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Wallet creating the request.
Transaction response containing tx.
Build a user transaction to deposit collateral into the vault in exchange for LP.
You can specify the deposit as:
depositAmount (wallet pays directly), ORdepositCoinArg (use an existing transaction argument)OptionalisSponsoredTx?: booleanWhether the tx is sponsored (gas paid by another party).
Minimum LP out (slippage guard).
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Depositor wallet.
Amount of collateral to deposit (mutually exclusive with depositCoinArg).
Transaction argument referencing collateral coin.
Transaction response containing tx.
Build an owner transaction that grants assistant permissions for this vault.
Fetch the current LP coin price for this vault (in collateral units).
Internally calls Perpetuals.getLpCoinPrices and returns the first price.
LP coin price as a number.
Build an owner transaction to process one or more users' withdraw requests.
This is the normal (non-force) processing path for withdrawals. The owner batches users and settles their requests in a single transaction.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Users whose requests should be processed.
Transaction response containing tx.
Build an owner transaction to update the vault's force withdraw delay.
New delay (ms). Should be no greater than the current maxForceWithdrawDelayMs from Perpetuals.getVaultsConfig.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Transaction response containing tx.
Build an owner transaction to update the vault's lock period.
New lock period (ms). Should be no greater than the current maxLockPeriodMs from Perpetuals.getVaultsConfig.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Transaction response containing tx.
Build an owner transaction to update the vault performance fee.
New fee as a fraction (e.g. 0.2 = 20%).
Should be no greater than the current maxPerformanceFeePercentage from Perpetuals.getVaultsConfig.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Transaction response containing tx.
Build an owner transaction to withdraw vault collateral by redeeming LP.
Amount of LP to redeem.
Minimum collateral out to protect from slippage.
OptionalrecipientAddress?: stringOptional recipient address for withdrawn collateral.
Optionaltx?: TransactionOptional transaction to extend.
Response containing tx and any extra outputs described by
ApiPerpetualsVaultOwnerWithdrawCollateralTxResponse.
Build an owner transaction to withdraw locked liquidity from the vault.
Owner-locked liquidity is LP that was locked at vault creation time. This flow allows the owner to withdraw a portion without going through the standard withdraw-request lifecycle. Owner-locked withdrawals are exempt from performance fees.
Amount of locked LP to withdraw (native units).
Minimum collateral out to protect from slippage.
OptionalrecipientAddress?: stringOptional recipient address for withdrawn collateral.
Optionaltx?: TransactionOptional transaction to extend.
Response containing tx and any extra outputs described by
ApiPerpetualsVaultOwnerWithdrawLockedLiquidityTxResponse.
Build an owner transaction to withdraw accrued performance fees.
OptionalrecipientAddress?: stringOptional recipient address for the withdrawn fees.
Optionaltx?: TransactionOptional transaction to extend.
Amount of collateral to withdraw as fees.
Response containing tx and any extra outputs described by
ApiPerpetualsVaultOwnerWithdrawPerformanceFeesTxResponse.
Build a transaction that pauses this vault for force-withdraw processing.
The builder adds this vault's object ID, serializes the supplied transaction
as txKind when an AftermathApi is available, and leaves signing
and execution to the caller. Optional sponsor data is forwarded to the API.
Optionalsponsor?: PerpetualsSponsorConfigCached gas-pool sponsorship data, if required.
Optionaltx?: TransactionExisting transaction to extend; otherwise a new one is used.
The backend transaction response.
Preview creating a withdraw request.
LP amount to withdraw.
Requesting wallet.
Preview response including estimated collateral out and constraints.
Preview depositing into the vault.
Deposit amount in collateral coin units.
Preview response including estimated LP out.
Preview the results of an owner processing one or more withdraw requests.
Users to process.
Preview response with expected effects.
Preview an owner collateral withdrawal (LP redemption).
LP amount to redeem.
Preview response including estimated collateral out.
Preview an owner locked liquidity withdrawal.
Returns the estimated collateral output for withdrawing a given amount of the owner's locked LP tokens. Owner-locked withdrawals are exempt from performance fees.
Amount of locked LP to withdraw (native units).
Preview response including estimated collateral out and price.
Preview the amount available for the owner to withdraw as performance fees.
Preview response including withdrawable fees and related metadata.
Preview whether this vault can be paused for force-withdraw processing.
The wallet address identifies the caller for the backend preview. This method performs HTTP I/O and does not build, sign, or submit a transaction.
Address whose force-withdraw request is checked.
Either an error string or { isPausable, minNextPauseTimestamp }.
The timestamp is a Unix timestamp in milliseconds as a bigint.
Preview processing a force withdraw request for a user.
This is useful to determine what positions/sizes must be closed or what the expected outputs are prior to building the actual transaction.
User wallet with a pending force-withdraw.
Preview response describing expected processing effects.
Build a process-force-withdraw-request transaction.
Force-withdraw is a mechanism that closes required positions and processes a withdraw request after a delay window (see vault params).
OptionalrecipientAddress?: stringOptional recipient of the withdrawn collateral.
Mapping of marketId -> size (base units) to close.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
User wallet that owns the withdraw request.
Transaction response containing tx (and any additional outputs
provided by the backend response type).
Build an owner transaction that revokes an assistant from this vault.
Build an update-withdraw-request-slippage transaction.
This updates the user's minimum acceptable collateral output amount for an existing withdraw request.
New minimum collateral amount out.
Optionalsponsor?: PerpetualsSponsorConfigOptionaltx?: TransactionOptional transaction to extend.
Transaction response containing tx.
Reports whether the vault is currently paused for force withdrawals.
The comparison uses vaultObject.pausedUntilTimestamp in Unix
milliseconds. A missing timestamp or a timestamp at or before Date.now()
means that the vault is not paused.
true while the current time is before the pause deadline.
Build a lightweight “cap-like” object for the vault’s underlying account.
PerpetualsPartialVaultCap suitable for account fetch helpers
such as Perpetuals.getAccount.
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.
StaticcalcCompute the implied slippage tolerance for a withdraw request.
Defined as:
(lpAmountInUsd - minCollateralAmountOutUsd) / lpAmountInUsd
Withdraw request to analyze.
Slippage fraction (0..1). Returns 0 if lpAmountInUsd is missing/zero.
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.
StaticisStaticis
High-level wrapper around a single Perpetuals vault.
A vault is a managed perpetuals account that accepts user deposits (LP), trades across up to a bounded set of markets, and supports withdrawals via a request flow.
This class provides:
Typical usage: