@cosmosapp/pay_sdk 2.3.2 → 2.4.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 +19 -0
  2. package/README.md +97 -61
  3. package/dist/{chunk-U3WDM2FJ.js → chunk-6FIALX2E.js} +3 -3
  4. package/dist/{chunk-U3WDM2FJ.js.map → chunk-6FIALX2E.js.map} +1 -1
  5. package/dist/chunk-ALFITFBN.js +105 -0
  6. package/dist/chunk-ALFITFBN.js.map +1 -0
  7. package/dist/chunk-PAQHOXQ6.js +392 -0
  8. package/dist/chunk-PAQHOXQ6.js.map +1 -0
  9. package/dist/errors-CZu5mmz1.d.cts +293 -0
  10. package/dist/errors-Cqh7UdUO.d.ts +293 -0
  11. package/dist/index.cjs +18 -5
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +12 -7
  14. package/dist/index.d.ts +12 -7
  15. package/dist/index.js +19 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/intent-input-BybnwL83.d.ts +126 -0
  18. package/dist/intent-input-C2PTr2XH.d.cts +126 -0
  19. package/dist/swk/index.js +1 -103
  20. package/dist/swk/index.js.map +1 -1
  21. package/dist/wallets/index.cjs +1043 -0
  22. package/dist/wallets/index.cjs.map +1 -0
  23. package/dist/wallets/index.d.cts +384 -0
  24. package/dist/wallets/index.d.ts +384 -0
  25. package/dist/wallets/index.js +629 -0
  26. package/dist/wallets/index.js.map +1 -0
  27. package/dist/{intent-input-CP5bkBYI.d.cts → wallets-CeIjESt5.d.cts} +39 -126
  28. package/dist/{intent-input-CP5bkBYI.d.ts → wallets-CeIjESt5.d.ts} +39 -126
  29. package/dist/web/index.cjs +1 -1
  30. package/dist/web/index.cjs.map +1 -1
  31. package/dist/web/index.d.cts +7 -292
  32. package/dist/web/index.d.ts +7 -292
  33. package/dist/web/index.js +5 -391
  34. package/dist/web/index.js.map +1 -1
  35. package/llms/07-webhooks.md +2 -0
  36. package/llms/15-swaps.md +2 -0
  37. package/llms/18-wallets.md +94 -0
  38. package/llms/llms-full.txt +101 -0
  39. package/llms/llms.txt +1 -0
  40. package/package.json +22 -8
@@ -1,219 +1,11 @@
1
- import { cN as WalletId, aG as PaymentIntentData } from '../intent-input-CP5bkBYI.cjs';
1
+ import { cJ as WalletId, aG as PaymentIntentData } from '../wallets-CeIjESt5.cjs';
2
2
  import { CreatePayPaymentIntentOptions, CreateTxPaymentIntentOptions, ValidationOutcomeData } from '../index.cjs';
3
- export { bE as AddressBook, bF as AddressRef, c2 as AssetDefinition, c3 as AssetRef, c4 as Assets, ca as CosmosPayAPIError, cb as CosmosPayRequestError, cE as ResolvableIntentInput, cF as ResolvedAsset, cI as TestnetAssets, cO as Wallets, cR as addresses, cS as assertAddress, cT as defineAsset, cU as isAddress, cV as isContractAddress, cW as isMuxedAddress, cX as isNativeAsset, cY as isStellarAddress, cZ as resolveAddress, c_ as resolveAsset, c$ as resolveIntentBody } from '../intent-input-CP5bkBYI.cjs';
3
+ export { c0 as AssetDefinition, c1 as AssetRef, c2 as Assets, cB as ResolvedAsset, cE as TestnetAssets, cK as Wallets, cN as defineAsset, cO as isNativeAsset, cP as resolveAsset } from '../wallets-CeIjESt5.cjs';
4
+ import { W as WalletAdapter, N as NetworkConfig, b as SignParams, c as WalletInfo, C as ConnectResult, I as InjectedWallets, S as StellarNetwork, d as StellarSdkLike, P as PayableInput, e as PayOptions, f as PayResult, g as NormalizedIntent, h as Sep7Request } from '../errors-CZu5mmz1.cjs';
5
+ export { i as CosmosPayWebError, j as IntentError, k as StellarSdkRequiredError, a as WalletError, l as WalletNotFoundError, m as defaultAdapters } from '../errors-CZu5mmz1.cjs';
4
6
  import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-BrpOdL_b.cjs';
5
7
  export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-BrpOdL_b.cjs';
