@lendasat/lendaswap-sdk 0.1.4 → 0.1.7

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.
@@ -0,0 +1,3019 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
36
+
37
+ let WASM_VECTOR_LEN = 0;
38
+
39
+ const cachedTextEncoder = new TextEncoder();
40
+
41
+ if (!('encodeInto' in cachedTextEncoder)) {
42
+ cachedTextEncoder.encodeInto = function (arg, view) {
43
+ const buf = cachedTextEncoder.encode(arg);
44
+ view.set(buf);
45
+ return {
46
+ read: arg.length,
47
+ written: buf.length
48
+ };
49
+ }
50
+ }
51
+
52
+ function passStringToWasm0(arg, malloc, realloc) {
53
+
54
+ if (realloc === undefined) {
55
+ const buf = cachedTextEncoder.encode(arg);
56
+ const ptr = malloc(buf.length, 1) >>> 0;
57
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
58
+ WASM_VECTOR_LEN = buf.length;
59
+ return ptr;
60
+ }
61
+
62
+ let len = arg.length;
63
+ let ptr = malloc(len, 1) >>> 0;
64
+
65
+ const mem = getUint8ArrayMemory0();
66
+
67
+ let offset = 0;
68
+
69
+ for (; offset < len; offset++) {
70
+ const code = arg.charCodeAt(offset);
71
+ if (code > 0x7F) break;
72
+ mem[ptr + offset] = code;
73
+ }
74
+
75
+ if (offset !== len) {
76
+ if (offset !== 0) {
77
+ arg = arg.slice(offset);
78
+ }
79
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
80
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
81
+ const ret = cachedTextEncoder.encodeInto(arg, view);
82
+
83
+ offset += ret.written;
84
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
85
+ }
86
+
87
+ WASM_VECTOR_LEN = offset;
88
+ return ptr;
89
+ }
90
+
91
+ let cachedDataViewMemory0 = null;
92
+
93
+ function getDataViewMemory0() {
94
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
95
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
96
+ }
97
+ return cachedDataViewMemory0;
98
+ }
99
+
100
+ function isLikeNone(x) {
101
+ return x === undefined || x === null;
102
+ }
103
+
104
+ function debugString(val) {
105
+ // primitive types
106
+ const type = typeof val;
107
+ if (type == 'number' || type == 'boolean' || val == null) {
108
+ return `${val}`;
109
+ }
110
+ if (type == 'string') {
111
+ return `"${val}"`;
112
+ }
113
+ if (type == 'symbol') {
114
+ const description = val.description;
115
+ if (description == null) {
116
+ return 'Symbol';
117
+ } else {
118
+ return `Symbol(${description})`;
119
+ }
120
+ }
121
+ if (type == 'function') {
122
+ const name = val.name;
123
+ if (typeof name == 'string' && name.length > 0) {
124
+ return `Function(${name})`;
125
+ } else {
126
+ return 'Function';
127
+ }
128
+ }
129
+ // objects
130
+ if (Array.isArray(val)) {
131
+ const length = val.length;
132
+ let debug = '[';
133
+ if (length > 0) {
134
+ debug += debugString(val[0]);
135
+ }
136
+ for(let i = 1; i < length; i++) {
137
+ debug += ', ' + debugString(val[i]);
138
+ }
139
+ debug += ']';
140
+ return debug;
141
+ }
142
+ // Test for built-in
143
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
144
+ let className;
145
+ if (builtInMatches && builtInMatches.length > 1) {
146
+ className = builtInMatches[1];
147
+ } else {
148
+ // Failed to match the standard '[object ClassName]'
149
+ return toString.call(val);
150
+ }
151
+ if (className == 'Object') {
152
+ // we're a user defined class or Object
153
+ // JSON.stringify avoids problems with cycles, and is generally much
154
+ // easier than looping through ownProperties of `val`.
155
+ try {
156
+ return 'Object(' + JSON.stringify(val) + ')';
157
+ } catch (_) {
158
+ return 'Object';
159
+ }
160
+ }
161
+ // errors
162
+ if (val instanceof Error) {
163
+ return `${val.name}: ${val.message}\n${val.stack}`;
164
+ }
165
+ // TODO we could test for more things here, like `Set`s and `Map`s.
166
+ return className;
167
+ }
168
+
169
+ function addToExternrefTable0(obj) {
170
+ const idx = wasm.__externref_table_alloc();
171
+ wasm.__wbindgen_externrefs.set(idx, obj);
172
+ return idx;
173
+ }
174
+
175
+ function handleError(f, args) {
176
+ try {
177
+ return f.apply(this, args);
178
+ } catch (e) {
179
+ const idx = addToExternrefTable0(e);
180
+ wasm.__wbindgen_exn_store(idx);
181
+ }
182
+ }
183
+
184
+ function getArrayU8FromWasm0(ptr, len) {
185
+ ptr = ptr >>> 0;
186
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
187
+ }
188
+
189
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
190
+ ? { register: () => {}, unregister: () => {} }
191
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
192
+
193
+ function makeMutClosure(arg0, arg1, dtor, f) {
194
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
195
+ const real = (...args) => {
196
+
197
+ // First up with a closure we increment the internal reference
198
+ // count. This ensures that the Rust closure environment won't
199
+ // be deallocated while we're invoking it.
200
+ state.cnt++;
201
+ const a = state.a;
202
+ state.a = 0;
203
+ try {
204
+ return f(a, state.b, ...args);
205
+ } finally {
206
+ state.a = a;
207
+ real._wbg_cb_unref();
208
+ }
209
+ };
210
+ real._wbg_cb_unref = () => {
211
+ if (--state.cnt === 0) {
212
+ state.dtor(state.a, state.b);
213
+ state.a = 0;
214
+ CLOSURE_DTORS.unregister(state);
215
+ }
216
+ };
217
+ CLOSURE_DTORS.register(real, state, state);
218
+ return real;
219
+ }
220
+
221
+ function getArrayJsValueFromWasm0(ptr, len) {
222
+ ptr = ptr >>> 0;
223
+ const mem = getDataViewMemory0();
224
+ const result = [];
225
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
226
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
227
+ }
228
+ wasm.__externref_drop_slice(ptr, len);
229
+ return result;
230
+ }
231
+
232
+ function _assertClass(instance, klass) {
233
+ if (!(instance instanceof klass)) {
234
+ throw new Error(`expected instance of ${klass.name}`);
235
+ }
236
+ }
237
+
238
+ function takeFromExternrefTable0(idx) {
239
+ const value = wasm.__wbindgen_externrefs.get(idx);
240
+ wasm.__externref_table_dealloc(idx);
241
+ return value;
242
+ }
243
+
244
+ function passArrayJsValueToWasm0(array, malloc) {
245
+ const ptr = malloc(array.length * 4, 4) >>> 0;
246
+ for (let i = 0; i < array.length; i++) {
247
+ const add = addToExternrefTable0(array[i]);
248
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
249
+ }
250
+ WASM_VECTOR_LEN = array.length;
251
+ return ptr;
252
+ }
253
+ /**
254
+ * Initialize the WASM module.
255
+ *
256
+ * This sets up logging and panic hooks for better debugging.
257
+ * Log level can be configured via localStorage key "lendaswap_log_level".
258
+ * Valid values: "trace", "debug", "info", "warn", "error" (case-insensitive).
259
+ * Default is "warn" if not set or invalid.
260
+ */
261
+ export function initialize() {
262
+ wasm.initialize();
263
+ }
264
+
265
+ /**
266
+ * Set the log level at runtime.
267
+ * This updates localStorage and reinitializes the logger.
268
+ *
269
+ * Valid values: "trace", "debug", "info", "warn", "error" (case-insensitive).
270
+ * @param {string} level
271
+ */
272
+ export function setLogLevel(level) {
273
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ret = wasm.setLogLevel(ptr0, len0);
276
+ if (ret[1]) {
277
+ throw takeFromExternrefTable0(ret[0]);
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Get the current log level.
283
+ * @returns {string}
284
+ */
285
+ export function getLogLevel() {
286
+ let deferred1_0;
287
+ let deferred1_1;
288
+ try {
289
+ const ret = wasm.getLogLevel();
290
+ deferred1_0 = ret[0];
291
+ deferred1_1 = ret[1];
292
+ return getStringFromWasm0(ret[0], ret[1]);
293
+ } finally {
294
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
295
+ }
296
+ }
297
+
298
+ function wasm_bindgen__convert__closures_____invoke__hf86cb6f5b134f7f7(arg0, arg1, arg2) {
299
+ wasm.wasm_bindgen__convert__closures_____invoke__hf86cb6f5b134f7f7(arg0, arg1, arg2);
300
+ }
301
+
302
+ function wasm_bindgen__convert__closures_____invoke__h49d21def8d7e8715(arg0, arg1) {
303
+ wasm.wasm_bindgen__convert__closures_____invoke__h49d21def8d7e8715(arg0, arg1);
304
+ }
305
+
306
+ function wasm_bindgen__convert__closures_____invoke__h68e6792a5299b78b(arg0, arg1, arg2, arg3) {
307
+ wasm.wasm_bindgen__convert__closures_____invoke__h68e6792a5299b78b(arg0, arg1, arg2, arg3);
308
+ }
309
+
310
+ /**
311
+ * Chain type for token information.
312
+ * @enum {0 | 1 | 2 | 3}
313
+ */
314
+ export const Chain = Object.freeze({
315
+ Arkade: 0, "0": "Arkade",
316
+ Lightning: 1, "1": "Lightning",
317
+ Polygon: 2, "2": "Polygon",
318
+ Ethereum: 3, "3": "Ethereum",
319
+ });
320
+
321
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
322
+
323
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
324
+
325
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
326
+
327
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
328
+
329
+ const AssetPairFinalization = (typeof FinalizationRegistry === 'undefined')
330
+ ? { register: () => {}, unregister: () => {} }
331
+ : new FinalizationRegistry(ptr => wasm.__wbg_assetpair_free(ptr >>> 0, 1));
332
+ /**
333
+ * Token information.
334
+ */
335
+ export class AssetPair {
336
+
337
+ static __wrap(ptr) {
338
+ ptr = ptr >>> 0;
339
+ const obj = Object.create(AssetPair.prototype);
340
+ obj.__wbg_ptr = ptr;
341
+ AssetPairFinalization.register(obj, obj.__wbg_ptr, obj);
342
+ return obj;
343
+ }
344
+
345
+ __destroy_into_raw() {
346
+ const ptr = this.__wbg_ptr;
347
+ this.__wbg_ptr = 0;
348
+ AssetPairFinalization.unregister(this);
349
+ return ptr;
350
+ }
351
+
352
+ free() {
353
+ const ptr = this.__destroy_into_raw();
354
+ wasm.__wbg_assetpair_free(ptr, 0);
355
+ }
356
+ /**
357
+ * @returns {TokenInfo}
358
+ */
359
+ get source() {
360
+ const ret = wasm.__wbg_get_assetpair_source(this.__wbg_ptr);
361
+ return TokenInfo.__wrap(ret);
362
+ }
363
+ /**
364
+ * @param {TokenInfo} arg0
365
+ */
366
+ set source(arg0) {
367
+ _assertClass(arg0, TokenInfo);
368
+ var ptr0 = arg0.__destroy_into_raw();
369
+ wasm.__wbg_set_assetpair_source(this.__wbg_ptr, ptr0);
370
+ }
371
+ /**
372
+ * @returns {TokenInfo}
373
+ */
374
+ get target() {
375
+ const ret = wasm.__wbg_get_assetpair_target(this.__wbg_ptr);
376
+ return TokenInfo.__wrap(ret);
377
+ }
378
+ /**
379
+ * @param {TokenInfo} arg0
380
+ */
381
+ set target(arg0) {
382
+ _assertClass(arg0, TokenInfo);
383
+ var ptr0 = arg0.__destroy_into_raw();
384
+ wasm.__wbg_set_assetpair_target(this.__wbg_ptr, ptr0);
385
+ }
386
+ }
387
+ if (Symbol.dispose) AssetPair.prototype[Symbol.dispose] = AssetPair.prototype.free;
388
+
389
+ const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
390
+ ? { register: () => {}, unregister: () => {} }
391
+ : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
392
+ /**
393
+ * Lendaswap client.
394
+ */
395
+ export class Client {
396
+
397
+ __destroy_into_raw() {
398
+ const ptr = this.__wbg_ptr;
399
+ this.__wbg_ptr = 0;
400
+ ClientFinalization.unregister(this);
401
+ return ptr;
402
+ }
403
+
404
+ free() {
405
+ const ptr = this.__destroy_into_raw();
406
+ wasm.__wbg_client_free(ptr, 0);
407
+ }
408
+ /**
409
+ * Create a new client with separate wallet and swap storage.
410
+ *
411
+ * # Arguments
412
+ * * `base_url` - The Lendaswap API URL
413
+ * * `wallet_storage` - Storage provider for wallet data (mnemonic, key index)
414
+ * * `swap_storage` - Storage provider for swap data
415
+ * * `network` - The Bitcoin network ("bitcoin" or "testnet")
416
+ * * `arkade_url` - The Arkade server URL
417
+ * @param {string} base_url
418
+ * @param {JsWalletStorageProvider} wallet_storage
419
+ * @param {JsSwapStorageProvider} swap_storage
420
+ * @param {string} network
421
+ * @param {string} arkade_url
422
+ */
423
+ constructor(base_url, wallet_storage, swap_storage, network, arkade_url) {
424
+ const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
425
+ const len0 = WASM_VECTOR_LEN;
426
+ _assertClass(wallet_storage, JsWalletStorageProvider);
427
+ var ptr1 = wallet_storage.__destroy_into_raw();
428
+ _assertClass(swap_storage, JsSwapStorageProvider);
429
+ var ptr2 = swap_storage.__destroy_into_raw();
430
+ const ptr3 = passStringToWasm0(network, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
431
+ const len3 = WASM_VECTOR_LEN;
432
+ const ptr4 = passStringToWasm0(arkade_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
433
+ const len4 = WASM_VECTOR_LEN;
434
+ const ret = wasm.client_new(ptr0, len0, ptr1, ptr2, ptr3, len3, ptr4, len4);
435
+ if (ret[2]) {
436
+ throw takeFromExternrefTable0(ret[1]);
437
+ }
438
+ this.__wbg_ptr = ret[0] >>> 0;
439
+ ClientFinalization.register(this, this.__wbg_ptr, this);
440
+ return this;
441
+ }
442
+ /**
443
+ * @param {string | null} [mnemonic]
444
+ * @returns {Promise<void>}
445
+ */
446
+ init(mnemonic) {
447
+ var ptr0 = isLikeNone(mnemonic) ? 0 : passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ var len0 = WASM_VECTOR_LEN;
449
+ const ret = wasm.client_init(this.__wbg_ptr, ptr0, len0);
450
+ return ret;
451
+ }
452
+ /**
453
+ * Create an Arkade to EVM swap.
454
+ * @param {string} target_address
455
+ * @param {number} target_amount
456
+ * @param {string} target_token
457
+ * @param {string} target_chain
458
+ * @param {string | null} [referral_code]
459
+ * @returns {Promise<any>}
460
+ */
461
+ createArkadeToEvmSwap(target_address, target_amount, target_token, target_chain, referral_code) {
462
+ const ptr0 = passStringToWasm0(target_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
+ const len0 = WASM_VECTOR_LEN;
464
+ const ptr1 = passStringToWasm0(target_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ const len1 = WASM_VECTOR_LEN;
466
+ const ptr2 = passStringToWasm0(target_chain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
467
+ const len2 = WASM_VECTOR_LEN;
468
+ var ptr3 = isLikeNone(referral_code) ? 0 : passStringToWasm0(referral_code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
469
+ var len3 = WASM_VECTOR_LEN;
470
+ const ret = wasm.client_createArkadeToEvmSwap(this.__wbg_ptr, ptr0, len0, target_amount, ptr1, len1, ptr2, len2, ptr3, len3);
471
+ return ret;
472
+ }
473
+ /**
474
+ * Create an EVM to Arkade swap.
475
+ * @param {string} target_address
476
+ * @param {string} user_address
477
+ * @param {number} source_amount
478
+ * @param {string} source_token
479
+ * @param {string} source_chain
480
+ * @param {string | null} [referral_code]
481
+ * @returns {Promise<any>}
482
+ */
483
+ createEvmToArkadeSwap(target_address, user_address, source_amount, source_token, source_chain, referral_code) {
484
+ const ptr0 = passStringToWasm0(target_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ptr1 = passStringToWasm0(user_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
487
+ const len1 = WASM_VECTOR_LEN;
488
+ const ptr2 = passStringToWasm0(source_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
489
+ const len2 = WASM_VECTOR_LEN;
490
+ const ptr3 = passStringToWasm0(source_chain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
491
+ const len3 = WASM_VECTOR_LEN;
492
+ var ptr4 = isLikeNone(referral_code) ? 0 : passStringToWasm0(referral_code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
+ var len4 = WASM_VECTOR_LEN;
494
+ const ret = wasm.client_createEvmToArkadeSwap(this.__wbg_ptr, ptr0, len0, ptr1, len1, source_amount, ptr2, len2, ptr3, len3, ptr4, len4);
495
+ return ret;
496
+ }
497
+ /**
498
+ * Create an EVM to Lightning swap.
499
+ * @param {string} bolt11_invoice
500
+ * @param {string} user_address
501
+ * @param {string} source_token
502
+ * @param {string} source_chain
503
+ * @param {string | null} [referral_code]
504
+ * @returns {Promise<any>}
505
+ */
506
+ createEvmToLightningSwap(bolt11_invoice, user_address, source_token, source_chain, referral_code) {
507
+ const ptr0 = passStringToWasm0(bolt11_invoice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
508
+ const len0 = WASM_VECTOR_LEN;
509
+ const ptr1 = passStringToWasm0(user_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
510
+ const len1 = WASM_VECTOR_LEN;
511
+ const ptr2 = passStringToWasm0(source_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
512
+ const len2 = WASM_VECTOR_LEN;
513
+ const ptr3 = passStringToWasm0(source_chain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
514
+ const len3 = WASM_VECTOR_LEN;
515
+ var ptr4 = isLikeNone(referral_code) ? 0 : passStringToWasm0(referral_code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ var len4 = WASM_VECTOR_LEN;
517
+ const ret = wasm.client_createEvmToLightningSwap(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
518
+ return ret;
519
+ }
520
+ /**
521
+ * @returns {Promise<AssetPair[]>}
522
+ */
523
+ getAssetPairs() {
524
+ const ret = wasm.client_getAssetPairs(this.__wbg_ptr);
525
+ return ret;
526
+ }
527
+ /**
528
+ * @returns {Promise<TokenInfo[]>}
529
+ */
530
+ getTokens() {
531
+ const ret = wasm.client_getTokens(this.__wbg_ptr);
532
+ return ret;
533
+ }
534
+ /**
535
+ * Get a quote.
536
+ * @param {string} from
537
+ * @param {string} to
538
+ * @param {bigint} base_amount
539
+ * @returns {Promise<QuoteResponse>}
540
+ */
541
+ getQuote(from, to, base_amount) {
542
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
543
+ const len0 = WASM_VECTOR_LEN;
544
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
+ const len1 = WASM_VECTOR_LEN;
546
+ const ret = wasm.client_getQuote(this.__wbg_ptr, ptr0, len0, ptr1, len1, base_amount);
547
+ return ret;
548
+ }
549
+ /**
550
+ * Get swap by ID.
551
+ *
552
+ * This function returns `[ExtendedSwapResponse]`. It's too complex for Wasm to handle.
553
+ * @param {string} id
554
+ * @returns {Promise<any>}
555
+ */
556
+ getSwap(id) {
557
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ const ret = wasm.client_getSwap(this.__wbg_ptr, ptr0, len0);
560
+ return ret;
561
+ }
562
+ /**
563
+ * Get all swaps.
564
+ *
565
+ * This function returns `[ExtendedSwapResponse[]]`. It's too complex for Wasm to handle.
566
+ * @returns {Promise<any>}
567
+ */
568
+ listAll() {
569
+ const ret = wasm.client_listAll(this.__wbg_ptr);
570
+ return ret;
571
+ }
572
+ /**
573
+ * @param {string} swap_id
574
+ * @param {string | null} [secret]
575
+ * @returns {Promise<void>}
576
+ */
577
+ claimGelato(swap_id, secret) {
578
+ const ptr0 = passStringToWasm0(swap_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
579
+ const len0 = WASM_VECTOR_LEN;
580
+ var ptr1 = isLikeNone(secret) ? 0 : passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
581
+ var len1 = WASM_VECTOR_LEN;
582
+ const ret = wasm.client_claimGelato(this.__wbg_ptr, ptr0, len0, ptr1, len1);
583
+ return ret;
584
+ }
585
+ /**
586
+ * @param {string} swap_id
587
+ * @returns {Promise<any>}
588
+ */
589
+ amountsForSwap(swap_id) {
590
+ const ptr0 = passStringToWasm0(swap_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
591
+ const len0 = WASM_VECTOR_LEN;
592
+ const ret = wasm.client_amountsForSwap(this.__wbg_ptr, ptr0, len0);
593
+ return ret;
594
+ }
595
+ /**
596
+ * @param {string} swap_id
597
+ * @returns {Promise<void>}
598
+ */
599
+ claimVhtlc(swap_id) {
600
+ const ptr0 = passStringToWasm0(swap_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
601
+ const len0 = WASM_VECTOR_LEN;
602
+ const ret = wasm.client_claimVhtlc(this.__wbg_ptr, ptr0, len0);
603
+ return ret;
604
+ }
605
+ /**
606
+ * @param {string} swap_id
607
+ * @param {string} refund_address
608
+ * @returns {Promise<string>}
609
+ */
610
+ refundVhtlc(swap_id, refund_address) {
611
+ const ptr0 = passStringToWasm0(swap_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
612
+ const len0 = WASM_VECTOR_LEN;
613
+ const ptr1 = passStringToWasm0(refund_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
614
+ const len1 = WASM_VECTOR_LEN;
615
+ const ret = wasm.client_refundVhtlc(this.__wbg_ptr, ptr0, len0, ptr1, len1);
616
+ return ret;
617
+ }
618
+ /**
619
+ * Get API version.
620
+ * @returns {Promise<Version>}
621
+ */
622
+ getVersion() {
623
+ const ret = wasm.client_getVersion(this.__wbg_ptr);
624
+ return ret;
625
+ }
626
+ /**
627
+ * Recover swaps using xpub.
628
+ * @returns {Promise<any>}
629
+ */
630
+ recoverSwaps() {
631
+ const ret = wasm.client_recoverSwaps(this.__wbg_ptr);
632
+ return ret;
633
+ }
634
+ /**
635
+ * Get mnemonic
636
+ * @returns {Promise<string>}
637
+ */
638
+ getMnemonic() {
639
+ const ret = wasm.client_getMnemonic(this.__wbg_ptr);
640
+ return ret;
641
+ }
642
+ /**
643
+ * Get userIdXpub
644
+ * @returns {Promise<string>}
645
+ */
646
+ getUserIdXpub() {
647
+ const ret = wasm.client_getUserIdXpub(this.__wbg_ptr);
648
+ return ret;
649
+ }
650
+ /**
651
+ * Deletes all stored swaps
652
+ * @returns {Promise<void>}
653
+ */
654
+ clearSwapStorage() {
655
+ const ret = wasm.client_clearSwapStorage(this.__wbg_ptr);
656
+ return ret;
657
+ }
658
+ /**
659
+ * Delete specific swap
660
+ * @param {string} id
661
+ * @returns {Promise<void>}
662
+ */
663
+ deleteSwap(id) {
664
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
665
+ const len0 = WASM_VECTOR_LEN;
666
+ const ret = wasm.client_deleteSwap(this.__wbg_ptr, ptr0, len0);
667
+ return ret;
668
+ }
669
+ /**
670
+ * Estimate the fee for a VTXO swap.
671
+ *
672
+ * # Arguments
673
+ * * `vtxos` - List of VTXO outpoints to refresh ("txid:vout" format)
674
+ * @param {string[]} vtxos
675
+ * @returns {Promise<EstimateVtxoSwapResponse>}
676
+ */
677
+ estimateVtxoSwap(vtxos) {
678
+ const ptr0 = passArrayJsValueToWasm0(vtxos, wasm.__wbindgen_malloc);
679
+ const len0 = WASM_VECTOR_LEN;
680
+ const ret = wasm.client_estimateVtxoSwap(this.__wbg_ptr, ptr0, len0);
681
+ return ret;
682
+ }
683
+ /**
684
+ * Create a VTXO swap for refreshing VTXOs.
685
+ *
686
+ * Returns the swap response and swap params.
687
+ *
688
+ * # Arguments
689
+ * * `vtxos` - List of VTXO outpoints to refresh ("txid:vout" format)
690
+ * @param {string[]} vtxos
691
+ * @returns {Promise<CreateVtxoSwapResult>}
692
+ */
693
+ createVtxoSwap(vtxos) {
694
+ const ptr0 = passArrayJsValueToWasm0(vtxos, wasm.__wbindgen_malloc);
695
+ const len0 = WASM_VECTOR_LEN;
696
+ const ret = wasm.client_createVtxoSwap(this.__wbg_ptr, ptr0, len0);
697
+ return ret;
698
+ }
699
+ /**
700
+ * Get VTXO swap details by ID.
701
+ * @param {string} id
702
+ * @returns {Promise<VtxoSwapResponse>}
703
+ */
704
+ getVtxoSwap(id) {
705
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
706
+ const len0 = WASM_VECTOR_LEN;
707
+ const ret = wasm.client_getVtxoSwap(this.__wbg_ptr, ptr0, len0);
708
+ return ret;
709
+ }
710
+ /**
711
+ * Claim the server's VHTLC in a VTXO swap.
712
+ *
713
+ * # Arguments
714
+ * * `swap` - The VTXO swap response
715
+ * * `swap_params` - The client's swap parameters
716
+ * * `claim_address` - The Arkade address to receive the claimed funds
717
+ * @param {VtxoSwapResponse} swap
718
+ * @param {SwapParams} swap_params
719
+ * @param {string} claim_address
720
+ * @returns {Promise<string>}
721
+ */
722
+ claimVtxoSwap(swap, swap_params, claim_address) {
723
+ _assertClass(swap, VtxoSwapResponse);
724
+ _assertClass(swap_params, SwapParams);
725
+ const ptr0 = passStringToWasm0(claim_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
726
+ const len0 = WASM_VECTOR_LEN;
727
+ const ret = wasm.client_claimVtxoSwap(this.__wbg_ptr, swap.__wbg_ptr, swap_params.__wbg_ptr, ptr0, len0);
728
+ return ret;
729
+ }
730
+ /**
731
+ * Refund the client's VHTLC in a VTXO swap.
732
+ *
733
+ * # Arguments
734
+ * * `swap` - The VTXO swap response
735
+ * * `swap_params` - The client's swap parameters
736
+ * * `refund_address` - The Arkade address to receive the refunded funds
737
+ * @param {VtxoSwapResponse} swap
738
+ * @param {SwapParams} swap_params
739
+ * @param {string} refund_address
740
+ * @returns {Promise<string>}
741
+ */
742
+ refundVtxoSwap(swap, swap_params, refund_address) {
743
+ _assertClass(swap, VtxoSwapResponse);
744
+ _assertClass(swap_params, SwapParams);
745
+ const ptr0 = passStringToWasm0(refund_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
746
+ const len0 = WASM_VECTOR_LEN;
747
+ const ret = wasm.client_refundVtxoSwap(this.__wbg_ptr, swap.__wbg_ptr, swap_params.__wbg_ptr, ptr0, len0);
748
+ return ret;
749
+ }
750
+ }
751
+ if (Symbol.dispose) Client.prototype[Symbol.dispose] = Client.prototype.free;
752
+
753
+ const CreateVtxoSwapResultFinalization = (typeof FinalizationRegistry === 'undefined')
754
+ ? { register: () => {}, unregister: () => {} }
755
+ : new FinalizationRegistry(ptr => wasm.__wbg_createvtxoswapresult_free(ptr >>> 0, 1));
756
+ /**
757
+ * Result from creating a VTXO swap.
758
+ */
759
+ export class CreateVtxoSwapResult {
760
+
761
+ static __wrap(ptr) {
762
+ ptr = ptr >>> 0;
763
+ const obj = Object.create(CreateVtxoSwapResult.prototype);
764
+ obj.__wbg_ptr = ptr;
765
+ CreateVtxoSwapResultFinalization.register(obj, obj.__wbg_ptr, obj);
766
+ return obj;
767
+ }
768
+
769
+ __destroy_into_raw() {
770
+ const ptr = this.__wbg_ptr;
771
+ this.__wbg_ptr = 0;
772
+ CreateVtxoSwapResultFinalization.unregister(this);
773
+ return ptr;
774
+ }
775
+
776
+ free() {
777
+ const ptr = this.__destroy_into_raw();
778
+ wasm.__wbg_createvtxoswapresult_free(ptr, 0);
779
+ }
780
+ /**
781
+ * The swap response
782
+ * @returns {VtxoSwapResponse}
783
+ */
784
+ get response() {
785
+ const ret = wasm.__wbg_get_createvtxoswapresult_response(this.__wbg_ptr);
786
+ return VtxoSwapResponse.__wrap(ret);
787
+ }
788
+ /**
789
+ * The swap response
790
+ * @param {VtxoSwapResponse} arg0
791
+ */
792
+ set response(arg0) {
793
+ _assertClass(arg0, VtxoSwapResponse);
794
+ var ptr0 = arg0.__destroy_into_raw();
795
+ wasm.__wbg_set_createvtxoswapresult_response(this.__wbg_ptr, ptr0);
796
+ }
797
+ /**
798
+ * The swap parameters (needed for claim/refund)
799
+ * @returns {SwapParams}
800
+ */
801
+ get swapParams() {
802
+ const ret = wasm.__wbg_get_createvtxoswapresult_swapParams(this.__wbg_ptr);
803
+ return SwapParams.__wrap(ret);
804
+ }
805
+ /**
806
+ * The swap parameters (needed for claim/refund)
807
+ * @param {SwapParams} arg0
808
+ */
809
+ set swapParams(arg0) {
810
+ _assertClass(arg0, SwapParams);
811
+ var ptr0 = arg0.__destroy_into_raw();
812
+ wasm.__wbg_set_createvtxoswapresult_swapParams(this.__wbg_ptr, ptr0);
813
+ }
814
+ }
815
+ if (Symbol.dispose) CreateVtxoSwapResult.prototype[Symbol.dispose] = CreateVtxoSwapResult.prototype.free;
816
+
817
+ const EstimateVtxoSwapResponseFinalization = (typeof FinalizationRegistry === 'undefined')
818
+ ? { register: () => {}, unregister: () => {} }
819
+ : new FinalizationRegistry(ptr => wasm.__wbg_estimatevtxoswapresponse_free(ptr >>> 0, 1));
820
+ /**
821
+ * Estimate response for a VTXO swap.
822
+ */
823
+ export class EstimateVtxoSwapResponse {
824
+
825
+ static __wrap(ptr) {
826
+ ptr = ptr >>> 0;
827
+ const obj = Object.create(EstimateVtxoSwapResponse.prototype);
828
+ obj.__wbg_ptr = ptr;
829
+ EstimateVtxoSwapResponseFinalization.register(obj, obj.__wbg_ptr, obj);
830
+ return obj;
831
+ }
832
+
833
+ __destroy_into_raw() {
834
+ const ptr = this.__wbg_ptr;
835
+ this.__wbg_ptr = 0;
836
+ EstimateVtxoSwapResponseFinalization.unregister(this);
837
+ return ptr;
838
+ }
839
+
840
+ free() {
841
+ const ptr = this.__destroy_into_raw();
842
+ wasm.__wbg_estimatevtxoswapresponse_free(ptr, 0);
843
+ }
844
+ /**
845
+ * Total fee in satoshis
846
+ * @returns {bigint}
847
+ */
848
+ get feeSats() {
849
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_feeSats(this.__wbg_ptr);
850
+ return ret;
851
+ }
852
+ /**
853
+ * Total fee in satoshis
854
+ * @param {bigint} arg0
855
+ */
856
+ set feeSats(arg0) {
857
+ wasm.__wbg_set_estimatevtxoswapresponse_feeSats(this.__wbg_ptr, arg0);
858
+ }
859
+ /**
860
+ * Total input amount in satoshis
861
+ * @returns {bigint}
862
+ */
863
+ get totalInputSats() {
864
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr);
865
+ return ret;
866
+ }
867
+ /**
868
+ * Total input amount in satoshis
869
+ * @param {bigint} arg0
870
+ */
871
+ set totalInputSats(arg0) {
872
+ wasm.__wbg_set_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr, arg0);
873
+ }
874
+ /**
875
+ * Amount user will receive (total_input_sats - fee_sats)
876
+ * @returns {bigint}
877
+ */
878
+ get outputSats() {
879
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_outputSats(this.__wbg_ptr);
880
+ return ret;
881
+ }
882
+ /**
883
+ * Amount user will receive (total_input_sats - fee_sats)
884
+ * @param {bigint} arg0
885
+ */
886
+ set outputSats(arg0) {
887
+ wasm.__wbg_set_estimatevtxoswapresponse_outputSats(this.__wbg_ptr, arg0);
888
+ }
889
+ /**
890
+ * Number of VTXOs being refreshed
891
+ * @returns {number}
892
+ */
893
+ get vtxoCount() {
894
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_vtxoCount(this.__wbg_ptr);
895
+ return ret >>> 0;
896
+ }
897
+ /**
898
+ * Number of VTXOs being refreshed
899
+ * @param {number} arg0
900
+ */
901
+ set vtxoCount(arg0) {
902
+ wasm.__wbg_set_estimatevtxoswapresponse_vtxoCount(this.__wbg_ptr, arg0);
903
+ }
904
+ /**
905
+ * Expected expiry timestamp (Unix) of the resulting VTXOs
906
+ * @returns {bigint}
907
+ */
908
+ get expectedVtxoExpiry() {
909
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr);
910
+ return ret;
911
+ }
912
+ /**
913
+ * Expected expiry timestamp (Unix) of the resulting VTXOs
914
+ * @param {bigint} arg0
915
+ */
916
+ set expectedVtxoExpiry(arg0) {
917
+ wasm.__wbg_set_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr, arg0);
918
+ }
919
+ }
920
+ if (Symbol.dispose) EstimateVtxoSwapResponse.prototype[Symbol.dispose] = EstimateVtxoSwapResponse.prototype.free;
921
+
922
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
923
+ ? { register: () => {}, unregister: () => {} }
924
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
925
+
926
+ export class IntoUnderlyingByteSource {
927
+
928
+ __destroy_into_raw() {
929
+ const ptr = this.__wbg_ptr;
930
+ this.__wbg_ptr = 0;
931
+ IntoUnderlyingByteSourceFinalization.unregister(this);
932
+ return ptr;
933
+ }
934
+
935
+ free() {
936
+ const ptr = this.__destroy_into_raw();
937
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
938
+ }
939
+ /**
940
+ * @returns {ReadableStreamType}
941
+ */
942
+ get type() {
943
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
944
+ return __wbindgen_enum_ReadableStreamType[ret];
945
+ }
946
+ /**
947
+ * @returns {number}
948
+ */
949
+ get autoAllocateChunkSize() {
950
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
951
+ return ret >>> 0;
952
+ }
953
+ /**
954
+ * @param {ReadableByteStreamController} controller
955
+ */
956
+ start(controller) {
957
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
958
+ }
959
+ /**
960
+ * @param {ReadableByteStreamController} controller
961
+ * @returns {Promise<any>}
962
+ */
963
+ pull(controller) {
964
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
965
+ return ret;
966
+ }
967
+ cancel() {
968
+ const ptr = this.__destroy_into_raw();
969
+ wasm.intounderlyingbytesource_cancel(ptr);
970
+ }
971
+ }
972
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
973
+
974
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
975
+ ? { register: () => {}, unregister: () => {} }
976
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
977
+
978
+ export class IntoUnderlyingSink {
979
+
980
+ __destroy_into_raw() {
981
+ const ptr = this.__wbg_ptr;
982
+ this.__wbg_ptr = 0;
983
+ IntoUnderlyingSinkFinalization.unregister(this);
984
+ return ptr;
985
+ }
986
+
987
+ free() {
988
+ const ptr = this.__destroy_into_raw();
989
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
990
+ }
991
+ /**
992
+ * @param {any} chunk
993
+ * @returns {Promise<any>}
994
+ */
995
+ write(chunk) {
996
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
997
+ return ret;
998
+ }
999
+ /**
1000
+ * @returns {Promise<any>}
1001
+ */
1002
+ close() {
1003
+ const ptr = this.__destroy_into_raw();
1004
+ const ret = wasm.intounderlyingsink_close(ptr);
1005
+ return ret;
1006
+ }
1007
+ /**
1008
+ * @param {any} reason
1009
+ * @returns {Promise<any>}
1010
+ */
1011
+ abort(reason) {
1012
+ const ptr = this.__destroy_into_raw();
1013
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
1014
+ return ret;
1015
+ }
1016
+ }
1017
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
1018
+
1019
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1020
+ ? { register: () => {}, unregister: () => {} }
1021
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
1022
+
1023
+ export class IntoUnderlyingSource {
1024
+
1025
+ __destroy_into_raw() {
1026
+ const ptr = this.__wbg_ptr;
1027
+ this.__wbg_ptr = 0;
1028
+ IntoUnderlyingSourceFinalization.unregister(this);
1029
+ return ptr;
1030
+ }
1031
+
1032
+ free() {
1033
+ const ptr = this.__destroy_into_raw();
1034
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
1035
+ }
1036
+ /**
1037
+ * @param {ReadableStreamDefaultController} controller
1038
+ * @returns {Promise<any>}
1039
+ */
1040
+ pull(controller) {
1041
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
1042
+ return ret;
1043
+ }
1044
+ cancel() {
1045
+ const ptr = this.__destroy_into_raw();
1046
+ wasm.intounderlyingsource_cancel(ptr);
1047
+ }
1048
+ }
1049
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
1050
+
1051
+ const JsSwapStorageProviderFinalization = (typeof FinalizationRegistry === 'undefined')
1052
+ ? { register: () => {}, unregister: () => {} }
1053
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsswapstorageprovider_free(ptr >>> 0, 1));
1054
+ /**
1055
+ * JavaScript swap storage provider passed from TypeScript.
1056
+ *
1057
+ * This struct wraps JavaScript callback functions that implement
1058
+ * typed swap storage operations. Each function should return a Promise.
1059
+ *
1060
+ * # Example (TypeScript with Dexie)
1061
+ *
1062
+ * ```typescript
1063
+ * import Dexie from 'dexie';
1064
+ *
1065
+ * const db = new Dexie('lendaswap');
1066
+ * db.version(1).stores({ swaps: 'id' });
1067
+ *
1068
+ * const swapStorage = new JsSwapStorageProvider(
1069
+ * async (swapId) => await db.swaps.get(swapId) ?? null,
1070
+ * async (swapId, data) => { await db.swaps.put({ id: swapId, ...data }); },
1071
+ * async (swapId) => { await db.swaps.delete(swapId); },
1072
+ * async () => await db.swaps.toCollection().primaryKeys()
1073
+ * );
1074
+ * ```
1075
+ */
1076
+ export class JsSwapStorageProvider {
1077
+
1078
+ __destroy_into_raw() {
1079
+ const ptr = this.__wbg_ptr;
1080
+ this.__wbg_ptr = 0;
1081
+ JsSwapStorageProviderFinalization.unregister(this);
1082
+ return ptr;
1083
+ }
1084
+
1085
+ free() {
1086
+ const ptr = this.__destroy_into_raw();
1087
+ wasm.__wbg_jsswapstorageprovider_free(ptr, 0);
1088
+ }
1089
+ /**
1090
+ * Create a new JsSwapStorageProvider from JavaScript callbacks.
1091
+ *
1092
+ * # Arguments
1093
+ * * `get_fn` - Function: `(swapId: string) => Promise<ExtendedSwapStorageData | null>`
1094
+ * * `store_fn` - Function: `(swapId: string, data: ExtendedSwapStorageData) => Promise<void>`
1095
+ * * `delete_fn` - Function: `(swapId: string) => Promise<void>`
1096
+ * * `list_fn` - Function: `() => Promise<string[]>`
1097
+ * * `get_all_fn` - Function: `() => Promise<ExtendedSwapStorageData[]>`
1098
+ * @param {Function} get_fn
1099
+ * @param {Function} store_fn
1100
+ * @param {Function} delete_fn
1101
+ * @param {Function} list_fn
1102
+ * @param {Function} get_all_fn
1103
+ */
1104
+ constructor(get_fn, store_fn, delete_fn, list_fn, get_all_fn) {
1105
+ const ret = wasm.jsswapstorageprovider_new(get_fn, store_fn, delete_fn, list_fn, get_all_fn);
1106
+ this.__wbg_ptr = ret >>> 0;
1107
+ JsSwapStorageProviderFinalization.register(this, this.__wbg_ptr, this);
1108
+ return this;
1109
+ }
1110
+ }
1111
+ if (Symbol.dispose) JsSwapStorageProvider.prototype[Symbol.dispose] = JsSwapStorageProvider.prototype.free;
1112
+
1113
+ const JsWalletStorageProviderFinalization = (typeof FinalizationRegistry === 'undefined')
1114
+ ? { register: () => {}, unregister: () => {} }
1115
+ : new FinalizationRegistry(ptr => wasm.__wbg_jswalletstorageprovider_free(ptr >>> 0, 1));
1116
+ /**
1117
+ * JavaScript wallet storage provider passed from TypeScript.
1118
+ *
1119
+ * This struct wraps JavaScript callback functions that implement
1120
+ * the typed wallet storage operations. Each function should return a Promise.
1121
+ *
1122
+ * # Example (TypeScript)
1123
+ *
1124
+ * ```typescript
1125
+ * const provider = new JsWalletStorageProvider(
1126
+ * async () => localStorage.getItem('mnemonic'), // get_mnemonic
1127
+ * async (mnemonic) => localStorage.setItem('mnemonic', mnemonic), // set_mnemonic
1128
+ * async () => parseInt(localStorage.getItem('key_index') ?? '0'), // get_key_index
1129
+ * async (index) => localStorage.setItem('key_index', index.toString()), // set_key_index
1130
+ * );
1131
+ * ```
1132
+ */
1133
+ export class JsWalletStorageProvider {
1134
+
1135
+ __destroy_into_raw() {
1136
+ const ptr = this.__wbg_ptr;
1137
+ this.__wbg_ptr = 0;
1138
+ JsWalletStorageProviderFinalization.unregister(this);
1139
+ return ptr;
1140
+ }
1141
+
1142
+ free() {
1143
+ const ptr = this.__destroy_into_raw();
1144
+ wasm.__wbg_jswalletstorageprovider_free(ptr, 0);
1145
+ }
1146
+ /**
1147
+ * Create a new JsWalletStorageProvider from JavaScript callbacks.
1148
+ *
1149
+ * # Arguments
1150
+ * * `get_mnemonic_fn` - Function: `() => Promise<string | null>`
1151
+ * * `set_mnemonic_fn` - Function: `(mnemonic: string) => Promise<void>`
1152
+ * * `get_key_index_fn` - Function: `() => Promise<number>`
1153
+ * * `set_key_index_fn` - Function: `(index: number) => Promise<void>`
1154
+ * @param {Function} get_mnemonic_fn
1155
+ * @param {Function} set_mnemonic_fn
1156
+ * @param {Function} get_key_index_fn
1157
+ * @param {Function} set_key_index_fn
1158
+ */
1159
+ constructor(get_mnemonic_fn, set_mnemonic_fn, get_key_index_fn, set_key_index_fn) {
1160
+ const ret = wasm.jswalletstorageprovider_new(get_mnemonic_fn, set_mnemonic_fn, get_key_index_fn, set_key_index_fn);
1161
+ this.__wbg_ptr = ret >>> 0;
1162
+ JsWalletStorageProviderFinalization.register(this, this.__wbg_ptr, this);
1163
+ return this;
1164
+ }
1165
+ }
1166
+ if (Symbol.dispose) JsWalletStorageProvider.prototype[Symbol.dispose] = JsWalletStorageProvider.prototype.free;
1167
+
1168
+ const QuoteResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1169
+ ? { register: () => {}, unregister: () => {} }
1170
+ : new FinalizationRegistry(ptr => wasm.__wbg_quoteresponse_free(ptr >>> 0, 1));
1171
+ /**
1172
+ * Quote response from the API.
1173
+ */
1174
+ export class QuoteResponse {
1175
+
1176
+ static __wrap(ptr) {
1177
+ ptr = ptr >>> 0;
1178
+ const obj = Object.create(QuoteResponse.prototype);
1179
+ obj.__wbg_ptr = ptr;
1180
+ QuoteResponseFinalization.register(obj, obj.__wbg_ptr, obj);
1181
+ return obj;
1182
+ }
1183
+
1184
+ __destroy_into_raw() {
1185
+ const ptr = this.__wbg_ptr;
1186
+ this.__wbg_ptr = 0;
1187
+ QuoteResponseFinalization.unregister(this);
1188
+ return ptr;
1189
+ }
1190
+
1191
+ free() {
1192
+ const ptr = this.__destroy_into_raw();
1193
+ wasm.__wbg_quoteresponse_free(ptr, 0);
1194
+ }
1195
+ /**
1196
+ * @returns {string}
1197
+ */
1198
+ get exchangeRate() {
1199
+ let deferred1_0;
1200
+ let deferred1_1;
1201
+ try {
1202
+ const ret = wasm.__wbg_get_quoteresponse_exchangeRate(this.__wbg_ptr);
1203
+ deferred1_0 = ret[0];
1204
+ deferred1_1 = ret[1];
1205
+ return getStringFromWasm0(ret[0], ret[1]);
1206
+ } finally {
1207
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1208
+ }
1209
+ }
1210
+ /**
1211
+ * @param {string} arg0
1212
+ */
1213
+ set exchangeRate(arg0) {
1214
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1215
+ const len0 = WASM_VECTOR_LEN;
1216
+ wasm.__wbg_set_quoteresponse_exchangeRate(this.__wbg_ptr, ptr0, len0);
1217
+ }
1218
+ /**
1219
+ * @returns {bigint}
1220
+ */
1221
+ get networkFee() {
1222
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_feeSats(this.__wbg_ptr);
1223
+ return BigInt.asUintN(64, ret);
1224
+ }
1225
+ /**
1226
+ * @param {bigint} arg0
1227
+ */
1228
+ set networkFee(arg0) {
1229
+ wasm.__wbg_set_estimatevtxoswapresponse_feeSats(this.__wbg_ptr, arg0);
1230
+ }
1231
+ /**
1232
+ * @returns {bigint}
1233
+ */
1234
+ get protocolFee() {
1235
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr);
1236
+ return BigInt.asUintN(64, ret);
1237
+ }
1238
+ /**
1239
+ * @param {bigint} arg0
1240
+ */
1241
+ set protocolFee(arg0) {
1242
+ wasm.__wbg_set_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr, arg0);
1243
+ }
1244
+ /**
1245
+ * @returns {number}
1246
+ */
1247
+ get protocolFeeRate() {
1248
+ const ret = wasm.__wbg_get_quoteresponse_protocolFeeRate(this.__wbg_ptr);
1249
+ return ret;
1250
+ }
1251
+ /**
1252
+ * @param {number} arg0
1253
+ */
1254
+ set protocolFeeRate(arg0) {
1255
+ wasm.__wbg_set_quoteresponse_protocolFeeRate(this.__wbg_ptr, arg0);
1256
+ }
1257
+ /**
1258
+ * @returns {bigint}
1259
+ */
1260
+ get minAmount() {
1261
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr);
1262
+ return BigInt.asUintN(64, ret);
1263
+ }
1264
+ /**
1265
+ * @param {bigint} arg0
1266
+ */
1267
+ set minAmount(arg0) {
1268
+ wasm.__wbg_set_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr, arg0);
1269
+ }
1270
+ /**
1271
+ * @returns {bigint}
1272
+ */
1273
+ get maxAmount() {
1274
+ const ret = wasm.__wbg_get_quoteresponse_maxAmount(this.__wbg_ptr);
1275
+ return BigInt.asUintN(64, ret);
1276
+ }
1277
+ /**
1278
+ * @param {bigint} arg0
1279
+ */
1280
+ set maxAmount(arg0) {
1281
+ wasm.__wbg_set_quoteresponse_maxAmount(this.__wbg_ptr, arg0);
1282
+ }
1283
+ }
1284
+ if (Symbol.dispose) QuoteResponse.prototype[Symbol.dispose] = QuoteResponse.prototype.free;
1285
+
1286
+ const SwapParamsFinalization = (typeof FinalizationRegistry === 'undefined')
1287
+ ? { register: () => {}, unregister: () => {} }
1288
+ : new FinalizationRegistry(ptr => wasm.__wbg_swapparams_free(ptr >>> 0, 1));
1289
+ /**
1290
+ * Parameters derived for a swap operation.
1291
+ */
1292
+ export class SwapParams {
1293
+
1294
+ static __wrap(ptr) {
1295
+ ptr = ptr >>> 0;
1296
+ const obj = Object.create(SwapParams.prototype);
1297
+ obj.__wbg_ptr = ptr;
1298
+ SwapParamsFinalization.register(obj, obj.__wbg_ptr, obj);
1299
+ return obj;
1300
+ }
1301
+
1302
+ __destroy_into_raw() {
1303
+ const ptr = this.__wbg_ptr;
1304
+ this.__wbg_ptr = 0;
1305
+ SwapParamsFinalization.unregister(this);
1306
+ return ptr;
1307
+ }
1308
+
1309
+ free() {
1310
+ const ptr = this.__destroy_into_raw();
1311
+ wasm.__wbg_swapparams_free(ptr, 0);
1312
+ }
1313
+ /**
1314
+ * Secret key (hex-encoded).
1315
+ * @returns {string}
1316
+ */
1317
+ get own_sk() {
1318
+ let deferred1_0;
1319
+ let deferred1_1;
1320
+ try {
1321
+ const ret = wasm.__wbg_get_swapparams_own_sk(this.__wbg_ptr);
1322
+ deferred1_0 = ret[0];
1323
+ deferred1_1 = ret[1];
1324
+ return getStringFromWasm0(ret[0], ret[1]);
1325
+ } finally {
1326
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1327
+ }
1328
+ }
1329
+ /**
1330
+ * Secret key (hex-encoded).
1331
+ * @param {string} arg0
1332
+ */
1333
+ set own_sk(arg0) {
1334
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1335
+ const len0 = WASM_VECTOR_LEN;
1336
+ wasm.__wbg_set_swapparams_own_sk(this.__wbg_ptr, ptr0, len0);
1337
+ }
1338
+ /**
1339
+ * Public key (hex-encoded).
1340
+ * @returns {string}
1341
+ */
1342
+ get own_pk() {
1343
+ let deferred1_0;
1344
+ let deferred1_1;
1345
+ try {
1346
+ const ret = wasm.__wbg_get_swapparams_own_pk(this.__wbg_ptr);
1347
+ deferred1_0 = ret[0];
1348
+ deferred1_1 = ret[1];
1349
+ return getStringFromWasm0(ret[0], ret[1]);
1350
+ } finally {
1351
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1352
+ }
1353
+ }
1354
+ /**
1355
+ * Public key (hex-encoded).
1356
+ * @param {string} arg0
1357
+ */
1358
+ set own_pk(arg0) {
1359
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1360
+ const len0 = WASM_VECTOR_LEN;
1361
+ wasm.__wbg_set_swapparams_own_pk(this.__wbg_ptr, ptr0, len0);
1362
+ }
1363
+ /**
1364
+ * Preimage for HTLC (hex-encoded).
1365
+ * @returns {string}
1366
+ */
1367
+ get preimage() {
1368
+ let deferred1_0;
1369
+ let deferred1_1;
1370
+ try {
1371
+ const ret = wasm.__wbg_get_swapparams_preimage(this.__wbg_ptr);
1372
+ deferred1_0 = ret[0];
1373
+ deferred1_1 = ret[1];
1374
+ return getStringFromWasm0(ret[0], ret[1]);
1375
+ } finally {
1376
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1377
+ }
1378
+ }
1379
+ /**
1380
+ * Preimage for HTLC (hex-encoded).
1381
+ * @param {string} arg0
1382
+ */
1383
+ set preimage(arg0) {
1384
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1385
+ const len0 = WASM_VECTOR_LEN;
1386
+ wasm.__wbg_set_swapparams_preimage(this.__wbg_ptr, ptr0, len0);
1387
+ }
1388
+ /**
1389
+ * Hash of the preimage (hex-encoded).
1390
+ * @returns {string}
1391
+ */
1392
+ get preimage_hash() {
1393
+ let deferred1_0;
1394
+ let deferred1_1;
1395
+ try {
1396
+ const ret = wasm.__wbg_get_swapparams_preimage_hash(this.__wbg_ptr);
1397
+ deferred1_0 = ret[0];
1398
+ deferred1_1 = ret[1];
1399
+ return getStringFromWasm0(ret[0], ret[1]);
1400
+ } finally {
1401
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1402
+ }
1403
+ }
1404
+ /**
1405
+ * Hash of the preimage (hex-encoded).
1406
+ * @param {string} arg0
1407
+ */
1408
+ set preimage_hash(arg0) {
1409
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1410
+ const len0 = WASM_VECTOR_LEN;
1411
+ wasm.__wbg_set_swapparams_preimage_hash(this.__wbg_ptr, ptr0, len0);
1412
+ }
1413
+ /**
1414
+ * User ID derived from HD wallet (hex-encoded).
1415
+ * @returns {string}
1416
+ */
1417
+ get user_id() {
1418
+ let deferred1_0;
1419
+ let deferred1_1;
1420
+ try {
1421
+ const ret = wasm.__wbg_get_swapparams_user_id(this.__wbg_ptr);
1422
+ deferred1_0 = ret[0];
1423
+ deferred1_1 = ret[1];
1424
+ return getStringFromWasm0(ret[0], ret[1]);
1425
+ } finally {
1426
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1427
+ }
1428
+ }
1429
+ /**
1430
+ * User ID derived from HD wallet (hex-encoded).
1431
+ * @param {string} arg0
1432
+ */
1433
+ set user_id(arg0) {
1434
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1435
+ const len0 = WASM_VECTOR_LEN;
1436
+ wasm.__wbg_set_swapparams_user_id(this.__wbg_ptr, ptr0, len0);
1437
+ }
1438
+ /**
1439
+ * Key derivation index used.
1440
+ * @returns {number}
1441
+ */
1442
+ get key_index() {
1443
+ const ret = wasm.__wbg_get_swapparams_key_index(this.__wbg_ptr);
1444
+ return ret >>> 0;
1445
+ }
1446
+ /**
1447
+ * Key derivation index used.
1448
+ * @param {number} arg0
1449
+ */
1450
+ set key_index(arg0) {
1451
+ wasm.__wbg_set_swapparams_key_index(this.__wbg_ptr, arg0);
1452
+ }
1453
+ }
1454
+ if (Symbol.dispose) SwapParams.prototype[Symbol.dispose] = SwapParams.prototype.free;
1455
+
1456
+ const TokenIdFinalization = (typeof FinalizationRegistry === 'undefined')
1457
+ ? { register: () => {}, unregister: () => {} }
1458
+ : new FinalizationRegistry(ptr => wasm.__wbg_tokenid_free(ptr >>> 0, 1));
1459
+ /**
1460
+ * Token identifier.
1461
+ */
1462
+ export class TokenId {
1463
+
1464
+ static __wrap(ptr) {
1465
+ ptr = ptr >>> 0;
1466
+ const obj = Object.create(TokenId.prototype);
1467
+ obj.__wbg_ptr = ptr;
1468
+ TokenIdFinalization.register(obj, obj.__wbg_ptr, obj);
1469
+ return obj;
1470
+ }
1471
+
1472
+ __destroy_into_raw() {
1473
+ const ptr = this.__wbg_ptr;
1474
+ this.__wbg_ptr = 0;
1475
+ TokenIdFinalization.unregister(this);
1476
+ return ptr;
1477
+ }
1478
+
1479
+ free() {
1480
+ const ptr = this.__destroy_into_raw();
1481
+ wasm.__wbg_tokenid_free(ptr, 0);
1482
+ }
1483
+ /**
1484
+ * @returns {string}
1485
+ */
1486
+ toString() {
1487
+ let deferred1_0;
1488
+ let deferred1_1;
1489
+ try {
1490
+ const ret = wasm.tokenid_toString(this.__wbg_ptr);
1491
+ deferred1_0 = ret[0];
1492
+ deferred1_1 = ret[1];
1493
+ return getStringFromWasm0(ret[0], ret[1]);
1494
+ } finally {
1495
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1496
+ }
1497
+ }
1498
+ /**
1499
+ * @param {string} s
1500
+ * @returns {TokenId}
1501
+ */
1502
+ static fromString(s) {
1503
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1504
+ const len0 = WASM_VECTOR_LEN;
1505
+ const ret = wasm.tokenid_fromString(ptr0, len0);
1506
+ if (ret[2]) {
1507
+ throw takeFromExternrefTable0(ret[1]);
1508
+ }
1509
+ return TokenId.__wrap(ret[0]);
1510
+ }
1511
+ }
1512
+ if (Symbol.dispose) TokenId.prototype[Symbol.dispose] = TokenId.prototype.free;
1513
+
1514
+ const TokenInfoFinalization = (typeof FinalizationRegistry === 'undefined')
1515
+ ? { register: () => {}, unregister: () => {} }
1516
+ : new FinalizationRegistry(ptr => wasm.__wbg_tokeninfo_free(ptr >>> 0, 1));
1517
+ /**
1518
+ * Token information.
1519
+ */
1520
+ export class TokenInfo {
1521
+
1522
+ static __wrap(ptr) {
1523
+ ptr = ptr >>> 0;
1524
+ const obj = Object.create(TokenInfo.prototype);
1525
+ obj.__wbg_ptr = ptr;
1526
+ TokenInfoFinalization.register(obj, obj.__wbg_ptr, obj);
1527
+ return obj;
1528
+ }
1529
+
1530
+ __destroy_into_raw() {
1531
+ const ptr = this.__wbg_ptr;
1532
+ this.__wbg_ptr = 0;
1533
+ TokenInfoFinalization.unregister(this);
1534
+ return ptr;
1535
+ }
1536
+
1537
+ free() {
1538
+ const ptr = this.__destroy_into_raw();
1539
+ wasm.__wbg_tokeninfo_free(ptr, 0);
1540
+ }
1541
+ /**
1542
+ * @returns {string}
1543
+ */
1544
+ get tokenId() {
1545
+ let deferred1_0;
1546
+ let deferred1_1;
1547
+ try {
1548
+ const ret = wasm.__wbg_get_tokeninfo_tokenId(this.__wbg_ptr);
1549
+ deferred1_0 = ret[0];
1550
+ deferred1_1 = ret[1];
1551
+ return getStringFromWasm0(ret[0], ret[1]);
1552
+ } finally {
1553
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1554
+ }
1555
+ }
1556
+ /**
1557
+ * @param {string} arg0
1558
+ */
1559
+ set tokenId(arg0) {
1560
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1561
+ const len0 = WASM_VECTOR_LEN;
1562
+ wasm.__wbg_set_tokeninfo_tokenId(this.__wbg_ptr, ptr0, len0);
1563
+ }
1564
+ /**
1565
+ * @returns {string}
1566
+ */
1567
+ get symbol() {
1568
+ let deferred1_0;
1569
+ let deferred1_1;
1570
+ try {
1571
+ const ret = wasm.__wbg_get_tokeninfo_symbol(this.__wbg_ptr);
1572
+ deferred1_0 = ret[0];
1573
+ deferred1_1 = ret[1];
1574
+ return getStringFromWasm0(ret[0], ret[1]);
1575
+ } finally {
1576
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1577
+ }
1578
+ }
1579
+ /**
1580
+ * @param {string} arg0
1581
+ */
1582
+ set symbol(arg0) {
1583
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1584
+ const len0 = WASM_VECTOR_LEN;
1585
+ wasm.__wbg_set_tokeninfo_symbol(this.__wbg_ptr, ptr0, len0);
1586
+ }
1587
+ /**
1588
+ * @returns {Chain}
1589
+ */
1590
+ get chain() {
1591
+ const ret = wasm.__wbg_get_tokeninfo_chain(this.__wbg_ptr);
1592
+ return ret;
1593
+ }
1594
+ /**
1595
+ * @param {Chain} arg0
1596
+ */
1597
+ set chain(arg0) {
1598
+ wasm.__wbg_set_tokeninfo_chain(this.__wbg_ptr, arg0);
1599
+ }
1600
+ /**
1601
+ * @returns {string}
1602
+ */
1603
+ get name() {
1604
+ let deferred1_0;
1605
+ let deferred1_1;
1606
+ try {
1607
+ const ret = wasm.__wbg_get_tokeninfo_name(this.__wbg_ptr);
1608
+ deferred1_0 = ret[0];
1609
+ deferred1_1 = ret[1];
1610
+ return getStringFromWasm0(ret[0], ret[1]);
1611
+ } finally {
1612
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1613
+ }
1614
+ }
1615
+ /**
1616
+ * @param {string} arg0
1617
+ */
1618
+ set name(arg0) {
1619
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1620
+ const len0 = WASM_VECTOR_LEN;
1621
+ wasm.__wbg_set_tokeninfo_name(this.__wbg_ptr, ptr0, len0);
1622
+ }
1623
+ /**
1624
+ * @returns {number}
1625
+ */
1626
+ get decimals() {
1627
+ const ret = wasm.__wbg_get_tokeninfo_decimals(this.__wbg_ptr);
1628
+ return ret;
1629
+ }
1630
+ /**
1631
+ * @param {number} arg0
1632
+ */
1633
+ set decimals(arg0) {
1634
+ wasm.__wbg_set_tokeninfo_decimals(this.__wbg_ptr, arg0);
1635
+ }
1636
+ }
1637
+ if (Symbol.dispose) TokenInfo.prototype[Symbol.dispose] = TokenInfo.prototype.free;
1638
+
1639
+ const VersionFinalization = (typeof FinalizationRegistry === 'undefined')
1640
+ ? { register: () => {}, unregister: () => {} }
1641
+ : new FinalizationRegistry(ptr => wasm.__wbg_version_free(ptr >>> 0, 1));
1642
+ /**
1643
+ * Version information.
1644
+ */
1645
+ export class Version {
1646
+
1647
+ static __wrap(ptr) {
1648
+ ptr = ptr >>> 0;
1649
+ const obj = Object.create(Version.prototype);
1650
+ obj.__wbg_ptr = ptr;
1651
+ VersionFinalization.register(obj, obj.__wbg_ptr, obj);
1652
+ return obj;
1653
+ }
1654
+
1655
+ __destroy_into_raw() {
1656
+ const ptr = this.__wbg_ptr;
1657
+ this.__wbg_ptr = 0;
1658
+ VersionFinalization.unregister(this);
1659
+ return ptr;
1660
+ }
1661
+
1662
+ free() {
1663
+ const ptr = this.__destroy_into_raw();
1664
+ wasm.__wbg_version_free(ptr, 0);
1665
+ }
1666
+ /**
1667
+ * @returns {string}
1668
+ */
1669
+ get tag() {
1670
+ let deferred1_0;
1671
+ let deferred1_1;
1672
+ try {
1673
+ const ret = wasm.__wbg_get_version_tag(this.__wbg_ptr);
1674
+ deferred1_0 = ret[0];
1675
+ deferred1_1 = ret[1];
1676
+ return getStringFromWasm0(ret[0], ret[1]);
1677
+ } finally {
1678
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1679
+ }
1680
+ }
1681
+ /**
1682
+ * @param {string} arg0
1683
+ */
1684
+ set tag(arg0) {
1685
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1686
+ const len0 = WASM_VECTOR_LEN;
1687
+ wasm.__wbg_set_version_tag(this.__wbg_ptr, ptr0, len0);
1688
+ }
1689
+ /**
1690
+ * @returns {string}
1691
+ */
1692
+ get commitHash() {
1693
+ let deferred1_0;
1694
+ let deferred1_1;
1695
+ try {
1696
+ const ret = wasm.__wbg_get_version_commitHash(this.__wbg_ptr);
1697
+ deferred1_0 = ret[0];
1698
+ deferred1_1 = ret[1];
1699
+ return getStringFromWasm0(ret[0], ret[1]);
1700
+ } finally {
1701
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1702
+ }
1703
+ }
1704
+ /**
1705
+ * @param {string} arg0
1706
+ */
1707
+ set commitHash(arg0) {
1708
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1709
+ const len0 = WASM_VECTOR_LEN;
1710
+ wasm.__wbg_set_version_commitHash(this.__wbg_ptr, ptr0, len0);
1711
+ }
1712
+ }
1713
+ if (Symbol.dispose) Version.prototype[Symbol.dispose] = Version.prototype.free;
1714
+
1715
+ const VhtlcAmountsFinalization = (typeof FinalizationRegistry === 'undefined')
1716
+ ? { register: () => {}, unregister: () => {} }
1717
+ : new FinalizationRegistry(ptr => wasm.__wbg_vhtlcamounts_free(ptr >>> 0, 1));
1718
+ /**
1719
+ * VHTLC amounts returned from Arkade.
1720
+ */
1721
+ export class VhtlcAmounts {
1722
+
1723
+ __destroy_into_raw() {
1724
+ const ptr = this.__wbg_ptr;
1725
+ this.__wbg_ptr = 0;
1726
+ VhtlcAmountsFinalization.unregister(this);
1727
+ return ptr;
1728
+ }
1729
+
1730
+ free() {
1731
+ const ptr = this.__destroy_into_raw();
1732
+ wasm.__wbg_vhtlcamounts_free(ptr, 0);
1733
+ }
1734
+ /**
1735
+ * Amount that can be spent (in satoshis).
1736
+ * @returns {bigint}
1737
+ */
1738
+ get spendable() {
1739
+ const ret = wasm.__wbg_get_vhtlcamounts_spendable(this.__wbg_ptr);
1740
+ return BigInt.asUintN(64, ret);
1741
+ }
1742
+ /**
1743
+ * Amount that can be spent (in satoshis).
1744
+ * @param {bigint} arg0
1745
+ */
1746
+ set spendable(arg0) {
1747
+ wasm.__wbg_set_vhtlcamounts_spendable(this.__wbg_ptr, arg0);
1748
+ }
1749
+ /**
1750
+ * Amount already spent (in satoshis).
1751
+ * @returns {bigint}
1752
+ */
1753
+ get spent() {
1754
+ const ret = wasm.__wbg_get_vhtlcamounts_spent(this.__wbg_ptr);
1755
+ return BigInt.asUintN(64, ret);
1756
+ }
1757
+ /**
1758
+ * Amount already spent (in satoshis).
1759
+ * @param {bigint} arg0
1760
+ */
1761
+ set spent(arg0) {
1762
+ wasm.__wbg_set_vhtlcamounts_spent(this.__wbg_ptr, arg0);
1763
+ }
1764
+ /**
1765
+ * Amount that can be recovered via refund (in satoshis).
1766
+ * @returns {bigint}
1767
+ */
1768
+ get recoverable() {
1769
+ const ret = wasm.__wbg_get_vhtlcamounts_recoverable(this.__wbg_ptr);
1770
+ return BigInt.asUintN(64, ret);
1771
+ }
1772
+ /**
1773
+ * Amount that can be recovered via refund (in satoshis).
1774
+ * @param {bigint} arg0
1775
+ */
1776
+ set recoverable(arg0) {
1777
+ wasm.__wbg_set_vhtlcamounts_recoverable(this.__wbg_ptr, arg0);
1778
+ }
1779
+ }
1780
+ if (Symbol.dispose) VhtlcAmounts.prototype[Symbol.dispose] = VhtlcAmounts.prototype.free;
1781
+
1782
+ const VtxoSwapResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1783
+ ? { register: () => {}, unregister: () => {} }
1784
+ : new FinalizationRegistry(ptr => wasm.__wbg_vtxoswapresponse_free(ptr >>> 0, 1));
1785
+ /**
1786
+ * Response from creating/getting a VTXO swap.
1787
+ */
1788
+ export class VtxoSwapResponse {
1789
+
1790
+ static __wrap(ptr) {
1791
+ ptr = ptr >>> 0;
1792
+ const obj = Object.create(VtxoSwapResponse.prototype);
1793
+ obj.__wbg_ptr = ptr;
1794
+ VtxoSwapResponseFinalization.register(obj, obj.__wbg_ptr, obj);
1795
+ return obj;
1796
+ }
1797
+
1798
+ __destroy_into_raw() {
1799
+ const ptr = this.__wbg_ptr;
1800
+ this.__wbg_ptr = 0;
1801
+ VtxoSwapResponseFinalization.unregister(this);
1802
+ return ptr;
1803
+ }
1804
+
1805
+ free() {
1806
+ const ptr = this.__destroy_into_raw();
1807
+ wasm.__wbg_vtxoswapresponse_free(ptr, 0);
1808
+ }
1809
+ /**
1810
+ * Swap ID
1811
+ * @returns {string}
1812
+ */
1813
+ get id() {
1814
+ let deferred1_0;
1815
+ let deferred1_1;
1816
+ try {
1817
+ const ret = wasm.__wbg_get_vtxoswapresponse_id(this.__wbg_ptr);
1818
+ deferred1_0 = ret[0];
1819
+ deferred1_1 = ret[1];
1820
+ return getStringFromWasm0(ret[0], ret[1]);
1821
+ } finally {
1822
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1823
+ }
1824
+ }
1825
+ /**
1826
+ * Swap ID
1827
+ * @param {string} arg0
1828
+ */
1829
+ set id(arg0) {
1830
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1831
+ const len0 = WASM_VECTOR_LEN;
1832
+ wasm.__wbg_set_vtxoswapresponse_id(this.__wbg_ptr, ptr0, len0);
1833
+ }
1834
+ /**
1835
+ * Swap status
1836
+ * @returns {string}
1837
+ */
1838
+ get status() {
1839
+ let deferred1_0;
1840
+ let deferred1_1;
1841
+ try {
1842
+ const ret = wasm.__wbg_get_vtxoswapresponse_status(this.__wbg_ptr);
1843
+ deferred1_0 = ret[0];
1844
+ deferred1_1 = ret[1];
1845
+ return getStringFromWasm0(ret[0], ret[1]);
1846
+ } finally {
1847
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1848
+ }
1849
+ }
1850
+ /**
1851
+ * Swap status
1852
+ * @param {string} arg0
1853
+ */
1854
+ set status(arg0) {
1855
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1856
+ const len0 = WASM_VECTOR_LEN;
1857
+ wasm.__wbg_set_vtxoswapresponse_status(this.__wbg_ptr, ptr0, len0);
1858
+ }
1859
+ /**
1860
+ * Creation timestamp (RFC3339)
1861
+ * @returns {string}
1862
+ */
1863
+ get createdAt() {
1864
+ let deferred1_0;
1865
+ let deferred1_1;
1866
+ try {
1867
+ const ret = wasm.__wbg_get_vtxoswapresponse_createdAt(this.__wbg_ptr);
1868
+ deferred1_0 = ret[0];
1869
+ deferred1_1 = ret[1];
1870
+ return getStringFromWasm0(ret[0], ret[1]);
1871
+ } finally {
1872
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1873
+ }
1874
+ }
1875
+ /**
1876
+ * Creation timestamp (RFC3339)
1877
+ * @param {string} arg0
1878
+ */
1879
+ set createdAt(arg0) {
1880
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1881
+ const len0 = WASM_VECTOR_LEN;
1882
+ wasm.__wbg_set_vtxoswapresponse_createdAt(this.__wbg_ptr, ptr0, len0);
1883
+ }
1884
+ /**
1885
+ * Client's VHTLC address
1886
+ * @returns {string}
1887
+ */
1888
+ get clientVhtlcAddress() {
1889
+ let deferred1_0;
1890
+ let deferred1_1;
1891
+ try {
1892
+ const ret = wasm.__wbg_get_vtxoswapresponse_clientVhtlcAddress(this.__wbg_ptr);
1893
+ deferred1_0 = ret[0];
1894
+ deferred1_1 = ret[1];
1895
+ return getStringFromWasm0(ret[0], ret[1]);
1896
+ } finally {
1897
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1898
+ }
1899
+ }
1900
+ /**
1901
+ * Client's VHTLC address
1902
+ * @param {string} arg0
1903
+ */
1904
+ set clientVhtlcAddress(arg0) {
1905
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1906
+ const len0 = WASM_VECTOR_LEN;
1907
+ wasm.__wbg_set_vtxoswapresponse_clientVhtlcAddress(this.__wbg_ptr, ptr0, len0);
1908
+ }
1909
+ /**
1910
+ * Amount client should fund in satoshis
1911
+ * @returns {bigint}
1912
+ */
1913
+ get clientFundAmountSats() {
1914
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_feeSats(this.__wbg_ptr);
1915
+ return ret;
1916
+ }
1917
+ /**
1918
+ * Amount client should fund in satoshis
1919
+ * @param {bigint} arg0
1920
+ */
1921
+ set clientFundAmountSats(arg0) {
1922
+ wasm.__wbg_set_estimatevtxoswapresponse_feeSats(this.__wbg_ptr, arg0);
1923
+ }
1924
+ /**
1925
+ * Client's public key
1926
+ * @returns {string}
1927
+ */
1928
+ get clientPk() {
1929
+ let deferred1_0;
1930
+ let deferred1_1;
1931
+ try {
1932
+ const ret = wasm.__wbg_get_vtxoswapresponse_clientPk(this.__wbg_ptr);
1933
+ deferred1_0 = ret[0];
1934
+ deferred1_1 = ret[1];
1935
+ return getStringFromWasm0(ret[0], ret[1]);
1936
+ } finally {
1937
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1938
+ }
1939
+ }
1940
+ /**
1941
+ * Client's public key
1942
+ * @param {string} arg0
1943
+ */
1944
+ set clientPk(arg0) {
1945
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1946
+ const len0 = WASM_VECTOR_LEN;
1947
+ wasm.__wbg_set_vtxoswapresponse_clientPk(this.__wbg_ptr, ptr0, len0);
1948
+ }
1949
+ /**
1950
+ * Client VHTLC locktime (Unix timestamp)
1951
+ * @returns {bigint}
1952
+ */
1953
+ get clientLocktime() {
1954
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr);
1955
+ return BigInt.asUintN(64, ret);
1956
+ }
1957
+ /**
1958
+ * Client VHTLC locktime (Unix timestamp)
1959
+ * @param {bigint} arg0
1960
+ */
1961
+ set clientLocktime(arg0) {
1962
+ wasm.__wbg_set_estimatevtxoswapresponse_totalInputSats(this.__wbg_ptr, arg0);
1963
+ }
1964
+ /**
1965
+ * Client claim delay in seconds
1966
+ * @returns {bigint}
1967
+ */
1968
+ get clientUnilateralClaimDelay() {
1969
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_outputSats(this.__wbg_ptr);
1970
+ return ret;
1971
+ }
1972
+ /**
1973
+ * Client claim delay in seconds
1974
+ * @param {bigint} arg0
1975
+ */
1976
+ set clientUnilateralClaimDelay(arg0) {
1977
+ wasm.__wbg_set_estimatevtxoswapresponse_outputSats(this.__wbg_ptr, arg0);
1978
+ }
1979
+ /**
1980
+ * Client refund delay in seconds
1981
+ * @returns {bigint}
1982
+ */
1983
+ get clientUnilateralRefundDelay() {
1984
+ const ret = wasm.__wbg_get_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr);
1985
+ return ret;
1986
+ }
1987
+ /**
1988
+ * Client refund delay in seconds
1989
+ * @param {bigint} arg0
1990
+ */
1991
+ set clientUnilateralRefundDelay(arg0) {
1992
+ wasm.__wbg_set_estimatevtxoswapresponse_expectedVtxoExpiry(this.__wbg_ptr, arg0);
1993
+ }
1994
+ /**
1995
+ * Client refund without receiver delay in seconds
1996
+ * @returns {bigint}
1997
+ */
1998
+ get clientUnilateralRefundWithoutReceiverDelay() {
1999
+ const ret = wasm.__wbg_get_quoteresponse_maxAmount(this.__wbg_ptr);
2000
+ return ret;
2001
+ }
2002
+ /**
2003
+ * Client refund without receiver delay in seconds
2004
+ * @param {bigint} arg0
2005
+ */
2006
+ set clientUnilateralRefundWithoutReceiverDelay(arg0) {
2007
+ wasm.__wbg_set_quoteresponse_maxAmount(this.__wbg_ptr, arg0);
2008
+ }
2009
+ /**
2010
+ * Server's VHTLC address
2011
+ * @returns {string}
2012
+ */
2013
+ get serverVhtlcAddress() {
2014
+ let deferred1_0;
2015
+ let deferred1_1;
2016
+ try {
2017
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverVhtlcAddress(this.__wbg_ptr);
2018
+ deferred1_0 = ret[0];
2019
+ deferred1_1 = ret[1];
2020
+ return getStringFromWasm0(ret[0], ret[1]);
2021
+ } finally {
2022
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2023
+ }
2024
+ }
2025
+ /**
2026
+ * Server's VHTLC address
2027
+ * @param {string} arg0
2028
+ */
2029
+ set serverVhtlcAddress(arg0) {
2030
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2031
+ const len0 = WASM_VECTOR_LEN;
2032
+ wasm.__wbg_set_vtxoswapresponse_serverVhtlcAddress(this.__wbg_ptr, ptr0, len0);
2033
+ }
2034
+ /**
2035
+ * Amount server will fund in satoshis
2036
+ * @returns {bigint}
2037
+ */
2038
+ get serverFundAmountSats() {
2039
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverFundAmountSats(this.__wbg_ptr);
2040
+ return ret;
2041
+ }
2042
+ /**
2043
+ * Amount server will fund in satoshis
2044
+ * @param {bigint} arg0
2045
+ */
2046
+ set serverFundAmountSats(arg0) {
2047
+ wasm.__wbg_set_vtxoswapresponse_serverFundAmountSats(this.__wbg_ptr, arg0);
2048
+ }
2049
+ /**
2050
+ * Server's public key
2051
+ * @returns {string}
2052
+ */
2053
+ get serverPk() {
2054
+ let deferred1_0;
2055
+ let deferred1_1;
2056
+ try {
2057
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverPk(this.__wbg_ptr);
2058
+ deferred1_0 = ret[0];
2059
+ deferred1_1 = ret[1];
2060
+ return getStringFromWasm0(ret[0], ret[1]);
2061
+ } finally {
2062
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2063
+ }
2064
+ }
2065
+ /**
2066
+ * Server's public key
2067
+ * @param {string} arg0
2068
+ */
2069
+ set serverPk(arg0) {
2070
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2071
+ const len0 = WASM_VECTOR_LEN;
2072
+ wasm.__wbg_set_vtxoswapresponse_serverPk(this.__wbg_ptr, ptr0, len0);
2073
+ }
2074
+ /**
2075
+ * Server VHTLC locktime (Unix timestamp)
2076
+ * @returns {bigint}
2077
+ */
2078
+ get serverLocktime() {
2079
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverLocktime(this.__wbg_ptr);
2080
+ return BigInt.asUintN(64, ret);
2081
+ }
2082
+ /**
2083
+ * Server VHTLC locktime (Unix timestamp)
2084
+ * @param {bigint} arg0
2085
+ */
2086
+ set serverLocktime(arg0) {
2087
+ wasm.__wbg_set_vtxoswapresponse_serverLocktime(this.__wbg_ptr, arg0);
2088
+ }
2089
+ /**
2090
+ * Server claim delay in seconds
2091
+ * @returns {bigint}
2092
+ */
2093
+ get serverUnilateralClaimDelay() {
2094
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverUnilateralClaimDelay(this.__wbg_ptr);
2095
+ return ret;
2096
+ }
2097
+ /**
2098
+ * Server claim delay in seconds
2099
+ * @param {bigint} arg0
2100
+ */
2101
+ set serverUnilateralClaimDelay(arg0) {
2102
+ wasm.__wbg_set_vtxoswapresponse_serverUnilateralClaimDelay(this.__wbg_ptr, arg0);
2103
+ }
2104
+ /**
2105
+ * Server refund delay in seconds
2106
+ * @returns {bigint}
2107
+ */
2108
+ get serverUnilateralRefundDelay() {
2109
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverUnilateralRefundDelay(this.__wbg_ptr);
2110
+ return ret;
2111
+ }
2112
+ /**
2113
+ * Server refund delay in seconds
2114
+ * @param {bigint} arg0
2115
+ */
2116
+ set serverUnilateralRefundDelay(arg0) {
2117
+ wasm.__wbg_set_vtxoswapresponse_serverUnilateralRefundDelay(this.__wbg_ptr, arg0);
2118
+ }
2119
+ /**
2120
+ * Server refund without receiver delay in seconds
2121
+ * @returns {bigint}
2122
+ */
2123
+ get serverUnilateralRefundWithoutReceiverDelay() {
2124
+ const ret = wasm.__wbg_get_vtxoswapresponse_serverUnilateralRefundWithoutReceiverDelay(this.__wbg_ptr);
2125
+ return ret;
2126
+ }
2127
+ /**
2128
+ * Server refund without receiver delay in seconds
2129
+ * @param {bigint} arg0
2130
+ */
2131
+ set serverUnilateralRefundWithoutReceiverDelay(arg0) {
2132
+ wasm.__wbg_set_vtxoswapresponse_serverUnilateralRefundWithoutReceiverDelay(this.__wbg_ptr, arg0);
2133
+ }
2134
+ /**
2135
+ * Arkade server's public key
2136
+ * @returns {string}
2137
+ */
2138
+ get arkadeServerPk() {
2139
+ let deferred1_0;
2140
+ let deferred1_1;
2141
+ try {
2142
+ const ret = wasm.__wbg_get_vtxoswapresponse_arkadeServerPk(this.__wbg_ptr);
2143
+ deferred1_0 = ret[0];
2144
+ deferred1_1 = ret[1];
2145
+ return getStringFromWasm0(ret[0], ret[1]);
2146
+ } finally {
2147
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2148
+ }
2149
+ }
2150
+ /**
2151
+ * Arkade server's public key
2152
+ * @param {string} arg0
2153
+ */
2154
+ set arkadeServerPk(arg0) {
2155
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2156
+ const len0 = WASM_VECTOR_LEN;
2157
+ wasm.__wbg_set_vtxoswapresponse_arkadeServerPk(this.__wbg_ptr, ptr0, len0);
2158
+ }
2159
+ /**
2160
+ * The preimage hash (SHA256)
2161
+ * @returns {string}
2162
+ */
2163
+ get preimageHash() {
2164
+ let deferred1_0;
2165
+ let deferred1_1;
2166
+ try {
2167
+ const ret = wasm.__wbg_get_vtxoswapresponse_preimageHash(this.__wbg_ptr);
2168
+ deferred1_0 = ret[0];
2169
+ deferred1_1 = ret[1];
2170
+ return getStringFromWasm0(ret[0], ret[1]);
2171
+ } finally {
2172
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2173
+ }
2174
+ }
2175
+ /**
2176
+ * The preimage hash (SHA256)
2177
+ * @param {string} arg0
2178
+ */
2179
+ set preimageHash(arg0) {
2180
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2181
+ const len0 = WASM_VECTOR_LEN;
2182
+ wasm.__wbg_set_vtxoswapresponse_preimageHash(this.__wbg_ptr, ptr0, len0);
2183
+ }
2184
+ /**
2185
+ * Fee in satoshis
2186
+ * @returns {bigint}
2187
+ */
2188
+ get feeSats() {
2189
+ const ret = wasm.__wbg_get_vtxoswapresponse_feeSats(this.__wbg_ptr);
2190
+ return ret;
2191
+ }
2192
+ /**
2193
+ * Fee in satoshis
2194
+ * @param {bigint} arg0
2195
+ */
2196
+ set feeSats(arg0) {
2197
+ wasm.__wbg_set_vtxoswapresponse_feeSats(this.__wbg_ptr, arg0);
2198
+ }
2199
+ /**
2200
+ * Bitcoin network
2201
+ * @returns {string}
2202
+ */
2203
+ get network() {
2204
+ let deferred1_0;
2205
+ let deferred1_1;
2206
+ try {
2207
+ const ret = wasm.__wbg_get_vtxoswapresponse_network(this.__wbg_ptr);
2208
+ deferred1_0 = ret[0];
2209
+ deferred1_1 = ret[1];
2210
+ return getStringFromWasm0(ret[0], ret[1]);
2211
+ } finally {
2212
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2213
+ }
2214
+ }
2215
+ /**
2216
+ * Bitcoin network
2217
+ * @param {string} arg0
2218
+ */
2219
+ set network(arg0) {
2220
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2221
+ const len0 = WASM_VECTOR_LEN;
2222
+ wasm.__wbg_set_vtxoswapresponse_network(this.__wbg_ptr, ptr0, len0);
2223
+ }
2224
+ }
2225
+ if (Symbol.dispose) VtxoSwapResponse.prototype[Symbol.dispose] = VtxoSwapResponse.prototype.free;
2226
+
2227
+ export function __wbg_Error_e83987f665cf5504(arg0, arg1) {
2228
+ const ret = Error(getStringFromWasm0(arg0, arg1));
2229
+ return ret;
2230
+ };
2231
+
2232
+ export function __wbg_Number_bb48ca12f395cd08(arg0) {
2233
+ const ret = Number(arg0);
2234
+ return ret;
2235
+ };
2236
+
2237
+ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
2238
+ const ret = String(arg1);
2239
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2240
+ const len1 = WASM_VECTOR_LEN;
2241
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2242
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2243
+ };
2244
+
2245
+ export function __wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd(arg0, arg1) {
2246
+ const v = arg1;
2247
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2248
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2249
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2250
+ };
2251
+
2252
+ export function __wbg___wbindgen_boolean_get_6d5a1ee65bab5f68(arg0) {
2253
+ const v = arg0;
2254
+ const ret = typeof(v) === 'boolean' ? v : undefined;
2255
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2256
+ };
2257
+
2258
+ export function __wbg___wbindgen_debug_string_df47ffb5e35e6763(arg0, arg1) {
2259
+ const ret = debugString(arg1);
2260
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2261
+ const len1 = WASM_VECTOR_LEN;
2262
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2263
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2264
+ };
2265
+
2266
+ export function __wbg___wbindgen_in_bb933bd9e1b3bc0f(arg0, arg1) {
2267
+ const ret = arg0 in arg1;
2268
+ return ret;
2269
+ };
2270
+
2271
+ export function __wbg___wbindgen_is_bigint_cb320707dcd35f0b(arg0) {
2272
+ const ret = typeof(arg0) === 'bigint';
2273
+ return ret;
2274
+ };
2275
+
2276
+ export function __wbg___wbindgen_is_function_ee8a6c5833c90377(arg0) {
2277
+ const ret = typeof(arg0) === 'function';
2278
+ return ret;
2279
+ };
2280
+
2281
+ export function __wbg___wbindgen_is_null_5e69f72e906cc57c(arg0) {
2282
+ const ret = arg0 === null;
2283
+ return ret;
2284
+ };
2285
+
2286
+ export function __wbg___wbindgen_is_object_c818261d21f283a4(arg0) {
2287
+ const val = arg0;
2288
+ const ret = typeof(val) === 'object' && val !== null;
2289
+ return ret;
2290
+ };
2291
+
2292
+ export function __wbg___wbindgen_is_string_fbb76cb2940daafd(arg0) {
2293
+ const ret = typeof(arg0) === 'string';
2294
+ return ret;
2295
+ };
2296
+
2297
+ export function __wbg___wbindgen_is_undefined_2d472862bd29a478(arg0) {
2298
+ const ret = arg0 === undefined;
2299
+ return ret;
2300
+ };
2301
+
2302
+ export function __wbg___wbindgen_jsval_eq_6b13ab83478b1c50(arg0, arg1) {
2303
+ const ret = arg0 === arg1;
2304
+ return ret;
2305
+ };
2306
+
2307
+ export function __wbg___wbindgen_jsval_loose_eq_b664b38a2f582147(arg0, arg1) {
2308
+ const ret = arg0 == arg1;
2309
+ return ret;
2310
+ };
2311
+
2312
+ export function __wbg___wbindgen_number_get_a20bf9b85341449d(arg0, arg1) {
2313
+ const obj = arg1;
2314
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2315
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2316
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2317
+ };
2318
+
2319
+ export function __wbg___wbindgen_string_get_e4f06c90489ad01b(arg0, arg1) {
2320
+ const obj = arg1;
2321
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2322
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2323
+ var len1 = WASM_VECTOR_LEN;
2324
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2325
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2326
+ };
2327
+
2328
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
2329
+ throw new Error(getStringFromWasm0(arg0, arg1));
2330
+ };
2331
+
2332
+ export function __wbg__wbg_cb_unref_2454a539ea5790d9(arg0) {
2333
+ arg0._wbg_cb_unref();
2334
+ };
2335
+
2336
+ export function __wbg_abort_28ad55c5825b004d(arg0, arg1) {
2337
+ arg0.abort(arg1);
2338
+ };
2339
+
2340
+ export function __wbg_abort_e7eb059f72f9ed0c(arg0) {
2341
+ arg0.abort();
2342
+ };
2343
+
2344
+ export function __wbg_append_45ddba58b0706f62() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2345
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2346
+ }, arguments) };
2347
+
2348
+ export function __wbg_append_892c5e2d5bdd60ac() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2349
+ arg0.append(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5));
2350
+ }, arguments) };
2351
+
2352
+ export function __wbg_append_b577eb3a177bc0fa() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2353
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2354
+ }, arguments) };
2355
+
2356
+ export function __wbg_append_cb0bba4cf263a60b() { return handleError(function (arg0, arg1, arg2, arg3) {
2357
+ arg0.append(getStringFromWasm0(arg1, arg2), arg3);
2358
+ }, arguments) };
2359
+
2360
+ export function __wbg_arrayBuffer_b375eccb84b4ddf3() { return handleError(function (arg0) {
2361
+ const ret = arg0.arrayBuffer();
2362
+ return ret;
2363
+ }, arguments) };
2364
+
2365
+ export function __wbg_assetpair_new(arg0) {
2366
+ const ret = AssetPair.__wrap(arg0);
2367
+ return ret;
2368
+ };
2369
+
2370
+ export function __wbg_buffer_ccc4520b36d3ccf4(arg0) {
2371
+ const ret = arg0.buffer;
2372
+ return ret;
2373
+ };
2374
+
2375
+ export function __wbg_byobRequest_2344e6975f27456e(arg0) {
2376
+ const ret = arg0.byobRequest;
2377
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2378
+ };
2379
+
2380
+ export function __wbg_byteLength_bcd42e4025299788(arg0) {
2381
+ const ret = arg0.byteLength;
2382
+ return ret;
2383
+ };
2384
+
2385
+ export function __wbg_byteOffset_ca3a6cf7944b364b(arg0) {
2386
+ const ret = arg0.byteOffset;
2387
+ return ret;
2388
+ };
2389
+
2390
+ export function __wbg_call_525440f72fbfc0ea() { return handleError(function (arg0, arg1, arg2) {
2391
+ const ret = arg0.call(arg1, arg2);
2392
+ return ret;
2393
+ }, arguments) };
2394
+
2395
+ export function __wbg_call_e45d2cf9fc925fcf() { return handleError(function (arg0, arg1, arg2, arg3) {
2396
+ const ret = arg0.call(arg1, arg2, arg3);
2397
+ return ret;
2398
+ }, arguments) };
2399
+
2400
+ export function __wbg_call_e762c39fa8ea36bf() { return handleError(function (arg0, arg1) {
2401
+ const ret = arg0.call(arg1);
2402
+ return ret;
2403
+ }, arguments) };
2404
+
2405
+ export function __wbg_clearTimeout_7a42b49784aea641(arg0) {
2406
+ const ret = clearTimeout(arg0);
2407
+ return ret;
2408
+ };
2409
+
2410
+ export function __wbg_close_5a6caed3231b68cd() { return handleError(function (arg0) {
2411
+ arg0.close();
2412
+ }, arguments) };
2413
+
2414
+ export function __wbg_close_6956df845478561a() { return handleError(function (arg0) {
2415
+ arg0.close();
2416
+ }, arguments) };
2417
+
2418
+ export function __wbg_createvtxoswapresult_new(arg0) {
2419
+ const ret = CreateVtxoSwapResult.__wrap(arg0);
2420
+ return ret;
2421
+ };
2422
+
2423
+ export function __wbg_crypto_574e78ad8b13b65f(arg0) {
2424
+ const ret = arg0.crypto;
2425
+ return ret;
2426
+ };
2427
+
2428
+ export function __wbg_debug_e55e1461940eb14d(arg0, arg1, arg2, arg3) {
2429
+ console.debug(arg0, arg1, arg2, arg3);
2430
+ };
2431
+
2432
+ export function __wbg_done_2042aa2670fb1db1(arg0) {
2433
+ const ret = arg0.done;
2434
+ return ret;
2435
+ };
2436
+
2437
+ export function __wbg_enqueue_7b18a650aec77898() { return handleError(function (arg0, arg1) {
2438
+ arg0.enqueue(arg1);
2439
+ }, arguments) };
2440
+
2441
+ export function __wbg_entries_e171b586f8f6bdbf(arg0) {
2442
+ const ret = Object.entries(arg0);
2443
+ return ret;
2444
+ };
2445
+
2446
+ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
2447
+ let deferred0_0;
2448
+ let deferred0_1;
2449
+ try {
2450
+ deferred0_0 = arg0;
2451
+ deferred0_1 = arg1;
2452
+ console.error(getStringFromWasm0(arg0, arg1));
2453
+ } finally {
2454
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2455
+ }
2456
+ };
2457
+
2458
+ export function __wbg_error_d8b22cf4e59a6791(arg0, arg1, arg2, arg3) {
2459
+ console.error(arg0, arg1, arg2, arg3);
2460
+ };
2461
+
2462
+ export function __wbg_estimatevtxoswapresponse_new(arg0) {
2463
+ const ret = EstimateVtxoSwapResponse.__wrap(arg0);
2464
+ return ret;
2465
+ };
2466
+
2467
+ export function __wbg_fetch_74a3e84ebd2c9a0e(arg0) {
2468
+ const ret = fetch(arg0);
2469
+ return ret;
2470
+ };
2471
+
2472
+ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
2473
+ const ret = arg0.fetch(arg1);
2474
+ return ret;
2475
+ };
2476
+
2477
+ export function __wbg_getItem_89f57d6acc51a876() { return handleError(function (arg0, arg1, arg2, arg3) {
2478
+ const ret = arg1.getItem(getStringFromWasm0(arg2, arg3));
2479
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2480
+ var len1 = WASM_VECTOR_LEN;
2481
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2482
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2483
+ }, arguments) };
2484
+
2485
+ export function __wbg_getRandomValues_b8f5dbd5f3995a9e() { return handleError(function (arg0, arg1) {
2486
+ arg0.getRandomValues(arg1);
2487
+ }, arguments) };
2488
+
2489
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
2490
+ const ret = arg0[arg1 >>> 0];
2491
+ return ret;
2492
+ };
2493
+
2494
+ export function __wbg_get_efcb449f58ec27c2() { return handleError(function (arg0, arg1) {
2495
+ const ret = Reflect.get(arg0, arg1);
2496
+ return ret;
2497
+ }, arguments) };
2498
+
2499
+ export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
2500
+ const ret = arg0[arg1];
2501
+ return ret;
2502
+ };
2503
+
2504
+ export function __wbg_has_787fafc980c3ccdb() { return handleError(function (arg0, arg1) {
2505
+ const ret = Reflect.has(arg0, arg1);
2506
+ return ret;
2507
+ }, arguments) };
2508
+
2509
+ export function __wbg_headers_b87d7eaba61c3278(arg0) {
2510
+ const ret = arg0.headers;
2511
+ return ret;
2512
+ };
2513
+
2514
+ export function __wbg_info_68cd5b51ef7e5137(arg0, arg1, arg2, arg3) {
2515
+ console.info(arg0, arg1, arg2, arg3);
2516
+ };
2517
+
2518
+ export function __wbg_instanceof_ArrayBuffer_70beb1189ca63b38(arg0) {
2519
+ let result;
2520
+ try {
2521
+ result = arg0 instanceof ArrayBuffer;
2522
+ } catch (_) {
2523
+ result = false;
2524
+ }
2525
+ const ret = result;
2526
+ return ret;
2527
+ };
2528
+
2529
+ export function __wbg_instanceof_Map_8579b5e2ab5437c7(arg0) {
2530
+ let result;
2531
+ try {
2532
+ result = arg0 instanceof Map;
2533
+ } catch (_) {
2534
+ result = false;
2535
+ }
2536
+ const ret = result;
2537
+ return ret;
2538
+ };
2539
+
2540
+ export function __wbg_instanceof_Promise_001fdd42afa1b7ef(arg0) {
2541
+ let result;
2542
+ try {
2543
+ result = arg0 instanceof Promise;
2544
+ } catch (_) {
2545
+ result = false;
2546
+ }
2547
+ const ret = result;
2548
+ return ret;
2549
+ };
2550
+
2551
+ export function __wbg_instanceof_Response_f4f3e87e07f3135c(arg0) {
2552
+ let result;
2553
+ try {
2554
+ result = arg0 instanceof Response;
2555
+ } catch (_) {
2556
+ result = false;
2557
+ }
2558
+ const ret = result;
2559
+ return ret;
2560
+ };
2561
+
2562
+ export function __wbg_instanceof_Uint8Array_20c8e73002f7af98(arg0) {
2563
+ let result;
2564
+ try {
2565
+ result = arg0 instanceof Uint8Array;
2566
+ } catch (_) {
2567
+ result = false;
2568
+ }
2569
+ const ret = result;
2570
+ return ret;
2571
+ };
2572
+
2573
+ export function __wbg_instanceof_Window_4846dbb3de56c84c(arg0) {
2574
+ let result;
2575
+ try {
2576
+ result = arg0 instanceof Window;
2577
+ } catch (_) {
2578
+ result = false;
2579
+ }
2580
+ const ret = result;
2581
+ return ret;
2582
+ };
2583
+
2584
+ export function __wbg_isArray_96e0af9891d0945d(arg0) {
2585
+ const ret = Array.isArray(arg0);
2586
+ return ret;
2587
+ };
2588
+
2589
+ export function __wbg_isSafeInteger_d216eda7911dde36(arg0) {
2590
+ const ret = Number.isSafeInteger(arg0);
2591
+ return ret;
2592
+ };
2593
+
2594
+ export function __wbg_iterator_e5822695327a3c39() {
2595
+ const ret = Symbol.iterator;
2596
+ return ret;
2597
+ };
2598
+
2599
+ export function __wbg_length_69bca3cb64fc8748(arg0) {
2600
+ const ret = arg0.length;
2601
+ return ret;
2602
+ };
2603
+
2604
+ export function __wbg_length_cdd215e10d9dd507(arg0) {
2605
+ const ret = arg0.length;
2606
+ return ret;
2607
+ };
2608
+
2609
+ export function __wbg_localStorage_3034501cd2b3da3f() { return handleError(function (arg0) {
2610
+ const ret = arg0.localStorage;
2611
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2612
+ }, arguments) };
2613
+
2614
+ export function __wbg_log_45eb3a49e7cdcb64(arg0, arg1, arg2, arg3) {
2615
+ console.log(arg0, arg1, arg2, arg3);
2616
+ };
2617
+
2618
+ export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
2619
+ const ret = arg0.msCrypto;
2620
+ return ret;
2621
+ };
2622
+
2623
+ export function __wbg_new_1acc0b6eea89d040() {
2624
+ const ret = new Object();
2625
+ return ret;
2626
+ };
2627
+
2628
+ export function __wbg_new_2531773dac38ebb3() { return handleError(function () {
2629
+ const ret = new AbortController();
2630
+ return ret;
2631
+ }, arguments) };
2632
+
2633
+ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
2634
+ try {
2635
+ var state0 = {a: arg0, b: arg1};
2636
+ var cb0 = (arg0, arg1) => {
2637
+ const a = state0.a;
2638
+ state0.a = 0;
2639
+ try {
2640
+ return wasm_bindgen__convert__closures_____invoke__h68e6792a5299b78b(a, state0.b, arg0, arg1);
2641
+ } finally {
2642
+ state0.a = a;
2643
+ }
2644
+ };
2645
+ const ret = new Promise(cb0);
2646
+ return ret;
2647
+ } finally {
2648
+ state0.a = state0.b = 0;
2649
+ }
2650
+ };
2651
+
2652
+ export function __wbg_new_5a79be3ab53b8aa5(arg0) {
2653
+ const ret = new Uint8Array(arg0);
2654
+ return ret;
2655
+ };
2656
+
2657
+ export function __wbg_new_68651c719dcda04e() {
2658
+ const ret = new Map();
2659
+ return ret;
2660
+ };
2661
+
2662
+ export function __wbg_new_6f694bb0585846e0() { return handleError(function () {
2663
+ const ret = new FormData();
2664
+ return ret;
2665
+ }, arguments) };
2666
+
2667
+ export function __wbg_new_8a6f238a6ece86ea() {
2668
+ const ret = new Error();
2669
+ return ret;
2670
+ };
2671
+
2672
+ export function __wbg_new_9edf9838a2def39c() { return handleError(function () {
2673
+ const ret = new Headers();
2674
+ return ret;
2675
+ }, arguments) };
2676
+
2677
+ export function __wbg_new_a7442b4b19c1a356(arg0, arg1) {
2678
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2679
+ return ret;
2680
+ };
2681
+
2682
+ export function __wbg_new_e17d9f43105b08be() {
2683
+ const ret = new Array();
2684
+ return ret;
2685
+ };
2686
+
2687
+ export function __wbg_new_from_slice_92f4d78ca282a2d2(arg0, arg1) {
2688
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2689
+ return ret;
2690
+ };
2691
+
2692
+ export function __wbg_new_no_args_ee98eee5275000a4(arg0, arg1) {
2693
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2694
+ return ret;
2695
+ };
2696
+
2697
+ export function __wbg_new_with_byte_offset_and_length_46e3e6a5e9f9e89b(arg0, arg1, arg2) {
2698
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
2699
+ return ret;
2700
+ };
2701
+
2702
+ export function __wbg_new_with_length_01aa0dc35aa13543(arg0) {
2703
+ const ret = new Uint8Array(arg0 >>> 0);
2704
+ return ret;
2705
+ };
2706
+
2707
+ export function __wbg_new_with_str_and_init_0ae7728b6ec367b1() { return handleError(function (arg0, arg1, arg2) {
2708
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
2709
+ return ret;
2710
+ }, arguments) };
2711
+
2712
+ export function __wbg_new_with_u8_array_sequence_and_options_0c1d0bd56d93d25a() { return handleError(function (arg0, arg1) {
2713
+ const ret = new Blob(arg0, arg1);
2714
+ return ret;
2715
+ }, arguments) };
2716
+
2717
+ export function __wbg_next_020810e0ae8ebcb0() { return handleError(function (arg0) {
2718
+ const ret = arg0.next();
2719
+ return ret;
2720
+ }, arguments) };
2721
+
2722
+ export function __wbg_next_2c826fe5dfec6b6a(arg0) {
2723
+ const ret = arg0.next;
2724
+ return ret;
2725
+ };
2726
+
2727
+ export function __wbg_node_905d3e251edff8a2(arg0) {
2728
+ const ret = arg0.node;
2729
+ return ret;
2730
+ };
2731
+
2732
+ export function __wbg_now_f5ba683d8ce2c571(arg0) {
2733
+ const ret = arg0.now();
2734
+ return ret;
2735
+ };
2736
+
2737
+ export function __wbg_performance_e8315b5ae987e93f(arg0) {
2738
+ const ret = arg0.performance;
2739
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2740
+ };
2741
+
2742
+ export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
2743
+ const ret = arg0.process;
2744
+ return ret;
2745
+ };
2746
+
2747
+ export function __wbg_prototypesetcall_2a6620b6922694b2(arg0, arg1, arg2) {
2748
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2749
+ };
2750
+
2751
+ export function __wbg_push_df81a39d04db858c(arg0, arg1) {
2752
+ const ret = arg0.push(arg1);
2753
+ return ret;
2754
+ };
2755
+
2756
+ export function __wbg_queueMicrotask_34d692c25c47d05b(arg0) {
2757
+ const ret = arg0.queueMicrotask;
2758
+ return ret;
2759
+ };
2760
+
2761
+ export function __wbg_queueMicrotask_9d76cacb20c84d58(arg0) {
2762
+ queueMicrotask(arg0);
2763
+ };
2764
+
2765
+ export function __wbg_quoteresponse_new(arg0) {
2766
+ const ret = QuoteResponse.__wrap(arg0);
2767
+ return ret;
2768
+ };
2769
+
2770
+ export function __wbg_randomFillSync_ac0988aba3254290() { return handleError(function (arg0, arg1) {
2771
+ arg0.randomFillSync(arg1);
2772
+ }, arguments) };
2773
+
2774
+ export function __wbg_require_60cc747a6bc5215a() { return handleError(function () {
2775
+ const ret = module.require;
2776
+ return ret;
2777
+ }, arguments) };
2778
+
2779
+ export function __wbg_resolve_caf97c30b83f7053(arg0) {
2780
+ const ret = Promise.resolve(arg0);
2781
+ return ret;
2782
+ };
2783
+
2784
+ export function __wbg_respond_0f4dbf5386f5c73e() { return handleError(function (arg0, arg1) {
2785
+ arg0.respond(arg1 >>> 0);
2786
+ }, arguments) };
2787
+
2788
+ export function __wbg_setItem_64dfb54d7b20d84c() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2789
+ arg0.setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2790
+ }, arguments) };
2791
+
2792
+ export function __wbg_setTimeout_7bb3429662ab1e70(arg0, arg1) {
2793
+ const ret = setTimeout(arg0, arg1);
2794
+ return ret;
2795
+ };
2796
+
2797
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
2798
+ arg0[arg1] = arg2;
2799
+ };
2800
+
2801
+ export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
2802
+ const ret = arg0.set(arg1, arg2);
2803
+ return ret;
2804
+ };
2805
+
2806
+ export function __wbg_set_9e6516df7b7d0f19(arg0, arg1, arg2) {
2807
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
2808
+ };
2809
+
2810
+ export function __wbg_set_body_3c365989753d61f4(arg0, arg1) {
2811
+ arg0.body = arg1;
2812
+ };
2813
+
2814
+ export function __wbg_set_c213c871859d6500(arg0, arg1, arg2) {
2815
+ arg0[arg1 >>> 0] = arg2;
2816
+ };
2817
+
2818
+ export function __wbg_set_cache_2f9deb19b92b81e3(arg0, arg1) {
2819
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
2820
+ };
2821
+
2822
+ export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
2823
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
2824
+ };
2825
+
2826
+ export function __wbg_set_headers_6926da238cd32ee4(arg0, arg1) {
2827
+ arg0.headers = arg1;
2828
+ };
2829
+
2830
+ export function __wbg_set_method_c02d8cbbe204ac2d(arg0, arg1, arg2) {
2831
+ arg0.method = getStringFromWasm0(arg1, arg2);
2832
+ };
2833
+
2834
+ export function __wbg_set_mode_52ef73cfa79639cb(arg0, arg1) {
2835
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
2836
+ };
2837
+
2838
+ export function __wbg_set_signal_dda2cf7ccb6bee0f(arg0, arg1) {
2839
+ arg0.signal = arg1;
2840
+ };
2841
+
2842
+ export function __wbg_set_type_63fa4c18251f6545(arg0, arg1, arg2) {
2843
+ arg0.type = getStringFromWasm0(arg1, arg2);
2844
+ };
2845
+
2846
+ export function __wbg_signal_4db5aa055bf9eb9a(arg0) {
2847
+ const ret = arg0.signal;
2848
+ return ret;
2849
+ };
2850
+
2851
+ export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
2852
+ const ret = arg1.stack;
2853
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2854
+ const len1 = WASM_VECTOR_LEN;
2855
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2856
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2857
+ };
2858
+
2859
+ export function __wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e() {
2860
+ const ret = typeof global === 'undefined' ? null : global;
2861
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2862
+ };
2863
+
2864
+ export function __wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac() {
2865
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
2866
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2867
+ };
2868
+
2869
+ export function __wbg_static_accessor_SELF_6fdf4b64710cc91b() {
2870
+ const ret = typeof self === 'undefined' ? null : self;
2871
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2872
+ };
2873
+
2874
+ export function __wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2() {
2875
+ const ret = typeof window === 'undefined' ? null : window;
2876
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2877
+ };
2878
+
2879
+ export function __wbg_status_de7eed5a7a5bfd5d(arg0) {
2880
+ const ret = arg0.status;
2881
+ return ret;
2882
+ };
2883
+
2884
+ export function __wbg_stringify_b5fb28f6465d9c3e() { return handleError(function (arg0) {
2885
+ const ret = JSON.stringify(arg0);
2886
+ return ret;
2887
+ }, arguments) };
2888
+
2889
+ export function __wbg_subarray_480600f3d6a9f26c(arg0, arg1, arg2) {
2890
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
2891
+ return ret;
2892
+ };
2893
+
2894
+ export function __wbg_text_dc33c15c17bdfb52() { return handleError(function (arg0) {
2895
+ const ret = arg0.text();
2896
+ return ret;
2897
+ }, arguments) };
2898
+
2899
+ export function __wbg_then_4f46f6544e6b4a28(arg0, arg1) {
2900
+ const ret = arg0.then(arg1);
2901
+ return ret;
2902
+ };
2903
+
2904
+ export function __wbg_then_70d05cf780a18d77(arg0, arg1, arg2) {
2905
+ const ret = arg0.then(arg1, arg2);
2906
+ return ret;
2907
+ };
2908
+
2909
+ export function __wbg_tokeninfo_new(arg0) {
2910
+ const ret = TokenInfo.__wrap(arg0);
2911
+ return ret;
2912
+ };
2913
+
2914
+ export function __wbg_url_b36d2a5008eb056f(arg0, arg1) {
2915
+ const ret = arg1.url;
2916
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2917
+ const len1 = WASM_VECTOR_LEN;
2918
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2919
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2920
+ };
2921
+
2922
+ export function __wbg_value_692627309814bb8c(arg0) {
2923
+ const ret = arg0.value;
2924
+ return ret;
2925
+ };
2926
+
2927
+ export function __wbg_version_new(arg0) {
2928
+ const ret = Version.__wrap(arg0);
2929
+ return ret;
2930
+ };
2931
+
2932
+ export function __wbg_versions_c01dfd4722a88165(arg0) {
2933
+ const ret = arg0.versions;
2934
+ return ret;
2935
+ };
2936
+
2937
+ export function __wbg_view_f6c15ac9fed63bbd(arg0) {
2938
+ const ret = arg0.view;
2939
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2940
+ };
2941
+
2942
+ export function __wbg_vtxoswapresponse_new(arg0) {
2943
+ const ret = VtxoSwapResponse.__wrap(arg0);
2944
+ return ret;
2945
+ };
2946
+
2947
+ export function __wbg_warn_8f5b5437666d0885(arg0, arg1, arg2, arg3) {
2948
+ console.warn(arg0, arg1, arg2, arg3);
2949
+ };
2950
+
2951
+ export function __wbindgen_cast_083ba3ce304d58ed(arg0, arg1) {
2952
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 570, function: Function { arguments: [], shim_idx: 571, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2953
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h19250ab695821211, wasm_bindgen__convert__closures_____invoke__h49d21def8d7e8715);
2954
+ return ret;
2955
+ };
2956
+
2957
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
2958
+ // Cast intrinsic for `Ref(String) -> Externref`.
2959
+ const ret = getStringFromWasm0(arg0, arg1);
2960
+ return ret;
2961
+ };
2962
+
2963
+ export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
2964
+ // Cast intrinsic for `U64 -> Externref`.
2965
+ const ret = BigInt.asUintN(64, arg0);
2966
+ return ret;
2967
+ };
2968
+
2969
+ export function __wbindgen_cast_48cbc3748220f6e5(arg0, arg1) {
2970
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 637, function: Function { arguments: [Externref], shim_idx: 638, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2971
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h5b1ee57da9b2ce1f, wasm_bindgen__convert__closures_____invoke__hf86cb6f5b134f7f7);
2972
+ return ret;
2973
+ };
2974
+
2975
+ export function __wbindgen_cast_53d45148ea4f5d79(arg0, arg1) {
2976
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
2977
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
2978
+ // Cast intrinsic for `Vector(NamedExternref("TokenInfo")) -> Externref`.
2979
+ const ret = v0;
2980
+ return ret;
2981
+ };
2982
+
2983
+ export function __wbindgen_cast_9ae0607507abb057(arg0) {
2984
+ // Cast intrinsic for `I64 -> Externref`.
2985
+ const ret = arg0;
2986
+ return ret;
2987
+ };
2988
+
2989
+ export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
2990
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2991
+ const ret = getArrayU8FromWasm0(arg0, arg1);
2992
+ return ret;
2993
+ };
2994
+
2995
+ export function __wbindgen_cast_d1236da12498f6f5(arg0, arg1) {
2996
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
2997
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
2998
+ // Cast intrinsic for `Vector(NamedExternref("AssetPair")) -> Externref`.
2999
+ const ret = v0;
3000
+ return ret;
3001
+ };
3002
+
3003
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
3004
+ // Cast intrinsic for `F64 -> Externref`.
3005
+ const ret = arg0;
3006
+ return ret;
3007
+ };
3008
+
3009
+ export function __wbindgen_init_externref_table() {
3010
+ const table = wasm.__wbindgen_externrefs;
3011
+ const offset = table.grow(4);
3012
+ table.set(0, undefined);
3013
+ table.set(offset + 0, undefined);
3014
+ table.set(offset + 1, null);
3015
+ table.set(offset + 2, true);
3016
+ table.set(offset + 3, false);
3017
+ ;
3018
+ };
3019
+