aftermath-ts-sdk - v3.3.3
    Preparing search index...

    Low-level NFT AMM API and transaction-builder methods.

    Object methods use the configured AftermathApi for on-chain reads. Builder methods either create a new unsigned transaction or append one Move call to a caller-owned transaction. No method signs or executes a transaction.

    Index
    addresses: NftAmmAddresses

    Package and shared-object addresses required by NFT AMM Move calls.

    • Appends an NFT AMM withdrawal Move call to an existing transaction.

      This local builder accepts an LP coin object ID or transaction argument and NFT object IDs. withTransfer: true targets interface::withdraw; otherwise it targets actions::withdraw. The expected asset output is a raw balance in the asset coin's smallest unit.

      Parameters

      • inputs: {
            expectedAssetCoinAmountOut: bigint;
            genericTypes: NftAmmInterfaceGenericTypes;
            lpCoin: string | TransactionArgument;
            marketObjectId: string;
            nftObjectIds: string[];
            slippage: number;
            tx: Transaction;
            withTransfer?: boolean;
        }

        Transaction, market object ID, LP coin argument, NFT IDs, expected asset output, type tuple, slippage, and transfer mode.

      Returns TransactionResult

      The TransactionArgument returned by tx.moveCall.

      Errors from the Sui transaction builder when an argument is invalid.

    • Appends an NFT AMM buy Move call to an existing transaction.

      This local builder does not create a transaction, set its sender, select coins, or sign. withTransfer: true targets interface::buy; otherwise it targets actions::buy, allowing the caller to compose the returned Move values. The slippage value is encoded as the fixed-point complement 1 - inputs.slippage.

      Parameters

      • inputs: {
            assetCoin: string | TransactionArgument;
            expectedAssetCoinAmountIn: bigint;
            genericTypes: NftAmmInterfaceGenericTypes;
            marketObjectId: string;
            nftObjectIds: string[];
            slippage: number;
            tx: Transaction;
            withTransfer?: boolean;
        }

        Transaction, market object ID, asset coin argument, NFT IDs, expected asset input, type tuple, slippage, and transfer mode.

      Returns TransactionResult

      The TransactionArgument returned by tx.moveCall.

      Errors from the Sui transaction builder when an argument is invalid.

    • Appends an NFT AMM deposit Move call to an existing transaction.

      The expectedLpRatio argument is an 18-decimal fixed-point bigint. The builder accepts asset and NFT inputs as object IDs or transaction arguments, and selects interface::deposit when withTransfer is true, otherwise actions::deposit.

      Parameters

      • inputs: {
            assetCoin: string | TransactionArgument;
            expectedLpRatio: bigint;
            genericTypes: NftAmmInterfaceGenericTypes;
            marketObjectId: string;
            nfts: (string | TransactionArgument)[];
            slippage: number;
            tx: Transaction;
            withTransfer?: boolean;
        }

        Transaction, market object ID, asset coin argument, NFT arguments, fixed LP ratio, type tuple, slippage, and transfer mode.

      Returns TransactionResult

      The TransactionArgument returned by tx.moveCall.

      Errors from the Sui transaction builder when an argument is invalid.

    • Builds an unsigned NFT AMM buy transaction.

      This method creates a new Transaction, sets walletAddress as its sender, calculates the required asset-coin amount from the NFT count, and selects that coin from the wallet through Coin.fetchCoinWithAmountTx. It then appends the interface::buy call with withTransfer: true. slippage is a decimal fraction such as 0.01 for 1%; the Move call receives the fixed-point complement 1 - slippage.

      Parameters

      • inputs: {
            market: NftAmmMarket;
            nftObjectIds: string[];
            referrer?: string;
            slippage: number;
            walletAddress: string;
        }

        Market facade, sender address, NFT IDs to buy, slippage, and optional referrer.

      Returns Promise<Transaction>

      An unsigned transaction with the sender set to walletAddress.

      Errors from quote calculation, coin selection, the configured provider, or the Sui transaction builder.

    • Builds an unsigned NFT AMM deposit transaction.

      The method creates a transaction with walletAddress as sender, calculates the pool LP ratio, converts that ratio to an 18-decimal fixed-point bigint, selects the requested asset-coin amount from the wallet, and appends the interface::deposit call with withTransfer: true.

      Parameters

      • inputs: {
            assetCoinAmountIn: bigint;
            market: NftAmmMarket;
            nfts: (string | TransactionArgument)[];
            referrer?: string;
            slippage: number;
            walletAddress: string;
        }

        Market facade, sender address, asset amount, NFT IDs, slippage, and optional referrer.

      Returns Promise<Transaction>

      An unsigned transaction with the sender set to walletAddress.

      Errors from quote calculation, coin selection, the configured provider, or the Sui transaction builder.

    • Builds an unsigned NFT AMM sell transaction.

      This method creates a new Transaction, sets walletAddress as its sender, estimates the asset-coin output from the number of NFT IDs, and appends the interface::sell call with withTransfer: true. It does not fetch the NFT objects first. The sender must own the supplied NFT IDs when the transaction executes.

      Parameters

      • inputs: {
            market: NftAmmMarket;
            nftObjectIds: string[];
            referrer?: string;
            slippage: number;
            walletAddress: string;
        }

        Market facade, sender address, NFT IDs to sell, slippage, and optional referrer.

      Returns Promise<Transaction>

      An unsigned transaction with the sender set to walletAddress.

      Errors from quote calculation or the Sui transaction builder.

    • Builds an unsigned NFT AMM withdrawal transaction.

      The method creates a transaction with walletAddress as sender, estimates the fractionalized-coin output, converts the non-zero output to the minimum asset-coin amount used by the Move call, selects the LP coin amount from the wallet, and appends the interface::withdraw call with withTransfer: true.

      Parameters

      • inputs: {
            lpCoinAmount: bigint;
            market: NftAmmMarket;
            nftObjectIds: string[];
            referrer?: string;
            slippage: number;
            walletAddress: string;
        }

        Market facade, sender address, LP amount, NFT IDs, slippage, and optional referrer.

      Returns Promise<Transaction>

      An unsigned transaction with the sender set to walletAddress.

      Errors from quote calculation, coin selection, the configured provider, or the Sui transaction builder.

    • Fetches and casts one NFT AMM market object by ID.

      The response is converted by NftAmmApiCasting.marketObjectFromSuiObject. The current caster expects the nested pool and supply data to contain type information that is not available in every response, so casting errors are propagated instead of being replaced with guessed type arguments.

      Parameters

      • inputs: { objectId: string }

        The market's on-chain object ID.

      Returns Promise<NftAmmMarketObject>

      The cast market object, including pool and coin type data.

      Errors from the object client or the market caster.

    • Fetches and casts a batch of NFT AMM market objects by ID.

      Parameters

      • inputs: { objectIds: string[] }

        The market object IDs to fetch.

      Returns Promise<NftAmmMarketObject[]>

      The cast market objects returned by the object client.

      Errors from the object client or the market caster.

    • Fetches one page of NFTs from an NFT AMM market's dynamic-field table.

      The method lists fields under marketTableObjectId, uses the optional object-ID cursor and numeric page limit, and resolves the field object IDs through the NFT API. A null nextCursor means that no later page exists.

      Parameters

      • inputs: { cursor?: string; limit?: number; marketTableObjectId: string }

        The table parent object ID, optional previous-page cursor, and page size.

      Returns Promise<DynamicFieldObjectsWithCursor<Nft>>

      The resolved NFTs and the next dynamic-field cursor.

      Errors from dynamic-field listing or NFT object resolution.

    • Appends an NFT AMM sell Move call to an existing transaction.

      This local builder accepts either object IDs or existing transaction object arguments in nfts. withTransfer: true targets interface::sell; otherwise it targets actions::sell. The caller must provide NFT objects owned or otherwise usable by the transaction sender.

      Parameters

      • inputs: {
            expectedAssetCoinAmountOut: bigint;
            genericTypes: NftAmmInterfaceGenericTypes;
            marketObjectId: string;
            nfts: (string | TransactionArgument)[];
            slippage: number;
            tx: Transaction;
            withTransfer?: boolean;
        }

        Transaction, market object ID, NFT arguments, expected asset output, type tuple, slippage, and transfer mode.

      Returns TransactionResult

      The TransactionArgument returned by tx.moveCall.

      Errors from the Sui transaction builder when an argument is invalid.