6
-
7
- /**
8
- * Types for the browser ("web client") side of the SDK.
9
- *
10
- * The web client never talks to a Stellar wallet through SEP-7 deep links —
11
- * Freighter, xBull, Albedo, Rabet & co. don't consume `web+stellar:` URIs from
12
- * a dapp. Instead the SDK *adapts* the Cosmos Pay response into a concrete
13
- * Stellar transaction (XDR) and asks the detected wallet to sign it. These
14
- * types describe that flow.
15
- */
16
-
17
- /** The Stellar network a transaction targets. */
18
- type StellarNetwork = 'public' | 'testnet';
19
- /** Fully-resolved network parameters used to build, sign and submit. */
20
- interface NetworkConfig {
21
- /** `public` (mainnet) or `testnet`. */
22
- network: StellarNetwork;
23
- /** Network passphrase, e.g. `Public Global Stellar Network ; September 2015`. */
24
- passphrase: string;
25
- /** Horizon base URL used to load accounts and submit transactions. */
26
- horizonUrl: string;
27
- }
28
- /**
29
- * Parsed parameters of a SEP-7 `web+stellar:` URI. The Cosmos Pay API returns
30
- * such a URI on every intent; the web client can act on either the structured
31
- * {@link PaymentIntentData} or the raw URI string.
32
- */
33
- interface Sep7Request {
34
- operation: 'tx' | 'pay';
35
- /** `tx` only: base64 TransactionEnvelope XDR. */
36
- xdr?: string;
37
- /** `pay` only: payee account / muxed account. */
38
- destination?: string;
39
- /** `pay` only: amount the destination receives. */
40
- amount?: string;
41
- /** `pay` only: asset code (absent ⇒ native XLM). */
42
- assetCode?: string;
43
- /** `pay` only: issuer of a non-native asset. */
44
- assetIssuer?: string;
45
- /** Memo value. */
46
- memo?: string;
47
- /** `MEMO_ID` | `MEMO_TEXT` | `MEMO_HASH` | `MEMO_RETURN`. */
48
- memoType?: string;
49
- /** Human-readable message shown to the user (≤ 300 chars). */
50
- msg?: string;
51
- /** `url:https://…` callback the signed XDR should be POSTed to. */
52
- callback?: string;
53
- /** Network passphrase for non-public networks. */
54
- networkPassphrase?: string;
55
- originDomain?: string;
56
- signature?: string;
57
- }
58
- /**
59
- * A normalized, wallet-agnostic view of "what to pay". The web client coerces
60
- * every accepted input — the server's {@link PaymentIntentData}, a parsed
61
- * {@link Sep7Request}, or a raw SEP-7 URI string — into this shape before
62
- * building a transaction.
63
- */
64
- interface NormalizedIntent {
65
- /** `tx` (source known, XDR present) or `pay` (wallet supplies the source). */
66
- kind: 'tx' | 'pay';
67
- /** Intent id, when acting on a {@link PaymentIntentData}. */
68
- id?: string;
69
- /** Network hint carried by the intent, if any (passphrase or label). */
70
- network: string | null;
71
- /** Payer account. `null` for `pay` intents (the connected wallet supplies it). */
72
- source: string | null;
73
- destination: string;
74
- /** Decimal amount string, or `null` when the user must enter it. */
75
- amount: string | null;
76
- /** Asset code, or `native` for XLM. */
77
- asset: string;
78
- assetIssuer: string | null;
79
- /** Memo value (MEMO_ID by default). */
80
- memo: string | null;
81
- memoType: string | null;
82
- msg: string | null;
83
- callback: string | null;
84
- /** Unsigned envelope (base64 XDR); `null` for `pay` intents. */
85
- xdr: string | null;
86
- /** The originating SEP-7 URI, when known. */
87
- uri: string | null;
88
- }
89
- /**
90
- * Anything the web client accepts as "the thing to pay": a server
91
- * {@link PaymentIntentData}, an already-parsed {@link Sep7Request}, a raw SEP-7
92
- * URI string, or any object exposing a `toJSON()` returning a
93
- * {@link PaymentIntentData} (e.g. a {@link PaymentIntent} structure instance).
94
- */
95
- type PayableInput = PaymentIntentData | Sep7Request | string | {
96
- toJSON(): PaymentIntentData;
97
- };
98
- /** Lightweight descriptor of a wallet, as surfaced by detection. */
99
- interface WalletInfo {
100
- /** Stable id, e.g. `freighter`, `xbull`, `albedo`, `rabet`, `lobstr`. */
101
- id: string;
102
- /** Human-readable name. */
103
- name: string;
104
- /** Optional icon (data URL or remote URL). */
105
- icon?: string;
106
- /** Whether the wallet is currently usable (extension injected / lib present). */
107
- available: boolean;
108
- }
109
- /** Parameters passed to {@link WalletAdapter.signTransaction}. */
110
- interface SignParams {
111
- /** Network passphrase the wallet must sign for. */
112
- networkPassphrase: string;
113
- /** `public` / `testnet`, for wallets whose API takes a label not a passphrase. */
114
- network: StellarNetwork;
115
- /** Account expected to sign (helps multi-account wallets pick the right key). */
116
- address?: string;
117
- }
118
- /**
119
- * A pluggable wallet integration. The SDK ships adapters for the most common
120
- * Stellar wallets and auto-detects the right one, but you can register your own
121
- * (WalletConnect, Ledger, a custom signer…) via {@link WebClient.registerWallet}.
122
- */
123
- interface WalletAdapter {
124
- /** Stable id (used for selection and {@link WalletInfo.id}). */
125
- readonly id: string;
126
- /** Human-readable name. */
127
- readonly name: string;
128
- /** Optional icon. */
129
- readonly icon?: string;
130
- /**
131
- * Whether this wallet is usable right now (e.g. the browser extension injected
132
- * its global, or the wallet's library was provided). Must never throw.
133
- */
134
- isAvailable(): Promise<boolean>;
135
- /** Connect (requesting permission if needed) and return the user's `G…` address. */
136
- getPublicKey(network: NetworkConfig): Promise<string>;
137
- /** Sign an unsigned XDR and return the signed XDR (base64). */
138
- signTransaction(xdr: string, params: SignParams): Promise<string>;
139
- /** Optional: tear down any connection/session. */
140
- disconnect?(): Promise<void>;
141
- }
142
- /** Result of {@link WebClient.connect}. */
143
- interface ConnectResult {
144
- /** Id of the wallet that connected. */
145
- wallet: string;
146
- /** Connected `G…` account. */
147
- address: string;
148
- /** Network the wallet reported / the client resolved. */
149
- network: StellarNetwork;
150
- }
151
- /** Options for {@link WebClient.pay} (and the lower-level builders). */
152
- interface PayOptions {
153
- /**
154
- * Force a specific wallet by id (e.g. `Wallets.FREIGHTER`). By default the
155
- * client auto-detects — you don't need to pass this.
156
- */
157
- wallet?: WalletId;
158
- /**
159
- * Override / supply the amount for an open `pay` intent (one created without a
160
- * fixed amount, e.g. a donation).
161
- */
162
- amount?: string;
163
- /**
164
- * For `pay` intents, the source account to build from. Defaults to the
165
- * connected wallet's address — you normally never set this.
166
- */
167
- source?: string;
168
- /** Skip Horizon submission and just return the signed XDR. */
169
- sign?: boolean;
170
- /**
171
- * Whether to submit the signed transaction. Defaults to `true` unless the
172
- * intent carries a SEP-7 `callback` (in which case the signed XDR is POSTed
173
- * there instead).
174
- */
175
- submit?: boolean;
176
- /** Per-call `AbortSignal`. */
177
- signal?: AbortSignal;
178
- }
179
- /** Outcome of a full {@link WebClient.pay} flow. */
180
- interface PayResult {
181
- /** Intent id, when paying a {@link PaymentIntentData}. */
182
- intentId?: string;
183
- /** Id of the wallet that signed. */
184
- wallet: string;
185
- /** Account that signed (the source). */
186
- account: string;
187
- /** Network used. */
188
- network: StellarNetwork;
189
- /** The signed transaction envelope (base64 XDR). */
190
- signedXdr: string;
191
- /** The transaction hash (hex) — stable whether submitted to Horizon or a callback. */
192
- txHash: string;
193
- /** Whether the transaction was broadcast (to Horizon or the SEP-7 callback). */
194
- submitted: boolean;
195
- /** Raw Horizon (or callback) response, when submitted. */
196
- response?: unknown;
197
- }
198
- /**
199
- * A Stellar SDK module, structurally typed to just the surface the web client
200
- * uses. Pass `@stellar/stellar-sdk` (or a compatible build) via
201
- * `new WebClient({ stellarSdk })`, or install it and let the client import it.
202
- */
203
- interface StellarSdkLike {
204
- TransactionBuilder: any;
205
- Account: any;
206
- Operation: any;
207
- Asset: any;
208
- Memo: any;
209
- BASE_FEE?: string;
210
- Networks?: Record<string, string>;
211
- Horizon?: {
212
- Server: any;
213
- };
214
- Server?: any;
215
- [key: string]: any;
216
- }
8
+ export { A as AddressBook, a as AddressRef, C as CosmosPayAPIError, b as CosmosPayRequestError, R as ResolvableIntentInput, c as addresses, d as assertAddress, i as isAddress, e as isContractAddress, f as isMuxedAddress, g as isStellarAddress, r as resolveAddress, h as resolveIntentBody } from '../intent-input-C2PTr2XH.cjs';
217
9
 
