@cosmosapp/pay_sdk 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +61 -3
- package/dist/{chunk-OVFDKC5Z.js → chunk-FTHQKUE5.js} +3 -3
- package/dist/{chunk-OVFDKC5Z.js.map → chunk-FTHQKUE5.js.map} +1 -1
- package/dist/index.cjs +408 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +292 -10
- package/dist/index.d.ts +292 -10
- package/dist/index.js +404 -12
- package/dist/index.js.map +1 -1
- package/dist/{intent-input-GiCgpAWR.d.cts → intent-input-B16Lt69q.d.cts} +650 -5
- package/dist/{intent-input-GiCgpAWR.d.ts → intent-input-B16Lt69q.d.ts} +650 -5
- package/dist/web/index.cjs +1 -1
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +2 -2
- package/dist/web/index.d.ts +2 -2
- package/dist/web/index.js +2 -2
- package/llms/04-client.md +5 -3
- package/llms/08-products-customers.md +31 -4
- package/llms/09-analytics-health.md +31 -0
- package/llms/13-types-reference.md +26 -3
- package/llms/16-private-payments.md +77 -0
- package/llms/17-usdt0.md +82 -0
- package/llms/README.md +3 -2
- package/llms/llms-full.txt +258 -10
- package/llms/llms.txt +4 -2
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/managers/AliasManager.ts","../src/managers/AnalyticsManager.ts","../src/managers/AssetManager.ts","../src/structures/Base.ts","../src/structures/Customer.ts","../src/managers/BaseManager.ts","../src/managers/CustomerManager.ts","../src/managers/HealthManager.ts","../src/types/index.ts","../src/structures/LiquidityOperation.ts","../src/managers/LiquidityManager.ts","../src/managers/OnrampManager.ts","../src/managers/OfframpManager.ts","../src/managers/ActivityManager.ts","../src/structures/Receiver.ts","../src/managers/KycManager.ts","../src/structures/CrossChainSwap.ts","../src/managers/CrossChainSwapManager.ts","../src/managers/DefindexManager.ts","../src/managers/PluginManager.ts","../src/managers/PublicKeyManager.ts","../src/structures/PaymentIntent.ts","../src/managers/PaymentIntentManager.ts","../src/structures/Product.ts","../src/managers/ProductManager.ts","../src/structures/ChainSwap.ts","../src/structures/Swap.ts","../src/managers/SwapManager.ts","../src/structures/WebhookDelivery.ts","../src/structures/WebhookEndpoint.ts","../src/util/Webhooks.ts","../src/managers/WebhookManager.ts","../src/rest/REST.ts","../src/util/shared.ts","../src/client/Client.ts"],"names":["EventEmitter"],"mappings":";;;;;;AAoCO,IAAM,eAAN,MAAmB;AAAA,EAIxB,YAAY,MAAA,EAAgB;AAF5B,IAAA,IAAA,CAAiB,KAAA,GAAQ,UAAA;AAGvB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA,EAEA,IAAY,IAAA,GAAa;AACvB,IAAA,OAAO,KAAK,MAAA,CAAO,IAAA;AAAA,EACrB;AAAA;AAAA,EAGO,OAAA,CAAQ,IAAA,EAAc,OAAA,GAAgC,EAAC,EAAiC;AAC7F,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAyB,CAAA,EAAG,IAAA,CAAK,KAAK,CAAA,SAAA,EAAY,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA,EAAI;AAAA,MAC7F,KAAA,EAAO,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA;AAAQ,KACnC,CAAA;AAAA,EACH;AAAA;AAAA,EAGO,aAAa,IAAA,EAA8C;AAChE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAA2B,CAAA,EAAG,IAAA,CAAK,KAAK,CAAA,cAAA,EAAiB,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAE,CAAA;AAAA,EACtG;AAAA;AAAA,EAGO,SAAA,CAAU,OAAA,EAAiB,OAAA,GAAgC,EAAC,EAAgC;AACjG,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAwB,CA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;AACF","file":"index.js","sourcesContent":["import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AddAliasAddressOptions,\n AliasAddressData,\n AliasAvailabilityData,\n AliasByAddressData,\n AliasChallengeData,\n AliasDeletedData,\n AliasListData,\n AliasRecoveryStartedData,\n AliasResolutionData,\n ClaimAliasOptions,\n CompleteAliasRecoveryOptions,\n CreateAliasChallengeOptions,\n OwnedAliasData,\n} from '@/types/index';\n\n/**\n * Payment handles — `client.aliases`. A handle names one or more Stellar\n * addresses, so a payer can send to `@ada` instead of a 56-character key.\n *\n * Every address on a handle proved control of itself: claiming a handle or\n * pointing it somewhere new takes a signature, by that address, over a\n * challenge the server issued. The SDK never holds the key — ask for a\n * challenge, sign its `message` where the key lives, and send the signature\n * back.\n *\n * @example\n * const { primaryAddress } = await client.aliases.resolve('ada', { network: 'public' });\n *\n * @example\n * const ch = await client.aliases.createChallenge({ name: 'ada', address, network: 'public' });\n * const signature = signWithYourWallet(ch.message); // base64 ed25519\n * await client.aliases.claim({ name: 'ada', email: 'ada@example.com', nonce: ch.nonce, signature });\n */\nexport class AliasManager {\n public readonly client: Client;\n private readonly route = '/aliases';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Where to pay a handle: its verified addresses on a network, primary first. */\n public resolve(name: string, options: { network?: string } = {}): Promise<AliasResolutionData> {\n return this.rest.get<AliasResolutionData>(`${this.route}/resolve/${encodeURIComponent(name)}`, {\n query: { network: options.network },\n });\n }\n\n /** Whether a handle can be claimed, and if not, why not. */\n public availability(name: string): Promise<AliasAvailabilityData> {\n return this.rest.get<AliasAvailabilityData>(`${this.route}/availability/${encodeURIComponent(name)}`);\n }\n\n /** Which handles point at an address — the reverse lookup. */\n public byAddress(address: string, options: { network?: string } = {}): Promise<AliasByAddressData> {\n return this.rest.get<AliasByAddressData>(`${this.route}/by-address/${encodeURIComponent(address)}`, {\n query: { network: options.network },\n });\n }\n\n /** A nonce and the exact message to sign, for a claim, a new address or a recovery. */\n public createChallenge(options: CreateAliasChallengeOptions): Promise<AliasChallengeData> {\n return this.rest.post<AliasChallengeData>(`${this.route}/challenges`, { body: options });\n }\n\n /** Claim a handle with a signature over a CLAIM challenge. */\n public claim(options: ClaimAliasOptions): Promise<OwnedAliasData> {\n return this.rest.post<OwnedAliasData>(this.route, { body: options });\n }\n\n /** The handles this consumer owns (paginated). */\n public list(options: { take?: number; skip?: number } = {}): Promise<AliasListData> {\n return this.rest.get<AliasListData>(this.route, {\n query: { take: options.take, skip: options.skip },\n });\n }\n\n /** Point a handle at another address, signed by that address (ADD_ADDRESS challenge). */\n public addAddress(name: string, options: AddAliasAddressOptions): Promise<AliasAddressData> {\n return this.rest.post<AliasAddressData>(`${this.route}/${encodeURIComponent(name)}/addresses`, {\n body: options,\n });\n }\n\n /** Remove one address from a handle. */\n public removeAddress(name: string, addressId: string): Promise<AliasDeletedData> {\n return this.rest.delete<AliasDeletedData>(\n `${this.route}/${encodeURIComponent(name)}/addresses/${encodeURIComponent(addressId)}`,\n );\n }\n\n /** Release a handle back to the namespace. */\n public release(name: string): Promise<AliasDeletedData> {\n return this.rest.delete<AliasDeletedData>(`${this.route}/${encodeURIComponent(name)}`);\n }\n\n /**\n * Start a recovery: the service emails a one-time token to the mailbox the\n * handle was claimed with, if `email` is that mailbox. The answer is the same\n * either way, so it says nothing about who owns the handle; the token only\n * ever reaches the mailbox, never this response.\n */\n public startRecovery(name: string, email: string): Promise<AliasRecoveryStartedData> {\n return this.rest.post<AliasRecoveryStartedData>(`${this.route}/${encodeURIComponent(name)}/recovery`, {\n body: { email },\n });\n }\n\n /**\n * Take a handle over with a new address after losing the old one: the token\n * the owner received by email, plus a signature by the new address over a\n * RECOVER challenge.\n */\n public completeRecovery(name: string, options: CompleteAliasRecoveryOptions): Promise<OwnedAliasData> {\n return this.rest.post<OwnedAliasData>(`${this.route}/${encodeURIComponent(name)}/recovery/complete`, {\n body: options,\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AnalyticsBalancesData,\n AnalyticsSummaryData,\n ApiLogsData,\n WebhookLogsData,\n} from '@/types/index';\n\n/**\n * Read-only analytics derived from the consumer's intents and deliveries —\n * `client.analytics`. Powers dashboard-style Overview / Balances / Logs views.\n */\nexport class AnalyticsManager {\n public readonly client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Overview metrics: totals, settled volume, webhook health, 30-day series. */\n public summary(): Promise<AnalyticsSummaryData> {\n return this.rest.get<AnalyticsSummaryData>('/summary');\n }\n\n /** Settled (and pending) amount per asset. */\n public balances(): Promise<AnalyticsBalancesData> {\n return this.rest.get<AnalyticsBalancesData>('/balances');\n }\n\n /** Recent API requests reaching the service (with details). */\n public apiLogs(): Promise<ApiLogsData> {\n return this.rest.get<ApiLogsData>('/logs');\n }\n\n /** Recent webhook deliveries across all endpoints (with details). */\n public webhookLogs(): Promise<WebhookLogsData> {\n return this.rest.get<WebhookLogsData>('/logs/webhooks');\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { AssetRegistryData, ListRegistryAssetsOptions } from '@/types/index';\n\n/**\n * The server's asset registry — `client.assets`: which `(code, issuer)` pairs\n * it knows per network, and who issues each.\n *\n * A code is not an identifier — mainnet carries dozens of accounts issuing\n * `USDC` — so this is where to learn WHICH one. `verified` is a claim about the\n * issuer's identity (checked against `issuerName`), not about quality; the\n * unverified rows are returned too, and a UI should show them below a warning\n * rather than hide them. The static {@link Assets} catalog is the offline\n * fallback; this is the current list, and its `version` says which is newer.\n *\n * @example\n * const { data } = await client.assets.list({ network: 'public', verified: true });\n */\nexport class AssetManager {\n public readonly client: Client;\n private readonly route = '/assets';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** The registry for a network. */\n public list(options: ListRegistryAssetsOptions = {}): Promise<AssetRegistryData> {\n return this.rest.get<AssetRegistryData>(this.route, {\n query: { network: options.network, verified: options.verified },\n });\n }\n}\n","import type { Client } from '@/client/Client';\n\n/**\n * Root of every API structure. Holds a back-reference to the {@link Client} so\n * instances can perform their own actions (e.g. `paymentIntent.delete()`), and\n * provides the `_patch`/`toJSON` plumbing shared by all structures.\n */\nexport abstract class Base<Data extends { id: string }> {\n /** The client that instantiated this structure. */\n public readonly client: Client;\n /** Unique identifier of the resource. */\n public id!: string;\n\n protected constructor(client: Client, data: Data) {\n this.client = client;\n this._patch(data);\n }\n\n /** Merge raw API data onto this instance. Subclasses override and call super. */\n protected _patch(data: Data): this {\n this.id = data.id;\n return this;\n }\n\n /** Return the raw API representation of this structure. */\n public abstract toJSON(): Data;\n\n /** Allow `String(structure)` / template literals to resolve to the id. */\n public valueOf(): string {\n return this.id;\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { CustomerData, UpdateCustomerOptions } from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A customer record, optionally enriched with on-chain payment stats. */\nexport class Customer extends Base<CustomerData> {\n public name!: string;\n public alias!: string | null;\n public note!: string | null;\n public email!: string | null;\n /** Optional Stellar account associated with the customer. */\n public account!: string | null;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n /** Number of payment intents from this customer's account (list view only). */\n public payments: number | null = null;\n /** Number of succeeded payments (list view only). */\n public succeeded: number | null = null;\n /** Total settled amount as a decimal string (list view only). */\n public total: string | null = null;\n\n constructor(client: Client, data: CustomerData) {\n super(client, data);\n }\n\n protected override _patch(data: CustomerData): this {\n super._patch(data);\n this.name = data.name;\n this.alias = data.alias;\n this.note = data.note;\n this.email = data.email;\n this.account = data.account;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n if (data.payments !== undefined) this.payments = data.payments;\n if (data.succeeded !== undefined) this.succeeded = data.succeeded;\n if (data.total !== undefined) this.total = data.total;\n return this;\n }\n\n /** Re-fetch this customer. */\n public fetch(): Promise<Customer> {\n return this.client.customers.fetch(this.id);\n }\n\n /** Update this customer. Mutates and returns this. */\n public async edit(options: UpdateCustomerOptions): Promise<this> {\n const updated = await this.client.customers.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Delete this customer. */\n public delete() {\n return this.client.customers.delete(this.id);\n }\n\n public toJSON(): CustomerData {\n return {\n id: this.id,\n name: this.name,\n alias: this.alias,\n note: this.note,\n email: this.email,\n account: this.account,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n ...(this.payments !== null ? { payments: this.payments } : {}),\n ...(this.succeeded !== null ? { succeeded: this.succeeded } : {}),\n ...(this.total !== null ? { total: this.total } : {}),\n };\n }\n}\n","import { EventEmitter } from 'node:events';\nimport type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\n\n/**\n * Base class for all resource managers. Each manager owns a slice of the API\n * (payment intents, webhooks, ...) and a lightweight in-memory cache of the\n * structures it has materialized — an atomic, per-resource manager pattern.\n *\n * Extends EventEmitter so managers that surface real-time events (e.g. the\n * webhook listener) can `emit`/`on` without extra plumbing.\n */\nexport abstract class BaseManager<\n Structure extends { id: string },\n> extends EventEmitter {\n public readonly client: Client;\n /** Cache of structures keyed by id, populated on fetch/create. */\n public readonly cache: Map<string, Structure> = new Map();\n\n constructor(client: Client) {\n super();\n this.client = client;\n }\n\n /** Shortcut to the shared REST instance. */\n protected get rest(): REST {\n return this.client.rest;\n }\n\n /** Store a structure in the cache and return it. */\n protected _add(structure: Structure): Structure {\n this.cache.set(structure.id, structure);\n return structure;\n }\n\n /** Resolve an id from either a raw id or a structure instance. */\n public resolveId(idOrStructure: string | { id: string }): string {\n return typeof idOrStructure === 'string' ? idOrStructure : idOrStructure.id;\n }\n}\n","import { Customer } from '@/structures/Customer';\nimport type {\n CreateCustomerOptions,\n CustomerData,\n CustomerListData,\n UpdateCustomerOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\ntype CustomerDeletedData = { id: string; deleted: boolean };\n\n/**\n * Manages customers — `client.customers`.\n *\n * @example\n * const customer = await client.customers.create({\n * name: 'Acme Inc.', email: 'billing@acme.com',\n * });\n */\nexport class CustomerManager extends BaseManager<Customer> {\n private readonly route = '/customers';\n\n /** Create a customer. */\n public async create(options: CreateCustomerOptions): Promise<Customer> {\n const data = await this.rest.post<CustomerData>(this.route, { body: options });\n return this._add(new Customer(this.client, data));\n }\n\n /** List the consumer's customers (with payment stats). */\n public async list(): Promise<Customer[]> {\n const data = await this.rest.get<CustomerListData>(this.route);\n return data.data.map((d) => this._add(new Customer(this.client, d)));\n }\n\n /** Get a customer by id. */\n public async fetch(id: string): Promise<Customer> {\n const data = await this.rest.get<CustomerData>(`${this.route}/${id}`);\n return this._add(new Customer(this.client, data));\n }\n\n /** Update a customer. */\n public async update(\n id: string,\n options: UpdateCustomerOptions,\n ): Promise<Customer> {\n const data = await this.rest.patch<CustomerData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new Customer(this.client, data));\n }\n\n /** Delete a customer. */\n public async delete(id: string): Promise<CustomerDeletedData> {\n const result = await this.rest.delete<CustomerDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { HealthCheckData } from '@/types/index';\n\n/**\n * Service health probes — `client.health`. These routes are public (they don't\n * require an authenticated consumer).\n */\nexport class HealthManager {\n public readonly client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Liveness probe — resolves when the service is up. */\n public async liveness(): Promise<boolean> {\n await this.rest.get<unknown>('/health/liveness');\n return true;\n }\n\n /** Readiness probe (checks the database). Returns the health report. */\n public readiness(): Promise<HealthCheckData> {\n return this.rest.get<HealthCheckData>('/health/readiness');\n }\n}\n","/**\n * Type definitions for the Cosmos Pay Payments API.\n *\n * These mirror the server's OpenAPI schema (Stellar SEP-7 payment intents,\n * webhooks, products, customers and analytics). Every type is exported so\n * TypeScript consumers get full intellisense; JavaScript consumers can ignore\n * them entirely.\n */\n\nimport type { AssetRef } from '@/common/assets';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Enums (provided both as runtime objects and as string-literal unions)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Lifecycle state of a payment intent. */\nexport const PaymentIntentStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Cancelled: 'CANCELLED',\n Expired: 'EXPIRED',\n} as const;\nexport type PaymentIntentStatus =\n (typeof PaymentIntentStatus)[keyof typeof PaymentIntentStatus];\n\n/** SEP-7 operation a payment intent represents. */\nexport const PaymentIntentKind = {\n /** Source account is known → unsigned XDR + `web+stellar:tx` URI. */\n Tx: 'TX',\n /** No source → `web+stellar:pay` URI only (wallet picks the source). */\n Pay: 'PAY',\n} as const;\nexport type PaymentIntentKind =\n (typeof PaymentIntentKind)[keyof typeof PaymentIntentKind];\n\n/** Domain events an integrator can subscribe a webhook to. */\nexport const WebhookEventType = {\n PaymentIntentCreated: 'PAYMENT_INTENT_CREATED',\n PaymentIntentUpdated: 'PAYMENT_INTENT_UPDATED',\n PaymentIntentSucceeded: 'PAYMENT_INTENT_SUCCEEDED',\n PaymentIntentFailed: 'PAYMENT_INTENT_FAILED',\n PaymentIntentCancelled: 'PAYMENT_INTENT_CANCELLED',\n PaymentIntentDeleted: 'PAYMENT_INTENT_DELETED',\n // Fiat (BlindPay), re-emitted once the server syncs them.\n ReceiverUpdated: 'RECEIVER_UPDATED',\n PayinCreated: 'PAYIN_CREATED',\n PayinUpdated: 'PAYIN_UPDATED',\n PayinCompleted: 'PAYIN_COMPLETED',\n PayoutCreated: 'PAYOUT_CREATED',\n PayoutUpdated: 'PAYOUT_UPDATED',\n PayoutCompleted: 'PAYOUT_COMPLETED',\n // Same-chain swaps on every chain (Stellar, Solana, Monad).\n SwapCreated: 'SWAP_CREATED',\n SwapSubmitted: 'SWAP_SUBMITTED',\n SwapSucceeded: 'SWAP_SUCCEEDED',\n SwapFailed: 'SWAP_FAILED',\n // Liquidity pool operations.\n LiquidityCreated: 'LIQUIDITY_CREATED',\n LiquiditySubmitted: 'LIQUIDITY_SUBMITTED',\n LiquiditySucceeded: 'LIQUIDITY_SUCCEEDED',\n LiquidityFailed: 'LIQUIDITY_FAILED',\n // Cross-chain swaps (NEAR Intents).\n CrossChainSwapCreated: 'CROSS_CHAIN_SWAP_CREATED',\n CrossChainSwapUpdated: 'CROSS_CHAIN_SWAP_UPDATED',\n CrossChainSwapSucceeded: 'CROSS_CHAIN_SWAP_SUCCEEDED',\n CrossChainSwapRefunded: 'CROSS_CHAIN_SWAP_REFUNDED',\n CrossChainSwapFailed: 'CROSS_CHAIN_SWAP_FAILED',\n CrossChainSwapExpired: 'CROSS_CHAIN_SWAP_EXPIRED',\n} as const;\nexport type WebhookEventType =\n (typeof WebhookEventType)[keyof typeof WebhookEventType];\n\n/** Delivery state of a single webhook attempt. */\nexport const WebhookDeliveryStatus = {\n Pending: 'PENDING',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n} as const;\nexport type WebhookDeliveryStatus =\n (typeof WebhookDeliveryStatus)[keyof typeof WebhookDeliveryStatus];\n\n/** Product billing kind. */\nexport const ProductKind = {\n Recurring: 'recurring',\n OneTime: 'one_time',\n Link: 'link',\n} as const;\nexport type ProductKind = (typeof ProductKind)[keyof typeof ProductKind];\n\n/** Lifecycle state of a swap. */\nexport const SwapStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type SwapStatus = (typeof SwapStatus)[keyof typeof SwapStatus];\n\n/** Which side of a pool an operation is on. */\nexport const LiquidityOperationKind = {\n Deposit: 'DEPOSIT',\n Withdraw: 'WITHDRAW',\n} as const;\nexport type LiquidityOperationKind =\n (typeof LiquidityOperationKind)[keyof typeof LiquidityOperationKind];\n\n/** Lifecycle state of a liquidity pool operation. */\nexport const LiquidityOperationStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type LiquidityOperationStatus =\n (typeof LiquidityOperationStatus)[keyof typeof LiquidityOperationStatus];\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Payment intents\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/payment-intents/tx`. */\nexport interface CreateTxPaymentIntentOptions {\n /** Payer's Stellar account — the transaction source. A registered address-book name also works. */\n source: string;\n /** Payee's Stellar account. A registered address-book name also works. */\n destination: string;\n /** Amount as a decimal string (max 7 decimals). */\n amount: string;\n /**\n * Typed asset (e.g. `Assets.USDC` or `defineAsset(...)`) — fills `assetCode`\n * and `assetIssuer` for you. Takes a back seat to explicit code/issuer below.\n */\n asset?: AssetRef;\n /** Asset code. Omit (or `XLM`/`native`) for native lumens. */\n assetCode?: string;\n /** Issuer account for a non-native asset. */\n assetIssuer?: string;\n /** MEMO_ID (numeric uint64) for idempotency + on-chain identification. Auto-generated when omitted. */\n memo?: string;\n /** SEP-7 `msg`: shown to the user in their wallet (≤ 300 chars). */\n msg?: string;\n /** SEP-7 `callback` where the wallet POSTs the signed XDR, e.g. `url:https://...`. */\n callback?: string;\n}\n\n/** Body for `POST /v1/payment-intents/pay`. */\n/** The chain a payment intent settles on. */\nexport type PaymentChain = 'stellar' | 'solana' | 'monad';\n\nexport interface CreatePayPaymentIntentOptions {\n /**\n * Chain the payment settles on: `stellar` (the default, a SEP-7 `web+stellar:pay` link),\n * `solana` (a Solana Pay link) or `monad` (an EIP-681 link). The network (mainnet or test)\n * is the API key's, as on every route.\n */\n chain?: PaymentChain;\n /**\n * Payee's account on that chain: a Stellar `G...` account, a Solana address or a Monad\n * `0x...` address. A registered address-book name also works.\n */\n destination: string;\n /** Amount the destination should receive. Omit to let the user enter it (e.g. donations). */\n amount?: string;\n /**\n * Typed asset (e.g. `Assets.USDC` or `defineAsset(...)`) — fills `assetCode`\n * and `assetIssuer` for you. Takes a back seat to explicit code/issuer below.\n */\n asset?: AssetRef;\n /** Asset code the destination receives. Omit for the chain's coin (XLM, SOL or MON). */\n assetCode?: string;\n /** Who issues a token: the Stellar issuer account, the Solana SPL mint or the Monad ERC-20 contract. */\n assetIssuer?: string;\n /** MEMO_ID (numeric uint64) for idempotency + on-chain identification. Auto-generated when omitted. */\n memo?: string;\n /** Shown to the user in their wallet (≤ 300 chars): SEP-7 `msg` on Stellar, the Solana Pay `message`. */\n msg?: string;\n /** SEP-7 `callback`, e.g. `url:https://...`. Stellar only. */\n callback?: string;\n}\n\n/** Body for `PATCH /v1/payment-intents/:id`. */\nexport interface UpdatePaymentIntentOptions {\n status?: PaymentIntentStatus;\n /** Stellar transaction hash once the signed tx is submitted. */\n txHash?: string;\n /** Merchant reference. */\n reference?: string;\n}\n\n/** Query for `GET /v1/payment-intents`. */\nexport interface ListPaymentIntentsOptions {\n status?: PaymentIntentStatus;\n /** Only intents on this chain. Omit for every chain. */\n chain?: PaymentChain;\n /** Only intents created at or after this instant (a Date or an ISO 8601 string). */\n createdFrom?: Date | string;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Raw payment intent payload returned by the API. */\nexport interface PaymentIntentData {\n id: string;\n kind: PaymentIntentKind;\n status: PaymentIntentStatus;\n /** Chain the payment settles on (TX intents are always Stellar). Older servers omit it: Stellar. */\n chain?: PaymentChain;\n network: string;\n source: string | null;\n destination: string;\n amount: string | null;\n asset: string;\n assetIssuer: string | null;\n memo: string;\n msg: string | null;\n callback: string | null;\n xdr: string | null;\n uri: string;\n qr: string;\n txHash: string | null;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of payment intents. */\nexport interface PaymentIntentListData {\n data: PaymentIntentData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/payment-intents/:id/validate`. */\nexport interface ValidatePaymentIntentOptions {\n /** Hash of the submitted Stellar transaction to validate against this intent. */\n txHash: string;\n}\n\n/** Raw outcome of a validation attempt. */\nexport interface ValidationOutcomeData {\n valid: boolean;\n status: PaymentIntentStatus;\n reason?: string | null;\n paymentIntent?: PaymentIntentData;\n}\n\n/** Raw `{ id, deleted }` response. */\nexport interface DeletedData {\n id: string;\n deleted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Webhooks\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/webhooks`. */\nexport interface CreateWebhookEndpointOptions {\n /** HTTPS URL that will receive POSTed event notifications. */\n url: string;\n description?: string;\n /** Event types to subscribe to. Omit/empty to receive all events. */\n eventTypes?: WebhookEventType[];\n}\n\n/** Body for `PATCH /v1/webhooks/:id`. */\nexport interface UpdateWebhookEndpointOptions {\n url?: string;\n description?: string;\n /** Pause/resume deliveries to this endpoint. */\n enabled?: boolean;\n eventTypes?: WebhookEventType[];\n}\n\n/** Raw webhook endpoint payload. */\nexport interface WebhookEndpointData {\n id: string;\n url: string;\n description: string | null;\n enabled: boolean;\n eventTypes: WebhookEventType[];\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw webhook endpoint payload including the one-time signing secret. */\nexport interface WebhookEndpointWithSecretData extends WebhookEndpointData {\n /** HMAC signing secret — shown once. Store it securely. */\n secret: string;\n}\n\n/** Raw result of a webhook ping. */\nexport interface WebhookPingData {\n ok: boolean;\n responseStatus: number | null;\n error: string | null;\n}\n\n/** Raw webhook delivery (audit) record. */\nexport interface WebhookDeliveryData {\n id: string;\n endpointId: string;\n eventType: WebhookEventType;\n eventId: string;\n payload: Record<string, unknown>;\n status: WebhookDeliveryStatus;\n attempts: number;\n responseStatus: number | null;\n error: string | null;\n lastAttemptAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of webhook deliveries. */\nexport interface WebhookDeliveryListData {\n data: WebhookDeliveryData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Query for `GET /v1/webhooks/:id/deliveries`. */\nexport interface ListWebhookDeliveriesOptions {\n status?: WebhookDeliveryStatus;\n take?: number;\n skip?: number;\n}\n\n/** Shape of the JSON body POSTed to an integrator's webhook URL. */\nexport interface WebhookEvent<T = PaymentIntentData> {\n /** Stable event id (use for idempotency). */\n id: string;\n type: WebhookEventType;\n createdAt: string;\n data: T;\n}\n\n/** What each webhook event carries in `data`. */\nexport interface WebhookEventDataMap {\n PAYMENT_INTENT_CREATED: PaymentIntentData;\n PAYMENT_INTENT_UPDATED: PaymentIntentData;\n PAYMENT_INTENT_SUCCEEDED: PaymentIntentData;\n PAYMENT_INTENT_FAILED: PaymentIntentData;\n PAYMENT_INTENT_CANCELLED: PaymentIntentData;\n PAYMENT_INTENT_DELETED: PaymentIntentData;\n /** Identity and state only — ids, status, rails; never personal data. */\n RECEIVER_UPDATED: Record<string, unknown>;\n PAYIN_CREATED: Record<string, unknown>;\n PAYIN_UPDATED: Record<string, unknown>;\n PAYIN_COMPLETED: Record<string, unknown>;\n PAYOUT_CREATED: Record<string, unknown>;\n PAYOUT_UPDATED: Record<string, unknown>;\n PAYOUT_COMPLETED: Record<string, unknown>;\n /** A Stellar swap, or a Solana / Monad one (it carries `chain`). */\n SWAP_CREATED: SwapData | ChainSwapData;\n SWAP_SUBMITTED: SwapData | ChainSwapData;\n SWAP_SUCCEEDED: SwapData | ChainSwapData;\n SWAP_FAILED: SwapData | ChainSwapData;\n LIQUIDITY_CREATED: LiquidityOperationData;\n LIQUIDITY_SUBMITTED: LiquidityOperationData;\n LIQUIDITY_SUCCEEDED: LiquidityOperationData;\n LIQUIDITY_FAILED: LiquidityOperationData;\n CROSS_CHAIN_SWAP_CREATED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_UPDATED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_SUCCEEDED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_REFUNDED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_FAILED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_EXPIRED: CrossChainSwapData;\n}\n\n/** One webhook event of a known type, with `data` typed for it. */\nexport type TypedWebhookEvent<K extends keyof WebhookEventDataMap> = Omit<\n WebhookEvent<WebhookEventDataMap[K]>,\n 'type'\n> & { type: K };\n\n/** Any webhook event — narrow on `type` to get `data` typed. */\nexport type AnyWebhookEvent = {\n [K in keyof WebhookEventDataMap]: TypedWebhookEvent<K>;\n}[keyof WebhookEventDataMap];\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Products\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/products`. */\nexport interface CreateProductOptions {\n name: string;\n description?: string;\n /** Decimal price (≤ 7 decimals). Omit for a customer-set amount. */\n amount?: string;\n /** Asset code the price is in. Omit for native lumens (XLM). */\n assetCode?: string;\n kind?: ProductKind;\n active?: boolean;\n reference?: string;\n}\n\n/** Body for `PATCH /v1/products/:id`. */\nexport type UpdateProductOptions = Partial<CreateProductOptions>;\n\n/** Raw product payload. */\nexport interface ProductData {\n id: string;\n name: string;\n description: string | null;\n amount: string | null;\n asset: string;\n kind: ProductKind;\n active: boolean;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Customers\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/customers`. */\nexport interface CreateCustomerOptions {\n name: string;\n alias?: string;\n note?: string;\n email?: string;\n /** Optional Stellar account to associate the customer with. */\n account?: string;\n reference?: string;\n}\n\n/** Body for `PATCH /v1/customers/:id`. */\nexport type UpdateCustomerOptions = Partial<CreateCustomerOptions>;\n\n/**\n * Raw customer payload.\n *\n * There is no `consumerId`: the API stopped sending it, because the owning\n * consumer is the key that made the call and an internal id is not part of the\n * contract.\n */\nexport interface CustomerData {\n id: string;\n name: string;\n alias: string | null;\n note: string | null;\n email: string | null;\n account: string | null;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n /** Derived on-chain stats (present in list responses). */\n payments?: number;\n succeeded?: number;\n total?: string;\n}\n\n/** Raw `{ data, total }` list of customers. */\nexport interface CustomerListData {\n data: CustomerData[];\n total: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Analytics\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface AnalyticsVolumeEntry {\n asset: string;\n amount: string;\n count: number;\n}\n\nexport interface AnalyticsSeriesPoint {\n date: string;\n count: number;\n volume: string;\n}\n\nexport interface AnalyticsRecentRow {\n id: string;\n kind: string;\n status: PaymentIntentStatus;\n amount: string | null;\n asset: string;\n destination: string;\n createdAt: string;\n}\n\n/** Raw overview metrics returned by `GET /v1/summary`. */\nexport interface AnalyticsSummaryData {\n totals: {\n all: number;\n succeeded: number;\n pending: number;\n submitted: number;\n failed: number;\n cancelled: number;\n expired: number;\n successRate: number;\n };\n volume: AnalyticsVolumeEntry[];\n webhooks: {\n endpoints: number;\n deliveries: number;\n failedDeliveries: number;\n };\n customers: number;\n series: AnalyticsSeriesPoint[];\n recent: AnalyticsRecentRow[];\n}\n\nexport interface AnalyticsBalanceEntry {\n asset: string;\n amount: string;\n pending: string;\n count: number;\n}\n\n/** Raw balances returned by `GET /v1/balances`. */\nexport interface AnalyticsBalancesData {\n data: AnalyticsBalanceEntry[];\n total: number;\n}\n\nexport interface ApiLogRow {\n id: string;\n method: string;\n path: string;\n statusCode: number;\n durationMs: number;\n ip: string | null;\n userAgent: string | null;\n status: 'ok' | 'pending' | 'fail';\n at: string;\n}\n\n/** Raw API request log returned by `GET /v1/logs`. */\nexport interface ApiLogsData {\n data: ApiLogRow[];\n total: number;\n}\n\nexport interface WebhookLogRow {\n id: string;\n endpointId: string;\n url: string | null;\n eventType: WebhookEventType;\n eventId: string;\n attempts: number;\n responseStatus: number | null;\n error: string | null;\n status: 'ok' | 'pending' | 'fail';\n at: string;\n}\n\n/** Raw webhook delivery log returned by `GET /v1/logs/webhooks`. */\nexport interface WebhookLogsData {\n data: WebhookLogRow[];\n total: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Health\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface HealthCheckData {\n status: string;\n info?: Record<string, { status: string } & Record<string, unknown>> | null;\n error?: Record<string, { status: string } & Record<string, unknown>> | null;\n details?: Record<string, { status: string } & Record<string, unknown>>;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Swaps\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The chain a same-chain swap runs on. `stellar` (the default when omitted) is\n * the Stellar DEX; `solana` goes through Jupiter and `monad` through Kuru Flow,\n * both mainnet only.\n */\nexport type SwapChain = 'stellar' | 'solana' | 'monad';\n\n/** The chains off Stellar, whose swaps come back as a {@link ChainSwapData}. */\nexport type OtherSwapChain = Exclude<SwapChain, 'stellar'>;\n\n/** Body for `POST /v1/swaps/quote` (pricing only; no fee parameter — the fee is enforced server-side per organization). */\nexport interface QuoteSwapOptions {\n /** Which chain to swap on. Omitted means Stellar. */\n chain?: SwapChain;\n /** Amount to send, as a decimal string in the asset's own units (max 7 decimals on Stellar). */\n amount: string;\n /**\n * Stellar: asset code (omit, `XLM` or `native` for lumens). Solana / Monad:\n * `SOL` / `MON`, `native`, or the SPL mint / ERC-20 address.\n */\n sourceAssetCode?: string;\n /** Stellar only: issuer account for a non-native source asset. */\n sourceAssetIssuer?: string;\n /** The asset the swap should deliver, spelled as for `sourceAssetCode`. */\n destAssetCode: string;\n /** Stellar only: issuer account for a non-native destination asset. */\n destAssetIssuer?: string;\n /** Allowed slippage in basis points. */\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/swaps`. */\nexport interface CreateSwapOptions extends QuoteSwapOptions {\n /** Source account performing (and signing) the swap, on `chain`. A registered address-book name also works on Stellar. */\n source: string;\n /** Stellar only: account that receives the swapped asset. Defaults to the source. */\n destination?: string;\n /** Stellar only: MEMO_ID (numeric uint64) for idempotency + on-chain identification. */\n memo?: string;\n /** Idempotency key (the `Idempotency-Key` header is preferred when both are set). */\n idempotencyKey?: string;\n}\n\n/**\n * Body for `POST /v1/swaps/:id/submit`: `signedXdr` for a Stellar swap,\n * `signedTransaction` for a Solana or Monad one.\n */\nexport type SubmitSwapOptions =\n | {\n /** Signed transaction envelope (base64 XDR) to relay to the Stellar network. */\n signedXdr: string;\n signedTransaction?: never;\n }\n | {\n /**\n * Solana: base64 wire bytes of the signed VersionedTransaction. Monad: the\n * `0x`-hex raw signed EIP-1559 transaction.\n */\n signedTransaction: string;\n signedXdr?: never;\n };\n\n/** Query for `GET /v1/swaps`. */\nexport interface ListSwapsOptions {\n /** Which chain to list. Omitted means Stellar. */\n chain?: SwapChain;\n status?: SwapStatus;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Raw swap payload returned by the API. */\nexport interface SwapData {\n id: string;\n status: SwapStatus;\n network: string;\n source: string;\n destination: string;\n sendAsset: string;\n sendAssetIssuer: string | null;\n sendAmount: string;\n feeAmount: string;\n feeBps: number;\n swapAmount: string;\n destAsset: string;\n destAssetIssuer: string | null;\n destEstimated: string;\n destMin: string;\n slippageBps: number;\n path: { code: string; issuer: string | null }[];\n memo: string | null;\n xdr: string;\n uri: string;\n txHash: string;\n qr: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of swaps. */\nexport interface SwapListData {\n data: SwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw pricing quote returned by `POST /v1/swaps/quote`. */\nexport interface SwapQuoteData {\n network: string;\n /** Solana and Monad quotes only. */\n chain?: OtherSwapChain;\n /** The aggregator that priced a Solana or Monad swap. */\n provider?: 'jupiter' | 'kuru';\n source: { asset: string; issuer: string | null; amount: string };\n /** Stellar takes the fee from the source asset; Solana and Monad from the output (`asset` says which). */\n fee: { asset: string; issuer: string | null; amount: string; bps: number; wallet: string | null };\n swap: { asset: string; issuer: string | null; amount: string };\n destination: {\n asset: string;\n issuer: string | null;\n estimated: string;\n minimum: string;\n slippageBps: number;\n };\n path: { code: string; issuer: string | null }[];\n}\n\n/** Raw outcome of relaying a signed swap transaction. */\nexport interface SwapSubmitOutcomeData {\n submitted: boolean;\n status: SwapStatus;\n txHash?: string;\n reason?: string;\n resultCodes?: string[];\n swap: SwapData;\n}\n\n/**\n * What a Solana or Monad swap's wallet signs. Solana: an unsigned\n * VersionedTransaction; Monad: a call the wallet signs as an EIP-1559\n * transaction, filling in nonce and gas itself.\n */\nexport type ChainSwapTransaction =\n | { encoding: 'base64'; data: string; lastValidBlockHeight?: number }\n | { to: string; data: string; value: string; chainId: number };\n\n/** An EVM call the wallet sends itself (a Monad ERC-20 `approve`). */\nexport interface EvmCallData {\n to: string;\n data: string;\n value: string;\n chainId: number;\n}\n\n/** Raw Solana or Monad swap (`chain_swap`), built by Jupiter or Kuru Flow. */\nexport interface ChainSwapData {\n id: string;\n chain: OtherSwapChain;\n /** Always `public`: the aggregators run on mainnet only. */\n network: string;\n provider: 'jupiter' | 'kuru';\n status: SwapStatus;\n /** The wallet that signs, pays and receives. */\n source: string;\n /** `native` (SOL / MON), or the SPL mint / ERC-20 address. */\n sendAsset: string;\n sendAmount: string;\n destAsset: string;\n /** Quoted output, net of the commission. */\n destEstimated: string;\n /** On-chain minimum after slippage. */\n destMin: string;\n feeBps: number;\n /** The commission, in the destination asset (taken from the output). */\n feeAmount: string;\n slippageBps: number;\n path: { code: string; issuer: string | null }[];\n transaction: ChainSwapTransaction;\n /** Monad, selling an ERC-20 with too small an allowance: send and confirm this first. */\n approval: EvmCallData | null;\n /** The Solana signature / EVM hash, once submitted. */\n txHash: string | null;\n idempotencyKey: string | null;\n /** Submit refuses the transaction after this; build a new swap. */\n expiresAt: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of Solana or Monad swaps. */\nexport interface ChainSwapListData {\n data: ChainSwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw outcome of relaying a signed Solana or Monad swap. */\nexport interface ChainSwapSubmitOutcomeData {\n submitted: boolean;\n status: SwapStatus;\n txHash: string;\n swap: ChainSwapData;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Cross-chain swaps (NEAR Intents)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Where a cross-chain swap stands. SUCCEEDED, REFUNDED and FAILED are final. */\nexport const CrossChainSwapStatus = {\n AwaitingDeposit: 'AWAITING_DEPOSIT',\n DepositDetected: 'DEPOSIT_DETECTED',\n IncompleteDeposit: 'INCOMPLETE_DEPOSIT',\n Processing: 'PROCESSING',\n Succeeded: 'SUCCEEDED',\n Refunded: 'REFUNDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type CrossChainSwapStatus =\n (typeof CrossChainSwapStatus)[keyof typeof CrossChainSwapStatus];\n\n/** A token NEAR Intents can swap on one of the supported chains. */\nexport interface CrossChainAssetData {\n chain: SwapChain;\n symbol: string;\n /** NEAR Intents' id for the asset. */\n assetId: string;\n decimals: number;\n /** SPL mint, ERC-20 address or Stellar issuer; null for the native coin. */\n contract: string | null;\n}\n\n/**\n * Body for `POST /v1/cross-chain-swaps/quote`. Both legs on one chain is not a\n * cross-chain swap — use `client.swaps` with `chain`.\n */\nexport interface QuoteCrossChainSwapOptions {\n originChain: SwapChain;\n /** Native ticker, a symbol listed once, a contract, or Stellar `CODE:ISSUER`. */\n originAsset: string;\n destinationChain: SwapChain;\n destinationAsset: string;\n /** Gross amount of the origin asset, in its own units. */\n amount: string;\n /** Who receives the output, on `destinationChain`. */\n recipient: string;\n /** Where a failed or late deposit is refunded, on `originChain`. */\n refundTo: string;\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/cross-chain-swaps`. */\nexport interface CreateCrossChainSwapOptions extends QuoteCrossChainSwapOptions {\n idempotencyKey?: string;\n}\n\n/** Raw cross-chain quote. */\nexport interface CrossChainQuoteData {\n network: string;\n origin: {\n chain: SwapChain;\n asset: string;\n assetId: string;\n contract: string | null;\n amount: string;\n amountUsd: string | null;\n };\n destination: {\n chain: SwapChain;\n asset: string;\n assetId: string;\n contract: string | null;\n amount: string;\n amountUsd: string | null;\n /** Below this NEAR Intents refunds instead of filling. */\n minimum: string;\n };\n /** The plan commission, taken by NEAR Intents out of the input. */\n fee: { bps: number; amount: string; asset: string };\n slippageBps: number;\n timeEstimateSeconds: number;\n}\n\n/** A settlement transaction NEAR Intents reports. */\nexport interface CrossChainTransactionData {\n hash: string;\n explorerUrl: string;\n}\n\n/** Raw cross-chain swap. */\nexport interface CrossChainSwapData {\n id: string;\n status: CrossChainSwapStatus;\n /** NEAR Intents' own status word, verbatim. */\n providerStatus: string;\n network: string;\n originChain: SwapChain;\n originAsset: string;\n originContract: string | null;\n destinationChain: SwapChain;\n destinationAsset: string;\n destinationContract: string | null;\n amountIn: string;\n feeBps: number;\n feeAmount: string;\n amountOutEstimated: string;\n amountOutMin: string;\n slippageBps: number;\n recipient: string;\n refundTo: string;\n /** Send exactly `amountIn` of the origin asset here. */\n depositAddress: string;\n /** Stellar only, and required: attach it as a MEMO_TEXT. */\n depositMemo: string | null;\n /** The deposit as a wallet link: SEP-7 pay, Solana Pay or EIP-681. */\n depositUri: string;\n /** QR of `depositUri` (PNG data URL); absent from list rows. */\n qr?: string;\n depositTxHash: string | null;\n amountOut: string | null;\n refundedAmount: string | null;\n originTxHashes: CrossChainTransactionData[] | null;\n destinationTxHashes: CrossChainTransactionData[] | null;\n timeEstimateSeconds: number;\n correlationId: string;\n /** NEAR Intents' signature over the quote and deposit address — keep it. */\n quoteSignature: string;\n idempotencyKey: string | null;\n expiresAt: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Query for `GET /v1/cross-chain-swaps`. */\nexport interface ListCrossChainSwapsOptions {\n status?: CrossChainSwapStatus;\n take?: number;\n skip?: number;\n}\n\n/** Raw paginated list of cross-chain swaps. */\nexport interface CrossChainSwapListData {\n data: CrossChainSwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Liquidity pools\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/liquidity-pools/deposit`. */\nexport interface DepositLiquidityOptions {\n /** Account whose funds go in, and which signs. An address-book name also works. */\n source: string;\n /** Asset A code. Omit (or `XLM`/`native`) for native lumens. */\n assetACode?: string;\n /** Issuer for a non-native asset A. */\n assetAIssuer?: string;\n /** Asset B code. */\n assetBCode?: string;\n /** Issuer for a non-native asset B. */\n assetBIssuer?: string;\n /** Ceiling on how much of asset A may go in, as a decimal string. */\n maxAmountA: string;\n /** Ceiling on how much of asset B may go in. */\n maxAmountB: string;\n /** Allowed price movement in basis points. */\n slippageBps?: number;\n /** MEMO_ID (numeric uint64) for on-chain identification. */\n memo?: string;\n /**\n * Idempotency token. Sent both as the body field and as the `Idempotency-Key`\n * header, which is what makes a retried deposit return the FIRST operation\n * instead of building a second one against the same funds.\n */\n idempotencyKey?: string;\n}\n\n/** Body for `POST /v1/liquidity-pools/withdraw`. */\nexport interface WithdrawLiquidityOptions {\n /** Account holding the shares, and which signs. */\n source: string;\n /** The pool to withdraw from (hex id). */\n poolId: string;\n /** Pool shares to burn, as a decimal string. */\n shares: string;\n /** Allowed price movement in basis points. */\n slippageBps?: number;\n memo?: string;\n /** See {@link DepositLiquidityOptions.idempotencyKey}. */\n idempotencyKey?: string;\n}\n\n/** Body for `POST /v1/liquidity-pools/operations/:id/submit`. */\nexport interface SubmitLiquidityOptions {\n /** Signed transaction envelope (base64 XDR) to relay to the network. */\n signedXdr: string;\n}\n\n/** Query for `GET /v1/liquidity-pools/operations`. */\nexport interface ListLiquidityOperationsOptions {\n kind?: LiquidityOperationKind;\n status?: LiquidityOperationStatus;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Query for `GET /v1/liquidity-pools` (Horizon proxy). */\nexport interface BrowseLiquidityPoolsOptions {\n assetACode?: string;\n assetAIssuer?: string;\n assetBCode?: string;\n assetBIssuer?: string;\n /** Only pools this account holds shares in. */\n account?: string;\n /** Horizon paging cursor from a previous page. */\n cursor?: string;\n limit?: number;\n}\n\n/** One side of a pool's reserves. */\nexport interface LiquidityReserveData {\n asset: string;\n issuer: string | null;\n amount: string;\n}\n\n/** Raw on-chain pool payload (Horizon proxy). */\nexport interface LiquidityPoolData {\n id: string;\n network: string;\n /** Pool fee in basis points — 30 for every constant-product pool today. */\n feeBp: number;\n totalTrustlines: string;\n totalShares: string;\n reserves: LiquidityReserveData[];\n}\n\n/** Raw cursor-paginated list of pools. */\nexport interface LiquidityPoolListData {\n data: LiquidityPoolData[];\n cursor?: string | null;\n}\n\n/** One account's stake in one pool. */\nexport interface LiquidityPositionData {\n poolId: string;\n /** Shares this account holds. */\n shares: string;\n /** Shares in existence. */\n totalShares: string;\n /** The account's share of the pool, in basis points. */\n shareOfPoolBps: number;\n reserves: LiquidityReserveData[];\n /** What those shares would redeem for right now. */\n redeemable: LiquidityReserveData[];\n}\n\n/** Raw payload of `GET /v1/liquidity-pools/positions`. */\nexport interface LiquidityPositionsData {\n account: string;\n network: string;\n data: LiquidityPositionData[];\n}\n\n/** Raw liquidity operation payload returned by the API. */\nexport interface LiquidityOperationData {\n id: string;\n kind: LiquidityOperationKind;\n status: LiquidityOperationStatus;\n network: string;\n source: string;\n poolId: string;\n assetA: string;\n assetAIssuer: string | null;\n assetB: string;\n assetBIssuer: string | null;\n amountA: string;\n amountB: string;\n shares: string | null;\n minPrice: string | null;\n maxPrice: string | null;\n slippageBps: number;\n idempotencyKey: string | null;\n feeBps: number;\n feeAmountA: string;\n feeAmountB: string;\n feeWallet: string | null;\n commissionMemo: string | null;\n xdr: string;\n uri: string;\n txHash: string;\n qr: string;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of liquidity operations. */\nexport interface LiquidityOperationListData {\n data: LiquidityOperationData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw outcome of relaying a signed liquidity transaction. */\nexport interface LiquiditySubmitOutcomeData {\n submitted: boolean;\n status: LiquidityOperationStatus;\n txHash?: string;\n reason?: string;\n resultCodes?: string[];\n operation: LiquidityOperationData;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Activity (client event stream)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Where an event came from. */\nexport type ActivitySource = 'wallet' | 'dashboard' | 'server' | 'sdk';\n\n/** Severity of an event. */\nexport type ActivityLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/** One event to report. Always batched — see {@link ReportActivityOptions}. */\nexport interface ActivityEventInput {\n /** Dotted event name, e.g. `payment.submitted`. */\n type: string;\n /**\n * Client-generated id. The service de-duplicates on it, which is what makes a\n * retried batch safe: the second delivery is counted as a duplicate rather than\n * stored twice.\n */\n eventId?: string;\n source?: ActivitySource;\n level?: ActivityLevel;\n category?: string;\n message?: string;\n sessionId?: string;\n distinctId?: string;\n appVersion?: string;\n platform?: string;\n network?: string;\n durationMs?: number;\n /** Free-form properties. Never put secrets or memo text here. */\n props?: Record<string, unknown>;\n /** When it happened (ISO-8601). Defaults to arrival time. */\n occurredAt?: string;\n}\n\n/** Body for `POST /v1/activity/events`. */\nexport interface ReportActivityOptions {\n events: ActivityEventInput[];\n}\n\n/** Raw outcome of a reported batch. */\nexport interface ActivityReportData {\n accepted: number;\n /** Events whose `eventId` had already been stored. */\n duplicates: number;\n}\n\n/** Query for `GET /v1/activity/events`. */\nexport interface ListActivityOptions {\n take?: number;\n skip?: number;\n source?: ActivitySource;\n level?: ActivityLevel;\n category?: string;\n type?: string;\n network?: string;\n /** ISO-8601 lower bound (inclusive). */\n since?: string;\n /** ISO-8601 upper bound (exclusive). */\n until?: string;\n}\n\n/** One stored event. */\nexport interface ActivityEventData {\n id: string;\n source: string;\n level: string;\n category: string;\n type: string;\n message: string | null;\n sessionId: string | null;\n distinctId: string | null;\n appVersion: string | null;\n platform: string | null;\n network: string | null;\n durationMs: number | null;\n props: Record<string, unknown> | null;\n ip: string | null;\n userAgent: string | null;\n /** When it happened. */\n at: string;\n /** When the service stored it. */\n receivedAt: string;\n}\n\n/** Raw paginated list of events. */\nexport interface ActivityListData {\n data: ActivityEventData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** One `{ key, count }` bucket of an activity summary. */\nexport interface ActivityBucket {\n key: string;\n count: number;\n}\n\n/** Raw payload of `GET /v1/activity/summary`. */\nexport interface ActivitySummaryData {\n total: number;\n sessions: number;\n devices: number;\n levels: ActivityBucket[];\n sources: ActivityBucket[];\n categories: ActivityBucket[];\n topTypes: ActivityBucket[];\n topErrors: ActivityBucket[];\n series: { date: string; count: number; errors: number }[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// On-ramp (fiat -> stablecoin)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Stablecoins the ramps settle in. */\nexport type RampToken = 'USDC' | 'USDT' | 'USDB';\n\n/** Which side of a quote the requested amount refers to. */\nexport type CurrencyType = 'sender' | 'receiver';\n\n/** Fiat rails a payin can arrive over. */\nexport type PayinMethod =\n | 'ach'\n | 'wire'\n | 'pix'\n | 'ted'\n | 'spei'\n | 'transfers'\n | 'pse'\n | 'international_swift'\n | 'rtp';\n\n/** Payer restrictions, for the rails that require them. */\nexport interface PayinPayerRules {\n pix_allowed_tax_ids?: string[];\n transfers_allowed_tax_id?: string;\n pse_allowed_tax_ids?: string[];\n pse_full_name?: string;\n pse_document_type?: string;\n pse_document_number?: string;\n pse_email?: string;\n pse_phone?: string;\n pse_bank_code?: string;\n}\n\n/**\n * Body for `POST /v1/onramp/quotes`.\n *\n * The field names are snake_case because they are the RAMP PROVIDER's, and the\n * service passes them through unchanged. Renaming them here would look tidier and\n * would put a translation layer between two systems that already agree.\n */\nexport interface CreatePayinQuoteOptions {\n /** Wallet that receives the converted stablecoin. */\n blockchain_wallet_id: string;\n currency_type: CurrencyType;\n payment_method: PayinMethod;\n token: RampToken;\n /** Amount in MINOR units (e.g. cents). */\n request_amount: number;\n cover_fees?: boolean;\n payer_rules?: PayinPayerRules;\n is_otc?: boolean;\n partner_fee_id?: string;\n wallet_id?: string;\n}\n\n/** Raw payin quote. Expires quickly — read `expires_at` before acting on it. */\nexport interface PayinQuoteData {\n id: string;\n /** Unix seconds (~5 minutes out). */\n expires_at: number;\n commercial_quotation?: number;\n receiver_amount?: number;\n sender_amount?: number;\n}\n\n/** Body for `POST /v1/onramp/payins`. */\nexport interface CreatePayinOptions {\n payin_quote_id: string;\n}\n\n/** Query for `GET /v1/onramp/payins`. */\nexport interface ListPayinsOptions {\n take?: number;\n skip?: number;\n}\n\n/**\n * Raw payin. The scalar fields are mirrored locally; `instructions` is passed\n * through from the provider verbatim (memo / CLABE / PIX code / CBU / PSE link…),\n * so its shape depends on `paymentMethod` and is deliberately not narrowed here.\n */\nexport interface PayinData {\n id: string;\n blindpayId: string;\n status: string | null;\n token: string | null;\n network: string | null;\n paymentMethod: string | null;\n /** Minor units, as a decimal string. */\n senderAmount: string | null;\n receiverAmount: string | null;\n instructions: unknown;\n createdAt: string;\n}\n\n/** Raw paginated list of payins. */\nexport interface PayinListData {\n data: PayinData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/onramp/trustline`. */\nexport interface CreateTrustlineOptions {\n /** Stellar address that needs the asset trustline. */\n address: string;\n}\n\n/**\n * Raw trustline response — a provider passthrough, which is why it is an open\n * shape. It carries the unsigned envelope the customer signs; a wallet reads `xdr`\n * off it and must put that through its own signing guard before signing.\n */\nexport interface TrustlineData {\n xdr?: string;\n [key: string]: unknown;\n}\n\n/** Banking partners a virtual account can be opened with. */\nexport type BankingPartner = 'jpmorgan' | 'citi' | 'hsbc' | 'cfsb';\n\n/** Body for `POST /v1/onramp/receivers/:receiverId/virtual-accounts`. */\nexport interface CreateVirtualAccountOptions {\n banking_partner: BankingPartner;\n token: RampToken;\n /** Cosmos Pay wallet id that receives the converted stablecoin. */\n blockchain_wallet_id: string;\n signed_agreement_id?: string;\n sole_proprietor_doc_type?: string;\n sole_proprietor_doc_file?: string;\n}\n\n/** Raw virtual account — a provider passthrough. */\nexport type VirtualAccountData = Record<string, unknown>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Off-ramp (stablecoin -> fiat)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Chains a payout can be funded from. */\nexport type PayoutNetwork =\n | 'ethereum'\n | 'base'\n | 'arbitrum'\n | 'polygon'\n | 'stellar'\n | 'solana'\n | 'tron'\n | 'sepolia'\n | 'base_sepolia'\n | 'arbitrum_sepolia'\n | 'polygon_amoy'\n | 'stellar_testnet'\n | 'solana_devnet';\n\n/** Chain families the authorize / create steps distinguish. */\nexport type PayoutChain = 'evm' | 'stellar' | 'solana';\n\n/** Body for `POST /v1/offramp/quotes`. */\nexport interface CreatePayoutQuoteOptions {\n /** Destination bank account, belonging to a verified receiver. */\n bank_account_id: string;\n currency_type: CurrencyType;\n cover_fees?: boolean;\n /** Amount in MINOR units. */\n request_amount: number;\n network: PayoutNetwork;\n token: RampToken;\n description?: string;\n partner_fee_id?: string;\n}\n\n/** Raw payout quote. */\nexport interface PayoutQuoteData {\n id: string;\n /** Unix seconds (~5 minutes out). */\n expires_at: number;\n sender_amount?: number;\n /** Local fiat amount to receive, in minor units. */\n receiver_amount?: number;\n receiver_local_amount?: number;\n /** EVM `approve` payload to sign (abi, address, functionName, amount). */\n contract?: unknown;\n}\n\n/** Body for `POST /v1/offramp/payouts/authorize`. */\nexport interface AuthorizePayoutOptions {\n quote_id: string;\n sender_wallet_address: string;\n /** Only the chains that need an unsigned transaction built for them. */\n chain: 'stellar' | 'solana';\n}\n\n/**\n * Raw authorize response — the unsigned transaction, passed through from the\n * provider. Its `xdr` (Stellar) is what a wallet must bound against the quote the\n * user actually confirmed before signing it.\n */\nexport interface AuthorizePayoutData {\n xdr?: string;\n [key: string]: unknown;\n}\n\n/** Body for `POST /v1/offramp/payouts`. */\nexport interface CreatePayoutOptions {\n quote_id: string;\n sender_wallet_address: string;\n chain: PayoutChain;\n /** The signed transaction produced from `authorize` (or the EVM approval). */\n signed_transaction?: string;\n}\n\n/** Query for `GET /v1/offramp/payouts`. */\nexport interface ListPayoutsOptions {\n take?: number;\n skip?: number;\n}\n\n/** Raw payout. Same mirroring rules as {@link PayinData}. */\nexport interface PayoutData {\n id: string;\n blindpayId: string;\n status: string | null;\n token: string | null;\n network: string | null;\n /** Fiat rail the money lands on. */\n rail: string | null;\n senderAmount: string | null;\n receiverAmount: string | null;\n senderWalletAddress: string | null;\n createdAt: string;\n}\n\n/** Raw paginated list of payouts. */\nexport interface PayoutListData {\n data: PayoutData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/offramp/payouts/:id/documents`. */\nexport interface AttachPayoutDocumentOptions {\n transaction_document_type?: string;\n transaction_document_id?: string;\n /** Base64 (or data URL) of the document itself. */\n transaction_document_file?: string;\n description?: string;\n}\n\n/** Raw document response — a provider passthrough. */\nexport type PayoutDocumentData = Record<string, unknown>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// KYC / KYB (receivers, wallets, bank accounts)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** A receiver is a person or a company. */\nexport type ReceiverType = 'individual' | 'business';\n\n/** How deep the verification goes. */\nexport type KycType = 'light' | 'standard' | 'enhanced';\n\n/** One beneficial owner of a business receiver. */\nexport interface ReceiverOwner {\n role?: string;\n first_name?: string;\n last_name?: string;\n date_of_birth?: string;\n tax_id?: string;\n country?: string;\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n postal_code?: string;\n /** Ownership percentage. */\n ownership_percentage?: number;\n title?: string;\n id_doc_country?: string;\n id_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n id_doc_front_file?: string;\n id_doc_back_file?: string;\n proof_of_address_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n proof_of_address_doc_file?: string;\n /** The owner's tax id type. */\n tax_type?: string;\n}\n\n/**\n * Body for `POST /v1/kyc/receivers`.\n *\n * Every `*_file` field takes a `file_url` returned by {@link KycManager.upload} —\n * not the bytes. Upload first, then create the receiver with the URLs.\n */\nexport interface CreateReceiverOptions {\n type: ReceiverType;\n kyc_type: KycType;\n email: string;\n /** ISO 3166-1 alpha-2 country code. */\n country: string;\n first_name?: string;\n last_name?: string;\n /** ISO-8601 datetime. A date-only value is rejected upstream. */\n date_of_birth?: string;\n tax_id?: string;\n occupation?: string;\n id_doc_country?: string;\n id_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n id_doc_front_file?: string;\n id_doc_back_file?: string;\n selfie_file?: string;\n account_purpose?: string;\n account_purpose_other?: string;\n source_of_funds_doc_type?: string;\n source_of_funds_doc_file?: string;\n source_of_wealth?: string;\n /** `master_service_agreement` | `salary_slip` | `bank_statement`. */\n sole_proprietor_doc_type?: string;\n proof_of_address_doc_type?: string;\n proof_of_address_doc_file?: string;\n recipient_relationship?: string;\n purpose_of_transactions?: string;\n purpose_of_transactions_explanation?: string;\n legal_name?: string;\n alternate_name?: string;\n business_type?: string;\n business_industry?: string;\n business_description?: string;\n formation_date?: string;\n estimated_annual_revenue?: string;\n publicly_traded?: boolean;\n website?: string;\n incorporation_doc_file?: string;\n proof_of_ownership_doc_file?: string;\n owners?: ReceiverOwner[];\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n postal_code?: string;\n phone_number?: string;\n ip_address?: string;\n /** Your own id for this receiver. */\n external_id?: string;\n image_url?: string;\n /**\n * Accepted terms-of-service id, from the redirect of\n * {@link KycManager.termsOfService}. The provider requires it to create a\n * receiver, which is why ToS is the FIRST step of the flow rather than the last.\n */\n tos_id?: string;\n}\n\n/**\n * Body for `PATCH /v1/kyc/receivers/:id` — the same fields, all optional.\n *\n * Identity is reviewed before it reaches the provider, edits included. Until the\n * receiver is enabled, an edit that touches KYC data sends it back to\n * `pending_review`. Once it exists at the provider, a tenant key may change only\n * `external_id` and `image_url`; any other field is `403 kyc_review_required` unless\n * the key is elevated (`X-Consumer-Role: admin`), because that edit rewrites the\n * identity at the provider directly.\n */\nexport type UpdateReceiverOptions = Partial<CreateReceiverOptions>;\n\n/** Body for `POST /v1/kyc/receivers/:id/approve`. */\nexport interface ApproveReceiverOptions {\n redirect_url?: string;\n /**\n * The {@link ReceiverData.dossierVersion} this approval is for.\n *\n * Approving is a statement about KYC data someone read and accepted, and the\n * tenant can edit that data in between: an edit leaves the receiver in\n * `pending_review`, so without a version the approval lands on whatever is\n * stored when the request arrives and nobody can tell. Send it and a dossier\n * that moved on is a `409 kyc_state_invalid` — re-read, review again, approve\n * that version.\n *\n * {@link Receiver.approve} fills this in from the instance; omit it there only\n * if you mean \"approve whatever is stored now\".\n */\n expected_version?: number;\n}\n\n/** Body for `POST /v1/kyc/receivers/:id/tos`. */\nexport interface RequestTosOptions {\n /** `code` returns the URL to show; `email` sends it to the receiver. */\n channel: 'code' | 'email';\n redirect_url?: string;\n}\n\n/** Body for `POST /v1/kyc/receivers/:id/enable`. */\nexport interface EnableReceiverOptions {\n /** An accepted terms-of-service id. */\n tos_id: string;\n}\n\n/** Body for `PATCH /v1/kyc/receivers/:id/access`. */\nexport interface SetReceiverAccessOptions {\n /** `true` cuts this receiver off from both ramps — an admin kill switch. */\n disabled: boolean;\n}\n\n/** Query for the paginated KYC collections. */\nexport interface ListKycOptions {\n take?: number;\n skip?: number;\n}\n\n/** Raw receiver payload. `kycStatus` is refreshed from the provider on read. */\nexport interface ReceiverData {\n id: string;\n blindpayId: string;\n type: string;\n kycType: string | null;\n kycStatus: string | null;\n email: string | null;\n name: string | null;\n country: string | null;\n externalId: string | null;\n /** True when the receiver is cut off from the ramps. */\n disabled: boolean;\n /**\n * How many times the submitted KYC data has been written. Send it back as\n * `expected_version` when approving, so the approval cannot land on a dossier\n * nobody read.\n */\n dossierVersion: number;\n /**\n * The `dossierVersion` a reviewer approved, or null while unapproved. The\n * receiver cannot be enabled until it equals {@link ReceiverData.dossierVersion}\n * again, so an edit after approval sends it back through review.\n */\n reviewedVersion: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of receivers. */\nexport interface ReceiverListData {\n data: ReceiverData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Chains a receiver wallet can be registered on. */\nexport type ReceiverWalletNetwork =\n | 'ethereum'\n | 'base'\n | 'arbitrum'\n | 'polygon'\n | 'stellar'\n | 'solana'\n | 'tron'\n | 'sepolia';\n\n/** Body for `POST /v1/kyc/receivers/:receiverId/wallets`. */\nexport interface CreateReceiverWalletOptions {\n name?: string;\n network: ReceiverWalletNetwork;\n address: string;\n /**\n * Proof the receiver controls the address, for the secure-wallet flow: the hash\n * of the transaction that signed the message from\n * {@link KycManager.walletSignMessage}.\n */\n signature_tx_hash?: string;\n is_account_abstraction?: boolean;\n}\n\n/** Raw receiver wallet payload. */\nexport interface ReceiverWalletData {\n id: string;\n blindpayId: string;\n name: string | null;\n network: string;\n address: string | null;\n isAccountAbstraction: boolean;\n createdAt: string;\n}\n\n/** Raw paginated list of receiver wallets. */\nexport interface ReceiverWalletListData {\n data: ReceiverWalletData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Fiat rails a bank account can be opened on. */\nexport type BankRail =\n | 'wire'\n | 'ach'\n | 'rtp'\n | 'pix'\n | 'pix_safe'\n | 'ted'\n | 'spei_bitso'\n | 'transfers_bitso';\n\n/**\n * Body for `POST /v1/kyc/receivers/:receiverId/bank-accounts`.\n *\n * Only the fields every rail shares are named here. The rest — `pix_*`, `ted_*`,\n * `spei_*`, `swift_*`, `sepa_*`, `ach_cop_*`, some seventy of them — depend on\n * `type`, and the authority on which ones a given rail needs is\n * {@link KycManager.bankDetails}, at runtime. Enumerating them in a published type\n * would freeze a provider's field list into a release of this SDK and break the\n * day it adds a rail.\n */\nexport interface CreateBankAccountOptions {\n type: BankRail;\n /** Label for the account. */\n name: string;\n account_class?: 'individual' | 'business';\n account_type?: 'checking' | 'saving';\n beneficiary_name?: string;\n recipient_relationship?: string;\n account_number?: string;\n routing_number?: string;\n business_industry?: string;\n phone_number?: string;\n tax_id?: string;\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n country?: string;\n postal_code?: string;\n /** Rail-specific fields. See `bankDetails(rail)` for the ones a rail requires. */\n [key: string]: unknown;\n}\n\n/** Raw bank account payload. */\nexport interface BankAccountData {\n id: string;\n blindpayId: string;\n rail: string | null;\n name: string | null;\n country: string | null;\n createdAt: string;\n}\n\n/** Raw paginated list of bank accounts. */\nexport interface BankAccountListData {\n data: BankAccountData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/kyc/terms-of-service`. */\nexport interface InitiateTosOptions {\n redirect_url?: string;\n /** Attach the acceptance to an existing receiver. */\n receiver_id?: string;\n idempotency_key?: string;\n}\n\n/**\n * Raw terms-of-service response — a provider passthrough carrying the hosted URL\n * the receiver has to visit.\n */\nexport interface TermsOfServiceData {\n url?: string;\n [key: string]: unknown;\n}\n\n/** Raw upload response. `file_url` is what every `*_file` field expects. */\nexport interface KycUploadData {\n file_url?: string;\n [key: string]: unknown;\n}\n\n/** Raw response of the rails catalogue / a rail's field schema — passthroughs. */\nexport type KycRailsData = unknown;\nexport type BankDetailsData = unknown;\n\n/** Raw response of the wallet sign-message challenge — a provider passthrough. */\nexport interface WalletSignMessageData {\n message?: string;\n [key: string]: unknown;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Payment intent history\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** One status change of a payment intent — `GET /v1/payment-intents/{id}/transitions`. */\nexport interface PaymentIntentTransitionData {\n id: string;\n intentId: string;\n fromStatus: PaymentIntentStatus;\n toStatus: PaymentIntentStatus;\n txHash?: string | null;\n /** Who moved it: `api`, `validate`, `observer` or `system`. */\n actor: string;\n reason?: string | null;\n createdAt: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Asset registry\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Query for `GET /v1/assets`. */\nexport interface ListRegistryAssetsOptions {\n network?: 'public' | 'testnet';\n /** Only the entries whose issuer was checked against the named organization. */\n verified?: boolean;\n}\n\n/** One `(code, issuer)` pair the server vouches for — or lists, unverified. */\nexport interface RegistryAssetData {\n code: string;\n /** Issuing account, or `null` for native XLM. */\n issuer: string | null;\n name: string;\n /** Who issues it, for display next to the code. */\n issuerName: string;\n /** The issuer's own on-chain `home_domain`, or empty when it publishes none. */\n issuerDomain: string;\n /** The issuing account was checked against `issuerName` — identity, not quality. */\n verified: boolean;\n /** Stellar Asset Contract id, when wrapped for Soroban. */\n contract: string | null;\n flags: { authRevocable: boolean; clawback: boolean };\n}\n\n/** Raw `GET /v1/assets` response. */\nexport interface AssetRegistryData {\n network: 'public' | 'testnet';\n /** Monotonic registry version: compare it against a bundled copy. */\n version: number;\n data: RegistryAssetData[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Aliases (payment handles)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type AliasChallengePurpose = 'CLAIM' | 'ADD_ADDRESS' | 'RECOVER';\n\n/** One verified address an alias points at. */\nexport interface AliasAddressData {\n id: string;\n address: string;\n network: string;\n label?: string | null;\n /** The default for this network. */\n isPrimary: boolean;\n /** When this address proved control of itself. */\n verifiedAt: string;\n}\n\n/** `GET /v1/aliases/resolve/{name}` — where to pay a handle. */\nexport interface AliasResolutionData {\n name: string;\n displayName: string;\n /** Every verified address on the requested network, primary first. */\n addresses: AliasAddressData[];\n /** The address to pay when the payer did not choose one. */\n primaryAddress?: string | null;\n}\n\n/** `GET /v1/aliases/availability/{name}`. */\nexport interface AliasAvailabilityData {\n name: string;\n available: boolean;\n /** Why not, when unavailable: `taken`, `reserved`, `bad_characters`, … */\n reason?: string | null;\n}\n\n/** `GET /v1/aliases/by-address/{address}`. */\nexport interface AliasByAddressData {\n data: { name: string; displayName: string; network: string; isPrimary: boolean }[];\n}\n\n/** Body for `POST /v1/aliases/challenges`. */\nexport interface CreateAliasChallengeOptions {\n /** The handle being claimed. */\n name: string;\n address: string;\n /** Network id: `public`, `testnet`, or a custom id. */\n network: string;\n purpose?: AliasChallengePurpose;\n}\n\n/** A nonce to sign — `POST /v1/aliases/challenges`. */\nexport interface AliasChallengeData {\n nonce: string;\n /** The EXACT string to digest and sign. Sign this, never a string you rebuilt. */\n message: string;\n /** Domain tag the digest is framed with. */\n domain: string;\n purpose: AliasChallengePurpose;\n expiresAt: string;\n}\n\n/** Body for `POST /v1/aliases`. */\nexport interface ClaimAliasOptions {\n name: string;\n /** Recovery mailbox — required at claim time. */\n email: string;\n /** The nonce from a CLAIM challenge. */\n nonce: string;\n /** base64 ed25519 over the challenge digest. */\n signature: string;\n /** Human label for this first address. */\n label?: string;\n}\n\n/** Body for `POST /v1/aliases/{name}/addresses`. */\nexport interface AddAliasAddressOptions {\n address: string;\n network: string;\n /** The nonce from an ADD_ADDRESS challenge. */\n nonce: string;\n signature: string;\n label?: string;\n /** Make this the address a payer gets when they do not ask for one. */\n primary?: boolean;\n}\n\n/** Body for `POST /v1/aliases/{name}/recovery/complete`. */\nexport interface CompleteAliasRecoveryOptions {\n /** The token delivered by email. */\n token: string;\n /** The address that will own the alias from now on. */\n address: string;\n network: string;\n /** The nonce from a RECOVER challenge. */\n nonce: string;\n signature: string;\n}\n\n/** An alias the caller owns. */\nexport interface OwnedAliasData {\n id: string;\n /** Normalized handle — the form uniqueness is decided on. */\n name: string;\n /** As the claimant typed it. Display only. */\n displayName: string;\n status: 'ACTIVE' | 'SUSPENDED';\n addresses: AliasAddressData[];\n createdAt: string;\n email: string;\n emailVerifiedAt?: string | null;\n}\n\n/** Raw `GET /v1/aliases` page. */\nexport interface AliasListData {\n data: OwnedAliasData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** `DELETE` answers for aliases and alias addresses. */\nexport interface AliasDeletedData {\n id: string;\n deleted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Alias recovery (email)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Answer of `POST /v1/aliases/:name/recovery` — the same whether or not the mailbox matches. */\nexport interface AliasRecoveryStartedData {\n accepted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Shared public key\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The shared public API key an open-source wallet embeds, per environment. */\nexport interface PublicKeyData {\n env: 'dev' | 'prod';\n apiKey: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Plugins\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** A plugin this deployment serves, and this consumer's installation of it. */\nexport interface PluginData {\n slug: string;\n name: string;\n version: string;\n description: string;\n author: string;\n /** What the plugin may do; installing is consenting to exactly this list. */\n capabilities: string[];\n /** Hosts the plugin may call out to. */\n egress: string[];\n config: Record<string, unknown>;\n queries: unknown[];\n commands: unknown[];\n events: unknown[];\n /** Null when this consumer has not installed it. */\n installation: Record<string, unknown> | null;\n}\n\nexport interface PluginListData {\n data: PluginData[];\n}\n\n/** Body for `PUT /v1/plugins/:slug/installation`. */\nexport interface InstallPluginOptions {\n /** Exactly the capabilities the plugin declares — consent is all or nothing. */\n grantCapabilities: string[];\n config?: Record<string, unknown>;\n}\n\nexport interface PluginUninstalledData {\n slug: string;\n uninstalled: boolean;\n}\n\n/** Result of a plugin query or command. */\nexport interface PluginActionResultData<T = unknown> {\n plugin: string;\n action: string;\n output: T;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// DeFindex vaults (native plugin, Stellar)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/defindex/vaults/:vault/deposit`. */\nexport interface DefindexDepositOptions {\n /** One amount per vault asset, in its base units. */\n amounts: string[];\n /** The account that signs. */\n caller: string;\n invest?: boolean;\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/defindex/vaults/:vault/withdraw`. */\nexport interface DefindexWithdrawOptions {\n shares: string;\n caller: string;\n slippageBps?: number;\n}\n","import type { Client } from '@/client/Client';\nimport {\n LiquidityOperationKind,\n LiquidityOperationStatus,\n type LiquidityOperationData,\n type SubmitLiquidityOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { LiquiditySubmitOutcome } from '@/managers/LiquidityManager';\n\n/**\n * One deposit into, or withdrawal from, a Stellar liquidity pool.\n *\n * The server builds the envelope and the wallet signs it, so an operation is a\n * two-step object: it arrives `PENDING` carrying an unsigned `xdr`, and reaches\n * `SUBMITTED`/`SUCCEEDED` only once the signed envelope comes back through\n * `submit()`. Both steps are available on the instance —\n * `await operation.submit({ signedXdr })` — so a caller never has to keep the id\n * and the manager in scope alongside it.\n */\nexport class LiquidityOperation extends Base<LiquidityOperationData> {\n /** Deposit or withdrawal. */\n public kind!: LiquidityOperationKind;\n public status!: LiquidityOperationStatus;\n public network!: string;\n /** Account whose funds move, and which must sign. */\n public source!: string;\n /** The pool this operation acts on (hex id). */\n public poolId!: string;\n public assetA!: string;\n public assetAIssuer!: string | null;\n public assetB!: string;\n public assetBIssuer!: string | null;\n /** Maximum of asset A put in (deposit), or minimum taken out (withdrawal). */\n public amountA!: string;\n public amountB!: string;\n /** Pool shares minted or burned; null until the network settles a deposit. */\n public shares!: string | null;\n /** Price band a deposit executes within, as decimal strings. */\n public minPrice!: string | null;\n public maxPrice!: string | null;\n public slippageBps!: number;\n public idempotencyKey!: string | null;\n public feeBps!: number;\n public feeAmountA!: string;\n public feeAmountB!: string;\n public feeWallet!: string | null;\n public commissionMemo!: string | null;\n /** Unsigned transaction envelope (base64 XDR) — what the wallet signs. */\n public xdr!: string;\n /** SEP-7 `web+stellar:tx` deep link for the same envelope. */\n public uri!: string;\n public txHash!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n /** When the built envelope stops being submittable. */\n public expiresAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: LiquidityOperationData) {\n super(client, data);\n }\n\n protected override _patch(data: LiquidityOperationData): this {\n super._patch(data);\n this.kind = data.kind;\n this.status = data.status;\n this.network = data.network;\n this.source = data.source;\n this.poolId = data.poolId;\n this.assetA = data.assetA;\n this.assetAIssuer = data.assetAIssuer ?? null;\n this.assetB = data.assetB;\n this.assetBIssuer = data.assetBIssuer ?? null;\n this.amountA = data.amountA;\n this.amountB = data.amountB;\n this.shares = data.shares ?? null;\n this.minPrice = data.minPrice ?? null;\n this.maxPrice = data.maxPrice ?? null;\n this.slippageBps = data.slippageBps;\n this.idempotencyKey = data.idempotencyKey ?? null;\n this.feeBps = data.feeBps;\n this.feeAmountA = data.feeAmountA;\n this.feeAmountB = data.feeAmountB;\n this.feeWallet = data.feeWallet ?? null;\n this.commissionMemo = data.commissionMemo ?? null;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.txHash = data.txHash;\n this.qr = data.qr;\n this.expiresAt = data.expiresAt ? new Date(data.expiresAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** True while the envelope still needs a signature. */\n public get isPending(): boolean {\n return this.status === LiquidityOperationStatus.Pending;\n }\n\n /** True once the network accepted it. */\n public get isSucceeded(): boolean {\n return this.status === LiquidityOperationStatus.Succeeded;\n }\n\n /** True for a deposit, false for a withdrawal. */\n public get isDeposit(): boolean {\n return this.kind === LiquidityOperationKind.Deposit;\n }\n\n /** Re-fetch this operation and patch it in place. */\n public async fetch(): Promise<this> {\n const data = await this.client.liquidity.fetchRaw(this.id);\n return this._patch(data);\n }\n\n /** Relay the signed envelope to the network and patch this instance with the result. */\n public async submit(options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome> {\n const outcome = await this.client.liquidity.submit(this.id, options);\n // Patch in place: the caller is holding THIS object, and leaving it showing\n // `PENDING` after a successful submit is the kind of staleness that gets\n // rendered straight into a UI.\n this._patch(outcome.operation.toJSON());\n return outcome;\n }\n\n public toJSON(): LiquidityOperationData {\n return {\n id: this.id,\n kind: this.kind,\n status: this.status,\n network: this.network,\n source: this.source,\n poolId: this.poolId,\n assetA: this.assetA,\n assetAIssuer: this.assetAIssuer,\n assetB: this.assetB,\n assetBIssuer: this.assetBIssuer,\n amountA: this.amountA,\n amountB: this.amountB,\n shares: this.shares,\n minPrice: this.minPrice,\n maxPrice: this.maxPrice,\n slippageBps: this.slippageBps,\n idempotencyKey: this.idempotencyKey,\n feeBps: this.feeBps,\n feeAmountA: this.feeAmountA,\n feeAmountB: this.feeAmountB,\n feeWallet: this.feeWallet,\n commissionMemo: this.commissionMemo,\n xdr: this.xdr,\n uri: this.uri,\n txHash: this.txHash,\n qr: this.qr,\n expiresAt: this.expiresAt ? this.expiresAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { LiquidityOperation } from '@/structures/LiquidityOperation';\nimport type {\n BrowseLiquidityPoolsOptions,\n DepositLiquidityOptions,\n LiquidityOperationData,\n LiquidityOperationListData,\n LiquidityOperationStatus,\n LiquidityPoolData,\n LiquidityPoolListData,\n LiquidityPositionsData,\n LiquiditySubmitOutcomeData,\n ListLiquidityOperationsOptions,\n SubmitLiquidityOptions,\n WithdrawLiquidityOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of liquidity operations plus its pagination metadata. */\nexport interface LiquidityOperationPage {\n items: LiquidityOperation[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of on-chain pools. Horizon paginates by cursor, not by offset. */\nexport interface LiquidityPoolPage {\n items: LiquidityPoolData[];\n /** Pass back as `cursor` to get the next page; null when there is none. */\n cursor: string | null;\n}\n\n/** Submission outcome with the refreshed operation materialized. */\nexport interface LiquiditySubmitOutcome {\n submitted: boolean;\n status: LiquidityOperationStatus;\n txHash: string | null;\n reason: string | null;\n resultCodes: string[] | null;\n operation: LiquidityOperation;\n}\n\n/**\n * Liquidity pools — `client.liquidity`.\n *\n * Two surfaces in one manager, because they are two halves of the same job:\n * *browsing* pools and positions (read-only, straight off Horizon), and\n * *operating* on them (deposit / withdraw), which produces an unsigned envelope\n * for a wallet to sign and a `submit()` to relay it back.\n *\n * The managed structure is the OPERATION, not the pool: a pool is a public\n * on-chain object with no lifecycle of its own, while an operation is a thing this\n * consumer created, can re-read and can push to the network.\n *\n * @example\n * const op = await client.liquidity.deposit({\n * source: 'G…',\n * assetACode: 'XLM',\n * assetBCode: 'USDC',\n * assetBIssuer: 'GA5Z…',\n * maxAmountA: '100',\n * maxAmountB: '25',\n * });\n * // …wallet signs op.xdr…\n * const { status, txHash } = await op.submit({ signedXdr });\n */\nexport class LiquidityManager extends BaseManager<LiquidityOperation> {\n private readonly route = '/liquidity-pools';\n\n /**\n * Build a deposit into the pool formed by the two assets → unsigned XDR, SEP-7\n * URI and QR.\n *\n * The pool is DERIVED from the two assets rather than named: a constant-product\n * pool id is a hash of its (assetA, assetB, fee) in CAP-38 order, so there is\n * exactly one pool the pair can form and no id for a caller to get wrong.\n */\n public async deposit(options: DepositLiquidityOptions): Promise<LiquidityOperation> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<LiquidityOperationData>(`${this.route}/deposit`, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n // Sent as a header too: the service accepts either, and the header is what\n // makes a retried POST safe when the body was already consumed upstream.\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new LiquidityOperation(this.client, data));\n }\n\n /** Build a withdrawal (burn shares) from a pool → unsigned XDR, SEP-7 URI and QR. */\n public async withdraw(options: WithdrawLiquidityOptions): Promise<LiquidityOperation> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<LiquidityOperationData>(`${this.route}/withdraw`, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new LiquidityOperation(this.client, data));\n }\n\n /** An account's pool share positions, with what each is redeemable for right now. */\n public positions(account: string): Promise<LiquidityPositionsData> {\n return this.rest.get<LiquidityPositionsData>(`${this.route}/positions`, {\n query: { account },\n });\n }\n\n /** Browse on-chain pools (Horizon proxy). Filter by asset pair or by holder. */\n public async browse(options: BrowseLiquidityPoolsOptions = {}): Promise<LiquidityPoolPage> {\n const data = await this.rest.get<LiquidityPoolListData>(this.route, {\n query: {\n assetACode: options.assetACode,\n assetAIssuer: options.assetAIssuer,\n assetBCode: options.assetBCode,\n assetBIssuer: options.assetBIssuer,\n account: options.account,\n cursor: options.cursor,\n limit: options.limit,\n },\n });\n return { items: data.data, cursor: data.cursor ?? null };\n }\n\n /** One on-chain pool by its hex id (Horizon proxy). */\n public pool(poolId: string): Promise<LiquidityPoolData> {\n return this.rest.get<LiquidityPoolData>(`${this.route}/${poolId}`);\n }\n\n /** List this consumer's pool operations (paginated). */\n public async operations(\n options: ListLiquidityOperationsOptions = {},\n ): Promise<LiquidityOperationPage> {\n const data = await this.rest.get<LiquidityOperationListData>(`${this.route}/operations`, {\n query: {\n kind: options.kind,\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n });\n return {\n items: data.data.map((d) => this._add(new LiquidityOperation(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Get one operation by id, materialized. */\n public async fetch(id: string): Promise<LiquidityOperation> {\n return this._add(new LiquidityOperation(this.client, await this.fetchRaw(id)));\n }\n\n /**\n * The raw payload for one operation. Exists so {@link LiquidityOperation.fetch}\n * can patch itself in place instead of materializing a second instance of the\n * thing the caller is already holding.\n */\n public fetchRaw(id: string): Promise<LiquidityOperationData> {\n return this.rest.get<LiquidityOperationData>(`${this.route}/operations/${id}`);\n }\n\n /**\n * Relay a signed operation to the network. The service checks the envelope's\n * hash against the one it built, so a signed envelope that is not the one this\n * operation describes is refused rather than broadcast.\n */\n public async submit(\n id: string,\n options: SubmitLiquidityOptions,\n ): Promise<LiquiditySubmitOutcome> {\n const data = await this.rest.post<LiquiditySubmitOutcomeData>(\n `${this.route}/operations/${id}/submit`,\n { body: options },\n );\n return {\n submitted: data.submitted,\n status: data.status,\n txHash: data.txHash ?? null,\n reason: data.reason ?? null,\n resultCodes: data.resultCodes ?? null,\n operation: this._add(new LiquidityOperation(this.client, data.operation)),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n CreatePayinOptions,\n CreatePayinQuoteOptions,\n CreateTrustlineOptions,\n CreateVirtualAccountOptions,\n ListPayinsOptions,\n PayinData,\n PayinListData,\n PayinQuoteData,\n TrustlineData,\n VirtualAccountData,\n} from '@/types/index';\n\n/** A page of payins plus its pagination metadata. */\nexport interface PayinPage {\n items: PayinData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Fiat → stablecoin — `client.onramp`.\n *\n * Three steps, in this order and no other: **quote** (a price, valid for about\n * five minutes), **payin** (created FROM that quote, and what returns the funding\n * instructions the payer acts on), then the money arrives off-band and the payin\n * status moves on its own.\n *\n * There is no structure class here on purpose. A payin has no action of its own —\n * it is a mirror of the provider's record, read and re-read — so an object with a\n * client back-reference would carry a `fetch()` and nothing else.\n *\n * @example\n * const quote = await client.onramp.quote({\n * blockchain_wallet_id: 'w_123',\n * currency_type: 'sender',\n * payment_method: 'pix',\n * token: 'USDC',\n * request_amount: 10_000, // minor units\n * });\n * const payin = await client.onramp.createPayin({ payin_quote_id: quote.id });\n * console.log(payin.instructions);\n */\nexport class OnrampManager {\n public readonly client: Client;\n private readonly route = '/onramp';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Price a payin. The quote expires — check `expires_at` before using it. */\n public quote(options: CreatePayinQuoteOptions): Promise<PayinQuoteData> {\n return this.rest.post<PayinQuoteData>(`${this.route}/quotes`, { body: options });\n }\n\n /** Create a payin from a quote. The response carries the funding instructions. */\n public createPayin(options: CreatePayinOptions): Promise<PayinData> {\n return this.rest.post<PayinData>(`${this.route}/payins`, { body: options });\n }\n\n /** List this consumer's payins (paginated). */\n public async payins(options: ListPayinsOptions = {}): Promise<PayinPage> {\n const data = await this.rest.get<PayinListData>(`${this.route}/payins`, {\n query: { take: options.take, skip: options.skip },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /**\n * One payin. Served from the local mirror, refreshed from the provider when it\n * is stale — so this is the right call to poll, not the provider's own API.\n */\n public payin(id: string): Promise<PayinData> {\n return this.rest.get<PayinData>(`${this.route}/payins/${id}`);\n }\n\n /**\n * Build the unsigned trustline transaction an address needs before it can hold\n * the stablecoin the ramp pays out in.\n *\n * The envelope comes from the gateway, so a wallet signing it must decode and\n * bound it first — the issuer it names is the one the payout will use, and it is\n * not known to the caller in advance.\n */\n public createTrustline(options: CreateTrustlineOptions): Promise<TrustlineData> {\n return this.rest.post<TrustlineData>(`${this.route}/trustline`, { body: options });\n }\n\n /** Open a virtual account (a permanent bank reference) for a verified receiver. */\n public createVirtualAccount(\n receiverId: string,\n options: CreateVirtualAccountOptions,\n ): Promise<VirtualAccountData> {\n return this.rest.post<VirtualAccountData>(\n `${this.route}/receivers/${receiverId}/virtual-accounts`,\n { body: options },\n );\n }\n\n /** A receiver's virtual accounts. */\n public virtualAccounts(\n receiverId: string,\n options: ListPayinsOptions = {},\n ): Promise<VirtualAccountData> {\n return this.rest.get<VirtualAccountData>(\n `${this.route}/receivers/${receiverId}/virtual-accounts`,\n { query: { take: options.take, skip: options.skip } },\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AttachPayoutDocumentOptions,\n AuthorizePayoutData,\n AuthorizePayoutOptions,\n CreatePayoutOptions,\n CreatePayoutQuoteOptions,\n ListPayoutsOptions,\n PayoutData,\n PayoutDocumentData,\n PayoutListData,\n PayoutQuoteData,\n} from '@/types/index';\n\n/** A page of payouts plus its pagination metadata. */\nexport interface PayoutPage {\n items: PayoutData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Stablecoin → fiat — `client.offramp`.\n *\n * Four steps, and the middle one is the one people miss: **quote**, **authorize**\n * (which builds the unsigned transaction that moves the stablecoin), the wallet\n * signs it, and only then **create the payout** with that signature attached. A\n * payout created without a signed transfer is a payout with nothing behind it.\n *\n * `authorize` is for the chains that need a transaction built for them (Stellar,\n * Solana). On EVM the quote itself carries the `approve` contract payload, so the\n * caller signs that instead and goes straight to `createPayout`.\n *\n * @example\n * const quote = await client.offramp.quote({\n * bank_account_id: 'ba_123',\n * currency_type: 'sender',\n * request_amount: 5_000,\n * network: 'stellar',\n * token: 'USDC',\n * });\n * const { xdr } = await client.offramp.authorize({\n * quote_id: quote.id,\n * sender_wallet_address: 'G…',\n * chain: 'stellar',\n * });\n * // …wallet signs `xdr`, after bounding it against `quote`…\n * const payout = await client.offramp.createPayout({\n * quote_id: quote.id,\n * sender_wallet_address: 'G…',\n * chain: 'stellar',\n * signed_transaction: signedXdr,\n * });\n */\nexport class OfframpManager {\n public readonly client: Client;\n private readonly route = '/offramp';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Price a payout. Expires in about five minutes. */\n public quote(options: CreatePayoutQuoteOptions): Promise<PayoutQuoteData> {\n return this.rest.post<PayoutQuoteData>(`${this.route}/quotes`, { body: options });\n }\n\n /**\n * Build the unsigned transfer for a Stellar or Solana payout.\n *\n * What comes back is built by the gateway, not by the caller: bound it against\n * the quote the user confirmed before signing, or the amount that leaves is\n * whatever the response says it is.\n */\n public authorize(options: AuthorizePayoutOptions): Promise<AuthorizePayoutData> {\n return this.rest.post<AuthorizePayoutData>(`${this.route}/payouts/authorize`, {\n body: options,\n });\n }\n\n /** Create the payout from a quote, with the signed transfer attached. */\n public createPayout(options: CreatePayoutOptions): Promise<PayoutData> {\n return this.rest.post<PayoutData>(`${this.route}/payouts`, { body: options });\n }\n\n /** List this consumer's payouts (paginated). */\n public async payouts(options: ListPayoutsOptions = {}): Promise<PayoutPage> {\n const data = await this.rest.get<PayoutListData>(`${this.route}/payouts`, {\n query: { take: options.take, skip: options.skip },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** One payout. Served from the local mirror, refreshed when stale. */\n public payout(id: string): Promise<PayoutData> {\n return this.rest.get<PayoutData>(`${this.route}/payouts/${id}`);\n }\n\n /**\n * Attach a compliance document to a payout — an invoice or proof of funds the\n * rail asks for before it will settle.\n */\n public attachDocument(\n id: string,\n options: AttachPayoutDocumentOptions,\n ): Promise<PayoutDocumentData> {\n return this.rest.post<PayoutDocumentData>(`${this.route}/payouts/${id}/documents`, {\n body: options,\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n ActivityEventInput,\n ActivityListData,\n ActivityReportData,\n ActivitySummaryData,\n ListActivityOptions,\n ReportActivityOptions,\n} from '@/types/index';\n\n/** A page of events plus its pagination metadata. */\nexport interface ActivityPage {\n items: ActivityListData['data'];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * The client event stream — `client.activity`.\n *\n * This is the trail the wallet, the dashboard and your own server write to: errors,\n * screen views, timings, the operations they built. It exists because a console is\n * not a trail — an extension popup's console dies with the popup and a phone's\n * WebView console needs a cable — and because the failures worth having are the\n * ones that never reach the API at all.\n *\n * Two rules the writers are expected to keep, and neither is enforceable here:\n * report only what the user consented to, and never put memo text or anything that\n * names a counterparty in `props`.\n *\n * @example\n * await client.activity.report([\n * { type: 'checkout.opened', source: 'server', level: 'info', eventId: crypto.randomUUID() },\n * ]);\n */\nexport class ActivityManager {\n public readonly client: Client;\n private readonly route = '/activity';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /**\n * Report a batch of events.\n *\n * Accepts the array directly or the full body. Give each event an `eventId`: the\n * service de-duplicates on it, which is the difference between a retried batch\n * and a double-counted one.\n */\n public report(\n events: ActivityEventInput[] | ReportActivityOptions,\n ): Promise<ActivityReportData> {\n const body: ReportActivityOptions = Array.isArray(events) ? { events } : events;\n return this.rest.post<ActivityReportData>(`${this.route}/events`, { body });\n }\n\n /** Recent events for this consumer, newest first. */\n public async events(options: ListActivityOptions = {}): Promise<ActivityPage> {\n const data = await this.rest.get<ActivityListData>(`${this.route}/events`, {\n query: {\n take: options.take,\n skip: options.skip,\n source: options.source,\n level: options.level,\n category: options.category,\n type: options.type,\n network: options.network,\n since: options.since,\n until: options.until,\n },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Counts, top event types, top errors and a daily series. */\n public summary(options: { days?: number; source?: string } = {}): Promise<ActivitySummaryData> {\n return this.rest.get<ActivitySummaryData>(`${this.route}/summary`, {\n query: { days: options.days, source: options.source },\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type {\n ApproveReceiverOptions,\n BankAccountData,\n CreateBankAccountOptions,\n CreateReceiverWalletOptions,\n EnableReceiverOptions,\n ListKycOptions,\n ReceiverData,\n ReceiverWalletData,\n RequestTosOptions,\n TermsOfServiceData,\n UpdateReceiverOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { BankAccountPage, ReceiverWalletPage } from '@/managers/KycManager';\n\n/**\n * A verified identity — the thing both ramps hang off.\n *\n * Everything a receiver owns is reachable from the instance\n * (`receiver.addBankAccount(…)`, `receiver.wallets()`), because the alternative is\n * carrying a receiver id and a manager reference side by side through a KYC flow\n * that already has enough moving parts.\n */\nexport class Receiver extends Base<ReceiverData> {\n public blindpayId!: string;\n /** `individual` or `business`. */\n public type!: string;\n public kycType!: string | null;\n /** Verification state, refreshed from upstream on every read. */\n public kycStatus!: string | null;\n public email!: string | null;\n public name!: string | null;\n public country!: string | null;\n /** Your own id for this receiver, if you set one. */\n public externalId!: string | null;\n /** True when the receiver is cut off from both ramps. */\n public disabled!: boolean;\n /** How many times the submitted KYC data has been written. */\n public dossierVersion!: number;\n /** The version a reviewer approved, or null while unapproved. */\n public reviewedVersion!: number | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ReceiverData) {\n super(client, data);\n }\n\n protected override _patch(data: ReceiverData): this {\n super._patch(data);\n this.blindpayId = data.blindpayId;\n this.type = data.type;\n this.kycType = data.kycType ?? null;\n this.kycStatus = data.kycStatus ?? null;\n this.email = data.email ?? null;\n this.name = data.name ?? null;\n this.country = data.country ?? null;\n this.externalId = data.externalId ?? null;\n this.disabled = data.disabled;\n this.dossierVersion = data.dossierVersion;\n this.reviewedVersion = data.reviewedVersion ?? null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** True once verification has passed and the ramps will act on this receiver. */\n public get isApproved(): boolean {\n return this.kycStatus === 'approved';\n }\n\n /** Re-read this receiver, refreshing `kycStatus`, and patch it in place. */\n public async fetch(): Promise<this> {\n return this._patch(await this.client.kyc.fetchReceiverRaw(this.id));\n }\n\n /** Update and patch in place. */\n public async update(options: UpdateReceiverOptions): Promise<this> {\n const updated = await this.client.kyc.updateReceiver(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Delete this receiver. */\n public delete(): Promise<void> {\n return this.client.kyc.deleteReceiver(this.id);\n }\n\n /**\n * Approve it out of review (admin-only).\n *\n * Pinned to the dossier THIS instance holds: `expected_version` defaults to\n * {@link Receiver.dossierVersion}, so approving a receiver that was edited since\n * you read it is a `409 kyc_state_invalid` rather than a silent approval of data\n * you never saw. Call {@link Receiver.fetch} and review again, or pass\n * `expected_version` yourself — including `undefined`, which approves whatever\n * is stored now.\n */\n public approve(options: ApproveReceiverOptions = {}): Promise<ReceiverData> {\n const pinned: ApproveReceiverOptions =\n 'expected_version' in options\n ? options\n : { ...options, expected_version: this.dossierVersion };\n return this.client.kyc.approveReceiver(this.id, pinned);\n }\n\n /** Ask for a terms-of-service link for this receiver. */\n public requestTos(options: RequestTosOptions): Promise<TermsOfServiceData> {\n return this.client.kyc.requestTos(this.id, options);\n }\n\n /** Enable it with an accepted terms-of-service id, and patch in place. */\n public async enable(options: EnableReceiverOptions): Promise<this> {\n const enabled = await this.client.kyc.enableReceiver(this.id, options);\n return this._patch(enabled.toJSON());\n }\n\n /** Cut this receiver off from both ramps, or let it back in. */\n public async setAccess(disabled: boolean): Promise<this> {\n const updated = await this.client.kyc.setReceiverAccess(this.id, { disabled });\n return this._patch(updated.toJSON());\n }\n\n /** Register a blockchain wallet for this receiver. */\n public addWallet(options: CreateReceiverWalletOptions): Promise<ReceiverWalletData> {\n return this.client.kyc.addWallet(this.id, options);\n }\n\n /** This receiver's wallets. */\n public wallets(options: ListKycOptions = {}): Promise<ReceiverWalletPage> {\n return this.client.kyc.wallets(this.id, options);\n }\n\n /** Add a fiat bank account — where an off-ramp pays out. */\n public addBankAccount(options: CreateBankAccountOptions): Promise<BankAccountData> {\n return this.client.kyc.addBankAccount(this.id, options);\n }\n\n /** This receiver's bank accounts. */\n public bankAccounts(options: ListKycOptions = {}): Promise<BankAccountPage> {\n return this.client.kyc.bankAccounts(this.id, options);\n }\n\n public toJSON(): ReceiverData {\n return {\n id: this.id,\n blindpayId: this.blindpayId,\n type: this.type,\n kycType: this.kycType,\n kycStatus: this.kycStatus,\n email: this.email,\n name: this.name,\n country: this.country,\n externalId: this.externalId,\n disabled: this.disabled,\n dossierVersion: this.dossierVersion,\n reviewedVersion: this.reviewedVersion,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport { Receiver } from '@/structures/Receiver';\nimport { BaseManager } from '@/managers/BaseManager';\nimport type {\n ApproveReceiverOptions,\n BankAccountData,\n BankAccountListData,\n BankDetailsData,\n CreateBankAccountOptions,\n CreateReceiverOptions,\n CreateReceiverWalletOptions,\n EnableReceiverOptions,\n InitiateTosOptions,\n KycRailsData,\n KycUploadData,\n ListKycOptions,\n ReceiverData,\n ReceiverListData,\n ReceiverWalletData,\n ReceiverWalletListData,\n RequestTosOptions,\n SetReceiverAccessOptions,\n TermsOfServiceData,\n UpdateReceiverOptions,\n WalletSignMessageData,\n} from '@/types/index';\n\n/** A page of receivers plus its pagination metadata. */\nexport interface ReceiverPage {\n items: Receiver[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of a receiver's wallets. */\nexport interface ReceiverWalletPage {\n items: ReceiverWalletData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of a receiver's bank accounts. */\nexport interface BankAccountPage {\n items: BankAccountData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * KYC / KYB — `client.kyc`.\n *\n * A receiver is the verified identity both ramps hang off: an on-ramp pays INTO\n * one of its wallets, an off-ramp pays OUT to one of its bank accounts, and\n * neither works until verification passes.\n *\n * The order is not obvious and the API will not guess it for you:\n *\n * 1. `termsOfService()` — the acceptance the provider requires up front, which\n * returns a `tos_id`.\n * 2. `upload()` each document, keeping the `file_url` it returns.\n * 3. `createReceiver()` with those URLs and the `tos_id`.\n * 4. `addWallet()` / `addBankAccount()` for where money should land.\n * 5. verification runs; `fetchReceiver()` refreshes `kycStatus` from upstream.\n *\n * @example\n * const tos = await client.kyc.termsOfService({ redirect_url: 'https://app/kyc/done' });\n * const { file_url } = await client.kyc.upload(fileBase64);\n * const receiver = await client.kyc.createReceiver({\n * type: 'individual', kyc_type: 'standard', email: 'a@b.com', country: 'BR',\n * id_doc_front_file: file_url, tos_id: tosId,\n * });\n */\nexport class KycManager extends BaseManager<Receiver> {\n private readonly route = '/kyc';\n\n /* ----------------------------- receivers ------------------------------- */\n\n /** Create a receiver and start verification. */\n public async createReceiver(options: CreateReceiverOptions): Promise<Receiver> {\n const data = await this.rest.post<ReceiverData>(`${this.route}/receivers`, { body: options });\n return this._add(new Receiver(this.client, data));\n }\n\n /** List this consumer's receivers (paginated). */\n public async receivers(options: ListKycOptions = {}): Promise<ReceiverPage> {\n const data = await this.rest.get<ReceiverListData>(`${this.route}/receivers`, {\n query: { take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new Receiver(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** One receiver, materialized. Reading it refreshes `kycStatus` upstream. */\n public async fetchReceiver(id: string): Promise<Receiver> {\n return this._add(new Receiver(this.client, await this.fetchReceiverRaw(id)));\n }\n\n /** The raw payload, so a {@link Receiver} can patch itself in place. */\n public fetchReceiverRaw(id: string): Promise<ReceiverData> {\n return this.rest.get<ReceiverData>(`${this.route}/receivers/${id}`);\n }\n\n /**\n * Update a receiver — the same fields as creation, all optional. Once the receiver\n * exists at the provider, identity fields need an elevated key; see\n * {@link UpdateReceiverOptions}.\n */\n public async updateReceiver(id: string, options: UpdateReceiverOptions): Promise<Receiver> {\n const data = await this.rest.patch<ReceiverData>(`${this.route}/receivers/${id}`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /** Delete a receiver. */\n public async deleteReceiver(id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${id}`);\n this.cache.delete(id);\n }\n\n /**\n * Approve a receiver sitting in review. Admin-only: it is the human gate on a\n * verification the provider could not decide by itself.\n */\n public approveReceiver(id: string, options: ApproveReceiverOptions = {}): Promise<ReceiverData> {\n return this.rest.post<ReceiverData>(`${this.route}/receivers/${id}/approve`, { body: options });\n }\n\n /**\n * Ask for a terms-of-service link for an existing receiver. `channel: 'code'`\n * returns the URL to render; `'email'` sends it to the receiver instead.\n */\n public requestTos(id: string, options: RequestTosOptions): Promise<TermsOfServiceData> {\n return this.rest.post<TermsOfServiceData>(`${this.route}/receivers/${id}/tos`, {\n body: options,\n });\n }\n\n /** Enable an inactive receiver with an accepted terms-of-service id. */\n public async enableReceiver(id: string, options: EnableReceiverOptions): Promise<Receiver> {\n const data = await this.rest.post<ReceiverData>(`${this.route}/receivers/${id}/enable`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /**\n * Cut a receiver off from both ramps, or let it back in. Admin-only, and the\n * fastest lever there is when something is wrong with an account.\n */\n public async setReceiverAccess(\n id: string,\n options: SetReceiverAccessOptions,\n ): Promise<Receiver> {\n const data = await this.rest.patch<ReceiverData>(`${this.route}/receivers/${id}/access`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /* ------------------------------ wallets -------------------------------- */\n\n /**\n * The message a receiver must sign to prove it controls an address. Sign it,\n * then pass the resulting transaction hash as `signature_tx_hash` to\n * {@link addWallet}.\n */\n public walletSignMessage(receiverId: string): Promise<WalletSignMessageData> {\n return this.rest.get<WalletSignMessageData>(\n `${this.route}/receivers/${receiverId}/wallets/sign-message`,\n );\n }\n\n /** Register a blockchain wallet for a receiver. */\n public addWallet(\n receiverId: string,\n options: CreateReceiverWalletOptions,\n ): Promise<ReceiverWalletData> {\n return this.rest.post<ReceiverWalletData>(`${this.route}/receivers/${receiverId}/wallets`, {\n body: options,\n });\n }\n\n /** A receiver's wallets (paginated). */\n public async wallets(\n receiverId: string,\n options: ListKycOptions = {},\n ): Promise<ReceiverWalletPage> {\n const data = await this.rest.get<ReceiverWalletListData>(\n `${this.route}/receivers/${receiverId}/wallets`,\n { query: { take: options.take, skip: options.skip } },\n );\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Delete one of a receiver's wallets. */\n public async deleteWallet(receiverId: string, id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${receiverId}/wallets/${id}`);\n }\n\n /* ---------------------------- bank accounts ---------------------------- */\n\n /** Add a fiat bank account for a receiver — where an off-ramp pays out. */\n public addBankAccount(\n receiverId: string,\n options: CreateBankAccountOptions,\n ): Promise<BankAccountData> {\n return this.rest.post<BankAccountData>(\n `${this.route}/receivers/${receiverId}/bank-accounts`,\n { body: options },\n );\n }\n\n /** A receiver's bank accounts (paginated). */\n public async bankAccounts(\n receiverId: string,\n options: ListKycOptions = {},\n ): Promise<BankAccountPage> {\n const data = await this.rest.get<BankAccountListData>(\n `${this.route}/receivers/${receiverId}/bank-accounts`,\n { query: { take: options.take, skip: options.skip } },\n );\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Delete one of a receiver's bank accounts. */\n public async deleteBankAccount(receiverId: string, id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${receiverId}/bank-accounts/${id}`);\n }\n\n /* ------------------------------ the rest ------------------------------- */\n\n /**\n * Upload a KYC document and get back the `file_url` every `*_file` field\n * expects. Documents are uploaded first and referenced by URL — the receiver\n * payload never carries bytes.\n */\n public upload(file: unknown): Promise<KycUploadData> {\n return this.rest.post<KycUploadData>(`${this.route}/upload`, { body: file });\n }\n\n /**\n * Start terms-of-service acceptance and get the hosted URL. This is the FIRST\n * step of the flow: the provider will not create a receiver without the `tos_id`\n * it produces.\n */\n public termsOfService(options: InitiateTosOptions = {}): Promise<TermsOfServiceData> {\n return this.rest.post<TermsOfServiceData>(`${this.route}/terms-of-service`, { body: options });\n }\n\n /** The bank rails available to this consumer. */\n public rails(): Promise<KycRailsData> {\n return this.rest.get<KycRailsData>(`${this.route}/rails`);\n }\n\n /**\n * The field schema a given rail requires. The authority on which of the ~70\n * rail-specific bank-account fields to send — read it at runtime rather than\n * hard-coding a rail's shape.\n */\n public bankDetails(rail: string): Promise<BankDetailsData> {\n return this.rest.get<BankDetailsData>(`${this.route}/bank-details`, { query: { rail } });\n }\n\n protected get rest(): REST {\n return this.client.rest;\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n CrossChainSwapStatus,\n type CrossChainSwapData,\n type CrossChainTransactionData,\n type SwapChain,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** Statuses after which nothing changes. */\nconst FINAL: readonly CrossChainSwapStatus[] = [\n CrossChainSwapStatus.Succeeded,\n CrossChainSwapStatus.Refunded,\n CrossChainSwapStatus.Failed,\n];\n\n/**\n * A swap between two chains, settled by NEAR Intents — `client.crossChainSwaps`.\n *\n * Pay exactly {@link amountIn} of the origin asset to {@link depositAddress}\n * (with {@link depositMemo} on Stellar, as a MEMO_TEXT) — {@link depositUri} is\n * that payment as a wallet link. NEAR Intents pays {@link recipient} on the\n * destination chain, or refunds {@link refundTo}. The server follows it; poll\n * with `await swap.fetch()` or subscribe to the `CROSS_CHAIN_SWAP_*` webhooks.\n */\nexport class CrossChainSwap extends Base<CrossChainSwapData> {\n public status!: CrossChainSwapStatus;\n /** NEAR Intents' own status word. */\n public providerStatus!: string;\n public network!: string;\n public originChain!: SwapChain;\n public originAsset!: string;\n public originContract!: string | null;\n public destinationChain!: SwapChain;\n public destinationAsset!: string;\n public destinationContract!: string | null;\n public amountIn!: string;\n public feeBps!: number;\n public feeAmount!: string;\n public amountOutEstimated!: string;\n public amountOutMin!: string;\n public slippageBps!: number;\n public recipient!: string;\n public refundTo!: string;\n public depositAddress!: string;\n public depositMemo!: string | null;\n public depositUri!: string;\n /** QR of {@link depositUri}; list rows do not carry it. */\n public qr!: string | null;\n public depositTxHash!: string | null;\n public amountOut!: string | null;\n public refundedAmount!: string | null;\n public originTxHashes!: CrossChainTransactionData[] | null;\n public destinationTxHashes!: CrossChainTransactionData[] | null;\n public timeEstimateSeconds!: number;\n public correlationId!: string;\n /** Keep it: NEAR Intents' signature over the quote settles a dispute. */\n public quoteSignature!: string;\n public idempotencyKey!: string | null;\n public expiresAt!: Date;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: CrossChainSwapData) {\n super(client, data);\n }\n\n protected override _patch(data: CrossChainSwapData): this {\n super._patch(data);\n this.status = data.status;\n this.providerStatus = data.providerStatus;\n this.network = data.network;\n this.originChain = data.originChain;\n this.originAsset = data.originAsset;\n this.originContract = data.originContract;\n this.destinationChain = data.destinationChain;\n this.destinationAsset = data.destinationAsset;\n this.destinationContract = data.destinationContract;\n this.amountIn = data.amountIn;\n this.feeBps = data.feeBps;\n this.feeAmount = data.feeAmount;\n this.amountOutEstimated = data.amountOutEstimated;\n this.amountOutMin = data.amountOutMin;\n this.slippageBps = data.slippageBps;\n this.recipient = data.recipient;\n this.refundTo = data.refundTo;\n this.depositAddress = data.depositAddress;\n this.depositMemo = data.depositMemo;\n this.depositUri = data.depositUri;\n this.qr = data.qr ?? null;\n this.depositTxHash = data.depositTxHash;\n this.amountOut = data.amountOut;\n this.refundedAmount = data.refundedAmount;\n this.originTxHashes = data.originTxHashes;\n this.destinationTxHashes = data.destinationTxHashes;\n this.timeEstimateSeconds = data.timeEstimateSeconds;\n this.correlationId = data.correlationId;\n this.quoteSignature = data.quoteSignature;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has reached an outcome that will not change. */\n public get isFinal(): boolean {\n return FINAL.includes(this.status);\n }\n\n public get isSucceeded(): boolean {\n return this.status === CrossChainSwapStatus.Succeeded;\n }\n\n /** Re-fetch from the API, updating this instance in place. */\n public async fetch(): Promise<this> {\n const fresh = await this.client.crossChainSwaps.fetch(this.id);\n return this._patch(fresh.toJSON());\n }\n\n /**\n * Report the transaction that paid the deposit address so NEAR Intents starts\n * without waiting for its indexer. Updates this instance in place.\n */\n public async reportDeposit(txHash: string): Promise<this> {\n const fresh = await this.client.crossChainSwaps.reportDeposit(this.id, txHash);\n return this._patch(fresh.toJSON());\n }\n\n public toJSON(): CrossChainSwapData {\n return {\n id: this.id,\n status: this.status,\n providerStatus: this.providerStatus,\n network: this.network,\n originChain: this.originChain,\n originAsset: this.originAsset,\n originContract: this.originContract,\n destinationChain: this.destinationChain,\n destinationAsset: this.destinationAsset,\n destinationContract: this.destinationContract,\n amountIn: this.amountIn,\n feeBps: this.feeBps,\n feeAmount: this.feeAmount,\n amountOutEstimated: this.amountOutEstimated,\n amountOutMin: this.amountOutMin,\n slippageBps: this.slippageBps,\n recipient: this.recipient,\n refundTo: this.refundTo,\n depositAddress: this.depositAddress,\n depositMemo: this.depositMemo,\n depositUri: this.depositUri,\n ...(this.qr ? { qr: this.qr } : {}),\n depositTxHash: this.depositTxHash,\n amountOut: this.amountOut,\n refundedAmount: this.refundedAmount,\n originTxHashes: this.originTxHashes,\n destinationTxHashes: this.destinationTxHashes,\n timeEstimateSeconds: this.timeEstimateSeconds,\n correlationId: this.correlationId,\n quoteSignature: this.quoteSignature,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { CrossChainSwap } from '@/structures/CrossChainSwap';\nimport type {\n CreateCrossChainSwapOptions,\n CrossChainAssetData,\n CrossChainQuoteData,\n CrossChainSwapData,\n CrossChainSwapListData,\n ListCrossChainSwapsOptions,\n QuoteCrossChainSwapOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of cross-chain swaps plus its pagination metadata. */\nexport interface CrossChainSwapPage {\n items: CrossChainSwap[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Swaps between Stellar, Solana and Monad, settled by NEAR Intents —\n * `client.crossChainSwaps`. Mainnet only: a `dev` key can list assets and\n * quote, but creating answers `400 network_unsupported`. Both legs on one chain\n * is `client.swaps` with `chain`.\n *\n * @example\n * const swap = await client.crossChainSwaps.create({\n * originChain: 'stellar', originAsset: 'XLM', amount: '100',\n * destinationChain: 'solana', destinationAsset: 'USDC',\n * recipient: solanaAddress, refundTo: stellarAddress,\n * });\n * // Pay swap.amountIn to swap.depositAddress (memo swap.depositMemo), or open swap.depositUri.\n */\nexport class CrossChainSwapManager extends BaseManager<CrossChainSwap> {\n private readonly route = '/cross-chain-swaps';\n\n /** The tokens NEAR Intents can swap on Stellar, Solana and Monad. */\n public async assets(): Promise<CrossChainAssetData[]> {\n const { data } = await this.rest.get<{ data: CrossChainAssetData[] }>(\n `${this.route}/assets`,\n );\n return data;\n }\n\n /** A dry quote: output, minimum and commission. Persists nothing. */\n public quote(options: QuoteCrossChainSwapOptions): Promise<CrossChainQuoteData> {\n return this.rest.post<CrossChainQuoteData>(`${this.route}/quote`, {\n body: options,\n });\n }\n\n /** A live quote: the deposit address, memo and wallet link that fund the swap. */\n public async create(options: CreateCrossChainSwapOptions): Promise<CrossChainSwap> {\n const data = await this.rest.post<CrossChainSwapData>(this.route, {\n body: options,\n });\n return this._add(new CrossChainSwap(this.client, data));\n }\n\n public async fetch(id: string): Promise<CrossChainSwap> {\n const data = await this.rest.get<CrossChainSwapData>(`${this.route}/${id}`);\n return this._add(new CrossChainSwap(this.client, data));\n }\n\n public async list(options: ListCrossChainSwapsOptions = {}): Promise<CrossChainSwapPage> {\n const data = await this.rest.get<CrossChainSwapListData>(this.route, {\n query: { status: options.status, take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new CrossChainSwap(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Report the transaction that paid the deposit address. */\n public async reportDeposit(id: string, txHash: string): Promise<CrossChainSwap> {\n const data = await this.rest.post<CrossChainSwapData>(\n `${this.route}/${id}/deposit`,\n { body: { txHash } },\n );\n return this._add(new CrossChainSwap(this.client, data));\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n DefindexDepositOptions,\n DefindexWithdrawOptions,\n} from '@/types/index';\n\n/**\n * DeFindex vaults on Stellar — `client.defindex`. Served only where the\n * deployment enables the DeFindex native plugin (`PLUGINS_ENABLED=defindex`);\n * elsewhere every call is a 404.\n *\n * The payloads are DeFindex's own and are passed through untyped. Deposits and\n * withdrawals come back as an unsigned transaction for the caller to sign and\n * hand to {@link submit}.\n */\nexport class DefindexManager {\n public readonly client: Client;\n private readonly route = '/defindex';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n public vaults<T = unknown>(): Promise<T> {\n return this.rest.get<T>(`${this.route}/vaults`);\n }\n\n public vault<T = unknown>(vault: string): Promise<T> {\n return this.rest.get<T>(`${this.route}/vaults/${encodeURIComponent(vault)}`);\n }\n\n /** An account's position in a vault. */\n public balance<T = unknown>(vault: string, account: string): Promise<T> {\n return this.rest.get<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/balance`,\n { query: { account } },\n );\n }\n\n public deposit<T = unknown>(vault: string, options: DefindexDepositOptions): Promise<T> {\n return this.rest.post<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/deposit`,\n { body: options },\n );\n }\n\n public withdraw<T = unknown>(vault: string, options: DefindexWithdrawOptions): Promise<T> {\n return this.rest.post<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/withdraw`,\n { body: options },\n );\n }\n\n /** Submit a signed DeFindex transaction (base64 XDR). */\n public submit<T = unknown>(xdr: string): Promise<T> {\n return this.rest.post<T>(`${this.route}/submit`, { body: { xdr } });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n InstallPluginOptions,\n PluginActionResultData,\n PluginData,\n PluginListData,\n PluginUninstalledData,\n} from '@/types/index';\n\n/**\n * Plugins this deployment serves — `client.plugins`. A plugin runs only for a\n * consumer that installed it, and installing is consenting to exactly the\n * capabilities it declares: pass them back as `grantCapabilities`.\n *\n * @example\n * const plugin = await client.plugins.fetch('invoices');\n * await client.plugins.install('invoices', { grantCapabilities: plugin.capabilities });\n * const { output } = await client.plugins.query('invoices', 'list', { status: 'open' });\n */\nexport class PluginManager {\n public readonly client: Client;\n private readonly route = '/plugins';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n public async list(): Promise<PluginData[]> {\n const { data } = await this.rest.get<PluginListData>(this.route);\n return data;\n }\n\n public fetch(slug: string): Promise<PluginData> {\n return this.rest.get<PluginData>(`${this.route}/${encodeURIComponent(slug)}`);\n }\n\n /** Install (or re-consent to) a plugin. */\n public install(slug: string, options: InstallPluginOptions): Promise<PluginData> {\n return this.rest.put<PluginData>(\n `${this.route}/${encodeURIComponent(slug)}/installation`,\n { body: options },\n );\n }\n\n public uninstall(slug: string): Promise<PluginUninstalledData> {\n return this.rest.delete<PluginUninstalledData>(\n `${this.route}/${encodeURIComponent(slug)}/installation`,\n );\n }\n\n /** Run a read-only action the plugin declares. */\n public query<T = unknown>(\n slug: string,\n action: string,\n input?: Record<string, unknown>,\n ): Promise<PluginActionResultData<T>> {\n return this.rest.post<PluginActionResultData<T>>(\n `${this.route}/${encodeURIComponent(slug)}/queries/${encodeURIComponent(action)}`,\n { body: { input } },\n );\n }\n\n /** Run an action that may change the plugin's state. */\n public command<T = unknown>(\n slug: string,\n action: string,\n input?: Record<string, unknown>,\n ): Promise<PluginActionResultData<T>> {\n return this.rest.post<PluginActionResultData<T>>(\n `${this.route}/${encodeURIComponent(slug)}/commands/${encodeURIComponent(action)}`,\n { body: { input } },\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { PublicKeyData } from '@/types/index';\n\n/**\n * The shared public API key — `client.publicKey`. It is what an open-source\n * wallet embeds to reach the few routes anonymous callers may use; the route\n * that serves it takes no key at all. Mostly useful to tooling that ships such\n * a wallet; a server with its own key has no need for it.\n */\nexport class PublicKeyManager {\n public readonly client: Client;\n private readonly route = '/public-key';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** The public key for an environment (`dev` → testnet, `prod` → mainnet). */\n public fetch(env: 'dev' | 'prod' = 'dev'): Promise<PublicKeyData> {\n return this.rest.get<PublicKeyData>(this.route, { query: { env } });\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n PaymentIntentKind,\n PaymentIntentStatus,\n type PaymentChain,\n type PaymentIntentData,\n type UpdatePaymentIntentOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/**\n * A Stellar SEP-7 payment intent.\n *\n * Wraps the raw API payload with typed accessors and atomic action methods so\n * you can operate on it directly: `await intent.validate(txHash)`,\n * `await intent.cancel()`, `await intent.delete()`.\n */\nexport class PaymentIntent extends Base<PaymentIntentData> {\n public kind!: PaymentIntentKind;\n public status!: PaymentIntentStatus;\n /** Chain the payment settles on. */\n public chain!: PaymentChain;\n public network!: string;\n /** Payer account (null for PAY intents). */\n public source!: string | null;\n public destination!: string;\n public amount!: string | null;\n /** Asset code, or `native` for the chain's coin (XLM, SOL or MON). */\n public asset!: string;\n public assetIssuer!: string | null;\n /** Mandatory MEMO_ID. */\n public memo!: string;\n public msg!: string | null;\n public callback!: string | null;\n /** Unsigned transaction envelope (base64 XDR); null for PAY intents. */\n public xdr!: string | null;\n /** SEP-7 deep link (`tx` or `pay`). */\n public uri!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n public txHash!: string | null;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: PaymentIntentData) {\n super(client, data);\n }\n\n protected override _patch(data: PaymentIntentData): this {\n super._patch(data);\n this.kind = data.kind;\n this.status = data.status;\n this.chain = data.chain ?? 'stellar';\n this.network = data.network;\n this.source = data.source;\n this.destination = data.destination;\n this.amount = data.amount;\n this.asset = data.asset;\n this.assetIssuer = data.assetIssuer;\n this.memo = data.memo;\n this.msg = data.msg;\n this.callback = data.callback;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.qr = data.qr;\n this.txHash = data.txHash;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether this is a SEP-7 `tx` intent (known source, has XDR). */\n public get isTx(): boolean {\n return this.kind === PaymentIntentKind.Tx;\n }\n\n /** Whether this is a SEP-7 `pay` intent (no source). */\n public get isPay(): boolean {\n return this.kind === PaymentIntentKind.Pay;\n }\n\n /** Whether the payment has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === PaymentIntentStatus.Succeeded;\n }\n\n /** Whether the intent is still awaiting payment. */\n public get isPending(): boolean {\n return this.status === PaymentIntentStatus.Pending;\n }\n\n /** Human-readable asset label (the chain's coin for native: `XLM`, `SOL` or `MON`). */\n public get assetLabel(): string {\n if (this.asset && this.asset !== 'native') return this.asset;\n return this.chain === 'solana' ? 'SOL' : this.chain === 'monad' ? 'MON' : 'XLM';\n }\n\n /** Re-fetch this intent from the API, returning a fresh instance. */\n public fetch(): Promise<PaymentIntent> {\n return this.client.paymentIntents.fetch(this.id);\n }\n\n /** Update this intent (status / txHash / reference). Mutates and returns it. */\n public async edit(options: UpdatePaymentIntentOptions): Promise<this> {\n const updated = await this.client.paymentIntents.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /**\n * Validate a submitted transaction against this intent. On a match the status\n * is finalized server-side and the webhook fires.\n */\n public validate(txHash: string) {\n return this.client.paymentIntents.validate(this.id, { txHash });\n }\n\n /** Mark this intent as cancelled. */\n public cancel(): Promise<this> {\n return this.edit({ status: PaymentIntentStatus.Cancelled });\n }\n\n /** Delete this intent. */\n public delete() {\n return this.client.paymentIntents.delete(this.id);\n }\n\n public toJSON(): PaymentIntentData {\n return {\n id: this.id,\n kind: this.kind,\n status: this.status,\n chain: this.chain,\n network: this.network,\n source: this.source,\n destination: this.destination,\n amount: this.amount,\n asset: this.asset,\n assetIssuer: this.assetIssuer,\n memo: this.memo,\n msg: this.msg,\n callback: this.callback,\n xdr: this.xdr,\n uri: this.uri,\n qr: this.qr,\n txHash: this.txHash,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { PaymentIntent } from '@/structures/PaymentIntent';\nimport type {\n CreatePayPaymentIntentOptions,\n CreateTxPaymentIntentOptions,\n DeletedData,\n ListPaymentIntentsOptions,\n PaymentIntentData,\n PaymentIntentListData,\n PaymentIntentTransitionData,\n UpdatePaymentIntentOptions,\n ValidatePaymentIntentOptions,\n ValidationOutcomeData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\nimport { resolveIntentBody } from '@/common/intent-input';\n\n/** A page of payment intents plus its pagination metadata. */\nexport interface PaymentIntentPage {\n items: PaymentIntent[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Validation outcome with the (optional) refreshed intent materialized. */\nexport interface ValidationOutcome {\n valid: boolean;\n status: ValidationOutcomeData['status'];\n reason: string | null;\n paymentIntent: PaymentIntent | null;\n}\n\n/**\n * Manages Stellar payment intents — `client.paymentIntents`.\n *\n * @example\n * const intent = await client.paymentIntents.createTx({\n * source: 'G...', destination: 'G...', amount: '25.5',\n * });\n * console.log(intent.uri, intent.qr);\n */\nexport class PaymentIntentManager extends BaseManager<PaymentIntent> {\n private readonly route = '/payment-intents';\n\n /** Create a SEP-7 `tx` intent (source known → unsigned XDR + tx URI + QR). */\n public async createTx(\n options: CreateTxPaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.post<PaymentIntentData>(`${this.route}/tx`, {\n body: resolveIntentBody(options),\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /**\n * Create a `pay` intent (no source → a payment link + QR, no XDR): SEP-7 on Stellar (the\n * default), Solana Pay with `chain: 'solana'`, EIP-681 with `chain: 'monad'`.\n */\n public async createPay(\n options: CreatePayPaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.post<PaymentIntentData>(`${this.route}/pay`, {\n body: resolveIntentBody(options),\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /** Get a single payment intent by id. */\n public async fetch(id: string): Promise<PaymentIntent> {\n const data = await this.rest.get<PaymentIntentData>(`${this.route}/${id}`);\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /**\n * Every status change an intent went through, oldest first — who moved it\n * (`api`, `validate`, `observer`, `system`), when, and with which transaction.\n */\n public transitions(id: string): Promise<PaymentIntentTransitionData[]> {\n return this.rest.get<PaymentIntentTransitionData[]>(`${this.route}/${id}/transitions`);\n }\n\n /** List the consumer's payment intents (paginated). */\n public async list(\n options: ListPaymentIntentsOptions = {},\n ): Promise<PaymentIntentPage> {\n const data = await this.rest.get<PaymentIntentListData>(this.route, {\n query: {\n status: options.status,\n chain: options.chain,\n createdFrom: options.createdFrom instanceof Date ? options.createdFrom.toISOString() : options.createdFrom,\n take: options.take,\n skip: options.skip,\n },\n });\n return {\n items: data.data.map((d) => this._add(new PaymentIntent(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Update a payment intent (status / txHash / reference). */\n public async update(\n id: string,\n options: UpdatePaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.patch<PaymentIntentData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /** Delete a payment intent. */\n public async delete(id: string): Promise<DeletedData> {\n const result = await this.rest.delete<DeletedData>(`${this.route}/${id}`);\n this.cache.delete(id);\n return result;\n }\n\n /**\n * Validate a submitted transaction against the intent (tx success +\n * destination + amount + memo). Finalizes status server-side and fires events.\n */\n public async validate(\n id: string,\n options: ValidatePaymentIntentOptions,\n ): Promise<ValidationOutcome> {\n const data = await this.rest.post<ValidationOutcomeData>(\n `${this.route}/${id}/validate`,\n { body: options },\n );\n const paymentIntent = data.paymentIntent\n ? this._add(new PaymentIntent(this.client, data.paymentIntent))\n : null;\n return {\n valid: data.valid,\n status: data.status,\n reason: data.reason ?? null,\n paymentIntent,\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n ProductKind,\n type ProductData,\n type UpdateProductOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A product / price the consumer can charge for. */\nexport class Product extends Base<ProductData> {\n public name!: string;\n public description!: string | null;\n public amount!: string | null;\n /** Asset code, or `native` for XLM. */\n public asset!: string;\n public kind!: ProductKind;\n public active!: boolean;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ProductData) {\n super(client, data);\n }\n\n protected override _patch(data: ProductData): this {\n super._patch(data);\n this.name = data.name;\n this.description = data.description;\n this.amount = data.amount;\n this.asset = data.asset;\n this.kind = data.kind;\n this.active = data.active;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Human-readable asset label (`XLM` for native). */\n public get assetLabel(): string {\n return !this.asset || this.asset === 'native' ? 'XLM' : this.asset;\n }\n\n /** Re-fetch this product. */\n public fetch(): Promise<Product> {\n return this.client.products.fetch(this.id);\n }\n\n /** Update this product. Mutates and returns this. */\n public async edit(options: UpdateProductOptions): Promise<this> {\n const updated = await this.client.products.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Mark the product active. */\n public activate(): Promise<this> {\n return this.edit({ active: true });\n }\n\n /** Mark the product inactive. */\n public deactivate(): Promise<this> {\n return this.edit({ active: false });\n }\n\n /** Delete this product. */\n public delete() {\n return this.client.products.delete(this.id);\n }\n\n public toJSON(): ProductData {\n return {\n id: this.id,\n name: this.name,\n description: this.description,\n amount: this.amount,\n asset: this.asset,\n kind: this.kind,\n active: this.active,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { Product } from '@/structures/Product';\nimport type {\n CreateProductOptions,\n ProductData,\n UpdateProductOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\ntype ProductDeletedData = { id: string; deleted: boolean };\n\n/**\n * Manages products / prices — `client.products`.\n *\n * @example\n * const product = await client.products.create({\n * name: 'Pro plan — monthly', amount: '49.00', assetCode: 'USDC',\n * });\n */\nexport class ProductManager extends BaseManager<Product> {\n private readonly route = '/products';\n\n /** Create a product. */\n public async create(options: CreateProductOptions): Promise<Product> {\n const data = await this.rest.post<ProductData>(this.route, { body: options });\n return this._add(new Product(this.client, data));\n }\n\n /** List the consumer's products. */\n public async list(): Promise<Product[]> {\n const data = await this.rest.get<ProductData[]>(this.route);\n return data.map((d) => this._add(new Product(this.client, d)));\n }\n\n /** Get a product by id. */\n public async fetch(id: string): Promise<Product> {\n const data = await this.rest.get<ProductData>(`${this.route}/${id}`);\n return this._add(new Product(this.client, data));\n }\n\n /** Update a product. */\n public async update(\n id: string,\n options: UpdateProductOptions,\n ): Promise<Product> {\n const data = await this.rest.patch<ProductData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new Product(this.client, data));\n }\n\n /** Delete a product. */\n public async delete(id: string): Promise<ProductDeletedData> {\n const result = await this.rest.delete<ProductDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n SwapStatus,\n type ChainSwapData,\n type ChainSwapTransaction,\n type EvmCallData,\n type OtherSwapChain,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { ChainSwapSubmitOutcome } from '@/managers/SwapManager';\n\n/**\n * A same-chain swap on Solana (built by Jupiter) or Monad (built by Kuru Flow),\n * from `client.swaps` with `chain: 'solana' | 'monad'`.\n *\n * Non-custodial like a Stellar {@link Swap}: sign {@link transaction} in the\n * wallet that owns {@link source}, then `await swap.submit({ signedTransaction })`.\n * The server checks it is the transaction it built before broadcasting it. On\n * Monad, when {@link approval} is set, send and confirm that `approve` call first.\n */\nexport class ChainSwap extends Base<ChainSwapData> {\n public chain!: OtherSwapChain;\n public network!: string;\n /** The aggregator that built it. */\n public provider!: 'jupiter' | 'kuru';\n public status!: SwapStatus;\n /** The wallet that signs, pays and receives. */\n public source!: string;\n /** `native`, or the SPL mint / ERC-20 address. */\n public sendAsset!: string;\n public sendAmount!: string;\n public destAsset!: string;\n public destEstimated!: string;\n public destMin!: string;\n public feeBps!: number;\n /** The commission, in the destination asset. */\n public feeAmount!: string;\n public slippageBps!: number;\n public path!: { code: string; issuer: string | null }[];\n /** What the wallet signs. */\n public transaction!: ChainSwapTransaction;\n /** Monad ERC-20 sales with a short allowance: the `approve` call to send first. */\n public approval!: EvmCallData | null;\n public txHash!: string | null;\n public idempotencyKey!: string | null;\n /** Submit refuses the transaction after this. */\n public expiresAt!: Date;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ChainSwapData) {\n super(client, data);\n }\n\n protected override _patch(data: ChainSwapData): this {\n super._patch(data);\n this.chain = data.chain;\n this.network = data.network;\n this.provider = data.provider;\n this.status = data.status;\n this.source = data.source;\n this.sendAsset = data.sendAsset;\n this.sendAmount = data.sendAmount;\n this.destAsset = data.destAsset;\n this.destEstimated = data.destEstimated;\n this.destMin = data.destMin;\n this.feeBps = data.feeBps;\n this.feeAmount = data.feeAmount;\n this.slippageBps = data.slippageBps;\n this.path = data.path;\n this.transaction = data.transaction;\n this.approval = data.approval;\n this.txHash = data.txHash;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === SwapStatus.Succeeded;\n }\n\n /** Whether the swap is still awaiting submission. */\n public get isPending(): boolean {\n return this.status === SwapStatus.Pending;\n }\n\n /** Whether the built transaction can no longer be submitted. */\n public get isStale(): boolean {\n return this.isPending && this.expiresAt.getTime() <= Date.now();\n }\n\n /** Re-fetch this swap from the API. */\n public async fetch(): Promise<ChainSwap> {\n return (await this.client.swaps.fetch(this.id)) as ChainSwap;\n }\n\n /**\n * Relay the signed transaction. Mutates this instance from the refreshed\n * swap in the outcome and returns the outcome.\n */\n public async submit(options: {\n signedTransaction: string;\n }): Promise<ChainSwapSubmitOutcome> {\n const outcome = (await this.client.swaps.submit(\n this.id,\n options,\n )) as ChainSwapSubmitOutcome;\n this._patch(outcome.swap.toJSON());\n return outcome;\n }\n\n public toJSON(): ChainSwapData {\n return {\n id: this.id,\n chain: this.chain,\n network: this.network,\n provider: this.provider,\n status: this.status,\n source: this.source,\n sendAsset: this.sendAsset,\n sendAmount: this.sendAmount,\n destAsset: this.destAsset,\n destEstimated: this.destEstimated,\n destMin: this.destMin,\n feeBps: this.feeBps,\n feeAmount: this.feeAmount,\n slippageBps: this.slippageBps,\n path: this.path,\n transaction: this.transaction,\n approval: this.approval,\n txHash: this.txHash,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport { SwapStatus, type SwapData } from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { SwapSubmitOutcome } from '@/managers/SwapManager';\n\n/**\n * A Stellar path-payment swap. Solana and Monad swaps are {@link ChainSwap}.\n *\n * Wraps the raw API payload with typed accessors and atomic action methods so\n * you can operate on it directly: `await swap.fetch()`,\n * `await swap.submit({ signedXdr })`.\n */\nexport class Swap extends Base<SwapData> {\n public status!: SwapStatus;\n public network!: string;\n /** Account performing the swap. */\n public source!: string;\n /** Account that receives the swapped asset. */\n public destination!: string;\n /** Asset code being sent, or `native` for XLM. */\n public sendAsset!: string;\n public sendAssetIssuer!: string | null;\n public sendAmount!: string;\n public feeAmount!: string;\n public feeBps!: number;\n /** Amount swapped after the fee is deducted. */\n public swapAmount!: string;\n /** Asset code being received, or `native` for XLM. */\n public destAsset!: string;\n public destAssetIssuer!: string | null;\n public destEstimated!: string;\n public destMin!: string;\n public slippageBps!: number;\n public path!: { code: string; issuer: string | null }[];\n public memo!: string | null;\n /** Unsigned transaction envelope (base64 XDR). */\n public xdr!: string;\n /** SEP-7 deep link. */\n public uri!: string;\n public txHash!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: SwapData) {\n super(client, data);\n }\n\n protected override _patch(data: SwapData): this {\n super._patch(data);\n this.status = data.status;\n this.network = data.network;\n this.source = data.source;\n this.destination = data.destination;\n this.sendAsset = data.sendAsset;\n this.sendAssetIssuer = data.sendAssetIssuer;\n this.sendAmount = data.sendAmount;\n this.feeAmount = data.feeAmount;\n this.feeBps = data.feeBps;\n this.swapAmount = data.swapAmount;\n this.destAsset = data.destAsset;\n this.destAssetIssuer = data.destAssetIssuer;\n this.destEstimated = data.destEstimated;\n this.destMin = data.destMin;\n this.slippageBps = data.slippageBps;\n this.path = data.path;\n this.memo = data.memo;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.txHash = data.txHash;\n this.qr = data.qr;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === SwapStatus.Succeeded;\n }\n\n /** Whether the swap is still awaiting submission. */\n public get isPending(): boolean {\n return this.status === SwapStatus.Pending;\n }\n\n /** Human-readable send asset label (`XLM` for native). */\n public get sendAssetLabel(): string {\n return !this.sendAsset || this.sendAsset === 'native' ? 'XLM' : this.sendAsset;\n }\n\n /** Human-readable destination asset label (`XLM` for native). */\n public get destAssetLabel(): string {\n return !this.destAsset || this.destAsset === 'native' ? 'XLM' : this.destAsset;\n }\n\n /** Re-fetch this swap from the API, returning a fresh instance. */\n public async fetch(): Promise<Swap> {\n return (await this.client.swaps.fetch(this.id)) as Swap;\n }\n\n /**\n * Relay the signed transaction for this swap. Mutates this instance from the\n * refreshed swap in the outcome and returns the outcome.\n */\n public async submit(options: { signedXdr: string }): Promise<SwapSubmitOutcome> {\n const outcome = (await this.client.swaps.submit(\n this.id,\n options,\n )) as SwapSubmitOutcome;\n this._patch(outcome.swap.toJSON());\n return outcome;\n }\n\n public toJSON(): SwapData {\n return {\n id: this.id,\n status: this.status,\n network: this.network,\n source: this.source,\n destination: this.destination,\n sendAsset: this.sendAsset,\n sendAssetIssuer: this.sendAssetIssuer,\n sendAmount: this.sendAmount,\n feeAmount: this.feeAmount,\n feeBps: this.feeBps,\n swapAmount: this.swapAmount,\n destAsset: this.destAsset,\n destAssetIssuer: this.destAssetIssuer,\n destEstimated: this.destEstimated,\n destMin: this.destMin,\n slippageBps: this.slippageBps,\n path: this.path,\n memo: this.memo,\n xdr: this.xdr,\n uri: this.uri,\n txHash: this.txHash,\n qr: this.qr,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { ChainSwap } from '@/structures/ChainSwap';\nimport { Swap } from '@/structures/Swap';\nimport type {\n ChainSwapData,\n ChainSwapListData,\n ChainSwapSubmitOutcomeData,\n CreateSwapOptions,\n ListSwapsOptions,\n OtherSwapChain,\n QuoteSwapOptions,\n SubmitSwapOptions,\n SwapData,\n SwapListData,\n SwapQuoteData,\n SwapStatus,\n SwapSubmitOutcomeData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of swaps plus its pagination metadata. */\nexport interface SwapPage<T extends Swap | ChainSwap = Swap> {\n items: T[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Submission outcome of a Stellar swap, with the refreshed swap materialized. */\nexport interface SwapSubmitOutcome {\n submitted: boolean;\n status: SwapStatus;\n txHash: string | null;\n reason: string | null;\n resultCodes: string[] | null;\n swap: Swap;\n}\n\n/** Submission outcome of a Solana or Monad swap. */\nexport interface ChainSwapSubmitOutcome {\n submitted: boolean;\n status: SwapStatus;\n txHash: string;\n swap: ChainSwap;\n}\n\n/** A request that names a chain off Stellar. */\ntype OnOtherChain = { chain: OtherSwapChain };\n\n/** A Solana or Monad payload carries its `chain`; a Stellar one never does. */\nfunction isChainSwapData(data: SwapData | ChainSwapData): data is ChainSwapData {\n return 'chain' in data && typeof data.chain === 'string';\n}\n\n/**\n * Same-chain swaps — `client.swaps`. No `chain` (or `'stellar'`) is a Stellar\n * path payment and yields a {@link Swap}, exactly as before; `'solana'` goes\n * through Jupiter and `'monad'` through Kuru Flow and yields a {@link ChainSwap}.\n * Swaps between chains are `client.crossChainSwaps`.\n *\n * @example\n * const swap = await client.swaps.create({\n * amount: '100', destAssetCode: 'USDC', destAssetIssuer: 'GA5Z…', source: 'G...',\n * });\n * console.log(swap.uri, swap.qr);\n *\n * const sol = await client.swaps.create({\n * chain: 'solana', amount: '0.1', sourceAssetCode: 'SOL',\n * destAssetCode: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', source: wallet,\n * });\n * await sol.submit({ signedTransaction: signInWallet(sol.transaction) });\n */\nexport class SwapManager extends BaseManager<Swap | ChainSwap> {\n private readonly route = '/swaps';\n\n /** Price a swap without creating it. Returns a plain quote (not a {@link Swap}). */\n public async quote(options: QuoteSwapOptions): Promise<SwapQuoteData> {\n return this.rest.post<SwapQuoteData>(`${this.route}/quote`, {\n body: options,\n });\n }\n\n /** Create a swap: an unsigned transaction for the source wallet to sign. */\n public async create(options: CreateSwapOptions & OnOtherChain): Promise<ChainSwap>;\n public async create(options: CreateSwapOptions): Promise<Swap>;\n public async create(options: CreateSwapOptions): Promise<Swap | ChainSwap> {\n const data = await this.rest.post<SwapData | ChainSwapData>(this.route, {\n body: options,\n });\n return this.materialize(data);\n }\n\n /** Get a single swap by id, on any chain. */\n public async fetch(id: string): Promise<Swap | ChainSwap> {\n const data = await this.rest.get<SwapData | ChainSwapData>(\n `${this.route}/${id}`,\n );\n return this.materialize(data);\n }\n\n /** List the consumer's swaps on one chain (Stellar when `chain` is omitted). */\n public async list(options: ListSwapsOptions & OnOtherChain): Promise<SwapPage<ChainSwap>>;\n public async list(options?: ListSwapsOptions): Promise<SwapPage<Swap>>;\n public async list(\n options: ListSwapsOptions = {},\n ): Promise<SwapPage<Swap> | SwapPage<ChainSwap>> {\n const data = await this.rest.get<SwapListData | ChainSwapListData>(\n this.route,\n {\n query: {\n chain: options.chain,\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n },\n );\n return {\n items: data.data.map((d) => this.materialize(d)),\n total: data.total,\n take: data.take,\n skip: data.skip,\n } as SwapPage<Swap> | SwapPage<ChainSwap>;\n }\n\n /**\n * Relay a signed swap transaction to its network: `{ signedXdr }` for a\n * Stellar swap, `{ signedTransaction }` for a Solana or Monad one.\n */\n public async submit(\n id: string,\n options: SubmitSwapOptions,\n ): Promise<SwapSubmitOutcome | ChainSwapSubmitOutcome> {\n const data = await this.rest.post<\n SwapSubmitOutcomeData | ChainSwapSubmitOutcomeData\n >(`${this.route}/${id}/submit`, { body: options });\n if (isChainSwapData(data.swap)) {\n return {\n submitted: data.submitted,\n status: data.status,\n txHash: (data as ChainSwapSubmitOutcomeData).txHash,\n swap: this._add(new ChainSwap(this.client, data.swap)) as ChainSwap,\n };\n }\n const stellar = data as SwapSubmitOutcomeData;\n return {\n submitted: stellar.submitted,\n status: stellar.status,\n txHash: stellar.txHash ?? null,\n reason: stellar.reason ?? null,\n resultCodes: stellar.resultCodes ?? null,\n swap: this._add(new Swap(this.client, stellar.swap)) as Swap,\n };\n }\n\n private materialize(data: SwapData): Swap;\n private materialize(data: ChainSwapData): ChainSwap;\n private materialize(data: SwapData | ChainSwapData): Swap | ChainSwap;\n private materialize(data: SwapData | ChainSwapData): Swap | ChainSwap {\n return this._add(\n isChainSwapData(data)\n ? new ChainSwap(this.client, data)\n : new Swap(this.client, data),\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n WebhookDeliveryStatus,\n WebhookEventType,\n type WebhookDeliveryData,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A single attempt to deliver an event to a webhook endpoint (audit record). */\nexport class WebhookDelivery extends Base<WebhookDeliveryData> {\n public endpointId!: string;\n public eventType!: WebhookEventType;\n public eventId!: string;\n public payload!: Record<string, unknown>;\n public status!: WebhookDeliveryStatus;\n public attempts!: number;\n public responseStatus!: number | null;\n public error!: string | null;\n public lastAttemptAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: WebhookDeliveryData) {\n super(client, data);\n }\n\n protected override _patch(data: WebhookDeliveryData): this {\n super._patch(data);\n this.endpointId = data.endpointId;\n this.eventType = data.eventType;\n this.eventId = data.eventId;\n this.payload = data.payload;\n this.status = data.status;\n this.attempts = data.attempts;\n this.responseStatus = data.responseStatus;\n this.error = data.error;\n this.lastAttemptAt = data.lastAttemptAt ? new Date(data.lastAttemptAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n public get isSucceeded(): boolean {\n return this.status === WebhookDeliveryStatus.Succeeded;\n }\n\n /** Manually re-send this delivery. */\n public redeliver(): Promise<WebhookDelivery> {\n return this.client.webhooks.redeliver(this.endpointId, this.id);\n }\n\n public toJSON(): WebhookDeliveryData {\n return {\n id: this.id,\n endpointId: this.endpointId,\n eventType: this.eventType,\n eventId: this.eventId,\n payload: this.payload,\n status: this.status,\n attempts: this.attempts,\n responseStatus: this.responseStatus,\n error: this.error,\n lastAttemptAt: this.lastAttemptAt ? this.lastAttemptAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type {\n ListWebhookDeliveriesOptions,\n UpdateWebhookEndpointOptions,\n WebhookEndpointData,\n WebhookEndpointWithSecretData,\n WebhookEventType,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/**\n * A registered webhook endpoint.\n *\n * Note: the signing `secret` is only ever present on the instance returned by\n * `create()` / `rotateSecret()` — list/get responses never include it.\n */\nexport class WebhookEndpoint extends Base<WebhookEndpointData> {\n public url!: string;\n public description!: string | null;\n public enabled!: boolean;\n public eventTypes!: WebhookEventType[];\n public createdAt!: Date;\n public updatedAt!: Date;\n /** HMAC signing secret — only set on create/rotate responses. */\n public readonly secret: string | null;\n\n constructor(\n client: Client,\n data: WebhookEndpointData | WebhookEndpointWithSecretData,\n ) {\n super(client, data);\n this.secret = 'secret' in data ? data.secret : null;\n }\n\n protected override _patch(\n data: WebhookEndpointData | WebhookEndpointWithSecretData,\n ): this {\n super._patch(data);\n this.url = data.url;\n this.description = data.description;\n this.enabled = data.enabled;\n this.eventTypes = data.eventTypes;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the endpoint receives all events (empty subscription). */\n public get receivesAllEvents(): boolean {\n return this.eventTypes.length === 0;\n }\n\n /** Re-fetch this endpoint. */\n public fetch(): Promise<WebhookEndpoint> {\n return this.client.webhooks.fetch(this.id);\n }\n\n /** Update url/description/enabled/eventTypes. Mutates and returns this. */\n public async edit(options: UpdateWebhookEndpointOptions): Promise<this> {\n const updated = await this.client.webhooks.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Pause deliveries to this endpoint. */\n public disable(): Promise<this> {\n return this.edit({ enabled: false });\n }\n\n /** Resume deliveries to this endpoint. */\n public enable(): Promise<this> {\n return this.edit({ enabled: true });\n }\n\n /** Rotate the signing secret (returns a new instance carrying the secret). */\n public rotateSecret(): Promise<WebhookEndpoint> {\n return this.client.webhooks.rotateSecret(this.id);\n }\n\n /** Send a test event to verify the endpoint. */\n public ping() {\n return this.client.webhooks.ping(this.id);\n }\n\n /** List delivery attempts for this endpoint. */\n public fetchDeliveries(options?: ListWebhookDeliveriesOptions) {\n return this.client.webhooks.fetchDeliveries(this.id, options);\n }\n\n /** Delete this endpoint. */\n public delete() {\n return this.client.webhooks.delete(this.id);\n }\n\n public toJSON(): WebhookEndpointData {\n return {\n id: this.id,\n url: this.url,\n description: this.description,\n enabled: this.enabled,\n eventTypes: this.eventTypes,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto';\nimport { SIGNATURE_HEADER } from '@/util/Constants';\nimport type { WebhookEvent } from '@/types/index';\n\n/** Options for {@link Webhooks.verify} / {@link Webhooks.constructEvent}. */\nexport interface VerifyWebhookOptions {\n /**\n * Tolerance in seconds between the signed timestamp and now. Protects against\n * replay attacks. Defaults to 300 (5 minutes). Pass 0 to disable the check.\n */\n toleranceSeconds?: number;\n /** Override \"now\" (unix seconds) — useful for testing. */\n now?: number;\n}\n\n/** Thrown when a webhook signature fails verification. */\nexport class WebhookSignatureError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'WebhookSignatureError';\n }\n}\n\n/**\n * Stateless helpers to verify the HMAC signatures the Cosmos Pay dispatcher\n * sends with each webhook delivery, and to safely parse the event body.\n *\n * The dispatcher signs each POST with:\n * `X-Cosmos-Signature: t=<unixSeconds>,v1=<hexHmacSha256>`\n * where the HMAC-SHA256 is computed over `${t}.${rawBody}` using the endpoint's\n * `whsec_...` secret.\n *\n * @example\n * // Express raw-body handler\n * app.post('/hooks', express.raw({ type: '*/*' }), (req, res) => {\n * try {\n * const event = Webhooks.constructEvent(\n * req.body, // the RAW body (Buffer/string)\n * req.header('X-Cosmos-Signature'),\n * process.env.WEBHOOK_SECRET,\n * );\n * // event.type, event.data ...\n * res.sendStatus(200);\n * } catch {\n * res.sendStatus(400);\n * }\n * });\n */\nexport const Webhooks = {\n /** Header name the dispatcher uses for the signature. */\n SIGNATURE_HEADER,\n\n /**\n * Verify a webhook signature. Returns `true` on success, throws\n * {@link WebhookSignatureError} on any failure (so it never silently passes).\n */\n verify(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n secret: string,\n options: VerifyWebhookOptions = {},\n ): boolean {\n if (!signatureHeader) {\n throw new WebhookSignatureError('Missing signature header.');\n }\n if (!secret) {\n throw new WebhookSignatureError('Missing signing secret.');\n }\n\n const { timestamp, signature } = parseSignatureHeader(signatureHeader);\n const payload = typeof rawBody === 'string' ? rawBody : decode(rawBody);\n\n const expected = createHmac('sha256', secret)\n .update(`${timestamp}.${payload}`)\n .digest('hex');\n\n if (!safeEqualHex(expected, signature)) {\n throw new WebhookSignatureError('Signature mismatch.');\n }\n\n const tolerance = options.toleranceSeconds ?? 300;\n if (tolerance > 0) {\n const now = options.now ?? Math.floor(Date.now() / 1000);\n if (Math.abs(now - timestamp) > tolerance) {\n throw new WebhookSignatureError(\n `Timestamp outside tolerance (${tolerance}s).`,\n );\n }\n }\n\n return true;\n },\n\n /**\n * Verify the signature and return the parsed {@link WebhookEvent}. Throws\n * {@link WebhookSignatureError} if verification fails.\n */\n constructEvent<T = unknown>(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n secret: string,\n options: VerifyWebhookOptions = {},\n ): WebhookEvent<T> {\n this.verify(rawBody, signatureHeader, secret, options);\n const payload = typeof rawBody === 'string' ? rawBody : decode(rawBody);\n try {\n return JSON.parse(payload) as WebhookEvent<T>;\n } catch {\n throw new WebhookSignatureError('Body is not valid JSON.');\n }\n },\n};\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\nfunction parseSignatureHeader(header: string): {\n timestamp: number;\n signature: string;\n} {\n let timestamp: number | undefined;\n let signature: string | undefined;\n for (const part of header.split(',')) {\n const [key, value] = part.split('=');\n if (!key || value === undefined) continue;\n const k = key.trim();\n if (k === 't') timestamp = Number(value.trim());\n else if (k === 'v1') signature = value.trim();\n }\n if (timestamp === undefined || Number.isNaN(timestamp) || !signature) {\n throw new WebhookSignatureError('Malformed signature header.');\n }\n return { timestamp, signature };\n}\n\nfunction safeEqualHex(a: string, b: string): boolean {\n if (a.length !== b.length) return false;\n try {\n return timingSafeEqual(Buffer.from(a, 'hex'), Buffer.from(b, 'hex'));\n } catch {\n return false;\n }\n}\n\nfunction decode(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('utf8');\n}\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport { WebhookDelivery } from '@/structures/WebhookDelivery';\nimport { WebhookEndpoint } from '@/structures/WebhookEndpoint';\nimport type {\n CreateWebhookEndpointOptions,\n ListWebhookDeliveriesOptions,\n PaymentIntentData,\n UpdateWebhookEndpointOptions,\n WebhookDeliveryData,\n WebhookDeliveryListData,\n WebhookEndpointData,\n WebhookEndpointWithSecretData,\n AnyWebhookEvent,\n TypedWebhookEvent,\n WebhookEventDataMap,\n WebhookPingData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\nimport { Webhooks, WebhookSignatureError } from '@/util/Webhooks';\nimport { SIGNATURE_HEADER } from '@/util/Constants';\n\n// Local alias — the deleted shape mirrors DeletedData.\ntype WebhookDeletedData = { id: string; deleted: boolean };\n\n/** A page of webhook deliveries plus its pagination metadata. */\nexport interface WebhookDeliveryPage {\n items: WebhookDelivery[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Options for verifying + dispatching an incoming webhook. */\nexport interface WebhookProcessOptions {\n /** Signing secret. Falls back to the client's `webhookSecret` when omitted. */\n secret?: string;\n /** Replay tolerance in seconds (default 300; 0 disables). */\n toleranceSeconds?: number;\n}\n\n/** Options for the built-in HTTP webhook handlers. */\nexport type WebhookHandlerOptions = WebhookProcessOptions;\n\n/**\n * Listener signatures for {@link WebhookManager}. You can subscribe with the raw\n * event type (`PAYMENT_INTENT_SUCCEEDED`), its camelCase alias\n * (`paymentIntentSucceeded`), or `event` to catch them all.\n */\nexport type WebhookListenerEvents = { event: [AnyWebhookEvent] } & {\n [K in keyof WebhookEventDataMap]: [TypedWebhookEvent<K>];\n} & {\n [K in keyof WebhookEventDataMap as CamelEvent<K>]: [TypedWebhookEvent<K>];\n};\n\n/** `SWAP_SUCCEEDED` → `SwapSucceeded`. */\ntype PascalEvent<S extends string> = S extends `${infer H}_${infer T}`\n ? `${Capitalize<Lowercase<H>>}${PascalEvent<T>}`\n : Capitalize<Lowercase<S>>;\n\n/** `SWAP_SUCCEEDED` → `swapSucceeded`, the alias each event is also emitted as. */\ntype CamelEvent<S extends string> = Uncapitalize<PascalEvent<S>>;\n\n/** Minimal Express-like request (so we don't depend on `@types/express`). */\ninterface RequestLike {\n headers: Record<string, string | string[] | undefined>;\n body?: unknown;\n rawBody?: unknown;\n [key: string]: unknown;\n}\n\n/** Minimal Express-like response. */\ninterface ResponseLike {\n status(code: number): ResponseLike;\n send(body?: unknown): unknown;\n end(body?: unknown): unknown;\n}\n\n// Typed event overloads (declaration merging onto the class).\nexport interface WebhookManager {\n on<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n once<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n off<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n emit<E extends keyof WebhookListenerEvents>(\n event: E,\n ...args: WebhookListenerEvents[E]\n ): boolean;\n}\n\n/**\n * Manages webhook endpoints, their delivery audit trail, **and** the incoming\n * event listener — `client.webhooks`.\n *\n * Registering endpoints (server-side CRUD):\n * @example\n * const endpoint = await client.webhooks.create({\n * url: 'https://me.example.com/hooks',\n * eventTypes: ['PAYMENT_INTENT_SUCCEEDED'],\n * });\n * console.log(endpoint.secret); // shown once — store it!\n *\n * Receiving events (listener):\n * @example\n * client.webhooks.on('paymentIntentSucceeded', (event) => {\n * console.log('Paid!', event.data.id);\n * });\n *\n * import { createServer } from 'node:http';\n * createServer(client.webhooks.createHandler()).listen(4242);\n */\nexport class WebhookManager extends BaseManager<WebhookEndpoint> {\n private readonly route = '/webhooks';\n\n // ── Endpoint CRUD ───────────────────────────────────────────────────────────\n\n /** Register a webhook endpoint (the returned instance carries the secret once). */\n public async create(\n options: CreateWebhookEndpointOptions,\n ): Promise<WebhookEndpoint> {\n const data = await this.rest.post<WebhookEndpointWithSecretData>(this.route, {\n body: options,\n });\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** List the consumer's webhook endpoints. */\n public async list(): Promise<WebhookEndpoint[]> {\n const data = await this.rest.get<WebhookEndpointData[]>(this.route);\n return data.map((d) => this._add(new WebhookEndpoint(this.client, d)));\n }\n\n /** Get a webhook endpoint by id. */\n public async fetch(id: string): Promise<WebhookEndpoint> {\n const data = await this.rest.get<WebhookEndpointData>(`${this.route}/${id}`);\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Update a webhook endpoint (url/description/enabled/eventTypes). */\n public async update(\n id: string,\n options: UpdateWebhookEndpointOptions,\n ): Promise<WebhookEndpoint> {\n const data = await this.rest.patch<WebhookEndpointData>(\n `${this.route}/${id}`,\n { body: options },\n );\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Delete a webhook endpoint. */\n public async delete(id: string): Promise<WebhookDeletedData> {\n const result = await this.rest.delete<WebhookDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n\n /** Rotate the signing secret (returns a new instance carrying the secret). */\n public async rotateSecret(id: string): Promise<WebhookEndpoint> {\n const data = await this.rest.post<WebhookEndpointWithSecretData>(\n `${this.route}/${id}/rotate-secret`,\n );\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Send a test event to verify the endpoint. */\n public ping(id: string): Promise<WebhookPingData> {\n return this.rest.post<WebhookPingData>(`${this.route}/${id}/ping`);\n }\n\n /** List delivery attempts for an endpoint (audit trail). */\n public async fetchDeliveries(\n id: string,\n options: ListWebhookDeliveriesOptions = {},\n ): Promise<WebhookDeliveryPage> {\n const data = await this.rest.get<WebhookDeliveryListData>(\n `${this.route}/${id}/deliveries`,\n {\n query: {\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n },\n );\n return {\n items: data.data.map((d) => new WebhookDelivery(this.client, d)),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Manually re-send a past delivery. */\n public async redeliver(\n id: string,\n deliveryId: string,\n ): Promise<WebhookDelivery> {\n const data = await this.rest.post<WebhookDeliveryData>(\n `${this.route}/${id}/deliveries/${deliveryId}/redeliver`,\n );\n return new WebhookDelivery(this.client, data);\n }\n\n // ── Incoming event listener ──────────────────────────────────────────────────\n\n /**\n * Verify a raw incoming webhook request and dispatch it to the listeners\n * registered via {@link WebhookManager.on}. Returns the parsed event.\n *\n * Emits, in order: the raw type (`PAYMENT_INTENT_SUCCEEDED`), the camelCase\n * alias (`paymentIntentSucceeded`) and the catch-all `event`.\n *\n * @throws {WebhookSignatureError} when the signature is missing/invalid.\n */\n public process(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n options: WebhookProcessOptions = {},\n ): AnyWebhookEvent {\n const secret = options.secret ?? this.client.webhookSecret;\n if (!secret) {\n throw new WebhookSignatureError(\n 'No webhook secret configured. Pass `{ secret }` or set `webhookSecret` on the client.',\n );\n }\n\n // The signature proves the body is the server's; its `type` says which\n // shape `data` has, which is what AnyWebhookEvent encodes.\n const event = Webhooks.constructEvent(rawBody, signatureHeader, secret, {\n toleranceSeconds: options.toleranceSeconds,\n }) as unknown as AnyWebhookEvent;\n\n this.emit(event.type, event as never);\n this.emit(toCamelEvent(event.type), event as never);\n this.emit('event', event);\n return event;\n }\n\n /**\n * Build a Node.js `http`/`https` request handler that verifies the signature,\n * dispatches the event to your listeners, and replies `200`/`400`.\n *\n * @example\n * import { createServer } from 'node:http';\n * createServer(client.webhooks.createHandler({ secret })).listen(4242);\n */\n public createHandler(\n options: WebhookHandlerOptions = {},\n ): (req: IncomingMessage, res: ServerResponse) => void {\n return (req, res) => {\n void this.collectBody(req)\n .then((raw) => {\n const sig = headerValue(req.headers[SIGNATURE_HEADER]);\n this.process(raw, sig, options);\n res.statusCode = 200;\n res.end('ok');\n })\n .catch((err: unknown) => {\n res.statusCode = err instanceof WebhookSignatureError ? 400 : 500;\n res.end(\n err instanceof WebhookSignatureError ? 'invalid signature' : 'error',\n );\n });\n };\n }\n\n /**\n * Express-style middleware. Expects the **raw** body (e.g. mounted with\n * `express.raw({ type: '*/*' })`). On success it attaches the parsed event to\n * `req.cosmosEvent` and calls `next()`; on a bad signature it replies `400`.\n *\n * @example\n * app.post('/hooks', express.raw({ type: '*/*' }), client.webhooks.middleware({ secret }));\n */\n public middleware(\n options: WebhookHandlerOptions = {},\n ): (req: RequestLike, res: ResponseLike, next: (err?: unknown) => void) => void {\n return (req, res, next) => {\n try {\n const raw = extractRawBody(req);\n const sig = headerValue(req.headers[SIGNATURE_HEADER]);\n const event = this.process(raw, sig, options);\n req.cosmosEvent = event;\n next();\n } catch (err) {\n if (err instanceof WebhookSignatureError) {\n res.status(400).send('invalid signature');\n return;\n }\n next(err);\n }\n };\n }\n\n /** Read a Node.js request stream into a single Buffer. */\n private collectBody(req: IncomingMessage): Promise<Buffer> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n req.on('data', (chunk: Buffer) => chunks.push(chunk));\n req.on('end', () => resolve(Buffer.concat(chunks)));\n req.on('error', reject);\n });\n }\n}\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\n/** `PAYMENT_INTENT_SUCCEEDED` → `paymentIntentSucceeded`. */\nfunction toCamelEvent(type: string): keyof WebhookListenerEvents {\n return type\n .toLowerCase()\n .replace(/_([a-z])/g, (_, c: string) =>\n c.toUpperCase(),\n ) as keyof WebhookListenerEvents;\n}\n\nfunction headerValue(value: string | string[] | undefined): string | undefined {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction extractRawBody(req: RequestLike): string | Uint8Array {\n const candidate = req.rawBody ?? req.body;\n if (typeof candidate === 'string' || candidate instanceof Uint8Array) {\n return candidate;\n }\n // express.json() already parsed it — re-stringify so the signature still matches\n // only if the original raw body is unavailable (best-effort).\n if (candidate && typeof candidate === 'object') {\n return JSON.stringify(candidate);\n }\n return '';\n}\n","import { EventEmitter } from 'node:events';\nimport {\n CosmosPayAPIError,\n CosmosPayRequestError,\n} from '@/errors/CosmosPayError';\nimport {\n DEFAULT_RETRIES,\n DEFAULT_TIMEOUT,\n DEFAULT_VERSION,\n Events,\n version,\n} from '@/util/Constants';\n\n/** A `fetch`-compatible function (defaults to the global `fetch`). */\nexport type FetchLike = typeof fetch;\n\n/** Options accepted when constructing a {@link REST} instance. */\nexport interface RESTOptions {\n /**\n * Base URL of the Cosmos Pay gateway (no trailing slash), e.g.\n * `https://api.cosmospay.lat/cosmos-api`. The version segment is appended\n * automatically.\n */\n baseURL: string;\n /**\n * API key issued by the Cosmos developer platform. Sent as\n * `Authorization: Bearer <apiKey>` (and `apikey: <apiKey>`) to the gateway.\n */\n apiKey?: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`). Only needed when calling the\n * service directly (bypassing APISIX) — typically local development.\n */\n gatewaySecret?: string;\n /**\n * Authenticated consumer username (`X-Consumer-Username`). Pair with\n * `gatewaySecret` for direct service access.\n */\n consumerUsername?: string;\n /**\n * API version segment prefixed to every route. Defaults to `v1`. Set to an\n * empty string when your gateway already injects the version.\n */\n version?: string;\n /** Per-request timeout in milliseconds (default 30000). */\n timeout?: number;\n /** Retries for transient failures — network errors, 429 and 5xx (default 2). */\n retries?: number;\n /** Extra headers merged into every request. */\n headers?: Record<string, string>;\n /** Custom fetch implementation (e.g. a polyfill on old runtimes). */\n fetch?: FetchLike;\n}\n\n/** Internal options for a single request. */\nexport interface RequestOptions {\n /** Query string parameters; `undefined`/`null` values are dropped. */\n query?: Record<string, string | number | boolean | undefined | null>;\n /** JSON body to send. */\n body?: unknown;\n /** Per-request header overrides. */\n headers?: Record<string, string>;\n /** Per-request AbortSignal. */\n signal?: AbortSignal;\n}\n\nconst RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);\n\n/**\n * The HTTP layer. Owns the base URL, authentication and retry/timeout policy,\n * and exposes thin verb helpers (`get`/`post`/`patch`/`delete`). Managers call\n * these — they never touch `fetch` directly.\n */\nexport class REST extends EventEmitter {\n public baseURL: string;\n public readonly version: string;\n private readonly timeout: number;\n private readonly retries: number;\n private readonly fetchFn: FetchLike;\n private readonly extraHeaders: Record<string, string>;\n private apiKey?: string;\n private gatewaySecret?: string;\n private consumerUsername?: string;\n\n constructor(options: RESTOptions) {\n super();\n if (!options.baseURL) {\n throw new TypeError('REST requires a `baseURL`.');\n }\n this.baseURL = options.baseURL.replace(/\\/+$/, '');\n this.version = options.version ?? DEFAULT_VERSION;\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n this.retries = options.retries ?? DEFAULT_RETRIES;\n this.extraHeaders = options.headers ?? {};\n this.apiKey = options.apiKey;\n this.gatewaySecret = options.gatewaySecret;\n this.consumerUsername = options.consumerUsername;\n\n const fetchFn = options.fetch ?? globalThis.fetch;\n if (typeof fetchFn !== 'function') {\n throw new TypeError(\n 'No global `fetch` found. Use Node.js >= 18 or pass a `fetch` implementation in the client options.',\n );\n }\n this.fetchFn = fetchFn.bind(globalThis);\n }\n\n /** Replace the API key used for subsequent requests. */\n public setApiKey(apiKey: string): this {\n this.apiKey = apiKey;\n return this;\n }\n\n /** Set direct-access gateway credentials (local/dev usage). */\n public setGatewayCredentials(secret: string, consumerUsername: string): this {\n this.gatewaySecret = secret;\n this.consumerUsername = consumerUsername;\n return this;\n }\n\n public get<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n public post<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n public put<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('PUT', path, options);\n }\n\n public patch<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('PATCH', path, options);\n }\n\n public delete<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('DELETE', path, options);\n }\n\n /** Build the absolute URL for a route, applying the version prefix + query. */\n public buildURL(path: string, query?: RequestOptions['query']): string {\n const clean = path.startsWith('/') ? path : `/${path}`;\n const prefix = this.version ? `/${this.version}` : '';\n const url = new URL(`${this.baseURL}${prefix}${clean}`);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n\n private buildHeaders(extra?: Record<string, string>): Record<string, string> {\n const headers: Record<string, string> = {\n Accept: 'application/json',\n 'User-Agent': `@cosmosapp/pay_sdk/${version}`,\n ...this.extraHeaders,\n };\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`;\n headers['apikey'] = this.apiKey;\n }\n if (this.gatewaySecret) headers['X-Gateway-Secret'] = this.gatewaySecret;\n if (this.consumerUsername) {\n headers['X-Consumer-Username'] = this.consumerUsername;\n }\n return { ...headers, ...extra };\n }\n\n /** Core request with retry, timeout and structured error handling. */\n public async request<T>(\n method: string,\n path: string,\n options: RequestOptions = {},\n ): Promise<T> {\n const url = this.buildURL(path, options.query);\n const headers = this.buildHeaders(options.headers);\n\n let serializedBody: string | undefined;\n if (options.body !== undefined) {\n serializedBody = JSON.stringify(options.body);\n headers['Content-Type'] = 'application/json';\n }\n\n let attempt = 0;\n let lastError: unknown;\n\n while (attempt <= this.retries) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n const signal = options.signal\n ? anySignal([options.signal, controller.signal])\n : controller.signal;\n\n this.emit(Events.Request, { method, url, attempt });\n\n try {\n const response = await this.fetchFn(url, {\n method,\n headers,\n body: serializedBody,\n signal,\n });\n clearTimeout(timer);\n\n this.emit(Events.Response, {\n method,\n url,\n status: response.status,\n attempt,\n });\n\n if (response.status === 429) {\n this.emit(Events.RateLimited, { method, url, attempt });\n }\n\n if (!response.ok) {\n const body = await safeParse(response);\n if (RETRYABLE_STATUS.has(response.status) && attempt < this.retries) {\n await this.backoff(response, attempt);\n attempt++;\n continue;\n }\n throw new CosmosPayAPIError({ status: response.status, method, url, body });\n }\n\n return (await safeParse(response)) as T;\n } catch (error) {\n clearTimeout(timer);\n if (error instanceof CosmosPayAPIError) throw error;\n\n // Network/abort/timeout → retry, then surface as a request error.\n lastError = error;\n if (attempt < this.retries) {\n await sleep(backoffDelay(attempt));\n attempt++;\n continue;\n }\n throw new CosmosPayRequestError({ method, url, cause: error });\n }\n }\n\n throw new CosmosPayRequestError({ method, url, cause: lastError });\n }\n\n private async backoff(response: Response, attempt: number): Promise<void> {\n const retryAfter = response.headers.get('retry-after');\n const ms = retryAfter\n ? Number(retryAfter) * 1000\n : backoffDelay(attempt);\n await sleep(Number.isFinite(ms) ? ms : backoffDelay(attempt));\n }\n}\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\nfunction backoffDelay(attempt: number): number {\n return Math.min(1000 * 2 ** attempt, 8000);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function safeParse(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return null;\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.includes('application/json')) {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n return text;\n}\n\n/** Combine multiple AbortSignals into one (first to abort wins). */\nfunction anySignal(signals: AbortSignal[]): AbortSignal {\n const controller = new AbortController();\n const onAbort = (signal: AbortSignal) => () => controller.abort(signal.reason);\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n break;\n }\n signal.addEventListener('abort', onAbort(signal), { once: true });\n }\n return controller.signal;\n}\n","import { DEFAULT_BASE_URL, DEFAULT_VERSION } from '@/util/Constants';\n\n/**\n * Internal (\"shared\") configuration that Cosmos Pay maintains on the user's\n * behalf. These are the gateway / infrastructure details an integrator should\n * **not** have to know about — they're pre-filled here so that, in practice, the\n * only credential a user provides is their `apiKey`.\n *\n * Every value is overridable (per-client via {@link ClientOptions}, or globally\n * via {@link Client.shared}) for self-hosting, staging or local development.\n */\nexport interface SharedConfig {\n /** Base URL of the Cosmos Pay gateway. */\n baseURL: string;\n /** API version segment prefixed to every route (`/v1/...`). */\n version: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`). Only used when talking to the\n * service directly, bypassing the gateway (local development). Internal.\n */\n gatewaySecret?: string;\n /**\n * Authenticated consumer username (`X-Consumer-Username`). Paired with\n * `gatewaySecret` for direct service access. Internal.\n */\n consumerUsername?: string;\n /**\n * Default webhook signing secret used by the webhook listener\n * (`client.webhooks.process` / handlers) when no secret is passed explicitly.\n */\n webhookSecret?: string;\n}\n\n/**\n * The mutable, process-wide defaults. Cosmos Pay ships sane values here; you can\n * tweak them once at startup (e.g. `Client.shared.baseURL = '...'`) and every\n * client created afterwards inherits them.\n */\nexport const shared: SharedConfig = {\n baseURL: DEFAULT_BASE_URL,\n version: DEFAULT_VERSION,\n};\n\n/** Merge a partial override on top of the current shared defaults. */\nexport function resolveShared(overrides: Partial<SharedConfig> = {}): SharedConfig {\n const defined: Partial<SharedConfig> = {};\n for (const key of Object.keys(overrides) as (keyof SharedConfig)[]) {\n const value = overrides[key];\n if (value !== undefined) {\n Object.assign(defined, { [key]: value });\n }\n }\n return { ...shared, ...defined };\n}\n","import { EventEmitter } from 'node:events';\nimport { AliasManager } from '@/managers/AliasManager';\nimport { AnalyticsManager } from '@/managers/AnalyticsManager';\nimport { AssetManager } from '@/managers/AssetManager';\nimport { CustomerManager } from '@/managers/CustomerManager';\nimport { HealthManager } from '@/managers/HealthManager';\nimport { LiquidityManager } from '@/managers/LiquidityManager';\nimport { OnrampManager } from '@/managers/OnrampManager';\nimport { OfframpManager } from '@/managers/OfframpManager';\nimport { ActivityManager } from '@/managers/ActivityManager';\nimport { KycManager } from '@/managers/KycManager';\nimport { CrossChainSwapManager } from '@/managers/CrossChainSwapManager';\nimport { DefindexManager } from '@/managers/DefindexManager';\nimport { PluginManager } from '@/managers/PluginManager';\nimport { PublicKeyManager } from '@/managers/PublicKeyManager';\nimport { PaymentIntentManager } from '@/managers/PaymentIntentManager';\nimport { ProductManager } from '@/managers/ProductManager';\nimport { SwapManager } from '@/managers/SwapManager';\nimport { WebhookManager } from '@/managers/WebhookManager';\nimport { REST, type FetchLike } from '@/rest/REST';\nimport { version } from '@/util/Constants';\nimport { resolveShared, shared, type SharedConfig } from '@/util/shared';\n\n/**\n * Options accepted by the {@link Client} constructor.\n *\n * In practice the only value you provide is `apiKey` — everything else (the\n * gateway URL, version and other infrastructure details) is pre-filled from the\n * {@link Client.shared} defaults that Cosmos Pay maintains for you.\n */\nexport interface ClientOptions {\n /**\n * Your Cosmos Pay API key. Sent to the gateway as `Authorization: Bearer\n * <apiKey>`. The key type determines the network (`dv_` → testnet, `prod_` →\n * mainnet). This is the only credential a typical integration needs.\n */\n apiKey: string;\n\n /**\n * Default webhook signing secret used by the webhook listener\n * (`client.webhooks.on(...)` + handlers) when you don't pass one explicitly.\n */\n webhookSecret?: string;\n\n /** Per-request timeout in milliseconds (default 30000). */\n timeout?: number;\n /** Retries for transient failures — network errors, 429 and 5xx (default 2). */\n retries?: number;\n /** Extra headers merged into every request. */\n headers?: Record<string, string>;\n /** Custom fetch implementation (e.g. a polyfill on old runtimes). */\n fetch?: FetchLike;\n\n // ── Advanced / internal overrides (you normally never set these) ────────────\n /**\n * Override the gateway base URL. Defaults to {@link Client.shared}`.baseURL`.\n * Only needed for self-hosting or a staging gateway.\n * @internal\n */\n baseURL?: string;\n /**\n * Override the API version segment. Defaults to `v1`.\n * @internal\n */\n version?: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`) for direct, gateway-bypassing\n * access (local development). Maintained internally.\n * @internal\n */\n gatewaySecret?: string;\n /**\n * Consumer username (`X-Consumer-Username`) for direct access. Internal.\n * @internal\n */\n consumerUsername?: string;\n}\n\n/** Payloads emitted by the {@link Client} for observability. */\nexport interface ClientEvents {\n request: [{ method: string; url: string; attempt: number }];\n response: [{ method: string; url: string; status: number; attempt: number }];\n rateLimited: [{ method: string; url: string; attempt: number }];\n debug: [message: string];\n}\n\nexport interface Client {\n on<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n once<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n off<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n emit<E extends keyof ClientEvents>(\n event: E,\n ...args: ClientEvents[E]\n ): boolean;\n}\n\n/**\n * The main entry point of the SDK — a single, atomic client that exposes every\n * resource through its own manager — an atomic, single-client design.\n *\n * @example\n * import { Client } from '@cosmosapp/pay_sdk';\n *\n * // The user only provides their API key — the gateway is handled for them.\n * const client = new Client({ apiKey: process.env.COSMOS_PAY_API_KEY });\n *\n * const intent = await client.paymentIntents.createPay({ destination: 'G...', amount: '10' });\n * console.log(intent.uri);\n */\nexport class Client extends EventEmitter {\n /** Library version. */\n public static readonly version = version;\n\n /**\n * Process-wide shared defaults maintained by Cosmos Pay (gateway URL, version,\n * internal secrets). Mutate once at startup to change them for every client\n * (e.g. self-hosting): `Client.shared.baseURL = 'https://gateway.your-domain.com'`.\n */\n public static readonly shared: SharedConfig = shared;\n\n /** Resolved shared configuration for this client instance. */\n public readonly shared: SharedConfig;\n\n /** Default webhook signing secret for the webhook listener (if configured). */\n public webhookSecret: string | undefined;\n\n /** The underlying HTTP layer. Shared by every manager. */\n public readonly rest: REST;\n\n /** Stellar payment intents — create/list/fetch/update/delete/validate. */\n public readonly paymentIntents: PaymentIntentManager;\n /** Webhook endpoints, delivery audit trail, and the event listener. */\n public readonly webhooks: WebhookManager;\n /** Products / prices. */\n public readonly products: ProductManager;\n /** Same-chain swaps: the Stellar DEX, Jupiter on Solana, Kuru Flow on Monad. */\n public readonly swaps: SwapManager;\n /** Swaps between Stellar, Solana and Monad, settled by NEAR Intents. */\n public readonly crossChainSwaps: CrossChainSwapManager;\n /** Liquidity pools: browse, positions, deposit / withdraw. */\n public readonly liquidity: LiquidityManager;\n /** Fiat -> stablecoin: quotes, payins, trustlines, virtual accounts. */\n public readonly onramp: OnrampManager;\n /** Stablecoin -> fiat: quotes, authorize, payouts, compliance documents. */\n public readonly offramp: OfframpManager;\n /** The client event stream: report events, read them back, summarize. */\n public readonly activity: ActivityManager;\n /** KYC / KYB: receivers, their wallets and their bank accounts. */\n public readonly kyc: KycManager;\n /** Customers. */\n public readonly customers: CustomerManager;\n /** Read-only analytics (summary, balances, logs). */\n public readonly analytics: AnalyticsManager;\n /** Service health probes (public). */\n public readonly health: HealthManager;\n /** Payment handles: resolve, claim and manage `@name` aliases. */\n public readonly aliases: AliasManager;\n /** The asset registry: which `(code, issuer)` pairs exist per network, and who issues them. */\n public readonly assets: AssetManager;\n /** Plugins this deployment serves: install, query, command. */\n public readonly plugins: PluginManager;\n /** DeFindex vaults (when the deployment enables the native plugin). */\n public readonly defindex: DefindexManager;\n /** The shared public API key an open-source wallet embeds. */\n public readonly publicKey: PublicKeyManager;\n\n constructor(options: ClientOptions) {\n super();\n if (!options || !options.apiKey) {\n throw new TypeError('Client requires an `apiKey` option.');\n }\n\n // Fill the infrastructure details from the shared defaults; the user only\n // had to bring their apiKey.\n this.shared = resolveShared({\n baseURL: options.baseURL,\n version: options.version,\n gatewaySecret: options.gatewaySecret,\n consumerUsername: options.consumerUsername,\n webhookSecret: options.webhookSecret,\n });\n this.webhookSecret = this.shared.webhookSecret;\n\n this.rest = new REST({\n baseURL: this.shared.baseURL,\n apiKey: options.apiKey,\n gatewaySecret: this.shared.gatewaySecret,\n consumerUsername: this.shared.consumerUsername,\n version: this.shared.version,\n timeout: options.timeout,\n retries: options.retries,\n headers: options.headers,\n fetch: options.fetch,\n });\n\n // Re-emit REST telemetry through the client so consumers can subscribe to\n // `client.on('request' | 'response' | 'rateLimited' | 'debug', ...)`.\n this.rest.on('request', (p) => this.emit('request', p));\n this.rest.on('response', (p) => this.emit('response', p));\n this.rest.on('rateLimited', (p) => this.emit('rateLimited', p));\n\n this.paymentIntents = new PaymentIntentManager(this);\n this.webhooks = new WebhookManager(this);\n this.products = new ProductManager(this);\n this.swaps = new SwapManager(this);\n this.crossChainSwaps = new CrossChainSwapManager(this);\n this.liquidity = new LiquidityManager(this);\n this.onramp = new OnrampManager(this);\n this.offramp = new OfframpManager(this);\n this.activity = new ActivityManager(this);\n this.kyc = new KycManager(this);\n this.customers = new CustomerManager(this);\n this.analytics = new AnalyticsManager(this);\n this.health = new HealthManager(this);\n this.aliases = new AliasManager(this);\n this.assets = new AssetManager(this);\n this.plugins = new PluginManager(this);\n this.defindex = new DefindexManager(this);\n this.publicKey = new PublicKeyManager(this);\n }\n\n /** Update the API key used for subsequent requests. */\n public setApiKey(apiKey: string): this {\n this.rest.setApiKey(apiKey);\n return this;\n }\n\n /** Set the default webhook signing secret for the webhook listener. */\n public setWebhookSecret(secret: string): this {\n this.webhookSecret = secret;\n return this;\n }\n\n /** Set direct-access gateway credentials (internal / local dev usage). */\n public setGatewayCredentials(secret: string, consumerUsername: string): this {\n this.rest.setGatewayCredentials(secret, consumerUsername);\n return this;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/managers/AliasManager.ts","../src/managers/AnalyticsManager.ts","../src/managers/AssetManager.ts","../src/util/path.ts","../src/structures/Base.ts","../src/structures/Customer.ts","../src/managers/BaseManager.ts","../src/managers/CustomerManager.ts","../src/managers/HealthManager.ts","../src/types/index.ts","../src/structures/LiquidityOperation.ts","../src/managers/LiquidityManager.ts","../src/managers/OnrampManager.ts","../src/managers/OfframpManager.ts","../src/managers/ActivityManager.ts","../src/structures/Receiver.ts","../src/managers/KycManager.ts","../src/structures/CrossChainSwap.ts","../src/managers/CrossChainSwapManager.ts","../src/managers/DefindexManager.ts","../src/managers/PluginManager.ts","../src/managers/PublicKeyManager.ts","../src/structures/PaymentIntent.ts","../src/managers/PaymentIntentManager.ts","../src/structures/PrivatePayment.ts","../src/managers/PrivatePaymentManager.ts","../src/structures/Product.ts","../src/managers/ProductManager.ts","../src/structures/ChainSwap.ts","../src/structures/Swap.ts","../src/managers/SwapManager.ts","../src/structures/Usdt0Transfer.ts","../src/managers/Usdt0Manager.ts","../src/structures/WebhookDelivery.ts","../src/structures/WebhookEndpoint.ts","../src/util/Webhooks.ts","../src/managers/WebhookManager.ts","../src/rest/REST.ts","../src/util/shared.ts","../src/client/Client.ts"],"names":["FINAL","EventEmitter"],"mappings":";;;;;;AAoCO,IAAM,eAAN,MAAmB;AAAA,EAIxB,YAAY,MAAA,EAAgB;AAF5B,IAAA,IAAA,CAAiB,KAAA,GAAQ,UAAA;AAGvB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA,EAEA,IAAY,IAAA,GAAa;AACvB,IAAA,OAAO,KAAK,MAAA,CAAO,IAAA;AAAA,EACrB;AAAA;AAAA,EAGO,OAAA,CAAQ,IAAA,EAAc,OAAA,GAAgC,EAAC,EAAiC;AAC7F,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAyB,CAAA,EAAG,IAAA,CAAK,KAAK,CAAA,SAAA,EAAY,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA,EAAI;AAAA,MAC7F,KAAA,EAAO,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA;AAAQ,KACnC,CAAA;AAAA,EACH;AAAA;AAAA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;AACnC,IAAA,IAAA,CAAK,OAAA,GAAU,IAAI,aAAA,CAAc,IAAI,CAAA;AACrC,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,eAAA,CAAgB,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,gBAAA,CAAiB,IAAI,CAAA;AAAA,EAC5C;AAAA;AAAA,EAGO,UAAU,MAAA,EAAsB;AACrC,IAAA,IAAA,CAAK,IAAA,CAAK,UAAU,MAAM,CAAA;AAC1B,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA,EAGO,iBAAiB,MAAA,EAAsB;AAC5C,IAAA,IAAA,CAAK,aAAA,GAAgB,MAAA;AACrB,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA,EAGO,qBAAA,CAAsB,QAAgB,gBAAA,EAAgC;AAC3E,IAAA,IAAA,CAAK,IAAA,CAAK,qBAAA,CAAsB,MAAA,EAAQ,gBAAgB,CAAA;AACxD,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AddAliasAddressOptions,\n AliasAddressData,\n AliasAvailabilityData,\n AliasByAddressData,\n AliasChallengeData,\n AliasDeletedData,\n AliasListData,\n AliasRecoveryStartedData,\n AliasResolutionData,\n ClaimAliasOptions,\n CompleteAliasRecoveryOptions,\n CreateAliasChallengeOptions,\n OwnedAliasData,\n} from '@/types/index';\n\n/**\n * Payment handles — `client.aliases`. A handle names one or more Stellar\n * addresses, so a payer can send to `@ada` instead of a 56-character key.\n *\n * Every address on a handle proved control of itself: claiming a handle or\n * pointing it somewhere new takes a signature, by that address, over a\n * challenge the server issued. The SDK never holds the key — ask for a\n * challenge, sign its `message` where the key lives, and send the signature\n * back.\n *\n * @example\n * const { primaryAddress } = await client.aliases.resolve('ada', { network: 'public' });\n *\n * @example\n * const ch = await client.aliases.createChallenge({ name: 'ada', address, network: 'public' });\n * const signature = signWithYourWallet(ch.message); // base64 ed25519\n * await client.aliases.claim({ name: 'ada', email: 'ada@example.com', nonce: ch.nonce, signature });\n */\nexport class AliasManager {\n public readonly client: Client;\n private readonly route = '/aliases';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Where to pay a handle: its verified addresses on a network, primary first. */\n public resolve(name: string, options: { network?: string } = {}): Promise<AliasResolutionData> {\n return this.rest.get<AliasResolutionData>(`${this.route}/resolve/${encodeURIComponent(name)}`, {\n query: { network: options.network },\n });\n }\n\n /** Whether a handle can be claimed, and if not, why not. */\n public availability(name: string): Promise<AliasAvailabilityData> {\n return this.rest.get<AliasAvailabilityData>(`${this.route}/availability/${encodeURIComponent(name)}`);\n }\n\n /** Which handles point at an address — the reverse lookup. */\n public byAddress(address: string, options: { network?: string } = {}): Promise<AliasByAddressData> {\n return this.rest.get<AliasByAddressData>(`${this.route}/by-address/${encodeURIComponent(address)}`, {\n query: { network: options.network },\n });\n }\n\n /** A nonce and the exact message to sign, for a claim, a new address or a recovery. */\n public createChallenge(options: CreateAliasChallengeOptions): Promise<AliasChallengeData> {\n return this.rest.post<AliasChallengeData>(`${this.route}/challenges`, { body: options });\n }\n\n /** Claim a handle with a signature over a CLAIM challenge. */\n public claim(options: ClaimAliasOptions): Promise<OwnedAliasData> {\n return this.rest.post<OwnedAliasData>(this.route, { body: options });\n }\n\n /** The handles this consumer owns (paginated). */\n public list(options: { take?: number; skip?: number } = {}): Promise<AliasListData> {\n return this.rest.get<AliasListData>(this.route, {\n query: { take: options.take, skip: options.skip },\n });\n }\n\n /** Point a handle at another address, signed by that address (ADD_ADDRESS challenge). */\n public addAddress(name: string, options: AddAliasAddressOptions): Promise<AliasAddressData> {\n return this.rest.post<AliasAddressData>(`${this.route}/${encodeURIComponent(name)}/addresses`, {\n body: options,\n });\n }\n\n /** Remove one address from a handle. */\n public removeAddress(name: string, addressId: string): Promise<AliasDeletedData> {\n return this.rest.delete<AliasDeletedData>(\n `${this.route}/${encodeURIComponent(name)}/addresses/${encodeURIComponent(addressId)}`,\n );\n }\n\n /** Release a handle back to the namespace. */\n public release(name: string): Promise<AliasDeletedData> {\n return this.rest.delete<AliasDeletedData>(`${this.route}/${encodeURIComponent(name)}`);\n }\n\n /**\n * Start a recovery: the service emails a one-time token to the mailbox the\n * handle was claimed with, if `email` is that mailbox. The answer is the same\n * either way, so it says nothing about who owns the handle; the token only\n * ever reaches the mailbox, never this response.\n */\n public startRecovery(name: string, email: string): Promise<AliasRecoveryStartedData> {\n return this.rest.post<AliasRecoveryStartedData>(`${this.route}/${encodeURIComponent(name)}/recovery`, {\n body: { email },\n });\n }\n\n /**\n * Take a handle over with a new address after losing the old one: the token\n * the owner received by email, plus a signature by the new address over a\n * RECOVER challenge.\n */\n public completeRecovery(name: string, options: CompleteAliasRecoveryOptions): Promise<OwnedAliasData> {\n return this.rest.post<OwnedAliasData>(`${this.route}/${encodeURIComponent(name)}/recovery/complete`, {\n body: options,\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AnalyticsBalancesData,\n AnalyticsSeriesData,\n AnalyticsSeriesOptions,\n AnalyticsSummaryData,\n ApiLogsData,\n WebhookLogsData,\n} from '@/types/index';\n\n/**\n * Read-only analytics derived from the consumer's intents and deliveries —\n * `client.analytics`. Powers dashboard-style Overview / Balances / Logs views.\n */\nexport class AnalyticsManager {\n public readonly client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Overview metrics: totals, settled volume, webhook health, 30-day series. */\n public summary(): Promise<AnalyticsSummaryData> {\n return this.rest.get<AnalyticsSummaryData>('/summary');\n }\n\n /**\n * Activity per day, week, month or year, with the window before for growth:\n * payments (with their settled volume in USD), swaps of every kind, liquidity\n * operations, webhook deliveries and private payments, each in the UTC\n * buckets of `period` (`day` when omitted).\n */\n public series(options: AnalyticsSeriesOptions = {}): Promise<AnalyticsSeriesData> {\n return this.rest.get<AnalyticsSeriesData>('/summary/series', {\n query: { period: options.period },\n });\n }\n\n /** Settled (and pending) amount per asset. */\n public balances(): Promise<AnalyticsBalancesData> {\n return this.rest.get<AnalyticsBalancesData>('/balances');\n }\n\n /** Recent API requests reaching the service (with details). */\n public apiLogs(): Promise<ApiLogsData> {\n return this.rest.get<ApiLogsData>('/logs');\n }\n\n /** Recent webhook deliveries across all endpoints (with details). */\n public webhookLogs(): Promise<WebhookLogsData> {\n return this.rest.get<WebhookLogsData>('/logs/webhooks');\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { AssetRegistryData, ListRegistryAssetsOptions } from '@/types/index';\n\n/**\n * The server's asset registry — `client.assets`: which `(code, issuer)` pairs\n * it knows per network, and who issues each.\n *\n * A code is not an identifier — mainnet carries dozens of accounts issuing\n * `USDC` — so this is where to learn WHICH one. `verified` is a claim about the\n * issuer's identity (checked against `issuerName`), not about quality; the\n * unverified rows are returned too, and a UI should show them below a warning\n * rather than hide them. The static {@link Assets} catalog is the offline\n * fallback; this is the current list, and its `version` says which is newer.\n *\n * @example\n * const { data } = await client.assets.list({ network: 'public', verified: true });\n */\nexport class AssetManager {\n public readonly client: Client;\n private readonly route = '/assets';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** The registry for a network. */\n public list(options: ListRegistryAssetsOptions = {}): Promise<AssetRegistryData> {\n return this.rest.get<AssetRegistryData>(this.route, {\n query: { network: options.network, verified: options.verified },\n });\n }\n}\n","/**\n * One segment of a request path, built from a caller's value (an id, a name). It is percent-encoded,\n * so `/`, `?` and `#` cannot add segments, a query or a fragment, and a value of `.` or `..` is\n * refused: encoding leaves dots as they are, and the URL parser would resolve them to another route\n * (`/transfers/../submit`).\n */\nexport function pathSegment(value: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new TypeError('A path segment must be a non-empty string.');\n }\n if (value === '.' || value === '..') {\n throw new TypeError(`\"${value}\" is not a valid id.`);\n }\n return encodeURIComponent(value);\n}\n","import type { Client } from '@/client/Client';\n\n/**\n * Root of every API structure. Holds a back-reference to the {@link Client} so\n * instances can perform their own actions (e.g. `paymentIntent.delete()`), and\n * provides the `_patch`/`toJSON` plumbing shared by all structures.\n */\nexport abstract class Base<Data extends { id: string }> {\n /** The client that instantiated this structure. */\n public readonly client: Client;\n /** Unique identifier of the resource. */\n public id!: string;\n\n protected constructor(client: Client, data: Data) {\n this.client = client;\n this._patch(data);\n }\n\n /** Merge raw API data onto this instance. Subclasses override and call super. */\n protected _patch(data: Data): this {\n this.id = data.id;\n return this;\n }\n\n /** Return the raw API representation of this structure. */\n public abstract toJSON(): Data;\n\n /** Allow `String(structure)` / template literals to resolve to the id. */\n public valueOf(): string {\n return this.id;\n }\n}\n","import type { Client } from '@/client/Client';\nimport type {\n AddCustomerWalletOptions,\n CustomerData,\n CustomerWalletData,\n CustomerWalletDeletedData,\n UpdateCustomerOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A customer record, optionally enriched with on-chain payment stats. */\nexport class Customer extends Base<CustomerData> {\n public name!: string;\n public alias!: string | null;\n public note!: string | null;\n public email!: string | null;\n /**\n * The customer's wallets, oldest first, on Stellar, Solana or Monad. Payments\n * paid from any of them count toward the customer.\n */\n public wallets!: CustomerWalletData[];\n /** @deprecated Read {@link Customer.wallets}. The first wallet's address, or null. */\n public account!: string | null;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n // No initializers on the three below: a field initializer runs after `super()`,\n // that is after `_patch`, and would reset what the list response carried.\n /** Number of payment intents from this customer's wallets (list view only). */\n public payments!: number | null;\n /** Number of succeeded payments (list view only). */\n public succeeded!: number | null;\n /** Total settled amount as a decimal string (list view only). */\n public total!: string | null;\n\n constructor(client: Client, data: CustomerData) {\n super(client, data);\n }\n\n protected override _patch(data: CustomerData): this {\n super._patch(data);\n this.name = data.name;\n this.alias = data.alias;\n this.note = data.note;\n this.email = data.email;\n this.wallets = data.wallets ?? [];\n this.account = data.account;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n // A response without stats (fetch, update) keeps the ones already read.\n this.payments = data.payments ?? this.payments ?? null;\n this.succeeded = data.succeeded ?? this.succeeded ?? null;\n this.total = data.total ?? this.total ?? null;\n return this;\n }\n\n /** Re-fetch this customer. */\n public fetch(): Promise<Customer> {\n return this.client.customers.fetch(this.id);\n }\n\n /** Update this customer. Mutates and returns this. */\n public async edit(options: UpdateCustomerOptions): Promise<this> {\n const updated = await this.client.customers.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Delete this customer. */\n public delete() {\n return this.client.customers.delete(this.id);\n }\n\n /**\n * Add a wallet to this customer and to {@link Customer.wallets}. A wallet the\n * customer already holds answers as it is.\n */\n public async addWallet(options: AddCustomerWalletOptions): Promise<CustomerWalletData> {\n const wallet = await this.client.customers.addWallet(this.id, options);\n const at = this.wallets.findIndex((w) => w.id === wallet.id);\n this.wallets = at === -1\n ? [...this.wallets, wallet]\n : this.wallets.map((w, i) => (i === at ? wallet : w));\n this.syncAccount();\n return wallet;\n }\n\n /** Remove one of this customer's wallets, by id or as read from {@link Customer.wallets}. */\n public async removeWallet(\n wallet: string | CustomerWalletData,\n ): Promise<CustomerWalletDeletedData> {\n const walletId = typeof wallet === 'string' ? wallet : wallet.id;\n const result = await this.client.customers.removeWallet(this.id, walletId);\n this.wallets = this.wallets.filter((w) => w.id !== walletId);\n this.syncAccount();\n return result;\n }\n\n /** `account` is the first wallet's address, as the API derives it. */\n private syncAccount(): void {\n this.account = this.wallets[0]?.address ?? null;\n }\n\n public toJSON(): CustomerData {\n return {\n id: this.id,\n name: this.name,\n alias: this.alias,\n note: this.note,\n email: this.email,\n wallets: this.wallets,\n account: this.account,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n ...(this.payments !== null ? { payments: this.payments } : {}),\n ...(this.succeeded !== null ? { succeeded: this.succeeded } : {}),\n ...(this.total !== null ? { total: this.total } : {}),\n };\n }\n}\n","import { EventEmitter } from 'node:events';\nimport type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\n\n/**\n * Base class for all resource managers. Each manager owns a slice of the API\n * (payment intents, webhooks, ...) and a lightweight in-memory cache of the\n * structures it has materialized — an atomic, per-resource manager pattern.\n *\n * Extends EventEmitter so managers that surface real-time events (e.g. the\n * webhook listener) can `emit`/`on` without extra plumbing.\n */\nexport abstract class BaseManager<\n Structure extends { id: string },\n> extends EventEmitter {\n public readonly client: Client;\n /** Cache of structures keyed by id, populated on fetch/create. */\n public readonly cache: Map<string, Structure> = new Map();\n\n constructor(client: Client) {\n super();\n this.client = client;\n }\n\n /** Shortcut to the shared REST instance. */\n protected get rest(): REST {\n return this.client.rest;\n }\n\n /** Store a structure in the cache and return it. */\n protected _add(structure: Structure): Structure {\n this.cache.set(structure.id, structure);\n return structure;\n }\n\n /** Resolve an id from either a raw id or a structure instance. */\n public resolveId(idOrStructure: string | { id: string }): string {\n return typeof idOrStructure === 'string' ? idOrStructure : idOrStructure.id;\n }\n}\n","import { pathSegment } from '@/util/path';\nimport { Customer } from '@/structures/Customer';\nimport type {\n AddCustomerWalletOptions,\n CreateCustomerOptions,\n CustomerData,\n CustomerListData,\n CustomerWalletData,\n CustomerWalletDeletedData,\n UpdateCustomerOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\ntype CustomerDeletedData = { id: string; deleted: boolean };\n\n/**\n * Manages customers — `client.customers`.\n *\n * @example\n * const customer = await client.customers.create({\n * name: 'Acme Inc.', email: 'billing@acme.com',\n * wallets: [{ chain: 'stellar', address: 'G...' }],\n * });\n * await customer.addWallet({ chain: 'solana', address: '7EcD...', label: 'Phantom' });\n */\nexport class CustomerManager extends BaseManager<Customer> {\n private readonly route = '/customers';\n\n /** Create a customer. */\n public async create(options: CreateCustomerOptions): Promise<Customer> {\n const data = await this.rest.post<CustomerData>(this.route, { body: options });\n return this._add(new Customer(this.client, data));\n }\n\n /** List the consumer's customers (with payment stats). */\n public async list(): Promise<Customer[]> {\n const data = await this.rest.get<CustomerListData>(this.route);\n return data.data.map((d) => this._add(new Customer(this.client, d)));\n }\n\n /** Get a customer by id. */\n public async fetch(id: string): Promise<Customer> {\n const data = await this.rest.get<CustomerData>(`${this.route}/${id}`);\n return this._add(new Customer(this.client, data));\n }\n\n /** Update a customer. */\n public async update(\n id: string,\n options: UpdateCustomerOptions,\n ): Promise<Customer> {\n const data = await this.rest.patch<CustomerData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new Customer(this.client, data));\n }\n\n /** Delete a customer. */\n public async delete(id: string): Promise<CustomerDeletedData> {\n const result = await this.rest.delete<CustomerDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n\n /**\n * Add a wallet to a customer, on Stellar, Solana or Monad (up to 20 per\n * customer); payments paid from it count toward the customer. A wallet the\n * customer already holds answers as it is; one another of your customers holds\n * is `409 customer_wallet_taken`.\n */\n public async addWallet(\n customerId: string,\n options: AddCustomerWalletOptions,\n ): Promise<CustomerWalletData> {\n return this.rest.post<CustomerWalletData>(`${this.route}/${pathSegment(customerId)}/wallets`, {\n body: options,\n });\n }\n\n /**\n * Remove a wallet from a customer. Payments from that address stop counting\n * toward it, and a later settled payment from it adds it as a new automatic\n * customer. A `walletId` that is not one of this customer's wallets is 404.\n */\n public async removeWallet(\n customerId: string,\n walletId: string,\n ): Promise<CustomerWalletDeletedData> {\n return this.rest.delete<CustomerWalletDeletedData>(\n `${this.route}/${pathSegment(customerId)}/wallets/${pathSegment(walletId)}`,\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { HealthCheckData } from '@/types/index';\n\n/**\n * Service health probes — `client.health`. These routes are public (they don't\n * require an authenticated consumer).\n */\nexport class HealthManager {\n public readonly client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Liveness probe — resolves when the service is up. */\n public async liveness(): Promise<boolean> {\n await this.rest.get<unknown>('/health/liveness');\n return true;\n }\n\n /** Readiness probe (checks the database). Returns the health report. */\n public readiness(): Promise<HealthCheckData> {\n return this.rest.get<HealthCheckData>('/health/readiness');\n }\n}\n","/**\n * Type definitions for the Cosmos Pay Payments API.\n *\n * These mirror the server's OpenAPI schema (Stellar SEP-7 payment intents,\n * webhooks, products, customers and analytics). Every type is exported so\n * TypeScript consumers get full intellisense; JavaScript consumers can ignore\n * them entirely.\n */\n\nimport type { AssetRef } from '@/common/assets';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Enums (provided both as runtime objects and as string-literal unions)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Lifecycle state of a payment intent. */\nexport const PaymentIntentStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Cancelled: 'CANCELLED',\n Expired: 'EXPIRED',\n} as const;\nexport type PaymentIntentStatus =\n (typeof PaymentIntentStatus)[keyof typeof PaymentIntentStatus];\n\n/** SEP-7 operation a payment intent represents. */\nexport const PaymentIntentKind = {\n /** Source account is known → unsigned XDR + `web+stellar:tx` URI. */\n Tx: 'TX',\n /** No source → `web+stellar:pay` URI only (wallet picks the source). */\n Pay: 'PAY',\n} as const;\nexport type PaymentIntentKind =\n (typeof PaymentIntentKind)[keyof typeof PaymentIntentKind];\n\n/** Domain events an integrator can subscribe a webhook to. */\nexport const WebhookEventType = {\n PaymentIntentCreated: 'PAYMENT_INTENT_CREATED',\n PaymentIntentUpdated: 'PAYMENT_INTENT_UPDATED',\n PaymentIntentSucceeded: 'PAYMENT_INTENT_SUCCEEDED',\n PaymentIntentFailed: 'PAYMENT_INTENT_FAILED',\n PaymentIntentCancelled: 'PAYMENT_INTENT_CANCELLED',\n PaymentIntentDeleted: 'PAYMENT_INTENT_DELETED',\n // Fiat (BlindPay), re-emitted once the server syncs them.\n ReceiverUpdated: 'RECEIVER_UPDATED',\n PayinCreated: 'PAYIN_CREATED',\n PayinUpdated: 'PAYIN_UPDATED',\n PayinCompleted: 'PAYIN_COMPLETED',\n PayoutCreated: 'PAYOUT_CREATED',\n PayoutUpdated: 'PAYOUT_UPDATED',\n PayoutCompleted: 'PAYOUT_COMPLETED',\n // Same-chain swaps on every chain (Stellar, Solana, Monad).\n SwapCreated: 'SWAP_CREATED',\n SwapSubmitted: 'SWAP_SUBMITTED',\n SwapSucceeded: 'SWAP_SUCCEEDED',\n SwapFailed: 'SWAP_FAILED',\n // Liquidity pool operations.\n LiquidityCreated: 'LIQUIDITY_CREATED',\n LiquiditySubmitted: 'LIQUIDITY_SUBMITTED',\n LiquiditySucceeded: 'LIQUIDITY_SUCCEEDED',\n LiquidityFailed: 'LIQUIDITY_FAILED',\n // Cross-chain swaps (NEAR Intents).\n CrossChainSwapCreated: 'CROSS_CHAIN_SWAP_CREATED',\n CrossChainSwapUpdated: 'CROSS_CHAIN_SWAP_UPDATED',\n CrossChainSwapSucceeded: 'CROSS_CHAIN_SWAP_SUCCEEDED',\n CrossChainSwapRefunded: 'CROSS_CHAIN_SWAP_REFUNDED',\n CrossChainSwapFailed: 'CROSS_CHAIN_SWAP_FAILED',\n CrossChainSwapExpired: 'CROSS_CHAIN_SWAP_EXPIRED',\n} as const;\nexport type WebhookEventType =\n (typeof WebhookEventType)[keyof typeof WebhookEventType];\n\n/** Delivery state of a single webhook attempt. */\nexport const WebhookDeliveryStatus = {\n Pending: 'PENDING',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n} as const;\nexport type WebhookDeliveryStatus =\n (typeof WebhookDeliveryStatus)[keyof typeof WebhookDeliveryStatus];\n\n/** Product billing kind. */\nexport const ProductKind = {\n Recurring: 'recurring',\n OneTime: 'one_time',\n Link: 'link',\n} as const;\nexport type ProductKind = (typeof ProductKind)[keyof typeof ProductKind];\n\n/** Lifecycle state of a swap. */\nexport const SwapStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type SwapStatus = (typeof SwapStatus)[keyof typeof SwapStatus];\n\n/** Which side of a pool an operation is on. */\nexport const LiquidityOperationKind = {\n Deposit: 'DEPOSIT',\n Withdraw: 'WITHDRAW',\n} as const;\nexport type LiquidityOperationKind =\n (typeof LiquidityOperationKind)[keyof typeof LiquidityOperationKind];\n\n/** Lifecycle state of a liquidity pool operation. */\nexport const LiquidityOperationStatus = {\n Pending: 'PENDING',\n Submitted: 'SUBMITTED',\n Succeeded: 'SUCCEEDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type LiquidityOperationStatus =\n (typeof LiquidityOperationStatus)[keyof typeof LiquidityOperationStatus];\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Payment intents\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/payment-intents/tx`. */\nexport interface CreateTxPaymentIntentOptions {\n /** Payer's Stellar account — the transaction source. A registered address-book name also works. */\n source: string;\n /** Payee's Stellar account. A registered address-book name also works. */\n destination: string;\n /** Amount as a decimal string (max 7 decimals). */\n amount: string;\n /**\n * Typed asset (e.g. `Assets.USDC` or `defineAsset(...)`) — fills `assetCode`\n * and `assetIssuer` for you. Takes a back seat to explicit code/issuer below.\n */\n asset?: AssetRef;\n /** Asset code. Omit (or `XLM`/`native`) for native lumens. */\n assetCode?: string;\n /** Issuer account for a non-native asset. */\n assetIssuer?: string;\n /** MEMO_ID (numeric uint64) for idempotency + on-chain identification. Auto-generated when omitted. */\n memo?: string;\n /** SEP-7 `msg`: shown to the user in their wallet (≤ 300 chars). */\n msg?: string;\n /** SEP-7 `callback` where the wallet POSTs the signed XDR, e.g. `url:https://...`. */\n callback?: string;\n}\n\n/** Body for `POST /v1/payment-intents/pay`. */\n/** The chain a payment intent settles on. */\nexport type PaymentChain = 'stellar' | 'solana' | 'monad';\n\nexport interface CreatePayPaymentIntentOptions {\n /**\n * Chain the payment settles on: `stellar` (the default, a SEP-7 `web+stellar:pay` link),\n * `solana` (a Solana Pay link) or `monad` (an EIP-681 link). The network (mainnet or test)\n * is the API key's, as on every route.\n */\n chain?: PaymentChain;\n /**\n * Payee's account on that chain: a Stellar `G...` account, a Solana address or a Monad\n * `0x...` address. A registered address-book name also works.\n */\n destination: string;\n /** Amount the destination should receive. Omit to let the user enter it (e.g. donations). */\n amount?: string;\n /**\n * Typed asset (e.g. `Assets.USDC` or `defineAsset(...)`) — fills `assetCode`\n * and `assetIssuer` for you. Takes a back seat to explicit code/issuer below.\n */\n asset?: AssetRef;\n /** Asset code the destination receives. Omit for the chain's coin (XLM, SOL or MON). */\n assetCode?: string;\n /** Who issues a token: the Stellar issuer account, the Solana SPL mint or the Monad ERC-20 contract. */\n assetIssuer?: string;\n /** MEMO_ID (numeric uint64) for idempotency + on-chain identification. Auto-generated when omitted. */\n memo?: string;\n /** Shown to the user in their wallet (≤ 300 chars): SEP-7 `msg` on Stellar, the Solana Pay `message`. */\n msg?: string;\n /** SEP-7 `callback`, e.g. `url:https://...`. Stellar only. */\n callback?: string;\n}\n\n/** Body for `PATCH /v1/payment-intents/:id`. */\nexport interface UpdatePaymentIntentOptions {\n status?: PaymentIntentStatus;\n /** Stellar transaction hash once the signed tx is submitted. */\n txHash?: string;\n /** Merchant reference. */\n reference?: string;\n}\n\n/** Query for `GET /v1/payment-intents`. */\nexport interface ListPaymentIntentsOptions {\n status?: PaymentIntentStatus;\n /** Only intents on this chain. Omit for every chain. */\n chain?: PaymentChain;\n /** Only intents created at or after this instant (a Date or an ISO 8601 string). */\n createdFrom?: Date | string;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Raw payment intent payload returned by the API. */\nexport interface PaymentIntentData {\n id: string;\n kind: PaymentIntentKind;\n status: PaymentIntentStatus;\n /** Chain the payment settles on (TX intents are always Stellar). Older servers omit it: Stellar. */\n chain?: PaymentChain;\n network: string;\n source: string | null;\n destination: string;\n amount: string | null;\n asset: string;\n assetIssuer: string | null;\n memo: string;\n msg: string | null;\n callback: string | null;\n xdr: string | null;\n uri: string;\n qr: string;\n txHash: string | null;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of payment intents. */\nexport interface PaymentIntentListData {\n data: PaymentIntentData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/payment-intents/:id/validate`. */\nexport interface ValidatePaymentIntentOptions {\n /** Hash of the submitted Stellar transaction to validate against this intent. */\n txHash: string;\n}\n\n/** Raw outcome of a validation attempt. */\nexport interface ValidationOutcomeData {\n valid: boolean;\n status: PaymentIntentStatus;\n reason?: string | null;\n paymentIntent?: PaymentIntentData;\n}\n\n/** Raw `{ id, deleted }` response. */\nexport interface DeletedData {\n id: string;\n deleted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Webhooks\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/webhooks`. */\nexport interface CreateWebhookEndpointOptions {\n /** HTTPS URL that will receive POSTed event notifications. */\n url: string;\n description?: string;\n /** Event types to subscribe to. Omit/empty to receive all events. */\n eventTypes?: WebhookEventType[];\n}\n\n/** Body for `PATCH /v1/webhooks/:id`. */\nexport interface UpdateWebhookEndpointOptions {\n url?: string;\n description?: string;\n /** Pause/resume deliveries to this endpoint. */\n enabled?: boolean;\n eventTypes?: WebhookEventType[];\n}\n\n/** Raw webhook endpoint payload. */\nexport interface WebhookEndpointData {\n id: string;\n url: string;\n description: string | null;\n enabled: boolean;\n eventTypes: WebhookEventType[];\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw webhook endpoint payload including the one-time signing secret. */\nexport interface WebhookEndpointWithSecretData extends WebhookEndpointData {\n /** HMAC signing secret — shown once. Store it securely. */\n secret: string;\n}\n\n/** Raw result of a webhook ping. */\nexport interface WebhookPingData {\n ok: boolean;\n responseStatus: number | null;\n error: string | null;\n}\n\n/** Raw webhook delivery (audit) record. */\nexport interface WebhookDeliveryData {\n id: string;\n endpointId: string;\n eventType: WebhookEventType;\n eventId: string;\n payload: Record<string, unknown>;\n status: WebhookDeliveryStatus;\n attempts: number;\n responseStatus: number | null;\n error: string | null;\n lastAttemptAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of webhook deliveries. */\nexport interface WebhookDeliveryListData {\n data: WebhookDeliveryData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Query for `GET /v1/webhooks/:id/deliveries`. */\nexport interface ListWebhookDeliveriesOptions {\n status?: WebhookDeliveryStatus;\n take?: number;\n skip?: number;\n}\n\n/** Shape of the JSON body POSTed to an integrator's webhook URL. */\nexport interface WebhookEvent<T = PaymentIntentData> {\n /** Stable event id (use for idempotency). */\n id: string;\n type: WebhookEventType;\n createdAt: string;\n data: T;\n}\n\n/** What each webhook event carries in `data`. */\nexport interface WebhookEventDataMap {\n PAYMENT_INTENT_CREATED: PaymentIntentData;\n PAYMENT_INTENT_UPDATED: PaymentIntentData;\n PAYMENT_INTENT_SUCCEEDED: PaymentIntentData;\n PAYMENT_INTENT_FAILED: PaymentIntentData;\n PAYMENT_INTENT_CANCELLED: PaymentIntentData;\n PAYMENT_INTENT_DELETED: PaymentIntentData;\n /** Identity and state only — ids, status, rails; never personal data. */\n RECEIVER_UPDATED: Record<string, unknown>;\n PAYIN_CREATED: Record<string, unknown>;\n PAYIN_UPDATED: Record<string, unknown>;\n PAYIN_COMPLETED: Record<string, unknown>;\n PAYOUT_CREATED: Record<string, unknown>;\n PAYOUT_UPDATED: Record<string, unknown>;\n PAYOUT_COMPLETED: Record<string, unknown>;\n /** A Stellar swap, or a Solana / Monad one (it carries `chain`). */\n SWAP_CREATED: SwapData | ChainSwapData;\n SWAP_SUBMITTED: SwapData | ChainSwapData;\n SWAP_SUCCEEDED: SwapData | ChainSwapData;\n SWAP_FAILED: SwapData | ChainSwapData;\n LIQUIDITY_CREATED: LiquidityOperationData;\n LIQUIDITY_SUBMITTED: LiquidityOperationData;\n LIQUIDITY_SUCCEEDED: LiquidityOperationData;\n LIQUIDITY_FAILED: LiquidityOperationData;\n CROSS_CHAIN_SWAP_CREATED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_UPDATED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_SUCCEEDED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_REFUNDED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_FAILED: CrossChainSwapData;\n CROSS_CHAIN_SWAP_EXPIRED: CrossChainSwapData;\n}\n\n/** One webhook event of a known type, with `data` typed for it. */\nexport type TypedWebhookEvent<K extends keyof WebhookEventDataMap> = Omit<\n WebhookEvent<WebhookEventDataMap[K]>,\n 'type'\n> & { type: K };\n\n/** Any webhook event — narrow on `type` to get `data` typed. */\nexport type AnyWebhookEvent = {\n [K in keyof WebhookEventDataMap]: TypedWebhookEvent<K>;\n}[keyof WebhookEventDataMap];\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Products\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/products`. */\nexport interface CreateProductOptions {\n name: string;\n description?: string;\n /** Decimal price (≤ 7 decimals). Omit for a customer-set amount. */\n amount?: string;\n /** Asset code the price is in. Omit for native lumens (XLM). */\n assetCode?: string;\n kind?: ProductKind;\n active?: boolean;\n reference?: string;\n}\n\n/** Body for `PATCH /v1/products/:id`. */\nexport type UpdateProductOptions = Partial<CreateProductOptions>;\n\n/** Raw product payload. */\nexport interface ProductData {\n id: string;\n name: string;\n description: string | null;\n amount: string | null;\n asset: string;\n kind: ProductKind;\n active: boolean;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Customers\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The chains a customer's wallet can be on: the chains payments settle on. */\nexport type CustomerWalletChain = 'stellar' | 'solana' | 'monad';\n\n/**\n * Body for `POST /v1/customers/:id/wallets`, and one entry of\n * {@link CreateCustomerOptions.wallets}: one wallet of a customer, the chain it\n * is on and its address there.\n */\nexport interface AddCustomerWalletOptions {\n /** The chain the wallet is on. */\n chain: CustomerWalletChain;\n /**\n * The address on that chain: a Stellar account (G..., checksum verified), a\n * Solana address (base58, 32 bytes) or a Monad address (0x + 40 hex, any case;\n * stored EIP-55 checksummed). Payment intents whose payer (`source`) is this\n * address count toward the customer.\n */\n address: string;\n /** A name for the wallet, shown beside the address. */\n label?: string;\n}\n\n/** Body for `POST /v1/customers`. */\nexport interface CreateCustomerOptions {\n name: string;\n alias?: string;\n note?: string;\n email?: string;\n /**\n * The customer's wallets, on any chain payments settle on, up to 20. Payment\n * intents paid from any of them count toward the customer. A wallet that\n * another of your customers already holds answers `409 customer_wallet_taken`.\n */\n wallets?: AddCustomerWalletOptions[];\n /**\n * @deprecated Use `wallets`. One wallet, its chain read from its shape (a\n * Stellar, Solana or Monad address); it is added to `wallets`.\n */\n account?: string;\n reference?: string;\n}\n\n/** Body for `PATCH /v1/customers/:id`. Wallets change through their own routes. */\nexport type UpdateCustomerOptions = Partial<Omit<CreateCustomerOptions, 'wallets'>>;\n\n/** A wallet of a customer, on one chain, as the API returns it. */\nexport interface CustomerWalletData {\n /** Wallet id, used to remove it from the customer. */\n id: string;\n chain: CustomerWalletChain;\n /** The address, in its chain's stored spelling (EIP-55 on Monad). */\n address: string;\n /** A name for the wallet; null when none was given. */\n label?: string | null;\n /** When the wallet was added (ISO 8601). */\n createdAt: string;\n}\n\n/** Confirmation that a wallet was removed from a customer. */\nexport interface CustomerWalletDeletedData {\n /** Id of the removed wallet. */\n id: string;\n /** Always true. */\n deleted: boolean;\n}\n\n/**\n * Raw customer payload.\n *\n * There is no `consumerId`: the API stopped sending it, because the owning\n * consumer is the key that made the call and an internal id is not part of the\n * contract.\n */\nexport interface CustomerData {\n id: string;\n name: string;\n alias: string | null;\n note: string | null;\n email: string | null;\n /** The customer's wallets, oldest first, on any chain payments settle on. */\n wallets: CustomerWalletData[];\n /** @deprecated Read `wallets`. The first wallet's address; null without wallets. */\n account: string | null;\n reference: string | null;\n createdAt: string;\n updatedAt: string;\n /** Derived on-chain stats (present in list responses). */\n payments?: number;\n succeeded?: number;\n total?: string;\n}\n\n/** Raw `{ data, total }` list of customers. */\nexport interface CustomerListData {\n data: CustomerData[];\n total: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Analytics\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface AnalyticsVolumeEntry {\n asset: string;\n amount: string;\n count: number;\n}\n\nexport interface AnalyticsSeriesPoint {\n date: string;\n count: number;\n volume: string;\n}\n\nexport interface AnalyticsRecentRow {\n id: string;\n kind: string;\n status: PaymentIntentStatus;\n amount: string | null;\n asset: string;\n destination: string;\n createdAt: string;\n}\n\n/** Raw overview metrics returned by `GET /v1/summary`. */\nexport interface AnalyticsSummaryData {\n totals: {\n all: number;\n succeeded: number;\n pending: number;\n submitted: number;\n failed: number;\n cancelled: number;\n expired: number;\n successRate: number;\n };\n volume: AnalyticsVolumeEntry[];\n webhooks: {\n endpoints: number;\n deliveries: number;\n failedDeliveries: number;\n };\n customers: number;\n series: AnalyticsSeriesPoint[];\n recent: AnalyticsRecentRow[];\n}\n\nexport interface AnalyticsBalanceEntry {\n asset: string;\n amount: string;\n pending: string;\n count: number;\n}\n\n/** Raw balances returned by `GET /v1/balances`. */\nexport interface AnalyticsBalancesData {\n data: AnalyticsBalanceEntry[];\n total: number;\n}\n\nexport interface ApiLogRow {\n id: string;\n method: string;\n path: string;\n statusCode: number;\n durationMs: number;\n ip: string | null;\n userAgent: string | null;\n status: 'ok' | 'pending' | 'fail';\n at: string;\n}\n\n/** Raw API request log returned by `GET /v1/logs`. */\nexport interface ApiLogsData {\n data: ApiLogRow[];\n total: number;\n}\n\nexport interface WebhookLogRow {\n id: string;\n endpointId: string;\n url: string | null;\n eventType: WebhookEventType;\n eventId: string;\n attempts: number;\n responseStatus: number | null;\n error: string | null;\n status: 'ok' | 'pending' | 'fail';\n at: string;\n}\n\n/** Raw webhook delivery log returned by `GET /v1/logs/webhooks`. */\nexport interface WebhookLogsData {\n data: WebhookLogRow[];\n total: number;\n}\n\n/**\n * How `GET /v1/summary/series` groups its buckets (UTC, weeks from Monday):\n * `day` is 30 days, `week` 12 weeks, `month` 12 months and `year` 5 years.\n */\nexport type AnalyticsSeriesPeriod = 'day' | 'week' | 'month' | 'year';\n\n/** Query for `GET /v1/summary/series`. */\nexport interface AnalyticsSeriesOptions {\n /** The bucket size; the server's default is `day`. */\n period?: AnalyticsSeriesPeriod;\n}\n\n/** Payment intents created in one bucket of the series. */\nexport interface AnalyticsSeriesBucket {\n /** The first day of the bucket (UTC; weeks start on Monday), e.g. `2026-10-01`. */\n start: string;\n /** Payments created in the bucket, any status. */\n count: number;\n /** Of those, the ones settled (status `SUCCEEDED`). */\n succeeded: number;\n /** Failed, cancelled or expired. */\n failed: number;\n /** Settled volume, every asset added, as a decimal string. */\n volume: string;\n /**\n * Settled volume in USD with two decimals, at NEAR Intents' current reference\n * price for each asset (indicative, today's price). Null only when the bucket\n * has settled payments and those prices could not be read.\n */\n volumeUsd: string | null;\n}\n\n/** Payment intent totals for a whole window of the series. */\nexport interface AnalyticsSeriesWindow {\n /** Payment intents created in the window, any status. */\n count: number;\n succeeded: number;\n /** Failed, cancelled or expired. */\n failed: number;\n /** Settled amount, every asset added, as a decimal string. */\n volume: string;\n /** Settled amount in USD (indicative); null when prices could not be read. */\n volumeUsd: string | null;\n /** Settled payments `volumeUsd` leaves out because their asset has no USD price. */\n unpriced: number;\n}\n\n/** {@link AnalyticsSeriesWindow} for the window the buckets cover, plus its distinct payers. */\nexport interface AnalyticsSeriesTotals extends AnalyticsSeriesWindow {\n /** Distinct paying accounts in the window. */\n payers: number;\n}\n\n/** Swaps or liquidity operations by outcome, for a bucket or a window. */\nexport interface AnalyticsSeriesOutcomeCounts {\n /** Created in the bucket or window, any status. */\n count: number;\n /** Of those, the ones that succeeded (for a USDT0 transfer, delivered). */\n succeeded: number;\n /** Given up on: failed or expired (and, for a cross-chain swap, refunded). */\n failed: number;\n}\n\n/** Swaps of every kind created in one bucket, with the USD value of the completed ones. */\nexport interface AnalyticsSeriesSwapBucket extends AnalyticsSeriesOutcomeCounts {\n /** The first day of the bucket, the same as the payments bucket at that index. */\n start: string;\n /** What the completed swaps sold, in USD (indicative); null when no price could be read. */\n volumeUsd: string | null;\n}\n\n/** A window's swaps split by kind, any status. */\nexport interface AnalyticsSeriesSwapsByKind {\n /** Stellar DEX swaps. */\n dex: number;\n /** Solana (Jupiter) and Monad (Kuru Flow) swaps. Mainnet only. */\n chain: number;\n /** Swaps between networks through NEAR Intents. Mainnet only. */\n crossChain: number;\n /** USDT0 sent from Stellar to an EVM network through LayerZero. Mainnet only. */\n usdt0: number;\n}\n\n/** Swap totals for the window the buckets cover. */\nexport interface AnalyticsSeriesSwapTotals extends AnalyticsSeriesOutcomeCounts {\n /** Not final yet: unsigned, submitted, or a cross-chain swap awaiting or processing its deposit. */\n inProgress: number;\n byKind: AnalyticsSeriesSwapsByKind;\n /** What the completed swaps sold, in USD (indicative); null when no price could be read. */\n volumeUsd: string | null;\n /** Completed swaps whose sold asset has no USD price, left out of `volumeUsd`. */\n unpriced: number;\n}\n\n/** Swap totals for the window of the same length just before the current one. */\nexport interface AnalyticsSeriesSwapPrevious extends AnalyticsSeriesOutcomeCounts {\n volumeUsd: string | null;\n}\n\n/**\n * Swaps of every kind (Stellar DEX, Solana and Monad, cross-chain, USDT0) on the\n * key's network. A sandbox key counts no Solana, Monad, cross-chain swap or USDT0\n * transfer, which run on mainnet only.\n */\nexport interface AnalyticsSeriesSwaps {\n buckets: AnalyticsSeriesSwapBucket[];\n totals: AnalyticsSeriesSwapTotals;\n previous: AnalyticsSeriesSwapPrevious;\n}\n\n/** Liquidity pool deposits and withdrawals created in one bucket. */\nexport interface AnalyticsSeriesLiquidityBucket extends AnalyticsSeriesOutcomeCounts {\n start: string;\n}\n\n/** Liquidity pool operations on the key's network. */\nexport interface AnalyticsSeriesLiquidity {\n buckets: AnalyticsSeriesLiquidityBucket[];\n totals: AnalyticsSeriesOutcomeCounts;\n previous: AnalyticsSeriesOutcomeCounts;\n}\n\n/** Webhook deliveries created in one bucket. */\nexport interface AnalyticsSeriesWebhookBucket {\n start: string;\n /** Deliveries created in the bucket, any status. */\n deliveries: number;\n /** Of those, the ones whose last attempt failed. */\n failed: number;\n}\n\n/** Webhook deliveries created in a window. */\nexport interface AnalyticsSeriesWebhookCounts {\n deliveries: number;\n failed: number;\n}\n\n/** Webhook deliveries to the consumer's endpoints (not scoped by network). */\nexport interface AnalyticsSeriesWebhooks {\n buckets: AnalyticsSeriesWebhookBucket[];\n totals: AnalyticsSeriesWebhookCounts;\n previous: AnalyticsSeriesWebhookCounts;\n}\n\n/** Private payments created in one bucket, amounts in XLM. */\nexport interface AnalyticsSeriesPrivatePaymentBucket {\n start: string;\n /** Private payments created in the bucket, any status. */\n count: number;\n /** Settled: both transfers confirmed. */\n succeeded: number;\n /** Past their deadline without settling. */\n expired: number;\n /** Settled amount in XLM, what the payers paid (the commission included). */\n volume: string;\n /** Settled amount in USD (indicative); null when prices could not be read. */\n volumeUsd: string | null;\n}\n\n/** Private payment totals for a window, amounts in XLM. */\nexport interface AnalyticsSeriesPrivatePaymentWindow {\n count: number;\n succeeded: number;\n expired: number;\n /** Settled amount in XLM, the commission included. */\n volume: string;\n volumeUsd: string | null;\n /** Commission the settled payments paid to Cosmos Pay, in XLM (0.18% of each). */\n fees: string;\n /** The commission in USD (indicative); null when prices could not be read. */\n feesUsd: string | null;\n}\n\n/**\n * Private payments on the key's network. They run on testnet only for now, so a\n * production key counts none.\n */\nexport interface AnalyticsSeriesPrivatePayments {\n buckets: AnalyticsSeriesPrivatePaymentBucket[];\n totals: AnalyticsSeriesPrivatePaymentWindow;\n previous: AnalyticsSeriesPrivatePaymentWindow;\n}\n\n/**\n * Raw activity series returned by `GET /v1/summary/series`: payments, swaps,\n * liquidity operations, webhook deliveries and private payments, each grouped\n * into the UTC buckets of `period`, with the totals of the window and of the\n * window before (for growth). Every `buckets` array is oldest first and\n * pre-seeded, so a quiet bucket is a zero.\n */\nexport interface AnalyticsSeriesData {\n /** How the buckets are grouped, as requested (`day` when omitted). */\n period: AnalyticsSeriesPeriod;\n /** Payment intents per bucket. */\n buckets: AnalyticsSeriesBucket[];\n /** Payment intent totals for the window the buckets cover. */\n totals: AnalyticsSeriesTotals;\n /** The window of the same length just before it. */\n previous: AnalyticsSeriesWindow;\n swaps: AnalyticsSeriesSwaps;\n liquidity: AnalyticsSeriesLiquidity;\n webhooks: AnalyticsSeriesWebhooks;\n /** Private payments (the API names this field after its `/v1/zk-payments` route). */\n zkPayments: AnalyticsSeriesPrivatePayments;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Health\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface HealthCheckData {\n status: string;\n info?: Record<string, { status: string } & Record<string, unknown>> | null;\n error?: Record<string, { status: string } & Record<string, unknown>> | null;\n details?: Record<string, { status: string } & Record<string, unknown>>;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Swaps\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * The chain a same-chain swap runs on. `stellar` (the default when omitted) is\n * the Stellar DEX; `solana` goes through Jupiter and `monad` through Kuru Flow,\n * both mainnet only.\n */\nexport type SwapChain = 'stellar' | 'solana' | 'monad';\n\n/** The chains off Stellar, whose swaps come back as a {@link ChainSwapData}. */\nexport type OtherSwapChain = Exclude<SwapChain, 'stellar'>;\n\n/** Body for `POST /v1/swaps/quote` (pricing only; no fee parameter — the fee is enforced server-side per organization). */\nexport interface QuoteSwapOptions {\n /** Which chain to swap on. Omitted means Stellar. */\n chain?: SwapChain;\n /** Amount to send, as a decimal string in the asset's own units (max 7 decimals on Stellar). */\n amount: string;\n /**\n * Stellar: asset code (omit, `XLM` or `native` for lumens). Solana / Monad:\n * `SOL` / `MON`, `native`, or the SPL mint / ERC-20 address.\n */\n sourceAssetCode?: string;\n /** Stellar only: issuer account for a non-native source asset. */\n sourceAssetIssuer?: string;\n /** The asset the swap should deliver, spelled as for `sourceAssetCode`. */\n destAssetCode: string;\n /** Stellar only: issuer account for a non-native destination asset. */\n destAssetIssuer?: string;\n /** Allowed slippage in basis points. */\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/swaps`. */\nexport interface CreateSwapOptions extends QuoteSwapOptions {\n /** Source account performing (and signing) the swap, on `chain`. A registered address-book name also works on Stellar. */\n source: string;\n /** Stellar only: account that receives the swapped asset. Defaults to the source. */\n destination?: string;\n /** Stellar only: MEMO_ID (numeric uint64) for idempotency + on-chain identification. */\n memo?: string;\n /** Idempotency key (the `Idempotency-Key` header is preferred when both are set). */\n idempotencyKey?: string;\n}\n\n/**\n * Body for `POST /v1/swaps/:id/submit`: `signedXdr` for a Stellar swap,\n * `signedTransaction` for a Solana or Monad one.\n */\nexport type SubmitSwapOptions =\n | {\n /** Signed transaction envelope (base64 XDR) to relay to the Stellar network. */\n signedXdr: string;\n signedTransaction?: never;\n }\n | {\n /**\n * Solana: base64 wire bytes of the signed VersionedTransaction. Monad: the\n * `0x`-hex raw signed EIP-1559 transaction.\n */\n signedTransaction: string;\n signedXdr?: never;\n };\n\n/** Query for `GET /v1/swaps`. */\nexport interface ListSwapsOptions {\n /** Which chain to list. Omitted means Stellar. */\n chain?: SwapChain;\n status?: SwapStatus;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Raw swap payload returned by the API. */\nexport interface SwapData {\n id: string;\n status: SwapStatus;\n network: string;\n source: string;\n destination: string;\n sendAsset: string;\n sendAssetIssuer: string | null;\n sendAmount: string;\n feeAmount: string;\n feeBps: number;\n swapAmount: string;\n destAsset: string;\n destAssetIssuer: string | null;\n destEstimated: string;\n destMin: string;\n slippageBps: number;\n path: { code: string; issuer: string | null }[];\n memo: string | null;\n xdr: string;\n uri: string;\n txHash: string;\n qr: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of swaps. */\nexport interface SwapListData {\n data: SwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw pricing quote returned by `POST /v1/swaps/quote`. */\nexport interface SwapQuoteData {\n network: string;\n /** Solana and Monad quotes only. */\n chain?: OtherSwapChain;\n /** The aggregator that priced a Solana or Monad swap. */\n provider?: 'jupiter' | 'kuru';\n source: { asset: string; issuer: string | null; amount: string };\n /** Stellar takes the fee from the source asset; Solana and Monad from the output (`asset` says which). */\n fee: { asset: string; issuer: string | null; amount: string; bps: number; wallet: string | null };\n swap: { asset: string; issuer: string | null; amount: string };\n destination: {\n asset: string;\n issuer: string | null;\n estimated: string;\n minimum: string;\n slippageBps: number;\n };\n path: { code: string; issuer: string | null }[];\n}\n\n/** Raw outcome of relaying a signed swap transaction. */\nexport interface SwapSubmitOutcomeData {\n submitted: boolean;\n status: SwapStatus;\n txHash?: string;\n reason?: string;\n resultCodes?: string[];\n swap: SwapData;\n}\n\n/**\n * What a Solana or Monad swap's wallet signs. Solana: an unsigned\n * VersionedTransaction; Monad: a call the wallet signs as an EIP-1559\n * transaction, filling in nonce and gas itself.\n */\nexport type ChainSwapTransaction =\n | { encoding: 'base64'; data: string; lastValidBlockHeight?: number }\n | { to: string; data: string; value: string; chainId: number };\n\n/** An EVM call the wallet sends itself (a Monad ERC-20 `approve`). */\nexport interface EvmCallData {\n to: string;\n data: string;\n value: string;\n chainId: number;\n}\n\n/** Raw Solana or Monad swap (`chain_swap`), built by Jupiter or Kuru Flow. */\nexport interface ChainSwapData {\n id: string;\n chain: OtherSwapChain;\n /** Always `public`: the aggregators run on mainnet only. */\n network: string;\n provider: 'jupiter' | 'kuru';\n status: SwapStatus;\n /** The wallet that signs, pays and receives. */\n source: string;\n /** `native` (SOL / MON), or the SPL mint / ERC-20 address. */\n sendAsset: string;\n sendAmount: string;\n destAsset: string;\n /** Quoted output, net of the commission. */\n destEstimated: string;\n /** On-chain minimum after slippage. */\n destMin: string;\n feeBps: number;\n /** The commission, in the destination asset (taken from the output). */\n feeAmount: string;\n slippageBps: number;\n path: { code: string; issuer: string | null }[];\n transaction: ChainSwapTransaction;\n /** Monad, selling an ERC-20 with too small an allowance: send and confirm this first. */\n approval: EvmCallData | null;\n /** The Solana signature / EVM hash, once submitted. */\n txHash: string | null;\n idempotencyKey: string | null;\n /** Submit refuses the transaction after this; build a new swap. */\n expiresAt: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of Solana or Monad swaps. */\nexport interface ChainSwapListData {\n data: ChainSwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw outcome of relaying a signed Solana or Monad swap. */\nexport interface ChainSwapSubmitOutcomeData {\n submitted: boolean;\n status: SwapStatus;\n txHash: string;\n swap: ChainSwapData;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Cross-chain swaps (NEAR Intents)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Where a cross-chain swap stands. SUCCEEDED, REFUNDED and FAILED are final. */\nexport const CrossChainSwapStatus = {\n AwaitingDeposit: 'AWAITING_DEPOSIT',\n DepositDetected: 'DEPOSIT_DETECTED',\n IncompleteDeposit: 'INCOMPLETE_DEPOSIT',\n Processing: 'PROCESSING',\n Succeeded: 'SUCCEEDED',\n Refunded: 'REFUNDED',\n Failed: 'FAILED',\n Expired: 'EXPIRED',\n} as const;\nexport type CrossChainSwapStatus =\n (typeof CrossChainSwapStatus)[keyof typeof CrossChainSwapStatus];\n\n/** A token NEAR Intents can swap on one of the supported chains. */\nexport interface CrossChainAssetData {\n chain: SwapChain;\n symbol: string;\n /** NEAR Intents' id for the asset. */\n assetId: string;\n decimals: number;\n /** SPL mint, ERC-20 address or Stellar issuer; null for the native coin. */\n contract: string | null;\n}\n\n/**\n * Body for `POST /v1/cross-chain-swaps/quote`. Both legs on one chain is not a\n * cross-chain swap — use `client.swaps` with `chain`.\n */\nexport interface QuoteCrossChainSwapOptions {\n originChain: SwapChain;\n /** Native ticker, a symbol listed once, a contract, or Stellar `CODE:ISSUER`. */\n originAsset: string;\n destinationChain: SwapChain;\n destinationAsset: string;\n /** Gross amount of the origin asset, in its own units. */\n amount: string;\n /** Who receives the output, on `destinationChain`. */\n recipient: string;\n /** Where a failed or late deposit is refunded, on `originChain`. */\n refundTo: string;\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/cross-chain-swaps`. */\nexport interface CreateCrossChainSwapOptions extends QuoteCrossChainSwapOptions {\n idempotencyKey?: string;\n}\n\n/** Raw cross-chain quote. */\nexport interface CrossChainQuoteData {\n network: string;\n origin: {\n chain: SwapChain;\n asset: string;\n assetId: string;\n contract: string | null;\n amount: string;\n amountUsd: string | null;\n };\n destination: {\n chain: SwapChain;\n asset: string;\n assetId: string;\n contract: string | null;\n amount: string;\n amountUsd: string | null;\n /** Below this NEAR Intents refunds instead of filling. */\n minimum: string;\n };\n /** The plan commission, taken by NEAR Intents out of the input. */\n fee: { bps: number; amount: string; asset: string };\n slippageBps: number;\n timeEstimateSeconds: number;\n}\n\n/** A settlement transaction NEAR Intents reports. */\nexport interface CrossChainTransactionData {\n hash: string;\n explorerUrl: string;\n}\n\n/** Raw cross-chain swap. */\nexport interface CrossChainSwapData {\n id: string;\n status: CrossChainSwapStatus;\n /** NEAR Intents' own status word, verbatim. */\n providerStatus: string;\n network: string;\n originChain: SwapChain;\n originAsset: string;\n originContract: string | null;\n destinationChain: SwapChain;\n destinationAsset: string;\n destinationContract: string | null;\n amountIn: string;\n feeBps: number;\n feeAmount: string;\n amountOutEstimated: string;\n amountOutMin: string;\n slippageBps: number;\n recipient: string;\n refundTo: string;\n /** Send exactly `amountIn` of the origin asset here. */\n depositAddress: string;\n /** Stellar only, and required: attach it as a MEMO_TEXT. */\n depositMemo: string | null;\n /** The deposit as a wallet link: SEP-7 pay, Solana Pay or EIP-681. */\n depositUri: string;\n /** QR of `depositUri` (PNG data URL); absent from list rows. */\n qr?: string;\n depositTxHash: string | null;\n amountOut: string | null;\n refundedAmount: string | null;\n originTxHashes: CrossChainTransactionData[] | null;\n destinationTxHashes: CrossChainTransactionData[] | null;\n timeEstimateSeconds: number;\n correlationId: string;\n /** NEAR Intents' signature over the quote and deposit address — keep it. */\n quoteSignature: string;\n idempotencyKey: string | null;\n expiresAt: string;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Query for `GET /v1/cross-chain-swaps`. */\nexport interface ListCrossChainSwapsOptions {\n status?: CrossChainSwapStatus;\n take?: number;\n skip?: number;\n}\n\n/** Raw paginated list of cross-chain swaps. */\nexport interface CrossChainSwapListData {\n data: CrossChainSwapData[];\n total: number;\n take: number;\n skip: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Liquidity pools\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/liquidity-pools/deposit`. */\nexport interface DepositLiquidityOptions {\n /** Account whose funds go in, and which signs. An address-book name also works. */\n source: string;\n /** Asset A code. Omit (or `XLM`/`native`) for native lumens. */\n assetACode?: string;\n /** Issuer for a non-native asset A. */\n assetAIssuer?: string;\n /** Asset B code. */\n assetBCode?: string;\n /** Issuer for a non-native asset B. */\n assetBIssuer?: string;\n /** Ceiling on how much of asset A may go in, as a decimal string. */\n maxAmountA: string;\n /** Ceiling on how much of asset B may go in. */\n maxAmountB: string;\n /** Allowed price movement in basis points. */\n slippageBps?: number;\n /** MEMO_ID (numeric uint64) for on-chain identification. */\n memo?: string;\n /**\n * Idempotency token. Sent both as the body field and as the `Idempotency-Key`\n * header, which is what makes a retried deposit return the FIRST operation\n * instead of building a second one against the same funds.\n */\n idempotencyKey?: string;\n}\n\n/** Body for `POST /v1/liquidity-pools/withdraw`. */\nexport interface WithdrawLiquidityOptions {\n /** Account holding the shares, and which signs. */\n source: string;\n /** The pool to withdraw from (hex id). */\n poolId: string;\n /** Pool shares to burn, as a decimal string. */\n shares: string;\n /** Allowed price movement in basis points. */\n slippageBps?: number;\n memo?: string;\n /** See {@link DepositLiquidityOptions.idempotencyKey}. */\n idempotencyKey?: string;\n}\n\n/** Body for `POST /v1/liquidity-pools/operations/:id/submit`. */\nexport interface SubmitLiquidityOptions {\n /** Signed transaction envelope (base64 XDR) to relay to the network. */\n signedXdr: string;\n}\n\n/** Query for `GET /v1/liquidity-pools/operations`. */\nexport interface ListLiquidityOperationsOptions {\n kind?: LiquidityOperationKind;\n status?: LiquidityOperationStatus;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Query for `GET /v1/liquidity-pools` (Horizon proxy). */\nexport interface BrowseLiquidityPoolsOptions {\n assetACode?: string;\n assetAIssuer?: string;\n assetBCode?: string;\n assetBIssuer?: string;\n /** Only pools this account holds shares in. */\n account?: string;\n /** Horizon paging cursor from a previous page. */\n cursor?: string;\n limit?: number;\n}\n\n/** One side of a pool's reserves. */\nexport interface LiquidityReserveData {\n asset: string;\n issuer: string | null;\n amount: string;\n}\n\n/** Raw on-chain pool payload (Horizon proxy). */\nexport interface LiquidityPoolData {\n id: string;\n network: string;\n /** Pool fee in basis points — 30 for every constant-product pool today. */\n feeBp: number;\n totalTrustlines: string;\n totalShares: string;\n reserves: LiquidityReserveData[];\n}\n\n/** Raw cursor-paginated list of pools. */\nexport interface LiquidityPoolListData {\n data: LiquidityPoolData[];\n cursor?: string | null;\n}\n\n/** One account's stake in one pool. */\nexport interface LiquidityPositionData {\n poolId: string;\n /** Shares this account holds. */\n shares: string;\n /** Shares in existence. */\n totalShares: string;\n /** The account's share of the pool, in basis points. */\n shareOfPoolBps: number;\n reserves: LiquidityReserveData[];\n /** What those shares would redeem for right now. */\n redeemable: LiquidityReserveData[];\n}\n\n/** Raw payload of `GET /v1/liquidity-pools/positions`. */\nexport interface LiquidityPositionsData {\n account: string;\n network: string;\n data: LiquidityPositionData[];\n}\n\n/** Raw liquidity operation payload returned by the API. */\nexport interface LiquidityOperationData {\n id: string;\n kind: LiquidityOperationKind;\n status: LiquidityOperationStatus;\n network: string;\n source: string;\n poolId: string;\n assetA: string;\n assetAIssuer: string | null;\n assetB: string;\n assetBIssuer: string | null;\n amountA: string;\n amountB: string;\n shares: string | null;\n minPrice: string | null;\n maxPrice: string | null;\n slippageBps: number;\n idempotencyKey: string | null;\n feeBps: number;\n feeAmountA: string;\n feeAmountB: string;\n feeWallet: string | null;\n commissionMemo: string | null;\n xdr: string;\n uri: string;\n txHash: string;\n qr: string;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of liquidity operations. */\nexport interface LiquidityOperationListData {\n data: LiquidityOperationData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw outcome of relaying a signed liquidity transaction. */\nexport interface LiquiditySubmitOutcomeData {\n submitted: boolean;\n status: LiquidityOperationStatus;\n txHash?: string;\n reason?: string;\n resultCodes?: string[];\n operation: LiquidityOperationData;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Activity (client event stream)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Where an event came from. */\nexport type ActivitySource = 'wallet' | 'dashboard' | 'server' | 'sdk';\n\n/** Severity of an event. */\nexport type ActivityLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/** One event to report. Always batched — see {@link ReportActivityOptions}. */\nexport interface ActivityEventInput {\n /** Dotted event name, e.g. `payment.submitted`. */\n type: string;\n /**\n * Client-generated id. The service de-duplicates on it, which is what makes a\n * retried batch safe: the second delivery is counted as a duplicate rather than\n * stored twice.\n */\n eventId?: string;\n source?: ActivitySource;\n level?: ActivityLevel;\n category?: string;\n message?: string;\n sessionId?: string;\n distinctId?: string;\n appVersion?: string;\n platform?: string;\n network?: string;\n durationMs?: number;\n /** Free-form properties. Never put secrets or memo text here. */\n props?: Record<string, unknown>;\n /** When it happened (ISO-8601). Defaults to arrival time. */\n occurredAt?: string;\n}\n\n/** Body for `POST /v1/activity/events`. */\nexport interface ReportActivityOptions {\n events: ActivityEventInput[];\n}\n\n/** Raw outcome of a reported batch. */\nexport interface ActivityReportData {\n accepted: number;\n /** Events whose `eventId` had already been stored. */\n duplicates: number;\n}\n\n/** Query for `GET /v1/activity/events`. */\nexport interface ListActivityOptions {\n take?: number;\n skip?: number;\n source?: ActivitySource;\n level?: ActivityLevel;\n category?: string;\n type?: string;\n network?: string;\n /** ISO-8601 lower bound (inclusive). */\n since?: string;\n /** ISO-8601 upper bound (exclusive). */\n until?: string;\n}\n\n/** One stored event. */\nexport interface ActivityEventData {\n id: string;\n source: string;\n level: string;\n category: string;\n type: string;\n message: string | null;\n sessionId: string | null;\n distinctId: string | null;\n appVersion: string | null;\n platform: string | null;\n network: string | null;\n durationMs: number | null;\n props: Record<string, unknown> | null;\n ip: string | null;\n userAgent: string | null;\n /** When it happened. */\n at: string;\n /** When the service stored it. */\n receivedAt: string;\n}\n\n/** Raw paginated list of events. */\nexport interface ActivityListData {\n data: ActivityEventData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** One `{ key, count }` bucket of an activity summary. */\nexport interface ActivityBucket {\n key: string;\n count: number;\n}\n\n/** Raw payload of `GET /v1/activity/summary`. */\nexport interface ActivitySummaryData {\n total: number;\n sessions: number;\n devices: number;\n levels: ActivityBucket[];\n sources: ActivityBucket[];\n categories: ActivityBucket[];\n topTypes: ActivityBucket[];\n topErrors: ActivityBucket[];\n series: { date: string; count: number; errors: number }[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// On-ramp (fiat -> stablecoin)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Stablecoins the ramps settle in. */\nexport type RampToken = 'USDC' | 'USDT' | 'USDB';\n\n/** Which side of a quote the requested amount refers to. */\nexport type CurrencyType = 'sender' | 'receiver';\n\n/** Fiat rails a payin can arrive over. */\nexport type PayinMethod =\n | 'ach'\n | 'wire'\n | 'pix'\n | 'ted'\n | 'spei'\n | 'transfers'\n | 'pse'\n | 'international_swift'\n | 'rtp';\n\n/** Payer restrictions, for the rails that require them. */\nexport interface PayinPayerRules {\n pix_allowed_tax_ids?: string[];\n transfers_allowed_tax_id?: string;\n pse_allowed_tax_ids?: string[];\n pse_full_name?: string;\n pse_document_type?: string;\n pse_document_number?: string;\n pse_email?: string;\n pse_phone?: string;\n pse_bank_code?: string;\n}\n\n/**\n * Body for `POST /v1/onramp/quotes`.\n *\n * The field names are snake_case because they are the RAMP PROVIDER's, and the\n * service passes them through unchanged. Renaming them here would look tidier and\n * would put a translation layer between two systems that already agree.\n */\nexport interface CreatePayinQuoteOptions {\n /** Wallet that receives the converted stablecoin. */\n blockchain_wallet_id: string;\n currency_type: CurrencyType;\n payment_method: PayinMethod;\n token: RampToken;\n /** Amount in MINOR units (e.g. cents). */\n request_amount: number;\n cover_fees?: boolean;\n payer_rules?: PayinPayerRules;\n is_otc?: boolean;\n partner_fee_id?: string;\n wallet_id?: string;\n}\n\n/** Raw payin quote. Expires quickly — read `expires_at` before acting on it. */\nexport interface PayinQuoteData {\n id: string;\n /** Unix seconds (~5 minutes out). */\n expires_at: number;\n commercial_quotation?: number;\n receiver_amount?: number;\n sender_amount?: number;\n}\n\n/** Body for `POST /v1/onramp/payins`. */\nexport interface CreatePayinOptions {\n payin_quote_id: string;\n}\n\n/** Query for `GET /v1/onramp/payins`. */\nexport interface ListPayinsOptions {\n take?: number;\n skip?: number;\n}\n\n/**\n * Raw payin. The scalar fields are mirrored locally; `instructions` is passed\n * through from the provider verbatim (memo / CLABE / PIX code / CBU / PSE link…),\n * so its shape depends on `paymentMethod` and is deliberately not narrowed here.\n */\nexport interface PayinData {\n id: string;\n blindpayId: string;\n status: string | null;\n token: string | null;\n network: string | null;\n paymentMethod: string | null;\n /** Minor units, as a decimal string. */\n senderAmount: string | null;\n receiverAmount: string | null;\n instructions: unknown;\n createdAt: string;\n}\n\n/** Raw paginated list of payins. */\nexport interface PayinListData {\n data: PayinData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/onramp/trustline`. */\nexport interface CreateTrustlineOptions {\n /** Stellar address that needs the asset trustline. */\n address: string;\n}\n\n/**\n * Raw trustline response — a provider passthrough, which is why it is an open\n * shape. It carries the unsigned envelope the customer signs; a wallet reads `xdr`\n * off it and must put that through its own signing guard before signing.\n */\nexport interface TrustlineData {\n xdr?: string;\n [key: string]: unknown;\n}\n\n/** Banking partners a virtual account can be opened with. */\nexport type BankingPartner = 'jpmorgan' | 'citi' | 'hsbc' | 'cfsb';\n\n/** Body for `POST /v1/onramp/receivers/:receiverId/virtual-accounts`. */\nexport interface CreateVirtualAccountOptions {\n banking_partner: BankingPartner;\n token: RampToken;\n /** Cosmos Pay wallet id that receives the converted stablecoin. */\n blockchain_wallet_id: string;\n signed_agreement_id?: string;\n sole_proprietor_doc_type?: string;\n sole_proprietor_doc_file?: string;\n}\n\n/** Raw virtual account — a provider passthrough. */\nexport type VirtualAccountData = Record<string, unknown>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Off-ramp (stablecoin -> fiat)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Chains a payout can be funded from. */\nexport type PayoutNetwork =\n | 'ethereum'\n | 'base'\n | 'arbitrum'\n | 'polygon'\n | 'stellar'\n | 'solana'\n | 'tron'\n | 'sepolia'\n | 'base_sepolia'\n | 'arbitrum_sepolia'\n | 'polygon_amoy'\n | 'stellar_testnet'\n | 'solana_devnet';\n\n/** Chain families the authorize / create steps distinguish. */\nexport type PayoutChain = 'evm' | 'stellar' | 'solana';\n\n/** Body for `POST /v1/offramp/quotes`. */\nexport interface CreatePayoutQuoteOptions {\n /** Destination bank account, belonging to a verified receiver. */\n bank_account_id: string;\n currency_type: CurrencyType;\n cover_fees?: boolean;\n /** Amount in MINOR units. */\n request_amount: number;\n network: PayoutNetwork;\n token: RampToken;\n description?: string;\n partner_fee_id?: string;\n}\n\n/** Raw payout quote. */\nexport interface PayoutQuoteData {\n id: string;\n /** Unix seconds (~5 minutes out). */\n expires_at: number;\n sender_amount?: number;\n /** Local fiat amount to receive, in minor units. */\n receiver_amount?: number;\n receiver_local_amount?: number;\n /** EVM `approve` payload to sign (abi, address, functionName, amount). */\n contract?: unknown;\n}\n\n/** Body for `POST /v1/offramp/payouts/authorize`. */\nexport interface AuthorizePayoutOptions {\n quote_id: string;\n sender_wallet_address: string;\n /** Only the chains that need an unsigned transaction built for them. */\n chain: 'stellar' | 'solana';\n}\n\n/**\n * Raw authorize response — the unsigned transaction, passed through from the\n * provider. Its `xdr` (Stellar) is what a wallet must bound against the quote the\n * user actually confirmed before signing it.\n */\nexport interface AuthorizePayoutData {\n xdr?: string;\n [key: string]: unknown;\n}\n\n/** Body for `POST /v1/offramp/payouts`. */\nexport interface CreatePayoutOptions {\n quote_id: string;\n sender_wallet_address: string;\n chain: PayoutChain;\n /** The signed transaction produced from `authorize` (or the EVM approval). */\n signed_transaction?: string;\n}\n\n/** Query for `GET /v1/offramp/payouts`. */\nexport interface ListPayoutsOptions {\n take?: number;\n skip?: number;\n}\n\n/** Raw payout. Same mirroring rules as {@link PayinData}. */\nexport interface PayoutData {\n id: string;\n blindpayId: string;\n status: string | null;\n token: string | null;\n network: string | null;\n /** Fiat rail the money lands on. */\n rail: string | null;\n senderAmount: string | null;\n receiverAmount: string | null;\n senderWalletAddress: string | null;\n createdAt: string;\n}\n\n/** Raw paginated list of payouts. */\nexport interface PayoutListData {\n data: PayoutData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/offramp/payouts/:id/documents`. */\nexport interface AttachPayoutDocumentOptions {\n transaction_document_type?: string;\n transaction_document_id?: string;\n /** Base64 (or data URL) of the document itself. */\n transaction_document_file?: string;\n description?: string;\n}\n\n/** Raw document response — a provider passthrough. */\nexport type PayoutDocumentData = Record<string, unknown>;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// KYC / KYB (receivers, wallets, bank accounts)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** A receiver is a person or a company. */\nexport type ReceiverType = 'individual' | 'business';\n\n/** How deep the verification goes. */\nexport type KycType = 'light' | 'standard' | 'enhanced';\n\n/** One beneficial owner of a business receiver. */\nexport interface ReceiverOwner {\n role?: string;\n first_name?: string;\n last_name?: string;\n date_of_birth?: string;\n tax_id?: string;\n country?: string;\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n postal_code?: string;\n /** Ownership percentage. */\n ownership_percentage?: number;\n title?: string;\n id_doc_country?: string;\n id_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n id_doc_front_file?: string;\n id_doc_back_file?: string;\n proof_of_address_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n proof_of_address_doc_file?: string;\n /** The owner's tax id type. */\n tax_type?: string;\n}\n\n/**\n * Body for `POST /v1/kyc/receivers`.\n *\n * Every `*_file` field takes a `file_url` returned by {@link KycManager.upload} —\n * not the bytes. Upload first, then create the receiver with the URLs.\n */\nexport interface CreateReceiverOptions {\n type: ReceiverType;\n kyc_type: KycType;\n email: string;\n /** ISO 3166-1 alpha-2 country code. */\n country: string;\n first_name?: string;\n last_name?: string;\n /** ISO-8601 datetime. A date-only value is rejected upstream. */\n date_of_birth?: string;\n tax_id?: string;\n occupation?: string;\n id_doc_country?: string;\n id_doc_type?: string;\n /** `file_url` from `POST /v1/kyc/upload`. */\n id_doc_front_file?: string;\n id_doc_back_file?: string;\n selfie_file?: string;\n account_purpose?: string;\n account_purpose_other?: string;\n source_of_funds_doc_type?: string;\n source_of_funds_doc_file?: string;\n source_of_wealth?: string;\n /** `master_service_agreement` | `salary_slip` | `bank_statement`. */\n sole_proprietor_doc_type?: string;\n proof_of_address_doc_type?: string;\n proof_of_address_doc_file?: string;\n recipient_relationship?: string;\n purpose_of_transactions?: string;\n purpose_of_transactions_explanation?: string;\n legal_name?: string;\n alternate_name?: string;\n business_type?: string;\n business_industry?: string;\n business_description?: string;\n formation_date?: string;\n estimated_annual_revenue?: string;\n publicly_traded?: boolean;\n website?: string;\n incorporation_doc_file?: string;\n proof_of_ownership_doc_file?: string;\n owners?: ReceiverOwner[];\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n postal_code?: string;\n phone_number?: string;\n ip_address?: string;\n /** Your own id for this receiver. */\n external_id?: string;\n image_url?: string;\n /**\n * Accepted terms-of-service id, from the redirect of\n * {@link KycManager.termsOfService}. The provider requires it to create a\n * receiver, which is why ToS is the FIRST step of the flow rather than the last.\n */\n tos_id?: string;\n}\n\n/**\n * Body for `PATCH /v1/kyc/receivers/:id` — the same fields, all optional.\n *\n * Identity is reviewed before it reaches the provider, edits included. Until the\n * receiver is enabled, an edit that touches KYC data sends it back to\n * `pending_review`. Once it exists at the provider, a tenant key may change only\n * `external_id` and `image_url`; any other field is `403 kyc_review_required` unless\n * the key is elevated (`X-Consumer-Role: admin`), because that edit rewrites the\n * identity at the provider directly.\n */\nexport type UpdateReceiverOptions = Partial<CreateReceiverOptions>;\n\n/** Body for `POST /v1/kyc/receivers/:id/approve`. */\nexport interface ApproveReceiverOptions {\n redirect_url?: string;\n /**\n * The {@link ReceiverData.dossierVersion} this approval is for.\n *\n * Approving is a statement about KYC data someone read and accepted, and the\n * tenant can edit that data in between: an edit leaves the receiver in\n * `pending_review`, so without a version the approval lands on whatever is\n * stored when the request arrives and nobody can tell. Send it and a dossier\n * that moved on is a `409 kyc_state_invalid` — re-read, review again, approve\n * that version.\n *\n * {@link Receiver.approve} fills this in from the instance; omit it there only\n * if you mean \"approve whatever is stored now\".\n */\n expected_version?: number;\n}\n\n/** Body for `POST /v1/kyc/receivers/:id/tos`. */\nexport interface RequestTosOptions {\n /** `code` returns the URL to show; `email` sends it to the receiver. */\n channel: 'code' | 'email';\n redirect_url?: string;\n}\n\n/** Body for `POST /v1/kyc/receivers/:id/enable`. */\nexport interface EnableReceiverOptions {\n /** An accepted terms-of-service id. */\n tos_id: string;\n}\n\n/** Body for `PATCH /v1/kyc/receivers/:id/access`. */\nexport interface SetReceiverAccessOptions {\n /** `true` cuts this receiver off from both ramps — an admin kill switch. */\n disabled: boolean;\n}\n\n/** Query for the paginated KYC collections. */\nexport interface ListKycOptions {\n take?: number;\n skip?: number;\n}\n\n/** Raw receiver payload. `kycStatus` is refreshed from the provider on read. */\nexport interface ReceiverData {\n id: string;\n blindpayId: string;\n type: string;\n kycType: string | null;\n kycStatus: string | null;\n email: string | null;\n name: string | null;\n country: string | null;\n externalId: string | null;\n /** True when the receiver is cut off from the ramps. */\n disabled: boolean;\n /**\n * How many times the submitted KYC data has been written. Send it back as\n * `expected_version` when approving, so the approval cannot land on a dossier\n * nobody read.\n */\n dossierVersion: number;\n /**\n * The `dossierVersion` a reviewer approved, or null while unapproved. The\n * receiver cannot be enabled until it equals {@link ReceiverData.dossierVersion}\n * again, so an edit after approval sends it back through review.\n */\n reviewedVersion: number | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of receivers. */\nexport interface ReceiverListData {\n data: ReceiverData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Chains a receiver wallet can be registered on. */\nexport type ReceiverWalletNetwork =\n | 'ethereum'\n | 'base'\n | 'arbitrum'\n | 'polygon'\n | 'stellar'\n | 'solana'\n | 'tron'\n | 'sepolia';\n\n/** Body for `POST /v1/kyc/receivers/:receiverId/wallets`. */\nexport interface CreateReceiverWalletOptions {\n name?: string;\n network: ReceiverWalletNetwork;\n address: string;\n /**\n * Proof the receiver controls the address, for the secure-wallet flow: the hash\n * of the transaction that signed the message from\n * {@link KycManager.walletSignMessage}.\n */\n signature_tx_hash?: string;\n is_account_abstraction?: boolean;\n}\n\n/** Raw receiver wallet payload. */\nexport interface ReceiverWalletData {\n id: string;\n blindpayId: string;\n name: string | null;\n network: string;\n address: string | null;\n isAccountAbstraction: boolean;\n createdAt: string;\n}\n\n/** Raw paginated list of receiver wallets. */\nexport interface ReceiverWalletListData {\n data: ReceiverWalletData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Fiat rails a bank account can be opened on. */\nexport type BankRail =\n | 'wire'\n | 'ach'\n | 'rtp'\n | 'pix'\n | 'pix_safe'\n | 'ted'\n | 'spei_bitso'\n | 'transfers_bitso';\n\n/**\n * Body for `POST /v1/kyc/receivers/:receiverId/bank-accounts`.\n *\n * Only the fields every rail shares are named here. The rest — `pix_*`, `ted_*`,\n * `spei_*`, `swift_*`, `sepa_*`, `ach_cop_*`, some seventy of them — depend on\n * `type`, and the authority on which ones a given rail needs is\n * {@link KycManager.bankDetails}, at runtime. Enumerating them in a published type\n * would freeze a provider's field list into a release of this SDK and break the\n * day it adds a rail.\n */\nexport interface CreateBankAccountOptions {\n type: BankRail;\n /** Label for the account. */\n name: string;\n account_class?: 'individual' | 'business';\n account_type?: 'checking' | 'saving';\n beneficiary_name?: string;\n recipient_relationship?: string;\n account_number?: string;\n routing_number?: string;\n business_industry?: string;\n phone_number?: string;\n tax_id?: string;\n address_line_1?: string;\n address_line_2?: string;\n city?: string;\n state_province_region?: string;\n country?: string;\n postal_code?: string;\n /** Rail-specific fields. See `bankDetails(rail)` for the ones a rail requires. */\n [key: string]: unknown;\n}\n\n/** Raw bank account payload. */\nexport interface BankAccountData {\n id: string;\n blindpayId: string;\n rail: string | null;\n name: string | null;\n country: string | null;\n createdAt: string;\n}\n\n/** Raw paginated list of bank accounts. */\nexport interface BankAccountListData {\n data: BankAccountData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Body for `POST /v1/kyc/terms-of-service`. */\nexport interface InitiateTosOptions {\n redirect_url?: string;\n /** Attach the acceptance to an existing receiver. */\n receiver_id?: string;\n idempotency_key?: string;\n}\n\n/**\n * Raw terms-of-service response — a provider passthrough carrying the hosted URL\n * the receiver has to visit.\n */\nexport interface TermsOfServiceData {\n url?: string;\n [key: string]: unknown;\n}\n\n/** Raw upload response. `file_url` is what every `*_file` field expects. */\nexport interface KycUploadData {\n file_url?: string;\n [key: string]: unknown;\n}\n\n/** Raw response of the rails catalogue / a rail's field schema — passthroughs. */\nexport type KycRailsData = unknown;\nexport type BankDetailsData = unknown;\n\n/** Raw response of the wallet sign-message challenge — a provider passthrough. */\nexport interface WalletSignMessageData {\n message?: string;\n [key: string]: unknown;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Payment intent history\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** One status change of a payment intent — `GET /v1/payment-intents/{id}/transitions`. */\nexport interface PaymentIntentTransitionData {\n id: string;\n intentId: string;\n fromStatus: PaymentIntentStatus;\n toStatus: PaymentIntentStatus;\n txHash?: string | null;\n /** Who moved it: `api`, `validate`, `observer` or `system`. */\n actor: string;\n reason?: string | null;\n createdAt: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Asset registry\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Query for `GET /v1/assets`. */\nexport interface ListRegistryAssetsOptions {\n network?: 'public' | 'testnet';\n /** Only the entries whose issuer was checked against the named organization. */\n verified?: boolean;\n}\n\n/** One `(code, issuer)` pair the server vouches for — or lists, unverified. */\nexport interface RegistryAssetData {\n code: string;\n /** Issuing account, or `null` for native XLM. */\n issuer: string | null;\n name: string;\n /** Who issues it, for display next to the code. */\n issuerName: string;\n /** The issuer's own on-chain `home_domain`, or empty when it publishes none. */\n issuerDomain: string;\n /** The issuing account was checked against `issuerName` — identity, not quality. */\n verified: boolean;\n /** Stellar Asset Contract id, when wrapped for Soroban. */\n contract: string | null;\n flags: { authRevocable: boolean; clawback: boolean };\n}\n\n/** Raw `GET /v1/assets` response. */\nexport interface AssetRegistryData {\n network: 'public' | 'testnet';\n /** Monotonic registry version: compare it against a bundled copy. */\n version: number;\n data: RegistryAssetData[];\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Aliases (payment handles)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type AliasChallengePurpose = 'CLAIM' | 'ADD_ADDRESS' | 'RECOVER';\n\n/** One verified address an alias points at. */\nexport interface AliasAddressData {\n id: string;\n address: string;\n network: string;\n label?: string | null;\n /** The default for this network. */\n isPrimary: boolean;\n /** When this address proved control of itself. */\n verifiedAt: string;\n}\n\n/** `GET /v1/aliases/resolve/{name}` — where to pay a handle. */\nexport interface AliasResolutionData {\n name: string;\n displayName: string;\n /** Every verified address on the requested network, primary first. */\n addresses: AliasAddressData[];\n /** The address to pay when the payer did not choose one. */\n primaryAddress?: string | null;\n}\n\n/** `GET /v1/aliases/availability/{name}`. */\nexport interface AliasAvailabilityData {\n name: string;\n available: boolean;\n /** Why not, when unavailable: `taken`, `reserved`, `bad_characters`, … */\n reason?: string | null;\n}\n\n/** `GET /v1/aliases/by-address/{address}`. */\nexport interface AliasByAddressData {\n data: { name: string; displayName: string; network: string; isPrimary: boolean }[];\n}\n\n/** Body for `POST /v1/aliases/challenges`. */\nexport interface CreateAliasChallengeOptions {\n /** The handle being claimed. */\n name: string;\n address: string;\n /** Network id: `public`, `testnet`, or a custom id. */\n network: string;\n purpose?: AliasChallengePurpose;\n}\n\n/** A nonce to sign — `POST /v1/aliases/challenges`. */\nexport interface AliasChallengeData {\n nonce: string;\n /** The EXACT string to digest and sign. Sign this, never a string you rebuilt. */\n message: string;\n /** Domain tag the digest is framed with. */\n domain: string;\n purpose: AliasChallengePurpose;\n expiresAt: string;\n}\n\n/** Body for `POST /v1/aliases`. */\nexport interface ClaimAliasOptions {\n name: string;\n /** Recovery mailbox — required at claim time. */\n email: string;\n /** The nonce from a CLAIM challenge. */\n nonce: string;\n /** base64 ed25519 over the challenge digest. */\n signature: string;\n /** Human label for this first address. */\n label?: string;\n}\n\n/** Body for `POST /v1/aliases/{name}/addresses`. */\nexport interface AddAliasAddressOptions {\n address: string;\n network: string;\n /** The nonce from an ADD_ADDRESS challenge. */\n nonce: string;\n signature: string;\n label?: string;\n /** Make this the address a payer gets when they do not ask for one. */\n primary?: boolean;\n}\n\n/** Body for `POST /v1/aliases/{name}/recovery/complete`. */\nexport interface CompleteAliasRecoveryOptions {\n /** The token delivered by email. */\n token: string;\n /** The address that will own the alias from now on. */\n address: string;\n network: string;\n /** The nonce from a RECOVER challenge. */\n nonce: string;\n signature: string;\n}\n\n/** An alias the caller owns. */\nexport interface OwnedAliasData {\n id: string;\n /** Normalized handle — the form uniqueness is decided on. */\n name: string;\n /** As the claimant typed it. Display only. */\n displayName: string;\n status: 'ACTIVE' | 'SUSPENDED';\n addresses: AliasAddressData[];\n createdAt: string;\n email: string;\n emailVerifiedAt?: string | null;\n}\n\n/** Raw `GET /v1/aliases` page. */\nexport interface AliasListData {\n data: OwnedAliasData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** `DELETE` answers for aliases and alias addresses. */\nexport interface AliasDeletedData {\n id: string;\n deleted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Alias recovery (email)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Answer of `POST /v1/aliases/:name/recovery` — the same whether or not the mailbox matches. */\nexport interface AliasRecoveryStartedData {\n accepted: boolean;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Shared public key\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** The shared public API key an open-source wallet embeds, per environment. */\nexport interface PublicKeyData {\n env: 'dev' | 'prod';\n apiKey: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Plugins\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** A plugin this deployment serves, and this consumer's installation of it. */\nexport interface PluginData {\n slug: string;\n name: string;\n version: string;\n description: string;\n author: string;\n /** What the plugin may do; installing is consenting to exactly this list. */\n capabilities: string[];\n /** Hosts the plugin may call out to. */\n egress: string[];\n config: Record<string, unknown>;\n queries: unknown[];\n commands: unknown[];\n events: unknown[];\n /** Null when this consumer has not installed it. */\n installation: Record<string, unknown> | null;\n}\n\nexport interface PluginListData {\n data: PluginData[];\n}\n\n/** Body for `PUT /v1/plugins/:slug/installation`. */\nexport interface InstallPluginOptions {\n /** Exactly the capabilities the plugin declares — consent is all or nothing. */\n grantCapabilities: string[];\n config?: Record<string, unknown>;\n}\n\nexport interface PluginUninstalledData {\n slug: string;\n uninstalled: boolean;\n}\n\n/** Result of a plugin query or command. */\nexport interface PluginActionResultData<T = unknown> {\n plugin: string;\n action: string;\n output: T;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// DeFindex vaults (native plugin, Stellar)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Body for `POST /v1/defindex/vaults/:vault/deposit`. */\nexport interface DefindexDepositOptions {\n /** One amount per vault asset, in its base units. */\n amounts: string[];\n /** The account that signs. */\n caller: string;\n invest?: boolean;\n slippageBps?: number;\n}\n\n/** Body for `POST /v1/defindex/vaults/:vault/withdraw`. */\nexport interface DefindexWithdrawOptions {\n shares: string;\n caller: string;\n slippageBps?: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Merchant fees\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * A merchant fee to charge on an operation: a percentage, a fixed amount or\n * both, paid on-chain to `wallet`. At least one of `bps` and `fixed` must be\n * above zero.\n */\nexport interface MerchantFeeOptions {\n /** The percentage part, in basis points (150 = 1.5%), at most 1000 (10%). Taken from `amount`, rounded down. */\n bps?: number;\n /** The fixed part, in the operation's asset, as a decimal with at most that asset's decimals. */\n fixed?: string;\n /** Where the fee is paid: an account on the chain the fee travels on. */\n wallet: string;\n /**\n * `recipient` (the default): deducted from `amount`, so the receiver gets less.\n * `payer`: added on top, so the payer sends `amount` plus the fee.\n */\n paidBy?: 'recipient' | 'payer';\n}\n\n/** The merchant fee an operation charged, as its record stores it. */\nexport interface MerchantFeeData {\n /** The percentage part, in basis points. */\n bps: number;\n /** The fixed part, in `asset`. */\n fixed: string;\n /** The fee charged: the percentage of `amount` plus the fixed part. */\n amount: string;\n /** The asset the fee is paid in. */\n asset: string;\n /** Where the fee is paid. */\n wallet: string;\n paidBy: 'recipient' | 'payer';\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Private payments (`/v1/zk-payments`)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Where a private payment stands, as it reads now: a `PENDING` payment past\n * `expiresAt` reads `EXPIRED`, and can still settle with transfers that closed\n * in time.\n */\nexport const PrivatePaymentStatus = {\n Pending: 'PENDING',\n Succeeded: 'SUCCEEDED',\n Expired: 'EXPIRED',\n} as const;\nexport type PrivatePaymentStatus =\n (typeof PrivatePaymentStatus)[keyof typeof PrivatePaymentStatus];\n\n/** The Stellar network a private payment is on, set by the API key. */\nexport type PrivatePaymentNetwork = 'public' | 'testnet';\n\n/** Body for `POST /v1/zk-payments`. */\nexport interface CreatePrivatePaymentOptions {\n /**\n * What the payer pays in total, in XLM (up to 7 decimal places). The merchant\n * receives it minus the 0.18% commission (`netAmount`); the commission\n * (`feeAmount`, rounded up, at least one stroop) goes to Cosmos Pay's fee\n * account. An amount whose net would be zero is refused.\n */\n amount: string;\n /**\n * The merchant's Stellar account (G...). It must already hold a confidential\n * account on Cosmos Pay's token, registered under auditor id 0; otherwise the\n * payment is refused with `recipient_not_registered`.\n */\n recipient: string;\n /**\n * Shown to the payer by the checkout (max 280 characters). Not secret and not\n * on-chain: the public read returns it to anyone holding the payment id.\n */\n description?: string;\n /** How long the payment stays payable, in minutes (1 to 10080; the server's default is 60). */\n expiresInMinutes?: number;\n /**\n * Idempotency key (max 255 characters), sent as the `Idempotency-Key` header\n * and in the body. A retry with the same key and request returns the existing\n * payment; the same key with a different request is `409 idempotency_conflict`.\n */\n idempotencyKey?: string;\n /**\n * Your own fee on this payment, in XLM, paid privately by a third confidential\n * transfer to `wallet`, which must already hold a confidential account on the\n * token (under auditor id 0) and be neither the recipient nor the fee account.\n */\n merchantFee?: MerchantFeeOptions;\n}\n\n/** Query for `GET /v1/zk-payments`. */\nexport interface ListPrivatePaymentsOptions {\n /** Only payments in this status, as it reads now. */\n status?: PrivatePaymentStatus;\n /** Page size (1 to 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Raw private payment, as its owner (the merchant's API key) reads it. */\nexport interface PrivatePaymentData {\n /** The private payment id (a cuid). */\n id: string;\n status: PrivatePaymentStatus;\n network: PrivatePaymentNetwork;\n /** The confidential token every transfer must be made on. */\n tokenContract: string;\n /** What the payer pays in total, in XLM: `netAmount + feeAmount`, plus `merchantFee.amount` when there is one. */\n amount: string;\n /** What the merchant receives: `amount - feeAmount`, less `merchantFee.amount` when there is one. */\n netAmount: string;\n /** The commission: `ceil(amount * feeBps / 10000)` in stroops, at least one. */\n feeAmount: string;\n /** The commission rate the payment was priced at, in basis points. */\n feeBps: number;\n /** The merchant (G...). */\n recipient: string;\n /** Cosmos Pay's account the commission (`feeAmount`) is paid to. */\n feeAccount: string;\n /** The account the transfers came from, once settled. */\n payer: string | null;\n /** The transaction of the transfer that paid `netAmount` to the recipient, once settled. */\n paymentTxHash: string | null;\n /** The transaction of the transfer that paid `feeAmount` to the fee account, once settled. */\n feeTxHash: string | null;\n /** The merchant fee the request named; null without one. */\n merchantFee: MerchantFeeData | null;\n /** The merchant fee's transaction, once settled. */\n merchantFeeTxHash: string | null;\n /** The description given at create; null when none was given. */\n description: string | null;\n /** The idempotency key of the create: the one sent, or a generated `zkp_...` key. */\n idempotencyKey: string;\n /** When the payment stops being payable. Every transfer must close before it. */\n expiresAt: string;\n /** When the later of the transfers closed, once settled. */\n settledAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Raw paginated list of private payments, newest first. */\nexport interface PrivatePaymentListData {\n data: PrivatePaymentData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Cosmos Pay's confidential token on one network. */\nexport interface PrivatePaymentTokenData {\n /** The confidential token contract (C...). */\n contractId: string;\n /** What it wraps: native XLM. */\n symbol: string;\n /** Decimal places of the token's amounts (7, as for XLM). */\n decimals: number;\n /** Native XLM's Stellar Asset Contract on this network. */\n underlying: string;\n /** The ledger the token was deployed at: where a wallet replays its confidential balance from. */\n deployedAtLedger: number;\n}\n\n/**\n * Raw private payments setup of the API key's network (`GET /v1/zk-payments/config`):\n * the token, registries, auditor id, commission and fee account a wallet\n * registers, proves and pays against. Everything in it is public on-chain data\n * or a public URL.\n */\nexport interface PrivatePaymentsConfigData {\n /**\n * Whether private payments run on this network. False where they do not run\n * yet (mainnet today); every other field but `network`, `networkPassphrase`,\n * `auditorId` and `feeBps` is then null.\n */\n enabled: boolean;\n network: PrivatePaymentNetwork;\n /** The Soroban RPC to build and submit transactions through. */\n rpcUrl: string | null;\n /** The Stellar network passphrase of `network`. */\n networkPassphrase: string;\n /** Cosmos Pay's confidential token on this network; null when `enabled` is false. */\n token: PrivatePaymentTokenData | null;\n /** The UltraHonk verifier registry the token checks proofs with. */\n verifier: string | null;\n /** The auditor registry holding Cosmos Pay's key. */\n auditorRegistry: string | null;\n /** The auditor id every account on the token registers under. */\n auditorId: number;\n /** The commission, in basis points (18 = 0.18%). */\n feeBps: number;\n /** Cosmos Pay's account the commission is transferred to. */\n feeAccount: string | null;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// USDT0 (Stellar to EVM networks through LayerZero)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Where a USDT0 transfer stands. DELIVERED, FAILED and EXPIRED are final. */\nexport const Usdt0TransferStatus = {\n /** Built, waiting for the signature. */\n Pending: 'PENDING',\n /** On the Stellar ledger; LayerZero is delivering it. */\n Submitted: 'SUBMITTED',\n /** Credited on the destination network. */\n Delivered: 'DELIVERED',\n /** The Stellar transaction failed, or LayerZero gave up on the message. */\n Failed: 'FAILED',\n /** Never reached the ledger before `expiresAt`. */\n Expired: 'EXPIRED',\n} as const;\nexport type Usdt0TransferStatus =\n (typeof Usdt0TransferStatus)[keyof typeof Usdt0TransferStatus];\n\n/**\n * A network USDT0 can be sent to from Stellar (`GET /v1/usdt0/routes`). `eth`\n * receives native USDT; every other network receives USDT0.\n */\nexport type Usdt0Destination =\n | 'eth'\n | 'arb'\n | 'bera'\n | 'conflux'\n | 'flare'\n | 'hedera'\n | 'hyperevm'\n | 'ink'\n | 'mantle'\n | 'megaeth'\n | 'monad'\n | 'morph'\n | 'op'\n | 'plasma'\n | 'pol'\n | 'rootstock'\n | 'sei'\n | 'stable'\n | 'tempo'\n | 'unichain'\n | 'xlayer';\n\n/** What arrives: native `USDT` on Ethereum, `USDT0` everywhere else. */\nexport type Usdt0Receives = 'USDT' | 'USDT0';\n\n/** Body for `POST /v1/usdt0/quote`. Nothing is persisted. */\nexport interface QuoteUsdt0Options {\n /** The destination network. */\n to: Usdt0Destination;\n /**\n * USDT0 to send, decimal with up to 7 places. The OFT carries 6: a 7th decimal\n * is dust that stays in the account.\n */\n amount: string;\n /** The account the quote is simulated as. Omitted, a fixed mainnet account is used; the price is the same. */\n source?: string;\n}\n\n/** Body for `POST /v1/usdt0/transfers`. */\nexport interface CreateUsdt0TransferOptions {\n /** The Stellar account that holds the USDT0, signs the transaction and pays its fees in XLM. */\n source: string;\n /** The destination network. */\n to: Usdt0Destination;\n /** The EVM address credited on the destination network (0x + 40 hex; a mixed-case one must be valid EIP-55). */\n recipient: string;\n /** USDT0 to send, decimal with up to 7 places (a 7th decimal is dust that stays in the account). */\n amount: string;\n /**\n * Idempotency key, sent as the `Idempotency-Key` header and in the body. A retry\n * with the same key and request returns the stored transfer; the same key with a\n * different request is `409 idempotency_conflict`.\n */\n idempotencyKey?: string;\n /**\n * Your own fee on this transfer, in USDT0, paid to `wallet` (a Stellar account\n * that trusts USDT0) in the same transaction. Needs a deployment with the fee\n * wrapper configured; otherwise `400 merchant_fee_unsupported`.\n */\n merchantFee?: MerchantFeeOptions;\n}\n\n/** Query for `GET /v1/usdt0/transfers`. */\nexport interface ListUsdt0TransfersOptions {\n /** Only transfers in this status, as last refreshed. */\n status?: Usdt0TransferStatus;\n /** Page size (max 100, default 20). */\n take?: number;\n /** Offset (default 0). */\n skip?: number;\n}\n\n/** Body for `POST /v1/usdt0/transfers/:id/submit`. */\nexport interface SubmitUsdt0TransferOptions {\n /** The signed transaction envelope (base64 XDR): the one the API built, carrying a signature. */\n signedXdr: string;\n}\n\n/**\n * Sent as `X-Record-Token` on the read and submit of one transfer. Required only\n * when the client uses the shared public key: it is the `publicToken` the create\n * returned. Every other key ignores it.\n */\nexport interface Usdt0RecordTokenOptions {\n recordToken?: string;\n}\n\n/** Raw USDT0 quote: what is sent and arrives, the fees and the OFT's limits. */\nexport interface Usdt0QuoteData {\n to: Usdt0Destination;\n /** The destination network's LayerZero endpoint id. */\n eid: number;\n receives: Usdt0Receives;\n /** The amount asked for. */\n amount: string;\n /** Cosmos Pay's plan commission rate, in basis points (0 when the deployment has no fee wrapper). */\n feeBps: number;\n /** The commission in USDT0, out of `amount`, rounded down. */\n feeAmount: string;\n /** What the OFT takes from the account: `amount` without its dust. */\n amountSent: string;\n /** What arrives on the destination network. */\n amountReceived: string;\n /** The 7th decimal the OFT cannot carry; it stays in the account. */\n dust: string;\n /** LayerZero's messaging fee, in XLM, paid on top of the USDT0. */\n nativeFee: string;\n /** What a transfer built now would offer LayerZero, in XLM (`nativeFee` plus 20%, the excess refunded). */\n nativeFeeLimit: string;\n /** The smallest amount the OFT accepts, in USDT0. */\n minAmount: string;\n /** The largest amount the OFT accepts, in USDT0. */\n maxAmount: string;\n}\n\n/** Raw USDT0 transfer from Stellar to an EVM network. */\nexport interface Usdt0TransferData {\n /** The transfer's id, used by the read and submit routes. */\n id: string;\n status: Usdt0TransferStatus;\n /** Always mainnet (`public`). */\n network: string;\n /** The Stellar account that holds the USDT0, signs the transaction and pays its fees in XLM. */\n source: string;\n to: Usdt0Destination;\n /** The destination network's LayerZero endpoint id. */\n eid: number;\n receives: Usdt0Receives;\n /** The EVM address credited, EIP-55. */\n recipient: string;\n /** The amount asked for. */\n amount: string;\n /** What the OFT takes from the account: `amount` without its dust. */\n amountSent: string;\n /** What arrives, and the on-chain floor: the transaction fails rather than deliver less. */\n amountReceived: string;\n /** The dust left in the account (`amount` - `amountSent`). */\n dust: string;\n /** LayerZero's quoted messaging fee, in XLM. */\n nativeFee: string;\n /** What the transaction offers LayerZero, in XLM: `nativeFee` plus a 20% buffer, the rest refunded. */\n nativeFeeLimit: string;\n /** The Stellar network fee, in XLM. */\n networkFee: string;\n /** Cosmos Pay's plan commission rate, in basis points. */\n feeBps: number;\n /** The commission in USDT0, out of `amount`. */\n feeAmount: string;\n /** Where the commission went; null without one. */\n feeWallet: string | null;\n /** The unsigned transaction (base64 XDR) to sign. */\n xdr: string;\n /** A SEP-7 `tx` link carrying `xdr`. */\n uri: string;\n /**\n * A QR of `uri` as a PNG data URL, or null when the transaction is too large for\n * one (a Soroban transaction usually is). Absent from list rows.\n */\n qr?: string | null;\n /** The Stellar transaction hash once it reached the network; null while PENDING or EXPIRED. */\n txHash: string | null;\n /** LayerZero's message id (0x + 64 hex), once the transaction landed. */\n guid: string | null;\n /** The destination network's transaction, once DELIVERED. */\n destinationTxHash: string | null;\n /** LayerZero Scan's own status word, verbatim (`INFLIGHT`, `CONFIRMING`, `DELIVERED`, ...). */\n scanStatus: string | null;\n /** The transaction on LayerZero Scan, once it reached the network. */\n scanUrl: string | null;\n /** Why a FAILED transfer failed. */\n failureReason: string | null;\n /** The merchant fee the request named, in USDT0; null without one. */\n merchantFee: MerchantFeeData | null;\n /** The Idempotency-Key it was created with, if any. */\n idempotencyKey: string | null;\n /** When the transaction's time bounds close: submit refuses it afterwards. */\n expiresAt: string;\n /** When it was first seen accepted by the network. */\n submittedAt: string | null;\n createdAt: string;\n updatedAt: string;\n /**\n * Only on the create, and only when the caller is the shared public key: this\n * record's read token, to send as `X-Record-Token` when reading or submitting it.\n */\n publicToken?: string;\n}\n\n/** Raw paginated list of USDT0 transfers, newest first, as last refreshed. */\nexport interface Usdt0TransferListData {\n data: Usdt0TransferData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Raw outcome of relaying a signed USDT0 transaction. */\nexport interface Usdt0SubmitOutcomeData {\n /** True when the network accepted the transaction (SUBMITTED, or already DELIVERED). */\n submitted: boolean;\n /** The transfer's status after this submission. */\n status: Usdt0TransferStatus;\n /** The Stellar transaction hash, once it reached the network. */\n txHash?: string;\n /** Why it was not submitted, when `submitted` is false. */\n reason?: string | null;\n /** The transfer after this submission. */\n transfer: Usdt0TransferData;\n}\n\n/** USDT0 on Stellar: the classic asset and its Stellar Asset Contract. */\nexport interface Usdt0TokenData {\n code: string;\n issuer: string;\n contract: string;\n}\n\n/** One destination network USDT0 can be sent to from Stellar. */\nexport interface Usdt0RouteData {\n /** The id requests name this network with (`to`). */\n chain: Usdt0Destination;\n /** The network's display name. */\n name: string;\n /** LayerZero endpoint id. */\n eid: number;\n receives: Usdt0Receives;\n}\n\n/** Raw `GET /v1/usdt0/routes`: where USDT0 can go, with the token and OFT a transfer uses. */\nexport interface Usdt0RoutesData {\n /** Always `public`: USDT0 exists on Stellar mainnet only. */\n network: string;\n /** True for a prod (mainnet) key; a dev (testnet) key gets `false` and no routes. */\n available: boolean;\n token: Usdt0TokenData;\n /** The LayerZero OFT contract the transaction calls (`send`). */\n oft: string;\n /** Stellar mainnet's LayerZero endpoint id. */\n eid: number;\n /** The destination networks, Ethereum first and then by name. */\n routes: Usdt0RouteData[];\n}\n","import type { Client } from '@/client/Client';\nimport {\n LiquidityOperationKind,\n LiquidityOperationStatus,\n type LiquidityOperationData,\n type SubmitLiquidityOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { LiquiditySubmitOutcome } from '@/managers/LiquidityManager';\n\n/**\n * One deposit into, or withdrawal from, a Stellar liquidity pool.\n *\n * The server builds the envelope and the wallet signs it, so an operation is a\n * two-step object: it arrives `PENDING` carrying an unsigned `xdr`, and reaches\n * `SUBMITTED`/`SUCCEEDED` only once the signed envelope comes back through\n * `submit()`. Both steps are available on the instance —\n * `await operation.submit({ signedXdr })` — so a caller never has to keep the id\n * and the manager in scope alongside it.\n */\nexport class LiquidityOperation extends Base<LiquidityOperationData> {\n /** Deposit or withdrawal. */\n public kind!: LiquidityOperationKind;\n public status!: LiquidityOperationStatus;\n public network!: string;\n /** Account whose funds move, and which must sign. */\n public source!: string;\n /** The pool this operation acts on (hex id). */\n public poolId!: string;\n public assetA!: string;\n public assetAIssuer!: string | null;\n public assetB!: string;\n public assetBIssuer!: string | null;\n /** Maximum of asset A put in (deposit), or minimum taken out (withdrawal). */\n public amountA!: string;\n public amountB!: string;\n /** Pool shares minted or burned; null until the network settles a deposit. */\n public shares!: string | null;\n /** Price band a deposit executes within, as decimal strings. */\n public minPrice!: string | null;\n public maxPrice!: string | null;\n public slippageBps!: number;\n public idempotencyKey!: string | null;\n public feeBps!: number;\n public feeAmountA!: string;\n public feeAmountB!: string;\n public feeWallet!: string | null;\n public commissionMemo!: string | null;\n /** Unsigned transaction envelope (base64 XDR) — what the wallet signs. */\n public xdr!: string;\n /** SEP-7 `web+stellar:tx` deep link for the same envelope. */\n public uri!: string;\n public txHash!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n /** When the built envelope stops being submittable. */\n public expiresAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: LiquidityOperationData) {\n super(client, data);\n }\n\n protected override _patch(data: LiquidityOperationData): this {\n super._patch(data);\n this.kind = data.kind;\n this.status = data.status;\n this.network = data.network;\n this.source = data.source;\n this.poolId = data.poolId;\n this.assetA = data.assetA;\n this.assetAIssuer = data.assetAIssuer ?? null;\n this.assetB = data.assetB;\n this.assetBIssuer = data.assetBIssuer ?? null;\n this.amountA = data.amountA;\n this.amountB = data.amountB;\n this.shares = data.shares ?? null;\n this.minPrice = data.minPrice ?? null;\n this.maxPrice = data.maxPrice ?? null;\n this.slippageBps = data.slippageBps;\n this.idempotencyKey = data.idempotencyKey ?? null;\n this.feeBps = data.feeBps;\n this.feeAmountA = data.feeAmountA;\n this.feeAmountB = data.feeAmountB;\n this.feeWallet = data.feeWallet ?? null;\n this.commissionMemo = data.commissionMemo ?? null;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.txHash = data.txHash;\n this.qr = data.qr;\n this.expiresAt = data.expiresAt ? new Date(data.expiresAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** True while the envelope still needs a signature. */\n public get isPending(): boolean {\n return this.status === LiquidityOperationStatus.Pending;\n }\n\n /** True once the network accepted it. */\n public get isSucceeded(): boolean {\n return this.status === LiquidityOperationStatus.Succeeded;\n }\n\n /** True for a deposit, false for a withdrawal. */\n public get isDeposit(): boolean {\n return this.kind === LiquidityOperationKind.Deposit;\n }\n\n /** Re-fetch this operation and patch it in place. */\n public async fetch(): Promise<this> {\n const data = await this.client.liquidity.fetchRaw(this.id);\n return this._patch(data);\n }\n\n /** Relay the signed envelope to the network and patch this instance with the result. */\n public async submit(options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome> {\n const outcome = await this.client.liquidity.submit(this.id, options);\n // Patch in place: the caller is holding THIS object, and leaving it showing\n // `PENDING` after a successful submit is the kind of staleness that gets\n // rendered straight into a UI.\n this._patch(outcome.operation.toJSON());\n return outcome;\n }\n\n public toJSON(): LiquidityOperationData {\n return {\n id: this.id,\n kind: this.kind,\n status: this.status,\n network: this.network,\n source: this.source,\n poolId: this.poolId,\n assetA: this.assetA,\n assetAIssuer: this.assetAIssuer,\n assetB: this.assetB,\n assetBIssuer: this.assetBIssuer,\n amountA: this.amountA,\n amountB: this.amountB,\n shares: this.shares,\n minPrice: this.minPrice,\n maxPrice: this.maxPrice,\n slippageBps: this.slippageBps,\n idempotencyKey: this.idempotencyKey,\n feeBps: this.feeBps,\n feeAmountA: this.feeAmountA,\n feeAmountB: this.feeAmountB,\n feeWallet: this.feeWallet,\n commissionMemo: this.commissionMemo,\n xdr: this.xdr,\n uri: this.uri,\n txHash: this.txHash,\n qr: this.qr,\n expiresAt: this.expiresAt ? this.expiresAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { LiquidityOperation } from '@/structures/LiquidityOperation';\nimport type {\n BrowseLiquidityPoolsOptions,\n DepositLiquidityOptions,\n LiquidityOperationData,\n LiquidityOperationListData,\n LiquidityOperationStatus,\n LiquidityPoolData,\n LiquidityPoolListData,\n LiquidityPositionsData,\n LiquiditySubmitOutcomeData,\n ListLiquidityOperationsOptions,\n SubmitLiquidityOptions,\n WithdrawLiquidityOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of liquidity operations plus its pagination metadata. */\nexport interface LiquidityOperationPage {\n items: LiquidityOperation[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of on-chain pools. Horizon paginates by cursor, not by offset. */\nexport interface LiquidityPoolPage {\n items: LiquidityPoolData[];\n /** Pass back as `cursor` to get the next page; null when there is none. */\n cursor: string | null;\n}\n\n/** Submission outcome with the refreshed operation materialized. */\nexport interface LiquiditySubmitOutcome {\n submitted: boolean;\n status: LiquidityOperationStatus;\n txHash: string | null;\n reason: string | null;\n resultCodes: string[] | null;\n operation: LiquidityOperation;\n}\n\n/**\n * Liquidity pools — `client.liquidity`.\n *\n * Two surfaces in one manager, because they are two halves of the same job:\n * *browsing* pools and positions (read-only, straight off Horizon), and\n * *operating* on them (deposit / withdraw), which produces an unsigned envelope\n * for a wallet to sign and a `submit()` to relay it back.\n *\n * The managed structure is the OPERATION, not the pool: a pool is a public\n * on-chain object with no lifecycle of its own, while an operation is a thing this\n * consumer created, can re-read and can push to the network.\n *\n * @example\n * const op = await client.liquidity.deposit({\n * source: 'G…',\n * assetACode: 'XLM',\n * assetBCode: 'USDC',\n * assetBIssuer: 'GA5Z…',\n * maxAmountA: '100',\n * maxAmountB: '25',\n * });\n * // …wallet signs op.xdr…\n * const { status, txHash } = await op.submit({ signedXdr });\n */\nexport class LiquidityManager extends BaseManager<LiquidityOperation> {\n private readonly route = '/liquidity-pools';\n\n /**\n * Build a deposit into the pool formed by the two assets → unsigned XDR, SEP-7\n * URI and QR.\n *\n * The pool is DERIVED from the two assets rather than named: a constant-product\n * pool id is a hash of its (assetA, assetB, fee) in CAP-38 order, so there is\n * exactly one pool the pair can form and no id for a caller to get wrong.\n */\n public async deposit(options: DepositLiquidityOptions): Promise<LiquidityOperation> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<LiquidityOperationData>(`${this.route}/deposit`, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n // Sent as a header too: the service accepts either, and the header is what\n // makes a retried POST safe when the body was already consumed upstream.\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new LiquidityOperation(this.client, data));\n }\n\n /** Build a withdrawal (burn shares) from a pool → unsigned XDR, SEP-7 URI and QR. */\n public async withdraw(options: WithdrawLiquidityOptions): Promise<LiquidityOperation> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<LiquidityOperationData>(`${this.route}/withdraw`, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new LiquidityOperation(this.client, data));\n }\n\n /** An account's pool share positions, with what each is redeemable for right now. */\n public positions(account: string): Promise<LiquidityPositionsData> {\n return this.rest.get<LiquidityPositionsData>(`${this.route}/positions`, {\n query: { account },\n });\n }\n\n /** Browse on-chain pools (Horizon proxy). Filter by asset pair or by holder. */\n public async browse(options: BrowseLiquidityPoolsOptions = {}): Promise<LiquidityPoolPage> {\n const data = await this.rest.get<LiquidityPoolListData>(this.route, {\n query: {\n assetACode: options.assetACode,\n assetAIssuer: options.assetAIssuer,\n assetBCode: options.assetBCode,\n assetBIssuer: options.assetBIssuer,\n account: options.account,\n cursor: options.cursor,\n limit: options.limit,\n },\n });\n return { items: data.data, cursor: data.cursor ?? null };\n }\n\n /** One on-chain pool by its hex id (Horizon proxy). */\n public pool(poolId: string): Promise<LiquidityPoolData> {\n return this.rest.get<LiquidityPoolData>(`${this.route}/${poolId}`);\n }\n\n /** List this consumer's pool operations (paginated). */\n public async operations(\n options: ListLiquidityOperationsOptions = {},\n ): Promise<LiquidityOperationPage> {\n const data = await this.rest.get<LiquidityOperationListData>(`${this.route}/operations`, {\n query: {\n kind: options.kind,\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n });\n return {\n items: data.data.map((d) => this._add(new LiquidityOperation(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Get one operation by id, materialized. */\n public async fetch(id: string): Promise<LiquidityOperation> {\n return this._add(new LiquidityOperation(this.client, await this.fetchRaw(id)));\n }\n\n /**\n * The raw payload for one operation. Exists so {@link LiquidityOperation.fetch}\n * can patch itself in place instead of materializing a second instance of the\n * thing the caller is already holding.\n */\n public fetchRaw(id: string): Promise<LiquidityOperationData> {\n return this.rest.get<LiquidityOperationData>(`${this.route}/operations/${id}`);\n }\n\n /**\n * Relay a signed operation to the network. The service checks the envelope's\n * hash against the one it built, so a signed envelope that is not the one this\n * operation describes is refused rather than broadcast.\n */\n public async submit(\n id: string,\n options: SubmitLiquidityOptions,\n ): Promise<LiquiditySubmitOutcome> {\n const data = await this.rest.post<LiquiditySubmitOutcomeData>(\n `${this.route}/operations/${id}/submit`,\n { body: options },\n );\n return {\n submitted: data.submitted,\n status: data.status,\n txHash: data.txHash ?? null,\n reason: data.reason ?? null,\n resultCodes: data.resultCodes ?? null,\n operation: this._add(new LiquidityOperation(this.client, data.operation)),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n CreatePayinOptions,\n CreatePayinQuoteOptions,\n CreateTrustlineOptions,\n CreateVirtualAccountOptions,\n ListPayinsOptions,\n PayinData,\n PayinListData,\n PayinQuoteData,\n TrustlineData,\n VirtualAccountData,\n} from '@/types/index';\n\n/** A page of payins plus its pagination metadata. */\nexport interface PayinPage {\n items: PayinData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Fiat → stablecoin — `client.onramp`.\n *\n * Three steps, in this order and no other: **quote** (a price, valid for about\n * five minutes), **payin** (created FROM that quote, and what returns the funding\n * instructions the payer acts on), then the money arrives off-band and the payin\n * status moves on its own.\n *\n * There is no structure class here on purpose. A payin has no action of its own —\n * it is a mirror of the provider's record, read and re-read — so an object with a\n * client back-reference would carry a `fetch()` and nothing else.\n *\n * @example\n * const quote = await client.onramp.quote({\n * blockchain_wallet_id: 'w_123',\n * currency_type: 'sender',\n * payment_method: 'pix',\n * token: 'USDC',\n * request_amount: 10_000, // minor units\n * });\n * const payin = await client.onramp.createPayin({ payin_quote_id: quote.id });\n * console.log(payin.instructions);\n */\nexport class OnrampManager {\n public readonly client: Client;\n private readonly route = '/onramp';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Price a payin. The quote expires — check `expires_at` before using it. */\n public quote(options: CreatePayinQuoteOptions): Promise<PayinQuoteData> {\n return this.rest.post<PayinQuoteData>(`${this.route}/quotes`, { body: options });\n }\n\n /** Create a payin from a quote. The response carries the funding instructions. */\n public createPayin(options: CreatePayinOptions): Promise<PayinData> {\n return this.rest.post<PayinData>(`${this.route}/payins`, { body: options });\n }\n\n /** List this consumer's payins (paginated). */\n public async payins(options: ListPayinsOptions = {}): Promise<PayinPage> {\n const data = await this.rest.get<PayinListData>(`${this.route}/payins`, {\n query: { take: options.take, skip: options.skip },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /**\n * One payin. Served from the local mirror, refreshed from the provider when it\n * is stale — so this is the right call to poll, not the provider's own API.\n */\n public payin(id: string): Promise<PayinData> {\n return this.rest.get<PayinData>(`${this.route}/payins/${id}`);\n }\n\n /**\n * Build the unsigned trustline transaction an address needs before it can hold\n * the stablecoin the ramp pays out in.\n *\n * The envelope comes from the gateway, so a wallet signing it must decode and\n * bound it first — the issuer it names is the one the payout will use, and it is\n * not known to the caller in advance.\n */\n public createTrustline(options: CreateTrustlineOptions): Promise<TrustlineData> {\n return this.rest.post<TrustlineData>(`${this.route}/trustline`, { body: options });\n }\n\n /** Open a virtual account (a permanent bank reference) for a verified receiver. */\n public createVirtualAccount(\n receiverId: string,\n options: CreateVirtualAccountOptions,\n ): Promise<VirtualAccountData> {\n return this.rest.post<VirtualAccountData>(\n `${this.route}/receivers/${receiverId}/virtual-accounts`,\n { body: options },\n );\n }\n\n /** A receiver's virtual accounts. */\n public virtualAccounts(\n receiverId: string,\n options: ListPayinsOptions = {},\n ): Promise<VirtualAccountData> {\n return this.rest.get<VirtualAccountData>(\n `${this.route}/receivers/${receiverId}/virtual-accounts`,\n { query: { take: options.take, skip: options.skip } },\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n AttachPayoutDocumentOptions,\n AuthorizePayoutData,\n AuthorizePayoutOptions,\n CreatePayoutOptions,\n CreatePayoutQuoteOptions,\n ListPayoutsOptions,\n PayoutData,\n PayoutDocumentData,\n PayoutListData,\n PayoutQuoteData,\n} from '@/types/index';\n\n/** A page of payouts plus its pagination metadata. */\nexport interface PayoutPage {\n items: PayoutData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Stablecoin → fiat — `client.offramp`.\n *\n * Four steps, and the middle one is the one people miss: **quote**, **authorize**\n * (which builds the unsigned transaction that moves the stablecoin), the wallet\n * signs it, and only then **create the payout** with that signature attached. A\n * payout created without a signed transfer is a payout with nothing behind it.\n *\n * `authorize` is for the chains that need a transaction built for them (Stellar,\n * Solana). On EVM the quote itself carries the `approve` contract payload, so the\n * caller signs that instead and goes straight to `createPayout`.\n *\n * @example\n * const quote = await client.offramp.quote({\n * bank_account_id: 'ba_123',\n * currency_type: 'sender',\n * request_amount: 5_000,\n * network: 'stellar',\n * token: 'USDC',\n * });\n * const { xdr } = await client.offramp.authorize({\n * quote_id: quote.id,\n * sender_wallet_address: 'G…',\n * chain: 'stellar',\n * });\n * // …wallet signs `xdr`, after bounding it against `quote`…\n * const payout = await client.offramp.createPayout({\n * quote_id: quote.id,\n * sender_wallet_address: 'G…',\n * chain: 'stellar',\n * signed_transaction: signedXdr,\n * });\n */\nexport class OfframpManager {\n public readonly client: Client;\n private readonly route = '/offramp';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** Price a payout. Expires in about five minutes. */\n public quote(options: CreatePayoutQuoteOptions): Promise<PayoutQuoteData> {\n return this.rest.post<PayoutQuoteData>(`${this.route}/quotes`, { body: options });\n }\n\n /**\n * Build the unsigned transfer for a Stellar or Solana payout.\n *\n * What comes back is built by the gateway, not by the caller: bound it against\n * the quote the user confirmed before signing, or the amount that leaves is\n * whatever the response says it is.\n */\n public authorize(options: AuthorizePayoutOptions): Promise<AuthorizePayoutData> {\n return this.rest.post<AuthorizePayoutData>(`${this.route}/payouts/authorize`, {\n body: options,\n });\n }\n\n /** Create the payout from a quote, with the signed transfer attached. */\n public createPayout(options: CreatePayoutOptions): Promise<PayoutData> {\n return this.rest.post<PayoutData>(`${this.route}/payouts`, { body: options });\n }\n\n /** List this consumer's payouts (paginated). */\n public async payouts(options: ListPayoutsOptions = {}): Promise<PayoutPage> {\n const data = await this.rest.get<PayoutListData>(`${this.route}/payouts`, {\n query: { take: options.take, skip: options.skip },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** One payout. Served from the local mirror, refreshed when stale. */\n public payout(id: string): Promise<PayoutData> {\n return this.rest.get<PayoutData>(`${this.route}/payouts/${id}`);\n }\n\n /**\n * Attach a compliance document to a payout — an invoice or proof of funds the\n * rail asks for before it will settle.\n */\n public attachDocument(\n id: string,\n options: AttachPayoutDocumentOptions,\n ): Promise<PayoutDocumentData> {\n return this.rest.post<PayoutDocumentData>(`${this.route}/payouts/${id}/documents`, {\n body: options,\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n ActivityEventInput,\n ActivityListData,\n ActivityReportData,\n ActivitySummaryData,\n ListActivityOptions,\n ReportActivityOptions,\n} from '@/types/index';\n\n/** A page of events plus its pagination metadata. */\nexport interface ActivityPage {\n items: ActivityListData['data'];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * The client event stream — `client.activity`.\n *\n * This is the trail the wallet, the dashboard and your own server write to: errors,\n * screen views, timings, the operations they built. It exists because a console is\n * not a trail — an extension popup's console dies with the popup and a phone's\n * WebView console needs a cable — and because the failures worth having are the\n * ones that never reach the API at all.\n *\n * Two rules the writers are expected to keep, and neither is enforceable here:\n * report only what the user consented to, and never put memo text or anything that\n * names a counterparty in `props`.\n *\n * @example\n * await client.activity.report([\n * { type: 'checkout.opened', source: 'server', level: 'info', eventId: crypto.randomUUID() },\n * ]);\n */\nexport class ActivityManager {\n public readonly client: Client;\n private readonly route = '/activity';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /**\n * Report a batch of events.\n *\n * Accepts the array directly or the full body. Give each event an `eventId`: the\n * service de-duplicates on it, which is the difference between a retried batch\n * and a double-counted one.\n */\n public report(\n events: ActivityEventInput[] | ReportActivityOptions,\n ): Promise<ActivityReportData> {\n const body: ReportActivityOptions = Array.isArray(events) ? { events } : events;\n return this.rest.post<ActivityReportData>(`${this.route}/events`, { body });\n }\n\n /** Recent events for this consumer, newest first. */\n public async events(options: ListActivityOptions = {}): Promise<ActivityPage> {\n const data = await this.rest.get<ActivityListData>(`${this.route}/events`, {\n query: {\n take: options.take,\n skip: options.skip,\n source: options.source,\n level: options.level,\n category: options.category,\n type: options.type,\n network: options.network,\n since: options.since,\n until: options.until,\n },\n });\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Counts, top event types, top errors and a daily series. */\n public summary(options: { days?: number; source?: string } = {}): Promise<ActivitySummaryData> {\n return this.rest.get<ActivitySummaryData>(`${this.route}/summary`, {\n query: { days: options.days, source: options.source },\n });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type {\n ApproveReceiverOptions,\n BankAccountData,\n CreateBankAccountOptions,\n CreateReceiverWalletOptions,\n EnableReceiverOptions,\n ListKycOptions,\n ReceiverData,\n ReceiverWalletData,\n RequestTosOptions,\n TermsOfServiceData,\n UpdateReceiverOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { BankAccountPage, ReceiverWalletPage } from '@/managers/KycManager';\n\n/**\n * A verified identity — the thing both ramps hang off.\n *\n * Everything a receiver owns is reachable from the instance\n * (`receiver.addBankAccount(…)`, `receiver.wallets()`), because the alternative is\n * carrying a receiver id and a manager reference side by side through a KYC flow\n * that already has enough moving parts.\n */\nexport class Receiver extends Base<ReceiverData> {\n public blindpayId!: string;\n /** `individual` or `business`. */\n public type!: string;\n public kycType!: string | null;\n /** Verification state, refreshed from upstream on every read. */\n public kycStatus!: string | null;\n public email!: string | null;\n public name!: string | null;\n public country!: string | null;\n /** Your own id for this receiver, if you set one. */\n public externalId!: string | null;\n /** True when the receiver is cut off from both ramps. */\n public disabled!: boolean;\n /** How many times the submitted KYC data has been written. */\n public dossierVersion!: number;\n /** The version a reviewer approved, or null while unapproved. */\n public reviewedVersion!: number | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ReceiverData) {\n super(client, data);\n }\n\n protected override _patch(data: ReceiverData): this {\n super._patch(data);\n this.blindpayId = data.blindpayId;\n this.type = data.type;\n this.kycType = data.kycType ?? null;\n this.kycStatus = data.kycStatus ?? null;\n this.email = data.email ?? null;\n this.name = data.name ?? null;\n this.country = data.country ?? null;\n this.externalId = data.externalId ?? null;\n this.disabled = data.disabled;\n this.dossierVersion = data.dossierVersion;\n this.reviewedVersion = data.reviewedVersion ?? null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** True once verification has passed and the ramps will act on this receiver. */\n public get isApproved(): boolean {\n return this.kycStatus === 'approved';\n }\n\n /** Re-read this receiver, refreshing `kycStatus`, and patch it in place. */\n public async fetch(): Promise<this> {\n return this._patch(await this.client.kyc.fetchReceiverRaw(this.id));\n }\n\n /** Update and patch in place. */\n public async update(options: UpdateReceiverOptions): Promise<this> {\n const updated = await this.client.kyc.updateReceiver(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Delete this receiver. */\n public delete(): Promise<void> {\n return this.client.kyc.deleteReceiver(this.id);\n }\n\n /**\n * Approve it out of review (admin-only).\n *\n * Pinned to the dossier THIS instance holds: `expected_version` defaults to\n * {@link Receiver.dossierVersion}, so approving a receiver that was edited since\n * you read it is a `409 kyc_state_invalid` rather than a silent approval of data\n * you never saw. Call {@link Receiver.fetch} and review again, or pass\n * `expected_version` yourself — including `undefined`, which approves whatever\n * is stored now.\n */\n public approve(options: ApproveReceiverOptions = {}): Promise<ReceiverData> {\n const pinned: ApproveReceiverOptions =\n 'expected_version' in options\n ? options\n : { ...options, expected_version: this.dossierVersion };\n return this.client.kyc.approveReceiver(this.id, pinned);\n }\n\n /** Ask for a terms-of-service link for this receiver. */\n public requestTos(options: RequestTosOptions): Promise<TermsOfServiceData> {\n return this.client.kyc.requestTos(this.id, options);\n }\n\n /** Enable it with an accepted terms-of-service id, and patch in place. */\n public async enable(options: EnableReceiverOptions): Promise<this> {\n const enabled = await this.client.kyc.enableReceiver(this.id, options);\n return this._patch(enabled.toJSON());\n }\n\n /** Cut this receiver off from both ramps, or let it back in. */\n public async setAccess(disabled: boolean): Promise<this> {\n const updated = await this.client.kyc.setReceiverAccess(this.id, { disabled });\n return this._patch(updated.toJSON());\n }\n\n /** Register a blockchain wallet for this receiver. */\n public addWallet(options: CreateReceiverWalletOptions): Promise<ReceiverWalletData> {\n return this.client.kyc.addWallet(this.id, options);\n }\n\n /** This receiver's wallets. */\n public wallets(options: ListKycOptions = {}): Promise<ReceiverWalletPage> {\n return this.client.kyc.wallets(this.id, options);\n }\n\n /** Add a fiat bank account — where an off-ramp pays out. */\n public addBankAccount(options: CreateBankAccountOptions): Promise<BankAccountData> {\n return this.client.kyc.addBankAccount(this.id, options);\n }\n\n /** This receiver's bank accounts. */\n public bankAccounts(options: ListKycOptions = {}): Promise<BankAccountPage> {\n return this.client.kyc.bankAccounts(this.id, options);\n }\n\n public toJSON(): ReceiverData {\n return {\n id: this.id,\n blindpayId: this.blindpayId,\n type: this.type,\n kycType: this.kycType,\n kycStatus: this.kycStatus,\n email: this.email,\n name: this.name,\n country: this.country,\n externalId: this.externalId,\n disabled: this.disabled,\n dossierVersion: this.dossierVersion,\n reviewedVersion: this.reviewedVersion,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport { Receiver } from '@/structures/Receiver';\nimport { BaseManager } from '@/managers/BaseManager';\nimport type {\n ApproveReceiverOptions,\n BankAccountData,\n BankAccountListData,\n BankDetailsData,\n CreateBankAccountOptions,\n CreateReceiverOptions,\n CreateReceiverWalletOptions,\n EnableReceiverOptions,\n InitiateTosOptions,\n KycRailsData,\n KycUploadData,\n ListKycOptions,\n ReceiverData,\n ReceiverListData,\n ReceiverWalletData,\n ReceiverWalletListData,\n RequestTosOptions,\n SetReceiverAccessOptions,\n TermsOfServiceData,\n UpdateReceiverOptions,\n WalletSignMessageData,\n} from '@/types/index';\n\n/** A page of receivers plus its pagination metadata. */\nexport interface ReceiverPage {\n items: Receiver[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of a receiver's wallets. */\nexport interface ReceiverWalletPage {\n items: ReceiverWalletData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** A page of a receiver's bank accounts. */\nexport interface BankAccountPage {\n items: BankAccountData[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * KYC / KYB — `client.kyc`.\n *\n * A receiver is the verified identity both ramps hang off: an on-ramp pays INTO\n * one of its wallets, an off-ramp pays OUT to one of its bank accounts, and\n * neither works until verification passes.\n *\n * The order is not obvious and the API will not guess it for you:\n *\n * 1. `termsOfService()` — the acceptance the provider requires up front, which\n * returns a `tos_id`.\n * 2. `upload()` each document, keeping the `file_url` it returns.\n * 3. `createReceiver()` with those URLs and the `tos_id`.\n * 4. `addWallet()` / `addBankAccount()` for where money should land.\n * 5. verification runs; `fetchReceiver()` refreshes `kycStatus` from upstream.\n *\n * @example\n * const tos = await client.kyc.termsOfService({ redirect_url: 'https://app/kyc/done' });\n * const { file_url } = await client.kyc.upload(fileBase64);\n * const receiver = await client.kyc.createReceiver({\n * type: 'individual', kyc_type: 'standard', email: 'a@b.com', country: 'BR',\n * id_doc_front_file: file_url, tos_id: tosId,\n * });\n */\nexport class KycManager extends BaseManager<Receiver> {\n private readonly route = '/kyc';\n\n /* ----------------------------- receivers ------------------------------- */\n\n /** Create a receiver and start verification. */\n public async createReceiver(options: CreateReceiverOptions): Promise<Receiver> {\n const data = await this.rest.post<ReceiverData>(`${this.route}/receivers`, { body: options });\n return this._add(new Receiver(this.client, data));\n }\n\n /** List this consumer's receivers (paginated). */\n public async receivers(options: ListKycOptions = {}): Promise<ReceiverPage> {\n const data = await this.rest.get<ReceiverListData>(`${this.route}/receivers`, {\n query: { take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new Receiver(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** One receiver, materialized. Reading it refreshes `kycStatus` upstream. */\n public async fetchReceiver(id: string): Promise<Receiver> {\n return this._add(new Receiver(this.client, await this.fetchReceiverRaw(id)));\n }\n\n /** The raw payload, so a {@link Receiver} can patch itself in place. */\n public fetchReceiverRaw(id: string): Promise<ReceiverData> {\n return this.rest.get<ReceiverData>(`${this.route}/receivers/${id}`);\n }\n\n /**\n * Update a receiver — the same fields as creation, all optional. Once the receiver\n * exists at the provider, identity fields need an elevated key; see\n * {@link UpdateReceiverOptions}.\n */\n public async updateReceiver(id: string, options: UpdateReceiverOptions): Promise<Receiver> {\n const data = await this.rest.patch<ReceiverData>(`${this.route}/receivers/${id}`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /** Delete a receiver. */\n public async deleteReceiver(id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${id}`);\n this.cache.delete(id);\n }\n\n /**\n * Approve a receiver sitting in review. Admin-only: it is the human gate on a\n * verification the provider could not decide by itself.\n */\n public approveReceiver(id: string, options: ApproveReceiverOptions = {}): Promise<ReceiverData> {\n return this.rest.post<ReceiverData>(`${this.route}/receivers/${id}/approve`, { body: options });\n }\n\n /**\n * Ask for a terms-of-service link for an existing receiver. `channel: 'code'`\n * returns the URL to render; `'email'` sends it to the receiver instead.\n */\n public requestTos(id: string, options: RequestTosOptions): Promise<TermsOfServiceData> {\n return this.rest.post<TermsOfServiceData>(`${this.route}/receivers/${id}/tos`, {\n body: options,\n });\n }\n\n /** Enable an inactive receiver with an accepted terms-of-service id. */\n public async enableReceiver(id: string, options: EnableReceiverOptions): Promise<Receiver> {\n const data = await this.rest.post<ReceiverData>(`${this.route}/receivers/${id}/enable`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /**\n * Cut a receiver off from both ramps, or let it back in. Admin-only, and the\n * fastest lever there is when something is wrong with an account.\n */\n public async setReceiverAccess(\n id: string,\n options: SetReceiverAccessOptions,\n ): Promise<Receiver> {\n const data = await this.rest.patch<ReceiverData>(`${this.route}/receivers/${id}/access`, {\n body: options,\n });\n return this._add(new Receiver(this.client, data));\n }\n\n /* ------------------------------ wallets -------------------------------- */\n\n /**\n * The message a receiver must sign to prove it controls an address. Sign it,\n * then pass the resulting transaction hash as `signature_tx_hash` to\n * {@link addWallet}.\n */\n public walletSignMessage(receiverId: string): Promise<WalletSignMessageData> {\n return this.rest.get<WalletSignMessageData>(\n `${this.route}/receivers/${receiverId}/wallets/sign-message`,\n );\n }\n\n /** Register a blockchain wallet for a receiver. */\n public addWallet(\n receiverId: string,\n options: CreateReceiverWalletOptions,\n ): Promise<ReceiverWalletData> {\n return this.rest.post<ReceiverWalletData>(`${this.route}/receivers/${receiverId}/wallets`, {\n body: options,\n });\n }\n\n /** A receiver's wallets (paginated). */\n public async wallets(\n receiverId: string,\n options: ListKycOptions = {},\n ): Promise<ReceiverWalletPage> {\n const data = await this.rest.get<ReceiverWalletListData>(\n `${this.route}/receivers/${receiverId}/wallets`,\n { query: { take: options.take, skip: options.skip } },\n );\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Delete one of a receiver's wallets. */\n public async deleteWallet(receiverId: string, id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${receiverId}/wallets/${id}`);\n }\n\n /* ---------------------------- bank accounts ---------------------------- */\n\n /** Add a fiat bank account for a receiver — where an off-ramp pays out. */\n public addBankAccount(\n receiverId: string,\n options: CreateBankAccountOptions,\n ): Promise<BankAccountData> {\n return this.rest.post<BankAccountData>(\n `${this.route}/receivers/${receiverId}/bank-accounts`,\n { body: options },\n );\n }\n\n /** A receiver's bank accounts (paginated). */\n public async bankAccounts(\n receiverId: string,\n options: ListKycOptions = {},\n ): Promise<BankAccountPage> {\n const data = await this.rest.get<BankAccountListData>(\n `${this.route}/receivers/${receiverId}/bank-accounts`,\n { query: { take: options.take, skip: options.skip } },\n );\n return { items: data.data, total: data.total, take: data.take, skip: data.skip };\n }\n\n /** Delete one of a receiver's bank accounts. */\n public async deleteBankAccount(receiverId: string, id: string): Promise<void> {\n await this.rest.delete<unknown>(`${this.route}/receivers/${receiverId}/bank-accounts/${id}`);\n }\n\n /* ------------------------------ the rest ------------------------------- */\n\n /**\n * Upload a KYC document and get back the `file_url` every `*_file` field\n * expects. Documents are uploaded first and referenced by URL — the receiver\n * payload never carries bytes.\n */\n public upload(file: unknown): Promise<KycUploadData> {\n return this.rest.post<KycUploadData>(`${this.route}/upload`, { body: file });\n }\n\n /**\n * Start terms-of-service acceptance and get the hosted URL. This is the FIRST\n * step of the flow: the provider will not create a receiver without the `tos_id`\n * it produces.\n */\n public termsOfService(options: InitiateTosOptions = {}): Promise<TermsOfServiceData> {\n return this.rest.post<TermsOfServiceData>(`${this.route}/terms-of-service`, { body: options });\n }\n\n /** The bank rails available to this consumer. */\n public rails(): Promise<KycRailsData> {\n return this.rest.get<KycRailsData>(`${this.route}/rails`);\n }\n\n /**\n * The field schema a given rail requires. The authority on which of the ~70\n * rail-specific bank-account fields to send — read it at runtime rather than\n * hard-coding a rail's shape.\n */\n public bankDetails(rail: string): Promise<BankDetailsData> {\n return this.rest.get<BankDetailsData>(`${this.route}/bank-details`, { query: { rail } });\n }\n\n protected get rest(): REST {\n return this.client.rest;\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n CrossChainSwapStatus,\n type CrossChainSwapData,\n type CrossChainTransactionData,\n type SwapChain,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** Statuses after which nothing changes. */\nconst FINAL: readonly CrossChainSwapStatus[] = [\n CrossChainSwapStatus.Succeeded,\n CrossChainSwapStatus.Refunded,\n CrossChainSwapStatus.Failed,\n];\n\n/**\n * A swap between two chains, settled by NEAR Intents — `client.crossChainSwaps`.\n *\n * Pay exactly {@link amountIn} of the origin asset to {@link depositAddress}\n * (with {@link depositMemo} on Stellar, as a MEMO_TEXT) — {@link depositUri} is\n * that payment as a wallet link. NEAR Intents pays {@link recipient} on the\n * destination chain, or refunds {@link refundTo}. The server follows it; poll\n * with `await swap.fetch()` or subscribe to the `CROSS_CHAIN_SWAP_*` webhooks.\n */\nexport class CrossChainSwap extends Base<CrossChainSwapData> {\n public status!: CrossChainSwapStatus;\n /** NEAR Intents' own status word. */\n public providerStatus!: string;\n public network!: string;\n public originChain!: SwapChain;\n public originAsset!: string;\n public originContract!: string | null;\n public destinationChain!: SwapChain;\n public destinationAsset!: string;\n public destinationContract!: string | null;\n public amountIn!: string;\n public feeBps!: number;\n public feeAmount!: string;\n public amountOutEstimated!: string;\n public amountOutMin!: string;\n public slippageBps!: number;\n public recipient!: string;\n public refundTo!: string;\n public depositAddress!: string;\n public depositMemo!: string | null;\n public depositUri!: string;\n /** QR of {@link depositUri}; list rows do not carry it. */\n public qr!: string | null;\n public depositTxHash!: string | null;\n public amountOut!: string | null;\n public refundedAmount!: string | null;\n public originTxHashes!: CrossChainTransactionData[] | null;\n public destinationTxHashes!: CrossChainTransactionData[] | null;\n public timeEstimateSeconds!: number;\n public correlationId!: string;\n /** Keep it: NEAR Intents' signature over the quote settles a dispute. */\n public quoteSignature!: string;\n public idempotencyKey!: string | null;\n public expiresAt!: Date;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: CrossChainSwapData) {\n super(client, data);\n }\n\n protected override _patch(data: CrossChainSwapData): this {\n super._patch(data);\n this.status = data.status;\n this.providerStatus = data.providerStatus;\n this.network = data.network;\n this.originChain = data.originChain;\n this.originAsset = data.originAsset;\n this.originContract = data.originContract;\n this.destinationChain = data.destinationChain;\n this.destinationAsset = data.destinationAsset;\n this.destinationContract = data.destinationContract;\n this.amountIn = data.amountIn;\n this.feeBps = data.feeBps;\n this.feeAmount = data.feeAmount;\n this.amountOutEstimated = data.amountOutEstimated;\n this.amountOutMin = data.amountOutMin;\n this.slippageBps = data.slippageBps;\n this.recipient = data.recipient;\n this.refundTo = data.refundTo;\n this.depositAddress = data.depositAddress;\n this.depositMemo = data.depositMemo;\n this.depositUri = data.depositUri;\n this.qr = data.qr ?? null;\n this.depositTxHash = data.depositTxHash;\n this.amountOut = data.amountOut;\n this.refundedAmount = data.refundedAmount;\n this.originTxHashes = data.originTxHashes;\n this.destinationTxHashes = data.destinationTxHashes;\n this.timeEstimateSeconds = data.timeEstimateSeconds;\n this.correlationId = data.correlationId;\n this.quoteSignature = data.quoteSignature;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has reached an outcome that will not change. */\n public get isFinal(): boolean {\n return FINAL.includes(this.status);\n }\n\n public get isSucceeded(): boolean {\n return this.status === CrossChainSwapStatus.Succeeded;\n }\n\n /** Re-fetch from the API, updating this instance in place. */\n public async fetch(): Promise<this> {\n const fresh = await this.client.crossChainSwaps.fetch(this.id);\n return this._patch(fresh.toJSON());\n }\n\n /**\n * Report the transaction that paid the deposit address so NEAR Intents starts\n * without waiting for its indexer. Updates this instance in place.\n */\n public async reportDeposit(txHash: string): Promise<this> {\n const fresh = await this.client.crossChainSwaps.reportDeposit(this.id, txHash);\n return this._patch(fresh.toJSON());\n }\n\n public toJSON(): CrossChainSwapData {\n return {\n id: this.id,\n status: this.status,\n providerStatus: this.providerStatus,\n network: this.network,\n originChain: this.originChain,\n originAsset: this.originAsset,\n originContract: this.originContract,\n destinationChain: this.destinationChain,\n destinationAsset: this.destinationAsset,\n destinationContract: this.destinationContract,\n amountIn: this.amountIn,\n feeBps: this.feeBps,\n feeAmount: this.feeAmount,\n amountOutEstimated: this.amountOutEstimated,\n amountOutMin: this.amountOutMin,\n slippageBps: this.slippageBps,\n recipient: this.recipient,\n refundTo: this.refundTo,\n depositAddress: this.depositAddress,\n depositMemo: this.depositMemo,\n depositUri: this.depositUri,\n ...(this.qr ? { qr: this.qr } : {}),\n depositTxHash: this.depositTxHash,\n amountOut: this.amountOut,\n refundedAmount: this.refundedAmount,\n originTxHashes: this.originTxHashes,\n destinationTxHashes: this.destinationTxHashes,\n timeEstimateSeconds: this.timeEstimateSeconds,\n correlationId: this.correlationId,\n quoteSignature: this.quoteSignature,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { CrossChainSwap } from '@/structures/CrossChainSwap';\nimport type {\n CreateCrossChainSwapOptions,\n CrossChainAssetData,\n CrossChainQuoteData,\n CrossChainSwapData,\n CrossChainSwapListData,\n ListCrossChainSwapsOptions,\n QuoteCrossChainSwapOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of cross-chain swaps plus its pagination metadata. */\nexport interface CrossChainSwapPage {\n items: CrossChainSwap[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Swaps between Stellar, Solana and Monad, settled by NEAR Intents —\n * `client.crossChainSwaps`. Mainnet only: a `dev` key can list assets and\n * quote, but creating answers `400 network_unsupported`. Both legs on one chain\n * is `client.swaps` with `chain`.\n *\n * @example\n * const swap = await client.crossChainSwaps.create({\n * originChain: 'stellar', originAsset: 'XLM', amount: '100',\n * destinationChain: 'solana', destinationAsset: 'USDC',\n * recipient: solanaAddress, refundTo: stellarAddress,\n * });\n * // Pay swap.amountIn to swap.depositAddress (memo swap.depositMemo), or open swap.depositUri.\n */\nexport class CrossChainSwapManager extends BaseManager<CrossChainSwap> {\n private readonly route = '/cross-chain-swaps';\n\n /** The tokens NEAR Intents can swap on Stellar, Solana and Monad. */\n public async assets(): Promise<CrossChainAssetData[]> {\n const { data } = await this.rest.get<{ data: CrossChainAssetData[] }>(\n `${this.route}/assets`,\n );\n return data;\n }\n\n /** A dry quote: output, minimum and commission. Persists nothing. */\n public quote(options: QuoteCrossChainSwapOptions): Promise<CrossChainQuoteData> {\n return this.rest.post<CrossChainQuoteData>(`${this.route}/quote`, {\n body: options,\n });\n }\n\n /** A live quote: the deposit address, memo and wallet link that fund the swap. */\n public async create(options: CreateCrossChainSwapOptions): Promise<CrossChainSwap> {\n const data = await this.rest.post<CrossChainSwapData>(this.route, {\n body: options,\n });\n return this._add(new CrossChainSwap(this.client, data));\n }\n\n public async fetch(id: string): Promise<CrossChainSwap> {\n const data = await this.rest.get<CrossChainSwapData>(`${this.route}/${id}`);\n return this._add(new CrossChainSwap(this.client, data));\n }\n\n public async list(options: ListCrossChainSwapsOptions = {}): Promise<CrossChainSwapPage> {\n const data = await this.rest.get<CrossChainSwapListData>(this.route, {\n query: { status: options.status, take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new CrossChainSwap(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Report the transaction that paid the deposit address. */\n public async reportDeposit(id: string, txHash: string): Promise<CrossChainSwap> {\n const data = await this.rest.post<CrossChainSwapData>(\n `${this.route}/${id}/deposit`,\n { body: { txHash } },\n );\n return this._add(new CrossChainSwap(this.client, data));\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n DefindexDepositOptions,\n DefindexWithdrawOptions,\n} from '@/types/index';\n\n/**\n * DeFindex vaults on Stellar — `client.defindex`. Served only where the\n * deployment enables the DeFindex native plugin (`PLUGINS_ENABLED=defindex`);\n * elsewhere every call is a 404.\n *\n * The payloads are DeFindex's own and are passed through untyped. Deposits and\n * withdrawals come back as an unsigned transaction for the caller to sign and\n * hand to {@link submit}.\n */\nexport class DefindexManager {\n public readonly client: Client;\n private readonly route = '/defindex';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n public vaults<T = unknown>(): Promise<T> {\n return this.rest.get<T>(`${this.route}/vaults`);\n }\n\n public vault<T = unknown>(vault: string): Promise<T> {\n return this.rest.get<T>(`${this.route}/vaults/${encodeURIComponent(vault)}`);\n }\n\n /** An account's position in a vault. */\n public balance<T = unknown>(vault: string, account: string): Promise<T> {\n return this.rest.get<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/balance`,\n { query: { account } },\n );\n }\n\n public deposit<T = unknown>(vault: string, options: DefindexDepositOptions): Promise<T> {\n return this.rest.post<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/deposit`,\n { body: options },\n );\n }\n\n public withdraw<T = unknown>(vault: string, options: DefindexWithdrawOptions): Promise<T> {\n return this.rest.post<T>(\n `${this.route}/vaults/${encodeURIComponent(vault)}/withdraw`,\n { body: options },\n );\n }\n\n /** Submit a signed DeFindex transaction (base64 XDR). */\n public submit<T = unknown>(xdr: string): Promise<T> {\n return this.rest.post<T>(`${this.route}/submit`, { body: { xdr } });\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type {\n InstallPluginOptions,\n PluginActionResultData,\n PluginData,\n PluginListData,\n PluginUninstalledData,\n} from '@/types/index';\n\n/**\n * Plugins this deployment serves — `client.plugins`. A plugin runs only for a\n * consumer that installed it, and installing is consenting to exactly the\n * capabilities it declares: pass them back as `grantCapabilities`.\n *\n * @example\n * const plugin = await client.plugins.fetch('invoices');\n * await client.plugins.install('invoices', { grantCapabilities: plugin.capabilities });\n * const { output } = await client.plugins.query('invoices', 'list', { status: 'open' });\n */\nexport class PluginManager {\n public readonly client: Client;\n private readonly route = '/plugins';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n public async list(): Promise<PluginData[]> {\n const { data } = await this.rest.get<PluginListData>(this.route);\n return data;\n }\n\n public fetch(slug: string): Promise<PluginData> {\n return this.rest.get<PluginData>(`${this.route}/${encodeURIComponent(slug)}`);\n }\n\n /** Install (or re-consent to) a plugin. */\n public install(slug: string, options: InstallPluginOptions): Promise<PluginData> {\n return this.rest.put<PluginData>(\n `${this.route}/${encodeURIComponent(slug)}/installation`,\n { body: options },\n );\n }\n\n public uninstall(slug: string): Promise<PluginUninstalledData> {\n return this.rest.delete<PluginUninstalledData>(\n `${this.route}/${encodeURIComponent(slug)}/installation`,\n );\n }\n\n /** Run a read-only action the plugin declares. */\n public query<T = unknown>(\n slug: string,\n action: string,\n input?: Record<string, unknown>,\n ): Promise<PluginActionResultData<T>> {\n return this.rest.post<PluginActionResultData<T>>(\n `${this.route}/${encodeURIComponent(slug)}/queries/${encodeURIComponent(action)}`,\n { body: { input } },\n );\n }\n\n /** Run an action that may change the plugin's state. */\n public command<T = unknown>(\n slug: string,\n action: string,\n input?: Record<string, unknown>,\n ): Promise<PluginActionResultData<T>> {\n return this.rest.post<PluginActionResultData<T>>(\n `${this.route}/${encodeURIComponent(slug)}/commands/${encodeURIComponent(action)}`,\n { body: { input } },\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport type { REST } from '@/rest/REST';\nimport type { PublicKeyData } from '@/types/index';\n\n/**\n * The shared public API key — `client.publicKey`. It is what an open-source\n * wallet embeds to reach the few routes anonymous callers may use; the route\n * that serves it takes no key at all. Mostly useful to tooling that ships such\n * a wallet; a server with its own key has no need for it.\n */\nexport class PublicKeyManager {\n public readonly client: Client;\n private readonly route = '/public-key';\n\n constructor(client: Client) {\n this.client = client;\n }\n\n private get rest(): REST {\n return this.client.rest;\n }\n\n /** The public key for an environment (`dev` → testnet, `prod` → mainnet). */\n public fetch(env: 'dev' | 'prod' = 'dev'): Promise<PublicKeyData> {\n return this.rest.get<PublicKeyData>(this.route, { query: { env } });\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n PaymentIntentKind,\n PaymentIntentStatus,\n type PaymentChain,\n type PaymentIntentData,\n type UpdatePaymentIntentOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/**\n * A Stellar SEP-7 payment intent.\n *\n * Wraps the raw API payload with typed accessors and atomic action methods so\n * you can operate on it directly: `await intent.validate(txHash)`,\n * `await intent.cancel()`, `await intent.delete()`.\n */\nexport class PaymentIntent extends Base<PaymentIntentData> {\n public kind!: PaymentIntentKind;\n public status!: PaymentIntentStatus;\n /** Chain the payment settles on. */\n public chain!: PaymentChain;\n public network!: string;\n /** Payer account (null for PAY intents). */\n public source!: string | null;\n public destination!: string;\n public amount!: string | null;\n /** Asset code, or `native` for the chain's coin (XLM, SOL or MON). */\n public asset!: string;\n public assetIssuer!: string | null;\n /** Mandatory MEMO_ID. */\n public memo!: string;\n public msg!: string | null;\n public callback!: string | null;\n /** Unsigned transaction envelope (base64 XDR); null for PAY intents. */\n public xdr!: string | null;\n /** SEP-7 deep link (`tx` or `pay`). */\n public uri!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n public txHash!: string | null;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: PaymentIntentData) {\n super(client, data);\n }\n\n protected override _patch(data: PaymentIntentData): this {\n super._patch(data);\n this.kind = data.kind;\n this.status = data.status;\n this.chain = data.chain ?? 'stellar';\n this.network = data.network;\n this.source = data.source;\n this.destination = data.destination;\n this.amount = data.amount;\n this.asset = data.asset;\n this.assetIssuer = data.assetIssuer;\n this.memo = data.memo;\n this.msg = data.msg;\n this.callback = data.callback;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.qr = data.qr;\n this.txHash = data.txHash;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether this is a SEP-7 `tx` intent (known source, has XDR). */\n public get isTx(): boolean {\n return this.kind === PaymentIntentKind.Tx;\n }\n\n /** Whether this is a SEP-7 `pay` intent (no source). */\n public get isPay(): boolean {\n return this.kind === PaymentIntentKind.Pay;\n }\n\n /** Whether the payment has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === PaymentIntentStatus.Succeeded;\n }\n\n /** Whether the intent is still awaiting payment. */\n public get isPending(): boolean {\n return this.status === PaymentIntentStatus.Pending;\n }\n\n /** Human-readable asset label (the chain's coin for native: `XLM`, `SOL` or `MON`). */\n public get assetLabel(): string {\n if (this.asset && this.asset !== 'native') return this.asset;\n return this.chain === 'solana' ? 'SOL' : this.chain === 'monad' ? 'MON' : 'XLM';\n }\n\n /** Re-fetch this intent from the API, returning a fresh instance. */\n public fetch(): Promise<PaymentIntent> {\n return this.client.paymentIntents.fetch(this.id);\n }\n\n /** Update this intent (status / txHash / reference). Mutates and returns it. */\n public async edit(options: UpdatePaymentIntentOptions): Promise<this> {\n const updated = await this.client.paymentIntents.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /**\n * Validate a submitted transaction against this intent. On a match the status\n * is finalized server-side and the webhook fires.\n */\n public validate(txHash: string) {\n return this.client.paymentIntents.validate(this.id, { txHash });\n }\n\n /** Mark this intent as cancelled. */\n public cancel(): Promise<this> {\n return this.edit({ status: PaymentIntentStatus.Cancelled });\n }\n\n /** Delete this intent. */\n public delete() {\n return this.client.paymentIntents.delete(this.id);\n }\n\n public toJSON(): PaymentIntentData {\n return {\n id: this.id,\n kind: this.kind,\n status: this.status,\n chain: this.chain,\n network: this.network,\n source: this.source,\n destination: this.destination,\n amount: this.amount,\n asset: this.asset,\n assetIssuer: this.assetIssuer,\n memo: this.memo,\n msg: this.msg,\n callback: this.callback,\n xdr: this.xdr,\n uri: this.uri,\n qr: this.qr,\n txHash: this.txHash,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { PaymentIntent } from '@/structures/PaymentIntent';\nimport type {\n CreatePayPaymentIntentOptions,\n CreateTxPaymentIntentOptions,\n DeletedData,\n ListPaymentIntentsOptions,\n PaymentIntentData,\n PaymentIntentListData,\n PaymentIntentTransitionData,\n UpdatePaymentIntentOptions,\n ValidatePaymentIntentOptions,\n ValidationOutcomeData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\nimport { resolveIntentBody } from '@/common/intent-input';\n\n/** A page of payment intents plus its pagination metadata. */\nexport interface PaymentIntentPage {\n items: PaymentIntent[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Validation outcome with the (optional) refreshed intent materialized. */\nexport interface ValidationOutcome {\n valid: boolean;\n status: ValidationOutcomeData['status'];\n reason: string | null;\n paymentIntent: PaymentIntent | null;\n}\n\n/**\n * Manages Stellar payment intents — `client.paymentIntents`.\n *\n * @example\n * const intent = await client.paymentIntents.createTx({\n * source: 'G...', destination: 'G...', amount: '25.5',\n * });\n * console.log(intent.uri, intent.qr);\n */\nexport class PaymentIntentManager extends BaseManager<PaymentIntent> {\n private readonly route = '/payment-intents';\n\n /** Create a SEP-7 `tx` intent (source known → unsigned XDR + tx URI + QR). */\n public async createTx(\n options: CreateTxPaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.post<PaymentIntentData>(`${this.route}/tx`, {\n body: resolveIntentBody(options),\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /**\n * Create a `pay` intent (no source → a payment link + QR, no XDR): SEP-7 on Stellar (the\n * default), Solana Pay with `chain: 'solana'`, EIP-681 with `chain: 'monad'`.\n */\n public async createPay(\n options: CreatePayPaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.post<PaymentIntentData>(`${this.route}/pay`, {\n body: resolveIntentBody(options),\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /** Get a single payment intent by id. */\n public async fetch(id: string): Promise<PaymentIntent> {\n const data = await this.rest.get<PaymentIntentData>(`${this.route}/${id}`);\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /**\n * Every status change an intent went through, oldest first — who moved it\n * (`api`, `validate`, `observer`, `system`), when, and with which transaction.\n */\n public transitions(id: string): Promise<PaymentIntentTransitionData[]> {\n return this.rest.get<PaymentIntentTransitionData[]>(`${this.route}/${id}/transitions`);\n }\n\n /** List the consumer's payment intents (paginated). */\n public async list(\n options: ListPaymentIntentsOptions = {},\n ): Promise<PaymentIntentPage> {\n const data = await this.rest.get<PaymentIntentListData>(this.route, {\n query: {\n status: options.status,\n chain: options.chain,\n createdFrom: options.createdFrom instanceof Date ? options.createdFrom.toISOString() : options.createdFrom,\n take: options.take,\n skip: options.skip,\n },\n });\n return {\n items: data.data.map((d) => this._add(new PaymentIntent(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Update a payment intent (status / txHash / reference). */\n public async update(\n id: string,\n options: UpdatePaymentIntentOptions,\n ): Promise<PaymentIntent> {\n const data = await this.rest.patch<PaymentIntentData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new PaymentIntent(this.client, data));\n }\n\n /** Delete a payment intent. */\n public async delete(id: string): Promise<DeletedData> {\n const result = await this.rest.delete<DeletedData>(`${this.route}/${id}`);\n this.cache.delete(id);\n return result;\n }\n\n /**\n * Validate a submitted transaction against the intent (tx success +\n * destination + amount + memo). Finalizes status server-side and fires events.\n */\n public async validate(\n id: string,\n options: ValidatePaymentIntentOptions,\n ): Promise<ValidationOutcome> {\n const data = await this.rest.post<ValidationOutcomeData>(\n `${this.route}/${id}/validate`,\n { body: options },\n );\n const paymentIntent = data.paymentIntent\n ? this._add(new PaymentIntent(this.client, data.paymentIntent))\n : null;\n return {\n valid: data.valid,\n status: data.status,\n reason: data.reason ?? null,\n paymentIntent,\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n PrivatePaymentStatus,\n type MerchantFeeData,\n type PrivatePaymentData,\n type PrivatePaymentNetwork,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/**\n * A private payment, from `client.privatePayments`: an amount in XLM whose value\n * is hidden on-chain. The payer pays it with confidential transfers on Cosmos\n * Pay's confidential token (net to {@link recipient}, the commission to\n * {@link feeAccount}, and a third one when there is a {@link merchantFee}) and\n * confirms them through the private checkout. Poll with `await payment.fetch()`.\n */\nexport class PrivatePayment extends Base<PrivatePaymentData> {\n /** As it reads now: a PENDING payment past {@link expiresAt} reads EXPIRED. */\n public status!: PrivatePaymentStatus;\n public network!: PrivatePaymentNetwork;\n /** The confidential token every transfer must be made on. */\n public tokenContract!: string;\n /** What the payer pays in total, in XLM. */\n public amount!: string;\n /** What the merchant receives, in XLM. */\n public netAmount!: string;\n /** The commission, in XLM. */\n public feeAmount!: string;\n /** The commission rate the payment was priced at, in basis points. */\n public feeBps!: number;\n /** The merchant (G...). */\n public recipient!: string;\n /** Cosmos Pay's account the commission is paid to. */\n public feeAccount!: string;\n /** The account the transfers came from, once settled. */\n public payer!: string | null;\n public paymentTxHash!: string | null;\n public feeTxHash!: string | null;\n public merchantFee!: MerchantFeeData | null;\n public merchantFeeTxHash!: string | null;\n public description!: string | null;\n public idempotencyKey!: string;\n /** Every transfer must close before this. */\n public expiresAt!: Date;\n public settledAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: PrivatePaymentData) {\n super(client, data);\n }\n\n protected override _patch(data: PrivatePaymentData): this {\n super._patch(data);\n this.status = data.status;\n this.network = data.network;\n this.tokenContract = data.tokenContract;\n this.amount = data.amount;\n this.netAmount = data.netAmount;\n this.feeAmount = data.feeAmount;\n this.feeBps = data.feeBps;\n this.recipient = data.recipient;\n this.feeAccount = data.feeAccount;\n this.payer = data.payer;\n this.paymentTxHash = data.paymentTxHash;\n this.feeTxHash = data.feeTxHash;\n this.merchantFee = data.merchantFee;\n this.merchantFeeTxHash = data.merchantFeeTxHash;\n this.description = data.description;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.settledAt = data.settledAt ? new Date(data.settledAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the payment is still waiting for its transfers. */\n public get isPending(): boolean {\n return this.status === PrivatePaymentStatus.Pending;\n }\n\n /** Whether every transfer has been confirmed. */\n public get isSucceeded(): boolean {\n return this.status === PrivatePaymentStatus.Succeeded;\n }\n\n /** Whether it passed {@link expiresAt} without settling (it can still settle with transfers that closed in time). */\n public get isExpired(): boolean {\n return this.status === PrivatePaymentStatus.Expired;\n }\n\n /** Re-fetch from the API, updating this instance in place. */\n public async fetch(): Promise<this> {\n const fresh = await this.client.privatePayments.fetch(this.id);\n return this._patch(fresh.toJSON());\n }\n\n public toJSON(): PrivatePaymentData {\n return {\n id: this.id,\n status: this.status,\n network: this.network,\n tokenContract: this.tokenContract,\n amount: this.amount,\n netAmount: this.netAmount,\n feeAmount: this.feeAmount,\n feeBps: this.feeBps,\n recipient: this.recipient,\n feeAccount: this.feeAccount,\n payer: this.payer,\n paymentTxHash: this.paymentTxHash,\n feeTxHash: this.feeTxHash,\n merchantFee: this.merchantFee,\n merchantFeeTxHash: this.merchantFeeTxHash,\n description: this.description,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n settledAt: this.settledAt ? this.settledAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { pathSegment } from '@/util/path';\nimport { PrivatePayment } from '@/structures/PrivatePayment';\nimport type {\n CreatePrivatePaymentOptions,\n ListPrivatePaymentsOptions,\n PrivatePaymentData,\n PrivatePaymentListData,\n PrivatePaymentsConfigData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of private payments plus its pagination metadata. */\nexport interface PrivatePaymentPage {\n items: PrivatePayment[];\n total: number;\n take: number;\n skip: number;\n}\n\n/**\n * Private payments: `client.privatePayments`.\n *\n * A private payment hides its amount on-chain. It is priced in XLM and paid with\n * confidential transfers on Cosmos Pay's confidential token; the merchant\n * receives `amount` minus a 0.18% commission. They run on Stellar testnet only\n * for now: on mainnet, {@link config} answers `enabled: false`.\n *\n * The SDK creates and reads them with your API key. The payer completes one in\n * the private checkout, which proves the transfers in their own browser.\n *\n * @example\n * const payment = await client.privatePayments.create({\n * amount: '25.5', recipient: 'G...', description: 'Order #24',\n * });\n * // ...the payer pays it through the private checkout...\n * await payment.fetch(); // payment.status: PENDING, then SUCCEEDED (or EXPIRED)\n */\nexport class PrivatePaymentManager extends BaseManager<PrivatePayment> {\n private readonly route = '/zk-payments';\n\n /**\n * Create a private payment. The server prices it (`amount` = `netAmount` +\n * `feeAmount`) and checks on-chain that the recipient holds a confidential\n * account on the token, refusing it with `recipient_not_registered` otherwise.\n */\n public async create(options: CreatePrivatePaymentOptions): Promise<PrivatePayment> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<PrivatePaymentData>(this.route, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new PrivatePayment(this.client, data));\n }\n\n /** List the private payments on the key's network, newest first. */\n public async list(options: ListPrivatePaymentsOptions = {}): Promise<PrivatePaymentPage> {\n const data = await this.rest.get<PrivatePaymentListData>(this.route, {\n query: { status: options.status, take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new PrivatePayment(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Get one of your private payments, with the transfers that settled it. */\n public async fetch(id: string): Promise<PrivatePayment> {\n const data = await this.rest.get<PrivatePaymentData>(`${this.route}/${pathSegment(id)}`);\n return this._add(new PrivatePayment(this.client, data));\n }\n\n /**\n * The private payments setup of the key's network: the token, registries,\n * auditor id, commission and fee account a wallet registers and pays against.\n * `enabled` is false where private payments do not run yet.\n */\n public config(): Promise<PrivatePaymentsConfigData> {\n return this.rest.get<PrivatePaymentsConfigData>(`${this.route}/config`);\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n ProductKind,\n type ProductData,\n type UpdateProductOptions,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A product / price the consumer can charge for. */\nexport class Product extends Base<ProductData> {\n public name!: string;\n public description!: string | null;\n public amount!: string | null;\n /** Asset code, or `native` for XLM. */\n public asset!: string;\n public kind!: ProductKind;\n public active!: boolean;\n public reference!: string | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ProductData) {\n super(client, data);\n }\n\n protected override _patch(data: ProductData): this {\n super._patch(data);\n this.name = data.name;\n this.description = data.description;\n this.amount = data.amount;\n this.asset = data.asset;\n this.kind = data.kind;\n this.active = data.active;\n this.reference = data.reference;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Human-readable asset label (`XLM` for native). */\n public get assetLabel(): string {\n return !this.asset || this.asset === 'native' ? 'XLM' : this.asset;\n }\n\n /** Re-fetch this product. */\n public fetch(): Promise<Product> {\n return this.client.products.fetch(this.id);\n }\n\n /** Update this product. Mutates and returns this. */\n public async edit(options: UpdateProductOptions): Promise<this> {\n const updated = await this.client.products.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Mark the product active. */\n public activate(): Promise<this> {\n return this.edit({ active: true });\n }\n\n /** Mark the product inactive. */\n public deactivate(): Promise<this> {\n return this.edit({ active: false });\n }\n\n /** Delete this product. */\n public delete() {\n return this.client.products.delete(this.id);\n }\n\n public toJSON(): ProductData {\n return {\n id: this.id,\n name: this.name,\n description: this.description,\n amount: this.amount,\n asset: this.asset,\n kind: this.kind,\n active: this.active,\n reference: this.reference,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { Product } from '@/structures/Product';\nimport type {\n CreateProductOptions,\n ProductData,\n UpdateProductOptions,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\ntype ProductDeletedData = { id: string; deleted: boolean };\n\n/**\n * Manages products / prices — `client.products`.\n *\n * @example\n * const product = await client.products.create({\n * name: 'Pro plan — monthly', amount: '49.00', assetCode: 'USDC',\n * });\n */\nexport class ProductManager extends BaseManager<Product> {\n private readonly route = '/products';\n\n /** Create a product. */\n public async create(options: CreateProductOptions): Promise<Product> {\n const data = await this.rest.post<ProductData>(this.route, { body: options });\n return this._add(new Product(this.client, data));\n }\n\n /** List the consumer's products. */\n public async list(): Promise<Product[]> {\n const data = await this.rest.get<ProductData[]>(this.route);\n return data.map((d) => this._add(new Product(this.client, d)));\n }\n\n /** Get a product by id. */\n public async fetch(id: string): Promise<Product> {\n const data = await this.rest.get<ProductData>(`${this.route}/${id}`);\n return this._add(new Product(this.client, data));\n }\n\n /** Update a product. */\n public async update(\n id: string,\n options: UpdateProductOptions,\n ): Promise<Product> {\n const data = await this.rest.patch<ProductData>(`${this.route}/${id}`, {\n body: options,\n });\n return this._add(new Product(this.client, data));\n }\n\n /** Delete a product. */\n public async delete(id: string): Promise<ProductDeletedData> {\n const result = await this.rest.delete<ProductDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n SwapStatus,\n type ChainSwapData,\n type ChainSwapTransaction,\n type EvmCallData,\n type OtherSwapChain,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { ChainSwapSubmitOutcome } from '@/managers/SwapManager';\n\n/**\n * A same-chain swap on Solana (built by Jupiter) or Monad (built by Kuru Flow),\n * from `client.swaps` with `chain: 'solana' | 'monad'`.\n *\n * Non-custodial like a Stellar {@link Swap}: sign {@link transaction} in the\n * wallet that owns {@link source}, then `await swap.submit({ signedTransaction })`.\n * The server checks it is the transaction it built before broadcasting it. On\n * Monad, when {@link approval} is set, send and confirm that `approve` call first.\n */\nexport class ChainSwap extends Base<ChainSwapData> {\n public chain!: OtherSwapChain;\n public network!: string;\n /** The aggregator that built it. */\n public provider!: 'jupiter' | 'kuru';\n public status!: SwapStatus;\n /** The wallet that signs, pays and receives. */\n public source!: string;\n /** `native`, or the SPL mint / ERC-20 address. */\n public sendAsset!: string;\n public sendAmount!: string;\n public destAsset!: string;\n public destEstimated!: string;\n public destMin!: string;\n public feeBps!: number;\n /** The commission, in the destination asset. */\n public feeAmount!: string;\n public slippageBps!: number;\n public path!: { code: string; issuer: string | null }[];\n /** What the wallet signs. */\n public transaction!: ChainSwapTransaction;\n /** Monad ERC-20 sales with a short allowance: the `approve` call to send first. */\n public approval!: EvmCallData | null;\n public txHash!: string | null;\n public idempotencyKey!: string | null;\n /** Submit refuses the transaction after this. */\n public expiresAt!: Date;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: ChainSwapData) {\n super(client, data);\n }\n\n protected override _patch(data: ChainSwapData): this {\n super._patch(data);\n this.chain = data.chain;\n this.network = data.network;\n this.provider = data.provider;\n this.status = data.status;\n this.source = data.source;\n this.sendAsset = data.sendAsset;\n this.sendAmount = data.sendAmount;\n this.destAsset = data.destAsset;\n this.destEstimated = data.destEstimated;\n this.destMin = data.destMin;\n this.feeBps = data.feeBps;\n this.feeAmount = data.feeAmount;\n this.slippageBps = data.slippageBps;\n this.path = data.path;\n this.transaction = data.transaction;\n this.approval = data.approval;\n this.txHash = data.txHash;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === SwapStatus.Succeeded;\n }\n\n /** Whether the swap is still awaiting submission. */\n public get isPending(): boolean {\n return this.status === SwapStatus.Pending;\n }\n\n /** Whether the built transaction can no longer be submitted. */\n public get isStale(): boolean {\n return this.isPending && this.expiresAt.getTime() <= Date.now();\n }\n\n /** Re-fetch this swap from the API. */\n public async fetch(): Promise<ChainSwap> {\n return (await this.client.swaps.fetch(this.id)) as ChainSwap;\n }\n\n /**\n * Relay the signed transaction. Mutates this instance from the refreshed\n * swap in the outcome and returns the outcome.\n */\n public async submit(options: {\n signedTransaction: string;\n }): Promise<ChainSwapSubmitOutcome> {\n const outcome = (await this.client.swaps.submit(\n this.id,\n options,\n )) as ChainSwapSubmitOutcome;\n this._patch(outcome.swap.toJSON());\n return outcome;\n }\n\n public toJSON(): ChainSwapData {\n return {\n id: this.id,\n chain: this.chain,\n network: this.network,\n provider: this.provider,\n status: this.status,\n source: this.source,\n sendAsset: this.sendAsset,\n sendAmount: this.sendAmount,\n destAsset: this.destAsset,\n destEstimated: this.destEstimated,\n destMin: this.destMin,\n feeBps: this.feeBps,\n feeAmount: this.feeAmount,\n slippageBps: this.slippageBps,\n path: this.path,\n transaction: this.transaction,\n approval: this.approval,\n txHash: this.txHash,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport { SwapStatus, type SwapData } from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { SwapSubmitOutcome } from '@/managers/SwapManager';\n\n/**\n * A Stellar path-payment swap. Solana and Monad swaps are {@link ChainSwap}.\n *\n * Wraps the raw API payload with typed accessors and atomic action methods so\n * you can operate on it directly: `await swap.fetch()`,\n * `await swap.submit({ signedXdr })`.\n */\nexport class Swap extends Base<SwapData> {\n public status!: SwapStatus;\n public network!: string;\n /** Account performing the swap. */\n public source!: string;\n /** Account that receives the swapped asset. */\n public destination!: string;\n /** Asset code being sent, or `native` for XLM. */\n public sendAsset!: string;\n public sendAssetIssuer!: string | null;\n public sendAmount!: string;\n public feeAmount!: string;\n public feeBps!: number;\n /** Amount swapped after the fee is deducted. */\n public swapAmount!: string;\n /** Asset code being received, or `native` for XLM. */\n public destAsset!: string;\n public destAssetIssuer!: string | null;\n public destEstimated!: string;\n public destMin!: string;\n public slippageBps!: number;\n public path!: { code: string; issuer: string | null }[];\n public memo!: string | null;\n /** Unsigned transaction envelope (base64 XDR). */\n public xdr!: string;\n /** SEP-7 deep link. */\n public uri!: string;\n public txHash!: string;\n /** QR code of the SEP-7 URI (PNG data URL). */\n public qr!: string;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: SwapData) {\n super(client, data);\n }\n\n protected override _patch(data: SwapData): this {\n super._patch(data);\n this.status = data.status;\n this.network = data.network;\n this.source = data.source;\n this.destination = data.destination;\n this.sendAsset = data.sendAsset;\n this.sendAssetIssuer = data.sendAssetIssuer;\n this.sendAmount = data.sendAmount;\n this.feeAmount = data.feeAmount;\n this.feeBps = data.feeBps;\n this.swapAmount = data.swapAmount;\n this.destAsset = data.destAsset;\n this.destAssetIssuer = data.destAssetIssuer;\n this.destEstimated = data.destEstimated;\n this.destMin = data.destMin;\n this.slippageBps = data.slippageBps;\n this.path = data.path;\n this.memo = data.memo;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.txHash = data.txHash;\n this.qr = data.qr;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the swap has settled on-chain. */\n public get isSucceeded(): boolean {\n return this.status === SwapStatus.Succeeded;\n }\n\n /** Whether the swap is still awaiting submission. */\n public get isPending(): boolean {\n return this.status === SwapStatus.Pending;\n }\n\n /** Human-readable send asset label (`XLM` for native). */\n public get sendAssetLabel(): string {\n return !this.sendAsset || this.sendAsset === 'native' ? 'XLM' : this.sendAsset;\n }\n\n /** Human-readable destination asset label (`XLM` for native). */\n public get destAssetLabel(): string {\n return !this.destAsset || this.destAsset === 'native' ? 'XLM' : this.destAsset;\n }\n\n /** Re-fetch this swap from the API, returning a fresh instance. */\n public async fetch(): Promise<Swap> {\n return (await this.client.swaps.fetch(this.id)) as Swap;\n }\n\n /**\n * Relay the signed transaction for this swap. Mutates this instance from the\n * refreshed swap in the outcome and returns the outcome.\n */\n public async submit(options: { signedXdr: string }): Promise<SwapSubmitOutcome> {\n const outcome = (await this.client.swaps.submit(\n this.id,\n options,\n )) as SwapSubmitOutcome;\n this._patch(outcome.swap.toJSON());\n return outcome;\n }\n\n public toJSON(): SwapData {\n return {\n id: this.id,\n status: this.status,\n network: this.network,\n source: this.source,\n destination: this.destination,\n sendAsset: this.sendAsset,\n sendAssetIssuer: this.sendAssetIssuer,\n sendAmount: this.sendAmount,\n feeAmount: this.feeAmount,\n feeBps: this.feeBps,\n swapAmount: this.swapAmount,\n destAsset: this.destAsset,\n destAssetIssuer: this.destAssetIssuer,\n destEstimated: this.destEstimated,\n destMin: this.destMin,\n slippageBps: this.slippageBps,\n path: this.path,\n memo: this.memo,\n xdr: this.xdr,\n uri: this.uri,\n txHash: this.txHash,\n qr: this.qr,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { ChainSwap } from '@/structures/ChainSwap';\nimport { Swap } from '@/structures/Swap';\nimport type {\n ChainSwapData,\n ChainSwapListData,\n ChainSwapSubmitOutcomeData,\n CreateSwapOptions,\n ListSwapsOptions,\n OtherSwapChain,\n QuoteSwapOptions,\n SubmitSwapOptions,\n SwapData,\n SwapListData,\n SwapQuoteData,\n SwapStatus,\n SwapSubmitOutcomeData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of swaps plus its pagination metadata. */\nexport interface SwapPage<T extends Swap | ChainSwap = Swap> {\n items: T[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Submission outcome of a Stellar swap, with the refreshed swap materialized. */\nexport interface SwapSubmitOutcome {\n submitted: boolean;\n status: SwapStatus;\n txHash: string | null;\n reason: string | null;\n resultCodes: string[] | null;\n swap: Swap;\n}\n\n/** Submission outcome of a Solana or Monad swap. */\nexport interface ChainSwapSubmitOutcome {\n submitted: boolean;\n status: SwapStatus;\n txHash: string;\n swap: ChainSwap;\n}\n\n/** A request that names a chain off Stellar. */\ntype OnOtherChain = { chain: OtherSwapChain };\n\n/** A Solana or Monad payload carries its `chain`; a Stellar one never does. */\nfunction isChainSwapData(data: SwapData | ChainSwapData): data is ChainSwapData {\n return 'chain' in data && typeof data.chain === 'string';\n}\n\n/**\n * Same-chain swaps — `client.swaps`. No `chain` (or `'stellar'`) is a Stellar\n * path payment and yields a {@link Swap}, exactly as before; `'solana'` goes\n * through Jupiter and `'monad'` through Kuru Flow and yields a {@link ChainSwap}.\n * Swaps between chains are `client.crossChainSwaps`.\n *\n * @example\n * const swap = await client.swaps.create({\n * amount: '100', destAssetCode: 'USDC', destAssetIssuer: 'GA5Z…', source: 'G...',\n * });\n * console.log(swap.uri, swap.qr);\n *\n * const sol = await client.swaps.create({\n * chain: 'solana', amount: '0.1', sourceAssetCode: 'SOL',\n * destAssetCode: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', source: wallet,\n * });\n * await sol.submit({ signedTransaction: signInWallet(sol.transaction) });\n */\nexport class SwapManager extends BaseManager<Swap | ChainSwap> {\n private readonly route = '/swaps';\n\n /** Price a swap without creating it. Returns a plain quote (not a {@link Swap}). */\n public async quote(options: QuoteSwapOptions): Promise<SwapQuoteData> {\n return this.rest.post<SwapQuoteData>(`${this.route}/quote`, {\n body: options,\n });\n }\n\n /** Create a swap: an unsigned transaction for the source wallet to sign. */\n public async create(options: CreateSwapOptions & OnOtherChain): Promise<ChainSwap>;\n public async create(options: CreateSwapOptions): Promise<Swap>;\n public async create(options: CreateSwapOptions): Promise<Swap | ChainSwap> {\n const data = await this.rest.post<SwapData | ChainSwapData>(this.route, {\n body: options,\n });\n return this.materialize(data);\n }\n\n /** Get a single swap by id, on any chain. */\n public async fetch(id: string): Promise<Swap | ChainSwap> {\n const data = await this.rest.get<SwapData | ChainSwapData>(\n `${this.route}/${id}`,\n );\n return this.materialize(data);\n }\n\n /** List the consumer's swaps on one chain (Stellar when `chain` is omitted). */\n public async list(options: ListSwapsOptions & OnOtherChain): Promise<SwapPage<ChainSwap>>;\n public async list(options?: ListSwapsOptions): Promise<SwapPage<Swap>>;\n public async list(\n options: ListSwapsOptions = {},\n ): Promise<SwapPage<Swap> | SwapPage<ChainSwap>> {\n const data = await this.rest.get<SwapListData | ChainSwapListData>(\n this.route,\n {\n query: {\n chain: options.chain,\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n },\n );\n return {\n items: data.data.map((d) => this.materialize(d)),\n total: data.total,\n take: data.take,\n skip: data.skip,\n } as SwapPage<Swap> | SwapPage<ChainSwap>;\n }\n\n /**\n * Relay a signed swap transaction to its network: `{ signedXdr }` for a\n * Stellar swap, `{ signedTransaction }` for a Solana or Monad one.\n */\n public async submit(\n id: string,\n options: SubmitSwapOptions,\n ): Promise<SwapSubmitOutcome | ChainSwapSubmitOutcome> {\n const data = await this.rest.post<\n SwapSubmitOutcomeData | ChainSwapSubmitOutcomeData\n >(`${this.route}/${id}/submit`, { body: options });\n if (isChainSwapData(data.swap)) {\n return {\n submitted: data.submitted,\n status: data.status,\n txHash: (data as ChainSwapSubmitOutcomeData).txHash,\n swap: this._add(new ChainSwap(this.client, data.swap)) as ChainSwap,\n };\n }\n const stellar = data as SwapSubmitOutcomeData;\n return {\n submitted: stellar.submitted,\n status: stellar.status,\n txHash: stellar.txHash ?? null,\n reason: stellar.reason ?? null,\n resultCodes: stellar.resultCodes ?? null,\n swap: this._add(new Swap(this.client, stellar.swap)) as Swap,\n };\n }\n\n private materialize(data: SwapData): Swap;\n private materialize(data: ChainSwapData): ChainSwap;\n private materialize(data: SwapData | ChainSwapData): Swap | ChainSwap;\n private materialize(data: SwapData | ChainSwapData): Swap | ChainSwap {\n return this._add(\n isChainSwapData(data)\n ? new ChainSwap(this.client, data)\n : new Swap(this.client, data),\n );\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n Usdt0TransferStatus,\n type MerchantFeeData,\n type Usdt0Destination,\n type Usdt0Receives,\n type Usdt0TransferData,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\nimport type { Usdt0SubmitOutcome } from '@/managers/Usdt0Manager';\n\n/** Statuses after which nothing changes. */\nconst FINAL: readonly Usdt0TransferStatus[] = [\n Usdt0TransferStatus.Delivered,\n Usdt0TransferStatus.Failed,\n Usdt0TransferStatus.Expired,\n];\n\n/**\n * A USDT0 transfer from Stellar to an EVM network through LayerZero, from\n * `client.usdt0`.\n *\n * Non-custodial like a {@link Swap}: the API builds one Soroban transaction\n * ({@link xdr}, or the SEP-7 {@link uri}), the account that holds the USDT0\n * ({@link source}) signs it, and `await transfer.submit({ signedXdr })` relays it.\n * LayerZero then delivers it (about 27 minutes on every route); follow it with\n * `await transfer.fetch()` until {@link isFinal}.\n */\nexport class Usdt0Transfer extends Base<Usdt0TransferData> {\n public status!: Usdt0TransferStatus;\n /** Always mainnet (`public`). */\n public network!: string;\n /** The Stellar account that holds the USDT0, signs and pays the fees in XLM. */\n public source!: string;\n public to!: Usdt0Destination;\n /** The destination network's LayerZero endpoint id. */\n public eid!: number;\n public receives!: Usdt0Receives;\n /** The EVM address credited. */\n public recipient!: string;\n public amount!: string;\n public amountSent!: string;\n public amountReceived!: string;\n public dust!: string;\n /** LayerZero's quoted messaging fee, in XLM. */\n public nativeFee!: string;\n /** What the transaction offers LayerZero, in XLM; the unused part is refunded. */\n public nativeFeeLimit!: string;\n /** The Stellar network fee, in XLM. */\n public networkFee!: string;\n public feeBps!: number;\n public feeAmount!: string;\n public feeWallet!: string | null;\n /** The unsigned transaction (base64 XDR) to sign. */\n public xdr!: string;\n /** SEP-7 `tx` link carrying {@link xdr}. */\n public uri!: string;\n /** QR of {@link uri}; usually null (a Soroban transaction is too large for one), and absent from list rows. */\n public qr!: string | null;\n public txHash!: string | null;\n /** LayerZero's message id, once the transaction landed. */\n public guid!: string | null;\n public destinationTxHash!: string | null;\n /** LayerZero Scan's own status word, verbatim. */\n public scanStatus!: string | null;\n public scanUrl!: string | null;\n public failureReason!: string | null;\n public merchantFee!: MerchantFeeData | null;\n public idempotencyKey!: string | null;\n /** Submit refuses the transaction after this. */\n public expiresAt!: Date;\n public submittedAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n /**\n * The record's read token, returned by the create only when the client uses the\n * shared public key. Kept across {@link fetch} and {@link submit}, which send it\n * as `X-Record-Token`.\n */\n public publicToken!: string | null;\n\n constructor(client: Client, data: Usdt0TransferData) {\n super(client, data);\n }\n\n protected override _patch(data: Usdt0TransferData): this {\n super._patch(data);\n this.status = data.status;\n this.network = data.network;\n this.source = data.source;\n this.to = data.to;\n this.eid = data.eid;\n this.receives = data.receives;\n this.recipient = data.recipient;\n this.amount = data.amount;\n this.amountSent = data.amountSent;\n this.amountReceived = data.amountReceived;\n this.dust = data.dust;\n this.nativeFee = data.nativeFee;\n this.nativeFeeLimit = data.nativeFeeLimit;\n this.networkFee = data.networkFee;\n this.feeBps = data.feeBps;\n this.feeAmount = data.feeAmount;\n this.feeWallet = data.feeWallet;\n this.xdr = data.xdr;\n this.uri = data.uri;\n this.qr = data.qr ?? null;\n this.txHash = data.txHash;\n this.guid = data.guid;\n this.destinationTxHash = data.destinationTxHash;\n this.scanStatus = data.scanStatus;\n this.scanUrl = data.scanUrl;\n this.failureReason = data.failureReason;\n this.merchantFee = data.merchantFee;\n this.idempotencyKey = data.idempotencyKey;\n this.expiresAt = new Date(data.expiresAt);\n this.submittedAt = data.submittedAt ? new Date(data.submittedAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n // Only the create carries it: a later read must not erase it.\n this.publicToken = data.publicToken ?? this.publicToken ?? null;\n return this;\n }\n\n /** Whether the transfer is still waiting for its signature. */\n public get isPending(): boolean {\n return this.status === Usdt0TransferStatus.Pending;\n }\n\n /** Whether it was credited on the destination network. */\n public get isDelivered(): boolean {\n return this.status === Usdt0TransferStatus.Delivered;\n }\n\n /** Whether it reached an outcome that will not change (DELIVERED, FAILED or EXPIRED). */\n public get isFinal(): boolean {\n return FINAL.includes(this.status);\n }\n\n /** Re-read it (the API refreshes it from the ledger and LayerZero Scan), updating this instance in place. */\n public async fetch(): Promise<this> {\n const fresh = await this.client.usdt0.fetch(this.id, this.recordToken());\n return this._patch(fresh.toJSON());\n }\n\n /**\n * Relay the signed transaction. Mutates this instance from the transfer in the\n * outcome and returns the outcome.\n */\n public async submit(options: { signedXdr: string }): Promise<Usdt0SubmitOutcome> {\n const outcome = await this.client.usdt0.submit(this.id, {\n signedXdr: options.signedXdr,\n ...this.recordToken(),\n });\n this._patch(outcome.transfer.toJSON());\n return outcome;\n }\n\n private recordToken(): { recordToken?: string } {\n return this.publicToken ? { recordToken: this.publicToken } : {};\n }\n\n public toJSON(): Usdt0TransferData {\n return {\n id: this.id,\n status: this.status,\n network: this.network,\n source: this.source,\n to: this.to,\n eid: this.eid,\n receives: this.receives,\n recipient: this.recipient,\n amount: this.amount,\n amountSent: this.amountSent,\n amountReceived: this.amountReceived,\n dust: this.dust,\n nativeFee: this.nativeFee,\n nativeFeeLimit: this.nativeFeeLimit,\n networkFee: this.networkFee,\n feeBps: this.feeBps,\n feeAmount: this.feeAmount,\n feeWallet: this.feeWallet,\n xdr: this.xdr,\n uri: this.uri,\n qr: this.qr,\n txHash: this.txHash,\n guid: this.guid,\n destinationTxHash: this.destinationTxHash,\n scanStatus: this.scanStatus,\n scanUrl: this.scanUrl,\n failureReason: this.failureReason,\n merchantFee: this.merchantFee,\n idempotencyKey: this.idempotencyKey,\n expiresAt: this.expiresAt.toISOString(),\n submittedAt: this.submittedAt ? this.submittedAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n ...(this.publicToken ? { publicToken: this.publicToken } : {}),\n };\n }\n}\n","import { pathSegment } from '@/util/path';\nimport { Usdt0Transfer } from '@/structures/Usdt0Transfer';\nimport type {\n CreateUsdt0TransferOptions,\n ListUsdt0TransfersOptions,\n QuoteUsdt0Options,\n SubmitUsdt0TransferOptions,\n Usdt0QuoteData,\n Usdt0RecordTokenOptions,\n Usdt0RoutesData,\n Usdt0SubmitOutcomeData,\n Usdt0TransferData,\n Usdt0TransferListData,\n Usdt0TransferStatus,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\n\n/** A page of USDT0 transfers plus its pagination metadata. */\nexport interface Usdt0TransferPage {\n items: Usdt0Transfer[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Submission outcome of a USDT0 transfer, with the refreshed transfer materialized. */\nexport interface Usdt0SubmitOutcome {\n /** True when the network accepted the transaction (SUBMITTED, or already DELIVERED). */\n submitted: boolean;\n status: Usdt0TransferStatus;\n txHash: string | null;\n /** Why it was not submitted: refused by the network (still PENDING, submit again) or failed on the ledger. */\n reason: string | null;\n transfer: Usdt0Transfer;\n}\n\n/** The `X-Record-Token` header, when there is a token to send. */\nfunction recordTokenHeader(recordToken: string | undefined): { headers?: Record<string, string> } {\n return recordToken ? { headers: { 'X-Record-Token': recordToken } } : {};\n}\n\n/**\n * USDT0 from Stellar to EVM networks: `client.usdt0`.\n *\n * USDT0 is Tether's omnichain USDT. From Stellar it travels through LayerZero's\n * OFT: Ethereum receives native USDT, every other network receives USDT0, and\n * every route takes an EVM recipient. Signing works like a swap: the API builds\n * the transaction, the holder signs it, and {@link submit} relays the signed XDR.\n * The holder pays LayerZero's fee and the network fee in XLM. Mainnet only: a\n * `dev` key gets `available: false` from {@link routes}, and `400\n * network_unsupported` from {@link quote} and {@link create}.\n *\n * @example\n * const quote = await client.usdt0.quote({ to: 'arb', amount: '12.5' });\n * const transfer = await client.usdt0.create({\n * source: 'G...', to: 'arb', recipient: '0x5aAe...', amount: '12.5',\n * });\n * // ...the holder signs transfer.xdr (or opens transfer.uri)...\n * await transfer.submit({ signedXdr });\n * await transfer.fetch(); // transfer.status: SUBMITTED, then DELIVERED\n */\nexport class Usdt0Manager extends BaseManager<Usdt0Transfer> {\n private readonly route = '/usdt0';\n\n /** The networks USDT0 can be sent to from Stellar, with the token and OFT a transfer uses. */\n public routes(): Promise<Usdt0RoutesData> {\n return this.rest.get<Usdt0RoutesData>(`${this.route}/routes`);\n }\n\n /**\n * Price a transfer: what is sent and arrives, the dust, LayerZero's fee and the\n * OFT's limits. Persists nothing.\n */\n public quote(options: QuoteUsdt0Options): Promise<Usdt0QuoteData> {\n return this.rest.post<Usdt0QuoteData>(`${this.route}/quote`, { body: options });\n }\n\n /** Build a transfer: the one unsigned Soroban transaction the holder signs (XDR and SEP-7 link). */\n public async create(options: CreateUsdt0TransferOptions): Promise<Usdt0Transfer> {\n const { idempotencyKey, ...body } = options;\n const data = await this.rest.post<Usdt0TransferData>(`${this.route}/transfers`, {\n body: { ...body, ...(idempotencyKey ? { idempotencyKey } : {}) },\n ...(idempotencyKey ? { headers: { 'Idempotency-Key': idempotencyKey } } : {}),\n });\n return this._add(new Usdt0Transfer(this.client, data));\n }\n\n /** List your transfers, newest first, as last refreshed (fetch one to refresh it). */\n public async list(options: ListUsdt0TransfersOptions = {}): Promise<Usdt0TransferPage> {\n const data = await this.rest.get<Usdt0TransferListData>(`${this.route}/transfers`, {\n query: { status: options.status, take: options.take, skip: options.skip },\n });\n return {\n items: data.data.map((d) => this._add(new Usdt0Transfer(this.client, d))),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /**\n * Get one transfer. While PENDING or SUBMITTED the API refreshes it from the\n * Stellar ledger and LayerZero Scan (at most every 15 seconds).\n */\n public async fetch(id: string, options: Usdt0RecordTokenOptions = {}): Promise<Usdt0Transfer> {\n const data = await this.rest.get<Usdt0TransferData>(\n `${this.route}/transfers/${pathSegment(id)}`,\n recordTokenHeader(options.recordToken),\n );\n return this._add(new Usdt0Transfer(this.client, data));\n }\n\n /**\n * Relay the signed transaction to Stellar mainnet. It must be the transaction\n * the API built for this transfer, signed. A refusal by the network leaves it\n * PENDING (`submitted: false`, `reason`) to submit again until it expires.\n */\n public async submit(\n id: string,\n options: SubmitUsdt0TransferOptions & Usdt0RecordTokenOptions,\n ): Promise<Usdt0SubmitOutcome> {\n const { recordToken, ...body } = options;\n const data = await this.rest.post<Usdt0SubmitOutcomeData>(\n `${this.route}/transfers/${pathSegment(id)}/submit`,\n { body, ...recordTokenHeader(recordToken) },\n );\n return {\n submitted: data.submitted,\n status: data.status,\n txHash: data.txHash ?? null,\n reason: data.reason ?? null,\n transfer: this._add(new Usdt0Transfer(this.client, data.transfer)),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport {\n WebhookDeliveryStatus,\n WebhookEventType,\n type WebhookDeliveryData,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/** A single attempt to deliver an event to a webhook endpoint (audit record). */\nexport class WebhookDelivery extends Base<WebhookDeliveryData> {\n public endpointId!: string;\n public eventType!: WebhookEventType;\n public eventId!: string;\n public payload!: Record<string, unknown>;\n public status!: WebhookDeliveryStatus;\n public attempts!: number;\n public responseStatus!: number | null;\n public error!: string | null;\n public lastAttemptAt!: Date | null;\n public createdAt!: Date;\n public updatedAt!: Date;\n\n constructor(client: Client, data: WebhookDeliveryData) {\n super(client, data);\n }\n\n protected override _patch(data: WebhookDeliveryData): this {\n super._patch(data);\n this.endpointId = data.endpointId;\n this.eventType = data.eventType;\n this.eventId = data.eventId;\n this.payload = data.payload;\n this.status = data.status;\n this.attempts = data.attempts;\n this.responseStatus = data.responseStatus;\n this.error = data.error;\n this.lastAttemptAt = data.lastAttemptAt ? new Date(data.lastAttemptAt) : null;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n public get isSucceeded(): boolean {\n return this.status === WebhookDeliveryStatus.Succeeded;\n }\n\n /** Manually re-send this delivery. */\n public redeliver(): Promise<WebhookDelivery> {\n return this.client.webhooks.redeliver(this.endpointId, this.id);\n }\n\n public toJSON(): WebhookDeliveryData {\n return {\n id: this.id,\n endpointId: this.endpointId,\n eventType: this.eventType,\n eventId: this.eventId,\n payload: this.payload,\n status: this.status,\n attempts: this.attempts,\n responseStatus: this.responseStatus,\n error: this.error,\n lastAttemptAt: this.lastAttemptAt ? this.lastAttemptAt.toISOString() : null,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import type { Client } from '@/client/Client';\nimport type {\n ListWebhookDeliveriesOptions,\n UpdateWebhookEndpointOptions,\n WebhookEndpointData,\n WebhookEndpointWithSecretData,\n WebhookEventType,\n} from '@/types/index';\nimport { Base } from '@/structures/Base';\n\n/**\n * A registered webhook endpoint.\n *\n * Note: the signing `secret` is only ever present on the instance returned by\n * `create()` / `rotateSecret()` — list/get responses never include it.\n */\nexport class WebhookEndpoint extends Base<WebhookEndpointData> {\n public url!: string;\n public description!: string | null;\n public enabled!: boolean;\n public eventTypes!: WebhookEventType[];\n public createdAt!: Date;\n public updatedAt!: Date;\n /** HMAC signing secret — only set on create/rotate responses. */\n public readonly secret: string | null;\n\n constructor(\n client: Client,\n data: WebhookEndpointData | WebhookEndpointWithSecretData,\n ) {\n super(client, data);\n this.secret = 'secret' in data ? data.secret : null;\n }\n\n protected override _patch(\n data: WebhookEndpointData | WebhookEndpointWithSecretData,\n ): this {\n super._patch(data);\n this.url = data.url;\n this.description = data.description;\n this.enabled = data.enabled;\n this.eventTypes = data.eventTypes;\n this.createdAt = new Date(data.createdAt);\n this.updatedAt = new Date(data.updatedAt);\n return this;\n }\n\n /** Whether the endpoint receives all events (empty subscription). */\n public get receivesAllEvents(): boolean {\n return this.eventTypes.length === 0;\n }\n\n /** Re-fetch this endpoint. */\n public fetch(): Promise<WebhookEndpoint> {\n return this.client.webhooks.fetch(this.id);\n }\n\n /** Update url/description/enabled/eventTypes. Mutates and returns this. */\n public async edit(options: UpdateWebhookEndpointOptions): Promise<this> {\n const updated = await this.client.webhooks.update(this.id, options);\n return this._patch(updated.toJSON());\n }\n\n /** Pause deliveries to this endpoint. */\n public disable(): Promise<this> {\n return this.edit({ enabled: false });\n }\n\n /** Resume deliveries to this endpoint. */\n public enable(): Promise<this> {\n return this.edit({ enabled: true });\n }\n\n /** Rotate the signing secret (returns a new instance carrying the secret). */\n public rotateSecret(): Promise<WebhookEndpoint> {\n return this.client.webhooks.rotateSecret(this.id);\n }\n\n /** Send a test event to verify the endpoint. */\n public ping() {\n return this.client.webhooks.ping(this.id);\n }\n\n /** List delivery attempts for this endpoint. */\n public fetchDeliveries(options?: ListWebhookDeliveriesOptions) {\n return this.client.webhooks.fetchDeliveries(this.id, options);\n }\n\n /** Delete this endpoint. */\n public delete() {\n return this.client.webhooks.delete(this.id);\n }\n\n public toJSON(): WebhookEndpointData {\n return {\n id: this.id,\n url: this.url,\n description: this.description,\n enabled: this.enabled,\n eventTypes: this.eventTypes,\n createdAt: this.createdAt.toISOString(),\n updatedAt: this.updatedAt.toISOString(),\n };\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto';\nimport { SIGNATURE_HEADER } from '@/util/Constants';\nimport type { WebhookEvent } from '@/types/index';\n\n/** Options for {@link Webhooks.verify} / {@link Webhooks.constructEvent}. */\nexport interface VerifyWebhookOptions {\n /**\n * Tolerance in seconds between the signed timestamp and now. Protects against\n * replay attacks. Defaults to 300 (5 minutes). Pass 0 to disable the check.\n */\n toleranceSeconds?: number;\n /** Override \"now\" (unix seconds) — useful for testing. */\n now?: number;\n}\n\n/** Thrown when a webhook signature fails verification. */\nexport class WebhookSignatureError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'WebhookSignatureError';\n }\n}\n\n/**\n * Stateless helpers to verify the HMAC signatures the Cosmos Pay dispatcher\n * sends with each webhook delivery, and to safely parse the event body.\n *\n * The dispatcher signs each POST with:\n * `X-Cosmos-Signature: t=<unixSeconds>,v1=<hexHmacSha256>`\n * where the HMAC-SHA256 is computed over `${t}.${rawBody}` using the endpoint's\n * `whsec_...` secret.\n *\n * @example\n * // Express raw-body handler\n * app.post('/hooks', express.raw({ type: '*/*' }), (req, res) => {\n * try {\n * const event = Webhooks.constructEvent(\n * req.body, // the RAW body (Buffer/string)\n * req.header('X-Cosmos-Signature'),\n * process.env.WEBHOOK_SECRET,\n * );\n * // event.type, event.data ...\n * res.sendStatus(200);\n * } catch {\n * res.sendStatus(400);\n * }\n * });\n */\nexport const Webhooks = {\n /** Header name the dispatcher uses for the signature. */\n SIGNATURE_HEADER,\n\n /**\n * Verify a webhook signature. Returns `true` on success, throws\n * {@link WebhookSignatureError} on any failure (so it never silently passes).\n */\n verify(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n secret: string,\n options: VerifyWebhookOptions = {},\n ): boolean {\n if (!signatureHeader) {\n throw new WebhookSignatureError('Missing signature header.');\n }\n if (!secret) {\n throw new WebhookSignatureError('Missing signing secret.');\n }\n\n const { timestamp, signature } = parseSignatureHeader(signatureHeader);\n const payload = typeof rawBody === 'string' ? rawBody : decode(rawBody);\n\n const expected = createHmac('sha256', secret)\n .update(`${timestamp}.${payload}`)\n .digest('hex');\n\n if (!safeEqualHex(expected, signature)) {\n throw new WebhookSignatureError('Signature mismatch.');\n }\n\n const tolerance = options.toleranceSeconds ?? 300;\n if (tolerance > 0) {\n const now = options.now ?? Math.floor(Date.now() / 1000);\n if (Math.abs(now - timestamp) > tolerance) {\n throw new WebhookSignatureError(\n `Timestamp outside tolerance (${tolerance}s).`,\n );\n }\n }\n\n return true;\n },\n\n /**\n * Verify the signature and return the parsed {@link WebhookEvent}. Throws\n * {@link WebhookSignatureError} if verification fails.\n */\n constructEvent<T = unknown>(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n secret: string,\n options: VerifyWebhookOptions = {},\n ): WebhookEvent<T> {\n this.verify(rawBody, signatureHeader, secret, options);\n const payload = typeof rawBody === 'string' ? rawBody : decode(rawBody);\n try {\n return JSON.parse(payload) as WebhookEvent<T>;\n } catch {\n throw new WebhookSignatureError('Body is not valid JSON.');\n }\n },\n};\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\nfunction parseSignatureHeader(header: string): {\n timestamp: number;\n signature: string;\n} {\n let timestamp: number | undefined;\n let signature: string | undefined;\n for (const part of header.split(',')) {\n const [key, value] = part.split('=');\n if (!key || value === undefined) continue;\n const k = key.trim();\n if (k === 't') timestamp = Number(value.trim());\n else if (k === 'v1') signature = value.trim();\n }\n if (timestamp === undefined || Number.isNaN(timestamp) || !signature) {\n throw new WebhookSignatureError('Malformed signature header.');\n }\n return { timestamp, signature };\n}\n\nfunction safeEqualHex(a: string, b: string): boolean {\n if (a.length !== b.length) return false;\n try {\n return timingSafeEqual(Buffer.from(a, 'hex'), Buffer.from(b, 'hex'));\n } catch {\n return false;\n }\n}\n\nfunction decode(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('utf8');\n}\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport { WebhookDelivery } from '@/structures/WebhookDelivery';\nimport { WebhookEndpoint } from '@/structures/WebhookEndpoint';\nimport type {\n CreateWebhookEndpointOptions,\n ListWebhookDeliveriesOptions,\n PaymentIntentData,\n UpdateWebhookEndpointOptions,\n WebhookDeliveryData,\n WebhookDeliveryListData,\n WebhookEndpointData,\n WebhookEndpointWithSecretData,\n AnyWebhookEvent,\n TypedWebhookEvent,\n WebhookEventDataMap,\n WebhookPingData,\n} from '@/types/index';\nimport { BaseManager } from '@/managers/BaseManager';\nimport { Webhooks, WebhookSignatureError } from '@/util/Webhooks';\nimport { SIGNATURE_HEADER } from '@/util/Constants';\n\n// Local alias — the deleted shape mirrors DeletedData.\ntype WebhookDeletedData = { id: string; deleted: boolean };\n\n/** A page of webhook deliveries plus its pagination metadata. */\nexport interface WebhookDeliveryPage {\n items: WebhookDelivery[];\n total: number;\n take: number;\n skip: number;\n}\n\n/** Options for verifying + dispatching an incoming webhook. */\nexport interface WebhookProcessOptions {\n /** Signing secret. Falls back to the client's `webhookSecret` when omitted. */\n secret?: string;\n /** Replay tolerance in seconds (default 300; 0 disables). */\n toleranceSeconds?: number;\n}\n\n/** Options for the built-in HTTP webhook handlers. */\nexport type WebhookHandlerOptions = WebhookProcessOptions;\n\n/**\n * Listener signatures for {@link WebhookManager}. You can subscribe with the raw\n * event type (`PAYMENT_INTENT_SUCCEEDED`), its camelCase alias\n * (`paymentIntentSucceeded`), or `event` to catch them all.\n */\nexport type WebhookListenerEvents = { event: [AnyWebhookEvent] } & {\n [K in keyof WebhookEventDataMap]: [TypedWebhookEvent<K>];\n} & {\n [K in keyof WebhookEventDataMap as CamelEvent<K>]: [TypedWebhookEvent<K>];\n};\n\n/** `SWAP_SUCCEEDED` → `SwapSucceeded`. */\ntype PascalEvent<S extends string> = S extends `${infer H}_${infer T}`\n ? `${Capitalize<Lowercase<H>>}${PascalEvent<T>}`\n : Capitalize<Lowercase<S>>;\n\n/** `SWAP_SUCCEEDED` → `swapSucceeded`, the alias each event is also emitted as. */\ntype CamelEvent<S extends string> = Uncapitalize<PascalEvent<S>>;\n\n/** Minimal Express-like request (so we don't depend on `@types/express`). */\ninterface RequestLike {\n headers: Record<string, string | string[] | undefined>;\n body?: unknown;\n rawBody?: unknown;\n [key: string]: unknown;\n}\n\n/** Minimal Express-like response. */\ninterface ResponseLike {\n status(code: number): ResponseLike;\n send(body?: unknown): unknown;\n end(body?: unknown): unknown;\n}\n\n// Typed event overloads (declaration merging onto the class).\nexport interface WebhookManager {\n on<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n once<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n off<E extends keyof WebhookListenerEvents>(\n event: E,\n listener: (...args: WebhookListenerEvents[E]) => void,\n ): this;\n emit<E extends keyof WebhookListenerEvents>(\n event: E,\n ...args: WebhookListenerEvents[E]\n ): boolean;\n}\n\n/**\n * Manages webhook endpoints, their delivery audit trail, **and** the incoming\n * event listener — `client.webhooks`.\n *\n * Registering endpoints (server-side CRUD):\n * @example\n * const endpoint = await client.webhooks.create({\n * url: 'https://me.example.com/hooks',\n * eventTypes: ['PAYMENT_INTENT_SUCCEEDED'],\n * });\n * console.log(endpoint.secret); // shown once — store it!\n *\n * Receiving events (listener):\n * @example\n * client.webhooks.on('paymentIntentSucceeded', (event) => {\n * console.log('Paid!', event.data.id);\n * });\n *\n * import { createServer } from 'node:http';\n * createServer(client.webhooks.createHandler()).listen(4242);\n */\nexport class WebhookManager extends BaseManager<WebhookEndpoint> {\n private readonly route = '/webhooks';\n\n // ── Endpoint CRUD ───────────────────────────────────────────────────────────\n\n /** Register a webhook endpoint (the returned instance carries the secret once). */\n public async create(\n options: CreateWebhookEndpointOptions,\n ): Promise<WebhookEndpoint> {\n const data = await this.rest.post<WebhookEndpointWithSecretData>(this.route, {\n body: options,\n });\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** List the consumer's webhook endpoints. */\n public async list(): Promise<WebhookEndpoint[]> {\n const data = await this.rest.get<WebhookEndpointData[]>(this.route);\n return data.map((d) => this._add(new WebhookEndpoint(this.client, d)));\n }\n\n /** Get a webhook endpoint by id. */\n public async fetch(id: string): Promise<WebhookEndpoint> {\n const data = await this.rest.get<WebhookEndpointData>(`${this.route}/${id}`);\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Update a webhook endpoint (url/description/enabled/eventTypes). */\n public async update(\n id: string,\n options: UpdateWebhookEndpointOptions,\n ): Promise<WebhookEndpoint> {\n const data = await this.rest.patch<WebhookEndpointData>(\n `${this.route}/${id}`,\n { body: options },\n );\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Delete a webhook endpoint. */\n public async delete(id: string): Promise<WebhookDeletedData> {\n const result = await this.rest.delete<WebhookDeletedData>(\n `${this.route}/${id}`,\n );\n this.cache.delete(id);\n return result;\n }\n\n /** Rotate the signing secret (returns a new instance carrying the secret). */\n public async rotateSecret(id: string): Promise<WebhookEndpoint> {\n const data = await this.rest.post<WebhookEndpointWithSecretData>(\n `${this.route}/${id}/rotate-secret`,\n );\n return this._add(new WebhookEndpoint(this.client, data));\n }\n\n /** Send a test event to verify the endpoint. */\n public ping(id: string): Promise<WebhookPingData> {\n return this.rest.post<WebhookPingData>(`${this.route}/${id}/ping`);\n }\n\n /** List delivery attempts for an endpoint (audit trail). */\n public async fetchDeliveries(\n id: string,\n options: ListWebhookDeliveriesOptions = {},\n ): Promise<WebhookDeliveryPage> {\n const data = await this.rest.get<WebhookDeliveryListData>(\n `${this.route}/${id}/deliveries`,\n {\n query: {\n status: options.status,\n take: options.take,\n skip: options.skip,\n },\n },\n );\n return {\n items: data.data.map((d) => new WebhookDelivery(this.client, d)),\n total: data.total,\n take: data.take,\n skip: data.skip,\n };\n }\n\n /** Manually re-send a past delivery. */\n public async redeliver(\n id: string,\n deliveryId: string,\n ): Promise<WebhookDelivery> {\n const data = await this.rest.post<WebhookDeliveryData>(\n `${this.route}/${id}/deliveries/${deliveryId}/redeliver`,\n );\n return new WebhookDelivery(this.client, data);\n }\n\n // ── Incoming event listener ──────────────────────────────────────────────────\n\n /**\n * Verify a raw incoming webhook request and dispatch it to the listeners\n * registered via {@link WebhookManager.on}. Returns the parsed event.\n *\n * Emits, in order: the raw type (`PAYMENT_INTENT_SUCCEEDED`), the camelCase\n * alias (`paymentIntentSucceeded`) and the catch-all `event`.\n *\n * @throws {WebhookSignatureError} when the signature is missing/invalid.\n */\n public process(\n rawBody: string | Uint8Array,\n signatureHeader: string | null | undefined,\n options: WebhookProcessOptions = {},\n ): AnyWebhookEvent {\n const secret = options.secret ?? this.client.webhookSecret;\n if (!secret) {\n throw new WebhookSignatureError(\n 'No webhook secret configured. Pass `{ secret }` or set `webhookSecret` on the client.',\n );\n }\n\n // The signature proves the body is the server's; its `type` says which\n // shape `data` has, which is what AnyWebhookEvent encodes.\n const event = Webhooks.constructEvent(rawBody, signatureHeader, secret, {\n toleranceSeconds: options.toleranceSeconds,\n }) as unknown as AnyWebhookEvent;\n\n this.emit(event.type, event as never);\n this.emit(toCamelEvent(event.type), event as never);\n this.emit('event', event);\n return event;\n }\n\n /**\n * Build a Node.js `http`/`https` request handler that verifies the signature,\n * dispatches the event to your listeners, and replies `200`/`400`.\n *\n * @example\n * import { createServer } from 'node:http';\n * createServer(client.webhooks.createHandler({ secret })).listen(4242);\n */\n public createHandler(\n options: WebhookHandlerOptions = {},\n ): (req: IncomingMessage, res: ServerResponse) => void {\n return (req, res) => {\n void this.collectBody(req)\n .then((raw) => {\n const sig = headerValue(req.headers[SIGNATURE_HEADER]);\n this.process(raw, sig, options);\n res.statusCode = 200;\n res.end('ok');\n })\n .catch((err: unknown) => {\n res.statusCode = err instanceof WebhookSignatureError ? 400 : 500;\n res.end(\n err instanceof WebhookSignatureError ? 'invalid signature' : 'error',\n );\n });\n };\n }\n\n /**\n * Express-style middleware. Expects the **raw** body (e.g. mounted with\n * `express.raw({ type: '*/*' })`). On success it attaches the parsed event to\n * `req.cosmosEvent` and calls `next()`; on a bad signature it replies `400`.\n *\n * @example\n * app.post('/hooks', express.raw({ type: '*/*' }), client.webhooks.middleware({ secret }));\n */\n public middleware(\n options: WebhookHandlerOptions = {},\n ): (req: RequestLike, res: ResponseLike, next: (err?: unknown) => void) => void {\n return (req, res, next) => {\n try {\n const raw = extractRawBody(req);\n const sig = headerValue(req.headers[SIGNATURE_HEADER]);\n const event = this.process(raw, sig, options);\n req.cosmosEvent = event;\n next();\n } catch (err) {\n if (err instanceof WebhookSignatureError) {\n res.status(400).send('invalid signature');\n return;\n }\n next(err);\n }\n };\n }\n\n /** Read a Node.js request stream into a single Buffer. */\n private collectBody(req: IncomingMessage): Promise<Buffer> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n req.on('data', (chunk: Buffer) => chunks.push(chunk));\n req.on('end', () => resolve(Buffer.concat(chunks)));\n req.on('error', reject);\n });\n }\n}\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\n/** `PAYMENT_INTENT_SUCCEEDED` → `paymentIntentSucceeded`. */\nfunction toCamelEvent(type: string): keyof WebhookListenerEvents {\n return type\n .toLowerCase()\n .replace(/_([a-z])/g, (_, c: string) =>\n c.toUpperCase(),\n ) as keyof WebhookListenerEvents;\n}\n\nfunction headerValue(value: string | string[] | undefined): string | undefined {\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction extractRawBody(req: RequestLike): string | Uint8Array {\n const candidate = req.rawBody ?? req.body;\n if (typeof candidate === 'string' || candidate instanceof Uint8Array) {\n return candidate;\n }\n // express.json() already parsed it — re-stringify so the signature still matches\n // only if the original raw body is unavailable (best-effort).\n if (candidate && typeof candidate === 'object') {\n return JSON.stringify(candidate);\n }\n return '';\n}\n","import { EventEmitter } from 'node:events';\nimport {\n CosmosPayAPIError,\n CosmosPayRequestError,\n} from '@/errors/CosmosPayError';\nimport {\n DEFAULT_RETRIES,\n DEFAULT_TIMEOUT,\n DEFAULT_VERSION,\n Events,\n version,\n} from '@/util/Constants';\n\n/** A `fetch`-compatible function (defaults to the global `fetch`). */\nexport type FetchLike = typeof fetch;\n\n/** Options accepted when constructing a {@link REST} instance. */\nexport interface RESTOptions {\n /**\n * Base URL of the Cosmos Pay gateway (no trailing slash), e.g.\n * `https://api.cosmospay.lat/cosmos-api`. The version segment is appended\n * automatically.\n */\n baseURL: string;\n /**\n * API key issued by the Cosmos developer platform. Sent as\n * `Authorization: Bearer <apiKey>` (and `apikey: <apiKey>`) to the gateway.\n */\n apiKey?: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`). Only needed when calling the\n * service directly (bypassing APISIX) — typically local development.\n */\n gatewaySecret?: string;\n /**\n * Authenticated consumer username (`X-Consumer-Username`). Pair with\n * `gatewaySecret` for direct service access.\n */\n consumerUsername?: string;\n /**\n * API version segment prefixed to every route. Defaults to `v1`. Set to an\n * empty string when your gateway already injects the version.\n */\n version?: string;\n /** Per-request timeout in milliseconds (default 30000). */\n timeout?: number;\n /** Retries for transient failures — network errors, 429 and 5xx (default 2). */\n retries?: number;\n /** Extra headers merged into every request. */\n headers?: Record<string, string>;\n /** Custom fetch implementation (e.g. a polyfill on old runtimes). */\n fetch?: FetchLike;\n}\n\n/** Internal options for a single request. */\nexport interface RequestOptions {\n /** Query string parameters; `undefined`/`null` values are dropped. */\n query?: Record<string, string | number | boolean | undefined | null>;\n /** JSON body to send. */\n body?: unknown;\n /** Per-request header overrides. */\n headers?: Record<string, string>;\n /** Per-request AbortSignal. */\n signal?: AbortSignal;\n}\n\nconst RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);\n\n/**\n * The HTTP layer. Owns the base URL, authentication and retry/timeout policy,\n * and exposes thin verb helpers (`get`/`post`/`patch`/`delete`). Managers call\n * these — they never touch `fetch` directly.\n */\nexport class REST extends EventEmitter {\n public baseURL: string;\n public readonly version: string;\n private readonly timeout: number;\n private readonly retries: number;\n private readonly fetchFn: FetchLike;\n private readonly extraHeaders: Record<string, string>;\n private apiKey?: string;\n private gatewaySecret?: string;\n private consumerUsername?: string;\n\n constructor(options: RESTOptions) {\n super();\n if (!options.baseURL) {\n throw new TypeError('REST requires a `baseURL`.');\n }\n this.baseURL = options.baseURL.replace(/\\/+$/, '');\n this.version = options.version ?? DEFAULT_VERSION;\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n this.retries = options.retries ?? DEFAULT_RETRIES;\n this.extraHeaders = options.headers ?? {};\n this.apiKey = options.apiKey;\n this.gatewaySecret = options.gatewaySecret;\n this.consumerUsername = options.consumerUsername;\n\n const fetchFn = options.fetch ?? globalThis.fetch;\n if (typeof fetchFn !== 'function') {\n throw new TypeError(\n 'No global `fetch` found. Use Node.js >= 18 or pass a `fetch` implementation in the client options.',\n );\n }\n this.fetchFn = fetchFn.bind(globalThis);\n }\n\n /** Replace the API key used for subsequent requests. */\n public setApiKey(apiKey: string): this {\n this.apiKey = apiKey;\n return this;\n }\n\n /** Set direct-access gateway credentials (local/dev usage). */\n public setGatewayCredentials(secret: string, consumerUsername: string): this {\n this.gatewaySecret = secret;\n this.consumerUsername = consumerUsername;\n return this;\n }\n\n public get<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('GET', path, options);\n }\n\n public post<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('POST', path, options);\n }\n\n public put<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('PUT', path, options);\n }\n\n public patch<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('PATCH', path, options);\n }\n\n public delete<T>(path: string, options: RequestOptions = {}): Promise<T> {\n return this.request<T>('DELETE', path, options);\n }\n\n /** Build the absolute URL for a route, applying the version prefix + query. */\n public buildURL(path: string, query?: RequestOptions['query']): string {\n const clean = path.startsWith('/') ? path : `/${path}`;\n const prefix = this.version ? `/${this.version}` : '';\n const url = new URL(`${this.baseURL}${prefix}${clean}`);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n\n private buildHeaders(extra?: Record<string, string>): Record<string, string> {\n const headers: Record<string, string> = {\n Accept: 'application/json',\n 'User-Agent': `@cosmosapp/pay_sdk/${version}`,\n ...this.extraHeaders,\n };\n if (this.apiKey) {\n headers['Authorization'] = `Bearer ${this.apiKey}`;\n headers['apikey'] = this.apiKey;\n }\n if (this.gatewaySecret) headers['X-Gateway-Secret'] = this.gatewaySecret;\n if (this.consumerUsername) {\n headers['X-Consumer-Username'] = this.consumerUsername;\n }\n return { ...headers, ...extra };\n }\n\n /** Core request with retry, timeout and structured error handling. */\n public async request<T>(\n method: string,\n path: string,\n options: RequestOptions = {},\n ): Promise<T> {\n const url = this.buildURL(path, options.query);\n const headers = this.buildHeaders(options.headers);\n\n let serializedBody: string | undefined;\n if (options.body !== undefined) {\n serializedBody = JSON.stringify(options.body);\n headers['Content-Type'] = 'application/json';\n }\n\n let attempt = 0;\n let lastError: unknown;\n\n while (attempt <= this.retries) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n const signal = options.signal\n ? anySignal([options.signal, controller.signal])\n : controller.signal;\n\n this.emit(Events.Request, { method, url, attempt });\n\n try {\n const response = await this.fetchFn(url, {\n method,\n headers,\n body: serializedBody,\n signal,\n });\n clearTimeout(timer);\n\n this.emit(Events.Response, {\n method,\n url,\n status: response.status,\n attempt,\n });\n\n if (response.status === 429) {\n this.emit(Events.RateLimited, { method, url, attempt });\n }\n\n if (!response.ok) {\n const body = await safeParse(response);\n if (RETRYABLE_STATUS.has(response.status) && attempt < this.retries) {\n await this.backoff(response, attempt);\n attempt++;\n continue;\n }\n throw new CosmosPayAPIError({ status: response.status, method, url, body });\n }\n\n return (await safeParse(response)) as T;\n } catch (error) {\n clearTimeout(timer);\n if (error instanceof CosmosPayAPIError) throw error;\n\n // Network/abort/timeout → retry, then surface as a request error.\n lastError = error;\n if (attempt < this.retries) {\n await sleep(backoffDelay(attempt));\n attempt++;\n continue;\n }\n throw new CosmosPayRequestError({ method, url, cause: error });\n }\n }\n\n throw new CosmosPayRequestError({ method, url, cause: lastError });\n }\n\n private async backoff(response: Response, attempt: number): Promise<void> {\n const retryAfter = response.headers.get('retry-after');\n const ms = retryAfter\n ? Number(retryAfter) * 1000\n : backoffDelay(attempt);\n await sleep(Number.isFinite(ms) ? ms : backoffDelay(attempt));\n }\n}\n\n// ── helpers ──────────────────────────────────────────────────────────────────\n\nfunction backoffDelay(attempt: number): number {\n return Math.min(1000 * 2 ** attempt, 8000);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function safeParse(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return null;\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.includes('application/json')) {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n return text;\n}\n\n/** Combine multiple AbortSignals into one (first to abort wins). */\nfunction anySignal(signals: AbortSignal[]): AbortSignal {\n const controller = new AbortController();\n const onAbort = (signal: AbortSignal) => () => controller.abort(signal.reason);\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n break;\n }\n signal.addEventListener('abort', onAbort(signal), { once: true });\n }\n return controller.signal;\n}\n","import { DEFAULT_BASE_URL, DEFAULT_VERSION } from '@/util/Constants';\n\n/**\n * Internal (\"shared\") configuration that Cosmos Pay maintains on the user's\n * behalf. These are the gateway / infrastructure details an integrator should\n * **not** have to know about — they're pre-filled here so that, in practice, the\n * only credential a user provides is their `apiKey`.\n *\n * Every value is overridable (per-client via {@link ClientOptions}, or globally\n * via {@link Client.shared}) for self-hosting, staging or local development.\n */\nexport interface SharedConfig {\n /** Base URL of the Cosmos Pay gateway. */\n baseURL: string;\n /** API version segment prefixed to every route (`/v1/...`). */\n version: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`). Only used when talking to the\n * service directly, bypassing the gateway (local development). Internal.\n */\n gatewaySecret?: string;\n /**\n * Authenticated consumer username (`X-Consumer-Username`). Paired with\n * `gatewaySecret` for direct service access. Internal.\n */\n consumerUsername?: string;\n /**\n * Default webhook signing secret used by the webhook listener\n * (`client.webhooks.process` / handlers) when no secret is passed explicitly.\n */\n webhookSecret?: string;\n}\n\n/**\n * The mutable, process-wide defaults. Cosmos Pay ships sane values here; you can\n * tweak them once at startup (e.g. `Client.shared.baseURL = '...'`) and every\n * client created afterwards inherits them.\n */\nexport const shared: SharedConfig = {\n baseURL: DEFAULT_BASE_URL,\n version: DEFAULT_VERSION,\n};\n\n/** Merge a partial override on top of the current shared defaults. */\nexport function resolveShared(overrides: Partial<SharedConfig> = {}): SharedConfig {\n const defined: Partial<SharedConfig> = {};\n for (const key of Object.keys(overrides) as (keyof SharedConfig)[]) {\n const value = overrides[key];\n if (value !== undefined) {\n Object.assign(defined, { [key]: value });\n }\n }\n return { ...shared, ...defined };\n}\n","import { EventEmitter } from 'node:events';\nimport { AliasManager } from '@/managers/AliasManager';\nimport { AnalyticsManager } from '@/managers/AnalyticsManager';\nimport { AssetManager } from '@/managers/AssetManager';\nimport { CustomerManager } from '@/managers/CustomerManager';\nimport { HealthManager } from '@/managers/HealthManager';\nimport { LiquidityManager } from '@/managers/LiquidityManager';\nimport { OnrampManager } from '@/managers/OnrampManager';\nimport { OfframpManager } from '@/managers/OfframpManager';\nimport { ActivityManager } from '@/managers/ActivityManager';\nimport { KycManager } from '@/managers/KycManager';\nimport { CrossChainSwapManager } from '@/managers/CrossChainSwapManager';\nimport { DefindexManager } from '@/managers/DefindexManager';\nimport { PluginManager } from '@/managers/PluginManager';\nimport { PublicKeyManager } from '@/managers/PublicKeyManager';\nimport { PaymentIntentManager } from '@/managers/PaymentIntentManager';\nimport { PrivatePaymentManager } from '@/managers/PrivatePaymentManager';\nimport { ProductManager } from '@/managers/ProductManager';\nimport { SwapManager } from '@/managers/SwapManager';\nimport { Usdt0Manager } from '@/managers/Usdt0Manager';\nimport { WebhookManager } from '@/managers/WebhookManager';\nimport { REST, type FetchLike } from '@/rest/REST';\nimport { version } from '@/util/Constants';\nimport { resolveShared, shared, type SharedConfig } from '@/util/shared';\n\n/**\n * Options accepted by the {@link Client} constructor.\n *\n * In practice the only value you provide is `apiKey` — everything else (the\n * gateway URL, version and other infrastructure details) is pre-filled from the\n * {@link Client.shared} defaults that Cosmos Pay maintains for you.\n */\nexport interface ClientOptions {\n /**\n * Your Cosmos Pay API key. Sent to the gateway as `Authorization: Bearer\n * <apiKey>`. The key type determines the network (`dv_` → testnet, `prod_` →\n * mainnet). This is the only credential a typical integration needs.\n */\n apiKey: string;\n\n /**\n * Default webhook signing secret used by the webhook listener\n * (`client.webhooks.on(...)` + handlers) when you don't pass one explicitly.\n */\n webhookSecret?: string;\n\n /** Per-request timeout in milliseconds (default 30000). */\n timeout?: number;\n /** Retries for transient failures — network errors, 429 and 5xx (default 2). */\n retries?: number;\n /** Extra headers merged into every request. */\n headers?: Record<string, string>;\n /** Custom fetch implementation (e.g. a polyfill on old runtimes). */\n fetch?: FetchLike;\n\n // ── Advanced / internal overrides (you normally never set these) ────────────\n /**\n * Override the gateway base URL. Defaults to {@link Client.shared}`.baseURL`.\n * Only needed for self-hosting or a staging gateway.\n * @internal\n */\n baseURL?: string;\n /**\n * Override the API version segment. Defaults to `v1`.\n * @internal\n */\n version?: string;\n /**\n * Shared gateway secret (`X-Gateway-Secret`) for direct, gateway-bypassing\n * access (local development). Maintained internally.\n * @internal\n */\n gatewaySecret?: string;\n /**\n * Consumer username (`X-Consumer-Username`) for direct access. Internal.\n * @internal\n */\n consumerUsername?: string;\n}\n\n/** Payloads emitted by the {@link Client} for observability. */\nexport interface ClientEvents {\n request: [{ method: string; url: string; attempt: number }];\n response: [{ method: string; url: string; status: number; attempt: number }];\n rateLimited: [{ method: string; url: string; attempt: number }];\n debug: [message: string];\n}\n\nexport interface Client {\n on<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n once<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n off<E extends keyof ClientEvents>(\n event: E,\n listener: (...args: ClientEvents[E]) => void,\n ): this;\n emit<E extends keyof ClientEvents>(\n event: E,\n ...args: ClientEvents[E]\n ): boolean;\n}\n\n/**\n * The main entry point of the SDK — a single, atomic client that exposes every\n * resource through its own manager — an atomic, single-client design.\n *\n * @example\n * import { Client } from '@cosmosapp/pay_sdk';\n *\n * // The user only provides their API key — the gateway is handled for them.\n * const client = new Client({ apiKey: process.env.COSMOS_PAY_API_KEY });\n *\n * const intent = await client.paymentIntents.createPay({ destination: 'G...', amount: '10' });\n * console.log(intent.uri);\n */\nexport class Client extends EventEmitter {\n /** Library version. */\n public static readonly version = version;\n\n /**\n * Process-wide shared defaults maintained by Cosmos Pay (gateway URL, version,\n * internal secrets). Mutate once at startup to change them for every client\n * (e.g. self-hosting): `Client.shared.baseURL = 'https://gateway.your-domain.com'`.\n */\n public static readonly shared: SharedConfig = shared;\n\n /** Resolved shared configuration for this client instance. */\n public readonly shared: SharedConfig;\n\n /** Default webhook signing secret for the webhook listener (if configured). */\n public webhookSecret: string | undefined;\n\n /** The underlying HTTP layer. Shared by every manager. */\n public readonly rest: REST;\n\n /** Stellar payment intents — create/list/fetch/update/delete/validate. */\n public readonly paymentIntents: PaymentIntentManager;\n /** Webhook endpoints, delivery audit trail, and the event listener. */\n public readonly webhooks: WebhookManager;\n /** Products / prices. */\n public readonly products: ProductManager;\n /** Same-chain swaps: the Stellar DEX, Jupiter on Solana, Kuru Flow on Monad. */\n public readonly swaps: SwapManager;\n /** Swaps between Stellar, Solana and Monad, settled by NEAR Intents. */\n public readonly crossChainSwaps: CrossChainSwapManager;\n /** USDT0 from Stellar to EVM networks through LayerZero (mainnet only). */\n public readonly usdt0: Usdt0Manager;\n /** Private payments: amounts hidden on-chain (Stellar testnet only for now). */\n public readonly privatePayments: PrivatePaymentManager;\n /** Liquidity pools: browse, positions, deposit / withdraw. */\n public readonly liquidity: LiquidityManager;\n /** Fiat -> stablecoin: quotes, payins, trustlines, virtual accounts. */\n public readonly onramp: OnrampManager;\n /** Stablecoin -> fiat: quotes, authorize, payouts, compliance documents. */\n public readonly offramp: OfframpManager;\n /** The client event stream: report events, read them back, summarize. */\n public readonly activity: ActivityManager;\n /** KYC / KYB: receivers, their wallets and their bank accounts. */\n public readonly kyc: KycManager;\n /** Customers and their wallets. */\n public readonly customers: CustomerManager;\n /** Read-only analytics (summary, series, balances, logs). */\n public readonly analytics: AnalyticsManager;\n /** Service health probes (public). */\n public readonly health: HealthManager;\n /** Payment handles: resolve, claim and manage `@name` aliases. */\n public readonly aliases: AliasManager;\n /** The asset registry: which `(code, issuer)` pairs exist per network, and who issues them. */\n public readonly assets: AssetManager;\n /** Plugins this deployment serves: install, query, command. */\n public readonly plugins: PluginManager;\n /** DeFindex vaults (when the deployment enables the native plugin). */\n public readonly defindex: DefindexManager;\n /** The shared public API key an open-source wallet embeds. */\n public readonly publicKey: PublicKeyManager;\n\n constructor(options: ClientOptions) {\n super();\n if (!options || !options.apiKey) {\n throw new TypeError('Client requires an `apiKey` option.');\n }\n\n // Fill the infrastructure details from the shared defaults; the user only\n // had to bring their apiKey.\n this.shared = resolveShared({\n baseURL: options.baseURL,\n version: options.version,\n gatewaySecret: options.gatewaySecret,\n consumerUsername: options.consumerUsername,\n webhookSecret: options.webhookSecret,\n });\n this.webhookSecret = this.shared.webhookSecret;\n\n this.rest = new REST({\n baseURL: this.shared.baseURL,\n apiKey: options.apiKey,\n gatewaySecret: this.shared.gatewaySecret,\n consumerUsername: this.shared.consumerUsername,\n version: this.shared.version,\n timeout: options.timeout,\n retries: options.retries,\n headers: options.headers,\n fetch: options.fetch,\n });\n\n // Re-emit REST telemetry through the client so consumers can subscribe to\n // `client.on('request' | 'response' | 'rateLimited' | 'debug', ...)`.\n this.rest.on('request', (p) => this.emit('request', p));\n this.rest.on('response', (p) => this.emit('response', p));\n this.rest.on('rateLimited', (p) => this.emit('rateLimited', p));\n\n this.paymentIntents = new PaymentIntentManager(this);\n this.webhooks = new WebhookManager(this);\n this.products = new ProductManager(this);\n this.swaps = new SwapManager(this);\n this.crossChainSwaps = new CrossChainSwapManager(this);\n this.usdt0 = new Usdt0Manager(this);\n this.privatePayments = new PrivatePaymentManager(this);\n this.liquidity = new LiquidityManager(this);\n this.onramp = new OnrampManager(this);\n this.offramp = new OfframpManager(this);\n this.activity = new ActivityManager(this);\n this.kyc = new KycManager(this);\n this.customers = new CustomerManager(this);\n this.analytics = new AnalyticsManager(this);\n this.health = new HealthManager(this);\n this.aliases = new AliasManager(this);\n this.assets = new AssetManager(this);\n this.plugins = new PluginManager(this);\n this.defindex = new DefindexManager(this);\n this.publicKey = new PublicKeyManager(this);\n }\n\n /** Update the API key used for subsequent requests. */\n public setApiKey(apiKey: string): this {\n this.rest.setApiKey(apiKey);\n return this;\n }\n\n /** Set the default webhook signing secret for the webhook listener. */\n public setWebhookSecret(secret: string): this {\n this.webhookSecret = secret;\n return this;\n }\n\n /** Set direct-access gateway credentials (internal / local dev usage). */\n public setGatewayCredentials(secret: string, consumerUsername: string): this {\n this.rest.setGatewayCredentials(secret, consumerUsername);\n return this;\n }\n}\n"]}
|