@cosmosapp/pay_sdk 1.2.1 → 2.1.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/dist/index.d.cts CHANGED
@@ -1,8 +1,71 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import { A as AnalyticsSummaryData, a as AnalyticsBalancesData, b as ApiLogsData, W as WebhookLogsData, C as CustomerData, U as UpdateCustomerOptions, c as CreateCustomerOptions, H as HealthCheckData, P as PaymentIntentData, d as PaymentIntentKind, e as PaymentIntentStatus, f as UpdatePaymentIntentOptions, D as DeletedData, V as ValidationOutcomeData, g as CreateTxPaymentIntentOptions, h as CreatePayPaymentIntentOptions, L as ListPaymentIntentsOptions, i as ValidatePaymentIntentOptions, j as ProductData, k as ProductKind, l as UpdateProductOptions, m as CreateProductOptions, S as SwapData, n as SwapStatus, o as SubmitSwapOptions, Q as QuoteSwapOptions, p as SwapQuoteData, q as CreateSwapOptions, r as ListSwapsOptions, s as WebhookDeliveryData, t as WebhookEventType, u as WebhookDeliveryStatus, v as WebhookEndpointData, w as WebhookEndpointWithSecretData, x as UpdateWebhookEndpointOptions, y as WebhookPingData, z as ListWebhookDeliveriesOptions, B as WebhookEvent, E as CreateWebhookEndpointOptions } from './intent-input-Ch8ogEg-.cjs';
3
- export { F as AddressBook, G as AddressRef, I as AnalyticsBalanceEntry, J as AnalyticsRecentRow, K as AnalyticsSeriesPoint, M as AnalyticsVolumeEntry, N as ApiLogRow, O as AssetDefinition, R as AssetRef, T as Assets, X as CosmosPayAPIError, Y as CosmosPayRequestError, Z as CustomerListData, _ as PaymentIntentListData, $ as ResolvableIntentInput, a0 as ResolvedAsset, a1 as SwapListData, a2 as SwapSubmitOutcomeData, a3 as TestnetAssets, a4 as WalletId, a5 as Wallets, a6 as WebhookDeliveryListData, a7 as WebhookLogRow, a8 as addresses, a9 as assertAddress, aa as defineAsset, ab as isAddress, ac as isContractAddress, ad as isMuxedAddress, ae as isNativeAsset, af as isStellarAddress, ag as resolveAddress, ah as resolveAsset, ai as resolveIntentBody } from './intent-input-Ch8ogEg-.cjs';
2
+ import { A as AliasResolutionData, a as AliasAvailabilityData, b as AliasByAddressData, C as CreateAliasChallengeOptions, c as AliasChallengeData, d as ClaimAliasOptions, O as OwnedAliasData, e as AliasListData, f as AddAliasAddressOptions, g as AliasAddressData, h as AliasDeletedData, i as AliasRecoveryStartedData, j as CompleteAliasRecoveryOptions, k as AnalyticsSummaryData, l as AnalyticsBalancesData, m as ApiLogsData, W as WebhookLogsData, L as ListRegistryAssetsOptions, n as AssetRegistryData, o as CustomerData, U as UpdateCustomerOptions, p as CreateCustomerOptions, H as HealthCheckData, q as LiquidityOperationData, r as LiquidityOperationKind, s as LiquidityOperationStatus, S as SubmitLiquidityOptions, D as DepositLiquidityOptions, t as WithdrawLiquidityOptions, u as LiquidityPositionsData, B as BrowseLiquidityPoolsOptions, v as LiquidityPoolData, w as ListLiquidityOperationsOptions, x as CreatePayinQuoteOptions, P as PayinQuoteData, y as CreatePayinOptions, z as PayinData, E as ListPayinsOptions, F as CreateTrustlineOptions, T as TrustlineData, G as CreateVirtualAccountOptions, V as VirtualAccountData, I as CreatePayoutQuoteOptions, J as PayoutQuoteData, K as AuthorizePayoutOptions, M as AuthorizePayoutData, N as CreatePayoutOptions, Q as PayoutData, R as ListPayoutsOptions, X as AttachPayoutDocumentOptions, Y as PayoutDocumentData, Z as ActivityEventInput, _ as ReportActivityOptions, $ as ActivityReportData, a0 as ListActivityOptions, a1 as ActivityListData, a2 as ActivitySummaryData, a3 as ReceiverData, a4 as UpdateReceiverOptions, a5 as ApproveReceiverOptions, a6 as RequestTosOptions, a7 as TermsOfServiceData, a8 as EnableReceiverOptions, a9 as CreateReceiverWalletOptions, aa as ReceiverWalletData, ab as ListKycOptions, ac as CreateBankAccountOptions, ad as BankAccountData, ae as CreateReceiverOptions, af as SetReceiverAccessOptions, ag as WalletSignMessageData, ah as KycUploadData, ai as InitiateTosOptions, aj as KycRailsData, ak as BankDetailsData, al as CrossChainSwapData, am as CrossChainSwapStatus, an as SwapChain, ao as CrossChainTransactionData, ap as CrossChainAssetData, aq as QuoteCrossChainSwapOptions, ar as CrossChainQuoteData, as as CreateCrossChainSwapOptions, at as ListCrossChainSwapsOptions, au as DefindexDepositOptions, av as DefindexWithdrawOptions, aw as PluginData, ax as InstallPluginOptions, ay as PluginUninstalledData, az as PluginActionResultData, aA as PublicKeyData, aB as PaymentIntentData, aC as PaymentIntentKind, aD as PaymentIntentStatus, aE as UpdatePaymentIntentOptions, aF as DeletedData, aG as ValidationOutcomeData, aH as CreateTxPaymentIntentOptions, aI as CreatePayPaymentIntentOptions, aJ as PaymentIntentTransitionData, aK as ListPaymentIntentsOptions, aL as ValidatePaymentIntentOptions, aM as ProductData, aN as ProductKind, aO as UpdateProductOptions, aP as CreateProductOptions, aQ as ChainSwapData, aR as OtherSwapChain, aS as SwapStatus, aT as ChainSwapTransaction, aU as EvmCallData, aV as SwapData, aW as QuoteSwapOptions, aX as SwapQuoteData, aY as CreateSwapOptions, aZ as ListSwapsOptions, a_ as SubmitSwapOptions, a$ as WebhookDeliveryData, b0 as WebhookEventType, b1 as WebhookDeliveryStatus, b2 as WebhookEndpointData, b3 as WebhookEndpointWithSecretData, b4 as UpdateWebhookEndpointOptions, b5 as WebhookPingData, b6 as ListWebhookDeliveriesOptions, b7 as AnyWebhookEvent, b8 as WebhookEventDataMap, b9 as TypedWebhookEvent, ba as CreateWebhookEndpointOptions, bb as WebhookEvent } from './intent-input-8rZfCrQ0.cjs';
3
+ export { bc as ActivityBucket, bd as ActivityEventData, be as ActivityLevel, bf as ActivitySource, bg as AddressBook, bh as AddressRef, bi as AliasChallengePurpose, bj as AnalyticsBalanceEntry, bk as AnalyticsRecentRow, bl as AnalyticsSeriesPoint, bm as AnalyticsVolumeEntry, bn as ApiLogRow, bo as AssetDefinition, bp as AssetRef, bq as Assets, br as BankAccountListData, bs as BankRail, bt as BankingPartner, bu as ChainSwapListData, bv as ChainSwapSubmitOutcomeData, bw as CosmosPayAPIError, bx as CosmosPayRequestError, by as CrossChainSwapListData, bz as CurrencyType, bA as CustomerListData, bB as KycType, bC as LiquidityOperationListData, bD as LiquidityPoolListData, bE as LiquidityPositionData, bF as LiquidityReserveData, bG as LiquiditySubmitOutcomeData, bH as PayinListData, bI as PayinMethod, bJ as PayinPayerRules, bK as PaymentIntentListData, bL as PayoutChain, bM as PayoutListData, bN as PayoutNetwork, bO as PluginListData, bP as RampToken, bQ as ReceiverListData, bR as ReceiverOwner, bS as ReceiverType, bT as ReceiverWalletListData, bU as ReceiverWalletNetwork, bV as RegistryAssetData, bW as ResolvableIntentInput, bX as ResolvedAsset, bY as SwapListData, bZ as SwapSubmitOutcomeData, b_ as TestnetAssets, b$ as WalletId, c0 as Wallets, c1 as WebhookDeliveryListData, c2 as WebhookLogRow, c3 as addresses, c4 as assertAddress, c5 as defineAsset, c6 as isAddress, c7 as isContractAddress, c8 as isMuxedAddress, c9 as isNativeAsset, ca as isStellarAddress, cb as resolveAddress, cc as resolveAsset, cd as resolveIntentBody } from './intent-input-8rZfCrQ0.cjs';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
6
+ /**
7
+ * Payment handles — `client.aliases`. A handle names one or more Stellar
8
+ * addresses, so a payer can send to `@ada` instead of a 56-character key.
9
+ *
10
+ * Every address on a handle proved control of itself: claiming a handle or
11
+ * pointing it somewhere new takes a signature, by that address, over a
12
+ * challenge the server issued. The SDK never holds the key — ask for a
13
+ * challenge, sign its `message` where the key lives, and send the signature
14
+ * back.
15
+ *
16
+ * @example
17
+ * const { primaryAddress } = await client.aliases.resolve('ada', { network: 'public' });
18
+ *
19
+ * @example
20
+ * const ch = await client.aliases.createChallenge({ name: 'ada', address, network: 'public' });
21
+ * const signature = signWithYourWallet(ch.message); // base64 ed25519
22
+ * await client.aliases.claim({ name: 'ada', email: 'ada@example.com', nonce: ch.nonce, signature });
23
+ */
24
+ declare class AliasManager {
25
+ readonly client: Client;
26
+ private readonly route;
27
+ constructor(client: Client);
28
+ private get rest();
29
+ /** Where to pay a handle: its verified addresses on a network, primary first. */
30
+ resolve(name: string, options?: {
31
+ network?: string;
32
+ }): Promise<AliasResolutionData>;
33
+ /** Whether a handle can be claimed, and if not, why not. */
34
+ availability(name: string): Promise<AliasAvailabilityData>;
35
+ /** Which handles point at an address — the reverse lookup. */
36
+ byAddress(address: string, options?: {
37
+ network?: string;
38
+ }): Promise<AliasByAddressData>;
39
+ /** A nonce and the exact message to sign, for a claim, a new address or a recovery. */
40
+ createChallenge(options: CreateAliasChallengeOptions): Promise<AliasChallengeData>;
41
+ /** Claim a handle with a signature over a CLAIM challenge. */
42
+ claim(options: ClaimAliasOptions): Promise<OwnedAliasData>;
43
+ /** The handles this consumer owns (paginated). */
44
+ list(options?: {
45
+ take?: number;
46
+ skip?: number;
47
+ }): Promise<AliasListData>;
48
+ /** Point a handle at another address, signed by that address (ADD_ADDRESS challenge). */
49
+ addAddress(name: string, options: AddAliasAddressOptions): Promise<AliasAddressData>;
50
+ /** Remove one address from a handle. */
51
+ removeAddress(name: string, addressId: string): Promise<AliasDeletedData>;
52
+ /** Release a handle back to the namespace. */
53
+ release(name: string): Promise<AliasDeletedData>;
54
+ /**
55
+ * Start a recovery: the service emails a one-time token to the mailbox the
56
+ * handle was claimed with, if `email` is that mailbox. The answer is the same
57
+ * either way, so it says nothing about who owns the handle; the token only
58
+ * ever reaches the mailbox, never this response.
59
+ */
60
+ startRecovery(name: string, email: string): Promise<AliasRecoveryStartedData>;
61
+ /**
62
+ * Take a handle over with a new address after losing the old one: the token
63
+ * the owner received by email, plus a signature by the new address over a
64
+ * RECOVER challenge.
65
+ */
66
+ completeRecovery(name: string, options: CompleteAliasRecoveryOptions): Promise<OwnedAliasData>;
67
+ }
68
+
6
69
  /**
7
70
  * Read-only analytics derived from the consumer's intents and deliveries —
8
71
  * `client.analytics`. Powers dashboard-style Overview / Balances / Logs views.
@@ -21,6 +84,29 @@ declare class AnalyticsManager {
21
84
  webhookLogs(): Promise<WebhookLogsData>;
22
85
  }
23
86
 
87
+ /**
88
+ * The server's asset registry — `client.assets`: which `(code, issuer)` pairs
89
+ * it knows per network, and who issues each.
90
+ *
91
+ * A code is not an identifier — mainnet carries dozens of accounts issuing
92
+ * `USDC` — so this is where to learn WHICH one. `verified` is a claim about the
93
+ * issuer's identity (checked against `issuerName`), not about quality; the
94
+ * unverified rows are returned too, and a UI should show them below a warning
95
+ * rather than hide them. The static {@link Assets} catalog is the offline
96
+ * fallback; this is the current list, and its `version` says which is newer.
97
+ *
98
+ * @example
99
+ * const { data } = await client.assets.list({ network: 'public', verified: true });
100
+ */
101
+ declare class AssetManager {
102
+ readonly client: Client;
103
+ private readonly route;
104
+ constructor(client: Client);
105
+ private get rest();
106
+ /** The registry for a network. */
107
+ list(options?: ListRegistryAssetsOptions): Promise<AssetRegistryData>;
108
+ }
109
+
24
110
  /**
25
111
  * Root of every API structure. Holds a back-reference to the {@link Client} so
26
112
  * instances can perform their own actions (e.g. `paymentIntent.delete()`), and
@@ -44,7 +130,6 @@ declare abstract class Base<Data extends {
44
130
 
45
131
  /** A customer record, optionally enriched with on-chain payment stats. */
