Creates a pool client without making a network request.
Supply api when transaction methods must select coins or configure
referral transactions. Read methods can use config alone.
Optionalconfig: CallerConfig
Optional API host, network, and access-token configuration.
Optionalapi: AftermathApi
Optional provider used by transaction builders and DAO-fee commands.
Optional ReadonlyapiOptional provider used by transaction builders and DAO-fee commands.
The mutable configuration used for subsequent requests.
Static ReadonlyconstantsProtocol fee fractions, referral settings, safety bounds, and defaults used by the high-level pool helpers.
Decimal safety bounds enforced by local estimates and pool creation validation.
Maximum number of distinct coins allowed in a single pool.
Maximum decimal fraction of a pool balance accepted for one trade.
Maximum decimal fraction of a pool balance accepted for one withdrawal.
Minimum and maximum decimal DAO fees. The range is 0% to 100%.
Minimum and maximum decimal swap fees. The range is 0.0001 to 0.1,
or 0.01% to 10%.
Minimum and maximum decimal coin weights. The range is 1% to 99%.
Defaults used when a caller does not supply an explicit value.
Default LP coin decimal precision.
Protocol fee fractions. totalProtocol is taken from a trade and the
other fields describe its allocation.
The fraction of totalProtocol allocated to the dev wallet.
The fraction of totalProtocol allocated to the insurance fund.
The total decimal fraction charged by the protocol. 0.00005 is
0.005%.
The fraction of totalProtocol allocated to the treasury.
Referral fractions applied to the treasury allocation. The static fee
helper uses discount; referral transaction builders register the
referrer separately.
The fraction of the treasury allocation used as a user fee discount.
The configured fraction of the treasury allocation reserved as a referrer rebate.
Fetches every pool recognized by the Aftermath API.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for all decoded Pool instances.
Builds an unsigned transaction that creates a new pool on chain.
The API serializes nested bigint deposits with an n suffix, and the
caller must supply a creation capability and initial coin balances. This
method does not sign, submit, or serialize the returned Transaction.
Pool type, metadata, coin configuration, capability, and fee settings.
A promise for the unsigned pool-creation Transaction.
const createPoolTx = await pools.getCreatePoolTransaction({
walletAddress: "0x<address>",
lpCoinType: "0x<lpCoin>",
lpCoinMetadata: {
name: "MyPool LP",
symbol: "MYPLP"
},
coinsInfo: [
{
coinType: "0x<coinA>",
weight: 0.5,
decimals: 9,
tradeFeeIn: 0.003,
initialDeposit: 1_000_000_000n
},
// ...
],
poolName: "My Weighted Pool",
createPoolCapId: "0x<capId>",
respectDecimals: true,
});
Fetches a wallet's deposit and withdrawal events across pools.
Wallet address and optional indexer pagination fields.
A promise for paginated PoolDepositEvent and PoolWithdrawEvent values.
Fetches DAO fee owner capabilities owned by a wallet.
Each returned capability identifies a DAO fee pool whose fee or recipient the wallet can update. DAO-fee package addresses must be configured.
The wallet address to inspect.
A promise for the owned DAO fee capability objects.
Fetches the LP coin balances owned by a wallet across pools.
The wallet address to inspect.
A promise for LP coin types, pool IDs, and smallest-unit balances.
Fetches one pool by its on-chain object ID and wraps it in Pool.
The pool object ID to read.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for a Pool backed by the decoded API object.
Resolves one LP coin type through the batch pool-ID endpoint.
The response is an array with one entry, which can be undefined when the
type is not registered. Use getPoolObjectIdsForLpCoinTypes for several
types.
The LP coin type to resolve.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for a one-entry (ObjectId | undefined)[] result.
Resolves LP coin types to pool object IDs.
The response preserves input order and uses undefined for an LP type with
no associated pool.
LP coin types to resolve.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for one result per input type.
Fetches multiple pools by object ID and wraps the returned objects in Pool.
The pool object IDs to read.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for pools in the API response order.
Fetches analytics for a selected set of pools.
Pool object IDs to include, in the requested order.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for the corresponding PoolStats values.
Fetches pool objects and analytics in one API response.
Omit poolIds to request every pool summary.
Optionalinputs: ApiPoolsSummaryBody
Optional pool IDs to include.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for pool objects paired with current PoolStats.
Builds an unsigned transaction that publishes the compiled LP coin package.
The transaction transfers the resulting upgrade capability to
walletAddress. It is not signed, submitted, or serialized by this method.
Publisher address and compiled LP coin decimal precision.
A promise for the unsigned publish Transaction.
Fetches the protocol-wide 24-hour pool volume.
A promise for the numeric API value. This method does not convert its unit.
Fetches total value locked across all pools or a selected pool set.
Optionalinputs: { poolIds?: string[] }
Optional pool IDs. Omit the argument for protocol-wide TVL.
A promise for the numeric API TVL value. This method does not convert its unit.
Checks whether an LP coin type maps to a registered pool.
This performs the same API read as getPoolObjectIdForLpCoinType and does
not validate the coin type from its string shape alone.
The LP coin type to resolve.
OptionalabortSignal: AbortSignal
Optional caller-owned cancellation signal.
A promise for true when the API returns a pool ID.
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.
StaticdisplayFormats an Aftermath LP coin type for display.
The method reads the type symbol, removes the AF_LP_ prefix when present,
title-cases underscore-separated components, and appends LP. It does not
validate the type on chain.
The fully qualified LP coin type.
A display label such as "A B LP".
StaticgetReverses getAmountWithProtocolFees for a smallest-unit amount.
The result is rounded down. With withReferral: true, it uses the same
treasury discount as the forward calculation. It does not register a
referrer or pay a referral rebate.
The net amount in a coin's smallest unit and optional referral flag.
The estimated gross amount in the same smallest unit, rounded down.
StaticgetApplies the protocol fee to a smallest-unit amount.
The default protocol fee is 0.00005, or 0.005%. With
withReferral: true, the helper reduces only the treasury portion by the
configured referral discount. It does not register a referrer or calculate
the separate referrer rebate. Use a referral-aware transaction builder for
that side effect.
The gross amount in a coin's smallest unit and optional referral flag.
The net amount in the same smallest unit, rounded down.
StaticisPerforms a string-shape check for an Aftermath LP coin type.
The check requires three :: segments, an af_lp module segment, and an
AF_LP symbol segment. It does not query the API or prove that a pool exists.
The coin type string to inspect.
true when the string matches the heuristic pattern.
StaticnormalizeConverts a decimal slippage tolerance to the fixed-point minimum-result factor.
A decimal fraction from 0 to 1. 0.01 represents 1%.
1 - slippage encoded as an on-chain fixed-point bigint.
Provides high-level pool reads, transaction requests, fee helpers, and pool discovery for Aftermath AMMs.
API methods return decoded
bigintamounts in coin or LP smallest units. Transaction methods return unsignedTransactionobjects. Network failures are normalized asAftermathTransportErrorby the shared caller.Example