@lendasat/lendaswap-sdk 0.1.65 → 0.1.68

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 (34) hide show
  1. package/README.md +200 -126
  2. package/dist/api.d.ts +139 -103
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +236 -137
  5. package/dist/api.js.map +1 -1
  6. package/dist/index.d.ts +20 -20
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +20 -27
  9. package/dist/index.js.map +1 -1
  10. package/package.json +14 -15
  11. package/wasm/lendaswap_wasm_sdk.d.ts +133 -123
  12. package/wasm/lendaswap_wasm_sdk_bg.js +548 -248
  13. package/wasm/lendaswap_wasm_sdk_bg.wasm +0 -0
  14. package/wasm/lendaswap_wasm_sdk_bg.wasm.d.ts +45 -35
  15. package/dist/price-calculations.test.d.ts +0 -2
  16. package/dist/price-calculations.test.d.ts.map +0 -1
  17. package/dist/price-calculations.test.js +0 -173
  18. package/dist/price-calculations.test.js.map +0 -1
  19. package/dist/storage/dexieSwapStorage.d.ts +0 -113
  20. package/dist/storage/dexieSwapStorage.d.ts.map +0 -1
  21. package/dist/storage/dexieSwapStorage.js +0 -200
  22. package/dist/storage/dexieSwapStorage.js.map +0 -1
  23. package/dist/storage/dexieVtxoSwapStorage.d.ts +0 -105
  24. package/dist/storage/dexieVtxoSwapStorage.d.ts.map +0 -1
  25. package/dist/storage/dexieVtxoSwapStorage.js +0 -149
  26. package/dist/storage/dexieVtxoSwapStorage.js.map +0 -1
  27. package/dist/storage/dexieWalletStorage.d.ts +0 -99
  28. package/dist/storage/dexieWalletStorage.d.ts.map +0 -1
  29. package/dist/storage/dexieWalletStorage.js +0 -139
  30. package/dist/storage/dexieWalletStorage.js.map +0 -1
  31. package/dist/storage/index.d.ts +0 -19
  32. package/dist/storage/index.d.ts.map +0 -1
  33. package/dist/storage/index.js +0 -22
  34. package/dist/storage/index.js.map +0 -1
package/dist/api.js CHANGED
@@ -6,9 +6,9 @@
6
6
  */
7
7
  // Import WASM types for internal use
8
8
  // With --target bundler, WASM is automatically initialized via static import
9
- import { Client as WasmClient, getLogLevel as wasmGetLogLevel, JsSwapStorageProvider, JsVtxoSwapStorageProvider, JsWalletStorageProvider, 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 { AssetPair, BtcToEvmSwapResponse, BtcToArkadeSwapResponse, Chain, CreateVtxoSwapResult, EstimateVtxoSwapResponse, EvmToBtcSwapResponse, ExtendedSwapStorageData as ExtendedSwapStorageDataWasm, ExtendedVtxoSwapStorageData, Network, QuoteResponse, SwapParams as VtxoSwapParams, SwapStatus, SwapType, swapStatusToString, TokenId, TokenInfo, 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
13
  * Convert WASM ExtendedSwapStorageData to plain TypeScript interface.
14
14
  * Returns undefined if the swap response type is unknown.
@@ -25,22 +25,187 @@ function mapWasmSwapToInterface(wasmSwap) {
25
25
  swap_params: wasmSwap.swapParams,
26
26
  };
27
27
  }
28
+ /**
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
+ * ```
46
+ */
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
+ }
145
+ }
146
+ /**
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
+ * ```
174
+ */
28
175
  export class Client {
29
- client;
30
- baseUrl;
31
- swapStorage;
32
- constructor(client, baseUrl, swapStorage) {
33
- this.client = client;
34
- this.baseUrl = baseUrl;
35
- this.swapStorage = swapStorage;
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);
36
203
  }