218
10
  /**
219
11
  * Freighter — https://www.freighter.app
@@ -399,43 +191,6 @@ declare class CosmosWalletAdapter implements WalletAdapter {
399
191
  signTransaction(xdr: string, params: SignParams): Promise<string>;
400
192
  }
401
193
 
402
- /**
403
- * Built-in wallet adapters and the default registration set.
404
- *
405
- * Auto-detection order (first available wins): Freighter → xBull → Rabet →
406
- * LOBSTR → Albedo → Cosmos Pay Wallet. Freighter, xBull and Rabet inject browser globals so they're
407
- * detected with zero configuration; LOBSTR and Albedo need their library passed
408
- * in (no reliable global), so they only activate when injected.
409
- */
410
-
411
- /**
412
- * Optional wallet libraries to enable wallets that have no auto-detectable
413
- * global (LOBSTR, Albedo) or to use a non-extension transport (xBull web-app
414
- * bridge). Everything here is optional — extension wallets need nothing.
415
- */
416
- interface InjectedWallets {
417
- /** An `@stellar/freighter-api` module (otherwise `window.freighterApi`). */
418
- freighter?: any;
419
- /** An xBull SDK instance (otherwise `window.xBullSDK`). */
420
- xBull?: any;
421
- /** A Rabet provider (otherwise `window.rabet`). */
422
- rabet?: any;
423
- /** An `@albedo-link/intent` module/global (otherwise `window.albedo`). */
424
- albedo?: any;
425
- /** A `@lobstrco/signer-extension-api` module. */
426
- lobstr?: any;
427
- /**
428
- * A Cosmos Pay Wallet provider, or `{ walletUrl }` to reach the HOSTED wallet when
429
- * the extension is absent (otherwise `window.cosmosWallet`).
430
- */
431
- cosmos?: CosmosWalletProvider | CosmosProviderOptions;
432
- }
433
- /**
434
- * Build the default adapter set, honoring any injected wallet libraries. The
435
- * order here is the auto-detection priority.
436
- */
437
- declare function defaultAdapters(injected?: InjectedWallets): WalletAdapter[];
438
-
439
194
  /**
440
195
  * Registry + auto-detection for wallet adapters.
441
196
  *
@@ -717,46 +472,6 @@ declare function submitToHorizon(sdk: StellarSdkLike, network: NetworkConfig, si
717
472
  */
