@lendasat/lendaswap-sdk 0.1.8 → 0.1.67

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 (36) hide show
  1. package/README.md +200 -126
  2. package/dist/api.d.ts +206 -192
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +292 -132
  5. package/dist/api.js.map +1 -1
  6. package/dist/index.d.ts +23 -19
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +22 -21
  9. package/dist/index.js.map +1 -1
  10. package/dist/price-calculations.d.ts +135 -0
  11. package/dist/price-calculations.d.ts.map +1 -0
  12. package/dist/price-calculations.js +171 -0
  13. package/dist/price-calculations.js.map +1 -0
  14. package/dist/price-feed.d.ts +3 -0
  15. package/dist/price-feed.d.ts.map +1 -1
  16. package/dist/price-feed.js.map +1 -1
  17. package/dist/usd-price.d.ts.map +1 -1
  18. package/dist/usd-price.js +1 -0
  19. package/dist/usd-price.js.map +1 -1
  20. package/package.json +14 -15
  21. package/wasm/lendaswap_wasm_sdk.d.ts +442 -114
  22. package/wasm/lendaswap_wasm_sdk_bg.js +2946 -630
  23. package/wasm/lendaswap_wasm_sdk_bg.wasm +0 -0
  24. package/wasm/lendaswap_wasm_sdk_bg.wasm.d.ts +268 -64
  25. package/dist/storage/dexieSwapStorage.d.ts +0 -111
  26. package/dist/storage/dexieSwapStorage.d.ts.map +0 -1
  27. package/dist/storage/dexieSwapStorage.js +0 -139
  28. package/dist/storage/dexieSwapStorage.js.map +0 -1
  29. package/dist/storage/dexieWalletStorage.d.ts +0 -99
  30. package/dist/storage/dexieWalletStorage.d.ts.map +0 -1
  31. package/dist/storage/dexieWalletStorage.js +0 -139
  32. package/dist/storage/dexieWalletStorage.js.map +0 -1
  33. package/dist/storage/index.d.ts +0 -18
  34. package/dist/storage/index.d.ts.map +0 -1
  35. package/dist/storage/index.js +0 -20
  36. package/dist/storage/index.js.map +0 -1
package/dist/api.js CHANGED
@@ -6,116 +6,231 @@
6
6
  */
7
7
  // Import WASM types for internal use
8
8
  // With --target bundler, WASM is automatically initialized via static import
9
- import { JsSwapStorageProvider, JsWalletStorageProvider, Chain as WasmChain, Client as WasmClient, getLogLevel as wasmGetLogLevel, setLogLevel as wasmSetLogLevel, } from "../wasm/lendaswap_wasm_sdk.js";
9
+ import { Client as WasmClient, ClientBuilder as WasmClientBuilder, getLogLevel as wasmGetLogLevel, setLogLevel as wasmSetLogLevel, } from "../wasm/lendaswap_wasm_sdk.js";
10
10
  // Re-export WASM types directly
11
- export { CreateVtxoSwapResult, EstimateVtxoSwapResponse, QuoteResponse, SwapParams as VtxoSwapParams, TokenId, Version, VhtlcAmounts, VtxoSwapResponse, } from "../wasm/lendaswap_wasm_sdk.js";
11
+ export { AssetPair, BtcToEvmSwapResponse, BtcToArkadeSwapResponse, Chain, CreateVtxoSwapResult, EstimateVtxoSwapResponse, EvmToBtcSwapResponse, ExtendedSwapStorageData as ExtendedSwapStorageDataWasm, ExtendedVtxoSwapStorageData, IdbStorageHandle, Network, openIdbDatabase, QuoteResponse, SwapParams as VtxoSwapParams, SwapStatus, SwapType, swapStatusToString, TokenId, TokenInfo, Version, VhtlcAmounts, VtxoSwapResponse, } from "../wasm/lendaswap_wasm_sdk.js";
12
12
  /**
13
- * Map WASM Chain enum to our Chain type.
13
+ * Convert WASM ExtendedSwapStorageData to plain TypeScript interface.
14
+ * Returns undefined if the swap response type is unknown.
14
15
  */