46
132
  declare class Customer extends Base<CustomerData> {
47
- consumerId: string;
48
133
  name: string;
49
134
  alias: string | null;
50
135
  note: string | null;
@@ -146,6 +231,7 @@ declare class REST extends EventEmitter {
146
231
  setGatewayCredentials(secret: string, consumerUsername: string): this;
147
232
  get<T>(path: string, options?: RequestOptions): Promise<T>;
148
233
  post<T>(path: string, options?: RequestOptions): Promise<T>;
234
+ put<T>(path: string, options?: RequestOptions): Promise<T>;
149
235
  patch<T>(path: string, options?: RequestOptions): Promise<T>;
150
236
  delete<T>(path: string, options?: RequestOptions): Promise<T>;
151
237
  /** Build the absolute URL for a route, applying the version prefix + query. */
@@ -221,6 +307,677 @@ declare class HealthManager {
221
307
  readiness(): Promise<HealthCheckData>;
222
308
  }
223
309
 
310
+ /**
311
+ * One deposit into, or withdrawal from, a Stellar liquidity pool.
312
+ *
313
+ * The server builds the envelope and the wallet signs it, so an operation is a
314
+ * two-step object: it arrives `PENDING` carrying an unsigned `xdr`, and reaches
315
+ * `SUBMITTED`/`SUCCEEDED` only once the signed envelope comes back through
316
+ * `submit()`. Both steps are available on the instance —
317
+ * `await operation.submit({ signedXdr })` — so a caller never has to keep the id
318
+ * and the manager in scope alongside it.
319
+ */
320
+ declare class LiquidityOperation extends Base<LiquidityOperationData> {
321
+ /** Deposit or withdrawal. */
322
+ kind: LiquidityOperationKind;
323
+ status: LiquidityOperationStatus;
324
+ network: string;
325
+ /** Account whose funds move, and which must sign. */
326
+ source: string;
327
+ /** The pool this operation acts on (hex id). */
328
+ poolId: string;
329
+ assetA: string;
330
+ assetAIssuer: string | null;
331
+ assetB: string;
332
+ assetBIssuer: string | null;
333
+ /** Maximum of asset A put in (deposit), or minimum taken out (withdrawal). */
334
+ amountA: string;
335
+ amountB: string;
336
+ /** Pool shares minted or burned; null until the network settles a deposit. */
337
+ shares: string | null;
338
+ /** Price band a deposit executes within, as decimal strings. */
339
+ minPrice: string | null;
340
+ maxPrice: string | null;
341
+ slippageBps: number;
342
+ idempotencyKey: string | null;
343
+ feeBps: number;
344
+ feeAmountA: string;
345
+ feeAmountB: string;
346
+ feeWallet: string | null;
347
+ commissionMemo: string | null;
348
+ /** Unsigned transaction envelope (base64 XDR) — what the wallet signs. */
349
+ xdr: string;
350
+ /** SEP-7 `web+stellar:tx` deep link for the same envelope. */
351
+ uri: string;
352
+ txHash: string;
353
+ /** QR code of the SEP-7 URI (PNG data URL). */
354
+ qr: string;
355
+ /** When the built envelope stops being submittable. */
356
+ expiresAt: Date | null;
357
+ createdAt: Date;
358
+ updatedAt: Date;
359
+ constructor(client: Client, data: LiquidityOperationData);
360
+ protected _patch(data: LiquidityOperationData): this;
361
+ /** True while the envelope still needs a signature. */
362
+ get isPending(): boolean;
363
+ /** True once the network accepted it. */
364
+ get isSucceeded(): boolean;
365
+ /** True for a deposit, false for a withdrawal. */
366
+ get isDeposit(): boolean;
367
+ /** Re-fetch this operation and patch it in place. */
368
+ fetch(): Promise<this>;
369
+ /** Relay the signed envelope to the network and patch this instance with the result. */
370
+ submit(options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome>;
371
+ toJSON(): LiquidityOperationData;
372
+ }
373
+
374
+ /** A page of liquidity operations plus its pagination metadata. */
375
+ interface LiquidityOperationPage {
376
+ items: LiquidityOperation[];
377
+ total: number;
378
+ take: number;
379
+ skip: number;
380
+ }
381
+ /** A page of on-chain pools. Horizon paginates by cursor, not by offset. */
382
+ interface LiquidityPoolPage {
383
+ items: LiquidityPoolData[];
384
+ /** Pass back as `cursor` to get the next page; null when there is none. */
385
+ cursor: string | null;
386
+ }
387
+ /** Submission outcome with the refreshed operation materialized. */
388
+ interface LiquiditySubmitOutcome {
389
+ submitted: boolean;
390
+ status: LiquidityOperationStatus;
391
+ txHash: string | null;
392
+ reason: string | null;
393
+ resultCodes: string[] | null;
394
+ operation: LiquidityOperation;
395
+ }
396
+ /**
397
+ * Liquidity pools — `client.liquidity`.
398
+ *
399
+ * Two surfaces in one manager, because they are two halves of the same job:
400
+ * *browsing* pools and positions (read-only, straight off Horizon), and
401
+ * *operating* on them (deposit / withdraw), which produces an unsigned envelope
402
+ * for a wallet to sign and a `submit()` to relay it back.
403
+ *
404
+ * The managed structure is the OPERATION, not the pool: a pool is a public
405
+ * on-chain object with no lifecycle of its own, while an operation is a thing this
406
+ * consumer created, can re-read and can push to the network.
407
+ *
408
+ * @example
409
+ * const op = await client.liquidity.deposit({
410
+ * source: 'G…',
411
+ * assetACode: 'XLM',
412
+ * assetBCode: 'USDC',
413
+ * assetBIssuer: 'GA5Z…',
414
+ * maxAmountA: '100',
415
+ * maxAmountB: '25',
416
+ * });
417
+ * // …wallet signs op.xdr…
418
+ * const { status, txHash } = await op.submit({ signedXdr });
419
+ */
420
+ declare class LiquidityManager extends BaseManager<LiquidityOperation> {
421
+ private readonly route;
422
+ /**
423
+ * Build a deposit into the pool formed by the two assets → unsigned XDR, SEP-7
424
+ * URI and QR.
425
+ *
426
+ * The pool is DERIVED from the two assets rather than named: a constant-product
427
+ * pool id is a hash of its (assetA, assetB, fee) in CAP-38 order, so there is
428
+ * exactly one pool the pair can form and no id for a caller to get wrong.
429
+ */
430
+ deposit(options: DepositLiquidityOptions): Promise<LiquidityOperation>;
431
+ /** Build a withdrawal (burn shares) from a pool → unsigned XDR, SEP-7 URI and QR. */
432
+ withdraw(options: WithdrawLiquidityOptions): Promise<LiquidityOperation>;
433
+ /** An account's pool share positions, with what each is redeemable for right now. */
434
+ positions(account: string): Promise<LiquidityPositionsData>;
435
+ /** Browse on-chain pools (Horizon proxy). Filter by asset pair or by holder. */
436
+ browse(options?: BrowseLiquidityPoolsOptions): Promise<LiquidityPoolPage>;
437
+ /** One on-chain pool by its hex id (Horizon proxy). */
438
+ pool(poolId: string): Promise<LiquidityPoolData>;
439
+ /** List this consumer's pool operations (paginated). */
440
+ operations(options?: ListLiquidityOperationsOptions): Promise<LiquidityOperationPage>;
441
+ /** Get one operation by id, materialized. */
442
+ fetch(id: string): Promise<LiquidityOperation>;
443
+ /**
444
+ * The raw payload for one operation. Exists so {@link LiquidityOperation.fetch}
445
+ * can patch itself in place instead of materializing a second instance of the
446
+ * thing the caller is already holding.
447
+ */
448
+ fetchRaw(id: string): Promise<LiquidityOperationData>;
449
+ /**
450
+ * Relay a signed operation to the network. The service checks the envelope's
451
+ * hash against the one it built, so a signed envelope that is not the one this
452
+ * operation describes is refused rather than broadcast.
453
+ */
454
+ submit(id: string, options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome>;
455
+ }
456
+
457
+ /** A page of payins plus its pagination metadata. */
458
+ interface PayinPage {
459
+ items: PayinData[];
460
+ total: number;
461
+ take: number;
462
+ skip: number;
463
+ }
464
+ /**
465
+ * Fiat → stablecoin — `client.onramp`.
466
+ *
467
+ * Three steps, in this order and no other: **quote** (a price, valid for about
468
+ * five minutes), **payin** (created FROM that quote, and what returns the funding
469
+ * instructions the payer acts on), then the money arrives off-band and the payin
470
+ * status moves on its own.
471
+ *
472
+ * There is no structure class here on purpose. A payin has no action of its own —
473
+ * it is a mirror of the provider's record, read and re-read — so an object with a
474
+ * client back-reference would carry a `fetch()` and nothing else.
475
+ *
476
+ * @example
477
+ * const quote = await client.onramp.quote({
478
+ * blockchain_wallet_id: 'w_123',
479
+ * currency_type: 'sender',
480
+ * payment_method: 'pix',
481
+ * token: 'USDC',
482
+ * request_amount: 10_000, // minor units
483
+ * });
484
+ * const payin = await client.onramp.createPayin({ payin_quote_id: quote.id });
485
+ * console.log(payin.instructions);
486
+ */
487
+ declare class OnrampManager {
488
+ readonly client: Client;
489
+ private readonly route;
490
+ constructor(client: Client);
491
+ private get rest();
492
+ /** Price a payin. The quote expires — check `expires_at` before using it. */
493
+ quote(options: CreatePayinQuoteOptions): Promise<PayinQuoteData>;
494
+ /** Create a payin from a quote. The response carries the funding instructions. */
495
+ createPayin(options: CreatePayinOptions): Promise<PayinData>;
496
+ /** List this consumer's payins (paginated). */
497
+ payins(options?: ListPayinsOptions): Promise<PayinPage>;
498
+ /**
499
+ * One payin. Served from the local mirror, refreshed from the provider when it
500
+ * is stale — so this is the right call to poll, not the provider's own API.
501
+ */
502
+ payin(id: string): Promise<PayinData>;
503
+ /**
504
+ * Build the unsigned trustline transaction an address needs before it can hold
505
+ * the stablecoin the ramp pays out in.
506
+ *
507
+ * The envelope comes from the gateway, so a wallet signing it must decode and
508
+ * bound it first — the issuer it names is the one the payout will use, and it is
509
+ * not known to the caller in advance.
510
+ */
511
+ createTrustline(options: CreateTrustlineOptions): Promise<TrustlineData>;
512
+ /** Open a virtual account (a permanent bank reference) for a verified receiver. */
513
+ createVirtualAccount(receiverId: string, options: CreateVirtualAccountOptions): Promise<VirtualAccountData>;
514
+ /** A receiver's virtual accounts. */
515
+ virtualAccounts(receiverId: string, options?: ListPayinsOptions): Promise<VirtualAccountData>;
516
+ }
517
+
518
+ /** A page of payouts plus its pagination metadata. */
519
+ interface PayoutPage {
520
+ items: PayoutData[];
521
+ total: number;
522
+ take: number;
523
+ skip: number;
524
+ }
525
+ /**
526
+ * Stablecoin → fiat — `client.offramp`.
527
+ *
528
+ * Four steps, and the middle one is the one people miss: **quote**, **authorize**
529
+ * (which builds the unsigned transaction that moves the stablecoin), the wallet
530
+ * signs it, and only then **create the payout** with that signature attached. A
531
+ * payout created without a signed transfer is a payout with nothing behind it.
532
+ *
533
+ * `authorize` is for the chains that need a transaction built for them (Stellar,
534
+ * Solana). On EVM the quote itself carries the `approve` contract payload, so the
535
+ * caller signs that instead and goes straight to `createPayout`.
536
+ *
537
+ * @example
538
+ * const quote = await client.offramp.quote({
539
+ * bank_account_id: 'ba_123',
540
+ * currency_type: 'sender',
541
+ * request_amount: 5_000,
542
+ * network: 'stellar',
543
+ * token: 'USDC',
544
+ * });
545
+ * const { xdr } = await client.offramp.authorize({
546
+ * quote_id: quote.id,
547
+ * sender_wallet_address: 'G…',
548
+ * chain: 'stellar',
549
+ * });
550
+ * // …wallet signs `xdr`, after bounding it against `quote`…
551
+ * const payout = await client.offramp.createPayout({
552
+ * quote_id: quote.id,
553
+ * sender_wallet_address: 'G…',
554
+ * chain: 'stellar',
555
+ * signed_transaction: signedXdr,
556
+ * });
557
+ */
558
+ declare class OfframpManager {
559
+ readonly client: Client;
560
+ private readonly route;
561
+ constructor(client: Client);
562
+ private get rest();
563
+ /** Price a payout. Expires in about five minutes. */
564
+ quote(options: CreatePayoutQuoteOptions): Promise<PayoutQuoteData>;
565
+ /**
566
+ * Build the unsigned transfer for a Stellar or Solana payout.
567
+ *
568
+ * What comes back is built by the gateway, not by the caller: bound it against
569
+ * the quote the user confirmed before signing, or the amount that leaves is
570
+ * whatever the response says it is.
571
+ */
572
+ authorize(options: AuthorizePayoutOptions): Promise<AuthorizePayoutData>;
573
+ /** Create the payout from a quote, with the signed transfer attached. */
574
+ createPayout(options: CreatePayoutOptions): Promise<PayoutData>;
575
+ /** List this consumer's payouts (paginated). */
576
+ payouts(options?: ListPayoutsOptions): Promise<PayoutPage>;
577
+ /** One payout. Served from the local mirror, refreshed when stale. */
578
+ payout(id: string): Promise<PayoutData>;
579
+ /**
580
+ * Attach a compliance document to a payout — an invoice or proof of funds the
581
+ * rail asks for before it will settle.
582
+ */
583
+ attachDocument(id: string, options: AttachPayoutDocumentOptions): Promise<PayoutDocumentData>;
584
+ }
585
+
586
+ /** A page of events plus its pagination metadata. */
587
+ interface ActivityPage {
588
+ items: ActivityListData['data'];
589
+ total: number;
590
+ take: number;
591
+ skip: number;
592
+ }
593
+ /**
594
+ * The client event stream — `client.activity`.
595
+ *
596
+ * This is the trail the wallet, the dashboard and your own server write to: errors,
597
+ * screen views, timings, the operations they built. It exists because a console is
598
+ * not a trail — an extension popup's console dies with the popup and a phone's
599
+ * WebView console needs a cable — and because the failures worth having are the
600
+ * ones that never reach the API at all.
601
+ *
602
+ * Two rules the writers are expected to keep, and neither is enforceable here:
603
+ * report only what the user consented to, and never put memo text or anything that
604
+ * names a counterparty in `props`.
605
+ *
606
+ * @example
607
+ * await client.activity.report([
608
+ * { type: 'checkout.opened', source: 'server', level: 'info', eventId: crypto.randomUUID() },
609
+ * ]);
610
+ */
611
+ declare class ActivityManager {
612
+ readonly client: Client;
613
+ private readonly route;
614
+ constructor(client: Client);
615
+ private get rest();
616
+ /**
617
+ * Report a batch of events.
618
+ *
619
+ * Accepts the array directly or the full body. Give each event an `eventId`: the
620
+ * service de-duplicates on it, which is the difference between a retried batch
621
+ * and a double-counted one.
622
+ */
623
+ report(events: ActivityEventInput[] | ReportActivityOptions): Promise<ActivityReportData>;
624
+ /** Recent events for this consumer, newest first. */
625
+ events(options?: ListActivityOptions): Promise<ActivityPage>;
626
+ /** Counts, top event types, top errors and a daily series. */
627
+ summary(options?: {
628
+ days?: number;
629
+ source?: string;
630
+ }): Promise<ActivitySummaryData>;
631
+ }
632
+
633
+ /**
634
+ * A verified identity — the thing both ramps hang off.
635
+ *
636
+ * Everything a receiver owns is reachable from the instance
637
+ * (`receiver.addBankAccount(…)`, `receiver.wallets()`), because the alternative is
638
+ * carrying a receiver id and a manager reference side by side through a KYC flow
639
+ * that already has enough moving parts.
640
+ */
641
+ declare class Receiver extends Base<ReceiverData> {
642
+ blindpayId: string;
643
+ /** `individual` or `business`. */
644
+ type: string;
645
+ kycType: string | null;
646
+ /** Verification state, refreshed from upstream on every read. */
647
+ kycStatus: string | null;
648
+ email: string | null;
649
+ name: string | null;
650
+ country: string | null;
651
+ /** Your own id for this receiver, if you set one. */
652
+ externalId: string | null;
653
+ /** True when the receiver is cut off from both ramps. */
654
+ disabled: boolean;
655
+ /** How many times the submitted KYC data has been written. */
656
+ dossierVersion: number;
657
+ /** The version a reviewer approved, or null while unapproved. */
658
+ reviewedVersion: number | null;
659
+ createdAt: Date;
660
+ updatedAt: Date;
661
+ constructor(client: Client, data: ReceiverData);
662
+ protected _patch(data: ReceiverData): this;
663
+ /** True once verification has passed and the ramps will act on this receiver. */
664
+ get isApproved(): boolean;
665
+ /** Re-read this receiver, refreshing `kycStatus`, and patch it in place. */
666
+ fetch(): Promise<this>;
667
+ /** Update and patch in place. */
668
+ update(options: UpdateReceiverOptions): Promise<this>;
669
+ /** Delete this receiver. */
670
+ delete(): Promise<void>;
671
+ /**
672
+ * Approve it out of review (admin-only).
673
+ *
674
+ * Pinned to the dossier THIS instance holds: `expected_version` defaults to
675
+ * {@link Receiver.dossierVersion}, so approving a receiver that was edited since
676
+ * you read it is a `409 kyc_state_invalid` rather than a silent approval of data
677
+ * you never saw. Call {@link Receiver.fetch} and review again, or pass
678
+ * `expected_version` yourself — including `undefined`, which approves whatever
679
+ * is stored now.
680
+ */
681
+ approve(options?: ApproveReceiverOptions): Promise<ReceiverData>;
682
+ /** Ask for a terms-of-service link for this receiver. */
683
+ requestTos(options: RequestTosOptions): Promise<TermsOfServiceData>;
684
+ /** Enable it with an accepted terms-of-service id, and patch in place. */
685
+ enable(options: EnableReceiverOptions): Promise<this>;
686
+ /** Cut this receiver off from both ramps, or let it back in. */
687
+ setAccess(disabled: boolean): Promise<this>;
688
+ /** Register a blockchain wallet for this receiver. */
689
+ addWallet(options: CreateReceiverWalletOptions): Promise<ReceiverWalletData>;
690
+ /** This receiver's wallets. */
691
+ wallets(options?: ListKycOptions): Promise<ReceiverWalletPage>;
692
+ /** Add a fiat bank account — where an off-ramp pays out. */
693
+ addBankAccount(options: CreateBankAccountOptions): Promise<BankAccountData>;
694
+ /** This receiver's bank accounts. */
695
+ bankAccounts(options?: ListKycOptions): Promise<BankAccountPage>;
696
+ toJSON(): ReceiverData;
697
+ }
698
+
699
+ /** A page of receivers plus its pagination metadata. */
700
+ interface ReceiverPage {
701
+ items: Receiver[];
702
+ total: number;
703
+ take: number;
704
+ skip: number;
705
+ }
706
+ /** A page of a receiver's wallets. */
707
+ interface ReceiverWalletPage {
708
+ items: ReceiverWalletData[];
709
+ total: number;
710
+ take: number;
711
+ skip: number;
712
+ }
713
+ /** A page of a receiver's bank accounts. */
714
+ interface BankAccountPage {
715
+ items: BankAccountData[];
716
+ total: number;
717
+ take: number;
718
+ skip: number;
719
+ }
720
+ /**
721
+ * KYC / KYB — `client.kyc`.
722
+ *
723
+ * A receiver is the verified identity both ramps hang off: an on-ramp pays INTO
724
+ * one of its wallets, an off-ramp pays OUT to one of its bank accounts, and
725
+ * neither works until verification passes.
726
+ *
727
+ * The order is not obvious and the API will not guess it for you:
728
+ *
729
+ * 1. `termsOfService()` — the acceptance the provider requires up front, which
730
+ * returns a `tos_id`.
731
+ * 2. `upload()` each document, keeping the `file_url` it returns.
732
+ * 3. `createReceiver()` with those URLs and the `tos_id`.
733
+ * 4. `addWallet()` / `addBankAccount()` for where money should land.
734
+ * 5. verification runs; `fetchReceiver()` refreshes `kycStatus` from upstream.
735
+ *
736
+ * @example
737
+ * const tos = await client.kyc.termsOfService({ redirect_url: 'https://app/kyc/done' });
738
+ * const { file_url } = await client.kyc.upload(fileBase64);
739
+ * const receiver = await client.kyc.createReceiver({
740
+ * type: 'individual', kyc_type: 'standard', email: 'a@b.com', country: 'BR',
741
+ * id_doc_front_file: file_url, tos_id: tosId,
742
+ * });
743
+ */
744
+ declare class KycManager extends BaseManager<Receiver> {
745
+ private readonly route;
746
+ /** Create a receiver and start verification. */
747
+ createReceiver(options: CreateReceiverOptions): Promise<Receiver>;
748
+ /** List this consumer's receivers (paginated). */
749
+ receivers(options?: ListKycOptions): Promise<ReceiverPage>;
750
+ /** One receiver, materialized. Reading it refreshes `kycStatus` upstream. */
751
+ fetchReceiver(id: string): Promise<Receiver>;
752
+ /** The raw payload, so a {@link Receiver} can patch itself in place. */
753
+ fetchReceiverRaw(id: string): Promise<ReceiverData>;
754
+ /**
755
+ * Update a receiver — the same fields as creation, all optional. Once the receiver
756
+ * exists at the provider, identity fields need an elevated key; see
757
+ * {@link UpdateReceiverOptions}.
758
+ */
759
+ updateReceiver(id: string, options: UpdateReceiverOptions): Promise<Receiver>;
760
+ /** Delete a receiver. */
761
+ deleteReceiver(id: string): Promise<void>;
762
+ /**
763
+ * Approve a receiver sitting in review. Admin-only: it is the human gate on a
764
+ * verification the provider could not decide by itself.
765
+ */
766
+ approveReceiver(id: string, options?: ApproveReceiverOptions): Promise<ReceiverData>;
767
+ /**
768
+ * Ask for a terms-of-service link for an existing receiver. `channel: 'code'`
769
+ * returns the URL to render; `'email'` sends it to the receiver instead.
770
+ */
771
+ requestTos(id: string, options: RequestTosOptions): Promise<TermsOfServiceData>;
772
+ /** Enable an inactive receiver with an accepted terms-of-service id. */
773
+ enableReceiver(id: string, options: EnableReceiverOptions): Promise<Receiver>;
774
+ /**
775
+ * Cut a receiver off from both ramps, or let it back in. Admin-only, and the
776
+ * fastest lever there is when something is wrong with an account.
777
+ */
778
+ setReceiverAccess(id: string, options: SetReceiverAccessOptions): Promise<Receiver>;
779
+ /**
780
+ * The message a receiver must sign to prove it controls an address. Sign it,
781
+ * then pass the resulting transaction hash as `signature_tx_hash` to
782
+ * {@link addWallet}.
783
+ */
784
+ walletSignMessage(receiverId: string): Promise<WalletSignMessageData>;
785
+ /** Register a blockchain wallet for a receiver. */
786
+ addWallet(receiverId: string, options: CreateReceiverWalletOptions): Promise<ReceiverWalletData>;
787
+ /** A receiver's wallets (paginated). */
788
+ wallets(receiverId: string, options?: ListKycOptions): Promise<ReceiverWalletPage>;
789
+ /** Delete one of a receiver's wallets. */
790
+ deleteWallet(receiverId: string, id: string): Promise<void>;
791
+ /** Add a fiat bank account for a receiver — where an off-ramp pays out. */
792
+ addBankAccount(receiverId: string, options: CreateBankAccountOptions): Promise<BankAccountData>;
793
+ /** A receiver's bank accounts (paginated). */
794
+ bankAccounts(receiverId: string, options?: ListKycOptions): Promise<BankAccountPage>;
795
+ /** Delete one of a receiver's bank accounts. */
796
+ deleteBankAccount(receiverId: string, id: string): Promise<void>;
797
+ /**
798
+ * Upload a KYC document and get back the `file_url` every `*_file` field
799
+ * expects. Documents are uploaded first and referenced by URL — the receiver
800
+ * payload never carries bytes.
801
+ */
802
+ upload(file: unknown): Promise<KycUploadData>;
803
+ /**
804
+ * Start terms-of-service acceptance and get the hosted URL. This is the FIRST
805
+ * step of the flow: the provider will not create a receiver without the `tos_id`
806
+ * it produces.
807
+ */
808
+ termsOfService(options?: InitiateTosOptions): Promise<TermsOfServiceData>;
809
+ /** The bank rails available to this consumer. */
810
+ rails(): Promise<KycRailsData>;
811
+ /**
812
+ * The field schema a given rail requires. The authority on which of the ~70
813
+ * rail-specific bank-account fields to send — read it at runtime rather than
814
+ * hard-coding a rail's shape.
815
+ */
816
+ bankDetails(rail: string): Promise<BankDetailsData>;
817
+ protected get rest(): REST;
818
+ }
819
+
820
+ /**
821
+ * A swap between two chains, settled by NEAR Intents — `client.crossChainSwaps`.
822
+ *
823
+ * Pay exactly {@link amountIn} of the origin asset to {@link depositAddress}
824
+ * (with {@link depositMemo} on Stellar, as a MEMO_TEXT) — {@link depositUri} is
825
+ * that payment as a wallet link. NEAR Intents pays {@link recipient} on the
826
+ * destination chain, or refunds {@link refundTo}. The server follows it; poll
827
+ * with `await swap.fetch()` or subscribe to the `CROSS_CHAIN_SWAP_*` webhooks.
828
+ */
829
+ declare class CrossChainSwap extends Base<CrossChainSwapData> {
830
+ status: CrossChainSwapStatus;
831
+ /** NEAR Intents' own status word. */
832
+ providerStatus: string;
833
+ network: string;
834
+ originChain: SwapChain;
835
+ originAsset: string;
836
+ originContract: string | null;
837
+ destinationChain: SwapChain;
838
+ destinationAsset: string;
839
+ destinationContract: string | null;
840
+ amountIn: string;
841
+ feeBps: number;
842
+ feeAmount: string;
843
+ amountOutEstimated: string;
844
+ amountOutMin: string;
845
+ slippageBps: number;
846
+ recipient: string;
847
+ refundTo: string;
848
+ depositAddress: string;
849
+ depositMemo: string | null;
850
+ depositUri: string;
851
+ /** QR of {@link depositUri}; list rows do not carry it. */
852
+ qr: string | null;
853
+ depositTxHash: string | null;
854
+ amountOut: string | null;
855
+ refundedAmount: string | null;
856
+ originTxHashes: CrossChainTransactionData[] | null;
857
+ destinationTxHashes: CrossChainTransactionData[] | null;
858
+ timeEstimateSeconds: number;
859
+ correlationId: string;
860
+ /** Keep it: NEAR Intents' signature over the quote settles a dispute. */
861
+ quoteSignature: string;
862
+ idempotencyKey: string | null;
863
+ expiresAt: Date;
864
+ createdAt: Date;
865
+ updatedAt: Date;
866
+ constructor(client: Client, data: CrossChainSwapData);
867
+ protected _patch(data: CrossChainSwapData): this;
868
+ /** Whether the swap has reached an outcome that will not change. */
869
+ get isFinal(): boolean;
870
+ get isSucceeded(): boolean;
871
+ /** Re-fetch from the API, updating this instance in place. */
872
+ fetch(): Promise<this>;
873
+ /**
874
+ * Report the transaction that paid the deposit address so NEAR Intents starts
875
+ * without waiting for its indexer. Updates this instance in place.
876
+ */
877
+ reportDeposit(txHash: string): Promise<this>;
878
+ toJSON(): CrossChainSwapData;
879
+ }
880
+
881
+ /** A page of cross-chain swaps plus its pagination metadata. */
882
+ interface CrossChainSwapPage {
883
+ items: CrossChainSwap[];
884
+ total: number;
885
+ take: number;
886
+ skip: number;
887
+ }
888
+ /**
889
+ * Swaps between Stellar, Solana and Monad, settled by NEAR Intents —
890
+ * `client.crossChainSwaps`. Mainnet only: a `dev` key can list assets and
891
+ * quote, but creating answers `400 network_unsupported`. Both legs on one chain
892
+ * is `client.swaps` with `chain`.
893
+ *
894
+ * @example
895
+ * const swap = await client.crossChainSwaps.create({
896
+ * originChain: 'stellar', originAsset: 'XLM', amount: '100',
897
+ * destinationChain: 'solana', destinationAsset: 'USDC',
898
+ * recipient: solanaAddress, refundTo: stellarAddress,
899
+ * });
900
+ * // Pay swap.amountIn to swap.depositAddress (memo swap.depositMemo), or open swap.depositUri.
901
+ */
902
+ declare class CrossChainSwapManager extends BaseManager<CrossChainSwap> {
903
+ private readonly route;
904
+ /** The tokens NEAR Intents can swap on Stellar, Solana and Monad. */
905
+ assets(): Promise<CrossChainAssetData[]>;
906
+ /** A dry quote: output, minimum and commission. Persists nothing. */
907
+ quote(options: QuoteCrossChainSwapOptions): Promise<CrossChainQuoteData>;
908
+ /** A live quote: the deposit address, memo and wallet link that fund the swap. */
909
+ create(options: CreateCrossChainSwapOptions): Promise<CrossChainSwap>;
910
+ fetch(id: string): Promise<CrossChainSwap>;
911
+ list(options?: ListCrossChainSwapsOptions): Promise<CrossChainSwapPage>;
912
+ /** Report the transaction that paid the deposit address. */
913
+ reportDeposit(id: string, txHash: string): Promise<CrossChainSwap>;
914
+ }
915
+
916
+ /**
917
+ * DeFindex vaults on Stellar — `client.defindex`. Served only where the
918
+ * deployment enables the DeFindex native plugin (`PLUGINS_ENABLED=defindex`);
919
+ * elsewhere every call is a 404.
920
+ *
921
+ * The payloads are DeFindex's own and are passed through untyped. Deposits and
922
+ * withdrawals come back as an unsigned transaction for the caller to sign and
923
+ * hand to {@link submit}.
924
+ */
925
+ declare class DefindexManager {
926
+ readonly client: Client;
927
+ private readonly route;
928
+ constructor(client: Client);
929
+ private get rest();
930
+ vaults<T = unknown>(): Promise<T>;
931
+ vault<T = unknown>(vault: string): Promise<T>;
932
+ /** An account's position in a vault. */
933
+ balance<T = unknown>(vault: string, account: string): Promise<T>;
934
+ deposit<T = unknown>(vault: string, options: DefindexDepositOptions): Promise<T>;
935
+ withdraw<T = unknown>(vault: string, options: DefindexWithdrawOptions): Promise<T>;
936
+ /** Submit a signed DeFindex transaction (base64 XDR). */
937
+ submit<T = unknown>(xdr: string): Promise<T>;
938
+ }
939
+
940
+ /**
941
+ * Plugins this deployment serves — `client.plugins`. A plugin runs only for a
942
+ * consumer that installed it, and installing is consenting to exactly the
943
+ * capabilities it declares: pass them back as `grantCapabilities`.
944
+ *
945
+ * @example
946
+ * const plugin = await client.plugins.fetch('invoices');
947
+ * await client.plugins.install('invoices', { grantCapabilities: plugin.capabilities });
948
+ * const { output } = await client.plugins.query('invoices', 'list', { status: 'open' });
949
+ */
950
+ declare class PluginManager {
951
+ readonly client: Client;
952
+ private readonly route;
953
+ constructor(client: Client);
954
+ private get rest();
955
+ list(): Promise<PluginData[]>;
956
+ fetch(slug: string): Promise<PluginData>;
957
+ /** Install (or re-consent to) a plugin. */
958
+ install(slug: string, options: InstallPluginOptions): Promise<PluginData>;
959
+ uninstall(slug: string): Promise<PluginUninstalledData>;
960
+ /** Run a read-only action the plugin declares. */
961
+ query<T = unknown>(slug: string, action: string, input?: Record<string, unknown>): Promise<PluginActionResultData<T>>;
962
+ /** Run an action that may change the plugin's state. */
963
+ command<T = unknown>(slug: string, action: string, input?: Record<string, unknown>): Promise<PluginActionResultData<T>>;
964
+ }
965
+
966
+ /**
967
+ * The shared public API key — `client.publicKey`. It is what an open-source
968
+ * wallet embeds to reach the few routes anonymous callers may use; the route
969
+ * that serves it takes no key at all. Mostly useful to tooling that ships such
970
+ * a wallet; a server with its own key has no need for it.
971
+ */
972
+ declare class PublicKeyManager {
973
+ readonly client: Client;
974
+ private readonly route;
975
+ constructor(client: Client);
976
+ private get rest();
977
+ /** The public key for an environment (`dev` → testnet, `prod` → mainnet). */
978
+ fetch(env?: 'dev' | 'prod'): Promise<PublicKeyData>;
979
+ }
980
+
224
981
  /**
225
982
  * A Stellar SEP-7 payment intent.
226
983
  *
@@ -312,6 +1069,11 @@ declare class PaymentIntentManager extends BaseManager<PaymentIntent> {
312
1069
  createPay(options: CreatePayPaymentIntentOptions): Promise<PaymentIntent>;
313
1070
  /** Get a single payment intent by id. */
314
1071
  fetch(id: string): Promise<PaymentIntent>;
1072
+ /**
1073
+ * Every status change an intent went through, oldest first — who moved it
1074
+ * (`api`, `validate`, `observer`, `system`), when, and with which transaction.
1075
+ */
1076
+ transitions(id: string): Promise<PaymentIntentTransitionData[]>;
315
1077
  /** List the consumer's payment intents (paginated). */
316
1078
  list(options?: ListPaymentIntentsOptions): Promise<PaymentIntentPage>;
317
1079
  /** Update a payment intent (status / txHash / reference). */
@@ -384,7 +1146,68 @@ declare class ProductManager extends BaseManager<Product> {
384
1146
  }
385
1147
 
386
1148
  /**
387
- * A Stellar path-payment swap.
1149
+ * A same-chain swap on Solana (built by Jupiter) or Monad (built by Kuru Flow),
1150
+ * from `client.swaps` with `chain: 'solana' | 'monad'`.
1151
+ *
1152
+ * Non-custodial like a Stellar {@link Swap}: sign {@link transaction} in the
1153
+ * wallet that owns {@link source}, then `await swap.submit({ signedTransaction })`.
1154
+ * The server checks it is the transaction it built before broadcasting it. On
1155
+ * Monad, when {@link approval} is set, send and confirm that `approve` call first.
1156
+ */
1157
+ declare class ChainSwap extends Base<ChainSwapData> {
1158
+ chain: OtherSwapChain;
1159
+ network: string;
1160
+ /** The aggregator that built it. */
1161
+ provider: 'jupiter' | 'kuru';
1162
+ status: SwapStatus;
1163
+ /** The wallet that signs, pays and receives. */
1164
+ source: string;
1165
+ /** `native`, or the SPL mint / ERC-20 address. */
1166
+ sendAsset: string;
1167
+ sendAmount: string;
1168
+ destAsset: string;
1169
+ destEstimated: string;
1170
+ destMin: string;
1171
+ feeBps: number;
1172
+ /** The commission, in the destination asset. */
1173
+ feeAmount: string;
1174
+ slippageBps: number;
1175
+ path: {
1176
+ code: string;
1177
+ issuer: string | null;
1178
+ }[];
1179
+ /** What the wallet signs. */
1180
+ transaction: ChainSwapTransaction;
1181
+ /** Monad ERC-20 sales with a short allowance: the `approve` call to send first. */
1182
+ approval: EvmCallData | null;
1183
+ txHash: string | null;
1184
+ idempotencyKey: string | null;
1185
+ /** Submit refuses the transaction after this. */
1186
+ expiresAt: Date;
1187
+ createdAt: Date;
1188
+ updatedAt: Date;
1189
+ constructor(client: Client, data: ChainSwapData);
1190
+ protected _patch(data: ChainSwapData): this;
1191
+ /** Whether the swap has settled on-chain. */
1192
+ get isSucceeded(): boolean;
1193
+ /** Whether the swap is still awaiting submission. */
1194
+ get isPending(): boolean;
1195
+ /** Whether the built transaction can no longer be submitted. */
1196
+ get isStale(): boolean;
1197
+ /** Re-fetch this swap from the API. */
1198
+ fetch(): Promise<ChainSwap>;
1199
+ /**
1200
+ * Relay the signed transaction. Mutates this instance from the refreshed
1201
+ * swap in the outcome and returns the outcome.
1202
+ */
1203
+ submit(options: {
1204
+ signedTransaction: string;
1205
+ }): Promise<ChainSwapSubmitOutcome>;
1206
+ toJSON(): ChainSwapData;
1207
+ }
1208
+
1209
+ /**
1210
+ * A Stellar path-payment swap. Solana and Monad swaps are {@link ChainSwap}.
388
1211
  *
389
1212
  * Wraps the raw API payload with typed accessors and atomic action methods so
390
1213
  * you can operate on it directly: `await swap.fetch()`,
@@ -441,18 +1264,20 @@ declare class Swap extends Base<SwapData> {
441
1264
  * Relay the signed transaction for this swap. Mutates this instance from the
442
1265
  * refreshed swap in the outcome and returns the outcome.
443
1266
  */
444
- submit(options: SubmitSwapOptions): Promise<SwapSubmitOutcome>;
1267
+ submit(options: {
1268
+ signedXdr: string;
1269
+ }): Promise<SwapSubmitOutcome>;
445
1270
  toJSON(): SwapData;
446
1271
  }
447
1272
 
448
1273
  /** A page of swaps plus its pagination metadata. */
449
- interface SwapPage {
450
- items: Swap[];
1274
+ interface SwapPage<T extends Swap | ChainSwap = Swap> {
1275
+ items: T[];
451
1276
  total: number;
452
1277
  take: number;
453
1278
  skip: number;
454
1279
  }
455
- /** Submission outcome with the refreshed swap materialized. */
1280
+ /** Submission outcome of a Stellar swap, with the refreshed swap materialized. */
456
1281
  interface SwapSubmitOutcome {
457
1282
  submitted: boolean;
458
1283
  status: SwapStatus;
@@ -461,33 +1286,53 @@ interface SwapSubmitOutcome {
461
1286
  resultCodes: string[] | null;
462
1287
  swap: Swap;
463
1288
  }
1289
+ /** Submission outcome of a Solana or Monad swap. */
1290
+ interface ChainSwapSubmitOutcome {
1291
+ submitted: boolean;
1292
+ status: SwapStatus;
1293
+ txHash: string;
1294
+ swap: ChainSwap;
1295
+ }
1296
+ /** A request that names a chain off Stellar. */
1297
+ type OnOtherChain = {
1298
+ chain: OtherSwapChain;
1299
+ };
464
1300
  /**
465
- * Manages Stellar swaps — `client.swaps`.
1301
+ * Same-chain swaps — `client.swaps`. No `chain` (or `'stellar'`) is a Stellar
1302
+ * path payment and yields a {@link Swap}, exactly as before; `'solana'` goes
1303
+ * through Jupiter and `'monad'` through Kuru Flow and yields a {@link ChainSwap}.
1304
+ * Swaps between chains are `client.crossChainSwaps`.
466
1305
  *
467
1306
  * @example
468
- * const quote = await client.swaps.quote({
469
- * amount: '100', destAssetCode: 'USDC',
470
- * });
471
1307
  * const swap = await client.swaps.create({
472
- * amount: '100', destAssetCode: 'USDC', source: 'G...',
1308
+ * amount: '100', destAssetCode: 'USDC', destAssetIssuer: 'GA5Z…', source: 'G...',
473
1309
  * });
474
1310
  * console.log(swap.uri, swap.qr);
1311
+ *
1312
+ * const sol = await client.swaps.create({
1313
+ * chain: 'solana', amount: '0.1', sourceAssetCode: 'SOL',
1314
+ * destAssetCode: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', source: wallet,
1315
+ * });
1316
+ * await sol.submit({ signedTransaction: signInWallet(sol.transaction) });
475
1317
  */
476
- declare class SwapManager extends BaseManager<Swap> {
1318
+ declare class SwapManager extends BaseManager<Swap | ChainSwap> {
477
1319
  private readonly route;
478
1320
  /** Price a swap without creating it. Returns a plain quote (not a {@link Swap}). */
479
1321
  quote(options: QuoteSwapOptions): Promise<SwapQuoteData>;
480
- /** Create a swap (unsigned XDR + SEP-7 URI + QR). */
1322
+ /** Create a swap: an unsigned transaction for the source wallet to sign. */
1323
+ create(options: CreateSwapOptions & OnOtherChain): Promise<ChainSwap>;
481
1324
  create(options: CreateSwapOptions): Promise<Swap>;
482
- /** Get a single swap by id. */
483
- fetch(id: string): Promise<Swap>;
484
- /** List the consumer's swaps (paginated). */
485
- list(options?: ListSwapsOptions): Promise<SwapPage>;
1325
+ /** Get a single swap by id, on any chain. */
1326
+ fetch(id: string): Promise<Swap | ChainSwap>;
1327
+ /** List the consumer's swaps on one chain (Stellar when `chain` is omitted). */
1328
+ list(options: ListSwapsOptions & OnOtherChain): Promise<SwapPage<ChainSwap>>;
1329
+ list(options?: ListSwapsOptions): Promise<SwapPage<Swap>>;
486
1330
  /**
487
- * Relay a signed swap transaction to the network. Finalizes status
488
- * server-side and returns the outcome with the refreshed swap materialized.
1331
+ * Relay a signed swap transaction to its network: `{ signedXdr }` for a
1332
+ * Stellar swap, `{ signedTransaction }` for a Solana or Monad one.
489
1333
  */
490
- submit(id: string, options: SubmitSwapOptions): Promise<SwapSubmitOutcome>;
1334
+ submit(id: string, options: SubmitSwapOptions): Promise<SwapSubmitOutcome | ChainSwapSubmitOutcome>;
1335
+ private materialize;
491
1336
  }
492
1337
 
493
1338
  /** A single attempt to deliver an event to a webhook endpoint (audit record). */
@@ -577,21 +1422,17 @@ type WebhookHandlerOptions = WebhookProcessOptions;
577
1422
  * event type (`PAYMENT_INTENT_SUCCEEDED`), its camelCase alias
578
1423
  * (`paymentIntentSucceeded`), or `event` to catch them all.
579
1424
  */
580
- interface WebhookListenerEvents {
581
- event: [WebhookEvent<PaymentIntentData>];
582
- PAYMENT_INTENT_CREATED: [WebhookEvent<PaymentIntentData>];
583
- PAYMENT_INTENT_UPDATED: [WebhookEvent<PaymentIntentData>];
584
- PAYMENT_INTENT_SUCCEEDED: [WebhookEvent<PaymentIntentData>];
585
- PAYMENT_INTENT_FAILED: [WebhookEvent<PaymentIntentData>];
586
- PAYMENT_INTENT_CANCELLED: [WebhookEvent<PaymentIntentData>];
587
- PAYMENT_INTENT_DELETED: [WebhookEvent<PaymentIntentData>];
588
- paymentIntentCreated: [WebhookEvent<PaymentIntentData>];
589
- paymentIntentUpdated: [WebhookEvent<PaymentIntentData>];
590
- paymentIntentSucceeded: [WebhookEvent<PaymentIntentData>];
591
- paymentIntentFailed: [WebhookEvent<PaymentIntentData>];
592
- paymentIntentCancelled: [WebhookEvent<PaymentIntentData>];
593
- paymentIntentDeleted: [WebhookEvent<PaymentIntentData>];
594
- }
1425
+ type WebhookListenerEvents = {
1426
+ event: [AnyWebhookEvent];
1427
+ } & {
1428
+ [K in keyof WebhookEventDataMap]: [TypedWebhookEvent<K>];
1429
+ } & {
1430
+ [K in keyof WebhookEventDataMap as CamelEvent<K>]: [TypedWebhookEvent<K>];
1431
+ };
1432
+ /** `SWAP_SUCCEEDED` → `SwapSucceeded`. */
1433
+ type PascalEvent<S extends string> = S extends `${infer H}_${infer T}` ? `${Capitalize<Lowercase<H>>}${PascalEvent<T>}` : Capitalize<Lowercase<S>>;
1434
+ /** `SWAP_SUCCEEDED` → `swapSucceeded`, the alias each event is also emitted as. */
1435
+ type CamelEvent<S extends string> = Uncapitalize<PascalEvent<S>>;
595
1436
  /** Minimal Express-like request (so we don't depend on `@types/express`). */
596
1437
  interface RequestLike {
597
1438
  headers: Record<string, string | string[] | undefined>;
@@ -661,7 +1502,7 @@ declare class WebhookManager extends BaseManager<WebhookEndpoint> {
661
1502
  *
662
1503
  * @throws {WebhookSignatureError} when the signature is missing/invalid.
663
1504
  */
664
- process(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, options?: WebhookProcessOptions): WebhookEvent<PaymentIntentData>;
1505
+ process(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, options?: WebhookProcessOptions): AnyWebhookEvent;
665
1506
  /**
666
1507
  * Build a Node.js `http`/`https` request handler that verifies the signature,
667
1508
  * dispatches the event to your listeners, and replies `200`/`400`.
@@ -814,7 +1655,7 @@ interface Client {
814
1655
  */
815
1656
  declare class Client extends EventEmitter {
816
1657
  /** Library version. */
817
- static readonly version = "1.2.1";
1658
+ static readonly version = "2.1.0";
818
1659
  /**
819
1660
  * Process-wide shared defaults maintained by Cosmos Pay (gateway URL, version,
820
1661
  * internal secrets). Mutate once at startup to change them for every client
@@ -833,14 +1674,36 @@ declare class Client extends EventEmitter {
833
1674
  readonly webhooks: WebhookManager;
834
1675
  /** Products / prices. */
835
1676
  readonly products: ProductManager;
836
- /** Stellar swaps — quote/create/fetch/list/submit. */
1677
+ /** Same-chain swaps: the Stellar DEX, Jupiter on Solana, Kuru Flow on Monad. */
837
1678
  readonly swaps: SwapManager;
1679
+ /** Swaps between Stellar, Solana and Monad, settled by NEAR Intents. */
1680
+ readonly crossChainSwaps: CrossChainSwapManager;
1681
+ /** Liquidity pools: browse, positions, deposit / withdraw. */
1682
+ readonly liquidity: LiquidityManager;
1683
+ /** Fiat -> stablecoin: quotes, payins, trustlines, virtual accounts. */
1684
+ readonly onramp: OnrampManager;
1685
+ /** Stablecoin -> fiat: quotes, authorize, payouts, compliance documents. */
1686
+ readonly offramp: OfframpManager;
1687
+ /** The client event stream: report events, read them back, summarize. */
1688
+ readonly activity: ActivityManager;
1689
+ /** KYC / KYB: receivers, their wallets and their bank accounts. */
1690
+ readonly kyc: KycManager;
838
1691
  /** Customers. */
839
1692
  readonly customers: CustomerManager;
840
1693
  /** Read-only analytics (summary, balances, logs). */
841
1694
  readonly analytics: AnalyticsManager;
842
1695
  /** Service health probes (public). */
843
1696
  readonly health: HealthManager;
1697
+ /** Payment handles: resolve, claim and manage `@name` aliases. */
1698
+ readonly aliases: AliasManager;
1699
+ /** The asset registry: which `(code, issuer)` pairs exist per network, and who issues them. */
1700
+ readonly assets: AssetManager;
1701
+ /** Plugins this deployment serves: install, query, command. */
1702
+ readonly plugins: PluginManager;
1703
+ /** DeFindex vaults (when the deployment enables the native plugin). */
1704
+ readonly defindex: DefindexManager;
1705
+ /** The shared public API key an open-source wallet embeds. */
1706
+ readonly publicKey: PublicKeyManager;
844
1707
  constructor(options: ClientOptions);
845
1708
  /** Update the API key used for subsequent requests. */
846
1709
  setApiKey(apiKey: string): this;
@@ -905,7 +1768,7 @@ declare const Webhooks: {
905
1768
  };
906
1769
 
907
1770
  /** Library version, kept in sync with package.json. */
908
- declare const version = "1.2.1";
1771
+ declare const version = "2.1.0";
909
1772
  /**
910
1773
  * Default base URL of the Cosmos Pay gateway. Maintained by Cosmos Pay — users
911
1774
  * never need to set this; it's part of the {@link shared} configuration. Override
@@ -937,4 +1800,4 @@ declare const Events: {
937
1800
  };
938
1801
  type ClientEvent = (typeof Events)[keyof typeof Events];
939
1802
 
940
- export { AnalyticsBalancesData, AnalyticsManager, AnalyticsSummaryData, ApiLogsData, Base, BaseManager, Client, type ClientEvent, type ClientEvents, type ClientOptions, CreateCustomerOptions, CreatePayPaymentIntentOptions, CreateProductOptions, CreateSwapOptions, CreateTxPaymentIntentOptions, CreateWebhookEndpointOptions, Customer, CustomerData, CustomerManager, DEFAULT_BASE_URL, DEFAULT_RETRIES, DEFAULT_TIMEOUT, DEFAULT_VERSION, DeletedData, Events, type FetchLike, HealthCheckData, HealthManager, ListPaymentIntentsOptions, ListSwapsOptions, ListWebhookDeliveriesOptions, PaymentIntent, PaymentIntentData, PaymentIntentKind, PaymentIntentManager, type PaymentIntentPage, PaymentIntentStatus, Product, ProductData, ProductKind, ProductManager, QuoteSwapOptions, REST, type RESTOptions, type RequestOptions, SIGNATURE_HEADER, type SharedConfig, SubmitSwapOptions, Swap, SwapData, SwapManager, type SwapPage, SwapQuoteData, SwapStatus, type SwapSubmitOutcome, UpdateCustomerOptions, UpdatePaymentIntentOptions, UpdateProductOptions, UpdateWebhookEndpointOptions, ValidatePaymentIntentOptions, type ValidationOutcome, ValidationOutcomeData, type VerifyWebhookOptions, WebhookDelivery, WebhookDeliveryData, type WebhookDeliveryPage, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointData, WebhookEndpointWithSecretData, WebhookEvent, WebhookEventType, type WebhookHandlerOptions, type WebhookListenerEvents, WebhookLogsData, WebhookManager, WebhookPingData, type WebhookProcessOptions, WebhookSignatureError, Webhooks, resolveShared, shared, version };
1803
+ export { ActivityEventInput, ActivityListData, ActivityManager, type ActivityPage, ActivityReportData, ActivitySummaryData, AddAliasAddressOptions, AliasAddressData, AliasAvailabilityData, AliasByAddressData, AliasChallengeData, AliasDeletedData, AliasListData, AliasManager, AliasRecoveryStartedData, AliasResolutionData, AnalyticsBalancesData, AnalyticsManager, AnalyticsSummaryData, AnyWebhookEvent, ApiLogsData, ApproveReceiverOptions, AssetManager, AssetRegistryData, AttachPayoutDocumentOptions, AuthorizePayoutData, AuthorizePayoutOptions, BankAccountData, type BankAccountPage, BankDetailsData, Base, BaseManager, BrowseLiquidityPoolsOptions, ChainSwap, ChainSwapData, type ChainSwapSubmitOutcome, ChainSwapTransaction, ClaimAliasOptions, Client, type ClientEvent, type ClientEvents, type ClientOptions, CompleteAliasRecoveryOptions, CreateAliasChallengeOptions, CreateBankAccountOptions, CreateCrossChainSwapOptions, CreateCustomerOptions, CreatePayPaymentIntentOptions, CreatePayinOptions, CreatePayinQuoteOptions, CreatePayoutOptions, CreatePayoutQuoteOptions, CreateProductOptions, CreateReceiverOptions, CreateReceiverWalletOptions, CreateSwapOptions, CreateTrustlineOptions, CreateTxPaymentIntentOptions, CreateVirtualAccountOptions, CreateWebhookEndpointOptions, CrossChainAssetData, CrossChainQuoteData, CrossChainSwap, CrossChainSwapData, CrossChainSwapManager, type CrossChainSwapPage, CrossChainSwapStatus, CrossChainTransactionData, Customer, CustomerData, CustomerManager, DEFAULT_BASE_URL, DEFAULT_RETRIES, DEFAULT_TIMEOUT, DEFAULT_VERSION, DefindexDepositOptions, DefindexManager, DefindexWithdrawOptions, DeletedData, DepositLiquidityOptions, EnableReceiverOptions, Events, EvmCallData, type FetchLike, HealthCheckData, HealthManager, InitiateTosOptions, InstallPluginOptions, KycManager, KycRailsData, KycUploadData, LiquidityManager, LiquidityOperation, LiquidityOperationData, LiquidityOperationKind, type LiquidityOperationPage, LiquidityOperationStatus, LiquidityPoolData, type LiquidityPoolPage, LiquidityPositionsData, type LiquiditySubmitOutcome, ListActivityOptions, ListCrossChainSwapsOptions, ListKycOptions, ListLiquidityOperationsOptions, ListPayinsOptions, ListPaymentIntentsOptions, ListPayoutsOptions, ListRegistryAssetsOptions, ListSwapsOptions, ListWebhookDeliveriesOptions, OfframpManager, OnrampManager, OtherSwapChain, OwnedAliasData, PayinData, type PayinPage, PayinQuoteData, PaymentIntent, PaymentIntentData, PaymentIntentKind, PaymentIntentManager, type PaymentIntentPage, PaymentIntentStatus, PaymentIntentTransitionData, PayoutData, PayoutDocumentData, type PayoutPage, PayoutQuoteData, PluginActionResultData, PluginData, PluginManager, PluginUninstalledData, Product, ProductData, ProductKind, ProductManager, PublicKeyData, PublicKeyManager, QuoteCrossChainSwapOptions, QuoteSwapOptions, REST, type RESTOptions, Receiver, ReceiverData, type ReceiverPage, ReceiverWalletData, type ReceiverWalletPage, ReportActivityOptions, type RequestOptions, RequestTosOptions, SIGNATURE_HEADER, SetReceiverAccessOptions, type SharedConfig, SubmitLiquidityOptions, SubmitSwapOptions, Swap, SwapChain, SwapData, SwapManager, type SwapPage, SwapQuoteData, SwapStatus, type SwapSubmitOutcome, TermsOfServiceData, TrustlineData, TypedWebhookEvent, UpdateCustomerOptions, UpdatePaymentIntentOptions, UpdateProductOptions, UpdateReceiverOptions, UpdateWebhookEndpointOptions, ValidatePaymentIntentOptions, type ValidationOutcome, ValidationOutcomeData, type VerifyWebhookOptions, VirtualAccountData, WalletSignMessageData, WebhookDelivery, WebhookDeliveryData, type WebhookDeliveryPage, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointData, WebhookEndpointWithSecretData, WebhookEvent, WebhookEventDataMap, WebhookEventType, type WebhookHandlerOptions, type WebhookListenerEvents, WebhookLogsData, WebhookManager, WebhookPingData, type WebhookProcessOptions, WebhookSignatureError, Webhooks, WithdrawLiquidityOptions, resolveShared, shared, version };