718
473
  declare function postToCallback(callback: string, signedXdr: string, fetchFn?: typeof fetch): Promise<unknown>;
719
474
 
720
- /**
721
- * Errors surfaced by the browser ("web client") side of the SDK.
722
- *
723
- * These are intentionally kept separate from the server-side
724
- * {@link CosmosPayAPIError}/{@link CosmosPayRequestError} so that bundling the
725
- * web entry never pulls in Node-only code paths. They all extend
726
- * {@link CosmosPayWebError} so a consumer can `catch (e) { if (e instanceof
727
- * CosmosPayWebError) ... }`.
728
- */
729
- /** Base class for every error thrown by `@cosmosapp/pay_sdk/web`. */
730
- declare class CosmosPayWebError extends Error {
731
- constructor(message: string);
732
- }
733
- /** No compatible Stellar wallet could be detected in the current environment. */
734
- declare class WalletNotFoundError extends CosmosPayWebError {
735
- /** Ids of the wallets that were searched for. */
736
- readonly searched: string[];
737
- constructor(searched: string[]);
738
- }
739
- /** A wallet was found but the operation failed (user rejected, locked, etc.). */
740
- declare class WalletError extends CosmosPayWebError {
741
- /** Id of the wallet that produced the error (e.g. `freighter`). */
742
- readonly wallet: string;
743
- /** The underlying error, if any. */
744
- readonly cause: unknown;
745
- constructor(wallet: string, message: string, cause?: unknown);
746
- }
747
- /**
748
- * Building a `pay` transaction (or submitting to Horizon) requires the Stellar
749
- * SDK, which is an optional peer dependency. Thrown when it is neither installed
750
- * nor injected.
751
- */
752
- declare class StellarSdkRequiredError extends CosmosPayWebError {
753
- constructor(detail?: string);
754
- }
755
- /** The intent / SEP-7 request could not be interpreted or is missing data. */
756
- declare class IntentError extends CosmosPayWebError {
757
- constructor(message: string);
758
- }
759
-
760
475
  /**
761
476
  * A tiny, browser-safe HTTP layer for the web client.
762
477
  *
@@ -801,5 +516,5 @@ declare class WebREST {
801
516
  request<T>(method: string, path: string, options?: WebRequestOptions): Promise<T>;
802
517
  }
803
518
 
804
- export { AlbedoAdapter, CosmosPayWebError, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, IntentError, LobstrAdapter, PASSPHRASES, PaymentIntentData, RabetAdapter, StellarSdkRequiredError, WalletError, WalletId, WalletNotFoundError, WalletRegistry, WebClient, WebREST, XBullAdapter, buildPaymentXdr, classifyNetwork, defaultAdapters, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
805
- export type { BuildPaymentInput, ConnectResult, InjectedWallets, NetworkConfig, NormalizedIntent, PayOptions, PayResult, PayableInput, ResolveNetworkInput, Sep7Request, SignParams, StellarNetwork, StellarSdkLike, WalletAdapter, WalletInfo, WebClientOptions, WebRESTOptions, WebRequestOptions };
519
+ export { AlbedoAdapter, ConnectResult, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, InjectedWallets, LobstrAdapter, NetworkConfig, NormalizedIntent, PASSPHRASES, PayOptions, PayResult, PayableInput, PaymentIntentData, RabetAdapter, Sep7Request, SignParams, StellarNetwork, StellarSdkLike, WalletAdapter, WalletId, WalletInfo, WalletRegistry, WebClient, WebREST, XBullAdapter, buildPaymentXdr, classifyNetwork, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
520
+ export type { BuildPaymentInput, ResolveNetworkInput, WebClientOptions, WebRESTOptions, WebRequestOptions };
@@ -1,219 +1,11 @@
1
- import { cN as WalletId, aG as PaymentIntentData } from '../intent-input-CP5bkBYI.js';
1
+ import { cJ as WalletId, aG as PaymentIntentData } from '../wallets-CeIjESt5.js';
2
2
  import { CreatePayPaymentIntentOptions, CreateTxPaymentIntentOptions, ValidationOutcomeData } from '../index.js';
3
- export { bE as AddressBook, bF as AddressRef, c2 as AssetDefinition, c3 as AssetRef, c4 as Assets, ca as CosmosPayAPIError, cb as CosmosPayRequestError, cE as ResolvableIntentInput, cF as ResolvedAsset, cI as TestnetAssets, cO as Wallets, cR as addresses, cS as assertAddress, cT as defineAsset, cU as isAddress, cV as isContractAddress, cW as isMuxedAddress, cX as isNativeAsset, cY as isStellarAddress, cZ as resolveAddress, c_ as resolveAsset, c$ as resolveIntentBody } from '../intent-input-CP5bkBYI.js';
3
+ export { c0 as AssetDefinition, c1 as AssetRef, c2 as Assets, cB as ResolvedAsset, cE as TestnetAssets, cK as Wallets, cN as defineAsset, cO as isNativeAsset, cP as resolveAsset } from '../wallets-CeIjESt5.js';
4
+ import { W as WalletAdapter, N as NetworkConfig, b as SignParams, c as WalletInfo, C as ConnectResult, I as InjectedWallets, S as StellarNetwork, d as StellarSdkLike, P as PayableInput, e as PayOptions, f as PayResult, g as NormalizedIntent, h as Sep7Request } from '../errors-Cqh7UdUO.js';
5
+ export { i as CosmosPayWebError, j as IntentError, k as StellarSdkRequiredError, a as WalletError, l as WalletNotFoundError, m as defaultAdapters } from '../errors-Cqh7UdUO.js';
4
6
  import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-BrpOdL_b.js';
5
7
  export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-BrpOdL_b.js';
6
-
7
- /**
8
- * Types for the browser ("web client") side of the SDK.
9
- *
10
- * The web client never talks to a Stellar wallet through SEP-7 deep links —
11
- * Freighter, xBull, Albedo, Rabet & co. don't consume `web+stellar:` URIs from
12
- * a dapp. Instead the SDK *adapts* the Cosmos Pay response into a concrete
13
- * Stellar transaction (XDR) and asks the detected wallet to sign it. These
14
- * types describe that flow.
15
- */
16
-
17
- /** The Stellar network a transaction targets. */
18
- type StellarNetwork = 'public' | 'testnet';
19
- /** Fully-resolved network parameters used to build, sign and submit. */
20
- interface NetworkConfig {
21
- /** `public` (mainnet) or `testnet`. */
22
- network: StellarNetwork;
23
- /** Network passphrase, e.g. `Public Global Stellar Network ; September 2015`. */
24
- passphrase: string;
25
- /** Horizon base URL used to load accounts and submit transactions. */
26
- horizonUrl: string;
27
- }
28
- /**
29
- * Parsed parameters of a SEP-7 `web+stellar:` URI. The Cosmos Pay API returns
30
- * such a URI on every intent; the web client can act on either the structured
31
- * {@link PaymentIntentData} or the raw URI string.
32
- */
33
- interface Sep7Request {
34
- operation: 'tx' | 'pay';
35
- /** `tx` only: base64 TransactionEnvelope XDR. */
36
- xdr?: string;
37
- /** `pay` only: payee account / muxed account. */
38
- destination?: string;
39
- /** `pay` only: amount the destination receives. */
40
- amount?: string;
41
- /** `pay` only: asset code (absent ⇒ native XLM). */
42
- assetCode?: string;
43
- /** `pay` only: issuer of a non-native asset. */
44
- assetIssuer?: string;
45
- /** Memo value. */
46
- memo?: string;
47
- /** `MEMO_ID` | `MEMO_TEXT` | `MEMO_HASH` | `MEMO_RETURN`. */
48
- memoType?: string;
49
- /** Human-readable message shown to the user (≤ 300 chars). */
50
- msg?: string;
51
- /** `url:https://…` callback the signed XDR should be POSTed to. */
52
- callback?: string;
53
- /** Network passphrase for non-public networks. */
54
- networkPassphrase?: string;
55
- originDomain?: string;
56
- signature?: string;
57
- }
58
- /**
59
- * A normalized, wallet-agnostic view of "what to pay". The web client coerces
60
- * every accepted input — the server's {@link PaymentIntentData}, a parsed
61
- * {@link Sep7Request}, or a raw SEP-7 URI string — into this shape before
62
- * building a transaction.
63
- */
64
- interface NormalizedIntent {
65
- /** `tx` (source known, XDR present) or `pay` (wallet supplies the source). */
66
- kind: 'tx' | 'pay';
67
- /** Intent id, when acting on a {@link PaymentIntentData}. */
68
- id?: string;
69
- /** Network hint carried by the intent, if any (passphrase or label). */
70
- network: string | null;
71
- /** Payer account. `null` for `pay` intents (the connected wallet supplies it). */
72
- source: string | null;
73
- destination: string;
74
- /** Decimal amount string, or `null` when the user must enter it. */
75
- amount: string | null;
76
- /** Asset code, or `native` for XLM. */
77
- asset: string;
78
- assetIssuer: string | null;
79
- /** Memo value (MEMO_ID by default). */
80
- memo: string | null;
81
- memoType: string | null;
82
- msg: string | null;
83
- callback: string | null;
84
- /** Unsigned envelope (base64 XDR); `null` for `pay` intents. */
85
- xdr: string | null;
86
- /** The originating SEP-7 URI, when known. */
87
- uri: string | null;
88
- }
89
- /**
90
- * Anything the web client accepts as "the thing to pay": a server
91
- * {@link PaymentIntentData}, an already-parsed {@link Sep7Request}, a raw SEP-7
92
- * URI string, or any object exposing a `toJSON()` returning a
93
- * {@link PaymentIntentData} (e.g. a {@link PaymentIntent} structure instance).
94
- */
95
- type PayableInput = PaymentIntentData | Sep7Request | string | {
96
- toJSON(): PaymentIntentData;
97
- };
98
- /** Lightweight descriptor of a wallet, as surfaced by detection. */
99
- interface WalletInfo {
100
- /** Stable id, e.g. `freighter`, `xbull`, `albedo`, `rabet`, `lobstr`. */
101
- id: string;
102
- /** Human-readable name. */
103
- name: string;
104
- /** Optional icon (data URL or remote URL). */
105
- icon?: string;
106
- /** Whether the wallet is currently usable (extension injected / lib present). */
107
- available: boolean;
108
- }
109
- /** Parameters passed to {@link WalletAdapter.signTransaction}. */
110
- interface SignParams {
111
- /** Network passphrase the wallet must sign for. */
112
- networkPassphrase: string;
113
- /** `public` / `testnet`, for wallets whose API takes a label not a passphrase. */
114
- network: StellarNetwork;
115
- /** Account expected to sign (helps multi-account wallets pick the right key). */
116
- address?: string;
117
- }
118
- /**
119
- * A pluggable wallet integration. The SDK ships adapters for the most common
120
- * Stellar wallets and auto-detects the right one, but you can register your own
121
- * (WalletConnect, Ledger, a custom signer…) via {@link WebClient.registerWallet}.
122
- */
123
- interface WalletAdapter {
124
- /** Stable id (used for selection and {@link WalletInfo.id}). */
125
- readonly id: string;
126
- /** Human-readable name. */
127
- readonly name: string;
128
- /** Optional icon. */
129
- readonly icon?: string;
130
- /**
131
- * Whether this wallet is usable right now (e.g. the browser extension injected
132
- * its global, or the wallet's library was provided). Must never throw.
133
- */
134
- isAvailable(): Promise<boolean>;
135
- /** Connect (requesting permission if needed) and return the user's `G…` address. */
136
- getPublicKey(network: NetworkConfig): Promise<string>;
137
- /** Sign an unsigned XDR and return the signed XDR (base64). */
138
- signTransaction(xdr: string, params: SignParams): Promise<string>;
139
- /** Optional: tear down any connection/session. */
140
- disconnect?(): Promise<void>;
141
- }
142
- /** Result of {@link WebClient.connect}. */
143
- interface ConnectResult {
144
- /** Id of the wallet that connected. */
145
- wallet: string;
146
- /** Connected `G…` account. */
147
- address: string;
148
- /** Network the wallet reported / the client resolved. */
149
- network: StellarNetwork;
150
- }
151
- /** Options for {@link WebClient.pay} (and the lower-level builders). */
152
- interface PayOptions {
153
- /**
154
- * Force a specific wallet by id (e.g. `Wallets.FREIGHTER`). By default the
155
- * client auto-detects — you don't need to pass this.
156
- */
157
- wallet?: WalletId;
158
- /**
159
- * Override / supply the amount for an open `pay` intent (one created without a
160
- * fixed amount, e.g. a donation).
161
- */
162
- amount?: string;
163
- /**
164
- * For `pay` intents, the source account to build from. Defaults to the
165
- * connected wallet's address — you normally never set this.
166
- */
167
- source?: string;
168
- /** Skip Horizon submission and just return the signed XDR. */
169
- sign?: boolean;
170
- /**
171
- * Whether to submit the signed transaction. Defaults to `true` unless the
172
- * intent carries a SEP-7 `callback` (in which case the signed XDR is POSTed
173
- * there instead).
174
- */
175
- submit?: boolean;
176
- /** Per-call `AbortSignal`. */
177
- signal?: AbortSignal;
178
- }
179
- /** Outcome of a full {@link WebClient.pay} flow. */
180
- interface PayResult {
181
- /** Intent id, when paying a {@link PaymentIntentData}. */
182
- intentId?: string;
183
- /** Id of the wallet that signed. */
184
- wallet: string;
185
- /** Account that signed (the source). */
186
- account: string;
187
- /** Network used. */
188
- network: StellarNetwork;
189
- /** The signed transaction envelope (base64 XDR). */
190
- signedXdr: string;
191
- /** The transaction hash (hex) — stable whether submitted to Horizon or a callback. */
192
- txHash: string;
193
- /** Whether the transaction was broadcast (to Horizon or the SEP-7 callback). */
194
- submitted: boolean;
195
- /** Raw Horizon (or callback) response, when submitted. */
196
- response?: unknown;
197
- }
198
- /**
199
- * A Stellar SDK module, structurally typed to just the surface the web client
200
- * uses. Pass `@stellar/stellar-sdk` (or a compatible build) via
201
- * `new WebClient({ stellarSdk })`, or install it and let the client import it.
202
- */
203
- interface StellarSdkLike {
204
- TransactionBuilder: any;
205
- Account: any;
206
- Operation: any;
207
- Asset: any;
208
- Memo: any;
209
- BASE_FEE?: string;
210
- Networks?: Record<string, string>;
211
- Horizon?: {
212
- Server: any;
213
- };
214
- Server?: any;
215
- [key: string]: any;
216
- }
8
+ export { A as AddressBook, a as AddressRef, C as CosmosPayAPIError, b as CosmosPayRequestError, R as ResolvableIntentInput, c as addresses, d as assertAddress, i as isAddress, e as isContractAddress, f as isMuxedAddress, g as isStellarAddress, r as resolveAddress, h as resolveIntentBody } from '../intent-input-BybnwL83.js';
217
9
 