37
204
  /**
38
- * Create a new Client instance.
205
+ * Create a new Client instance with IndexedDB storage.
39
206
  *
40
207
  * @param baseUrl - The base URL of the Lendaswap API
41
- * @param walletStorage - Storage provider for persisting wallet data (mnemonic, key index)
42
- * @param swapStorage - Storage provider for persisting swap data (uses Dexie/IndexedDB)
43
- * @param vtxoSwapStorage - Storage provider for persisting VTXO swap data (uses Dexie/IndexedDB)
208
+ * @param storage - Storage handle from `openIdbDatabase()`
44
209
  * @param network - Bitcoin network ("bitcoin", "testnet", "regtest", "mutinynet")
45
210
  * @param arkadeUrl - Arkade's server url
46
211
  * @param esploraUrl - Esplora API URL for on-chain Bitcoin operations (e.g., "https://mempool.space/api")
@@ -48,40 +213,24 @@ export class Client {
48
213
  *
49
214
  * @example
50
215
  * ```typescript
51
- * import {
52
- * Client,
53
- * createDexieWalletStorage,
54
- * createDexieSwapStorage,
55
- * createDexieVtxoSwapStorage
56
- * } from '@lendasat/lendaswap-sdk';
57
- *
58
- * const walletStorage = createDexieWalletStorage();
59
- * const swapStorage = createDexieSwapStorage();
60
- * const vtxoSwapStorage = createDexieVtxoSwapStorage();
216
+ * import { openIdbDatabase, Client } from '@lendasat/lendaswap-sdk';
61
217
  *
218
+ * const storage = await openIdbDatabase();
62
219
  * const client = await Client.create(
63
220
  * 'https://apilendaswap.lendasat.com',
64
- * walletStorage,
65
- * swapStorage,
66
- * vtxoSwapStorage,
221
+ * storage,
67
222
  * 'bitcoin',
68
223
  * 'https://arkade.computer',
69
224
  * 'https://mempool.space/api'
70
225
  * );
71
226
  * ```
72
227
  */
73
- static async create(baseUrl, walletStorage, swapStorage, vtxoSwapStorage, network, arkadeUrl, esploraUrl) {
74
- // Bind wallet storage methods to preserve 'this' context when called from WASM
75
- const jsWalletStorageProvider = new JsWalletStorageProvider(walletStorage.getMnemonic.bind(walletStorage), walletStorage.setMnemonic.bind(walletStorage), walletStorage.getKeyIndex.bind(walletStorage), walletStorage.setKeyIndex.bind(walletStorage));
76
- // Bind swap storage methods to preserve 'this' context when called from WASM
77
- const jsSwapStorageProvider = new JsSwapStorageProvider(swapStorage.get.bind(swapStorage), swapStorage.store.bind(swapStorage), swapStorage.delete.bind(swapStorage), swapStorage.list.bind(swapStorage), swapStorage.getAll.bind(swapStorage));
78
- // Bind VTXO swap storage methods to preserve 'this' context when called from WASM
79
- const jsVtxoSwapStorageProvider = new JsVtxoSwapStorageProvider(vtxoSwapStorage.get.bind(vtxoSwapStorage), vtxoSwapStorage.store.bind(vtxoSwapStorage), vtxoSwapStorage.delete.bind(vtxoSwapStorage), vtxoSwapStorage.list.bind(vtxoSwapStorage), vtxoSwapStorage.getAll.bind(vtxoSwapStorage));
80
- const wasmClient = new WasmClient(baseUrl, jsWalletStorageProvider, jsSwapStorageProvider, jsVtxoSwapStorageProvider, network, arkadeUrl, esploraUrl);
81
- return new Client(wasmClient, baseUrl, swapStorage);
228
+ static async create(baseUrl, storage, network, arkadeUrl, esploraUrl) {
229
+ const wasmClient = new WasmClient(baseUrl, storage, network, arkadeUrl, esploraUrl);
230
+ return Client.fromWasmClient(wasmClient);
82
231
  }
83
232
  async init(mnemonic) {
84
- await this.client.init(mnemonic);
233
+ await this.wasmClient.init(mnemonic);
85
234
  }
86
235
  /**
87
236
  * Create an Arkade to EVM swap (BTC → Token).
@@ -91,7 +240,29 @@ export class Client {
91
240
  * @returns The created swap response
92
241
  */
93
242
  async createArkadeToEvmSwap(request, targetNetwork) {
94
- return await this.client.createArkadeToEvmSwap(request.target_address, request.target_amount, request.target_token, targetNetwork, request.referral_code);
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);
95
266
  }
96
267
  /**
97
268
  * Create an EVM to Arkade swap (Token → BTC).
@@ -101,7 +272,7 @@ export class Client {
101
272
  * @returns The created swap response
102
273
  */
