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

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    cache: ServiceCache<CachedLedgerAccountSearch>
    solanaAccountBalanceQueryService: SolanaAccountBalanceQueryService

    Methods

    • Get the given ledger account for the given customer

      Parameters

      • args: { customerId: string; id: string }

      Returns Promise<
          {
              ok: true;
              value: | {
                  address: Address;
                  balance: BigNumber;
                  createdAt: Date;
                  id: string;
                  name: string;
                  notes?: string;
                  paymentInstrumentId?: string;
                  permissions: "ALL"
                  | "ADMIN";
                  referenceId?: string;
                  tokenAccounts: Record<"MOVEUSD", { address: Address }>;
                  updatedAt: Date;
                  visibility: "PRIVATE" | "PUBLIC";
              } & {
                  customerOrganizationId: string;
                  entityDisplayName: string;
                  entityId: string;
                  entityReferenceId: string
                  | null;
                  entityType: "IDENTITY" | "ORGANIZATION";
              }
              | null;
          },
      >

    • Sum the balances of all ledger accounts for the given customer. Returns BigNumber(0) when the customer has no accounts.

      Parameters

      • __namedParameters: { customerId: string }

      Returns Promise<{ ok: true; value: { totalBalance: BigNumber } }>

    • Get a public ledger account that belongs to any customer

      Parameters

      • __namedParameters: { id: string }

      Returns Promise<
          | Omit<
              {
                  address: Address;
                  balance: BigNumber;
                  createdAt: Date;
                  id: string;
                  name: string;
                  notes?: string;
                  paymentInstrumentId?: string;
                  permissions: "ALL"
                  | "ADMIN";
                  referenceId?: string;
                  tokenAccounts: Record<"MOVEUSD", { address: Address }>;
                  updatedAt: Date;
                  visibility: "PRIVATE" | "PUBLIC";
              },
              "balance",
          > & { customer: { id: string; name: string } }
          | null,
      >

    • Return per-entity account metadata and counts for the given customer. One row per entity (identity or organization). main is true when the entity is the customer's primary organization.

      Parameters

      • __namedParameters: { customerId: string }

      Returns Promise<
          {
              ok: true;
              value: {
                  items: {
                      count: number;
                      customerOrganizationId: string;
                      entityDisplayName: string;
                      entityId: string;
                      entityReferenceId: string
                      | null;
                      entityType: "IDENTITY" | "ORGANIZATION";
                      main: boolean;
                  }[];
              };
          },
      >

    • Search all customers' public ledger accounts

      Parameters

      • __namedParameters: {
            addresses?: Address[];
            customerIds?: string[];
            customerNameLike?: string;
            ids?: string[];
        }

      Returns Promise<
          (
              Omit<
                  {
                      address: Address;
                      balance: BigNumber;
                      createdAt: Date;
                      id: string;
                      name: string;
                      notes?: string;
                      paymentInstrumentId?: string;
                      permissions: "ALL"
                      | "ADMIN";
                      referenceId?: string;
                      tokenAccounts: Record<"MOVEUSD", { address: Address }>;
                      updatedAt: Date;
                      visibility: "PRIVATE" | "PUBLIC";
                  },
                  "balance",
              > & { customer: { id: string; name: string } }
          )[],
      >