@cosmosapp/pay_sdk 2.0.0 → 2.2.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.
@@ -1,7 +1,8 @@
1
- import { bG as WalletId, an as PaymentIntentData, au as CreatePayPaymentIntentOptions, at as CreateTxPaymentIntentOptions, as as ValidationOutcomeData } from '../intent-input-BtUp3tFN.cjs';
2
- export { aW as AddressBook, aX as AddressRef, b1 as AssetDefinition, b2 as AssetRef, b3 as Assets, b7 as CosmosPayAPIError, b8 as CosmosPayRequestError, bB as ResolvableIntentInput, bC as ResolvedAsset, bF as TestnetAssets, bH as Wallets, 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.cjs';
3
- import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-CFASjnd5.cjs';
4
- export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-CFASjnd5.cjs';
1
+ import { c0 as WalletId, aB as PaymentIntentData } from '../intent-input-GiCgpAWR.cjs';
2
+ import { CreatePayPaymentIntentOptions, CreateTxPaymentIntentOptions, ValidationOutcomeData } from '../index.cjs';
3
+ export { bh as AddressBook, bi as AddressRef, bp as AssetDefinition, bq as AssetRef, br as Assets, bx as CosmosPayAPIError, by as CosmosPayRequestError, bX as ResolvableIntentInput, bY as ResolvedAsset, b$ as TestnetAssets, c1 as Wallets, c4 as addresses, c5 as assertAddress, c6 as defineAsset, c7 as isAddress, c8 as isContractAddress, c9 as isMuxedAddress, ca as isNativeAsset, cb as isStellarAddress, cc as resolveAddress, cd as resolveAsset, ce as resolveIntentBody } from '../intent-input-GiCgpAWR.cjs';
4
+ import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-DTz0Y8xZ.cjs';
5
+ export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-DTz0Y8xZ.cjs';
5
6
 
6
7
  /**
7
8
  * Types for the browser ("web client") side of the SDK.
@@ -800,4 +801,5 @@ declare class WebREST {
800
801
  request<T>(method: string, path: string, options?: WebRequestOptions): Promise<T>;
801
802
  }
802
803
 
803
- export { AlbedoAdapter, type BuildPaymentInput, type ConnectResult, CosmosPayWebError, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, type InjectedWallets, IntentError, LobstrAdapter, type NetworkConfig, type NormalizedIntent, PASSPHRASES, type PayOptions, type PayResult, type PayableInput, PaymentIntentData, RabetAdapter, type ResolveNetworkInput, type Sep7Request, type SignParams, type StellarNetwork, type StellarSdkLike, StellarSdkRequiredError, type WalletAdapter, WalletError, WalletId, type WalletInfo, WalletNotFoundError, WalletRegistry, WebClient, type WebClientOptions, WebREST, type WebRESTOptions, type WebRequestOptions, XBullAdapter, buildPaymentXdr, classifyNetwork, defaultAdapters, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
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 };
@@ -1,7 +1,8 @@
1
- import { bG as WalletId, an as PaymentIntentData, au as CreatePayPaymentIntentOptions, at as CreateTxPaymentIntentOptions, as as ValidationOutcomeData } from '../intent-input-BtUp3tFN.js';
2
- export { aW as AddressBook, aX as AddressRef, b1 as AssetDefinition, b2 as AssetRef, b3 as Assets, b7 as CosmosPayAPIError, b8 as CosmosPayRequestError, bB as ResolvableIntentInput, bC as ResolvedAsset, bF as TestnetAssets, bH as Wallets, 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';
3
- import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-CFASjnd5.js';
4
- export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-CFASjnd5.js';
1
+ import { c0 as WalletId, aB as PaymentIntentData } from '../intent-input-GiCgpAWR.js';
2
+ import { CreatePayPaymentIntentOptions, CreateTxPaymentIntentOptions, ValidationOutcomeData } from '../index.js';
3
+ export { bh as AddressBook, bi as AddressRef, bp as AssetDefinition, bq as AssetRef, br as Assets, bx as CosmosPayAPIError, by as CosmosPayRequestError, bX as ResolvableIntentInput, bY as ResolvedAsset, b$ as TestnetAssets, c1 as Wallets, c4 as addresses, c5 as assertAddress, c6 as defineAsset, c7 as isAddress, c8 as isContractAddress, c9 as isMuxedAddress, ca as isNativeAsset, cb as isStellarAddress, cc as resolveAddress, cd as resolveAsset, ce as resolveIntentBody } from '../intent-input-GiCgpAWR.js';
4
+ import { C as CosmosProviderOptions, a as CosmosWalletProvider } from '../cosmosProvider-DTz0Y8xZ.js';
5
+ export { i as injectedProvider, l as loadHostedProvider, r as resetProviderCache, b as resolveProvider } from '../cosmosProvider-DTz0Y8xZ.js';
5
6
 
6
7
  /**
7
8
  * Types for the browser ("web client") side of the SDK.
@@ -800,4 +801,5 @@ declare class WebREST {
800
801
  request<T>(method: string, path: string, options?: WebRequestOptions): Promise<T>;
801
802
  }
802
803
 
803
- export { AlbedoAdapter, type BuildPaymentInput, type ConnectResult, CosmosPayWebError, CosmosProviderOptions, CosmosWalletAdapter, CosmosWalletProvider, FreighterAdapter, HORIZON_URLS, type InjectedWallets, IntentError, LobstrAdapter, type NetworkConfig, type NormalizedIntent, PASSPHRASES, type PayOptions, type PayResult, type PayableInput, PaymentIntentData, RabetAdapter, type ResolveNetworkInput, type Sep7Request, type SignParams, type StellarNetwork, type StellarSdkLike, StellarSdkRequiredError, type WalletAdapter, WalletError, WalletId, type WalletInfo, WalletNotFoundError, WalletRegistry, WebClient, type WebClientOptions, WebREST, type WebRESTOptions, type WebRequestOptions, XBullAdapter, buildPaymentXdr, classifyNetwork, defaultAdapters, isPassphrase, isSep7Uri, loadStellarSdk, normalizeIntent, parseSep7, postToCallback, resolveNetwork, submitToHorizon, transactionHash };
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 };
package/dist/web/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { version, CosmosPayAPIError, CosmosPayRequestError, DEFAULT_BASE_URL, resolveIntentBody } from '../chunk-TM4HAKWE.js';
2
- export { AddressBook, Assets, CosmosPayAPIError, CosmosPayRequestError, TestnetAssets, Wallets, addresses, assertAddress, defineAsset, isAddress, isContractAddress, isMuxedAddress, isNativeAsset, isStellarAddress, resolveAddress, resolveAsset, resolveIntentBody } from '../chunk-TM4HAKWE.js';
1
+ import { version, CosmosPayAPIError, CosmosPayRequestError, DEFAULT_BASE_URL, resolveIntentBody } from '../chunk-AQEHMCJZ.js';
2
+ export { AddressBook, Assets, CosmosPayAPIError, CosmosPayRequestError, TestnetAssets, Wallets, addresses, assertAddress, defineAsset, isAddress, isContractAddress, isMuxedAddress, isNativeAsset, isStellarAddress, resolveAddress, resolveAsset, resolveIntentBody } from '../chunk-AQEHMCJZ.js';
3
3
  import { injectedProvider, resolveProvider } from '../chunk-AYVWYEOK.js';
4
4
  export { injectedProvider, loadHostedProvider, resetProviderCache, resolveProvider } from '../chunk-AYVWYEOK.js';
5
5
 
@@ -1,11 +1,12 @@
1
1
  # Payment intents
2
2
 
3
- `client.paymentIntents` — Stellar SEP-7 intents. Two kinds:
3
+ `client.paymentIntents` — payment intents on Stellar, Solana and Monad. Two kinds:
4
4
 
5
5
  - **`pay` intent** — no source. The payer's wallet picks the source account.
6
- Produces a `web+stellar:pay?...` URI + QR (no XDR).
7
- - **`tx` intent** — source known. Produces an unsigned XDR + `web+stellar:tx?...`
8
- URI + QR.
6
+ Produces a payment link + QR (no XDR): `web+stellar:pay?...` on Stellar (the default),
7
+ a Solana Pay link with `chain: 'solana'`, an EIP-681 link with `chain: 'monad'`.
8
+ - **`tx` intent** — source known (Stellar only). Produces an unsigned XDR +
9
+ `web+stellar:tx?...` URI + QR.
9
10
 
10
11
  ## Create
11
12
 
@@ -28,6 +29,16 @@ const pay = await client.paymentIntents.createPay({
28
29
  callback: 'url:https://...', // optional SEP-7 callback for the signed XDR
29
30
  });
30
31
 
32
+ // pay on Solana or Monad: name the chain; the destination is an address on that chain
33
+ const sol = await client.paymentIntents.createPay({
34
+ chain: 'solana', // 'stellar' (default) | 'solana' | 'monad'
35
+ destination: '7xKX...', // Solana address (Monad: 0x...)
36
+ amount: '25', // required on Monad
37
+ assetCode: 'USDC', // a token by code + issuer (SPL mint / ERC-20 contract)
38
+ assetIssuer: 'EPjF...Dt1v',
39
+ });
40
+ console.log(sol.chain, sol.uri); // 'solana', 'solana:...'
41
+
31
42
  // tx (source known)
32
43
  const tx = await client.paymentIntents.createTx({
33
44
  source: 'G...PAYER', // required (extra vs pay)
@@ -47,6 +58,8 @@ const intent = await client.paymentIntents.fetch('pi_123');
47
58
 
48
59
  const page = await client.paymentIntents.list({
49
60
  status: 'SUCCEEDED', // optional filter (PaymentIntentStatus)
61
+ chain: 'solana', // optional: 'stellar' | 'solana' | 'monad'
62
+ createdFrom: new Date('2026-11-01'), // optional: created at or after (Date or ISO 8601)
50
63
  take: 50, // page size, max 100, default 20
51
64
  skip: 0, // offset
52
65
  });
@@ -76,8 +89,8 @@ server-side, and fires the webhook.
76
89
 
77
90
  ## Structure accessors (on a `PaymentIntent`)
78
91
 
79
- `id`, `kind`, `status`, `network`, `source`, `destination`, `amount`, `asset`,
92
+ `id`, `kind`, `status`, `chain`, `network`, `source`, `destination`, `amount`, `asset`,
80
93
  `assetIssuer`, `memo`, `msg`, `callback`, `xdr`, `uri`, `qr`, `txHash`,
81
94
  `reference`, `createdAt`, `updatedAt`. Helpers: `isTx`, `isPay`, `isSucceeded`,
82
- `isPending`, `assetLabel` (`'XLM'` for native). Methods: `fetch()`, `edit()`,
95
+ `isPending`, `assetLabel` (the chain's coin for native: `'XLM'`, `'SOL'` or `'MON'`). Methods: `fetch()`, `edit()`,
83
96
  `validate(txHash)`, `cancel()`, `delete()`, `toJSON()`.
@@ -0,0 +1,58 @@
1
+ # Swaps
2
+
3
+ Two managers, split by whether the swap leaves its chain.
4
+
5
+ **Same chain — `client.swaps`.** No `chain` (or `'stellar'`) is a Stellar path
6
+ payment and yields a `Swap`, exactly as before. `chain: 'solana'` goes through
7
+ Jupiter and `chain: 'monad'` through Kuru Flow — aggregators that route across
8
+ every liquidity source on their chain — and yields a `ChainSwap`. Both are
9
+ non-custodial: the wallet signs, the server checks it is the transaction it
10
+ built, then broadcasts it. Solana and Monad are mainnet only (a `dev` key gets
11
+ `400 network_unsupported`).
12
+
13
+ ```ts
14
+ // Stellar: unchanged
15
+ const swap = await client.swaps.create({
16
+ amount: '100', destAssetCode: 'USDC', destAssetIssuer: 'GA5Z…', source: 'G…',
17
+ });
18
+ await swap.submit({ signedXdr });
19
+
20
+ // Solana (Jupiter): sign `transaction.data` (base64 VersionedTransaction)
21
+ const sol = await client.swaps.create({
22
+ chain: 'solana', amount: '0.1', sourceAssetCode: 'SOL',
23
+ destAssetCode: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', source: solanaWallet,
24
+ });
25
+ await sol.submit({ signedTransaction });
26
+
27
+ // Monad (Kuru Flow): sign `transaction` ({ to, data, value, chainId }) as EIP-1559.
28
+ // Selling an ERC-20 with a short allowance: send `approval` first.
29
+ const mon = await client.swaps.create({ chain: 'monad', amount: '10', sourceAssetCode: 'MON',
30
+ destAssetCode: '0x754704bc059f8c67012fed69bc8a327a5aafb603', source: evmWallet });
31
+ if (mon.approval) await wallet.sendTransaction(mon.approval);
32
+
33
+ const page = await client.swaps.list({ chain: 'solana' }); // ChainSwap[]
34
+ ```
35
+
36
+ The commission is the organization plan's, enforced by the server — never a
37
+ parameter. On Stellar it comes out of the input; on Solana and Monad, out of the
38
+ output (`fee.asset` in the quote says which).
39
+
40
+ **Between chains — `client.crossChainSwaps`.** Stellar ⇄ Solana ⇄ Monad, settled
41
+ by NEAR Intents. You get a deposit address (and, on Stellar, a memo to attach as
42
+ a MEMO_TEXT); NEAR Intents pays the recipient on the other chain or refunds.
43
+
44
+ ```ts
45
+ const assets = await client.crossChainSwaps.assets();
46
+ const x = await client.crossChainSwaps.create({
47
+ originChain: 'stellar', originAsset: 'XLM', amount: '100',
48
+ destinationChain: 'solana', destinationAsset: 'USDC',
49
+ recipient: solanaWallet, refundTo: stellarWallet,
50
+ });
51
+ // pay x.amountIn to x.depositAddress (memo x.depositMemo) — or open x.depositUri / x.qr
52
+ await x.reportDeposit(txHash); // optional: starts it without waiting for the indexer
53
+ await x.fetch(); // x.status: AWAITING_DEPOSIT → … → SUCCEEDED | REFUNDED | FAILED
54
+ ```
55
+
56
+ Keep `x.quoteSignature`: it is NEAR Intents' signature over the quote, what
57
+ settles a dispute. Webhooks: `SWAP_*` for both same-chain managers,
58
+ `CROSS_CHAIN_SWAP_*` here — `client.webhooks.on('crossChainSwapSucceeded', …)`.
@@ -260,12 +260,13 @@ e.g. `intent.isPay`, `intent.assetLabel`, `await intent.validate(txHash)`,
260
260
 
261
261
  # Payment intents
262
262
 
263
- `client.paymentIntents` — Stellar SEP-7 intents. Two kinds:
263
+ `client.paymentIntents` — payment intents on Stellar, Solana and Monad. Two kinds:
264
264
 
265
265
  - **`pay` intent** — no source. The payer's wallet picks the source account.
266
- Produces a `web+stellar:pay?...` URI + QR (no XDR).
267
- - **`tx` intent** — source known. Produces an unsigned XDR + `web+stellar:tx?...`
268
- URI + QR.
266
+ Produces a payment link + QR (no XDR): `web+stellar:pay?...` on Stellar (the default),
267
+ a Solana Pay link with `chain: 'solana'`, an EIP-681 link with `chain: 'monad'`.
268
+ - **`tx` intent** — source known (Stellar only). Produces an unsigned XDR +
269
+ `web+stellar:tx?...` URI + QR.
269
270
 
270
271
  ## Create
271
272
 
@@ -288,6 +289,16 @@ const pay = await client.paymentIntents.createPay({
288
289
  callback: 'url:https://...', // optional SEP-7 callback for the signed XDR
289
290
  });
290
291
 
292
+ // pay on Solana or Monad: name the chain; the destination is an address on that chain
293
+ const sol = await client.paymentIntents.createPay({
294
+ chain: 'solana', // 'stellar' (default) | 'solana' | 'monad'
295
+ destination: '7xKX...', // Solana address (Monad: 0x...)
296
+ amount: '25', // required on Monad
297
+ assetCode: 'USDC', // a token by code + issuer (SPL mint / ERC-20 contract)
298
+ assetIssuer: 'EPjF...Dt1v',
299
+ });
300
+ console.log(sol.chain, sol.uri); // 'solana', 'solana:...'
301
+
291
302
  // tx (source known)
292
303
  const tx = await client.paymentIntents.createTx({
293
304
  source: 'G...PAYER', // required (extra vs pay)
@@ -307,6 +318,8 @@ const intent = await client.paymentIntents.fetch('pi_123');
307
318
 
308
319
  const page = await client.paymentIntents.list({
309
320
  status: 'SUCCEEDED', // optional filter (PaymentIntentStatus)
321
+ chain: 'solana', // optional: 'stellar' | 'solana' | 'monad'
322
+ createdFrom: new Date('2026-11-01'), // optional: created at or after (Date or ISO 8601)
310
323
  take: 50, // page size, max 100, default 20
311
324
  skip: 0, // offset
312
325
  });
@@ -336,10 +349,10 @@ server-side, and fires the webhook.
336
349
 
337
350
  ## Structure accessors (on a `PaymentIntent`)
338
351
 
339
- `id`, `kind`, `status`, `network`, `source`, `destination`, `amount`, `asset`,
352
+ `id`, `kind`, `status`, `chain`, `network`, `source`, `destination`, `amount`, `asset`,
340
353
  `assetIssuer`, `memo`, `msg`, `callback`, `xdr`, `uri`, `qr`, `txHash`,
341
354
  `reference`, `createdAt`, `updatedAt`. Helpers: `isTx`, `isPay`, `isSucceeded`,
342
- `isPending`, `assetLabel` (`'XLM'` for native). Methods: `fetch()`, `edit()`,
355
+ `isPending`, `assetLabel` (the chain's coin for native: `'XLM'`, `'SOL'` or `'MON'`). Methods: `fetch()`, `edit()`,
343
356
  `validate(txHash)`, `cancel()`, `delete()`, `toJSON()`.
344
357
 
345
358
  ---
@@ -985,3 +998,64 @@ const product = await client.products.create({ name: 'Pro', amount: '49.00', ass
985
998
  const customer = await client.customers.create({ name: 'Acme', email: 'billing@acme.com', account: 'G...' });
986
999
  // then create intents referencing the customer's account as destination/source.
987
1000
  ```
1001
+
1002
+ ---
1003
+
1004
+ # Swaps
1005
+
1006
+ Two managers, split by whether the swap leaves its chain.
1007
+
1008
+ **Same chain — `client.swaps`.** No `chain` (or `'stellar'`) is a Stellar path
1009
+ payment and yields a `Swap`, exactly as before. `chain: 'solana'` goes through
1010
+ Jupiter and `chain: 'monad'` through Kuru Flow — aggregators that route across
1011
+ every liquidity source on their chain — and yields a `ChainSwap`. Both are
1012
+ non-custodial: the wallet signs, the server checks it is the transaction it
1013
+ built, then broadcasts it. Solana and Monad are mainnet only (a `dev` key gets
1014
+ `400 network_unsupported`).
1015
+
1016
+ ```ts
1017
+ // Stellar: unchanged
1018
+ const swap = await client.swaps.create({
1019
+ amount: '100', destAssetCode: 'USDC', destAssetIssuer: 'GA5Z…', source: 'G…',
1020
+ });
1021
+ await swap.submit({ signedXdr });
1022
+
1023
+ // Solana (Jupiter): sign `transaction.data` (base64 VersionedTransaction)
1024
+ const sol = await client.swaps.create({
1025
+ chain: 'solana', amount: '0.1', sourceAssetCode: 'SOL',
1026
+ destAssetCode: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', source: solanaWallet,
1027
+ });
1028
+ await sol.submit({ signedTransaction });
1029
+
1030
+ // Monad (Kuru Flow): sign `transaction` ({ to, data, value, chainId }) as EIP-1559.
1031
+ // Selling an ERC-20 with a short allowance: send `approval` first.
1032
+ const mon = await client.swaps.create({ chain: 'monad', amount: '10', sourceAssetCode: 'MON',
1033
+ destAssetCode: '0x754704bc059f8c67012fed69bc8a327a5aafb603', source: evmWallet });
1034
+ if (mon.approval) await wallet.sendTransaction(mon.approval);
1035
+
1036
+ const page = await client.swaps.list({ chain: 'solana' }); // ChainSwap[]
1037
+ ```
1038
+
1039
+ The commission is the organization plan's, enforced by the server — never a
1040
+ parameter. On Stellar it comes out of the input; on Solana and Monad, out of the
1041
+ output (`fee.asset` in the quote says which).
1042
+
1043
+ **Between chains — `client.crossChainSwaps`.** Stellar ⇄ Solana ⇄ Monad, settled
1044
+ by NEAR Intents. You get a deposit address (and, on Stellar, a memo to attach as
1045
+ a MEMO_TEXT); NEAR Intents pays the recipient on the other chain or refunds.
1046
+
1047
+ ```ts
1048
+ const assets = await client.crossChainSwaps.assets();
1049
+ const x = await client.crossChainSwaps.create({
1050
+ originChain: 'stellar', originAsset: 'XLM', amount: '100',
1051
+ destinationChain: 'solana', destinationAsset: 'USDC',
1052
+ recipient: solanaWallet, refundTo: stellarWallet,
1053
+ });
1054
+ // pay x.amountIn to x.depositAddress (memo x.depositMemo) — or open x.depositUri / x.qr
1055
+ await x.reportDeposit(txHash); // optional: starts it without waiting for the indexer
1056
+ await x.fetch(); // x.status: AWAITING_DEPOSIT → … → SUCCEEDED | REFUNDED | FAILED
1057
+ ```
1058
+
1059
+ Keep `x.quoteSignature`: it is NEAR Intents' signature over the quote, what
1060
+ settles a dispute. Webhooks: `SWAP_*` for both same-chain managers,
1061
+ `CROSS_CHAIN_SWAP_*` here — `client.webhooks.on('crossChainSwapSucceeded', …)`.
package/llms/llms.txt CHANGED
@@ -35,6 +35,7 @@ The files below are atomic and self-contained — read the ones relevant to the
35
35
  ## Recipes
36
36
 
37
37
  - [Recipes](./14-recipes.md): checkout, donations, idempotent webhooks, reconciliation, testnet/mainnet
38
+ - [Swaps](./15-swaps.md): same-chain swaps (Stellar DEX, Jupiter on Solana, Kuru Flow on Monad) and cross-chain swaps (NEAR Intents)
38
39
 
39
40
  ## Optional
40
41
 
package/package.json CHANGED
@@ -1,26 +1,33 @@
1
1
  {
2
2
  "name": "@cosmosapp/pay_sdk",
3
- "version": "2.0.0",
4
- "description": "A powerful, object-oriented JavaScript/TypeScript SDK for the Cosmos Pay Payments API — server SDK (Stellar SEP-7 payment intents, webhooks, products, customers, analytics) plus a browser web client that auto-detects Freighter, xBull, Rabet, LOBSTR & Albedo wallets and signs transactions for you.",
3
+ "version": "2.2.0",
4
+ "description": "Official SDK for Cosmos Pay, the stablecoin payments API for Stellar, Solana and Monad: payment intents and checkout, webhooks, swaps (same-chain and cross-chain), fiat ramps, products and customers. Payment intents are Stellar SEP-7; Solana and Monad intents use the REST API. Includes a browser client for Stellar wallets.",
5
5
  "keywords": [
6
- "cosmos",
7
6
  "cosmos-pay",
8
- "stellar",
9
- "sep-7",
7
+ "cosmos",
10
8
  "payments",
9
+ "stablecoin",
10
+ "usdc",
11
+ "crypto-payments",
12
+ "payment-api",
13
+ "payment-links",
14
+ "checkout",
11
15
  "payment-intents",
12
16
  "webhooks",
17
+ "swaps",
18
+ "cross-chain",
19
+ "stellar",
20
+ "solana",
21
+ "monad",
22
+ "sep-7",
13
23
  "sdk",
14
- "api",
15
- "client",
16
24
  "typescript",
17
25
  "wallet",
18
26
  "freighter",
19
27
  "xbull",
20
28
  "albedo",
21
29
  "rabet",
22
- "lobstr",
23
- "browser"
30
+ "lobstr"
24
31
  ],
25
32
  "license": "Apache-2.0",
26
33
  "author": "Cosmos Pay",
@@ -31,7 +38,7 @@
31
38
  "bugs": {
32
39
  "url": "https://github.com/CosmosPay/CosmosJS_SDK/issues"
33
40
  },
34
- "homepage": "https://github.com/CosmosPay/CosmosJS_SDK#readme",
41
+ "homepage": "https://dev.cosmospay.lat/docs/sdk/server/overview",
35
42
  "type": "module",
36
43
  "main": "./dist/index.cjs",
37
44
  "module": "./dist/index.js",
@@ -85,18 +92,20 @@
85
92
  "dev": "tsup --watch",
86
93
  "typecheck": "tsc --noEmit",
87
94
  "pretest": "npm run build",
88
- "test": "node --test test/client.test.mjs test/rest.test.mjs test/payment-intents.test.mjs test/swaps.test.mjs test/webhooks.test.mjs test/structures.test.mjs test/web.test.mjs test/catalogs.test.mjs test/cosmos-wallet.test.mjs test/liquidity.test.mjs test/ramps.test.mjs test/kyc-pollar.test.mjs",
89
- "test:watch": "node --test --watch test/client.test.mjs test/rest.test.mjs test/payment-intents.test.mjs test/swaps.test.mjs test/webhooks.test.mjs test/structures.test.mjs test/web.test.mjs test/catalogs.test.mjs test/cosmos-wallet.test.mjs test/liquidity.test.mjs test/ramps.test.mjs test/kyc-pollar.test.mjs",
95
+ "test": "node --test test/client.test.mjs test/rest.test.mjs test/payment-intents.test.mjs test/swaps.test.mjs test/webhooks.test.mjs test/structures.test.mjs test/web.test.mjs test/catalogs.test.mjs test/cosmos-wallet.test.mjs test/liquidity.test.mjs test/ramps.test.mjs test/kyc.test.mjs test/aliases-assets.test.mjs test/cross-chain-swaps.test.mjs test/extensions.test.mjs test/openapi.test.mjs",
96
+ "test:watch": "node --test --watch test/client.test.mjs test/rest.test.mjs test/payment-intents.test.mjs test/swaps.test.mjs test/webhooks.test.mjs test/structures.test.mjs test/web.test.mjs test/catalogs.test.mjs test/cosmos-wallet.test.mjs test/liquidity.test.mjs test/ramps.test.mjs test/kyc.test.mjs test/aliases-assets.test.mjs test/cross-chain-swaps.test.mjs test/extensions.test.mjs test/openapi.test.mjs",
90
97
  "prepublishOnly": "npm run build",
91
98
  "changelog": "npx --yes git-cliff@2 -o CHANGELOG.md",
92
99
  "llms": "node scripts/build-llms.mjs",
93
- "clean": "rimraf dist"
100
+ "clean": "rimraf dist",
101
+ "openapi:sync": "node scripts/sync-openapi.mjs",
102
+ "openapi:check": "node scripts/sync-openapi.mjs --check"
94
103
  },
95
104
  "devDependencies": {
96
- "@types/node": "^26.4.1",
105
+ "@types/node": "^26.6.5",
97
106
  "rimraf": "^6.1.3",
98
107
  "semver": "^7.8.5",
99
- "tsup": "^8.5.1",
108
+ "tsup": "^9.0.0",
100
109
  "typescript": "^5.9.3"
101
110
  },
102
111
  "peerDependencies": {