103
274
  async createEvmToArkadeSwap(request, sourceNetwork) {
104
- return await this.client.createEvmToArkadeSwap(request.target_address, request.user_address, request.source_amount, request.source_token, sourceNetwork, request.referral_code);
275
+ return await this.wasmClient.createEvmToArkadeSwap(request.target_address, request.user_address, request.source_amount, request.source_token, sourceNetwork, request.referral_code);
105
276
  }
106
277
  /**
107
278
  * Create an EVM to Lightning swap (Token → BTC).
@@ -111,13 +282,13 @@ export class Client {
111
282
  * @returns The created swap response
112
283
  */
113
284
  async createEvmToLightningSwap(request, sourceNetwork) {
114
- return await this.client.createEvmToLightningSwap(request.bolt11_invoice, request.user_address, request.source_token, sourceNetwork, request.referral_code);
285
+ return await this.wasmClient.createEvmToLightningSwap(request.bolt11_invoice, request.user_address, request.source_token, sourceNetwork, request.referral_code);
115
286
  }
116
287
  async getAssetPairs() {
117
- return await this.client.getAssetPairs();
288
+ return await this.wasmClient.getAssetPairs();
118
289
  }
119
290
  async getTokens() {
120
- return await this.client.getTokens();
291
+ return await this.wasmClient.getTokens();
121
292
  }
122
293
  /**
123
294
  * Get a quote for a swap.
@@ -128,7 +299,7 @@ export class Client {
128
299
  * @returns Quote response with exchange rate and fees
129
300
  */
130
301
  async getQuote(from, to, baseAmount) {
131
- return await this.client.getQuote(from, to, baseAmount);
302
+ return await this.wasmClient.getQuote(from, to, baseAmount);
132
303
  }
133
304
  /**
134
305
  * Get a swap by its ID.
@@ -137,7 +308,7 @@ export class Client {
137
308
  * @returns The swap data, or undefined if the swap type is unknown
138
309
  */
139
310
  async getSwap(id) {
140
- return mapWasmSwapToInterface(await this.client.getSwap(id));
311
+ return mapWasmSwapToInterface(await this.wasmClient.getSwap(id));
141
312
  }
142
313
  /**
143
314
  * Gets all stored swaps.
@@ -145,7 +316,7 @@ export class Client {
145
316
  * @returns Array of swaps (unknown types are filtered out)
146
317
  */
147
318
  async listAllSwaps() {
148
- const wasmSwaps = await this.client.listAll();
319
+ const wasmSwaps = await this.wasmClient.listAll();
149
320
  return wasmSwaps.map(mapWasmSwapToInterface).filter((s) => s !== undefined);
150
321
  }
151
322
  /**
@@ -155,7 +326,7 @@ export class Client {
155
326
  * @param secret - The preimage secret (hex-encoded)
156
327
  */
157
328
  async claimGelato(swapId, secret) {
158
- await this.client.claimGelato(swapId, secret);
329
+ await this.wasmClient.claimGelato(swapId, secret);
159
330
  }
160
331
  /**
161
332
  * Get the VHTLC amounts associated with a swap.
@@ -164,7 +335,7 @@ export class Client {
164
335
  * @returns VhtlcAmounts
165
336
  */
166
337
  async amountsForSwap(swapId) {
167
- return await this.client.amountsForSwap(swapId);
338
+ return await this.wasmClient.amountsForSwap(swapId);
168
339
  }
169
340
  /**
170
341
  * Claim a swap VHTLC
@@ -172,16 +343,17 @@ export class Client {
172
343
  * @param swapId - The swap ID
173
344
  */
174
345
  async claimVhtlc(swapId) {
175
- await this.client.claimVhtlc(swapId);
346
+ await this.wasmClient.claimVhtlc(swapId);
176
347
  }
177
348
  /**
178
- * Claim a swap VHTLC
349
+ * Refund a swap VHTLC
179
350
  *
180
351
  * @param swapId - The swap ID
352
+ * @param refundAddress - The address to receive the refund
181
353
  * @returns The TXID of the Ark transaction which refunded the VHTLC.
182
354
  */
183
355
  async refundVhtlc(swapId, refundAddress) {
184
- return await this.client.refundVhtlc(swapId, refundAddress);
356
+ return await this.wasmClient.refundVhtlc(swapId, refundAddress);
185
357
  }
186
358
  /**
187
359
  * Get the API version.
@@ -189,7 +361,7 @@ export class Client {
189
361
  * @returns Version information
190
362
  */
