@cfxlabsinc/b2b-services
    Preparing search index...

    Read-only query services to fetch normalized transactions across all products

    If you need more info about a transaction, fetch it using its specific service. Transaction Service will remain generic and high-level.

    Index
    instance: (...args: []) => TransactionQueryService = ...

    The process default, on the replica: every query here is a read, and a read landing inside the lag right after a write self-heals on the next bust.

    • Aggregate transaction totals grouped by (method, type, status).

      Single GROUP BY query against the same UNION used by search, but skips the outer entity / ledger / solana enrichment — aggregation only needs (method, type, status, amount). Use this instead of paging through search when you only need bucketed sums (e.g. the home-page money- movement widget).

      Parameters

      • args: {
            createdAt?: DbTimestampCriteria;
            customerId: string;
            dataSources?: (
                | "deposit"
                | "manual_mint"
                | "withdrawal"
                | "swap"
                | "transfer"
                | "network_transfer"
                | "fee_transfer"
                | "redemption"
                | "card"
                | "escrow_transfer"
                | "reward"
                | "blockchain_deposit"
                | "blockchain_withdrawal"
                | "ledger_account_withdrawal"
            )[];
            methods?: (
                | "ACH_CREDIT"
                | "ACH_DEBIT"
                | "AF_BANK"
                | "AF_MOMO"
                | "BLOCKCHAIN"
                | "CASH"
                | "CFX_NETWORK"
                | "DEPOSIT"
                | "ESCROW"
                | "FEDWIRE"
                | "FEDWIRE_DRAWDOWN"
                | "FEDNOW"
                | "RTP"
                | "INSTANT"
                | "SPEI"
                | "DEBIT_CARD"
                | "REWARD"
                | "SWAP"
                | "SWIFT"
                | "TRANSFER"
                | "VIRTUAL_CARD"
                | "WITHDRAWAL"
            )[];
            statuses?: (
                | "PENDING"
                | "FAILED"
                | "PROCESSING"
                | "COMPLETED"
                | "RETURNED"
                | "CANCELLED"
            )[];
            subtypes?: | (
                | "DEPOSIT"
                | "RETURN"
                | "FEE"
                | "ADJUSTMENT"
                | "POINTS"
                | "LEDGER_ACCOUNT"
                | "PLATFORM_SETTLEMENT"
                | undefined
            )[]
            | null;
        }
        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • OptionaldataSources?: (
              | "deposit"
              | "manual_mint"
              | "withdrawal"
              | "swap"
              | "transfer"
              | "network_transfer"
              | "fee_transfer"
              | "redemption"
              | "card"
              | "escrow_transfer"
              | "reward"
              | "blockchain_deposit"
              | "blockchain_withdrawal"
              | "ledger_account_withdrawal"
          )[]

          Filter by the producing arm; prunes the UNION exactly.

        • Optionalmethods?: (
              | "ACH_CREDIT"
              | "ACH_DEBIT"
              | "AF_BANK"
              | "AF_MOMO"
              | "BLOCKCHAIN"
              | "CASH"
              | "CFX_NETWORK"
              | "DEPOSIT"
              | "ESCROW"
              | "FEDWIRE"
              | "FEDWIRE_DRAWDOWN"
              | "FEDNOW"
              | "RTP"
              | "INSTANT"
              | "SPEI"
              | "DEBIT_CARD"
              | "REWARD"
              | "SWAP"
              | "SWIFT"
              | "TRANSFER"
              | "VIRTUAL_CARD"
              | "WITHDRAWAL"
          )[]
        • Optionalstatuses?: ("PENDING" | "FAILED" | "PROCESSING" | "COMPLETED" | "RETURNED" | "CANCELLED")[]
        • Optionalsubtypes?:
              | (
                  | "DEPOSIT"
                  | "RETURN"
                  | "FEE"
                  | "ADJUSTMENT"
                  | "POINTS"
                  | "LEDGER_ACCOUNT"
                  | "PLATFORM_SETTLEMENT"
                  | undefined
              )[]
              | null

          Pass values to include only those subtypes; pass null to exclude transactions with a subtype

      Returns Promise<{ ok: true; value: { items: TransactionMethodAggregate[] } }>

    • Entity external ids the customer has transacted with, ordered by recency (most recently transacted first), optionally filtered by entityType. Uncached.

      Parameters

      • __namedParameters: {
            createdAt?: DbTimestampCriteria;
            customerId: string;
            entityType?: NonNullable<"IDENTITY" | "ORGANIZATION" | null>;
            limit?: number;
        }

      Returns Promise<{ ok: true; value: { entityIds: string[] } }>

    • Every matching transaction, a page at a time, oldest page first.

      For callers that read the whole result set (CSV and XLSX exports, the DART reports, a statement period) rather than one page of it. Walks by keyset, so the cost per page does not grow with how deep the walk has gone the way search's OFFSET paging does. The cache is deliberately not in the path: a full walk would evict every useful entry for a result nobody reads twice.

      Pages rather than rows so a caller can resolve related data for a whole page in one query instead of once per row.

      Parameters

      • args: TransactionSearchFilters & {
            customerId: string;
            orderBy?: TransactionOrderBy[];
            pageSize?: number;
        }

      Returns AsyncGenerator<Transaction[]>

    • Payment-instrument external ids the customer has transacted with, ranked by usage (most-used first). Skips the outer entity / ledger / solana enrichment — ranking only needs (payment_instrument_id, method, created_at). Uncached.

      Parameters

      • __namedParameters: {
            createdAt?: DbTimestampCriteria;
            customerId: string;
            dataSources?: (
                | "deposit"
                | "manual_mint"
                | "withdrawal"
                | "swap"
                | "transfer"
                | "network_transfer"
                | "fee_transfer"
                | "redemption"
                | "card"
                | "escrow_transfer"
                | "reward"
                | "blockchain_deposit"
                | "blockchain_withdrawal"
                | "ledger_account_withdrawal"
            )[];
            limit?: number;
            methods?: (
                | "ACH_CREDIT"
                | "ACH_DEBIT"
                | "AF_BANK"
                | "AF_MOMO"
                | "BLOCKCHAIN"
                | "CASH"
                | "CFX_NETWORK"
                | "DEPOSIT"
                | "ESCROW"
                | "FEDWIRE"
                | "FEDWIRE_DRAWDOWN"
                | "FEDNOW"
                | "RTP"
                | "INSTANT"
                | "SPEI"
                | "DEBIT_CARD"
                | "REWARD"
                | "SWAP"
                | "SWIFT"
                | "TRANSFER"
                | "VIRTUAL_CARD"
                | "WITHDRAWAL"
            )[];
        }
        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • OptionaldataSources?: (
              | "deposit"
              | "manual_mint"
              | "withdrawal"
              | "swap"
              | "transfer"
              | "network_transfer"
              | "fee_transfer"
              | "redemption"
              | "card"
              | "escrow_transfer"
              | "reward"
              | "blockchain_deposit"
              | "blockchain_withdrawal"
              | "ledger_account_withdrawal"
          )[]

          Filter by the producing arm; prunes the UNION exactly.

        • Optionallimit?: number
        • Optionalmethods?: (
              | "ACH_CREDIT"
              | "ACH_DEBIT"
              | "AF_BANK"
              | "AF_MOMO"
              | "BLOCKCHAIN"
              | "CASH"
              | "CFX_NETWORK"
              | "DEPOSIT"
              | "ESCROW"
              | "FEDWIRE"
              | "FEDWIRE_DRAWDOWN"
              | "FEDNOW"
              | "RTP"
              | "INSTANT"
              | "SPEI"
              | "DEBIT_CARD"
              | "REWARD"
              | "SWAP"
              | "SWIFT"
              | "TRANSFER"
              | "VIRTUAL_CARD"
              | "WITHDRAWAL"
          )[]

      Returns Promise<{ ok: true; value: { paymentInstrumentIds: string[] } }>