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

    Provides coin-object queries and transaction arguments for AftermathApi.

    The query methods use the provider's Sui client, and the transaction methods append commands to the supplied Transaction.

    Index
    • Fetches every owned coin object for a coin type.

      The method follows all available pages and returns the objects sorted by numeric coin object ID in ascending order.

      Parameters

      • inputs: { coinType: string; walletAddress: string }
        • coinType: string

          Coin type to query.

        • walletAddress: string

          Address whose coin objects to query.

      Returns Promise<CoinStruct[]>

      All matching coin objects from the wallet.

    • Creates transaction arguments for several coin types and amounts.

      The method processes coinTypes and coinAmounts by matching array index and appends each result to the supplied transaction.

      Parameters

      • inputs: {
            coinAmounts: bigint[];
            coinTypes: string[];
            isSponsoredTx?: boolean;
            tx: Transaction;
            walletAddress: string;
        }
        • coinAmounts: bigint[]

          Amounts corresponding to coinTypes by index, in each coin's smallest unit.

        • coinTypes: string[]

          Coin types to select, in the order of the returned arguments.

        • OptionalisSponsoredTx?: boolean

          Whether to use owned coin objects instead of a CoinWithBalance intent.

        • tx: Transaction

          Transaction to mutate.

        • walletAddress: string

          Address that owns the coins and signs the transaction.

      Returns Promise<TransactionObjectArgument[]>

      Transaction arguments in the same order as coinTypes.

      Error when any requested amount cannot be selected.

    • Fetches owned coin objects until their combined balances cover an amount.

      The method selects the largest balances found across pages and stops after 50 pages to avoid creating an oversized transaction for a dust-heavy wallet.

      Parameters

      • inputs: { coinAmount: bigint; coinType: string; walletAddress: string }
        • coinAmount: bigint

          Minimum combined balance to select, in the coin's smallest unit.

        • coinType: string

          Coin type to query.

        • walletAddress: string

          Address whose coin objects to query.

      Returns Promise<CoinStruct[]>

      The selected coin objects, ordered from largest balance to smallest.

      Error when the wallet cannot cover the amount or the balance is spread across more than 50 pages.

    • Creates a transaction argument for a requested amount of one coin type.

      The method sets the transaction sender. For a sponsored transaction, it selects owned coin objects and appends raw merge and split commands. For a non-sponsored transaction, it checks the total balance before adding a CoinWithBalance intent.

      Parameters

      • inputs: {
            coinAmount: bigint;
            coinType: string;
            isSponsoredTx?: boolean;
            tx: Transaction;
            walletAddress: string;
        }
        • coinAmount: bigint

          Amount to represent in the transaction, as a bigint in the coin's smallest unit.

        • coinType: string

          Coin type to select.

        • OptionalisSponsoredTx?: boolean

          Whether the transaction uses an external gas sponsor.

        • tx: Transaction

          Transaction to mutate.

        • walletAddress: string

          Address that owns the coin and signs the transaction.

      Returns Promise<TransactionObjectArgument>

      A transaction argument representing exactly coinAmount of coinType.

      Error when the wallet lacks sufficient balance or has too many coin objects for sponsored selection.