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

    Operations that cannot be performed by consumers of this doam

    These operations are cross-customer and do not have the additional validation the normal service has. So please use with care.

    Hierarchy (View Summary)

    Index
    • Parameters

      • __namedParameters: {
            db: B2bDatabase;
            eventPublisher: CustomerEventPublisher;
            internalEventPublisher: InternalEventPublisher | null;
            valkeyClient: ValkeyClient | null;
        }

      Returns SwapAdminService

    db: B2bDatabase
    instance: (...args: []) => SwapAdminService = ...

    The process service: the shared database, Valkey and both event buses.

    • { quote } claims the quote ACTIVE → ACCEPTED and inserts its swap in one transaction: a quote yields at most one swap, and a failed insert leaves it ACTIVE. A retry of an ACCEPTED quote whose swap is still PENDING returns that swap and republishes PENDING, since the attempt that made it may have failed before its send.

      { deposit } records an inbound transfer to a swap deposit address as an unpriced DEPOSIT swap owned by the address's ledger account. The receipt and address are the idempotency key: a replay returns the swap it made and makes none, and one with another amount is DEPOSIT_RECEIPT_CONFLICT.

      Parameters

      • args: { quote: SwapQuote } | { deposit: DepositInput }

      Returns Promise<{ ok: true; value: SwapAdminItem } | { error: ServiceError; ok: false }>

    • Parameters

      • __namedParameters: {
            data:
                | { reason?: string; status: "FAILED" }
                | {
                    fill?: {
                        filledBy?: string;
                        fundingLedgerAccountId: string;
                        quoteId?: string;
                    };
                    status: "PROCESSING";
                }
                | {
                    receipt: (
                        | {
                            id: string;
                            leg?: SwapReceiptLeg;
                            type: "SOLANA_TRANSACTION_SIGNATURE";
                        }
                        | {
                            chain: string;
                            id: string;
                            leg?: SwapReceiptLeg;
                            logIndex: number;
                            type: "EVM_TRANSACTION_SIGNATURE";
                        }
                        | {
                            id: string;
                            leg?: SwapReceiptLeg;
                            type: "TRON_TRANSACTION_SIGNATURE";
                        }
                    )[];
                    status: "COMPLETED";
                };
            id: string;
        }

      Returns Promise<
          | { ok: true; value: SwapAdminItem }
          | { error: SwapUpdateError; ok: false },
      >