191
363
  async getVersion() {
192
- return await this.client.getVersion();
364
+ return await this.wasmClient.getVersion();
193
365
  }
194
366
  /**
195
367
  * Recover swaps for the currently loaded mnemonic.
@@ -197,7 +369,7 @@ export class Client {
197
369
  * @returns Array of recovered swaps (unknown types are filtered out)
198
370
  */
199
371
  async recoverSwaps() {
200
- const wasmSwaps = await this.client.recoverSwaps();
372
+ const wasmSwaps = await this.wasmClient.recoverSwaps();
201
373
  return wasmSwaps.map(mapWasmSwapToInterface).filter((s) => s !== undefined);
202
374
  }
203
375
  /**
@@ -205,99 +377,26 @@ export class Client {
205
377
  * @returns The mnemonic as string
206
378
  */
207
379
  async getMnemonic() {
208
- return await this.client.getMnemonic();
380
+ return await this.wasmClient.getMnemonic();
209
381
  }
210
382
  /**
211
383
  * Get current loaded user id xpub
212
384
  * @returns The xpub as string
213
385
  */
214
386
  async getUserIdXpub() {
215
- return await this.client.getUserIdXpub();
387
+ return await this.wasmClient.getUserIdXpub();
216
388
  }
217
389
  /**
218
390
  * Deletes all stored swaps
219
391
  */
220
392
  async clearSwapStorage() {
221
- return await this.client.clearSwapStorage();
393
+ await this.wasmClient.clearSwapStorage();
222
394
  }
223
395
  /**
224
396
  * Delete one particular swap by id
225
397
  */
226
398
  async deleteSwap(id) {
227
- return await this.client.deleteSwap(id);
228
- }
229
- /**
230
- * Get the list of swap IDs that failed to deserialize during the last listAllSwaps() call.
231
- * These are "corrupted" entries that couldn't be loaded due to invalid or missing data.
232
- *
233
- * @returns Array of swap IDs that failed to load
234
- */
235
- getCorruptedSwapIds() {
236
- return this.client.getCorruptedSwapIds();
237
- }
238
- /**
239
- * Delete all corrupted swap entries from storage.
240
- * Call this after listAllSwaps() to clean up entries that couldn't be deserialized.
241
- *
242
- * @returns The number of corrupted entries that were deleted
243
- */
244
- async deleteCorruptedSwaps() {
245
- return await this.client.deleteCorruptedSwaps();
246
- }
247
- /**
248
- * Attempt to repair corrupted swap entries by fetching missing data from the server.
249
- *
250
- * For each corrupted swap ID:
251
- * 1. Reads the raw swap_params from local storage
252
- * 2. Fetches the swap response from the server via GET /swap/:id
253
- * 3. Combines them and stores the repaired entry
254
- *
255
- * @returns Object with repaired count and any failed IDs
256
- */
257
- async repairCorruptedSwaps() {
258
- const corruptedIds = this.getCorruptedSwapIds();
259
- if (corruptedIds.length === 0) {
260
- return { repaired: 0, failed: [] };
261
- }
262
- // Check if storage provider supports raw access
263
- if (!this.swapStorage.getRawSwapParams) {
264
- console.warn("Storage provider does not support getRawSwapParams - cannot repair corrupted entries");
265
- return { repaired: 0, failed: corruptedIds };
266
- }
267
- const failed = [];
268
- let repaired = 0;
269
- for (const swapId of corruptedIds) {
270
- try {
271
- // Get raw swap_params from storage
272
- const swapParams = await this.swapStorage.getRawSwapParams(swapId);
273
- if (!swapParams) {
274
- console.warn(`No swap_params found for corrupted swap ${swapId}`);
275
- failed.push(swapId);
276
- continue;
277
- }
278
- // Fetch response from server
279
- const response = await fetch(`${this.baseUrl}/swap/${swapId}`);
280
- if (!response.ok) {
281
- console.warn(`Failed to fetch swap ${swapId} from server: ${response.status}`);
282
- failed.push(swapId);
283
- continue;
284
- }
285
- const serverResponse = await response.json();
286
- // Combine and store
287
- const repairedData = {
288
- response: serverResponse,
289
- swap_params: swapParams,
290
- };
291
- await this.swapStorage.store(swapId, repairedData);
292
- repaired++;
293
- console.log(`Repaired swap ${swapId}`);
294
- }
295
- catch (error) {
296
- console.error(`Error repairing swap ${swapId}:`, error);
297
- failed.push(swapId);
298
- }
299
- }
300
- return { repaired, failed };
399
+ await this.wasmClient.deleteSwap(id);
301
400
  }
