@lendasat/lendaswap-sdk-pure 0.0.1 → 0.0.3

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 (129) hide show
  1. package/README.md +91 -19
  2. package/dist/api/client.d.ts +15 -18
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/arkade.d.ts +36 -0
  6. package/dist/arkade.d.ts.map +1 -0
  7. package/dist/arkade.js +68 -0
  8. package/dist/arkade.js.map +1 -0
  9. package/dist/client.d.ts +295 -120
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js +1243 -274
  12. package/dist/client.js.map +1 -1
  13. package/dist/create/arkade.d.ts +13 -7
  14. package/dist/create/arkade.d.ts.map +1 -1
  15. package/dist/create/arkade.js +46 -53
  16. package/dist/create/arkade.js.map +1 -1
  17. package/dist/create/bitcoin-to-arkade.d.ts +36 -0
  18. package/dist/create/bitcoin-to-arkade.d.ts.map +1 -0
  19. package/dist/create/bitcoin-to-arkade.js +69 -0
  20. package/dist/create/bitcoin-to-arkade.js.map +1 -0
  21. package/dist/create/bitcoin.d.ts +6 -3
  22. package/dist/create/bitcoin.d.ts.map +1 -1
  23. package/dist/create/bitcoin.js +34 -48
  24. package/dist/create/bitcoin.js.map +1 -1
  25. package/dist/create/evm-to-arkade.d.ts +12 -13
  26. package/dist/create/evm-to-arkade.d.ts.map +1 -1
  27. package/dist/create/evm-to-arkade.js +38 -59
  28. package/dist/create/evm-to-arkade.js.map +1 -1
  29. package/dist/create/evm-to-bitcoin.d.ts +35 -0
  30. package/dist/create/evm-to-bitcoin.d.ts.map +1 -0
  31. package/dist/create/evm-to-bitcoin.js +71 -0
  32. package/dist/create/evm-to-bitcoin.js.map +1 -0
  33. package/dist/create/evm-to-lightning.d.ts +12 -12
  34. package/dist/create/evm-to-lightning.d.ts.map +1 -1
  35. package/dist/create/evm-to-lightning.js +33 -50
  36. package/dist/create/evm-to-lightning.js.map +1 -1
  37. package/dist/create/index.d.ts +7 -5
  38. package/dist/create/index.d.ts.map +1 -1
  39. package/dist/create/index.js +6 -4
  40. package/dist/create/index.js.map +1 -1
  41. package/dist/create/lightning.d.ts +11 -8
  42. package/dist/create/lightning.d.ts.map +1 -1
  43. package/dist/create/lightning.js +36 -45
  44. package/dist/create/lightning.js.map +1 -1
  45. package/dist/create/types.d.ts +166 -29
  46. package/dist/create/types.d.ts.map +1 -1
  47. package/dist/delegate.d.ts +62 -0
  48. package/dist/delegate.d.ts.map +1 -0
  49. package/dist/delegate.js +284 -0
  50. package/dist/delegate.js.map +1 -0
  51. package/dist/esplora.d.ts +18 -15
  52. package/dist/esplora.d.ts.map +1 -1
  53. package/dist/esplora.js +14 -13
  54. package/dist/esplora.js.map +1 -1
  55. package/dist/evm/coordinator.d.ts +247 -0
  56. package/dist/evm/coordinator.d.ts.map +1 -0
  57. package/dist/evm/coordinator.js +414 -0
  58. package/dist/evm/coordinator.js.map +1 -0
  59. package/dist/evm/htlc.d.ts +93 -0
  60. package/dist/evm/htlc.d.ts.map +1 -1
  61. package/dist/evm/htlc.js +91 -0
  62. package/dist/evm/htlc.js.map +1 -1
  63. package/dist/evm/index.d.ts +3 -1
  64. package/dist/evm/index.d.ts.map +1 -1
  65. package/dist/evm/index.js +3 -1
  66. package/dist/evm/index.js.map +1 -1
  67. package/dist/evm/signing.d.ts +30 -0
  68. package/dist/evm/signing.d.ts.map +1 -0
  69. package/dist/evm/signing.js +91 -0
  70. package/dist/evm/signing.js.map +1 -0
  71. package/dist/generated/api.d.ts +1033 -970
  72. package/dist/generated/api.d.ts.map +1 -1
  73. package/dist/index.d.ts +8 -4
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +8 -2
  76. package/dist/index.js.map +1 -1
  77. package/dist/price-calculations.d.ts +109 -0
  78. package/dist/price-calculations.d.ts.map +1 -0
  79. package/dist/price-calculations.js +135 -0
  80. package/dist/price-calculations.js.map +1 -0
  81. package/dist/price-feed.d.ts +124 -0
  82. package/dist/price-feed.d.ts.map +1 -0
  83. package/dist/price-feed.js +178 -0
  84. package/dist/price-feed.js.map +1 -0
  85. package/dist/redeem/arkade.js +2 -2
  86. package/dist/redeem/arkade.js.map +1 -1
  87. package/dist/redeem/ethereum.d.ts +26 -10
  88. package/dist/redeem/ethereum.d.ts.map +1 -1
  89. package/dist/redeem/ethereum.js +111 -26
  90. package/dist/redeem/ethereum.js.map +1 -1
  91. package/dist/redeem/gasless.d.ts +33 -14
  92. package/dist/redeem/gasless.d.ts.map +1 -1
  93. package/dist/redeem/gasless.js +60 -53
  94. package/dist/redeem/gasless.js.map +1 -1
  95. package/dist/redeem/index.d.ts +19 -22
  96. package/dist/redeem/index.d.ts.map +1 -1
  97. package/dist/redeem/index.js +110 -31
  98. package/dist/redeem/index.js.map +1 -1
  99. package/dist/redeem/types.d.ts +56 -4
  100. package/dist/redeem/types.d.ts.map +1 -1
  101. package/dist/redeem/types.js +13 -0
  102. package/dist/redeem/types.js.map +1 -1
  103. package/dist/refund/arkade.js +1 -1
  104. package/dist/refund/arkade.js.map +1 -1
  105. package/dist/refund/index.d.ts +1 -1
  106. package/dist/refund/index.d.ts.map +1 -1
  107. package/dist/refund/index.js +1 -1
  108. package/dist/refund/index.js.map +1 -1
  109. package/dist/refund/onchain.d.ts +54 -0
  110. package/dist/refund/onchain.d.ts.map +1 -1
  111. package/dist/refund/onchain.js +130 -0
  112. package/dist/refund/onchain.js.map +1 -1
  113. package/dist/signer/index.js +1 -1
  114. package/dist/signer/index.js.map +1 -1
  115. package/dist/storage/idb.d.ts +7 -0
  116. package/dist/storage/idb.d.ts.map +1 -1
  117. package/dist/storage/idb.js +89 -1
  118. package/dist/storage/idb.js.map +1 -1
  119. package/dist/storage/types.d.ts +2 -0
  120. package/dist/storage/types.d.ts.map +1 -1
  121. package/dist/tokens.d.ts +29 -0
  122. package/dist/tokens.d.ts.map +1 -0
  123. package/dist/tokens.js +89 -0
  124. package/dist/tokens.js.map +1 -0
  125. package/dist/usd-price.d.ts +83 -0
  126. package/dist/usd-price.d.ts.map +1 -0
  127. package/dist/usd-price.js +166 -0
  128. package/dist/usd-price.js.map +1 -0
  129. package/package.json +6 -1
