@cosmosapp/pay_sdk 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to @cosmosapp/pay_sdk are documented here.
4
4
  Generated from [Conventional Commits](https://www.conventionalcommits.org) by [git-cliff](https://git-cliff.org).
5
+ ## [2.3.0] - 2026-11-02
6
+
7
+ ### Features
8
+ - Wrap private payments, USDT0, customer wallets and the activity series (349fd34)
9
+
10
+ ### Bug Fixes
11
+ - Keep the payment stats a customer list carries (1c719c6)
12
+ - Path ids are one encoded segment; sync the spec with server v1.8.6 (af03889)
13
+
14
+ ### Documentation
15
+ - Document private payments, USDT0, customer wallets and the series (a2208c7)
16
+
17
+ ## [2.2.1] - 2026-11-01
18
+
19
+ ### Bug Fixes
20
+ - Describe payment links on all three chains (c6430ba)
21
+
5
22
  ## [2.2.0] - 2026-11-01
6
23
 
7
24
  ### Features
package/README.md CHANGED
@@ -81,6 +81,8 @@ console.log(`Paid via ${wallet} from ${account}: ${txHash}`);
81
81
  - [Payment intents](#-payment-intents)
82
82
  - [Typed assets, wallets & addresses](#-typed-assets-wallets--addresses)
83
83
  - [Swaps](#-swaps)
84
+ - [USDT0 (Stellar to EVM networks)](#-usdt0-stellar-to-evm-networks)
85
+ - [Private payments](#-private-payments)
84
86
  - [Webhooks](#-webhooks)
85
87
  - [Products & customers](#-products--customers)
86
88
  - [Analytics & health](#-analytics--health)
@@ -188,13 +190,15 @@ if (outcome.valid) console.log('Settled!', outcome.status);
188
190
  | `client.paymentIntents` | Stellar SEP-7 payment intents | `createTx` · `createPay` · `fetch` · `list` · `update` · `delete` · `validate` |
189
191
  | `client.webhooks` | Webhook endpoints + deliveries | `create` · `list` · `fetch` · `rotateSecret` · `ping` · `on(...)` · `process` |
190
192
  | `client.products` | Products / prices | `create` · `list` · `fetch` · `update` · `delete` |
191
- | `client.customers` | Customers | `create` · `list` · `fetch` · `update` · `delete` |
193
+ | `client.customers` | Customers and their wallets | `create` · `list` · `fetch` · `update` · `delete` · `addWallet` · `removeWallet` |
192
194
  | `client.swaps` | Same-chain swaps (Stellar DEX, Jupiter, Kuru Flow) | `quote` · `create` · `fetch` · `list` · `submit` |
193
195
  | `client.crossChainSwaps` | Swaps between chains (NEAR Intents) | `assets` · `quote` · `create` · `fetch` · `list` · `reportDeposit` |
196
+ | `client.usdt0` | USDT0 from Stellar to EVM networks (LayerZero, mainnet only) | `routes` · `quote` · `create` · `list` · `fetch` · `submit` |
197
+ | `client.privatePayments` | Private payments, amounts hidden on-chain (Stellar Testnet for now) | `create` · `list` · `fetch` · `config` |
194
198
  | `client.plugins` | Plugins the deployment serves | `list` · `fetch` · `install` · `uninstall` · `query` · `command` |
195
199
  | `client.defindex` | DeFindex vaults (native plugin) | `vaults` · `vault` · `balance` · `deposit` · `withdraw` · `submit` |
196
200
  | `client.publicKey` | The shared public API key | `fetch` |
197
- | `client.analytics` | Read-only metrics & logs | `summary` · `balances` · `apiLogs` · `webhookLogs` |
201
+ | `client.analytics` | Read-only metrics & logs | `summary` · `series` · `balances` · `apiLogs` · `webhookLogs` |
198
202
  | `client.health` | Liveness / readiness probes | `liveness` · `readiness` |
199
203
 
200
204
  ## 🌐 Web client (browser wallets)
@@ -509,6 +513,57 @@ Keep `x.quoteSignature`: it is NEAR Intents' signature over the quote, what
509
513
  settles a dispute. Webhooks: `SWAP_*` for both same-chain managers,
510
514
  `CROSS_CHAIN_SWAP_*` here — `client.webhooks.on('crossChainSwapSucceeded', …)`.
511
515
 
516
+ ## 🪙 USDT0 (Stellar to EVM networks)
517
+
518
+ `client.usdt0` sends USDT0, Tether's omnichain USDT, from Stellar to an EVM network
519
+ through LayerZero's OFT: Ethereum (`eth`) receives native USDT, every other network
520
+ receives USDT0. Signing works like a swap: the API builds the one Soroban
521
+ transaction, the account that holds the USDT0 signs it, and `submit` relays the
522
+ signed XDR. The holder pays LayerZero's fee and the network fee in XLM. Mainnet
523
+ only: a `dev` key gets `available: false` from `routes()` and
524
+ `400 network_unsupported` from `quote()` and `create()`.
525
+
526
+ ```ts
527
+ const { routes } = await client.usdt0.routes(); // [{ chain: 'eth', name, eid, receives }, ...]
528
+ const quote = await client.usdt0.quote({ to: 'arb', amount: '12.5' }); // persists nothing
529
+
530
+ const transfer = await client.usdt0.create({
531
+ source: 'G...', to: 'arb', recipient: '0x5aAe...', amount: '12.5',
532
+ });
533
+ // sign transfer.xdr with the holder's wallet (or open the SEP-7 link transfer.uri)
534
+ await transfer.submit({ signedXdr });
535
+ await transfer.fetch(); // PENDING -> SUBMITTED -> DELIVERED (about 27 minutes), or FAILED / EXPIRED
536
+
537
+ const page = await client.usdt0.list({ status: 'DELIVERED' }); // Usdt0Transfer[]
538
+ ```
539
+
540
+ The OFT carries 6 decimals, so a 7th decimal of `amount` is `dust` that stays in the
541
+ account. See [`llms/17-usdt0.md`](./llms/17-usdt0.md) for the fees, the shared public
542
+ key's `publicToken` and every field.
543
+
544
+ ## 🔒 Private payments
545
+
546
+ `client.privatePayments` creates and reads payments whose amount is hidden on-chain:
547
+ priced in XLM and paid with confidential transfers on Cosmos Pay's confidential token.
548
+ They run on **Stellar Testnet only for now** and cost a **0.18% commission per
549
+ payment**, taken from `amount` (`amount` = `netAmount` + `feeAmount`). The
550
+ recipient must already hold a confidential account on the token
551
+ (`400 recipient_not_registered` otherwise). The payer completes the payment in the
552
+ private checkout, which proves the confidential transfers in their browser.
553
+
554
+ ```ts
555
+ const payment = await client.privatePayments.create({
556
+ amount: '25.5', recipient: 'G...', description: 'Order #24',
557
+ });
558
+ await payment.fetch(); // payment.status: PENDING -> SUCCEEDED (or EXPIRED)
559
+
560
+ const page = await client.privatePayments.list({ status: 'SUCCEEDED' }); // PrivatePayment[]
561
+ const config = await client.privatePayments.config(); // the token, registries, auditor id, feeBps, fee account
562
+ ```
563
+
564
+ See [`llms/16-private-payments.md`](./llms/16-private-payments.md) for merchant fees,
565
+ expiry and every field.
566
+
512
567
  ## 🔔 Webhooks
513
568
 
514
569
  ```ts
@@ -622,9 +677,11 @@ await product.deactivate();
622
677
  const customer = await client.customers.create({
623
678
  name: 'Acme Inc.',
624
679
  email: 'billing@acme.com',
625
- account: 'G...',
680
+ wallets: [{ chain: 'stellar', address: 'G...' }], // up to 20, on Stellar, Solana or Monad
626
681
  });
627
682
  await customer.edit({ note: 'VIP, net-30' });
683
+ const wallet = await customer.addWallet({ chain: 'solana', address: '7EcD...', label: 'Phantom' });
684
+ await customer.removeWallet(wallet); // or client.customers.removeWallet(customer.id, wallet.id)
628
685
  const customers = await client.customers.list(); // includes payment stats
629
686
  ```
630
687
 
@@ -633,6 +690,7 @@ const customers = await client.customers.list(); // includes payment stats
633
690
  ```ts
634
691
  const summary = await client.analytics.summary(); // totals, volume, webhook health, 30-day series
635
692
  const balances = await client.analytics.balances(); // settled + pending per asset
693
+ const series = await client.analytics.series({ period: 'week' }); // day | week | month | year, with the window before
636
694
  const apiLogs = await client.analytics.apiLogs();
637
695
  const hookLogs = await client.analytics.webhookLogs();
638
696
 
@@ -145,7 +145,7 @@ function resolveIntentBody(options, book = addresses) {
145
145
  }
146
146
 
147
147
  // src/util/Constants.ts
148
- var version = "2.2.0";
148
+ var version = "2.3.0";
149
149
  var DEFAULT_BASE_URL = "https://api.cosmospay.lat/cosmos-api";
150
150
  var DEFAULT_VERSION = "v1";
151
151
  var DEFAULT_TIMEOUT = 3e4;
@@ -214,5 +214,5 @@ var Wallets = {
214
214
  };
215
215
 
216
216
  export { AddressBook, Assets, CosmosPayAPIError, CosmosPayRequestError, DEFAULT_BASE_URL, DEFAULT_RETRIES, DEFAULT_TIMEOUT, DEFAULT_VERSION, Events, SIGNATURE_HEADER, TestnetAssets, Wallets, addresses, assertAddress, defineAsset, isAddress, isContractAddress, isMuxedAddress, isNativeAsset, isStellarAddress, resolveAddress, resolveAsset, resolveIntentBody, version };
217
- //# sourceMappingURL=chunk-AQEHMCJZ.js.map
218
- //# sourceMappingURL=chunk-AQEHMCJZ.js.map
217
+ //# sourceMappingURL=chunk-FTHQKUE5.js.map
218
+ //# sourceMappingURL=chunk-FTHQKUE5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/addresses.ts","../src/common/assets.ts","../src/common/intent-input.ts","../src/util/Constants.ts","../src/errors/CosmosPayError.ts","../src/common/wallets.ts"],"names":[],"mappings":";AAWA,IAAM,SAAA,GAAY,iBAAA;AAClB,IAAM,SAAA,GAAY,iBAAA;AAClB,IAAM,SAAA,GAAY,iBAAA;AAGX,SAAS,iBAAiB,KAAA,EAAiC;AAChE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,eAAe,KAAA,EAAiC;AAC9D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,kBAAkB,KAAA,EAAiC;AACjE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,UAAU,KAAA,EAAiC;AACzD,EAAA,OAAO,iBAAiB,KAAK,CAAA,IAAK,eAAe,KAAK,CAAA,IAAK,kBAAkB,KAAK,CAAA;AACpF;AAGO,SAAS,aAAA,CAAc,KAAA,EAAgB,KAAA,GAAQ,SAAA,EAAmB;AACvE,EAAA,IAAI,CAAC,SAAA,CAAU,KAAK,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,UAAU,CAAA,gBAAA,EAAmB,KAAK,KAAK,MAAA,CAAO,KAAK,CAAC,CAAA,CAAE,CAAA;AAAA,EAClE;AACA,EAAA,OAAO,KAAA;AACT;AAWO,IAAM,cAAN,MAAkB;AAAA,EAGvB,WAAA,CAAY,OAAA,GAAkC,EAAC,EAAG;AAFlD,IAAA,IAAA,CAAiB,OAAA,uBAAc,GAAA,EAAoB;AAGjD,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AAMO,IAAM,qBAAA,GAAN,MAAM,sBAAA,SAA8B,KAAA,CAAM;AAAA,EAK/C,YAAY,OAAA,EAA0D;AACpE,IAAA,MAAM,MAAA,GACJ,QAAQ,KAAA,YAAiB,KAAA,GAAQ,QAAQ,KAAA,CAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA;AAC/E,IAAA,KAAA,CAAM,CAAA,WAAA,EAAc,QAAQ,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,CAAA,SAAA,EAAY,MAAM,CAAA,CAAE,CAAA;AACrE,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AACZ,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,MAAA;AACtB,IAAA,IAAA,CAAK,MAAM,OAAA,CAAQ,GAAA;AACnB,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,KAAA;AACrB,IAAA,KAAA,CAAM,iBAAA,GAAoB,MAAM,sBAAqB,CAAA;AAAA,EACvD;AACF;;;ACpEO,IAAM,OAAA,GAAU;AAAA;AAAA,EAErB,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,WAAA;AAAA,EACX,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV","file":"chunk-AQEHMCJZ.js","sourcesContent":["/**\n * Stellar address helpers + a tiny named-address book.\n *\n * So integrators don't have to sprinkle raw `G...` strings everywhere (and risk\n * typos), they can name the accounts they care about once and reference them by\n * name. A plain address string always keeps working — `resolveAddress` only\n * substitutes registered names and otherwise passes the value straight through.\n */\n\n// Stellar strkeys are base32 (RFC 4648 alphabet, no padding). These checks are\n// length/prefix sanity checks, not full checksum validation.\nconst G_ADDRESS = /^G[A-Z2-7]{55}$/; // ed25519 public key (account)\nconst M_ADDRESS = /^M[A-Z2-7]{68}$/; // muxed account\nconst C_ADDRESS = /^C[A-Z2-7]{55}$/; // contract id\n\n/** Whether a value looks like a Stellar account address (`G…`). */\nexport function isStellarAddress(value: unknown): value is string {\n return typeof value === 'string' && G_ADDRESS.test(value);\n}\n\n/** Whether a value looks like a muxed account address (`M…`). */\nexport function isMuxedAddress(value: unknown): value is string {\n return typeof value === 'string' && M_ADDRESS.test(value);\n}\n\n/** Whether a value looks like a Soroban contract id (`C…`). */\nexport function isContractAddress(value: unknown): value is string {\n return typeof value === 'string' && C_ADDRESS.test(value);\n}\n\n/** Whether a value is any kind of Stellar address (account, muxed or contract). */\nexport function isAddress(value: unknown): value is string {\n return isStellarAddress(value) || isMuxedAddress(value) || isContractAddress(value);\n}\n\n/** Throw unless `value` is a valid Stellar account/muxed/contract address. */\nexport function assertAddress(value: unknown, label = 'address'): string {\n if (!isAddress(value)) {\n throw new TypeError(`Invalid Stellar ${label}: ${String(value)}`);\n }\n return value;\n}\n\n/**\n * A registry of named Stellar addresses. Register the accounts you use a lot —\n * your merchant payout account, a treasury, frequent counterparties — and refer\n * to them by name anywhere an address is accepted.\n *\n * @example\n * addresses.define('merchant', 'GC...');\n * await client.paymentIntents.createPay({ destination: 'merchant', amount: '10' });\n */\nexport class AddressBook {\n private readonly entries = new Map<string, string>();\n\n constructor(initial: Record<string, string> = {}) {\n for (const [name, address] of Object.entries(initial)) {\n this.define(name, address);\n }\n }\n\n /** Register (or overwrite) a named address. The address is validated. */\n public define(name: string, address: string): this {\n this.entries.set(name, assertAddress(address, `address for \"${name}\"`));\n return this;\n }\n\n /** Whether a name is registered. */\n public has(name: string): boolean {\n return this.entries.has(name);\n }\n\n /** Look up a registered address by name. */\n public get(name: string): string | undefined {\n return this.entries.get(name);\n }\n\n /** Remove a named address. */\n public delete(name: string): boolean {\n return this.entries.delete(name);\n }\n\n /** All registered names. */\n public names(): string[] {\n return [...this.entries.keys()];\n }\n\n /**\n * Resolve a reference to a concrete address: a registered name is substituted,\n * any other string is returned unchanged (so raw `G…`, muxed `M…`, federation\n * `name*domain`, etc. all keep working).\n */\n public resolve(ref: string): string {\n return this.entries.get(ref) ?? ref;\n }\n}\n\n/** Process-wide default address book. Use `addresses.define(...)` to populate it. */\nexport const addresses = new AddressBook();\n\n/** Anything accepted where an address is expected: a raw address or a name in a book. */\nexport type AddressRef = string;\n\n/**\n * Resolve an {@link AddressRef} using the given book (the shared {@link addresses}\n * by default). Lenient: unknown strings pass through unchanged.\n */\nexport function resolveAddress(ref: AddressRef, book: AddressBook = addresses): string {\n return book.resolve(ref);\n}\n","/**\n * A typed, extensible catalog of Stellar assets.\n *\n * Instead of hunting down an asset's issuer (or pasting the wrong one), use the\n * built-in catalog — `Assets.USDC`, `Assets.EURC`, `Assets.XLM` — which carries\n * the verified issuer for you. Need something else? `defineAsset(...)` makes a\n * typed asset you can reuse. And a plain code string still works everywhere.\n *\n * ⚠️ Issuers are network-specific. The {@link Assets} catalog targets **mainnet**;\n * {@link TestnetAssets} carries the testnet issuers. Bare code strings (e.g.\n * `'USDC'`) are treated as *code only* (no issuer) for backwards compatibility —\n * use the catalog object or `defineAsset` when you want the issuer filled in.\n */\n\nimport { isStellarAddress } from '@/common/addresses';\n\n/** A fully-described Stellar asset. */\nexport interface AssetDefinition {\n /** Asset code, e.g. `USDC`. Use `XLM` (or omit the issuer) for native lumens. */\n code: string;\n /** Issuer account (`G…`). `null`/omitted means the native asset (XLM). */\n issuer?: string | null;\n /** Optional Soroban contract id (`C…`) for the SAC / token contract. */\n contract?: string;\n /** Human-readable name. */\n name?: string;\n /** Network the `issuer` is valid on. */\n network?: 'public' | 'testnet';\n}\n\n/** Anything accepted where an asset is expected: a code string or a definition. */\nexport type AssetRef = string | AssetDefinition;\n\n/** Normalized asset: a code plus a concrete issuer (or `null` for native). */\nexport interface ResolvedAsset {\n /** `XLM` for the native asset, otherwise the asset code. */\n code: string;\n /** Issuer `G…`, or `null` for the native asset. */\n issuer: string | null;\n /** Optional Soroban contract id. */\n contract?: string;\n}\n\nconst NATIVE: AssetDefinition = { code: 'XLM', issuer: null, name: 'Stellar Lumens' };\n\n/**\n * Built-in **mainnet** assets with verified issuers. Extend with your own via\n * {@link defineAsset}. Issuers sourced from the official issuers (Circle for\n * USDC/EURC).\n */\nexport const Assets = {\n /** Native lumens. */\n XLM: NATIVE,\n /** USD Coin by Circle (mainnet). */\n USDC: {\n code: 'USDC',\n issuer: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',\n name: 'USD Coin',\n network: 'public',\n },\n /** Euro Coin by Circle (mainnet). */\n EURC: {\n code: 'EURC',\n issuer: 'GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2',\n name: 'Euro Coin',\n network: 'public',\n },\n} as const satisfies Record<string, AssetDefinition>;\n\n/** Built-in **testnet** assets (Circle's Test SDF Network issuers). */\nexport const TestnetAssets = {\n XLM: NATIVE,\n USDC: {\n code: 'USDC',\n issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',\n name: 'USD Coin',\n network: 'testnet',\n },\n EURC: {\n code: 'EURC',\n issuer: 'GB3Q6QDZYTHWT7E5PVS3W7FUT5GVAFC5KSZFFLPU25GO7VTC3NM2ZTVO',\n name: 'Euro Coin',\n network: 'testnet',\n },\n} as const satisfies Record<string, AssetDefinition>;\n\n/** Whether a reference denotes the native asset (XLM). */\nexport function isNativeAsset(ref: AssetRef): boolean {\n if (typeof ref === 'string') {\n const code = ref.trim().toLowerCase();\n return code === '' || code === 'xlm' || code === 'native';\n }\n return !ref.issuer || isNativeAsset(ref.code);\n}\n\n/**\n * Create a reusable, typed custom asset. Validates the issuer/contract format so\n * a typo surfaces immediately rather than on-chain.\n *\n * @example\n * const AQUA = defineAsset({ code: 'AQUA', issuer: 'GBNZ...', name: 'Aquarius' });\n * await client.paymentIntents.createPay({ destination, amount: '5', asset: AQUA });\n */\nexport function defineAsset(def: AssetDefinition): AssetDefinition {\n if (!def.code) throw new TypeError('defineAsset requires a `code`.');\n if (def.issuer != null && !isStellarAddress(def.issuer)) {\n throw new TypeError(`defineAsset: invalid issuer for ${def.code}: ${def.issuer}`);\n }\n if (def.contract != null && !/^C[A-Z2-7]{55}$/.test(def.contract)) {\n throw new TypeError(`defineAsset: invalid contract for ${def.code}: ${def.contract}`);\n }\n return Object.freeze({ ...def });\n}\n\n/**\n * Normalize an {@link AssetRef} into `{ code, issuer, contract }`.\n *\n * - A bare string is treated as *code only* (`issuer: null`) — pass a catalog\n * object or `defineAsset(...)` result when you want the issuer included.\n * - The native asset normalizes to `{ code: 'XLM', issuer: null }`.\n */\nexport function resolveAsset(ref: AssetRef): ResolvedAsset {\n if (isNativeAsset(ref)) return { code: 'XLM', issuer: null };\n if (typeof ref === 'string') return { code: ref, issuer: null };\n return {\n code: ref.code,\n issuer: ref.issuer ?? null,\n ...(ref.contract ? { contract: ref.contract } : {}),\n };\n}\n","/**\n * Shared resolution of \"create intent\" input, used by both the server SDK and\n * the web client so the convenience layers behave identically: a typed\n * {@link AssetRef} (e.g. `Assets.USDC`) is expanded into `assetCode`/`assetIssuer`,\n * and named addresses are substituted via an {@link AddressBook}.\n */\n\nimport { addresses as defaultBook, AddressBook, resolveAddress } from '@/common/addresses';\nimport { resolveAsset, type AssetRef } from '@/common/assets';\n\n/** Fields the resolver understands (everything else passes through untouched). */\nexport interface ResolvableIntentInput {\n destination?: string;\n source?: string;\n /** Typed asset (`Assets.USDC`, `defineAsset(...)`) — fills code + issuer. */\n asset?: AssetRef;\n assetCode?: string;\n assetIssuer?: string;\n}\n\n/**\n * Expand `asset` into `assetCode`/`assetIssuer` and resolve named\n * `destination`/`source` addresses. Existing `assetCode`/`assetIssuer` win over a\n * provided `asset`; native assets leave the code unset (the API treats an omitted\n * asset as native XLM). Returns a new object — the input is not mutated.\n */\nexport function resolveIntentBody<T extends ResolvableIntentInput>(\n options: T,\n book: AddressBook = defaultBook,\n): Omit<T, 'asset'> {\n const out: Record<string, unknown> = { ...(options as Record<string, unknown>) };\n\n if (typeof out['destination'] === 'string') {\n out['destination'] = resolveAddress(out['destination'], book);\n }\n if (typeof out['source'] === 'string') {\n out['source'] = resolveAddress(out['source'], book);\n }\n\n if (out['asset'] != null) {\n const { code, issuer } = resolveAsset(out['asset'] as AssetRef);\n delete out['asset'];\n if (issuer) {\n // Non-native: fill code + issuer unless the caller set them explicitly.\n out['assetCode'] ??= code;\n out['assetIssuer'] ??= issuer;\n }\n // Native (issuer == null) → leave assetCode/assetIssuer omitted = native XLM.\n }\n\n return out as Omit<T, 'asset'>;\n}\n","/** Library version, kept in sync with package.json. */\nexport const version = '2.2.0';\n\n/**\n * Default base URL of the Cosmos Pay gateway. Maintained by Cosmos Pay — users\n * never need to set this; it's part of the {@link shared} configuration. Override\n * only when self-hosting or pointing at a staging gateway.\n *\n * This is the public APISIX gateway: requests under `/cosmos-api/*` are\n * authenticated (API key) and proxied to the Payments API. The version segment\n * (`/v1`, see {@link DEFAULT_VERSION}) is appended by the REST layer, producing\n * e.g. `https://api.cosmospay.lat/cosmos-api/v1/payment-intents/pay`.\n */\nexport const DEFAULT_BASE_URL = 'https://api.cosmospay.lat/cosmos-api';\n\n/** Default API version segment prefixed to every route (`/v1/...`). */\nexport const DEFAULT_VERSION = 'v1';\n\n/** Default request timeout in milliseconds. */\nexport const DEFAULT_TIMEOUT = 30_000;\n\n/** Default number of retries for transient failures (network / 429 / 5xx). */\nexport const DEFAULT_RETRIES = 2;\n\n/** Default HMAC signature header sent by the Cosmos Pay webhook dispatcher. */\nexport const SIGNATURE_HEADER = 'x-cosmos-signature';\n\n/**\n * Client debug/telemetry events. The {@link Client} extends EventEmitter and\n * emits these for observability (`debug`/`rateLimit`-style events).\n */\nexport const Events = {\n Debug: 'debug',\n Request: 'request',\n Response: 'response',\n RateLimited: 'rateLimited',\n} as const;\nexport type ClientEvent = (typeof Events)[keyof typeof Events];\n","/**\n * Error thrown when the Cosmos Pay API responds with a non-2xx status.\n *\n * Carries the HTTP status, the parsed response body and the request context so\n * callers can branch on `error.status` (e.g. 404 → not found, 403 → gateway).\n */\nexport class CosmosPayAPIError extends Error {\n /** HTTP status code returned by the API. */\n public readonly status: number;\n /** HTTP method of the failed request. */\n public readonly method: string;\n /** Absolute URL of the failed request. */\n public readonly url: string;\n /** Parsed response body (object when JSON, string otherwise, or null). */\n public readonly body: unknown;\n /** Machine-readable error code extracted from the body when present. */\n public readonly code: string | undefined;\n\n constructor(options: {\n status: number;\n method: string;\n url: string;\n body: unknown;\n }) {\n const message = CosmosPayAPIError.resolveMessage(options.status, options.body);\n super(message);\n this.name = 'CosmosPayAPIError';\n this.status = options.status;\n this.method = options.method;\n this.url = options.url;\n this.body = options.body;\n this.code = CosmosPayAPIError.resolveCode(options.body);\n Error.captureStackTrace?.(this, CosmosPayAPIError);\n }\n\n private static resolveMessage(status: number, body: unknown): string {\n if (body && typeof body === 'object') {\n const maybe = body as { message?: unknown; error?: unknown };\n const msg = maybe.message ?? maybe.error;\n if (Array.isArray(msg)) return `[${status}] ${msg.join(', ')}`;\n if (typeof msg === 'string') return `[${status}] ${msg}`;\n }\n if (typeof body === 'string' && body.length) return `[${status}] ${body}`;\n return `[${status}] Request failed`;\n }\n\n private static resolveCode(body: unknown): string | undefined {\n if (body && typeof body === 'object') {\n const maybe = body as { code?: unknown; error?: unknown };\n if (typeof maybe.code === 'string') return maybe.code;\n if (typeof maybe.error === 'string') return maybe.error;\n }\n return undefined;\n }\n}\n\n/**\n * Error thrown when a request never reaches the API: network failure, abort or\n * timeout. Distinct from {@link CosmosPayAPIError}, which always has a status.\n */\nexport class CosmosPayRequestError extends Error {\n public readonly method: string;\n public readonly url: string;\n public readonly cause: unknown;\n\n constructor(options: { method: string; url: string; cause: unknown }) {\n const reason =\n options.cause instanceof Error ? options.cause.message : String(options.cause);\n super(`Request to ${options.method} ${options.url} failed: ${reason}`);\n this.name = 'CosmosPayRequestError';\n this.method = options.method;\n this.url = options.url;\n this.cause = options.cause;\n Error.captureStackTrace?.(this, CosmosPayRequestError);\n }\n}\n","/**\n * Typed identifiers for the wallets the web client knows about, so you can write\n * `Wallets.FREIGHTER` instead of remembering the `'freighter'` magic string —\n * while any custom adapter id still works.\n */\n\n/** Built-in wallet ids (matches each adapter's `id`). */\nexport const Wallets = {\n /** Cosmos Pay's own wallet — extension, or the hosted build (see CosmosWalletAdapter). */\n COSMOS: 'cosmos',\n FREIGHTER: 'freighter',\n XBULL: 'xbull',\n RABET: 'rabet',\n LOBSTR: 'lobstr',\n ALBEDO: 'albedo',\n} as const;\n\n/** A known wallet id, or any custom adapter id (autocomplete for the built-ins). */\nexport type WalletId = (typeof Wallets)[keyof typeof Wallets] | (string & {});\n"]}
1
+ {"version":3,"sources":["../src/common/addresses.ts","../src/common/assets.ts","../src/common/intent-input.ts","../src/util/Constants.ts","../src/errors/CosmosPayError.ts","../src/common/wallets.ts"],"names":[],"mappings":";AAWA,IAAM,SAAA,GAAY,iBAAA;AAClB,IAAM,SAAA,GAAY,iBAAA;AAClB,IAAM,SAAA,GAAY,iBAAA;AAGX,SAAS,iBAAiB,KAAA,EAAiC;AAChE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,eAAe,KAAA,EAAiC;AAC9D,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,kBAAkB,KAAA,EAAiC;AACjE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,SAAA,CAAU,KAAK,KAAK,CAAA;AAC1D;AAGO,SAAS,UAAU,KAAA,EAAiC;AACzD,EAAA,OAAO,iBAAiB,KAAK,CAAA,IAAK,eAAe,KAAK,CAAA,IAAK,kBAAkB,KAAK,CAAA;AACpF;AAGO,SAAS,aAAA,CAAc,KAAA,EAAgB,KAAA,GAAQ,SAAA,EAAmB;AACvE,EAAA,IAAI,CAAC,SAAA,CAAU,KAAK,CAAA,EAAG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AAQ,OAAO,IAAA,KAAS,QAAA,EAAU;AACpC,MAAA,MAAM,KAAA,GAAQ,IAAA;AACd,MAAA,IAAI,OAAO,KAAA,CAAM,IAAA,KAAS,QAAA,SAAiB,KAAA,CAAM,IAAA;AACjD,MAAA,IAAI,OAAO,KAAA,CAAM,KAAA,KAAU,QAAA,SAAiB,KAAA,CAAM,KAAA;AAAA,IACpD;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAMO,IAAM,qBAAA,GAAN,MAAM,sBAAA,SAA8B,KAAA,CAAM;AAAA,EAK/C,YAAY,OAAA,EAA0D;AACpE,IAAA,MAAM,MAAA,GACJ,QAAQ,KAAA,YAAiB,KAAA,GAAQ,QAAQ,KAAA,CAAM,OAAA,GAAU,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA;AAC/E,IAAA,KAAA,CAAM,CAAA,WAAA,EAAc,QAAQ,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,CAAA,SAAA,EAAY,MAAM,CAAA,CAAE,CAAA;AACrE,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AACZ,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,MAAA;AACtB,IAAA,IAAA,CAAK,MAAM,OAAA,CAAQ,GAAA;AACnB,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,KAAA;AACrB,IAAA,KAAA,CAAM,iBAAA,GAAoB,MAAM,sBAAqB,CAAA;AAAA,EACvD;AACF;;;ACpEO,IAAM,OAAA,GAAU;AAAA;AAAA,EAErB,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,WAAA;AAAA,EACX,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ;AACV","file":"chunk-FTHQKUE5.js","sourcesContent":["/**\n * Stellar address helpers + a tiny named-address book.\n *\n * So integrators don't have to sprinkle raw `G...` strings everywhere (and risk\n * typos), they can name the accounts they care about once and reference them by\n * name. A plain address string always keeps working — `resolveAddress` only\n * substitutes registered names and otherwise passes the value straight through.\n */\n\n// Stellar strkeys are base32 (RFC 4648 alphabet, no padding). These checks are\n// length/prefix sanity checks, not full checksum validation.\nconst G_ADDRESS = /^G[A-Z2-7]{55}$/; // ed25519 public key (account)\nconst M_ADDRESS = /^M[A-Z2-7]{68}$/; // muxed account\nconst C_ADDRESS = /^C[A-Z2-7]{55}$/; // contract id\n\n/** Whether a value looks like a Stellar account address (`G…`). */\nexport function isStellarAddress(value: unknown): value is string {\n return typeof value === 'string' && G_ADDRESS.test(value);\n}\n\n/** Whether a value looks like a muxed account address (`M…`). */\nexport function isMuxedAddress(value: unknown): value is string {\n return typeof value === 'string' && M_ADDRESS.test(value);\n}\n\n/** Whether a value looks like a Soroban contract id (`C…`). */\nexport function isContractAddress(value: unknown): value is string {\n return typeof value === 'string' && C_ADDRESS.test(value);\n}\n\n/** Whether a value is any kind of Stellar address (account, muxed or contract). */\nexport function isAddress(value: unknown): value is string {\n return isStellarAddress(value) || isMuxedAddress(value) || isContractAddress(value);\n}\n\n/** Throw unless `value` is a valid Stellar account/muxed/contract address. */\nexport function assertAddress(value: unknown, label = 'address'): string {\n if (!isAddress(value)) {\n throw new TypeError(`Invalid Stellar ${label}: ${String(value)}`);\n }\n return value;\n}\n\n/**\n * A registry of named Stellar addresses. Register the accounts you use a lot —\n * your merchant payout account, a treasury, frequent counterparties — and refer\n * to them by name anywhere an address is accepted.\n *\n * @example\n * addresses.define('merchant', 'GC...');\n * await client.paymentIntents.createPay({ destination: 'merchant', amount: '10' });\n */\nexport class AddressBook {\n private readonly entries = new Map<string, string>();\n\n constructor(initial: Record<string, string> = {}) {\n for (const [name, address] of Object.entries(initial)) {\n this.define(name, address);\n }\n }\n\n /** Register (or overwrite) a named address. The address is validated. */\n public define(name: string, address: string): this {\n this.entries.set(name, assertAddress(address, `address for \"${name}\"`));\n return this;\n }\n\n /** Whether a name is registered. */\n public has(name: string): boolean {\n return this.entries.has(name);\n }\n\n /** Look up a registered address by name. */\n public get(name: string): string | undefined {\n return this.entries.get(name);\n }\n\n /** Remove a named address. */\n public delete(name: string): boolean {\n return this.entries.delete(name);\n }\n\n /** All registered names. */\n public names(): string[] {\n return [...this.entries.keys()];\n }\n\n /**\n * Resolve a reference to a concrete address: a registered name is substituted,\n * any other string is returned unchanged (so raw `G…`, muxed `M…`, federation\n * `name*domain`, etc. all keep working).\n */\n public resolve(ref: string): string {\n return this.entries.get(ref) ?? ref;\n }\n}\n\n/** Process-wide default address book. Use `addresses.define(...)` to populate it. */\nexport const addresses = new AddressBook();\n\n/** Anything accepted where an address is expected: a raw address or a name in a book. */\nexport type AddressRef = string;\n\n/**\n * Resolve an {@link AddressRef} using the given book (the shared {@link addresses}\n * by default). Lenient: unknown strings pass through unchanged.\n */\nexport function resolveAddress(ref: AddressRef, book: AddressBook = addresses): string {\n return book.resolve(ref);\n}\n","/**\n * A typed, extensible catalog of Stellar assets.\n *\n * Instead of hunting down an asset's issuer (or pasting the wrong one), use the\n * built-in catalog — `Assets.USDC`, `Assets.EURC`, `Assets.XLM` — which carries\n * the verified issuer for you. Need something else? `defineAsset(...)` makes a\n * typed asset you can reuse. And a plain code string still works everywhere.\n *\n * ⚠️ Issuers are network-specific. The {@link Assets} catalog targets **mainnet**;\n * {@link TestnetAssets} carries the testnet issuers. Bare code strings (e.g.\n * `'USDC'`) are treated as *code only* (no issuer) for backwards compatibility —\n * use the catalog object or `defineAsset` when you want the issuer filled in.\n */\n\nimport { isStellarAddress } from '@/common/addresses';\n\n/** A fully-described Stellar asset. */\nexport interface AssetDefinition {\n /** Asset code, e.g. `USDC`. Use `XLM` (or omit the issuer) for native lumens. */\n code: string;\n /** Issuer account (`G…`). `null`/omitted means the native asset (XLM). */\n issuer?: string | null;\n /** Optional Soroban contract id (`C…`) for the SAC / token contract. */\n contract?: string;\n /** Human-readable name. */\n name?: string;\n /** Network the `issuer` is valid on. */\n network?: 'public' | 'testnet';\n}\n\n/** Anything accepted where an asset is expected: a code string or a definition. */\nexport type AssetRef = string | AssetDefinition;\n\n/** Normalized asset: a code plus a concrete issuer (or `null` for native). */\nexport interface ResolvedAsset {\n /** `XLM` for the native asset, otherwise the asset code. */\n code: string;\n /** Issuer `G…`, or `null` for the native asset. */\n issuer: string | null;\n /** Optional Soroban contract id. */\n contract?: string;\n}\n\nconst NATIVE: AssetDefinition = { code: 'XLM', issuer: null, name: 'Stellar Lumens' };\n\n/**\n * Built-in **mainnet** assets with verified issuers. Extend with your own via\n * {@link defineAsset}. Issuers sourced from the official issuers (Circle for\n * USDC/EURC).\n */\nexport const Assets = {\n /** Native lumens. */\n XLM: NATIVE,\n /** USD Coin by Circle (mainnet). */\n USDC: {\n code: 'USDC',\n issuer: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',\n name: 'USD Coin',\n network: 'public',\n },\n /** Euro Coin by Circle (mainnet). */\n EURC: {\n code: 'EURC',\n issuer: 'GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2',\n name: 'Euro Coin',\n network: 'public',\n },\n} as const satisfies Record<string, AssetDefinition>;\n\n/** Built-in **testnet** assets (Circle's Test SDF Network issuers). */\nexport const TestnetAssets = {\n XLM: NATIVE,\n USDC: {\n code: 'USDC',\n issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',\n name: 'USD Coin',\n network: 'testnet',\n },\n EURC: {\n code: 'EURC',\n issuer: 'GB3Q6QDZYTHWT7E5PVS3W7FUT5GVAFC5KSZFFLPU25GO7VTC3NM2ZTVO',\n name: 'Euro Coin',\n network: 'testnet',\n },\n} as const satisfies Record<string, AssetDefinition>;\n\n/** Whether a reference denotes the native asset (XLM). */\nexport function isNativeAsset(ref: AssetRef): boolean {\n if (typeof ref === 'string') {\n const code = ref.trim().toLowerCase();\n return code === '' || code === 'xlm' || code === 'native';\n }\n return !ref.issuer || isNativeAsset(ref.code);\n}\n\n/**\n * Create a reusable, typed custom asset. Validates the issuer/contract format so\n * a typo surfaces immediately rather than on-chain.\n *\n * @example\n * const AQUA = defineAsset({ code: 'AQUA', issuer: 'GBNZ...', name: 'Aquarius' });\n * await client.paymentIntents.createPay({ destination, amount: '5', asset: AQUA });\n */\nexport function defineAsset(def: AssetDefinition): AssetDefinition {\n if (!def.code) throw new TypeError('defineAsset requires a `code`.');\n if (def.issuer != null && !isStellarAddress(def.issuer)) {\n throw new TypeError(`defineAsset: invalid issuer for ${def.code}: ${def.issuer}`);\n }\n if (def.contract != null && !/^C[A-Z2-7]{55}$/.test(def.contract)) {\n throw new TypeError(`defineAsset: invalid contract for ${def.code}: ${def.contract}`);\n }\n return Object.freeze({ ...def });\n}\n\n/**\n * Normalize an {@link AssetRef} into `{ code, issuer, contract }`.\n *\n * - A bare string is treated as *code only* (`issuer: null`) — pass a catalog\n * object or `defineAsset(...)` result when you want the issuer included.\n * - The native asset normalizes to `{ code: 'XLM', issuer: null }`.\n */\nexport function resolveAsset(ref: AssetRef): ResolvedAsset {\n if (isNativeAsset(ref)) return { code: 'XLM', issuer: null };\n if (typeof ref === 'string') return { code: ref, issuer: null };\n return {\n code: ref.code,\n issuer: ref.issuer ?? null,\n ...(ref.contract ? { contract: ref.contract } : {}),\n };\n}\n","/**\n * Shared resolution of \"create intent\" input, used by both the server SDK and\n * the web client so the convenience layers behave identically: a typed\n * {@link AssetRef} (e.g. `Assets.USDC`) is expanded into `assetCode`/`assetIssuer`,\n * and named addresses are substituted via an {@link AddressBook}.\n */\n\nimport { addresses as defaultBook, AddressBook, resolveAddress } from '@/common/addresses';\nimport { resolveAsset, type AssetRef } from '@/common/assets';\n\n/** Fields the resolver understands (everything else passes through untouched). */\nexport interface ResolvableIntentInput {\n destination?: string;\n source?: string;\n /** Typed asset (`Assets.USDC`, `defineAsset(...)`) — fills code + issuer. */\n asset?: AssetRef;\n assetCode?: string;\n assetIssuer?: string;\n}\n\n/**\n * Expand `asset` into `assetCode`/`assetIssuer` and resolve named\n * `destination`/`source` addresses. Existing `assetCode`/`assetIssuer` win over a\n * provided `asset`; native assets leave the code unset (the API treats an omitted\n * asset as native XLM). Returns a new object — the input is not mutated.\n */\nexport function resolveIntentBody<T extends ResolvableIntentInput>(\n options: T,\n book: AddressBook = defaultBook,\n): Omit<T, 'asset'> {\n const out: Record<string, unknown> = { ...(options as Record<string, unknown>) };\n\n if (typeof out['destination'] === 'string') {\n out['destination'] = resolveAddress(out['destination'], book);\n }\n if (typeof out['source'] === 'string') {\n out['source'] = resolveAddress(out['source'], book);\n }\n\n if (out['asset'] != null) {\n const { code, issuer } = resolveAsset(out['asset'] as AssetRef);\n delete out['asset'];\n if (issuer) {\n // Non-native: fill code + issuer unless the caller set them explicitly.\n out['assetCode'] ??= code;\n out['assetIssuer'] ??= issuer;\n }\n // Native (issuer == null) → leave assetCode/assetIssuer omitted = native XLM.\n }\n\n return out as Omit<T, 'asset'>;\n}\n","/** Library version, kept in sync with package.json. */\nexport const version = '2.3.0';\n\n/**\n * Default base URL of the Cosmos Pay gateway. Maintained by Cosmos Pay — users\n * never need to set this; it's part of the {@link shared} configuration. Override\n * only when self-hosting or pointing at a staging gateway.\n *\n * This is the public APISIX gateway: requests under `/cosmos-api/*` are\n * authenticated (API key) and proxied to the Payments API. The version segment\n * (`/v1`, see {@link DEFAULT_VERSION}) is appended by the REST layer, producing\n * e.g. `https://api.cosmospay.lat/cosmos-api/v1/payment-intents/pay`.\n */\nexport const DEFAULT_BASE_URL = 'https://api.cosmospay.lat/cosmos-api';\n\n/** Default API version segment prefixed to every route (`/v1/...`). */\nexport const DEFAULT_VERSION = 'v1';\n\n/** Default request timeout in milliseconds. */\nexport const DEFAULT_TIMEOUT = 30_000;\n\n/** Default number of retries for transient failures (network / 429 / 5xx). */\nexport const DEFAULT_RETRIES = 2;\n\n/** Default HMAC signature header sent by the Cosmos Pay webhook dispatcher. */\nexport const SIGNATURE_HEADER = 'x-cosmos-signature';\n\n/**\n * Client debug/telemetry events. The {@link Client} extends EventEmitter and\n * emits these for observability (`debug`/`rateLimit`-style events).\n */\nexport const Events = {\n Debug: 'debug',\n Request: 'request',\n Response: 'response',\n RateLimited: 'rateLimited',\n} as const;\nexport type ClientEvent = (typeof Events)[keyof typeof Events];\n","/**\n * Error thrown when the Cosmos Pay API responds with a non-2xx status.\n *\n * Carries the HTTP status, the parsed response body and the request context so\n * callers can branch on `error.status` (e.g. 404 → not found, 403 → gateway).\n */\nexport class CosmosPayAPIError extends Error {\n /** HTTP status code returned by the API. */\n public readonly status: number;\n /** HTTP method of the failed request. */\n public readonly method: string;\n /** Absolute URL of the failed request. */\n public readonly url: string;\n /** Parsed response body (object when JSON, string otherwise, or null). */\n public readonly body: unknown;\n /** Machine-readable error code extracted from the body when present. */\n public readonly code: string | undefined;\n\n constructor(options: {\n status: number;\n method: string;\n url: string;\n body: unknown;\n }) {\n const message = CosmosPayAPIError.resolveMessage(options.status, options.body);\n super(message);\n this.name = 'CosmosPayAPIError';\n this.status = options.status;\n this.method = options.method;\n this.url = options.url;\n this.body = options.body;\n this.code = CosmosPayAPIError.resolveCode(options.body);\n Error.captureStackTrace?.(this, CosmosPayAPIError);\n }\n\n private static resolveMessage(status: number, body: unknown): string {\n if (body && typeof body === 'object') {\n const maybe = body as { message?: unknown; error?: unknown };\n const msg = maybe.message ?? maybe.error;\n if (Array.isArray(msg)) return `[${status}] ${msg.join(', ')}`;\n if (typeof msg === 'string') return `[${status}] ${msg}`;\n }\n if (typeof body === 'string' && body.length) return `[${status}] ${body}`;\n return `[${status}] Request failed`;\n }\n\n private static resolveCode(body: unknown): string | undefined {\n if (body && typeof body === 'object') {\n const maybe = body as { code?: unknown; error?: unknown };\n if (typeof maybe.code === 'string') return maybe.code;\n if (typeof maybe.error === 'string') return maybe.error;\n }\n return undefined;\n }\n}\n\n/**\n * Error thrown when a request never reaches the API: network failure, abort or\n * timeout. Distinct from {@link CosmosPayAPIError}, which always has a status.\n */\nexport class CosmosPayRequestError extends Error {\n public readonly method: string;\n public readonly url: string;\n public readonly cause: unknown;\n\n constructor(options: { method: string; url: string; cause: unknown }) {\n const reason =\n options.cause instanceof Error ? options.cause.message : String(options.cause);\n super(`Request to ${options.method} ${options.url} failed: ${reason}`);\n this.name = 'CosmosPayRequestError';\n this.method = options.method;\n this.url = options.url;\n this.cause = options.cause;\n Error.captureStackTrace?.(this, CosmosPayRequestError);\n }\n}\n","/**\n * Typed identifiers for the wallets the web client knows about, so you can write\n * `Wallets.FREIGHTER` instead of remembering the `'freighter'` magic string —\n * while any custom adapter id still works.\n */\n\n/** Built-in wallet ids (matches each adapter's `id`). */\nexport const Wallets = {\n /** Cosmos Pay's own wallet — extension, or the hosted build (see CosmosWalletAdapter). */\n COSMOS: 'cosmos',\n FREIGHTER: 'freighter',\n XBULL: 'xbull',\n RABET: 'rabet',\n LOBSTR: 'lobstr',\n ALBEDO: 'albedo',\n} as const;\n\n/** A known wallet id, or any custom adapter id (autocomplete for the built-ins). */\nexport type WalletId = (typeof Wallets)[keyof typeof Wallets] | (string & {});\n"]}