218
10
  /**
219
11
  * Freighter — https://www.freighter.app
@@ -399,43 +191,6 @@ declare class CosmosWalletAdapter implements WalletAdapter {
399
191
  signTransaction(xdr: string, params: SignParams): Promise<string>;
400
192
  }
401
193
 
402
- /**
403
- * Built-in wallet adapters and the default registration set.
404
- *
405
- * Auto-detection order (first available wins): Freighter → xBull → Rabet →
406
- * LOBSTR → Albedo → Cosmos Pay Wallet. Freighter, xBull and Rabet inject browser globals so they're
407
- * detected with zero configuration; LOBSTR and Albedo need their library passed
408
- * in (no reliable global), so they only activate when injected.
409
- */
410
-
411
- /**
412
- * Optional wallet libraries to enable wallets that have no auto-detectable
413
- * global (LOBSTR, Albedo) or to use a non-extension transport (xBull web-app
414
- * bridge). Everything here is optional — extension wallets need nothing.
415
- */
416
- interface InjectedWallets {
417
- /** An `@stellar/freighter-api` module (otherwise `window.freighterApi`). */
418
- freighter?: any;
419
- /** An xBull SDK instance (otherwise `window.xBullSDK`). */
420
- xBull?: any;
421
- /** A Rabet provider (otherwise `window.rabet`). */
422
- rabet?: any;
423
- /** An `@albedo-link/intent` module/global (otherwise `window.albedo`). */
424
- albedo?: any;
425
- /** A `@lobstrco/signer-extension-api` module. */
426
- lobstr?: any;
427
- /**
428
- * A Cosmos Pay Wallet provider, or `{ walletUrl }` to reach the HOSTED wallet when
429
- * the extension is absent (otherwise `window.cosmosWallet`).
430
- */
431
- cosmos?: CosmosWalletProvider | CosmosProviderOptions;
432
- }
433
- /**
434
- * Build the default adapter set, honoring any injected wallet libraries. The
435
- * order here is the auto-detection priority.
436
- */
437
- declare function defaultAdapters(injected?: InjectedWallets): WalletAdapter[];
438
-
439
194
  /**
440
195
  * Registry + auto-detection for wallet adapters.
441
196
  *
@@ -717,46 +472,6 @@ declare function submitToHorizon(sdk: StellarSdkLike, network: NetworkConfig, si
717
472
  */