package/dist/client.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { type ApiClient, type AssetPair, type GetSwapResponse, type QuoteResponse, type TokenInfo } from "./api/client.js";
2
- import { type BitcoinToEvmSwapOptions, type BitcoinToEvmSwapResult, type BtcToEvmSwapOptions, type BtcToEvmSwapResult, type EvmToArkadeSwapOptions, type EvmToArkadeSwapResult, type EvmToLightningSwapOptions, type EvmToLightningSwapResult } from "./create/index.js";
3
- import { type ClaimResult } from "./redeem/index.js";
1
+ import { type ApiClient, type Chain, type GetSwapResponse, type QuoteResponse, type TokenInfos } from "./api/client.js";
2
+ import { type VhtlcAmounts } from "./arkade.js";
3
+ import { type ArkadeToEvmSwapOptions, type ArkadeToEvmSwapResult, type BitcoinToArkadeSwapOptions, type BitcoinToArkadeSwapResult, type BitcoinToEvmSwapOptions, type BitcoinToEvmSwapResult, type CreateSwapOptions, type CreateSwapResult, type EvmToArkadeSwapGenericOptions, type EvmToArkadeSwapGenericResult, type EvmToBitcoinSwapOptions, type EvmToBitcoinSwapResult, type EvmToLightningSwapGenericOptions, type EvmToLightningSwapGenericResult, type LightningToEvmSwapGenericOptions, type LightningToEvmSwapGenericResult } from "./create";
4
+ import { type ClaimGaslessResult, type ClaimResult } from "./redeem/index.js";
4
5
  import { Signer, type SwapParams } from "./signer/index.js";
