@cosmosapp/pay_sdk 1.2.0 → 2.0.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +0 -75
  3. package/NOTICE +8 -0
  4. package/README.md +15 -18
  5. package/dist/chunk-AYVWYEOK.js +62 -0
  6. package/dist/chunk-AYVWYEOK.js.map +1 -0
  7. package/dist/{chunk-TZDZBVFS.js → chunk-TM4HAKWE.js} +5 -3
  8. package/dist/chunk-TM4HAKWE.js.map +1 -0
  9. package/dist/cosmosProvider-CFASjnd5.d.cts +100 -0
  10. package/dist/cosmosProvider-CFASjnd5.d.ts +100 -0
  11. package/dist/index.cjs +739 -3
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +618 -6
  14. package/dist/index.d.ts +618 -6
  15. package/dist/index.js +731 -5
  16. package/dist/index.js.map +1 -1
  17. package/dist/intent-input-BtUp3tFN.d.cts +1697 -0
  18. package/dist/intent-input-BtUp3tFN.d.ts +1697 -0
  19. package/dist/swk/index.cjs +170 -0
  20. package/dist/swk/index.cjs.map +1 -0
  21. package/dist/swk/index.d.cts +207 -0
  22. package/dist/swk/index.d.ts +207 -0
  23. package/dist/swk/index.js +106 -0
  24. package/dist/swk/index.js.map +1 -0
  25. package/dist/web/index.cjs +129 -2
  26. package/dist/web/index.cjs.map +1 -1
  27. package/dist/web/index.d.cts +49 -4
  28. package/dist/web/index.d.ts +49 -4
  29. package/dist/web/index.js +67 -4
  30. package/dist/web/index.js.map +1 -1
  31. package/llms/03-quickstart.md +4 -4
  32. package/llms/05-payment-intents.md +6 -2
  33. package/llms/08-products-customers.md +1 -1
  34. package/llms/13-types-reference.md +1 -1
  35. package/llms/14-recipes.md +14 -8
  36. package/llms/llms-full.txt +26 -16
  37. package/package.json +17 -6
  38. package/dist/chunk-TZDZBVFS.js.map +0 -1
  39. package/dist/intent-input-Ch8ogEg-.d.cts +0 -750
  40. package/dist/intent-input-Ch8ogEg-.d.ts +0 -750
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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-.js';
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-.js';
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, L as LiquidityOperationData, d as LiquidityOperationKind, e as LiquidityOperationStatus, S as SubmitLiquidityOptions, D as DepositLiquidityOptions, f as WithdrawLiquidityOptions, g as LiquidityPositionsData, B as BrowseLiquidityPoolsOptions, h as LiquidityPoolData, i as ListLiquidityOperationsOptions, j as CreatePayinQuoteOptions, P as PayinQuoteData, k as CreatePayinOptions, l as PayinData, m as ListPayinsOptions, n as CreateTrustlineOptions, T as TrustlineData, o as CreateVirtualAccountOptions, V as VirtualAccountData, p as CreatePayoutQuoteOptions, q as PayoutQuoteData, r as AuthorizePayoutOptions, s as AuthorizePayoutData, t as CreatePayoutOptions, u as PayoutData, v as ListPayoutsOptions, w as AttachPayoutDocumentOptions, x as PayoutDocumentData, y as ActivityEventInput, R as ReportActivityOptions, z as ActivityReportData, E as ListActivityOptions, F as ActivityListData, G as ActivitySummaryData, I as ReceiverData, J as UpdateReceiverOptions, K as ApproveReceiverOptions, M as RequestTosOptions, N as TermsOfServiceData, O as EnableReceiverOptions, Q as CreateReceiverWalletOptions, X as ReceiverWalletData, Y as ListKycOptions, Z as CreateBankAccountOptions, _ as BankAccountData, $ as CreateReceiverOptions, a0 as SetReceiverAccessOptions, a1 as WalletSignMessageData, a2 as KycUploadData, a3 as InitiateTosOptions, a4 as KycRailsData, a5 as BankDetailsData, a6 as PollarAuthorizeOptions, a7 as PollarAuthorizeData, a8 as PollarLoginSessionData, a9 as PollarTokenOptions, aa as PollarSessionData, ab as PollarRefreshOptions, ac as PollarRefreshData, ad as PollarLogoutOptions, ae as PollarLogoutData, af as VerifyPollarTokenOptions, ag as PollarTokenVerificationData, ah as ActivatePollarWalletOptions, ai as PollarActivationData, aj as PollarTrustlineData, ak as PollarTrustlinesOptions, al as RegisterPollarUserOptions, am as PollarUserData, an as PaymentIntentData, ao as PaymentIntentKind, ap as PaymentIntentStatus, aq as UpdatePaymentIntentOptions, ar as DeletedData, as as ValidationOutcomeData, at as CreateTxPaymentIntentOptions, au as CreatePayPaymentIntentOptions, av as ListPaymentIntentsOptions, aw as ValidatePaymentIntentOptions, ax as ProductData, ay as ProductKind, az as UpdateProductOptions, aA as CreateProductOptions, aB as SwapData, aC as SwapStatus, aD as SubmitSwapOptions, aE as QuoteSwapOptions, aF as SwapQuoteData, aG as CreateSwapOptions, aH as ListSwapsOptions, aI as WebhookDeliveryData, aJ as WebhookEventType, aK as WebhookDeliveryStatus, aL as WebhookEndpointData, aM as WebhookEndpointWithSecretData, aN as UpdateWebhookEndpointOptions, aO as WebhookPingData, aP as ListWebhookDeliveriesOptions, aQ as WebhookEvent, aR as CreateWebhookEndpointOptions } from './intent-input-BtUp3tFN.js';
3
+ export { aS as ActivityBucket, aT as ActivityEventData, aU as ActivityLevel, aV as ActivitySource, aW as AddressBook, aX as AddressRef, aY as AnalyticsBalanceEntry, aZ as AnalyticsRecentRow, a_ as AnalyticsSeriesPoint, a$ as AnalyticsVolumeEntry, b0 as ApiLogRow, b1 as AssetDefinition, b2 as AssetRef, b3 as Assets, b4 as BankAccountListData, b5 as BankRail, b6 as BankingPartner, b7 as CosmosPayAPIError, b8 as CosmosPayRequestError, b9 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 PollarAuthorizeBaseOptions, bp as PollarDpopJwk, bq as PollarLoginStatus, br as PollarProfileData, bs as PollarProvider, bt as PollarTrustlineAsset, bu as PollarWalletData, bv as RampToken, bw as ReceiverListData, bx as ReceiverOwner, by as ReceiverType, bz as ReceiverWalletListData, bA as ReceiverWalletNetwork, bB as ResolvableIntentInput, bC as ResolvedAsset, bD as SwapListData, bE as SwapSubmitOutcomeData, bF as TestnetAssets, bG as WalletId, bH as Wallets, bI as WebhookDeliveryListData, bJ as WebhookLogRow, bK as addresses, bL as assertAddress, bM as defineAsset, bN as isAddress, bO as isContractAddress, bP as isMuxedAddress, bQ as isNativeAsset, bR as isStellarAddress, bS as resolveAddress, bT as resolveAsset, bU as resolveIntentBody } from './intent-input-BtUp3tFN.js';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
6
6
  /**
@@ -44,7 +44,6 @@ declare abstract class Base<Data extends {
44
44
 
45
45
  /** A customer record, optionally enriched with on-chain payment stats. */
