Creates a market facade from an API market object.
Market data, including its pool and Move type arguments.
Optionalconfig: CallerConfig
Optional caller configuration used by NFT-table reads.
Optionalapi: AftermathApi
Optional AftermathApi used by NFT-table reads and transaction builders.
The mutable configuration used for subsequent requests.
ReadonlymarketMarket object and public on-chain market fields.
Pool facade constructed from market.pool for local quote calculations.
Calculates the pool spot price from asset coin to fractionalized coin.
The result is a JavaScript number adjusted for both coins' decimal scalars,
not a raw Balance. Set withFees to include pool fees in the spot price;
omit it to use the pool calculation's default fee behavior.
Optionalinputs: { withFees: boolean }
Optional withFees flag.
Fractionalized-coin output units per asset-coin input unit.
Calculates the asset-coin amount required to buy a number of NFTs.
The requested fractionalized output equals nftsCount multiplied by the
market's fractionalized amount per NFT. The result is in the asset coin's
smallest unit. A defined referral flag enables referral-aware pool math.
NFT count and optional referral flag.
Required asset-coin input in smallest units.
Builds an unsigned transaction that buys the selected NFTs from this market.
The builder selects the required asset coin from walletAddress, sets that
address as the transaction sender, and appends the NFT AMM buy call. The
wallet must own enough of the market's asset coin and must sign the returned
transaction before execution.
Market ID, wallet address, NFT IDs, decimal slippage, and optional referrer.
An unsigned Sui Transaction with the sender set.
Calculates LP output for depositing an asset-coin amount.
The returned lpAmountOut is in LP-coin smallest units. lpRatio is the
pool's local JavaScript-number ratio and is not itself a coin amount.
Asset-coin amount in smallest units and optional referral flag.
LP amount and the calculated local LP ratio.
Builds an unsigned transaction that deposits an asset coin and NFTs into this market.
The asset amount is in the asset coin's smallest unit. The builder selects
that amount from walletAddress, calculates the expected LP ratio, and
appends the deposit call. The wallet must own the asset coin and NFT inputs
and must sign the returned transaction.
Market ID, wallet address, asset amount, NFT IDs, decimal slippage, and optional referrer.
An unsigned Sui Transaction with the sender set.
Calculates the pool spot price from fractionalized coin to asset coin.
The result is a JavaScript number adjusted for both coins' decimal scalars,
not a raw Balance. Set withFees to include pool fees in the spot price;
omit it to use the pool calculation's default fee behavior.
Optionalinputs: { withFees: boolean }
Optional withFees flag.
Asset-coin output units per fractionalized-coin input unit.
Fetches one page of NFTs stored in the market's dynamic-field table.
The method uses market.objectId as the dynamic-field parent and defaults
limit to 25. cursor is the object ID returned by the previous page's
nextCursor; a null result cursor means that the table is exhausted.
Optional page cursor and maximum number of NFTs.
A page of Nft objects and a nullable next cursor.
Estimates the spot price of one NFT in asset-coin smallest units.
The calculation multiplies the pool's asset-to-fractionalized-coin spot
price by market.fractionalizedCoinAmount and converts the JavaScript
number result to bigint. The conversion therefore has the precision limits
of the intermediate number calculation.
Optionalinputs: { withFees: boolean }
Optional withFees flag passed to the pool spot-price calculation.
The estimated asset-coin amount for one NFT, in smallest units.
Calculates the asset-coin amount received for selling a number of NFTs.
The fractionalized input equals nftsCount multiplied by the market's
fractionalized amount per NFT. The result is in the asset coin's smallest
unit. A defined referral flag enables referral-aware pool math.
NFT count and optional referral flag.
Asset-coin output in smallest units.
Builds an unsigned transaction that sells the selected NFTs to this market.
The wallet identified by walletAddress must own the NFT objects supplied
in nftObjectIds. The returned transaction transfers the calculated asset
coin output to that sender when the Move call executes.
Market ID, wallet address, NFT IDs, decimal slippage, and optional referrer.
An unsigned Sui Transaction with the sender set.
Estimates the fractionalized-coin output for an LP withdrawal.
The method converts lpCoinAmount to the pool's local withdrawal ratio and
requests a fractionalized-coin output direction equal to one NFT's
fractionalized amount. The returned value is in fractionalized-coin
smallest units. A defined referral flag enables referral-aware pool math.
LP-coin amount in smallest units and optional referral flag.
Fractionalized-coin output in smallest units.
Estimates how many whole NFTs correspond to an LP withdrawal.
The method divides the estimated fractionalized-coin output by the market's fractionalized amount per NFT using bigint integer division, so any partial NFT amount is discarded. The underlying withdrawal calculation may throw when the requested LP amount is outside the pool's supported range.
LP-coin amount in smallest units and optional referral flag.
The minimum whole NFT count as a bigint.
Builds an unsigned transaction that withdraws LP liquidity and selected NFTs.
lpCoinAmount is in the LP coin's smallest unit. The builder selects that
LP coin from walletAddress, estimates the asset-coin minimum output, and
appends the withdraw call. The wallet must own the LP coin and must sign the
returned transaction.
Market ID, wallet address, LP amount, NFT IDs, decimal slippage, and optional referrer.
An unsigned Sui Transaction with the sender set.
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.
Wraps one NFT AMM market with NFT reads, unsigned transaction builders, and pool-based quote calculations.
The class does not sign or execute transactions. Its transaction methods return unsigned
Transactionobjects that the caller must sign and submit with a wallet that owns the required input objects.