5
- import { type StoredSwap, type SwapStorage, type WalletStorage } from "./storage/index.js";
6
- export type { BitcoinToEvmSwapOptions, BitcoinToEvmSwapResult, BtcToEvmSwapOptions, BtcToEvmSwapResult, EvmChain, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToLightningSwapOptions, EvmToLightningSwapResult, } from "./create/index.js";
7
- export type { BitcoinToEvmSwapResponse } from "./create/types.js";
8
- export type { ClaimResult, EthereumClaimData } from "./redeem/index.js";
6
+ import { type StoredSwap, type SwapStorage, type WalletStorage } from "./storage";
7
+ export type { ArkadeToEvmSwapOptions, ArkadeToEvmSwapResult, BitcoinToArkadeSwapOptions, BitcoinToArkadeSwapResult, BitcoinToEvmSwapOptions, BitcoinToEvmSwapResponse, BitcoinToEvmSwapResult, BtcToEvmSwapOptions, CreateSwapOptions, CreateSwapResult, EvmChain, EvmToArkadeSwapGenericOptions, EvmToArkadeSwapGenericResult, EvmToArkadeSwapOptions, EvmToArkadeSwapResult, EvmToBitcoinSwapOptions, EvmToBitcoinSwapResult, EvmToLightningSwapOptions, } from "./create/index.js";
8
+ export { buildExecuteAndCreateCalls, buildRedeemCalls, buildRedeemDigest, type CoordinatorCall, type ExecuteAndCreateCallData, type ExecuteAndCreateParams, encodeExecuteAndCreate, encodeRedeemAndExecute, encodeRefundAndExecute, encodeRefundTo, type RedeemAndExecuteCallData, type RedeemAndExecuteParams, type RedeemDigestParams, type RefundAndExecuteParams, type RefundToParams, } from "./evm/index.js";
9
+ export type { ClaimGaslessResult, ClaimResult, CoordinatorClaimData, EthereumClaimData, } from "./redeem/index.js";
9
10
  /** Result of attempting a refund */
