@alphafi/alphalend-sdk - v4.1.0
    Preparing search index...

    Function buildMergeCoinsTransaction

    • Build a transaction consolidating address's Coin<coinType> objects into a single coin object or into the address balance (accumulator). With coin-object output any existing address balance is withdrawn and merged in too. Handles at most MAX_COINS_PER_TX objects — re-run until one remains.

      Gas payment is set explicitly for SUI: build-time gas resolution can only pick SUI coins that are not transaction inputs, and here every SUI coin is one. The largest SUI coin is reserved as gas (it alone must cover the budget), except with address-balance output when the address balance already exceeds MIN_ADDRESS_BALANCE_FOR_GAS — then gas resolves against it and every coin object is sent, leaving none behind.

      The address balance is withdrawn as an exact amount read at build time (the protocol has no entire-balance withdrawal), so concurrent accumulator activity fails the transaction with "Invalid withdraw reservation".

      Parameters

      • coinType: string
      • output: MergeCoinsOutput
      • address: string
      • network: Network
      • OptionalgrpcUrl: string
      • OptionalgrpcToken: string

      Returns Promise<Transaction>