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

    Function selectAccountsByPreferredTreeType

    • Selects accounts by preferred tree type with automatic fallback.

      In V2 mode, prefers StateV2 accounts. Falls back to StateV1 if V2 has insufficient balance.

      This ensures all returned accounts are from the same tree type, preventing mixed V1/V2 batch proof failures.

      Parameters

      • accounts: ParsedTokenAccount[]

        All available accounts (can be mixed V1/V2)

      • OptionalrequiredAmount: BN

        Minimum amount needed (optional - if not provided, returns all from preferred type)

      Returns SelectedAccountsResult

      Selected accounts from a single tree type