@keyban/agent-wallet-mcp 0.0.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,780 @@
1
+ /* @ts-self-types="./ecdsa_schnorr_wasm_client.d.ts" */
2
+
3
+ /**
4
+ * @param {string} api_url
5
+ * @param {string} auth_token
6
+ * @param {string} app_id
7
+ * @param {string} network
8
+ * @returns {Promise<any>}
9
+ */
10
+ export function dkg(api_url, auth_token, app_id, network) {
11
+ const ptr0 = passStringToWasm0(api_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
12
+ const len0 = WASM_VECTOR_LEN;
13
+ const ptr1 = passStringToWasm0(auth_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14
+ const len1 = WASM_VECTOR_LEN;
15
+ const ptr2 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
16
+ const len2 = WASM_VECTOR_LEN;
17
+ const ptr3 = passStringToWasm0(network, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
18
+ const len3 = WASM_VECTOR_LEN;
19
+ const ret = wasm.dkg(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
20
+ return ret;
21
+ }
22
+
23
+ /**
24
+ * @param {any} secret_share
25
+ * @returns {Promise<any>}
26
+ */
27
+ export function public_key(secret_share) {
28
+ const ret = wasm.public_key(secret_share);
29
+ return ret;
30
+ }
31
+
32
+ /**
33
+ * @param {string} api_url
34
+ * @param {string} auth_token
35
+ * @param {string} app_id
36
+ * @param {string} network
37
+ * @param {any} secret_share
38
+ * @param {string} message
39
+ * @returns {Promise<any>}
40
+ */
41
+ export function sign(api_url, auth_token, app_id, network, secret_share, message) {
42
+ const ptr0 = passStringToWasm0(api_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
43
+ const len0 = WASM_VECTOR_LEN;
44
+ const ptr1 = passStringToWasm0(auth_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
45
+ const len1 = WASM_VECTOR_LEN;
46
+ const ptr2 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
+ const len2 = WASM_VECTOR_LEN;
48
+ const ptr3 = passStringToWasm0(network, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
49
+ const len3 = WASM_VECTOR_LEN;
50
+ const ptr4 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
51
+ const len4 = WASM_VECTOR_LEN;
52
+ const ret = wasm.sign(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, secret_share, ptr4, len4);
53
+ return ret;
54
+ }
55
+
56
+ function __wbg_get_imports() {
57
+ const import0 = {
58
+ __proto__: null,
59
+ __wbg_Error_4577686b3a6d9b3a: function(arg0, arg1) {
60
+ const ret = Error(getStringFromWasm0(arg0, arg1));
61
+ return ret;
62
+ },
63
+ __wbg_Number_e89e48a2fe1a6355: function(arg0) {
64
+ const ret = Number(arg0);
65
+ return ret;
66
+ },
67
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
68
+ const ret = String(arg1);
69
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
70
+ const len1 = WASM_VECTOR_LEN;
71
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
72
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
73
+ },
74
+ __wbg___wbindgen_bigint_get_as_i64_578010f8442e0319: function(arg0, arg1) {
75
+ const v = arg1;
76
+ const ret = typeof(v) === 'bigint' ? v : undefined;
77
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
78
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
79
+ },
80
+ __wbg___wbindgen_boolean_get_18c4ed9422296fff: function(arg0) {
81
+ const v = arg0;
82
+ const ret = typeof(v) === 'boolean' ? v : undefined;
83
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
84
+ },
85
+ __wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
86
+ const ret = debugString(arg1);
87
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len1 = WASM_VECTOR_LEN;
89
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
90
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
91
+ },
92
+ __wbg___wbindgen_in_1064a108f4d18b9e: function(arg0, arg1) {
93
+ const ret = arg0 in arg1;
94
+ return ret;
95
+ },
96
+ __wbg___wbindgen_is_bigint_a157f0734ca85901: function(arg0) {
97
+ const ret = typeof(arg0) === 'bigint';
98
+ return ret;
99
+ },
100
+ __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
101
+ const ret = typeof(arg0) === 'function';
102
+ return ret;
103
+ },
104
+ __wbg___wbindgen_is_object_4b3de556756ee8a8: function(arg0) {
105
+ const val = arg0;
106
+ const ret = typeof(val) === 'object' && val !== null;
107
+ return ret;
108
+ },
109
+ __wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
110
+ const ret = typeof(arg0) === 'string';
111
+ return ret;
112
+ },
113
+ __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
114
+ const ret = arg0 === undefined;
115
+ return ret;
116
+ },
117
+ __wbg___wbindgen_jsval_eq_a6afb59d8c5e78d6: function(arg0, arg1) {
118
+ const ret = arg0 === arg1;
119
+ return ret;
120
+ },
121
+ __wbg___wbindgen_jsval_loose_eq_1562ceb9af84e990: function(arg0, arg1) {
122
+ const ret = arg0 == arg1;
123
+ return ret;
124
+ },
125
+ __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
126
+ const obj = arg1;
127
+ const ret = typeof(obj) === 'number' ? obj : undefined;
128
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
129
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
130
+ },
131
+ __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
132
+ const obj = arg1;
133
+ const ret = typeof(obj) === 'string' ? obj : undefined;
134
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
135
+ var len1 = WASM_VECTOR_LEN;
136
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
137
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
138
+ },
139
+ __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
140
+ throw new Error(getStringFromWasm0(arg0, arg1));
141
+ },
142
+ __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
143
+ arg0._wbg_cb_unref();
144
+ },
145
+ __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
146
+ const ret = arg0.call(arg1, arg2);
147
+ return ret;
148
+ }, arguments); },
149
+ __wbg_call_73af281463ec8b58: function() { return handleError(function (arg0, arg1) {
150
+ const ret = arg0.call(arg1);
151
+ return ret;
152
+ }, arguments); },
153
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
154
+ const ret = arg0.crypto;
155
+ return ret;
156
+ },
157
+ __wbg_done_5aad55ec6b1954b1: function(arg0) {
158
+ const ret = arg0.done;
159
+ return ret;
160
+ },
161
+ __wbg_entries_28d32ba4cd93f5fc: function(arg0) {
162
+ const ret = Object.entries(arg0);
163
+ return ret;
164
+ },
165
+ __wbg_fetch_94c7b17b3a50ed61: function(arg0) {
166
+ const ret = fetch(arg0);
167
+ return ret;
168
+ },
169
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
170
+ arg0.getRandomValues(arg1);
171
+ }, arguments); },
172
+ __wbg_getTime_9429d05129287418: function(arg0) {
173
+ const ret = arg0.getTime();
174
+ return ret;
175
+ },
176
+ __wbg_get_4920fefd3451364b: function() { return handleError(function (arg0, arg1) {
177
+ const ret = Reflect.get(arg0, arg1);
178
+ return ret;
179
+ }, arguments); },
180
+ __wbg_get_f09c3a16f8848381: function(arg0, arg1) {
181
+ const ret = arg0[arg1 >>> 0];
182
+ return ret;
183
+ },
184
+ __wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
185
+ const ret = arg0[arg1 >>> 0];
186
+ return ret;
187
+ },
188
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
189
+ const ret = arg0[arg1];
190
+ return ret;
191
+ },
192
+ __wbg_headers_bf73bfa4e6f2e301: function(arg0) {
193
+ const ret = arg0.headers;
194
+ return ret;
195
+ },
196
+ __wbg_instanceof_ArrayBuffer_15859862b80b732d: function(arg0) {
197
+ let result;
198
+ try {
199
+ result = arg0 instanceof ArrayBuffer;
200
+ } catch (_) {
201
+ result = false;
202
+ }
203
+ const ret = result;
204
+ return ret;
205
+ },
206
+ __wbg_instanceof_Map_9df16bf25ceb4ecb: function(arg0) {
207
+ let result;
208
+ try {
209
+ result = arg0 instanceof Map;
210
+ } catch (_) {
211
+ result = false;
212
+ }
213
+ const ret = result;
214
+ return ret;
215
+ },
216
+ __wbg_instanceof_Response_8ec0057b1e5c71bf: function(arg0) {
217
+ let result;
218
+ try {
219
+ result = arg0 instanceof Response;
220
+ } catch (_) {
221
+ result = false;
222
+ }
223
+ const ret = result;
224
+ return ret;
225
+ },
226
+ __wbg_instanceof_Uint8Array_2240b7046ac16f05: function(arg0) {
227
+ let result;
228
+ try {
229
+ result = arg0 instanceof Uint8Array;
230
+ } catch (_) {
231
+ result = false;
232
+ }
233
+ const ret = result;
234
+ return ret;
235
+ },
236
+ __wbg_isArray_fad08a0d12828686: function(arg0) {
237
+ const ret = Array.isArray(arg0);
238
+ return ret;
239
+ },
240
+ __wbg_isSafeInteger_10e4151eb694e42a: function(arg0) {
241
+ const ret = Number.isSafeInteger(arg0);
242
+ return ret;
243
+ },
244
+ __wbg_iterator_fc7ad8d33bab9e26: function() {
245
+ const ret = Symbol.iterator;
246
+ return ret;
247
+ },
248
+ __wbg_json_55b2973846f7e268: function() { return handleError(function (arg0) {
249
+ const ret = arg0.json();
250
+ return ret;
251
+ }, arguments); },
252
+ __wbg_length_5855c1f289dfffc1: function(arg0) {
253
+ const ret = arg0.length;
254
+ return ret;
255
+ },
256
+ __wbg_length_a31e05262e09b7f8: function(arg0) {
257
+ const ret = arg0.length;
258
+ return ret;
259
+ },
260
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
261
+ const ret = arg0.msCrypto;
262
+ return ret;
263
+ },
264
+ __wbg_new_09959f7b4c92c246: function(arg0) {
265
+ const ret = new Uint8Array(arg0);
266
+ return ret;
267
+ },
268
+ __wbg_new_0_a719938e6f92ddf4: function() {
269
+ const ret = new Date();
270
+ return ret;
271
+ },
272
+ __wbg_new_cbee8c0d5c479eac: function() {
273
+ const ret = new Array();
274
+ return ret;
275
+ },
276
+ __wbg_new_ed69e637b553a997: function() {
277
+ const ret = new Object();
278
+ return ret;
279
+ },
280
+ __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
281
+ try {
282
+ var state0 = {a: arg0, b: arg1};
283
+ var cb0 = (arg0, arg1) => {
284
+ const a = state0.a;
285
+ state0.a = 0;
286
+ try {
287
+ return wasm_bindgen__convert__closures_____invoke__h3c08944a7b2fb0f7(a, state0.b, arg0, arg1);
288
+ } finally {
289
+ state0.a = a;
290
+ }
291
+ };
292
+ const ret = new Promise(cb0);
293
+ return ret;
294
+ } finally {
295
+ state0.a = state0.b = 0;
296
+ }
297
+ },
298
+ __wbg_new_with_length_c8449d782396d344: function(arg0) {
299
+ const ret = new Uint8Array(arg0 >>> 0);
300
+ return ret;
301
+ },
302
+ __wbg_new_with_str_and_init_5fdb105df3907de1: function() { return handleError(function (arg0, arg1, arg2) {
303
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
304
+ return ret;
305
+ }, arguments); },
306
+ __wbg_next_a5fe6f328f7affc2: function(arg0) {
307
+ const ret = arg0.next;
308
+ return ret;
309
+ },
310
+ __wbg_next_e592122bb4ed4c67: function() { return handleError(function (arg0) {
311
+ const ret = arg0.next();
312
+ return ret;
313
+ }, arguments); },
314
+ __wbg_node_84ea875411254db1: function(arg0) {
315
+ const ret = arg0.node;
316
+ return ret;
317
+ },
318
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
319
+ const ret = arg0.process;
320
+ return ret;
321
+ },
322
+ __wbg_prototypesetcall_f034d444741426c3: function(arg0, arg1, arg2) {
323
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
324
+ },
325
+ __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
326
+ const ret = arg0.queueMicrotask;
327
+ return ret;
328
+ },
329
+ __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
330
+ queueMicrotask(arg0);
331
+ },
332
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
333
+ arg0.randomFillSync(arg1);
334
+ }, arguments); },
335
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
336
+ const ret = module.require;
337
+ return ret;
338
+ }, arguments); },
339
+ __wbg_resolve_5d61e0d10c14730a: function(arg0) {
340
+ const ret = Promise.resolve(arg0);
341
+ return ret;
342
+ },
343
+ __wbg_set_4c81cfb5dc3a333c: function(arg0, arg1, arg2) {
344
+ arg0[arg1 >>> 0] = arg2;
345
+ },
346
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
347
+ arg0[arg1] = arg2;
348
+ },
349
+ __wbg_set_77cf5fbc40154bdb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
350
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
351
+ }, arguments); },
352
+ __wbg_set_bad5c505cc70b5f8: function() { return handleError(function (arg0, arg1, arg2) {
353
+ const ret = Reflect.set(arg0, arg1, arg2);
354
+ return ret;
355
+ }, arguments); },
356
+ __wbg_set_body_cced363f7703790d: function(arg0, arg1) {
357
+ arg0.body = arg1;
358
+ },
359
+ __wbg_set_credentials_b80a80dfa15201af: function(arg0, arg1) {
360
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
361
+ },
362
+ __wbg_set_method_c1be4686b152fe29: function(arg0, arg1, arg2) {
363
+ arg0.method = getStringFromWasm0(arg1, arg2);
364
+ },
365
+ __wbg_set_mode_13fad253f291265c: function(arg0, arg1) {
366
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
367
+ },
368
+ __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
369
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
370
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
371
+ },
372
+ __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
373
+ const ret = typeof global === 'undefined' ? null : global;
374
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
375
+ },
376
+ __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
377
+ const ret = typeof self === 'undefined' ? null : self;
378
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
379
+ },
380
+ __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
381
+ const ret = typeof window === 'undefined' ? null : window;
382
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
383
+ },
384
+ __wbg_status_acf2080bc55aa324: function(arg0) {
385
+ const ret = arg0.status;
386
+ return ret;
387
+ },
388
+ __wbg_stringify_86f4ab954f88f382: function() { return handleError(function (arg0) {
389
+ const ret = JSON.stringify(arg0);
390
+ return ret;
391
+ }, arguments); },
392
+ __wbg_subarray_7ad5f01d4a9c1c4d: function(arg0, arg1, arg2) {
393
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
394
+ return ret;
395
+ },
396
+ __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
397
+ const ret = arg0.then(arg1, arg2);
398
+ return ret;
399
+ },
400
+ __wbg_then_f1c954fe00733701: function(arg0, arg1) {
401
+ const ret = arg0.then(arg1);
402
+ return ret;
403
+ },
404
+ __wbg_value_667dcb90597486a6: function(arg0) {
405
+ const ret = arg0.value;
406
+ return ret;
407
+ },
408
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
409
+ const ret = arg0.versions;
410
+ return ret;
411
+ },
412
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
413
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 105, function: Function { arguments: [Externref], shim_idx: 82, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
414
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1021cdf50f346519, wasm_bindgen__convert__closures_____invoke__hf0340d064bb5bb15);
415
+ return ret;
416
+ },
417
+ __wbindgen_cast_0000000000000002: function(arg0) {
418
+ // Cast intrinsic for `F64 -> Externref`.
419
+ const ret = arg0;
420
+ return ret;
421
+ },
422
+ __wbindgen_cast_0000000000000003: function(arg0) {
423
+ // Cast intrinsic for `I64 -> Externref`.
424
+ const ret = arg0;
425
+ return ret;
426
+ },
427
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
428
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
429
+ const ret = getArrayU8FromWasm0(arg0, arg1);
430
+ return ret;
431
+ },
432
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
433
+ // Cast intrinsic for `Ref(String) -> Externref`.
434
+ const ret = getStringFromWasm0(arg0, arg1);
435
+ return ret;
436
+ },
437
+ __wbindgen_cast_0000000000000006: function(arg0) {
438
+ // Cast intrinsic for `U64 -> Externref`.
439
+ const ret = BigInt.asUintN(64, arg0);
440
+ return ret;
441
+ },
442
+ __wbindgen_init_externref_table: function() {
443
+ const table = wasm.__wbindgen_externrefs;
444
+ const offset = table.grow(4);
445
+ table.set(0, undefined);
446
+ table.set(offset + 0, undefined);
447
+ table.set(offset + 1, null);
448
+ table.set(offset + 2, true);
449
+ table.set(offset + 3, false);
450
+ },
451
+ };
452
+ return {
453
+ __proto__: null,
454
+ "./ecdsa_schnorr_wasm_client_bg.js": import0,
455
+ };
456
+ }
457
+
458
+ function wasm_bindgen__convert__closures_____invoke__hf0340d064bb5bb15(arg0, arg1, arg2) {
459
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hf0340d064bb5bb15(arg0, arg1, arg2);
460
+ if (ret[1]) {
461
+ throw takeFromExternrefTable0(ret[0]);
462
+ }
463
+ }
464
+
465
+ function wasm_bindgen__convert__closures_____invoke__h3c08944a7b2fb0f7(arg0, arg1, arg2, arg3) {
466
+ wasm.wasm_bindgen__convert__closures_____invoke__h3c08944a7b2fb0f7(arg0, arg1, arg2, arg3);
467
+ }
468
+
469
+
470
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
471
+
472
+
473
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
474
+
475
+ function addToExternrefTable0(obj) {
476
+ const idx = wasm.__externref_table_alloc();
477
+ wasm.__wbindgen_externrefs.set(idx, obj);
478
+ return idx;
479
+ }
480
+
481
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
482
+ ? { register: () => {}, unregister: () => {} }
483
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
484
+
485
+ function debugString(val) {
486
+ // primitive types
487
+ const type = typeof val;
488
+ if (type == 'number' || type == 'boolean' || val == null) {
489
+ return `${val}`;
490
+ }
491
+ if (type == 'string') {
492
+ return `"${val}"`;
493
+ }
494
+ if (type == 'symbol') {
495
+ const description = val.description;
496
+ if (description == null) {
497
+ return 'Symbol';
498
+ } else {
499
+ return `Symbol(${description})`;
500
+ }
501
+ }
502
+ if (type == 'function') {
503
+ const name = val.name;
504
+ if (typeof name == 'string' && name.length > 0) {
505
+ return `Function(${name})`;
506
+ } else {
507
+ return 'Function';
508
+ }
509
+ }
510
+ // objects
511
+ if (Array.isArray(val)) {
512
+ const length = val.length;
513
+ let debug = '[';
514
+ if (length > 0) {
515
+ debug += debugString(val[0]);
516
+ }
517
+ for(let i = 1; i < length; i++) {
518
+ debug += ', ' + debugString(val[i]);
519
+ }
520
+ debug += ']';
521
+ return debug;
522
+ }
523
+ // Test for built-in
524
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
525
+ let className;
526
+ if (builtInMatches && builtInMatches.length > 1) {
527
+ className = builtInMatches[1];
528
+ } else {
529
+ // Failed to match the standard '[object ClassName]'
530
+ return toString.call(val);
531
+ }
532
+ if (className == 'Object') {
533
+ // we're a user defined class or Object
534
+ // JSON.stringify avoids problems with cycles, and is generally much
535
+ // easier than looping through ownProperties of `val`.
536
+ try {
537
+ return 'Object(' + JSON.stringify(val) + ')';
538
+ } catch (_) {
539
+ return 'Object';
540
+ }
541
+ }
542
+ // errors
543
+ if (val instanceof Error) {
544
+ return `${val.name}: ${val.message}\n${val.stack}`;
545
+ }
546
+ // TODO we could test for more things here, like `Set`s and `Map`s.
547
+ return className;
548
+ }
549
+
550
+ function getArrayU8FromWasm0(ptr, len) {
551
+ ptr = ptr >>> 0;
552
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
553
+ }
554
+
555
+ let cachedDataViewMemory0 = null;
556
+ function getDataViewMemory0() {
557
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
558
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
559
+ }
560
+ return cachedDataViewMemory0;
561
+ }
562
+
563
+ function getStringFromWasm0(ptr, len) {
564
+ ptr = ptr >>> 0;
565
+ return decodeText(ptr, len);
566
+ }
567
+
568
+ let cachedUint8ArrayMemory0 = null;
569
+ function getUint8ArrayMemory0() {
570
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
571
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
572
+ }
573
+ return cachedUint8ArrayMemory0;
574
+ }
575
+
576
+ function handleError(f, args) {
577
+ try {
578
+ return f.apply(this, args);
579
+ } catch (e) {
580
+ const idx = addToExternrefTable0(e);
581
+ wasm.__wbindgen_exn_store(idx);
582
+ }
583
+ }
584
+
585
+ function isLikeNone(x) {
586
+ return x === undefined || x === null;
587
+ }
588
+
589
+ function makeMutClosure(arg0, arg1, dtor, f) {
590
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
591
+ const real = (...args) => {
592
+
593
+ // First up with a closure we increment the internal reference
594
+ // count. This ensures that the Rust closure environment won't
595
+ // be deallocated while we're invoking it.
596
+ state.cnt++;
597
+ const a = state.a;
598
+ state.a = 0;
599
+ try {
600
+ return f(a, state.b, ...args);
601
+ } finally {
602
+ state.a = a;
603
+ real._wbg_cb_unref();
604
+ }
605
+ };
606
+ real._wbg_cb_unref = () => {
607
+ if (--state.cnt === 0) {
608
+ state.dtor(state.a, state.b);
609
+ state.a = 0;
610
+ CLOSURE_DTORS.unregister(state);
611
+ }
612
+ };
613
+ CLOSURE_DTORS.register(real, state, state);
614
+ return real;
615
+ }
616
+
617
+ function passStringToWasm0(arg, malloc, realloc) {
618
+ if (realloc === undefined) {
619
+ const buf = cachedTextEncoder.encode(arg);
620
+ const ptr = malloc(buf.length, 1) >>> 0;
621
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
622
+ WASM_VECTOR_LEN = buf.length;
623
+ return ptr;
624
+ }
625
+
626
+ let len = arg.length;
627
+ let ptr = malloc(len, 1) >>> 0;
628
+
629
+ const mem = getUint8ArrayMemory0();
630
+
631
+ let offset = 0;
632
+
633
+ for (; offset < len; offset++) {
634
+ const code = arg.charCodeAt(offset);
635
+ if (code > 0x7F) break;
636
+ mem[ptr + offset] = code;
637
+ }
638
+ if (offset !== len) {
639
+ if (offset !== 0) {
640
+ arg = arg.slice(offset);
641
+ }
642
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
643
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
644
+ const ret = cachedTextEncoder.encodeInto(arg, view);
645
+
646
+ offset += ret.written;
647
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
648
+ }
649
+
650
+ WASM_VECTOR_LEN = offset;
651
+ return ptr;
652
+ }
653
+
654
+ function takeFromExternrefTable0(idx) {
655
+ const value = wasm.__wbindgen_externrefs.get(idx);
656
+ wasm.__externref_table_dealloc(idx);
657
+ return value;
658
+ }
659
+
660
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
661
+ cachedTextDecoder.decode();
662
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
663
+ let numBytesDecoded = 0;
664
+ function decodeText(ptr, len) {
665
+ numBytesDecoded += len;
666
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
667
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
668
+ cachedTextDecoder.decode();
669
+ numBytesDecoded = len;
670
+ }
671
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
672
+ }
673
+
674
+ const cachedTextEncoder = new TextEncoder();
675
+
676
+ if (!('encodeInto' in cachedTextEncoder)) {
677
+ cachedTextEncoder.encodeInto = function (arg, view) {
678
+ const buf = cachedTextEncoder.encode(arg);
679
+ view.set(buf);
680
+ return {
681
+ read: arg.length,
682
+ written: buf.length
683
+ };
684
+ };
685
+ }
686
+
687
+ let WASM_VECTOR_LEN = 0;
688
+
689
+ let wasmModule, wasm;
690
+ function __wbg_finalize_init(instance, module) {
691
+ wasm = instance.exports;
692
+ wasmModule = module;
693
+ cachedDataViewMemory0 = null;
694
+ cachedUint8ArrayMemory0 = null;
695
+ wasm.__wbindgen_start();
696
+ return wasm;
697
+ }
698
+
699
+ async function __wbg_load(module, imports) {
700
+ if (typeof Response === 'function' && module instanceof Response) {
701
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
702
+ try {
703
+ return await WebAssembly.instantiateStreaming(module, imports);
704
+ } catch (e) {
705
+ const validResponse = module.ok && expectedResponseType(module.type);
706
+
707
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
708
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
709
+
710
+ } else { throw e; }
711
+ }
712
+ }
713
+
714
+ const bytes = await module.arrayBuffer();
715
+ return await WebAssembly.instantiate(bytes, imports);
716
+ } else {
717
+ const instance = await WebAssembly.instantiate(module, imports);
718
+
719
+ if (instance instanceof WebAssembly.Instance) {
720
+ return { instance, module };
721
+ } else {
722
+ return instance;
723
+ }
724
+ }
725
+
726
+ function expectedResponseType(type) {
727
+ switch (type) {
728
+ case 'basic': case 'cors': case 'default': return true;
729
+ }
730
+ return false;
731
+ }
732
+ }
733
+
734
+ function initSync(module) {
735
+ if (wasm !== undefined) return wasm;
736
+
737
+
738
+ if (module !== undefined) {
739
+ if (Object.getPrototypeOf(module) === Object.prototype) {
740
+ ({module} = module)
741
+ } else {
742
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
743
+ }
744
+ }
745
+
746
+ const imports = __wbg_get_imports();
747
+ if (!(module instanceof WebAssembly.Module)) {
748
+ module = new WebAssembly.Module(module);
749
+ }
750
+ const instance = new WebAssembly.Instance(module, imports);
751
+ return __wbg_finalize_init(instance, module);
752
+ }
753
+
754
+ async function __wbg_init(module_or_path) {
755
+ if (wasm !== undefined) return wasm;
756
+
757
+
758
+ if (module_or_path !== undefined) {
759
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
760
+ ({module_or_path} = module_or_path)
761
+ } else {
762
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
763
+ }
764
+ }
765
+
766
+ if (module_or_path === undefined) {
767
+ module_or_path = new URL('ecdsa_schnorr_wasm_client_bg.wasm', import.meta.url);
768
+ }
769
+ const imports = __wbg_get_imports();
770
+
771
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
772
+ module_or_path = fetch(module_or_path);
773
+ }
774
+
775
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
776
+
777
+ return __wbg_finalize_init(instance, module);
778
+ }
779
+
780
+ export { initSync, __wbg_init as default };