718
473
  declare function postToCallback(callback: string, signedXdr: string, fetchFn?: typeof fetch): Promise<unknown>;
719
474
 
720
- /**
721
- * Errors surfaced by the browser ("web client") side of the SDK.
722
- *
723
- * These are intentionally kept separate from the server-side
724
- * {@link CosmosPayAPIError}/{@link CosmosPayRequestError} so that bundling the
725
- * web entry never pulls in Node-only code paths. They all extend
726
- * {@link CosmosPayWebError} so a consumer can `catch (e) { if (e instanceof
727
- * CosmosPayWebError) ... }`.
728
- */
729
- /** Base class for every error thrown by `@cosmosapp/pay_sdk/web`. */
730
- declare class CosmosPayWebError extends Error {
731
- constructor(message: string);
732
- }
733
- /** No compatible Stellar wallet could be detected in the current environment. */
734
- declare class WalletNotFoundError extends CosmosPayWebError {
735
- /** Ids of the wallets that were searched for. */
736
- readonly searched: string[];
737
- constructor(searched: string[]);
738
- }
739
- /** A wallet was found but the operation failed (user rejected, locked, etc.). */
740
- declare class WalletError extends CosmosPayWebError {
741
- /** Id of the wallet that produced the error (e.g. `freighter`). */
742
- readonly wallet: string;
743
- /** The underlying error, if any. */
744
- readonly cause: unknown;
745
- constructor(wallet: string, message: string, cause?: unknown);
746
- }
747
- /**
748
- * Building a `pay` transaction (or submitting to Horizon) requires the Stellar
749
- * SDK, which is an optional peer dependency. Thrown when it is neither installed
750
- * nor injected.
751
- */
752
- declare class StellarSdkRequiredError extends CosmosPayWebError {
753
- constructor(detail?: string);
754
- }
755
- /** The intent / SEP-7 request could not be interpreted or is missing data. */
756
- declare class IntentError extends CosmosPayWebError {
757
- constructor(message: string);
758
- }
759
-
760
475
  /**
761
476
  * A tiny, browser-safe HTTP layer for the web client.
762
477
  *
@@ -801,5 +516,5 @@ declare class WebREST {
801
516
  request<T>(method: string, path: string, options?: WebRequestOptions): Promise<T>;
802
517
  }
803
518
 
804
- export { AlbedoAdapter, CosmosPayWebError, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, IntentError, LobstrAdapter, PASSPHRASES, PaymentIntentData, RabetAdapter, StellarSdkRequiredError, WalletError, WalletId, WalletNotFoundError, WalletRegistry, WebClient, WebREST, XBullAdapter, buildPaymentXdr, classifyNetwork, defaultAdapters, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
805
- export type { BuildPaymentInput, ConnectResult, InjectedWallets, NetworkConfig, NormalizedIntent, PayOptions, PayResult, PayableInput, ResolveNetworkInput, Sep7Request, SignParams, StellarNetwork, StellarSdkLike, WalletAdapter, WalletInfo, WebClientOptions, WebRESTOptions, WebRequestOptions };
519
+ export { AlbedoAdapter, ConnectResult, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, InjectedWallets, LobstrAdapter, NetworkConfig, NormalizedIntent, PASSPHRASES, PayOptions, PayResult, PayableInput, PaymentIntentData, RabetAdapter, Sep7Request, SignParams, StellarNetwork, StellarSdkLike, WalletAdapter, WalletId, WalletInfo, WalletRegistry, WebClient, WebREST, XBullAdapter, buildPaymentXdr, classifyNetwork, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
520
+ export type { BuildPaymentInput, ResolveNetworkInput, WebClientOptions, WebRESTOptions, WebRequestOptions };