@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

    Constructors

    Methods

    • 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;
            methods?: (
                | "REDEMPTION"
                | "TRANSFER"
                | "SWAP"
                | "DEPOSIT_BLOCKCHAIN"
                | "DEPOSIT_DIRECT"
                | "DEPOSIT_US_BANK_ACH"
                | "DEPOSIT_ACH_CREDIT"
                | "DEPOSIT_RTP"
                | "DEPOSIT_US_CASH"
                | "DEPOSIT_US_WIRE"
                | "DEPOSIT_SWIFT_WIRE"
                | "FEE_TRANSFER"
                | "TRANSFER_NETWORK"
                | "WITHDRAW_AF_BANK"
                | "WITHDRAW_AF_MOMO"
                | "WITHDRAW_MX_SPEI"
                | "WITHDRAW_SWIFT_WIRE"
                | "WITHDRAW_US_BANK_ACH"
                | "WITHDRAW_US_INSTANT"
                | "WITHDRAW_ACH_PULL"
                | "WITHDRAW_US_WIRE_DRAWDOWN"
                | "WITHDRAW_US_WIRE"
                | "WITHDRAW_BLOCKCHAIN"
                | "VIRTUAL_CARD"
                | "PHYSICAL_CARD"
                | "ESCROW_TRANSFER"
                | "REWARD"
            )[];
            statuses?: ("FAILED" | "PROCESSING" | "COMPLETED" | "RETURNED")[];
            subtypes?: ("RETURN" | "FEE" | undefined)[] | null;
            token?: Token;
        }
        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • Optionalmethods?: (
              | "REDEMPTION"
              | "TRANSFER"
              | "SWAP"
              | "DEPOSIT_BLOCKCHAIN"
              | "DEPOSIT_DIRECT"
              | "DEPOSIT_US_BANK_ACH"
              | "DEPOSIT_ACH_CREDIT"
              | "DEPOSIT_RTP"
              | "DEPOSIT_US_CASH"
              | "DEPOSIT_US_WIRE"
              | "DEPOSIT_SWIFT_WIRE"
              | "FEE_TRANSFER"
              | "TRANSFER_NETWORK"
              | "WITHDRAW_AF_BANK"
              | "WITHDRAW_AF_MOMO"
              | "WITHDRAW_MX_SPEI"
              | "WITHDRAW_SWIFT_WIRE"
              | "WITHDRAW_US_BANK_ACH"
              | "WITHDRAW_US_INSTANT"
              | "WITHDRAW_ACH_PULL"
              | "WITHDRAW_US_WIRE_DRAWDOWN"
              | "WITHDRAW_US_WIRE"
              | "WITHDRAW_BLOCKCHAIN"
              | "VIRTUAL_CARD"
              | "PHYSICAL_CARD"
              | "ESCROW_TRANSFER"
              | "REWARD"
          )[]
        • Optionalstatuses?: ("FAILED" | "PROCESSING" | "COMPLETED" | "RETURNED")[]
        • Optionalsubtypes?: ("RETURN" | "FEE" | undefined)[] | null

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

        • Optionaltoken?: Token

      Returns Promise<
          {
              ok: true;
              value: {
                  items: {
                      method: | "REDEMPTION"
                      | "TRANSFER"
                      | "SWAP"
                      | "DEPOSIT_BLOCKCHAIN"
                      | "DEPOSIT_DIRECT"
                      | "DEPOSIT_US_BANK_ACH"
                      | "DEPOSIT_ACH_CREDIT"
                      | "DEPOSIT_RTP"
                      | "DEPOSIT_US_CASH"
                      | "DEPOSIT_US_WIRE"
                      | "DEPOSIT_SWIFT_WIRE"
                      | "FEE_TRANSFER"
                      | "TRANSFER_NETWORK"
                      | "WITHDRAW_AF_BANK"
                      | "WITHDRAW_AF_MOMO"
                      | "WITHDRAW_MX_SPEI"
                      | "WITHDRAW_SWIFT_WIRE"
                      | "WITHDRAW_US_BANK_ACH"
                      | "WITHDRAW_US_INSTANT"
                      | "WITHDRAW_ACH_PULL"
                      | "WITHDRAW_US_WIRE_DRAWDOWN"
                      | "WITHDRAW_US_WIRE"
                      | "WITHDRAW_BLOCKCHAIN"
                      | "VIRTUAL_CARD"
                      | "PHYSICAL_CARD"
                      | "ESCROW_TRANSFER"
                      | "REWARD";
                      status: "FAILED"
                      | "PROCESSING"
                      | "COMPLETED"
                      | "RETURNED";
                      total: BigNumber;
                      type: "CREDIT" | "DEBIT";
                  }[];
              };
          },
      >

    • Returns the base UNION query (all selects enabled, scoped to the given customer) as an inlined SQL string. Useful for debugging prod issues against a specific customer.

      Parameters

      • __namedParameters: { customerId: string; token?: Token }

      Returns Promise<{ params: unknown[]; sql: string }>

    • Bust both transaction caches for a customer. Public seam for in-process readers/writers (e.g. the dashboard's transfer server action) and the cross-service TransactionCacheBuster. Tags are the external string customerId — the same value search / aggregateTotalsByMethod write.

      Parameters

      • __namedParameters: { customerId: string }

      Returns Promise<void>

    • Parameters

      • args: {
            amount?: { operator: "EQ" | "LTE" | "GTE"; value: BigNumber };
            bankIds?: (string | undefined)[];
            bankTransactionIds?: (string | undefined)[];
            cardIds?: string[];
            createdAt?: DbTimestampCriteria;
            customerId: string;
            entityIds?: string[];
            entityTypes?: NonNullable<"IDENTITY" | "ORGANIZATION" | null>[];
            ids?: string[];
            methods?: (
                | "REDEMPTION"
                | "TRANSFER"
                | "SWAP"
                | "DEPOSIT_BLOCKCHAIN"
                | "DEPOSIT_DIRECT"
                | "DEPOSIT_US_BANK_ACH"
                | "DEPOSIT_ACH_CREDIT"
                | "DEPOSIT_RTP"
                | "DEPOSIT_US_CASH"
                | "DEPOSIT_US_WIRE"
                | "DEPOSIT_SWIFT_WIRE"
                | "FEE_TRANSFER"
                | "TRANSFER_NETWORK"
                | "WITHDRAW_AF_BANK"
                | "WITHDRAW_AF_MOMO"
                | "WITHDRAW_MX_SPEI"
                | "WITHDRAW_SWIFT_WIRE"
                | "WITHDRAW_US_BANK_ACH"
                | "WITHDRAW_US_INSTANT"
                | "WITHDRAW_ACH_PULL"
                | "WITHDRAW_US_WIRE_DRAWDOWN"
                | "WITHDRAW_US_WIRE"
                | "WITHDRAW_BLOCKCHAIN"
                | "VIRTUAL_CARD"
                | "PHYSICAL_CARD"
                | "ESCROW_TRANSFER"
                | "REWARD"
            )[];
            orderBy?: { direction: "ASC"
            | "DESC"; field: "createdAt" | "updatedAt" }[];
            page?: number;
            pageSize?: number;
            paymentInstrumentIds?: (string | undefined)[];
            signatures?: string[];
            statuses?: ("FAILED" | "PROCESSING" | "COMPLETED" | "RETURNED")[];
            subtypes?: ("RETURN" | "FEE" | undefined)[] | null;
            token?: Token;
            types?: ("CREDIT" | "DEBIT")[];
            updatedAt?: DbTimestampCriteria;
            walletAddresses?: (Address | null)[];
        }
        • Optionalamount?: { operator: "EQ" | "LTE" | "GTE"; value: BigNumber }
        • OptionalbankIds?: (string | undefined)[]
        • OptionalbankTransactionIds?: (string | undefined)[]
        • OptionalcardIds?: string[]
        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • OptionalentityIds?: string[]
        • OptionalentityTypes?: NonNullable<"IDENTITY" | "ORGANIZATION" | null>[]
        • Optionalids?: string[]
        • Optionalmethods?: (
              | "REDEMPTION"
              | "TRANSFER"
              | "SWAP"
              | "DEPOSIT_BLOCKCHAIN"
              | "DEPOSIT_DIRECT"
              | "DEPOSIT_US_BANK_ACH"
              | "DEPOSIT_ACH_CREDIT"
              | "DEPOSIT_RTP"
              | "DEPOSIT_US_CASH"
              | "DEPOSIT_US_WIRE"
              | "DEPOSIT_SWIFT_WIRE"
              | "FEE_TRANSFER"
              | "TRANSFER_NETWORK"
              | "WITHDRAW_AF_BANK"
              | "WITHDRAW_AF_MOMO"
              | "WITHDRAW_MX_SPEI"
              | "WITHDRAW_SWIFT_WIRE"
              | "WITHDRAW_US_BANK_ACH"
              | "WITHDRAW_US_INSTANT"
              | "WITHDRAW_ACH_PULL"
              | "WITHDRAW_US_WIRE_DRAWDOWN"
              | "WITHDRAW_US_WIRE"
              | "WITHDRAW_BLOCKCHAIN"
              | "VIRTUAL_CARD"
              | "PHYSICAL_CARD"
              | "ESCROW_TRANSFER"
              | "REWARD"
          )[]
        • OptionalorderBy?: { direction: "ASC" | "DESC"; field: "createdAt" | "updatedAt" }[]

          Defaults to createdAt DESC

        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 10

        • OptionalpaymentInstrumentIds?: (string | undefined)[]
        • Optionalsignatures?: string[]
        • Optionalstatuses?: ("FAILED" | "PROCESSING" | "COMPLETED" | "RETURNED")[]
        • Optionalsubtypes?: ("RETURN" | "FEE" | undefined)[] | null

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

        • Optionaltoken?: Token

          Token name to resolve to a mint address. Defaults to MOVEUSD

        • Optionaltypes?: ("CREDIT" | "DEBIT")[]
        • OptionalupdatedAt?: DbTimestampCriteria
        • OptionalwalletAddresses?: (Address | null)[]

      Returns Promise<{ ok: true; value: { hasNext: boolean; items: Transaction[] } }>

    • Entity external ids the customer has transacted with, ordered by recency (most recently transacted first). Mirrors the uncached TransactionAdminService.searchEntities (same enriched CTE via outerEnrichmentSelectSql to resolve entity_external_id / entity_type) but scopes to a single customerId, optionally filters by entityType, and ranks distinct entities by MAX(created_at) instead of returning an unordered DISTINCT set.

      No caching (mirrors the admin method).

      Parameters

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

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

    • Payment-instrument external ids the customer has transacted with, ranked by usage (most-used first). Mirrors the uncached TransactionAdminService.searchPaymentInstrumentIds but scopes to a single customerId and ranks by COUNT(*) instead of returning a flat DISTINCT set. Skips the outer entity / ledger / solana enrichment — ranking only needs (payment_instrument_external_id, method, created_at).

      No caching (mirrors the admin method).

      Parameters

      • __namedParameters: {
            createdAt?: DbTimestampCriteria;
            customerId: string;
            limit?: number;
            methods?: (
                | "REDEMPTION"
                | "TRANSFER"
                | "SWAP"
                | "DEPOSIT_BLOCKCHAIN"
                | "DEPOSIT_DIRECT"
                | "DEPOSIT_US_BANK_ACH"
                | "DEPOSIT_ACH_CREDIT"
                | "DEPOSIT_RTP"
                | "DEPOSIT_US_CASH"
                | "DEPOSIT_US_WIRE"
                | "DEPOSIT_SWIFT_WIRE"
                | "FEE_TRANSFER"
                | "TRANSFER_NETWORK"
                | "WITHDRAW_AF_BANK"
                | "WITHDRAW_AF_MOMO"
                | "WITHDRAW_MX_SPEI"
                | "WITHDRAW_SWIFT_WIRE"
                | "WITHDRAW_US_BANK_ACH"
                | "WITHDRAW_US_INSTANT"
                | "WITHDRAW_ACH_PULL"
                | "WITHDRAW_US_WIRE_DRAWDOWN"
                | "WITHDRAW_US_WIRE"
                | "WITHDRAW_BLOCKCHAIN"
                | "VIRTUAL_CARD"
                | "PHYSICAL_CARD"
                | "ESCROW_TRANSFER"
                | "REWARD"
            )[];
            token?: Token;
        }

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