15
- function mapChain(wasmChain) {
16
- switch (wasmChain) {
17
- case WasmChain.Arkade:
18
- return "Arkade";
19
- case WasmChain.Lightning:
20
- return "Lightning";
21
- case WasmChain.Polygon:
22
- return "Polygon";
23
- case WasmChain.Ethereum:
24
- return "Ethereum";
25
- default:
26
- return String(wasmChain);
16
+ function mapWasmSwapToInterface(wasmSwap) {
17
+ const response = wasmSwap.btcToEvmResponse ??
18
+ wasmSwap.evmToBtcResponse ??
19
+ wasmSwap.btcToArkadeResponse;
20
+ if (!response) {
21
+ return undefined;
27
22
  }
28
- }
29
- /**
30
- * Map WASM TokenInfo to our typed TokenInfo.
31
- */
32
- function mapTokenInfo(wasmToken) {
33
23
  return {
34
- tokenId: wasmToken.tokenId,
35
- symbol: wasmToken.symbol,
36
- chain: mapChain(wasmToken.chain),
37
- name: wasmToken.name,
38
- decimals: wasmToken.decimals,
24
+ response,
25
+ swap_params: wasmSwap.swapParams,
39
26
  };
40
27
  }
41
28
  /**
42
- * Map WASM AssetPair to our typed AssetPair.
29
+ * Builder for constructing a Client with a fluent API.
30
+ *
31
+ * Uses IndexedDB storage via `.withIdbStorage()` for browser applications.
32
+ * For Node.js server-side applications, use `@lendasat/lendaswap-sdk-native` instead.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import { Client } from '@lendasat/lendaswap-sdk';
37
+ *
38
+ * const client = await Client.builder()
39
+ * .url('https://api.lendaswap.com')
40
+ * .withIdbStorage()
41
+ * .network('bitcoin')
42
+ * .arkadeUrl('https://arkade.computer')
43
+ * .esploraUrl('https://mempool.space/api')
44
+ * .build();
45
+ * ```
43
46
  */
44
- function mapAssetPair(wasmPair) {
45
- return {
46
- source: mapTokenInfo(wasmPair.source),
47
- target: mapTokenInfo(wasmPair.target),
48
- };
47
+ export class ClientBuilder {
48
+ _url;
49
+ _storage;
50
+ _network;
51
+ _arkadeUrl;
52
+ _esploraUrl;
53
+ constructor() { }
54
+ /**
55
+ * Set the Lendaswap API URL.
56
+ */
57
+ url(url) {
58
+ this._url = url;
59
+ return this;
60
+ }
61
+ /**
62
+ * Use IndexedDB storage.
63
+ *
64
+ * This will automatically open the IndexedDB database when `build()` is called.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const client = await Client.builder()
69
+ * .url('https://api.lendaswap.com')
70
+ * .withIdbStorage()
71
+ * .network('bitcoin')
72
+ * .arkadeUrl('...')
73
+ * .esploraUrl('...')
74
+ * .build();
75
+ * ```
76
+ */
77
+ withIdbStorage() {
78
+ // We'll open the database in build() - storage will be set then
79
+ return this;
80
+ }
81
+ /**
82
+ * Set the storage handle directly (for advanced use cases).
83
+ * @deprecated Use `.withIdbStorage()` instead.
84
+ */
85
+ storage(storage) {
86
+ this._storage = storage;
87
+ return this;
88
+ }
89
+ /**
90
+ * Set the Bitcoin network.
91
+ */
92
+ network(network) {
93
+ this._network = network;
94
+ return this;
95
+ }
96
+ /**
97
+ * Set the Arkade server URL.
98
+ */
99
+ arkadeUrl(url) {
100
+ this._arkadeUrl = url;
101
+ return this;
102
+ }
103
+ /**
104
+ * Set the Esplora API URL for on-chain Bitcoin operations.
105
+ */
106
+ esploraUrl(url) {
107
+ this._esploraUrl = url;
108
+ return this;
109
+ }
110
+ /**
111
+ * Build the client asynchronously.
112
+ *
113
+ * @returns A Promise that resolves to a new Client instance
114
+ * @throws Error if any required field is missing or storage initialization fails
115
+ */
116
+ async build() {
117
+ if (!this._url) {
118
+ throw new Error("url is required - call .url(url)");
119
+ }
120
+ if (!this._network) {
121
+ throw new Error("network is required - call .network(network)");
122
+ }
123
+ if (!this._arkadeUrl) {
124
+ throw new Error("arkadeUrl is required - call .arkadeUrl(url)");
125
+ }
126
+ if (!this._esploraUrl) {
127
+ throw new Error("esploraUrl is required - call .esploraUrl(url)");
128
+ }
129
+ const { openIdbDatabase } = await import("../wasm/lendaswap_wasm_sdk.js");
130
+ // If storage handle wasn't provided directly, open it now
131
+ let storageHandle = this._storage;
132
+ if (!storageHandle) {
133
+ storageHandle = await openIdbDatabase();
134
+ }
135
+ const wasmBuilder = new WasmClientBuilder();
136
+ const wasmClient = wasmBuilder
137
+ .url(this._url)
138
+ .storage(storageHandle)
139
+ .network(this._network)
140
+ .arkadeUrl(this._arkadeUrl)
141
+ .esploraUrl(this._esploraUrl)
142
+ .build();
143
+ return Client.fromWasmClient(wasmClient);
144
+ }
49
145
  }
50
146
  /**
51
- * Convert a value from WASM (which may be a Map) to a plain object.
52
- * serde_wasm_bindgen serializes structs as Maps by default.
147
+ * Lendaswap client using IndexedDB storage.
148
+ *
149
+ * This client uses native Rust IndexedDB storage via the `idb` crate,
150
+ * eliminating the need for JavaScript storage callbacks.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { openIdbDatabase, Client } from '@lendasat/lendaswap-sdk';
155
+ *
156
+ * // Open the IndexedDB database
157
+ * const storage = await openIdbDatabase();
158
+ *
159
+ * // Create the client
160
+ * const client = await Client.create(
161
+ * 'https://api.lendaswap.com',
162
+ * storage,
163
+ * 'bitcoin',
164
+ * 'https://arkade.computer',
165
+ * 'https://mempool.space/api'
166
+ * );
167
+ *
168
+ * // Initialize wallet (generates mnemonic if needed)
169
+ * await client.init();
170
+ *
171
+ * // Get all swaps
172
+ * const swaps = await client.listAllSwaps();
173
+ * ```
53
174
  */
54
- function fromWasm(value) {
55
- if (value instanceof Map) {
56
- return Object.fromEntries(value);
57
- }
58
- return value;
59
- }
60
175
  export class Client {
61
- client;
62
- constructor(client) {
63
- this.client = client;
176
+ wasmClient;
177
+ constructor(wasmClient) {
178
+ this.wasmClient = wasmClient;
179
+ }
180
+ /**
181
+ * Create a new ClientBuilder for constructing a client.
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * const client = Client.builder()
186
+ * .url('https://api.lendaswap.com')
187
+ * .withIdbStorage()
188
+ * .network('bitcoin')
189
+ * .arkadeUrl('https://arkade.computer')
190
+ * .esploraUrl('https://mempool.space/api')
191
+ * .build();
192
+ * ```
193
+ */
194
+ static builder() {
195
+ return new ClientBuilder();
196
+ }
197
+ /**
198
+ * Create a Client from a WASM client instance.
199
+ * Used internally by ClientBuilder.
200
+ */
201
+ static fromWasmClient(wasmClient) {
202
+ return new Client(wasmClient);
64
203
  }
65
204
  /**
66
- * Create a new Client instance.
205
+ * Create a new Client instance with IndexedDB storage.
67
206
  *
68
207
  * @param baseUrl - The base URL of the Lendaswap API
69
- * @param walletStorage - Storage provider for persisting wallet data (mnemonic, key index)
70
- * @param swapStorage - Storage provider for persisting swap data (uses Dexie/IndexedDB)
208
+ * @param storage - Storage handle from `openIdbDatabase()`
71
209
  * @param network - Bitcoin network ("bitcoin", "testnet", "regtest", "mutinynet")
72
210
  * @param arkadeUrl - Arkade's server url
73
- * @param wasmPath - Optional path to the WASM file (for Node.js environments)
211
+ * @param esploraUrl - Esplora API URL for on-chain Bitcoin operations (e.g., "https://mempool.space/api")
74
212
  * @returns A new Client instance
75
213
  *
76
214
  * @example
77
215
  * ```typescript
78
- * import Dexie from 'dexie';
79
- *
80
- * // Wallet storage using localStorage with typed methods
81
- * const walletStorage: WalletStorageProvider = {
82
- * getMnemonic: async () => localStorage.getItem('mnemonic'),
83
- * setMnemonic: async (mnemonic) => localStorage.setItem('mnemonic', mnemonic),
84
- * getKeyIndex: async () => parseInt(localStorage.getItem('key_index') ?? '0'),
85
- * setKeyIndex: async (index) => localStorage.setItem('key_index', index.toString()),
86
- * };
87
- *
88
- * // Swap storage using Dexie (IndexedDB)
89
- * const db = new Dexie('lendaswap');
90
- * db.version(1).stores({ swaps: 'id' });
91
- *
92
- * const swapStorage: SwapStorageProvider = {
93
- * get: async (swapId) => await db.table('swaps').get(swapId) ?? null,
94
- * store: async (swapId, data) => await db.table('swaps').put({ id: swapId, ...data }),
95
- * delete: async (swapId) => await db.table('swaps').delete(swapId),
96
- * list: async () => await db.table('swaps').toCollection().primaryKeys() as string[],
97
- * getAll: async () => await db.table('swaps').toArray(),
98
- * };
216
+ * import { openIdbDatabase, Client } from '@lendasat/lendaswap-sdk';
99
217
  *
218
+ * const storage = await openIdbDatabase();
100
219
  * const client = await Client.create(
101
220
  * 'https://apilendaswap.lendasat.com',
102
- * walletStorage,
103
- * swapStorage,
221
+ * storage,
104
222
  * 'bitcoin',
105
- * 'https://arkade.computer'
223
+ * 'https://arkade.computer',
224
+ * 'https://mempool.space/api'
106
225
  * );
107
226
  * ```
108
227
  */
109
- static async create(baseUrl, walletStorage, swapStorage, network, arkadeUrl) {
110
- // Bind wallet storage methods to preserve 'this' context when called from WASM
111
- const jsWalletStorageProvider = new JsWalletStorageProvider(walletStorage.getMnemonic.bind(walletStorage), walletStorage.setMnemonic.bind(walletStorage), walletStorage.getKeyIndex.bind(walletStorage), walletStorage.setKeyIndex.bind(walletStorage));
112
- // Bind swap storage methods to preserve 'this' context when called from WASM
113
- const jsSwapStorageProvider = new JsSwapStorageProvider(swapStorage.get.bind(swapStorage), swapStorage.store.bind(swapStorage), swapStorage.delete.bind(swapStorage), swapStorage.list.bind(swapStorage), swapStorage.getAll.bind(swapStorage));
114
- const wasmClient = new WasmClient(baseUrl, jsWalletStorageProvider, jsSwapStorageProvider, network, arkadeUrl);
115
- return new Client(wasmClient);
228
+ static async create(baseUrl, storage, network, arkadeUrl, esploraUrl) {
229
+ const wasmClient = new WasmClient(baseUrl, storage, network, arkadeUrl, esploraUrl);
230
+ return Client.fromWasmClient(wasmClient);
116
231
  }
117
232
  async init(mnemonic) {
118
- await this.client.init(mnemonic);
233
+ await this.wasmClient.init(mnemonic);
119
234
  }
120
235
  /**
121
236
  * Create an Arkade to EVM swap (BTC → Token).
@@ -125,10 +240,29 @@ export class Client {
125
240
  * @returns The created swap response
126
241
  */
127
242
  async createArkadeToEvmSwap(request, targetNetwork) {
128
- const response = await this.client.createArkadeToEvmSwap(request.target_address, request.target_amount, request.target_token, targetNetwork, request.referral_code);
129
- // serde_wasm_bindgen returns a Map for complex structs, convert to plain object
130
- const obj = fromWasm(response);
131
- return { ...obj, direction: "btc_to_evm" };
243
+ if (request.source_amount &&
244
+ request.target_amount &&
245
+ request.source_amount > 0 &&
246
+ request.target_amount > 0) {
247
+ throw Error("Cannot have source amount and target amount defined");
248
+ }
249
+ return await this.wasmClient.createArkadeToEvmSwap(request.target_address, request.source_amount, request.target_amount, request.target_token, targetNetwork, request.referral_code);
250
+ }
251
+ /**
252
+ * Create a Lightning to EVM swap (BTC → Token).
253
+ *
254
+ * @param request - The swap request parameters
255
+ * @param targetNetwork - Target EVM network (e.g., 'polygon', 'ethereum')
256
+ * @returns The created swap response
257
+ */
258
+ async createLightningToEvmSwap(request, targetNetwork) {
259
+ if (request.source_amount &&
260
+ request.target_amount &&
261
+ request.source_amount > 0 &&
262
+ request.target_amount > 0) {
263
+ throw Error("Cannot have source amount and target amount defined");
264
+ }
265
+ return await this.wasmClient.createLightningToEvmSwap(request.target_address, request.source_amount, request.target_amount, request.target_token, targetNetwork, request.referral_code);
132
266
  }
133
267
  /**
134
268
  * Create an EVM to Arkade swap (Token → BTC).
@@ -138,10 +272,7 @@ export class Client {
138
272
  * @returns The created swap response
139
273
  */
140
274
  async createEvmToArkadeSwap(request, sourceNetwork) {
141
- const response = await this.client.createEvmToArkadeSwap(request.target_address, request.user_address, request.source_amount, request.source_token, sourceNetwork, request.referral_code);
142
- // serde_wasm_bindgen returns a Map for complex structs, convert to plain object
143
- const obj = fromWasm(response);
144
- return { ...obj, direction: "evm_to_btc" };
275
+ return await this.wasmClient.createEvmToArkadeSwap(request.target_address, request.user_address, request.source_amount, request.source_token, sourceNetwork, request.referral_code);
145
276
  }
146
277
  /**
147
278
  * Create an EVM to Lightning swap (Token → BTC).
@@ -151,18 +282,13 @@ export class Client {
151
282
  * @returns The created swap response
152
283
  */
153
284
  async createEvmToLightningSwap(request, sourceNetwork) {
154
- const response = await this.client.createEvmToLightningSwap(request.bolt11_invoice, request.user_address, request.source_token, sourceNetwork, request.referral_code);
155
- // serde_wasm_bindgen returns a Map for complex structs, convert to plain object
156
- const obj = fromWasm(response);
157
- return { ...obj, direction: "evm_to_btc" };
285
+ return await this.wasmClient.createEvmToLightningSwap(request.bolt11_invoice, request.user_address, request.source_token, sourceNetwork, request.referral_code);
158
286
  }
159
287
  async getAssetPairs() {
160
- const wasmPairs = await this.client.getAssetPairs();
161
- return wasmPairs.map(mapAssetPair);
288
+ return await this.wasmClient.getAssetPairs();
162
289
  }
163
290
  async getTokens() {
164
- const wasmTokens = await this.client.getTokens();
165
- return wasmTokens.map(mapTokenInfo);
291
+ return await this.wasmClient.getTokens();
166
292
  }
167
293
  /**
168
294
  * Get a quote for a swap.
@@ -173,32 +299,25 @@ export class Client {
173
299
  * @returns Quote response with exchange rate and fees
174
300
  */
175
301
  async getQuote(from, to, baseAmount) {
176
- const quote = await this.client.getQuote(from, to, baseAmount);
177
- return {
178
- exchange_rate: quote.exchangeRate,
179
- network_fee: Number(quote.networkFee),
180
- protocol_fee: Number(quote.protocolFee),
181
- protocol_fee_rate: quote.protocolFeeRate,
182
- min_amount: Number(quote.minAmount),
183
- max_amount: Number(quote.maxAmount),
184
- };
302
+ return await this.wasmClient.getQuote(from, to, baseAmount);
185
303
  }
186
304
  /**
187
305
  * Get a swap by its ID.
188
306
  *
189
307
  * @param id - The swap ID
190
- * @returns The swap response
308
+ * @returns The swap data, or undefined if the swap type is unknown
191
309
  */
192
310
  async getSwap(id) {
193
- return (await this.client.getSwap(id));
311
+ return mapWasmSwapToInterface(await this.wasmClient.getSwap(id));
194
312
  }
195
313
  /**
196
314
  * Gets all stored swaps.
197
315
  *
198
- * @returns A vec of swaps
316
+ * @returns Array of swaps (unknown types are filtered out)
199
317
  */
200
318
  async listAllSwaps() {
201
- return (await this.client.listAll());
319
+ const wasmSwaps = await this.wasmClient.listAll();
320
+ return wasmSwaps.map(mapWasmSwapToInterface).filter((s) => s !== undefined);
202
321
  }
203
322
  /**
204
323
  * Claim a swap via Gelato relay (gasless).
@@ -207,7 +326,7 @@ export class Client {
207
326
  * @param secret - The preimage secret (hex-encoded)
208
327
  */
209
328
  async claimGelato(swapId, secret) {
210
- await this.client.claimGelato(swapId, secret);
329
+ await this.wasmClient.claimGelato(swapId, secret);
211
330
  }
212
331
  /**
213
332
  * Get the VHTLC amounts associated with a swap.
@@ -216,7 +335,7 @@ export class Client {
216
335
  * @returns VhtlcAmounts
217
336
  */
218
337
  async amountsForSwap(swapId) {
219
- return (await this.client.amountsForSwap(swapId));
338
+ return await this.wasmClient.amountsForSwap(swapId);
220
339
  }
221
340
  /**
222
341
  * Claim a swap VHTLC
@@ -224,16 +343,17 @@ export class Client {
224
343
  * @param swapId - The swap ID
225
344
  */
226
345
  async claimVhtlc(swapId) {
227
- await this.client.claimVhtlc(swapId);
346
+ await this.wasmClient.claimVhtlc(swapId);
228
347
  }
229
348
  /**
230
- * Claim a swap VHTLC
349
+ * Refund a swap VHTLC
231
350
  *
232
351
  * @param swapId - The swap ID
352
+ * @param refundAddress - The address to receive the refund
233
353
  * @returns The TXID of the Ark transaction which refunded the VHTLC.
234
354
  */
235
355
  async refundVhtlc(swapId, refundAddress) {
236
- return await this.client.refundVhtlc(swapId, refundAddress);
356
+ return await this.wasmClient.refundVhtlc(swapId, refundAddress);
237
357
  }
238
358
  /**
239
359
  * Get the API version.
@@ -241,45 +361,42 @@ export class Client {
241
361
  * @returns Version information
242
362
  */
243
363
  async getVersion() {
244
- const version = await this.client.getVersion();
245
- return {
246
- tag: version.tag,
247
- commit_hash: version.commitHash,
248
- };
364
+ return await this.wasmClient.getVersion();
249
365
  }
250
366
  /**
251
367
  * Recover swaps for the currently loaded mnemonic.
252
368
  *
253
- * @returns Response containing recovered swaps
369
+ * @returns Array of recovered swaps (unknown types are filtered out)
254
370
  */
255
371
  async recoverSwaps() {
256
- return (await this.client.recoverSwaps());
372
+ const wasmSwaps = await this.wasmClient.recoverSwaps();
373
+ return wasmSwaps.map(mapWasmSwapToInterface).filter((s) => s !== undefined);
257
374
  }
258
375
  /**
259
376
  * Get current loaded mnemonic
260
377
  * @returns The mnemonic as string
261
378
  */
262
379
  async getMnemonic() {
263
- return await this.client.getMnemonic();
380
+ return await this.wasmClient.getMnemonic();
264
381
  }
265
382
  /**
266
383
  * Get current loaded user id xpub
267
384
  * @returns The xpub as string
268
385
  */
269
386
  async getUserIdXpub() {
270
- return await this.client.getUserIdXpub();
387
+ return await this.wasmClient.getUserIdXpub();
271
388
  }
272
389
  /**
273
390
  * Deletes all stored swaps
274
391
  */
275
392
  async clearSwapStorage() {
276
- return await this.client.clearSwapStorage();
393
+ await this.wasmClient.clearSwapStorage();
277
394
  }
278
395
  /**
279
396
  * Delete one particular swap by id
280
397
  */
281
398
  async deleteSwap(id) {
282
- return await this.client.deleteSwap(id);
399
+ await this.wasmClient.deleteSwap(id);
283
400
  }
284
401
  // =========================================================================
285
402
  // VTXO Swap Methods
@@ -291,7 +408,7 @@ export class Client {
291
408
  * @returns Estimate response with fee and output amounts
292
409
  */
293
410
  async estimateVtxoSwap(vtxos) {
294
- return await this.client.estimateVtxoSwap(vtxos);
411
+ return await this.wasmClient.estimateVtxoSwap(vtxos);
295
412
  }
296
413
  /**
297
414
  * Create a VTXO swap for refreshing VTXOs.
@@ -304,16 +421,16 @@ export class Client {
304
421
  * @returns The swap response and swap parameters
305
422
  */
306
423
  async createVtxoSwap(vtxos) {
307
- return await this.client.createVtxoSwap(vtxos);
424
+ return await this.wasmClient.createVtxoSwap(vtxos);
308
425
  }
309
426
  /**
310
427
  * Get VTXO swap details by ID.
311
428
  *
312
429
  * @param id - The swap ID
313
- * @returns The VTXO swap response
430
+ * @returns The extended VTXO swap data
314
431
  */
315
432
  async getVtxoSwap(id) {
316
- return await this.client.getVtxoSwap(id);
433
+ return await this.wasmClient.getVtxoSwap(id);
317
434
  }
318
435
  /**
319
436
  * Claim the server's VHTLC in a VTXO swap.
@@ -327,7 +444,7 @@ export class Client {
327
444
  * @returns The claim transaction ID
328
445
  */
329
446
  async claimVtxoSwap(swap, swapParams, claimAddress) {
330
- return await this.client.claimVtxoSwap(swap, swapParams, claimAddress);
447
+ return await this.wasmClient.claimVtxoSwap(swap, swapParams, claimAddress);
331
448
  }
332
449
  /**
333
450
  * Refund the client's VHTLC in a VTXO swap.
@@ -335,13 +452,56 @@ export class Client {
335
452
  * This can be called if the swap fails (e.g., server doesn't fund)
336
453
  * and the client's locktime has expired.
337
454
  *
338
- * @param swap - The VTXO swap response
339
- * @param swapParams - The client's swap parameters
455
+ * @param swapId - The swap ID
340
456
  * @param refundAddress - The Arkade address to receive the refunded funds
341
457
  * @returns The refund transaction ID
342
458
  */
343
- async refundVtxoSwap(swap, swapParams, refundAddress) {
344
- return await this.client.refundVtxoSwap(swap, swapParams, refundAddress);
459
+ async refundVtxoSwap(swapId, refundAddress) {
460
+ return await this.wasmClient.refundVtxoSwap(swapId, refundAddress);
461
+ }
462
+ /**
463
+ * List all VTXO swaps from local storage.
464
+ *
465
+ * Returns all stored VTXO swaps without fetching from the API.
466
+ *
467
+ * @returns Array of all stored extended VTXO swap data
468
+ */
469
+ async listAllVtxoSwaps() {
470
+ return await this.wasmClient.listAllVtxoSwaps();
471
+ }
472
+ /**
473
+ * Create an on-chain Bitcoin to Arkade swap.
474
+ *
475
+ * User sends on-chain BTC to a P2WSH HTLC address, and receives Arkade VTXOs.
476
+ *
477
+ * @param request - The swap request parameters
478
+ * @returns The created swap response with P2WSH address to fund
479
+ */
480
+ async createBitcoinToArkadeSwap(request) {
481
+ return await this.wasmClient.createBitcoinToArkadeSwap(request.target_arkade_address, BigInt(request.sats_receive), request.referral_code);
482
+ }
483
+ /**
484
+ * Claim the Arkade VHTLC for a BTC-to-Arkade swap.
485
+ *
486
+ * This reveals the preimage/secret to claim funds on Arkade.
487
+ *
488
+ * @param swapId - The swap ID
489
+ * @returns The Arkade claim transaction ID
490
+ */
491
+ async claimBtcToArkadeVhtlc(swapId) {
492
+ return await this.wasmClient.claimBtcToArkadeVhtlc(swapId);
493
+ }
494
+ /**
495
+ * Refund from the on-chain Bitcoin HTLC after timeout.
496
+ *
497
+ * This spends from the P2WSH HTLC back to the user's address.
498
+ *
499
+ * @param swapId - The swap ID
500
+ * @param refundAddress - The Bitcoin address to receive the refund
501
+ * @returns The refund transaction ID
502
+ */
503
+ async refundOnchainHtlc(swapId, refundAddress) {
504
+ return await this.wasmClient.refundOnchainHtlc(swapId, refundAddress);
345
505
  }
346
506
  }
347
507
  /**
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qCAAqC;AACrC,6EAA6E;AAC7E,OAAO,EAGL,qBAA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