@lightprotocol/compressed-token - v0.23.0-beta.8
    Preparing search index...

    Function selectInputsForAmount

    • Select compressed inputs for a target amount.

      Sorts by amount descending (largest first), accumulates until the target is met, then pads to MAX_INPUT_ACCOUNTS if possible within a single batch.

      • If the amount is covered by N <= 8 inputs, returns min(8, total) inputs.
      • If more than 8 inputs are needed, returns exactly as many as required (no padding beyond the amount-needed count).
      • Returns [] when neededAmount <= 0 or accounts is empty.

      Parameters

      • accounts: ParsedTokenAccount[]

        Cold light-token accounts available for loading.

      • neededAmount: bigint

        Amount that must be covered by selected inputs.

      Returns ParsedTokenAccount[]

      Subset of accounts, sorted largest-first.