10
11
  export interface RefundResult {
11
12
  /** Whether the refund was successful */
@@ -26,6 +27,17 @@ export interface RefundResult {
26
27
  htlcAddress?: string;
27
28
  /** The HTLC address reported by the server (for debugging) */
28
29
  serverHtlcAddress?: string;
30
+ /** EVM refund data (for evm_to_arkade and evm_to_btc swaps) */
31
+ evmRefundData?: {
32
+ /** Address to send the refund transaction to (coordinator or HTLC) */
33
+ to: string;
34
+ /** ABI-encoded calldata for the refund call */
35
+ data: string;
36
+ /** Whether the timelock has already expired (refund is available) */
37
+ timelockExpired: boolean;
38
+ /** Unix timestamp when the timelock expires */
39
+ timelockExpiry: number;
40
+ };
29
41
  }
30
42
  /** Options for on-chain refund */
31
43
  export interface OnchainRefundOptions {
@@ -43,6 +55,17 @@ export interface ArkadeRefundOptions {
43
55
  /** Arkade server URL (optional, uses default based on network) */
44
56
  arkadeServerUrl?: string;
45
57
  }
58
+ /** Options for EVM refund via coordinator */
59
+ export interface EvmRefundOptions {
60
+ /**
61
+ * Refund mode:
62
+ * - "swap-back" (default): Swap WBTC back to original token via DEX
63
+ * - "direct": Return WBTC directly (useful when DEX calldata is stale)
64
+ */
65
+ mode?: "swap-back" | "direct";
66
+ }
67
+ /** General refund options — the method picks the right variant based on swap type */
68
+ export type RefundOptions = OnchainRefundOptions | ArkadeRefundOptions | EvmRefundOptions;
46
69
  /** Options for Arkade (off-chain) claim */
47
70
  export interface ArkadeClaimOptions {
48
71
  /** Destination Arkade address to receive claimed BTC */
@@ -50,6 +73,18 @@ export interface ArkadeClaimOptions {
50
73
  /** Arkade server URL (optional, uses default based on network) */
51
74
  arkadeServerUrl?: string;
52
75
  }
76
+ /** Options for claiming a swap */
77
+ export interface ClaimOptions {
78
+ /**
79
+ * @deprecated For Arkade-to-EVM swaps, the destination is now set at swap creation time
80
+ * and stored on the server. This option is ignored for arkade_to_evm swaps.
81
+ */
82
+ destination?: string;
83
+ /** Bitcoin destination address for EVM-to-Bitcoin claims (required for evm_to_bitcoin direction) */
84
+ destinationAddress?: string;
85
+ /** Fee rate in sat/vB for on-chain Bitcoin claims (default: 2) */
86
+ feeRateSatPerVb?: number;
87
+ }
53
88
  /** Result of getting EVM funding call data */
54
89
  export interface EvmFundingCallData {
55
90
  /** Call data for approving token spend (ERC20 approve) */
@@ -67,6 +102,36 @@ export interface EvmFundingCallData {
67
102
  data: string;
68
103
  };
69
104
  }
105
+ /** Result of getting coordinator funding call data for EVM-to-BTC swaps */
106
+ export interface CoordinatorFundingCallData {
107
+ /** Call data for approving source token spend to the coordinator */
108
+ approve: {
109
+ /** Source token contract address to call */
110
+ to: string;
111
+ /** Encoded approve(coordinator, amount) call data */
112
+ data: string;
113
+ };
114
+ /** Call data for executeAndCreate on the coordinator */
115
+ executeAndCreate: {
116
+ /** Coordinator contract address to call */
117
+ to: string;
118
+ /** Encoded executeAndCreate call data */
119
+ data: string;
120
+ };
121
+ }
122
+ /** Result of getting coordinator refund call data */
123
+ export interface CoordinatorRefundCallData {
124
+ /** Contract address to call */
125
+ to: string;
126
+ /** Encoded refund call data */
127
+ data: string;
128
+ /** Whether the timelock has expired (refund is possible) */
129
+ timelockExpired: boolean;
130
+ /** Unix timestamp when the timelock expires */
131
+ timelockExpiry: number;
132
+ /** Refund mode used */
133
+ mode: "swap-back" | "direct";
134
+ }
70
135
  /** Configuration options for the Lendaswap client. */
71
136
  export interface ClientConfig {
72
137
  /** The base URL of the Lendaswap API. */
@@ -75,6 +140,8 @@ export interface ClientConfig {
75
140
  apiKey?: string;
76
141
  /** Optional Esplora API URL for broadcasting Bitcoin transactions. */
77
142
  esploraUrl?: string;
143
+ /** Optional Arkade server URL (e.g. "https://arkade.computer"). Falls back to network-based defaults. */
144
+ arkadeServerUrl?: string;
78
145
  }
79
146
  /**
80
147
  * Builder for creating a Lendaswap client with a fluent API.
@@ -124,6 +191,17 @@ export declare class ClientBuilder {
124
191
  * @returns The builder instance for chaining.
125
192
  */
126
193
  withEsploraUrl(esploraUrl: string): this;
194
+ /**
195
+ * Sets the Arkade server URL for VHTLC operations (claim, refund, amounts).
196
+ *
197
+ * If not set, defaults are used based on the network:
198
+ * - bitcoin: https://arkade.computer
199
+ * - signet: wa
200
+ *
201
+ * @param arkadeServerUrl - The Arkade server base URL.
202
+ * @returns The builder instance for chaining.
203
+ */
204
+ withArkadeServerUrl(arkadeServerUrl: string): this;
127
205
  /**
128
206
  * Sets the storage backend for signer data (mnemonic and key index).
129
207
  * @param storage - The storage implementation to use.
@@ -218,6 +296,15 @@ export declare class Client {
218
296
  * @returns The BIP39 mnemonic phrase.
219
297
  */
220
298
  getMnemonic(): string;
299
+ /**
300
+ * Loads a mnemonic phrase, replacing the current signer.
301
+ *
302
+ * The new mnemonic is persisted to storage if storage is configured.
303
+ *
304
+ * @param mnemonic - The BIP39 mnemonic phrase to load.
305
+ * @throws Error if the mnemonic is invalid.
306
+ */
307
+ loadMnemonic(mnemonic: string): Promise<void>;
221
308
  /**
222
309
  * Gets the user ID extended public key for wallet recovery.
223
310
  *
@@ -274,26 +361,40 @@ export declare class Client {
274
361
  commit_hash: string;
275
362
  }>;
276
363
  /**
277
- * Gets the list of supported tokens.
278
- * @returns A promise that resolves to an array of token information.
279
- * @throws Error if the request fails.
364
+ * Gets the current Median Time Past (MTP) and tip block height.
365
+ * @returns A promise that resolves to the MTP timestamp and tip height.
366
+ * @throws Error if the request fails or MTP is not yet available.
280
367
  */
281
- getTokens(): Promise<TokenInfo[]>;
368
+ getMtp(): Promise<{
369
+ mtp: number;
370
+ tip_height: number;
371
+ }>;
282
372
  /**
283
- * Gets the list of available asset pairs for swapping.
284
- * @returns A promise that resolves to an array of asset pairs.
373
+ * Gets the list of supported tokens.
374
+ * @returns A promise that resolves to an array of token information.
285
375
  * @throws Error if the request fails.
286
376
  */
287
- getAssetPairs(): Promise<AssetPair[]>;
377
+ getTokens(): Promise<TokenInfos>;
288
378
  /**
289
379
  * Gets a quote for swapping between two tokens.
290
- * @param from - The source token ID (e.g., "btc_arkade", "btc_lightning").
291
- * @param to - The target token ID (e.g., "usdc_pol", "usdt_eth").
292
- * @param baseAmount - The amount to swap in the source token's smallest unit.
380
+ * @param params - Quote parameters.
381
+ * @param params.sourceChain - Source blockchain (e.g., "Arkade", "Polygon").
382
+ * @param params.sourceToken - Source token: contract address for EVM tokens, or "btc" for BTC.
383
+ * @param params.targetChain - Target blockchain (e.g., "Polygon", "Lightning").
384
+ * @param params.targetToken - Target token: contract address for EVM tokens, or "btc" for BTC.
385
+ * @param params.sourceAmount - Amount in smallest unit of source token (mutually exclusive with targetAmount).
386
+ * @param params.targetAmount - Amount in smallest unit of target token (mutually exclusive with sourceAmount).
293
387
  * @returns A promise that resolves to the quote response with pricing details.
294
388
  * @throws Error if the request fails.
295
389
  */
296
- getQuote(from: string, to: string, baseAmount: number): Promise<QuoteResponse>;
390
+ getQuote(params: {
391
+ sourceChain: Chain;
392
+ sourceToken: string;
393
+ targetChain: Chain;
394
+ targetToken: string;
395
+ sourceAmount?: number;
396
+ targetAmount?: number;
397
+ }): Promise<QuoteResponse>;
297
398
  /**
298
399
  * Gets the status and details of a swap by its ID.
299
400
  * @param id - The UUID of the swap.
@@ -325,38 +426,96 @@ export declare class Client {
325
426
  * ```
326
427
  */
327
428
  getStoredSwap(id: string): Promise<StoredSwap | null>;
429
+ /**
430
+ * Gets all stored swaps from local storage.
431
+ *
432
+ * @returns Array of all stored swap data, or empty array if no storage is configured.
433
+ */
434
+ listAllSwaps(): Promise<StoredSwap[]>;
435
+ deleteSwap(id: string): Promise<void>;
436
+ clearSwapStorage(): Promise<void>;
437
+ /**
438
+ * Recovers all swaps associated with the current wallet from the server.
439
+ *
440
+ * Sends the user's xpub to the server, which returns all swaps belonging
441
+ * to that wallet. For each recovered swap, re-derives the keys using the
442
+ * swap's derivation index and stores it locally.
443
+ *
444
+ * After recovery, the key index is set to `highest_index + 1` so that
445
+ * new swaps don't reuse derivation indices.
446
+ *
447
+ * @returns The recovered swaps stored locally.
448
+ */
449
+ recoverSwaps(): Promise<StoredSwap[]>;
450
+ /**
451
+ * Gets VHTLC amounts for an Arkade swap.
452
+ *
453
+ * Queries the Arkade indexer for spendable, spent, and recoverable balances
454
+ * at the VHTLC address associated with a swap. Works for:
455
+ * - BTC → EVM swaps where the source asset is Arkade
456
+ * - EVM → BTC swaps where the target asset is Arkade
457
+ *
458
+ * Reads swap data from local storage (does not contact the server).
459
+ *
460
+ * @param id - The UUID of the swap.
461
+ * @returns The VHTLC amounts in satoshis.
462
+ */
463
+ amountsForSwap(id: string): Promise<VhtlcAmounts>;
328
464
  /**
329
465
  * Claims a swap by revealing the preimage.
330
466
  *
331
467
  * Reads swap data and preimage from local storage. The claim method
332
- * depends on the target chain:
333
- * - **Polygon/Arbitrum**: Uses Gelato Relay for gasless execution
334
- * - **Ethereum**: Returns call data for manual claiming
468
+ * depends on the swap direction and target chain:
469
+ * - **Arkade/Lightning-to-EVM**: Gasless claim via server
470
+ * - **Other EVM swaps**: Returns call data for manual claiming
335
471
  * - **Arkade**: Claims via Arkade protocol
336
472
  *
337
473
  * @param id - The UUID of the swap.
474
+ * @param _options - Deprecated. For Arkade/Lightning-to-EVM, destination is set at swap creation.
338
475
  * @returns A ClaimResult with the outcome.
339
476
  *
340
477
  * @example
341
478
  * ```ts
479
+ * // Arkade-to-EVM (gasless via server, uses stored target address)
480
+ * const result = await client.claim(swapId);
481
+ *
482
+ * // Other swap types
342
483
  * const result = await client.claim(swapId);
343
484
  * if (result.success) {
344
- * if (result.chain === "arkade") {
345
- * console.log("Arkade TX:", result.txHash);
346
- * } else {
347
- * console.log("Claim TX:", result.txHash);
348
- * }
349
- * } else {
350
- * console.error("Claim failed:", result.message);
485
+ * console.log("Claim TX:", result.txHash);
351
486
  * }
352
487
  * ```
353
488
  */
354
- claim(id: string): Promise<ClaimResult>;
489
+ claim(id: string, _options?: ClaimOptions): Promise<ClaimResult>;
490
+ /**
491
+ * Claims an Arkade-to-EVM swap gaslessly via the server.
492
+ *
493
+ * The SDK builds the EIP-712 digest, signs it with the swap's internally
494
+ * derived EVM key, and sends the signature + secret to the server. The
495
+ * server submits the `coordinator.redeemAndExecute` transaction.
496
+ *
497
+ * @param id - The UUID of the swap.
498
+ * @param destination - The EVM address where tokens should be sent.
499
+ * @returns The gasless claim result with transaction hash.
500
+ *
501
+ * @example
502
+ * ```ts
503
+ * const result = await client.claimViaGasless(swapId, "0xYourAddress");
504
+ * console.log("Claimed! TX:", result.txHash);
505
+ * ```
506
+ */
507
+ claimViaGasless(id: string, destination: string, options?: {
508
+ slippage?: number;
509
+ }): Promise<ClaimGaslessResult>;
355
510
  /**
356
511
  * Claims an Arkade (off-chain) VHTLC swap by revealing the preimage.
357
512
  *
358
- * This is used for EVM-to-Arkade swaps where the user claims BTC
359
- * on Arkade after the server has funded the VHTLC.
513
+ * Automatically selects the best claim method based on VTXO status:
514
+ * - **spendable** VTXOs offchain spend (submitTx/finalizeTx)
515
+ * - **recoverable** or **mixed** VTXOs → delegated settlement via backend
516
+ *
517
+ * This is used for EVM-to-Arkade and BTC-to-Arkade swaps where the user
518
+ * claims BTC on Arkade after the server has funded the VHTLC.
360
519
  *
361
520
  * @param id - The UUID of the swap.
362
521
  * @param options - Claim options including destination address.
@@ -407,32 +566,31 @@ export declare class Client {
407
566
  * }
408
567
  * ```
409
568
  */
410
- refundSwap(id: string, options?: OnchainRefundOptions): Promise<RefundResult>;
569
+ refundSwap(id: string, options?: RefundOptions): Promise<RefundResult>;
411
570
  /**
412
- * Creates a new Arkade to EVM swap.
413
- *
414
- * Automatically derives swap parameters and increments the key index.
571
+ * Creates a swap by routing to the correct direction-specific method
572
+ * based on `sourceAsset.chain` and `targetAsset.chain`.
415
573
  *
416
- * @param options - The swap options.
417
- * @returns The swap response and parameters for storage.
418
- * @throws Error if the swap creation fails.
574
+ * Supported directions:
575
+ * - Arkade EVM
576
+ * - Lightning EVM
577
+ * - Bitcoin (on-chain) → EVM
578
+ * - Bitcoin (on-chain) → Arkade
579
+ * - EVM → Arkade
580
+ * - EVM → Bitcoin (on-chain)
581
+ * - EVM → Lightning
419
582
  *
420
- * @example
421
- * ```ts
422
- * const result = await client.createArkadeToEvmSwap({
423
- * targetAddress: "0x1234...",
424
- * targetToken: "usdc_pol",
425
- * targetChain: "polygon",
426
- * sourceAmount: 100000, // 100k sats
427
- * });
428
- * console.log("Fund this address:", result.response.htlc_address_arkade);
429
- * ```
583
+ * @param options - The swap options including source/target assets, amounts, and addresses.
584
+ * @returns The swap result (response + swapParams).
585
+ * @throws Error if the swap direction is unsupported or required fields are missing.
430
586
  */
431
- createArkadeToEvmSwap(options: BtcToEvmSwapOptions): Promise<BtcToEvmSwapResult>;
587
+ createSwap(options: CreateSwapOptions): Promise<CreateSwapResult>;
432
588
  /**
433
- * Creates a new Lightning to EVM swap.
589
+ * Creates a new Arkade-to-EVM swap via the generic chain-agnostic endpoint.
434
590
  *
435
- * Automatically derives swap parameters and increments the key index.
591
+ * Uses the `/swap/arkade/evm` endpoint which supports any ERC-20 token
592
+ * reachable through 1inch aggregation. Returns coordinator address and
593
+ * optional 1inch calldata for the redeem-and-swap flow.
436
594
  *
437
595
  * @param options - The swap options.
438
596
  * @returns The swap response and parameters for storage.
@@ -440,16 +598,24 @@ export declare class Client {
440
598
  *
441
599
  * @example
442
600
  * ```ts
443
- * const result = await client.createLightningToEvmSwap({
601
+ * const result = await client.createArkadeToEvmSwapGeneric({
444
602
  * targetAddress: "0x1234...",
445
- * targetToken: "usdc_pol",
446
- * targetChain: "polygon",
603
+ * tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
604
+ * evmChainId: 137,
447
605
  * sourceAmount: 100000, // 100k sats
448
606
  * });
449
- * console.log("Pay this invoice:", result.response.ln_invoice);
607
+ * console.log("Fund:", result.response.btc_vhtlc_address);
608
+ * console.log("Coordinator:", result.response.evm_coordinator_address);
450
609
  * ```
451
610
  */
452
- createLightningToEvmSwap(options: BtcToEvmSwapOptions): Promise<BtcToEvmSwapResult>;
611
+ createArkadeToEvmSwapGeneric(options: ArkadeToEvmSwapOptions): Promise<ArkadeToEvmSwapResult>;
612
+ /**
613
+ * Creates a new Lightning to EVM swap using the generic chain-agnostic endpoint.
614
+ *
615
+ * @param options - The swap options including evmChainId and tokenAddress.
616
+ * @returns The swap response and parameters for storage.
617
+ */
618
+ createLightningToEvmSwapGeneric(options: LightningToEvmSwapGenericOptions): Promise<LightningToEvmSwapGenericResult>;
453
619
  /**
454
620
  * Creates a new Bitcoin (on-chain) to EVM swap.
455
621
  *
@@ -463,8 +629,8 @@ export declare class Client {
463
629
  * ```ts
464
630
  * const result = await client.createBitcoinToEvmSwap({
465
631
  * targetAddress: "0x1234...",
466
- * targetToken: "usdc_pol",
467
- * targetChain: "polygon",
632
+ * tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
633
+ * evmChainId: 137,
468
634
  * sourceAmount: 100000, // 100k sats
469
635
  * });
470
636
  * console.log("Send BTC to:", result.response.btc_htlc_address);
@@ -472,10 +638,10 @@ export declare class Client {
472
638
  */
473
639
  createBitcoinToEvmSwap(options: BitcoinToEvmSwapOptions): Promise<BitcoinToEvmSwapResult>;
474
640
  /**
475
- * Creates a new EVM to Arkade swap.
641
+ * Creates a new Bitcoin (on-chain) to Arkade swap.
476
642
  *
477
- * This allows users to swap ERC-20 tokens (USDC, USDT, etc.) from EVM chains
478
- * to receive BTC on Arkade.
643
+ * The user sends on-chain BTC to a Taproot HTLC address and receives
644
+ * Arkade VTXOs after the server funds the Arkade VHTLC.
479
645
  *
480
646
  * Automatically derives swap parameters and increments the key index.
481
647
  *
@@ -485,101 +651,110 @@ export declare class Client {
485
651
  *
486
652
  * @example
487
653
  * ```ts
488
- * const result = await client.createEvmToArkadeSwap({
489
- * sourceChain: "polygon",
490
- * sourceToken: "usdc_pol",
491
- * sourceAmount: 100.0, // 100 USDC
654
+ * const result = await client.createBitcoinToArkadeSwap({
655
+ * satsReceive: 100000, // 100k sats to receive on Arkade
492
656
  * targetAddress: "ark1q...", // Arkade address
493
- * userAddress: "0x1234...", // EVM wallet address
494
657
  * });
495
- * console.log("Approve token:", result.response.source_token_address);
496
- * console.log("HTLC contract:", result.response.htlc_address_evm);
658
+ * console.log("Send BTC to:", result.response.btc_htlc_address);
659
+ * console.log("Amount to send:", result.response.source_amount, "sats");
497
660
  * ```
498
661
  */
499
- createEvmToArkadeSwap(options: EvmToArkadeSwapOptions): Promise<EvmToArkadeSwapResult>;
662
+ createBitcoinToArkadeSwap(options: BitcoinToArkadeSwapOptions): Promise<BitcoinToArkadeSwapResult>;
500
663
  /**
501
- * Creates a new EVM to Lightning swap.
664
+ * Creates a new EVM-to-Arkade swap via the generic endpoint.
502
665
  *
503
- * This allows users to swap ERC-20 tokens (USDC, USDT, etc.) from EVM chains
504
- * to pay a Lightning invoice.
666
+ * Uses the chain-agnostic `/swap/evm/arkade` endpoint which supports any
667
+ * ERC-20 token reachable through 1inch aggregation.
505
668
  *
506
- * @param options - The swap options including bolt11 invoice.
669
+ * @param options - The swap options.
507
670
  * @returns The swap response and parameters for storage.
508
671
  * @throws Error if the swap creation fails.
509
672
  *
510
673
  * @example
511
674
  * ```ts
512
- * const result = await client.createEvmToLightningSwap({
513
- * sourceChain: "polygon",
514
- * sourceToken: "usdc_pol",
515
- * bolt11Invoice: "lnbc...", // Lightning invoice to pay
516
- * userAddress: "0x1234...", // EVM wallet address
675
+ * const result = await client.createEvmToArkadeSwapGeneric({
676
+ * targetAddress: "ark1q...",
677
+ * tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
678
+ * evmChainId: 137,
679
+ * userAddress: "0x1234...",
680
+ * sourceAmount: 100000000, // 100 USDC (6 decimals)
517
681
  * });
518
- * console.log("Approve token:", result.response.source_token_address);
519
- * console.log("HTLC contract:", result.response.htlc_address_evm);
682
+ * console.log("HTLC:", result.response.evm_htlc_address);
520
683
  * ```
521
684
  */
522
- createEvmToLightningSwap(options: EvmToLightningSwapOptions): Promise<EvmToLightningSwapResult>;
685
+ createEvmToArkadeSwapGeneric(options: EvmToArkadeSwapGenericOptions): Promise<EvmToArkadeSwapGenericResult>;
523
686
  /**
524
- * Gets the call data needed to fund an EVM-to-Arkade/Lightning swap.
687
+ * Creates a new EVM-to-Bitcoin (on-chain) swap.
525
688
  *
526
- * Returns both:
527
- * 1. `approve` - ERC20 approve call data (computed locally)
528
- * 2. `createSwap` - HTLC createSwap call data (from server)
689
+ * Uses the chain-agnostic `/swap/evm/bitcoin` endpoint which supports any
690
+ * ERC-20 token reachable through 1inch aggregation. The user locks tokens
691
+ * in an EVM HTLC and receives BTC to an on-chain Taproot HTLC.
529
692
  *
530
- * @param swapId - The UUID of the swap.
531
- * @param tokenDecimals - Decimals of the source token (e.g., 6 for USDC).
532
- * @param approveMax - If true, approves max uint256. If false, approves exact amount. Default: true.
533
- * @returns The approve and createSwap call data.
693
+ * @param options - The swap options.
694
+ * @returns The swap response and parameters for storage.
695
+ * @throws Error if the swap creation fails.
534
696
  *
535
697
  * @example
536
698
  * ```ts
537
- * const swap = await client.createEvmToArkadeSwap({...});
699
+ * const result = await client.createEvmToBitcoinSwap({
700
+ * tokenAddress: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", // USDC on Polygon
701
+ * evmChainId: 137,
702
+ * userAddress: "0x1234...",
703
+ * sourceAmount: 100000000n, // 100 USDC (6 decimals)
704
+ * });
705
+ * console.log("EVM HTLC:", result.response.evm_htlc_address);
706
+ * console.log("BTC HTLC:", result.response.btc_htlc_address);
707
+ * ```
708
+ */
709
+ createEvmToBitcoinSwap(options: EvmToBitcoinSwapOptions): Promise<EvmToBitcoinSwapResult>;
710
+ /**
711
+ * Creates a new EVM to Lightning swap using the chain-agnostic generic endpoint.
538
712
  *
539
- * // Get funding call data
540
- * const funding = await client.getEvmFundingCallData(swap.response.id, 6);
713
+ * This allows users to swap any ERC-20 token from any supported EVM chain
714
+ * to pay a Lightning invoice.
541
715
  *
542
- * // Step 1: Approve token spend
543
- * await wallet.sendTransaction({
544
- * to: funding.approve.to,
545
- * data: funding.approve.data,
546
- * });
716
+ * @param options - The swap options including Lightning invoice, chain ID, and token address.
717
+ * @returns The swap response and parameters for storage.
718
+ * @throws Error if the swap creation fails.
547
719
  *
548
- * // Step 2: Create the swap
549
- * await wallet.sendTransaction({
550
- * to: funding.createSwap.to,
551
- * data: funding.createSwap.data,
720
+ * @example
721
+ * ```ts
722
+ * const result = await client.createEvmToLightningSwapGeneric({
723
+ * lightningInvoice: "lnbc...",
724
+ * evmChainId: 137, // Polygon
725
+ * tokenAddress: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", // WBTC
726
+ * userAddress: "0x1234...",
552
727
  * });
728
+ * console.log("HTLC contract:", result.response.evm_htlc_address);
729
+ * console.log("Swap ID:", result.response.id);
553
730
  * ```
554
731
  */
555
- getEvmFundingCallData(swapId: string, tokenDecimals: number, approveMax?: boolean): Promise<EvmFundingCallData>;
732
+ createEvmToLightningSwapGeneric(options: EvmToLightningSwapGenericOptions): Promise<EvmToLightningSwapGenericResult>;
556
733
  /**
557
- * Gets call data for refunding an EVM HTLC.
734
+ * Gets call data to fund an EVM-to-BTC swap via the HTLCCoordinator.
735
+ *
736
+ * The coordinator atomically swaps source tokens (e.g. USDC) to WBTC via DEX
737
+ * and locks the WBTC into an HTLC in a single transaction.
558
738
  *
559
- * For EVM-to-Arkade/Lightning swaps, if the swap times out (server doesn't
560
- * complete it), users can refund their tokens by calling refundSwap on
561
- * the HTLC contract.
739
+ * Fetches the coordinator calldata from the server, which builds the 1inch
740
+ * swap calldata and computes the refundCallsHash.
562
741
  *
563
742
  * @param swapId - The UUID of the swap.
564
- * @returns The refund call data.
743
+ * @param approveMax - If true, approves max uint256. If false, approves exact amount. Default: true.
744
+ * @returns The approve and executeAndCreate call data.
565
745
  *
566
746
  * @example
567
747
  * ```ts
568
- * // Get refund call data
569
- * const refund = await client.getEvmRefundCallData(swapId);
748
+ * const swap = await client.createEvmToArkadeSwap({...});
749
+ * const funding = await client.getCoordinatorFundingCallData(swap.response.id);
570
750
  *
571
- * // Submit the refund transaction
572
- * await wallet.sendTransaction({
573
- * to: refund.to,
574
- * data: refund.data,
575
- * });
751
+ * // Step 1: Approve source token to coordinator
752
+ * await wallet.sendTransaction({ to: funding.approve.to, data: funding.approve.data });
753
+ *
754
+ * // Step 2: Execute swap + create HTLC
755
+ * await wallet.sendTransaction({ to: funding.executeAndCreate.to, data: funding.executeAndCreate.data });
576
756
  * ```
577
757
  */
578
- getEvmRefundCallData(swapId: string): Promise<{
579
- to: string;
580
- data: string;
581
- timelockExpired: boolean;
582
- timelockExpiry: number;
583
- }>;
758
+ getCoordinatorFundingCallData(swapId: string, approveMax?: boolean): Promise<CoordinatorFundingCallData>;
584
759
  }
585
760
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot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