Documentation
    Preparing search index...
    • Merges multiple coins into a single coin for transaction building

      This function takes multiple coin objects and merges them into a single coin that can be used in a transaction. It supports optional splitting to create a specific balance amount.

      Parameters

      • tx: Transaction

        Transaction object to add merge operations to

      • coins: (
            {
                balance: string
                | number
                | bigint;
                coinObjectId: string;
                coinType: string;
            } & CoinStruct
        )[]

        Array of coin objects to merge

      • Optionaloptions: {
            addressBalance?: string | number | bigint;
            balance?: number;
            coinType?: string;
            useGasCoin?: boolean;
        }

        Optional parameters for balance splitting and gas coin usage

        • balance - If provided, splits this amount from the resulting coin object
        • useGasCoin - If true, uses the gas coin for the operation
        • addressBalance - Funds held directly at the address level (v2 address balances) for this coin type. coins only carries Coin<T> objects, so when they fall short of balance this covers the remainder. Defaults to 0, which preserves the legacy coin-object-only behavior exactly.
        • coinType - Coin type used to withdraw the shortfall from the address balance via 0x2::coin::redeem_funds. Required for the address-balance path; ignored when the owned coin objects already cover balance.

      Returns any

      Transaction result representing the merged coin