302
401
  // =========================================================================
303
402
  // VTXO Swap Methods
@@ -309,7 +408,7 @@ export class Client {
309
408
  * @returns Estimate response with fee and output amounts
310
409
  */
311
410
  async estimateVtxoSwap(vtxos) {
312
- return await this.client.estimateVtxoSwap(vtxos);
411
+ return await this.wasmClient.estimateVtxoSwap(vtxos);
313
412
  }
314
413
  /**
315
414
  * Create a VTXO swap for refreshing VTXOs.
@@ -322,7 +421,7 @@ export class Client {
322
421
  * @returns The swap response and swap parameters
323
422
  */
324
423
  async createVtxoSwap(vtxos) {
325
- return await this.client.createVtxoSwap(vtxos);
424
+ return await this.wasmClient.createVtxoSwap(vtxos);
326
425
  }
327
426
  /**
328
427
  * Get VTXO swap details by ID.
@@ -331,7 +430,7 @@ export class Client {
331
430
  * @returns The extended VTXO swap data
332
431
  */
333
432
  async getVtxoSwap(id) {
334
- return await this.client.getVtxoSwap(id);
433
+ return await this.wasmClient.getVtxoSwap(id);
335
434
  }
336
435
  /**
337
436
  * Claim the server's VHTLC in a VTXO swap.
@@ -345,7 +444,7 @@ export class Client {
345
444
  * @returns The claim transaction ID
346
445
  */
347
446
  async claimVtxoSwap(swap, swapParams, claimAddress) {
348
- return await this.client.claimVtxoSwap(swap, swapParams, claimAddress);
447
+ return await this.wasmClient.claimVtxoSwap(swap, swapParams, claimAddress);
349
448
  }
350
449
  /**
351
450
  * Refund the client's VHTLC in a VTXO swap.
@@ -358,7 +457,7 @@ export class Client {
358
457
  * @returns The refund transaction ID
359
458
  */
360
459
  async refundVtxoSwap(swapId, refundAddress) {
361
- return await this.client.refundVtxoSwap(swapId, refundAddress);
460
+ return await this.wasmClient.refundVtxoSwap(swapId, refundAddress);
362
461
  }
363
462
  /**
364
463
  * List all VTXO swaps from local storage.
@@ -368,7 +467,7 @@ export class Client {
368
467
  * @returns Array of all stored extended VTXO swap data
369
468
  */
370
469
  async listAllVtxoSwaps() {
371
- return await this.client.listAllVtxoSwaps();
470
+ return await this.wasmClient.listAllVtxoSwaps();
372
471
  }
373
472
  /**
374
473
  * Create an on-chain Bitcoin to Arkade swap.
@@ -379,7 +478,7 @@ export class Client {
379
478
  * @returns The created swap response with P2WSH address to fund
380
479
  */
381
480
  async createBitcoinToArkadeSwap(request) {
382
- return await this.client.createBitcoinToArkadeSwap(request.target_arkade_address, BigInt(request.sats_receive), request.referral_code);
481
+ return await this.wasmClient.createBitcoinToArkadeSwap(request.target_arkade_address, BigInt(request.sats_receive), request.referral_code);
383
482
  }
384
483
  /**
385
484
  * Claim the Arkade VHTLC for a BTC-to-Arkade swap.
@@ -390,7 +489,7 @@ export class Client {
390
489
  * @returns The Arkade claim transaction ID
391
490
  */
392
491
  async claimBtcToArkadeVhtlc(swapId) {
393
- return await this.client.claimBtcToArkadeVhtlc(swapId);
492
+ return await this.wasmClient.claimBtcToArkadeVhtlc(swapId);
394
493
  }
395
494
  /**
396
495
  * Refund from the on-chain Bitcoin HTLC after timeout.
@@ -402,7 +501,7 @@ export class Client {
402
501
  * @returns The refund transaction ID
403
502
  */
404
503
  async refundOnchainHtlc(swapId, refundAddress) {
405
- return await this.client.refundOnchainHtlc(swapId, refundAddress);
504
+ return await this.wasmClient.refundOnchainHtlc(swapId, refundAddress);
406
505
  }
407
506
  }
408
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,EAIL,MAAM,IAAI,UAAU,EAMpB,WAAW,IA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