46
46
  declare class Customer extends Base<CustomerData> {
47
- consumerId: string;
48
47
  name: string;
49
48
  alias: string | null;
50
49
  note: string | null;
@@ -221,6 +220,607 @@ declare class HealthManager {
221
220
  readiness(): Promise<HealthCheckData>;
222
221
  }
223
222
 
223
+ /**
224
+ * One deposit into, or withdrawal from, a Stellar liquidity pool.
225
+ *
226
+ * The server builds the envelope and the wallet signs it, so an operation is a
227
+ * two-step object: it arrives `PENDING` carrying an unsigned `xdr`, and reaches
228
+ * `SUBMITTED`/`SUCCEEDED` only once the signed envelope comes back through
229
+ * `submit()`. Both steps are available on the instance —
230
+ * `await operation.submit({ signedXdr })` — so a caller never has to keep the id
231
+ * and the manager in scope alongside it.
232
+ */
233
+ declare class LiquidityOperation extends Base<LiquidityOperationData> {
234
+ /** Deposit or withdrawal. */
235
+ kind: LiquidityOperationKind;
236
+ status: LiquidityOperationStatus;
237
+ network: string;
238
+ /** Account whose funds move, and which must sign. */
239
+ source: string;
240
+ /** The pool this operation acts on (hex id). */
241
+ poolId: string;
242
+ assetA: string;
243
+ assetAIssuer: string | null;
244
+ assetB: string;
245
+ assetBIssuer: string | null;
246
+ /** Maximum of asset A put in (deposit), or minimum taken out (withdrawal). */
247
+ amountA: string;
248
+ amountB: string;
249
+ /** Pool shares minted or burned; null until the network settles a deposit. */
250
+ shares: string | null;
251
+ /** Price band a deposit executes within, as decimal strings. */
252
+ minPrice: string | null;
253
+ maxPrice: string | null;
254
+ slippageBps: number;
255
+ idempotencyKey: string | null;
256
+ feeBps: number;
257
+ feeAmountA: string;
258
+ feeAmountB: string;
259
+ feeWallet: string | null;
260
+ commissionMemo: string | null;
261
+ /** Unsigned transaction envelope (base64 XDR) — what the wallet signs. */
262
+ xdr: string;
263
+ /** SEP-7 `web+stellar:tx` deep link for the same envelope. */
264
+ uri: string;
265
+ txHash: string;
266
+ /** QR code of the SEP-7 URI (PNG data URL). */
267
+ qr: string;
268
+ /** When the built envelope stops being submittable. */
269
+ expiresAt: Date | null;
270
+ createdAt: Date;
271
+ updatedAt: Date;
272
+ constructor(client: Client, data: LiquidityOperationData);
273
+ protected _patch(data: LiquidityOperationData): this;
274
+ /** True while the envelope still needs a signature. */
275
+ get isPending(): boolean;
276
+ /** True once the network accepted it. */
277
+ get isSucceeded(): boolean;
278
+ /** True for a deposit, false for a withdrawal. */
279
+ get isDeposit(): boolean;
280
+ /** Re-fetch this operation and patch it in place. */
281
+ fetch(): Promise<this>;
282
+ /** Relay the signed envelope to the network and patch this instance with the result. */
283
+ submit(options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome>;
284
+ toJSON(): LiquidityOperationData;
285
+ }
286
+
287
+ /** A page of liquidity operations plus its pagination metadata. */
288
+ interface LiquidityOperationPage {
289
+ items: LiquidityOperation[];
290
+ total: number;
291
+ take: number;
292
+ skip: number;
293
+ }
294
+ /** A page of on-chain pools. Horizon paginates by cursor, not by offset. */
295
+ interface LiquidityPoolPage {
296
+ items: LiquidityPoolData[];
297
+ /** Pass back as `cursor` to get the next page; null when there is none. */
298
+ cursor: string | null;
299
+ }
300
+ /** Submission outcome with the refreshed operation materialized. */
301
+ interface LiquiditySubmitOutcome {
302
+ submitted: boolean;
303
+ status: LiquidityOperationStatus;
304
+ txHash: string | null;
305
+ reason: string | null;
306
+ resultCodes: string[] | null;
307
+ operation: LiquidityOperation;
308
+ }
309
+ /**
310
+ * Liquidity pools — `client.liquidity`.
311
+ *
312
+ * Two surfaces in one manager, because they are two halves of the same job:
313
+ * *browsing* pools and positions (read-only, straight off Horizon), and
314
+ * *operating* on them (deposit / withdraw), which produces an unsigned envelope
315
+ * for a wallet to sign and a `submit()` to relay it back.
316
+ *
317
+ * The managed structure is the OPERATION, not the pool: a pool is a public
318
+ * on-chain object with no lifecycle of its own, while an operation is a thing this
319
+ * consumer created, can re-read and can push to the network.
320
+ *
321
+ * @example
322
+ * const op = await client.liquidity.deposit({
323
+ * source: 'G…',
324
+ * assetACode: 'XLM',
325
+ * assetBCode: 'USDC',
326
+ * assetBIssuer: 'GA5Z…',
327
+ * maxAmountA: '100',
328
+ * maxAmountB: '25',
329
+ * });
330
+ * // …wallet signs op.xdr…
331
+ * const { status, txHash } = await op.submit({ signedXdr });
332
+ */
333
+ declare class LiquidityManager extends BaseManager<LiquidityOperation> {
334
+ private readonly route;
335
+ /**
336
+ * Build a deposit into the pool formed by the two assets → unsigned XDR, SEP-7
337
+ * URI and QR.
338
+ *
339
+ * The pool is DERIVED from the two assets rather than named: a constant-product
340
+ * pool id is a hash of its (assetA, assetB, fee) in CAP-38 order, so there is
341
+ * exactly one pool the pair can form and no id for a caller to get wrong.
342
+ */
343
+ deposit(options: DepositLiquidityOptions): Promise<LiquidityOperation>;
344
+ /** Build a withdrawal (burn shares) from a pool → unsigned XDR, SEP-7 URI and QR. */
345
+ withdraw(options: WithdrawLiquidityOptions): Promise<LiquidityOperation>;
346
+ /** An account's pool share positions, with what each is redeemable for right now. */
347
+ positions(account: string): Promise<LiquidityPositionsData>;
348
+ /** Browse on-chain pools (Horizon proxy). Filter by asset pair or by holder. */
349
+ browse(options?: BrowseLiquidityPoolsOptions): Promise<LiquidityPoolPage>;
350
+ /** One on-chain pool by its hex id (Horizon proxy). */
351
+ pool(poolId: string): Promise<LiquidityPoolData>;
352
+ /** List this consumer's pool operations (paginated). */
353
+ operations(options?: ListLiquidityOperationsOptions): Promise<LiquidityOperationPage>;
354
+ /** Get one operation by id, materialized. */
355
+ fetch(id: string): Promise<LiquidityOperation>;
356
+ /**
357
+ * The raw payload for one operation. Exists so {@link LiquidityOperation.fetch}
358
+ * can patch itself in place instead of materializing a second instance of the
359
+ * thing the caller is already holding.
360
+ */
361
+ fetchRaw(id: string): Promise<LiquidityOperationData>;
362
+ /**
363
+ * Relay a signed operation to the network. The service checks the envelope's
364
+ * hash against the one it built, so a signed envelope that is not the one this
365
+ * operation describes is refused rather than broadcast.
366
+ */
367
+ submit(id: string, options: SubmitLiquidityOptions): Promise<LiquiditySubmitOutcome>;
368
+ }
369
+
370
+ /** A page of payins plus its pagination metadata. */
371
+ interface PayinPage {
372
+ items: PayinData[];
373
+ total: number;
374
+ take: number;
375
+ skip: number;
376
+ }
377
+ /**
378
+ * Fiat → stablecoin — `client.onramp`.
379
+ *
380
+ * Three steps, in this order and no other: **quote** (a price, valid for about
381
+ * five minutes), **payin** (created FROM that quote, and what returns the funding
382
+ * instructions the payer acts on), then the money arrives off-band and the payin
383
+ * status moves on its own.
384
+ *
385
+ * There is no structure class here on purpose. A payin has no action of its own —
386
+ * it is a mirror of the provider's record, read and re-read — so an object with a
387
+ * client back-reference would carry a `fetch()` and nothing else.
388
+ *
389
+ * @example
390
+ * const quote = await client.onramp.quote({
391
+ * blockchain_wallet_id: 'w_123',
392
+ * currency_type: 'sender',
393
+ * payment_method: 'pix',
394
+ * token: 'USDC',
395
+ * request_amount: 10_000, // minor units
396
+ * });
397
+ * const payin = await client.onramp.createPayin({ payin_quote_id: quote.id });
398
+ * console.log(payin.instructions);
399
+ */
400
+ declare class OnrampManager {
401
+ readonly client: Client;
402
+ private readonly route;
403
+ constructor(client: Client);
404
+ private get rest();
405
+ /** Price a payin. The quote expires — check `expires_at` before using it. */
406
+ quote(options: CreatePayinQuoteOptions): Promise<PayinQuoteData>;
407
+ /** Create a payin from a quote. The response carries the funding instructions. */
408
+ createPayin(options: CreatePayinOptions): Promise<PayinData>;
409
+ /** List this consumer's payins (paginated). */
410
+ payins(options?: ListPayinsOptions): Promise<PayinPage>;
411
+ /**
412
+ * One payin. Served from the local mirror, refreshed from the provider when it
413
+ * is stale — so this is the right call to poll, not the provider's own API.
414
+ */
415
+ payin(id: string): Promise<PayinData>;
416
+ /**
417
+ * Build the unsigned trustline transaction an address needs before it can hold
418
+ * the stablecoin the ramp pays out in.
419
+ *
420
+ * The envelope comes from the gateway, so a wallet signing it must decode and
421
+ * bound it first — the issuer it names is the one the payout will use, and it is
422
+ * not known to the caller in advance.
423
+ */
424
+ createTrustline(options: CreateTrustlineOptions): Promise<TrustlineData>;
425
+ /** Open a virtual account (a permanent bank reference) for a verified receiver. */
426
+ createVirtualAccount(receiverId: string, options: CreateVirtualAccountOptions): Promise<VirtualAccountData>;
427
+ /** A receiver's virtual accounts. */
428
+ virtualAccounts(receiverId: string, options?: ListPayinsOptions): Promise<VirtualAccountData>;
429
+ }
430
+
431
+ /** A page of payouts plus its pagination metadata. */
432
+ interface PayoutPage {
433
+ items: PayoutData[];
434
+ total: number;
435
+ take: number;
436
+ skip: number;
437
+ }
438
+ /**
439
+ * Stablecoin → fiat — `client.offramp`.
440
+ *
441
+ * Four steps, and the middle one is the one people miss: **quote**, **authorize**
442
+ * (which builds the unsigned transaction that moves the stablecoin), the wallet
443
+ * signs it, and only then **create the payout** with that signature attached. A
444
+ * payout created without a signed transfer is a payout with nothing behind it.
445
+ *
446
+ * `authorize` is for the chains that need a transaction built for them (Stellar,
447
+ * Solana). On EVM the quote itself carries the `approve` contract payload, so the
448
+ * caller signs that instead and goes straight to `createPayout`.
449
+ *
450
+ * @example
451
+ * const quote = await client.offramp.quote({
452
+ * bank_account_id: 'ba_123',
453
+ * currency_type: 'sender',
454
+ * request_amount: 5_000,
455
+ * network: 'stellar',
456
+ * token: 'USDC',
457
+ * });
458
+ * const { xdr } = await client.offramp.authorize({
459
+ * quote_id: quote.id,
460
+ * sender_wallet_address: 'G…',
461
+ * chain: 'stellar',
462
+ * });
463
+ * // …wallet signs `xdr`, after bounding it against `quote`…
464
+ * const payout = await client.offramp.createPayout({
465
+ * quote_id: quote.id,
466
+ * sender_wallet_address: 'G…',
467
+ * chain: 'stellar',
468
+ * signed_transaction: signedXdr,
469
+ * });
470
+ */
471
+ declare class OfframpManager {
472
+ readonly client: Client;
473
+ private readonly route;
474
+ constructor(client: Client);
475
+ private get rest();
476
+ /** Price a payout. Expires in about five minutes. */
477
+ quote(options: CreatePayoutQuoteOptions): Promise<PayoutQuoteData>;
478
+ /**
479
+ * Build the unsigned transfer for a Stellar or Solana payout.
480
+ *
481
+ * What comes back is built by the gateway, not by the caller: bound it against
482
+ * the quote the user confirmed before signing, or the amount that leaves is
483
+ * whatever the response says it is.
484
+ */
485
+ authorize(options: AuthorizePayoutOptions): Promise<AuthorizePayoutData>;
486
+ /** Create the payout from a quote, with the signed transfer attached. */
487
+ createPayout(options: CreatePayoutOptions): Promise<PayoutData>;
488
+ /** List this consumer's payouts (paginated). */
489
+ payouts(options?: ListPayoutsOptions): Promise<PayoutPage>;
490
+ /** One payout. Served from the local mirror, refreshed when stale. */
491
+ payout(id: string): Promise<PayoutData>;
492
+ /**
493
+ * Attach a compliance document to a payout — an invoice or proof of funds the
494
+ * rail asks for before it will settle.
495
+ */
496
+ attachDocument(id: string, options: AttachPayoutDocumentOptions): Promise<PayoutDocumentData>;
497
+ }
498
+
499
+ /** A page of events plus its pagination metadata. */
500
+ interface ActivityPage {
501
+ items: ActivityListData['data'];
502
+ total: number;
503
+ take: number;
504
+ skip: number;
505
+ }
506
+ /**
507
+ * The client event stream — `client.activity`.
508
+ *
509
+ * This is the trail the wallet, the dashboard and your own server write to: errors,
510
+ * screen views, timings, the operations they built. It exists because a console is
511
+ * not a trail — an extension popup's console dies with the popup and a phone's
512
+ * WebView console needs a cable — and because the failures worth having are the
513
+ * ones that never reach the API at all.
514
+ *
515
+ * Two rules the writers are expected to keep, and neither is enforceable here:
516
+ * report only what the user consented to, and never put memo text or anything that
517
+ * names a counterparty in `props`.
518
+ *
519
+ * @example
520
+ * await client.activity.report([
521
+ * { type: 'checkout.opened', source: 'server', level: 'info', eventId: crypto.randomUUID() },
522
+ * ]);
523
+ */
524
+ declare class ActivityManager {
525
+ readonly client: Client;
526
+ private readonly route;
527
+ constructor(client: Client);
528
+ private get rest();
529
+ /**
530
+ * Report a batch of events.
531
+ *
532
+ * Accepts the array directly or the full body. Give each event an `eventId`: the
533
+ * service de-duplicates on it, which is the difference between a retried batch
534
+ * and a double-counted one.
535
+ */
536
+ report(events: ActivityEventInput[] | ReportActivityOptions): Promise<ActivityReportData>;
537
+ /** Recent events for this consumer, newest first. */
538
+ events(options?: ListActivityOptions): Promise<ActivityPage>;
539
+ /** Counts, top event types, top errors and a daily series. */
540
+ summary(options?: {
541
+ days?: number;
542
+ source?: string;
543
+ }): Promise<ActivitySummaryData>;
544
+ }
545
+
546
+ /**
547
+ * A verified identity — the thing both ramps hang off.
548
+ *
549
+ * Everything a receiver owns is reachable from the instance
550
+ * (`receiver.addBankAccount(…)`, `receiver.wallets()`), because the alternative is
551
+ * carrying a receiver id and a manager reference side by side through a KYC flow
552
+ * that already has enough moving parts.
553
+ */
554
+ declare class Receiver extends Base<ReceiverData> {
555
+ blindpayId: string;
556
+ /** `individual` or `business`. */
557
+ type: string;
558
+ kycType: string | null;
559
+ /** Verification state, refreshed from upstream on every read. */
560
+ kycStatus: string | null;
561
+ email: string | null;
562
+ name: string | null;
563
+ country: string | null;
564
+ /** Your own id for this receiver, if you set one. */
565
+ externalId: string | null;
566
+ /** True when the receiver is cut off from both ramps. */
567
+ disabled: boolean;
568
+ /** How many times the submitted KYC data has been written. */
569
+ dossierVersion: number;
570
+ /** The version a reviewer approved, or null while unapproved. */
571
+ reviewedVersion: number | null;
572
+ createdAt: Date;
573
+ updatedAt: Date;
574
+ constructor(client: Client, data: ReceiverData);
575
+ protected _patch(data: ReceiverData): this;
576
+ /** True once verification has passed and the ramps will act on this receiver. */
577
+ get isApproved(): boolean;
578
+ /** Re-read this receiver, refreshing `kycStatus`, and patch it in place. */
579
+ fetch(): Promise<this>;
580
+ /** Update and patch in place. */
581
+ update(options: UpdateReceiverOptions): Promise<this>;
582
+ /** Delete this receiver. */
583
+ delete(): Promise<void>;
584
+ /**
585
+ * Approve it out of review (admin-only).
586
+ *
587
+ * Pinned to the dossier THIS instance holds: `expected_version` defaults to
588
+ * {@link Receiver.dossierVersion}, so approving a receiver that was edited since
589
+ * you read it is a `409 kyc_state_invalid` rather than a silent approval of data
590
+ * you never saw. Call {@link Receiver.fetch} and review again, or pass
591
+ * `expected_version` yourself — including `undefined`, which approves whatever
592
+ * is stored now.
593
+ */
594
+ approve(options?: ApproveReceiverOptions): Promise<ReceiverData>;
595
+ /** Ask for a terms-of-service link for this receiver. */
596
+ requestTos(options: RequestTosOptions): Promise<TermsOfServiceData>;
597
+ /** Enable it with an accepted terms-of-service id, and patch in place. */
598
+ enable(options: EnableReceiverOptions): Promise<this>;
599
+ /** Cut this receiver off from both ramps, or let it back in. */
600
+ setAccess(disabled: boolean): Promise<this>;
601
+ /** Register a blockchain wallet for this receiver. */
602
+ addWallet(options: CreateReceiverWalletOptions): Promise<ReceiverWalletData>;
603
+ /** This receiver's wallets. */
604
+ wallets(options?: ListKycOptions): Promise<ReceiverWalletPage>;
605
+ /** Add a fiat bank account — where an off-ramp pays out. */
606
+ addBankAccount(options: CreateBankAccountOptions): Promise<BankAccountData>;
607
+ /** This receiver's bank accounts. */
608
+ bankAccounts(options?: ListKycOptions): Promise<BankAccountPage>;
609
+ toJSON(): ReceiverData;
610
+ }
611
+
612
+ /** A page of receivers plus its pagination metadata. */
613
+ interface ReceiverPage {
614
+ items: Receiver[];
615
+ total: number;
616
+ take: number;
617
+ skip: number;
618
+ }
619
+ /** A page of a receiver's wallets. */
620
+ interface ReceiverWalletPage {
621
+ items: ReceiverWalletData[];
622
+ total: number;
623
+ take: number;
624
+ skip: number;
625
+ }
626
+ /** A page of a receiver's bank accounts. */
627
+ interface BankAccountPage {
628
+ items: BankAccountData[];
629
+ total: number;
630
+ take: number;
631
+ skip: number;
632
+ }
633
+ /**
634
+ * KYC / KYB — `client.kyc`.
635
+ *
636
+ * A receiver is the verified identity both ramps hang off: an on-ramp pays INTO
637
+ * one of its wallets, an off-ramp pays OUT to one of its bank accounts, and
638
+ * neither works until verification passes.
639
+ *
640
+ * The order is not obvious and the API will not guess it for you:
641
+ *
642
+ * 1. `termsOfService()` — the acceptance the provider requires up front, which
643
+ * returns a `tos_id`.
644
+ * 2. `upload()` each document, keeping the `file_url` it returns.
645
+ * 3. `createReceiver()` with those URLs and the `tos_id`.
646
+ * 4. `addWallet()` / `addBankAccount()` for where money should land.
647
+ * 5. verification runs; `fetchReceiver()` refreshes `kycStatus` from upstream.
648
+ *
649
+ * @example
650
+ * const tos = await client.kyc.termsOfService({ redirect_url: 'https://app/kyc/done' });
651
+ * const { file_url } = await client.kyc.upload(fileBase64);
652
+ * const receiver = await client.kyc.createReceiver({
653
+ * type: 'individual', kyc_type: 'standard', email: 'a@b.com', country: 'BR',
654
+ * id_doc_front_file: file_url, tos_id: tosId,
655
+ * });
656
+ */
657
+ declare class KycManager extends BaseManager<Receiver> {
658
+ private readonly route;
659
+ /** Create a receiver and start verification. */
660
+ createReceiver(options: CreateReceiverOptions): Promise<Receiver>;
661
+ /** List this consumer's receivers (paginated). */
662
+ receivers(options?: ListKycOptions): Promise<ReceiverPage>;
663
+ /** One receiver, materialized. Reading it refreshes `kycStatus` upstream. */
664
+ fetchReceiver(id: string): Promise<Receiver>;
665
+ /** The raw payload, so a {@link Receiver} can patch itself in place. */
666
+ fetchReceiverRaw(id: string): Promise<ReceiverData>;
667
+ /**
668
+ * Update a receiver — the same fields as creation, all optional. Once the receiver
669
+ * exists at the provider, identity fields need an elevated key; see
670
+ * {@link UpdateReceiverOptions}.
671
+ */
672
+ updateReceiver(id: string, options: UpdateReceiverOptions): Promise<Receiver>;
673
+ /** Delete a receiver. */
674
+ deleteReceiver(id: string): Promise<void>;
675
+ /**
676
+ * Approve a receiver sitting in review. Admin-only: it is the human gate on a
677
+ * verification the provider could not decide by itself.
678
+ */
679
+ approveReceiver(id: string, options?: ApproveReceiverOptions): Promise<ReceiverData>;
680
+ /**
681
+ * Ask for a terms-of-service link for an existing receiver. `channel: 'code'`
682
+ * returns the URL to render; `'email'` sends it to the receiver instead.
683
+ */
684
+ requestTos(id: string, options: RequestTosOptions): Promise<TermsOfServiceData>;
685
+ /** Enable an inactive receiver with an accepted terms-of-service id. */
686
+ enableReceiver(id: string, options: EnableReceiverOptions): Promise<Receiver>;
687
+ /**
688
+ * Cut a receiver off from both ramps, or let it back in. Admin-only, and the
689
+ * fastest lever there is when something is wrong with an account.
690
+ */
691
+ setReceiverAccess(id: string, options: SetReceiverAccessOptions): Promise<Receiver>;
692
+ /**
693
+ * The message a receiver must sign to prove it controls an address. Sign it,
694
+ * then pass the resulting transaction hash as `signature_tx_hash` to
695
+ * {@link addWallet}.
696
+ */
697
+ walletSignMessage(receiverId: string): Promise<WalletSignMessageData>;
698
+ /** Register a blockchain wallet for a receiver. */
699
+ addWallet(receiverId: string, options: CreateReceiverWalletOptions): Promise<ReceiverWalletData>;
700
+ /** A receiver's wallets (paginated). */
701
+ wallets(receiverId: string, options?: ListKycOptions): Promise<ReceiverWalletPage>;
702
+ /** Delete one of a receiver's wallets. */
703
+ deleteWallet(receiverId: string, id: string): Promise<void>;
704
+ /** Add a fiat bank account for a receiver — where an off-ramp pays out. */
705
+ addBankAccount(receiverId: string, options: CreateBankAccountOptions): Promise<BankAccountData>;
706
+ /** A receiver's bank accounts (paginated). */
707
+ bankAccounts(receiverId: string, options?: ListKycOptions): Promise<BankAccountPage>;
708
+ /** Delete one of a receiver's bank accounts. */
709
+ deleteBankAccount(receiverId: string, id: string): Promise<void>;
710
+ /**
711
+ * Upload a KYC document and get back the `file_url` every `*_file` field
712
+ * expects. Documents are uploaded first and referenced by URL — the receiver
713
+ * payload never carries bytes.
714
+ */
715
+ upload(file: unknown): Promise<KycUploadData>;
716
+ /**
717
+ * Start terms-of-service acceptance and get the hosted URL. This is the FIRST
718
+ * step of the flow: the provider will not create a receiver without the `tos_id`
719
+ * it produces.
720
+ */
721
+ termsOfService(options?: InitiateTosOptions): Promise<TermsOfServiceData>;
722
+ /** The bank rails available to this consumer. */
723
+ rails(): Promise<KycRailsData>;
724
+ /**
725
+ * The field schema a given rail requires. The authority on which of the ~70
726
+ * rail-specific bank-account fields to send — read it at runtime rather than
727
+ * hard-coding a rail's shape.
728
+ */
729
+ bankDetails(rail: string): Promise<BankDetailsData>;
730
+ protected get rest(): REST;
731
+ }
732
+
733
+ /**
734
+ * Pollar — social login and the custodial wallets behind it — `client.pollar`.
735
+ *
736
+ * The login is a three-legged flow, and the middle leg is the one that surprises
737
+ * people: the browser leaves for the provider and comes back to POLLAR, not to
738
+ * you, so a client cannot simply await a redirect. It polls instead.
739
+ *
740
+ * 1. `authorize()` → a `state` and the `authorization_url` to open.
741
+ * 2. `session(state)` until `status` is `authorized`, which carries a bridge `code`.
742
+ * 3. `token({ code, code_verifier })` → the session, its wallets and the profile.
743
+ *
744
+ * Use PKCE. The code travels through a redirect a client does not control, and the
745
+ * `code_verifier` is the only reason an intercepted one is worth nothing. With a
746
+ * `redirect_uri` it is not a choice: the service refuses that authorize without a
747
+ * `code_challenge` (`400 validation_failed`).
748
+ *
749
+ * The session only comes back to the account that owns the API key. Every tenant
750
+ * shares one Pollar application, so `token()` compares the email the login reports
751
+ * with the key's account email and refuses a login someone else completed with
752
+ * `403 pollar_identity_mismatch` — the session is revoked, never returned. A key
753
+ * whose account has no verified email gets `403 pollar_identity_required` at
754
+ * `authorize()`.
755
+ *
756
+ * The two callback routes (`/oauth/callback…`) are deliberately absent from this
757
+ * manager: they are where a BROWSER lands, not something a server calls. Polling
758
+ * `session()` is the programmatic half of the same step.
759
+ *
760
+ * @example
761
+ * const { state, authorization_url } = await client.pollar.authorize({
762
+ * provider: 'google',
763
+ * code_challenge: challenge,
764
+ * code_challenge_method: 'S256',
765
+ * });
766
+ * // open `authorization_url`, then poll:
767
+ * const polled = await client.pollar.session(state);
768
+ * if (polled.status === 'authorized') {
769
+ * const session = await client.pollar.token({ code: polled.code, code_verifier: verifier });
770
+ * }
771
+ */
772
+ declare class PollarManager {
773
+ readonly client: Client;
774
+ private readonly route;
775
+ constructor(client: Client);
776
+ private get rest();
777
+ /** Start a login and get the URL to send the user to. */
778
+ authorize(options: PollarAuthorizeOptions): Promise<PollarAuthorizeData>;
779
+ /**
780
+ * Poll a login. `status: 'authorized'` carries the bridge `code` to redeem;
781
+ * `pending` means keep waiting; anything else is over.
782
+ */
783
+ session(state: string): Promise<PollarLoginSessionData>;
784
+ /** Redeem the bridge code for a session. Single use — a consumed code is dead. */
785
+ token(options: PollarTokenOptions): Promise<PollarSessionData>;
786
+ /**
787
+ * Rotate the token pair. The old refresh token stops working, so store what
788
+ * comes back before using it — a rotation you lose is a session you lose.
789
+ */
790
+ refresh(options: PollarRefreshOptions): Promise<PollarRefreshData>;
791
+ /** Revoke a session — this device, or every one of them. */
792
+ logout(options: PollarLogoutOptions): Promise<PollarLogoutData>;
793
+ /** Validate an end-user access token and learn whose it is. */
794
+ verifyToken(options: VerifyPollarTokenOptions): Promise<PollarTokenVerificationData>;
795
+ /**
796
+ * Fund a wallet's XLM base reserve. A Stellar account does not exist until
797
+ * something pays for it, which is why a fresh Pollar wallet can have an address
798
+ * and still not be on the network.
799
+ */
800
+ activateWallet(options: ActivatePollarWalletOptions): Promise<PollarActivationData>;
801
+ /** Enable the application's configured assets on a wallet. */
802
+ addDefaultTrustlines(address: string): Promise<PollarTrustlineData>;
803
+ /** Enable specific assets on a wallet. */
804
+ addTrustlines(address: string, options: PollarTrustlinesOptions): Promise<PollarTrustlineData>;
805
+ /**
806
+ * Remove a trustline. An asset is `(code, issuer)`, and both are in the path for
807
+ * that reason: a bare code names no asset.
808
+ */
809
+ removeTrustline(address: string, code: string, issuer: string): Promise<PollarTrustlineData>;
810
+ /**
811
+ * Register a user with Pollar ahead of their first login. Needs an elevated
812
+ * (admin) key: the Pollar user directory is shared by every tenant, so a tenant
813
+ * key gets `403 elevated_key_required`.
814
+ */
815
+ registerUser(options: RegisterPollarUserOptions): Promise<PollarUserData>;
816
+ /**
817
+ * Register a user AND provision their Stellar wallet in one call — the variant
818
+ * to use when the user should be able to receive before they ever log in. Needs
819
+ * an elevated (admin) key, like {@link registerUser}.
820
+ */
821
+ registerUserWithWallet(options: RegisterPollarUserOptions): Promise<PollarUserData>;
822
+ }
823
+
224
824
  /**
225
825
  * A Stellar SEP-7 payment intent.
226
826
  *
@@ -814,7 +1414,7 @@ interface Client {
814
1414
  */
815
1415
  declare class Client extends EventEmitter {
816
1416
  /** Library version. */
817
- static readonly version = "1.2.0";
1417
+ static readonly version = "2.0.0";
818
1418
  /**
819
1419
  * Process-wide shared defaults maintained by Cosmos Pay (gateway URL, version,
820
1420
  * internal secrets). Mutate once at startup to change them for every client
@@ -835,6 +1435,18 @@ declare class Client extends EventEmitter {
835
1435
  readonly products: ProductManager;
836
1436
  /** Stellar swaps — quote/create/fetch/list/submit. */
837
1437
  readonly swaps: SwapManager;
1438
+ /** Liquidity pools: browse, positions, deposit / withdraw. */
1439
+ readonly liquidity: LiquidityManager;
1440
+ /** Fiat -> stablecoin: quotes, payins, trustlines, virtual accounts. */
1441
+ readonly onramp: OnrampManager;
1442
+ /** Stablecoin -> fiat: quotes, authorize, payouts, compliance documents. */
1443
+ readonly offramp: OfframpManager;
1444
+ /** The client event stream: report events, read them back, summarize. */
1445
+ readonly activity: ActivityManager;
1446
+ /** KYC / KYB: receivers, their wallets and their bank accounts. */
1447
+ readonly kyc: KycManager;
1448
+ /** Pollar: social login, its sessions, and the custodial wallets behind them. */
1449
+ readonly pollar: PollarManager;
838
1450
  /** Customers. */
839
1451
  readonly customers: CustomerManager;
840
1452
  /** Read-only analytics (summary, balances, logs). */
@@ -905,7 +1517,7 @@ declare const Webhooks: {
905
1517
  };
906
1518
 
907
1519
  /** Library version, kept in sync with package.json. */
908
- declare const version = "1.2.0";
1520
+ declare const version = "2.0.0";
909
1521
  /**
910
1522
  * Default base URL of the Cosmos Pay gateway. Maintained by Cosmos Pay — users
911
1523
  * never need to set this; it's part of the {@link shared} configuration. Override
@@ -937,4 +1549,4 @@ declare const Events: {
937
1549
  };
938
1550
  type ClientEvent = (typeof Events)[keyof typeof Events];
939
1551
 
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 };
1552
+ export { ActivatePollarWalletOptions, ActivityEventInput, ActivityListData, ActivityManager, type ActivityPage, ActivityReportData, ActivitySummaryData, AnalyticsBalancesData, AnalyticsManager, AnalyticsSummaryData, ApiLogsData, ApproveReceiverOptions, AttachPayoutDocumentOptions, AuthorizePayoutData, AuthorizePayoutOptions, BankAccountData, type BankAccountPage, BankDetailsData, Base, BaseManager, BrowseLiquidityPoolsOptions, Client, type ClientEvent, type ClientEvents, type ClientOptions, CreateBankAccountOptions, CreateCustomerOptions, CreatePayPaymentIntentOptions, CreatePayinOptions, CreatePayinQuoteOptions, CreatePayoutOptions, CreatePayoutQuoteOptions, CreateProductOptions, CreateReceiverOptions, CreateReceiverWalletOptions, CreateSwapOptions, CreateTrustlineOptions, CreateTxPaymentIntentOptions, CreateVirtualAccountOptions, CreateWebhookEndpointOptions, Customer, CustomerData, CustomerManager, DEFAULT_BASE_URL, DEFAULT_RETRIES, DEFAULT_TIMEOUT, DEFAULT_VERSION, DeletedData, DepositLiquidityOptions, EnableReceiverOptions, Events, type FetchLike, HealthCheckData, HealthManager, InitiateTosOptions, KycManager, KycRailsData, KycUploadData, LiquidityManager, LiquidityOperation, LiquidityOperationData, LiquidityOperationKind, type LiquidityOperationPage, LiquidityOperationStatus, LiquidityPoolData, type LiquidityPoolPage, LiquidityPositionsData, type LiquiditySubmitOutcome, ListActivityOptions, ListKycOptions, ListLiquidityOperationsOptions, ListPayinsOptions, ListPaymentIntentsOptions, ListPayoutsOptions, ListSwapsOptions, ListWebhookDeliveriesOptions, OfframpManager, OnrampManager, PayinData, type PayinPage, PayinQuoteData, PaymentIntent, PaymentIntentData, PaymentIntentKind, PaymentIntentManager, type PaymentIntentPage, PaymentIntentStatus, PayoutData, PayoutDocumentData, type PayoutPage, PayoutQuoteData, PollarActivationData, PollarAuthorizeData, PollarAuthorizeOptions, PollarLoginSessionData, PollarLogoutData, PollarLogoutOptions, PollarManager, PollarRefreshData, PollarRefreshOptions, PollarSessionData, PollarTokenOptions, PollarTokenVerificationData, PollarTrustlineData, PollarTrustlinesOptions, PollarUserData, Product, ProductData, ProductKind, ProductManager, QuoteSwapOptions, REST, type RESTOptions, Receiver, ReceiverData, type ReceiverPage, ReceiverWalletData, type ReceiverWalletPage, RegisterPollarUserOptions, ReportActivityOptions, type RequestOptions, RequestTosOptions, SIGNATURE_HEADER, SetReceiverAccessOptions, type SharedConfig, SubmitLiquidityOptions, SubmitSwapOptions, Swap, SwapData, SwapManager, type SwapPage, SwapQuoteData, SwapStatus, type SwapSubmitOutcome, TermsOfServiceData, TrustlineData, UpdateCustomerOptions, UpdatePaymentIntentOptions, UpdateProductOptions, UpdateReceiverOptions, UpdateWebhookEndpointOptions, ValidatePaymentIntentOptions, type ValidationOutcome, ValidationOutcomeData, VerifyPollarTokenOptions, type VerifyWebhookOptions, VirtualAccountData, WalletSignMessageData, WebhookDelivery, WebhookDeliveryData, type WebhookDeliveryPage, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointData, WebhookEndpointWithSecretData, WebhookEvent, WebhookEventType, type WebhookHandlerOptions, type WebhookListenerEvents, WebhookLogsData, WebhookManager, WebhookPingData, type WebhookProcessOptions, WebhookSignatureError, Webhooks, WithdrawLiquidityOptions, resolveShared, shared, version };