@chironbuilder/ootle-sdk 0.1.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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/accountApi.d.ts +33 -0
  4. package/dist/accountApi.d.ts.map +1 -0
  5. package/dist/accountApi.js +1 -0
  6. package/dist/adapters.d.ts +13 -0
  7. package/dist/adapters.d.ts.map +1 -0
  8. package/dist/adapters.js +68 -0
  9. package/dist/componentAddress.d.ts +27 -0
  10. package/dist/componentAddress.d.ts.map +1 -0
  11. package/dist/componentAddress.js +68 -0
  12. package/dist/confidential.d.ts +50 -0
  13. package/dist/confidential.d.ts.map +1 -0
  14. package/dist/confidential.js +86 -0
  15. package/dist/derivation.d.ts +7 -0
  16. package/dist/derivation.d.ts.map +1 -0
  17. package/dist/derivation.js +47 -0
  18. package/dist/domainHash.d.ts +11 -0
  19. package/dist/domainHash.d.ts.map +1 -0
  20. package/dist/domainHash.js +44 -0
  21. package/dist/htlc.d.ts +26 -0
  22. package/dist/htlc.d.ts.map +1 -0
  23. package/dist/htlc.js +69 -0
  24. package/dist/index.d.ts +21 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +14 -0
  27. package/dist/ootleNetwork.d.ts +4 -0
  28. package/dist/ootleNetwork.d.ts.map +1 -0
  29. package/dist/ootleNetwork.js +11 -0
  30. package/dist/ownershipProof.d.ts +4 -0
  31. package/dist/ownershipProof.d.ts.map +1 -0
  32. package/dist/ownershipProof.js +53 -0
  33. package/dist/storage.d.ts +61 -0
  34. package/dist/storage.d.ts.map +1 -0
  35. package/dist/storage.js +110 -0
  36. package/dist/timeout.d.ts +2 -0
  37. package/dist/timeout.d.ts.map +1 -0
  38. package/dist/timeout.js +19 -0
  39. package/dist/vault.d.ts +12 -0
  40. package/dist/vault.d.ts.map +1 -0
  41. package/dist/vault.js +44 -0
  42. package/dist/wallet.d.ts +733 -0
  43. package/dist/wallet.d.ts.map +1 -0
  44. package/dist/wallet.js +1964 -0
  45. package/package.json +46 -0
  46. package/vendor/ootle-patched/README.md +67 -0
  47. package/vendor/ootle-patched/dist/index.d.ts +2129 -0
  48. package/vendor/ootle-patched/dist/index.js +1365 -0
  49. package/vendor/ootle-patched/package.json +23 -0
  50. package/vendor/ootle-wasm-patched/README.md +128 -0
  51. package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +454 -0
  52. package/vendor/ootle-wasm-patched/ootle_wasm.js +9 -0
  53. package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +1485 -0
  54. package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
  55. package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +83 -0
  56. package/vendor/ootle-wasm-patched/package.json +27 -0
@@ -0,0 +1,1485 @@
1
+ /**
2
+ * Decrypted contents of an inbound stealth UTXO.
3
+ */
4
+ export class DecryptedOutputResult {
5
+ static __wrap(ptr) {
6
+ ptr = ptr >>> 0;
7
+ const obj = Object.create(DecryptedOutputResult.prototype);
8
+ obj.__wbg_ptr = ptr;
9
+ DecryptedOutputResultFinalization.register(obj, obj.__wbg_ptr, obj);
10
+ return obj;
11
+ }
12
+ __destroy_into_raw() {
13
+ const ptr = this.__wbg_ptr;
14
+ this.__wbg_ptr = 0;
15
+ DecryptedOutputResultFinalization.unregister(this);
16
+ return ptr;
17
+ }
18
+ free() {
19
+ const ptr = this.__destroy_into_raw();
20
+ wasm.__wbg_decryptedoutputresult_free(ptr, 0);
21
+ }
22
+ /**
23
+ * The 32-byte commitment mask scalar.
24
+ * @returns {Uint8Array}
25
+ */
26
+ get mask() {
27
+ const ret = wasm.__wbg_get_decryptedoutputresult_mask(this.__wbg_ptr);
28
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
29
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
30
+ return v1;
31
+ }
32
+ /**
33
+ * JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `PayRefAndBytes`), or `null` if
34
+ * the payload carried no memo or `skipMemo` was set.
35
+ * @returns {string | undefined}
36
+ */
37
+ get memo_json() {
38
+ const ret = wasm.__wbg_get_decryptedoutputresult_memo_json(this.__wbg_ptr);
39
+ let v1;
40
+ if (ret[0] !== 0) {
41
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
42
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
43
+ }
44
+ return v1;
45
+ }
46
+ /**
47
+ * The plaintext value (u64).
48
+ * @returns {bigint}
49
+ */
50
+ get value() {
51
+ const ret = wasm.__wbg_get_decryptedoutputresult_value(this.__wbg_ptr);
52
+ return BigInt.asUintN(64, ret);
53
+ }
54
+ /**
55
+ * The 32-byte commitment mask scalar.
56
+ * @param {Uint8Array} arg0
57
+ */
58
+ set mask(arg0) {
59
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
60
+ const len0 = WASM_VECTOR_LEN;
61
+ wasm.__wbg_set_decryptedoutputresult_mask(this.__wbg_ptr, ptr0, len0);
62
+ }
63
+ /**
64
+ * JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `PayRefAndBytes`), or `null` if
65
+ * the payload carried no memo or `skipMemo` was set.
66
+ * @param {string | null} [arg0]
67
+ */
68
+ set memo_json(arg0) {
69
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
70
+ var len0 = WASM_VECTOR_LEN;
71
+ wasm.__wbg_set_decryptedoutputresult_memo_json(this.__wbg_ptr, ptr0, len0);
72
+ }
73
+ /**
74
+ * The plaintext value (u64).
75
+ * @param {bigint} arg0
76
+ */
77
+ set value(arg0) {
78
+ wasm.__wbg_set_decryptedoutputresult_value(this.__wbg_ptr, arg0);
79
+ }
80
+ }
81
+ if (Symbol.dispose) DecryptedOutputResult.prototype[Symbol.dispose] = DecryptedOutputResult.prototype.free;
82
+
83
+ /**
84
+ * A generated keypair (raw bytes).
85
+ */
86
+ export class KeypairResult {
87
+ static __wrap(ptr) {
88
+ ptr = ptr >>> 0;
89
+ const obj = Object.create(KeypairResult.prototype);
90
+ obj.__wbg_ptr = ptr;
91
+ KeypairResultFinalization.register(obj, obj.__wbg_ptr, obj);
92
+ return obj;
93
+ }
94
+ __destroy_into_raw() {
95
+ const ptr = this.__wbg_ptr;
96
+ this.__wbg_ptr = 0;
97
+ KeypairResultFinalization.unregister(this);
98
+ return ptr;
99
+ }
100
+ free() {
101
+ const ptr = this.__destroy_into_raw();
102
+ wasm.__wbg_keypairresult_free(ptr, 0);
103
+ }
104
+ /**
105
+ * @returns {Uint8Array}
106
+ */
107
+ get public_key() {
108
+ const ret = wasm.__wbg_get_keypairresult_public_key(this.__wbg_ptr);
109
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
110
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
111
+ return v1;
112
+ }
113
+ /**
114
+ * @returns {Uint8Array}
115
+ */
116
+ get secret_key() {
117
+ const ret = wasm.__wbg_get_keypairresult_secret_key(this.__wbg_ptr);
118
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
119
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
120
+ return v1;
121
+ }
122
+ /**
123
+ * @param {Uint8Array} arg0
124
+ */
125
+ set public_key(arg0) {
126
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
127
+ const len0 = WASM_VECTOR_LEN;
128
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
129
+ }
130
+ /**
131
+ * @param {Uint8Array} arg0
132
+ */
133
+ set secret_key(arg0) {
134
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
137
+ }
138
+ }
139
+ if (Symbol.dispose) KeypairResult.prototype[Symbol.dispose] = KeypairResult.prototype.free;
140
+
141
+ /**
142
+ * A pair of Ootle public keys derived from an OotleSecretKey.
143
+ */
144
+ export class OotlePublicKey {
145
+ static __wrap(ptr) {
146
+ ptr = ptr >>> 0;
147
+ const obj = Object.create(OotlePublicKey.prototype);
148
+ obj.__wbg_ptr = ptr;
149
+ OotlePublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);
150
+ return obj;
151
+ }
152
+ __destroy_into_raw() {
153
+ const ptr = this.__wbg_ptr;
154
+ this.__wbg_ptr = 0;
155
+ OotlePublicKeyFinalization.unregister(this);
156
+ return ptr;
157
+ }
158
+ free() {
159
+ const ptr = this.__destroy_into_raw();
160
+ wasm.__wbg_ootlepublickey_free(ptr, 0);
161
+ }
162
+ /**
163
+ * The owner (spending) public key bytes.
164
+ * @returns {Uint8Array}
165
+ */
166
+ get owner_key() {
167
+ const ret = wasm.__wbg_get_ootlepublickey_owner_key(this.__wbg_ptr);
168
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
169
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
170
+ return v1;
171
+ }
172
+ /**
173
+ * The view-only public key bytes.
174
+ * @returns {Uint8Array}
175
+ */
176
+ get view_key() {
177
+ const ret = wasm.__wbg_get_ootlepublickey_view_key(this.__wbg_ptr);
178
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
179
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
180
+ return v1;
181
+ }
182
+ /**
183
+ * The owner (spending) public key bytes.
184
+ * @param {Uint8Array} arg0
185
+ */
186
+ set owner_key(arg0) {
187
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
188
+ const len0 = WASM_VECTOR_LEN;
189
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
190
+ }
191
+ /**
192
+ * The view-only public key bytes.
193
+ * @param {Uint8Array} arg0
194
+ */
195
+ set view_key(arg0) {
196
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
197
+ const len0 = WASM_VECTOR_LEN;
198
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
199
+ }
200
+ }
201
+ if (Symbol.dispose) OotlePublicKey.prototype[Symbol.dispose] = OotlePublicKey.prototype.free;
202
+
203
+ /**
204
+ * A pair of Ootle secret keys (owner + view).
205
+ */
206
+ export class OotleSecretKey {
207
+ static __wrap(ptr) {
208
+ ptr = ptr >>> 0;
209
+ const obj = Object.create(OotleSecretKey.prototype);
210
+ obj.__wbg_ptr = ptr;
211
+ OotleSecretKeyFinalization.register(obj, obj.__wbg_ptr, obj);
212
+ return obj;
213
+ }
214
+ __destroy_into_raw() {
215
+ const ptr = this.__wbg_ptr;
216
+ this.__wbg_ptr = 0;
217
+ OotleSecretKeyFinalization.unregister(this);
218
+ return ptr;
219
+ }
220
+ free() {
221
+ const ptr = this.__destroy_into_raw();
222
+ wasm.__wbg_ootlesecretkey_free(ptr, 0);
223
+ }
224
+ /**
225
+ * The owner (spending) secret key bytes.
226
+ * @returns {Uint8Array}
227
+ */
228
+ get owner_key() {
229
+ const ret = wasm.__wbg_get_ootlesecretkey_owner_key(this.__wbg_ptr);
230
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
231
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
232
+ return v1;
233
+ }
234
+ /**
235
+ * The view-only secret key bytes.
236
+ * @returns {Uint8Array}
237
+ */
238
+ get view_key() {
239
+ const ret = wasm.__wbg_get_ootlesecretkey_view_key(this.__wbg_ptr);
240
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
241
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
242
+ return v1;
243
+ }
244
+ /**
245
+ * The owner (spending) secret key bytes.
246
+ * @param {Uint8Array} arg0
247
+ */
248
+ set owner_key(arg0) {
249
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
250
+ const len0 = WASM_VECTOR_LEN;
251
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
252
+ }
253
+ /**
254
+ * The view-only secret key bytes.
255
+ * @param {Uint8Array} arg0
256
+ */
257
+ set view_key(arg0) {
258
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
261
+ }
262
+ }
263
+ if (Symbol.dispose) OotleSecretKey.prototype[Symbol.dispose] = OotleSecretKey.prototype.free;
264
+
265
+ /**
266
+ * Parsed components of an Ootle address.
267
+ */
268
+ export class ParsedOotleAddress {
269
+ static __wrap(ptr) {
270
+ ptr = ptr >>> 0;
271
+ const obj = Object.create(ParsedOotleAddress.prototype);
272
+ obj.__wbg_ptr = ptr;
273
+ ParsedOotleAddressFinalization.register(obj, obj.__wbg_ptr, obj);
274
+ return obj;
275
+ }
276
+ __destroy_into_raw() {
277
+ const ptr = this.__wbg_ptr;
278
+ this.__wbg_ptr = 0;
279
+ ParsedOotleAddressFinalization.unregister(this);
280
+ return ptr;
281
+ }
282
+ free() {
283
+ const ptr = this.__destroy_into_raw();
284
+ wasm.__wbg_parsedootleaddress_free(ptr, 0);
285
+ }
286
+ /**
287
+ * Optional pay reference / memo bytes.
288
+ * @returns {Uint8Array | undefined}
289
+ */
290
+ get memo() {
291
+ const ret = wasm.__wbg_get_parsedootleaddress_memo(this.__wbg_ptr);
292
+ let v1;
293
+ if (ret[0] !== 0) {
294
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
295
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
296
+ }
297
+ return v1;
298
+ }
299
+ /**
300
+ * The network byte.
301
+ * @returns {number}
302
+ */
303
+ get network() {
304
+ const ret = wasm.__wbg_get_parsedootleaddress_network(this.__wbg_ptr);
305
+ return ret;
306
+ }
307
+ /**
308
+ * The owner (spending) public key bytes.
309
+ * @returns {Uint8Array}
310
+ */
311
+ get owner_key() {
312
+ const ret = wasm.__wbg_get_parsedootleaddress_owner_key(this.__wbg_ptr);
313
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
314
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
315
+ return v1;
316
+ }
317
+ /**
318
+ * The view-only public key bytes.
319
+ * @returns {Uint8Array}
320
+ */
321
+ get view_key() {
322
+ const ret = wasm.__wbg_get_parsedootleaddress_view_key(this.__wbg_ptr);
323
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
324
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
325
+ return v1;
326
+ }
327
+ /**
328
+ * Optional pay reference / memo bytes.
329
+ * @param {Uint8Array | null} [arg0]
330
+ */
331
+ set memo(arg0) {
332
+ var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
333
+ var len0 = WASM_VECTOR_LEN;
334
+ wasm.__wbg_set_parsedootleaddress_memo(this.__wbg_ptr, ptr0, len0);
335
+ }
336
+ /**
337
+ * The network byte.
338
+ * @param {number} arg0
339
+ */
340
+ set network(arg0) {
341
+ wasm.__wbg_set_parsedootleaddress_network(this.__wbg_ptr, arg0);
342
+ }
343
+ /**
344
+ * The owner (spending) public key bytes.
345
+ * @param {Uint8Array} arg0
346
+ */
347
+ set owner_key(arg0) {
348
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
351
+ }
352
+ /**
353
+ * The view-only public key bytes.
354
+ * @param {Uint8Array} arg0
355
+ */
356
+ set view_key(arg0) {
357
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
358
+ const len0 = WASM_VECTOR_LEN;
359
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
360
+ }
361
+ }
362
+ if (Symbol.dispose) ParsedOotleAddress.prototype[Symbol.dispose] = ParsedOotleAddress.prototype.free;
363
+
364
+ /**
365
+ * Result of a Schnorr signature operation (raw bytes). Also used for balance proof signatures, which
366
+ * share the `(public_nonce, signature)` shape.
367
+ */
368
+ export class SchnorrSignatureResult {
369
+ static __wrap(ptr) {
370
+ ptr = ptr >>> 0;
371
+ const obj = Object.create(SchnorrSignatureResult.prototype);
372
+ obj.__wbg_ptr = ptr;
373
+ SchnorrSignatureResultFinalization.register(obj, obj.__wbg_ptr, obj);
374
+ return obj;
375
+ }
376
+ __destroy_into_raw() {
377
+ const ptr = this.__wbg_ptr;
378
+ this.__wbg_ptr = 0;
379
+ SchnorrSignatureResultFinalization.unregister(this);
380
+ return ptr;
381
+ }
382
+ free() {
383
+ const ptr = this.__destroy_into_raw();
384
+ wasm.__wbg_schnorrsignatureresult_free(ptr, 0);
385
+ }
386
+ /**
387
+ * @returns {Uint8Array}
388
+ */
389
+ get public_nonce() {
390
+ const ret = wasm.__wbg_get_schnorrsignatureresult_public_nonce(this.__wbg_ptr);
391
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
392
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
393
+ return v1;
394
+ }
395
+ /**
396
+ * @returns {Uint8Array}
397
+ */
398
+ get signature() {
399
+ const ret = wasm.__wbg_get_schnorrsignatureresult_signature(this.__wbg_ptr);
400
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
401
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
402
+ return v1;
403
+ }
404
+ /**
405
+ * @param {Uint8Array} arg0
406
+ */
407
+ set public_nonce(arg0) {
408
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
409
+ const len0 = WASM_VECTOR_LEN;
410
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
411
+ }
412
+ /**
413
+ * @param {Uint8Array} arg0
414
+ */
415
+ set signature(arg0) {
416
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
417
+ const len0 = WASM_VECTOR_LEN;
418
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
419
+ }
420
+ }
421
+ if (Symbol.dispose) SchnorrSignatureResult.prototype[Symbol.dispose] = SchnorrSignatureResult.prototype.free;
422
+
423
+ /**
424
+ * Result of generating a stealth outputs statement.
425
+ */
426
+ export class StealthOutputsResult {
427
+ static __wrap(ptr) {
428
+ ptr = ptr >>> 0;
429
+ const obj = Object.create(StealthOutputsResult.prototype);
430
+ obj.__wbg_ptr = ptr;
431
+ StealthOutputsResultFinalization.register(obj, obj.__wbg_ptr, obj);
432
+ return obj;
433
+ }
434
+ __destroy_into_raw() {
435
+ const ptr = this.__wbg_ptr;
436
+ this.__wbg_ptr = 0;
437
+ StealthOutputsResultFinalization.unregister(this);
438
+ return ptr;
439
+ }
440
+ free() {
441
+ const ptr = this.__destroy_into_raw();
442
+ wasm.__wbg_stealthoutputsresult_free(ptr, 0);
443
+ }
444
+ /**
445
+ * Sum of all witness masks, suitable for use as the `aggregated_output_mask` argument to
446
+ * `generateStealthBalanceProofSignature`.
447
+ * @returns {Uint8Array}
448
+ */
449
+ get aggregated_output_mask() {
450
+ const ret = wasm.__wbg_get_stealthoutputsresult_aggregated_output_mask(this.__wbg_ptr);
451
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
452
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
453
+ return v1;
454
+ }
455
+ /**
456
+ * JSON-serialized `StealthOutputsStatement` (the wire-format payload).
457
+ * @returns {string}
458
+ */
459
+ get statement_json() {
460
+ let deferred1_0;
461
+ let deferred1_1;
462
+ try {
463
+ const ret = wasm.__wbg_get_stealthoutputsresult_statement_json(this.__wbg_ptr);
464
+ deferred1_0 = ret[0];
465
+ deferred1_1 = ret[1];
466
+ return getStringFromWasm0(ret[0], ret[1]);
467
+ } finally {
468
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
469
+ }
470
+ }
471
+ /**
472
+ * Sum of all witness masks, suitable for use as the `aggregated_output_mask` argument to
473
+ * `generateStealthBalanceProofSignature`.
474
+ * @param {Uint8Array} arg0
475
+ */
476
+ set aggregated_output_mask(arg0) {
477
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ wasm.__wbg_set_keypairresult_public_key(this.__wbg_ptr, ptr0, len0);
480
+ }
481
+ /**
482
+ * JSON-serialized `StealthOutputsStatement` (the wire-format payload).
483
+ * @param {string} arg0
484
+ */
485
+ set statement_json(arg0) {
486
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
487
+ const len0 = WASM_VECTOR_LEN;
488
+ wasm.__wbg_set_keypairresult_secret_key(this.__wbg_ptr, ptr0, len0);
489
+ }
490
+ }
491
+ if (Symbol.dispose) StealthOutputsResult.prototype[Symbol.dispose] = StealthOutputsResult.prototype.free;
492
+
493
+ /**
494
+ * Add a signer to a transaction (unsigned or unsealed JSON).
495
+ *
496
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
497
+ * Returns the `UnsealedTransactionV1` (with the new signature appended) as a JSON string.
498
+ * @param {string} tx_json
499
+ * @param {Uint8Array} signer_secret_key
500
+ * @param {Uint8Array} seal_signer_public_key
501
+ * @returns {string}
502
+ */
503
+ export function addTransactionSigner(tx_json, signer_secret_key, seal_signer_public_key) {
504
+ let deferred5_0;
505
+ let deferred5_1;
506
+ try {
507
+ const ptr0 = passStringToWasm0(tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
508
+ const len0 = WASM_VECTOR_LEN;
509
+ const ptr1 = passArray8ToWasm0(signer_secret_key, wasm.__wbindgen_malloc);
510
+ const len1 = WASM_VECTOR_LEN;
511
+ const ptr2 = passArray8ToWasm0(seal_signer_public_key, wasm.__wbindgen_malloc);
512
+ const len2 = WASM_VECTOR_LEN;
513
+ const ret = wasm.addTransactionSigner(ptr0, len0, ptr1, len1, ptr2, len2);
514
+ var ptr4 = ret[0];
515
+ var len4 = ret[1];
516
+ if (ret[3]) {
517
+ ptr4 = 0; len4 = 0;
518
+ throw takeFromExternrefTable0(ret[2]);
519
+ }
520
+ deferred5_0 = ptr4;
521
+ deferred5_1 = len4;
522
+ return getStringFromWasm0(ptr4, len4);
523
+ } finally {
524
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Aggregate the commitment masks of stealth inputs into a single 32-byte Ristretto scalar.
530
+ *
531
+ * `masks_concat` is the concatenated bytes of all input masks (32 bytes per mask, so the input
532
+ * length must be a multiple of 32). Pass an empty array to obtain the zero scalar.
533
+ *
534
+ * Returns the sum as 32 bytes, suitable as the `aggregated_input_mask` argument to
535
+ * `generateStealthBalanceProofSignature`. The output side of the same balance proof is aggregated
536
+ * automatically by `generateStealthOutputsStatement` (returned as `aggregated_output_mask`).
537
+ * @param {Uint8Array} masks_concat
538
+ * @returns {Uint8Array}
539
+ */
540
+ export function aggregateInputMasks(masks_concat) {
541
+ const ptr0 = passArray8ToWasm0(masks_concat, wasm.__wbindgen_malloc);
542
+ const len0 = WASM_VECTOR_LEN;
543
+ const ret = wasm.aggregateInputMasks(ptr0, len0);
544
+ if (ret[3]) {
545
+ throw takeFromExternrefTable0(ret[2]);
546
+ }
547
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
548
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
549
+ return v2;
550
+ }
551
+
552
+ /**
553
+ * BOR-encode a Transaction (JSON string) → base64 string (TransactionEnvelope format).
554
+ * @param {string} transaction_json
555
+ * @returns {string}
556
+ */
557
+ export function borEncodeTransaction(transaction_json) {
558
+ let deferred3_0;
559
+ let deferred3_1;
560
+ try {
561
+ const ptr0 = passStringToWasm0(transaction_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
562
+ const len0 = WASM_VECTOR_LEN;
563
+ const ret = wasm.borEncodeTransaction(ptr0, len0);
564
+ var ptr2 = ret[0];
565
+ var len2 = ret[1];
566
+ if (ret[3]) {
567
+ ptr2 = 0; len2 = 0;
568
+ throw takeFromExternrefTable0(ret[2]);
569
+ }
570
+ deferred3_0 = ptr2;
571
+ deferred3_1 = len2;
572
+ return getStringFromWasm0(ptr2, len2);
573
+ } finally {
574
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
575
+ }
576
+ }
577
+
578
+ /**
579
+ * Build a script-path `SpendWitness` revealing `leaf` from the committed `conditions` set, optionally
580
+ * supplying a witness `data` blob the leaf's predicate interprets (e.g. a hashlock preimage). Returns a
581
+ * JSON object: `{ "witness": <SpendWitness>, "condition_root": <Hash32> }`.
582
+ *
583
+ * `conditions_json` is the JSON array of `SpendCondition` leaves exactly as passed to
584
+ * `createStealthOutputWitness`'s `PayTo::Conditions` when the output was created; `leaf_json` is the
585
+ * single leaf being revealed. The returned `condition_root` must match the `Script` root recorded in
586
+ * that output's `SpendAuthorization` -- record it against the spent input via
587
+ * `buildStealthInputsStatementFromInputs`.
588
+ *
589
+ * Pass an empty `data` array for a leaf whose predicate needs no spender-supplied data (e.g. a plain
590
+ * timelock refund).
591
+ * @param {string} conditions_json
592
+ * @param {string} leaf_json
593
+ * @param {Uint8Array} data
594
+ * @returns {string}
595
+ */
596
+ export function buildScriptPathWitness(conditions_json, leaf_json, data) {
597
+ let deferred5_0;
598
+ let deferred5_1;
599
+ try {
600
+ const ptr0 = passStringToWasm0(conditions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
601
+ const len0 = WASM_VECTOR_LEN;
602
+ const ptr1 = passStringToWasm0(leaf_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
603
+ const len1 = WASM_VECTOR_LEN;
604
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
605
+ const len2 = WASM_VECTOR_LEN;
606
+ const ret = wasm.buildScriptPathWitness(ptr0, len0, ptr1, len1, ptr2, len2);
607
+ var ptr4 = ret[0];
608
+ var len4 = ret[1];
609
+ if (ret[3]) {
610
+ ptr4 = 0; len4 = 0;
611
+ throw takeFromExternrefTable0(ret[2]);
612
+ }
613
+ deferred5_0 = ptr4;
614
+ deferred5_1 = len4;
615
+ return getStringFromWasm0(ptr4, len4);
616
+ } finally {
617
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
618
+ }
619
+ }
620
+
621
+ /**
622
+ * Build a `StealthInputsStatement` JSON from raw input commitments and a revealed amount.
623
+ *
624
+ * `input_commitments` is the concatenated bytes of all 32-byte commitments (so the length must be a
625
+ * multiple of 32). Pass an empty array for a revealed-only statement.
626
+ *
627
+ * This is a convenience helper so callers don't need to hand-craft the wire JSON; the result is used
628
+ * as the `inputs_statement_json` argument to `generateStealthBalanceProofSignature` and friends.
629
+ * @param {Uint8Array} input_commitments
630
+ * @param {bigint} revealed_amount_microtari
631
+ * @returns {string}
632
+ */
633
+ export function buildStealthInputsStatement(input_commitments, revealed_amount_microtari) {
634
+ let deferred3_0;
635
+ let deferred3_1;
636
+ try {
637
+ const ptr0 = passArray8ToWasm0(input_commitments, wasm.__wbindgen_malloc);
638
+ const len0 = WASM_VECTOR_LEN;
639
+ const ret = wasm.buildStealthInputsStatement(ptr0, len0, revealed_amount_microtari);
640
+ var ptr2 = ret[0];
641
+ var len2 = ret[1];
642
+ if (ret[3]) {
643
+ ptr2 = 0; len2 = 0;
644
+ throw takeFromExternrefTable0(ret[2]);
645
+ }
646
+ deferred3_0 = ptr2;
647
+ deferred3_1 = len2;
648
+ return getStringFromWasm0(ptr2, len2);
649
+ } finally {
650
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Build a `StealthInputsStatement` JSON from a JSON array of per-input `{commitment, witness}` pairs
656
+ * and a revealed amount.
657
+ *
658
+ * Unlike `buildStealthInputsStatement`, which only builds key-path inputs from raw commitment bytes,
659
+ * this accepts a caller-supplied `witness` per input -- the only way to spend an output committed with
660
+ * `PayTo::Conditions` (e.g. claiming or refunding an HTLC-style hashlock/timelock output). Build each
661
+ * script-path input's witness with `buildScriptPathWitness` first; a plain key-path input can still be
662
+ * included in the same call, either with `"witness":"KeyPath"` or by omitting `witness` entirely
663
+ * (defaults to key path).
664
+ *
665
+ * `inputs_json` shape: `[{ "commitment": <hex 32 bytes>, "witness"?: <SpendWitness> }, ...]`.
666
+ * @param {string} inputs_json
667
+ * @param {bigint} revealed_amount_microtari
668
+ * @returns {string}
669
+ */
670
+ export function buildStealthInputsStatementFromInputs(inputs_json, revealed_amount_microtari) {
671
+ let deferred3_0;
672
+ let deferred3_1;
673
+ try {
674
+ const ptr0 = passStringToWasm0(inputs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
675
+ const len0 = WASM_VECTOR_LEN;
676
+ const ret = wasm.buildStealthInputsStatementFromInputs(ptr0, len0, revealed_amount_microtari);
677
+ var ptr2 = ret[0];
678
+ var len2 = ret[1];
679
+ if (ret[3]) {
680
+ ptr2 = 0; len2 = 0;
681
+ throw takeFromExternrefTable0(ret[2]);
682
+ }
683
+ deferred3_0 = ptr2;
684
+ deferred3_1 = len2;
685
+ return getStringFromWasm0(ptr2, len2);
686
+ } finally {
687
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
688
+ }
689
+ }
690
+
691
+ /**
692
+ * Build a complete `StealthTransferStatement` JSON from unblinded input/output witnesses.
693
+ *
694
+ * Unlike `generateStealthOutputsStatement` / `buildStealthInputsStatementFromInputs` +
695
+ * `generateStealthBalanceProofSignature`, which build and sign each half of a transfer
696
+ * separately, this wraps the single primitive that produces the *entire*, internally-consistent
697
+ * statement in one call, including a covenant balance-integrity proof for any script-path input
698
+ * whose revealed leaf gates on `Covenant::BalancePreserved` (see `ootle_wasm_core::stealth::
699
+ * transfer::build_stealth_transfer_statement` for when a claim is and isn't needed).
700
+ *
701
+ * `input_witnesses_json` is a JSON array of `{ "mask_and_value": { "value": <u64>, "mask": <hex
702
+ * 32 bytes> }, "witness"?: <SpendWitness>, "condition_root"?: <Hash32> }` -- each entry's
703
+ * `witness`/`condition_root` are the exact pair `buildScriptPathWitness` returns, for a
704
+ * script-path input; omit both for a plain key-path input. Mixing key-path and script-path
705
+ * inputs in one call is supported.
706
+ *
707
+ * `output_witnesses_json` is a JSON array of the same `{ "witness": {...}, "auth": ..., "tag":
708
+ * ... }` shape `createStealthOutputWitness` returns -- collect one entry per output (including
709
+ * change).
710
+ * @param {string} input_witnesses_json
711
+ * @param {bigint} revealed_input_amount_microtari
712
+ * @param {string} output_witnesses_json
713
+ * @param {bigint} revealed_output_amount_microtari
714
+ * @returns {string}
715
+ */
716
+ export function buildStealthTransferStatement(input_witnesses_json, revealed_input_amount_microtari, output_witnesses_json, revealed_output_amount_microtari) {
717
+ let deferred4_0;
718
+ let deferred4_1;
719
+ try {
720
+ const ptr0 = passStringToWasm0(input_witnesses_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
721
+ const len0 = WASM_VECTOR_LEN;
722
+ const ptr1 = passStringToWasm0(output_witnesses_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
723
+ const len1 = WASM_VECTOR_LEN;
724
+ const ret = wasm.buildStealthTransferStatement(ptr0, len0, revealed_input_amount_microtari, ptr1, len1, revealed_output_amount_microtari);
725
+ var ptr3 = ret[0];
726
+ var len3 = ret[1];
727
+ if (ret[3]) {
728
+ ptr3 = 0; len3 = 0;
729
+ throw takeFromExternrefTable0(ret[2]);
730
+ }
731
+ deferred4_0 = ptr3;
732
+ deferred4_1 = len3;
733
+ return getStringFromWasm0(ptr3, len3);
734
+ } finally {
735
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
736
+ }
737
+ }
738
+
739
+ /**
740
+ * Builds a `ConfidentialWithdrawProof` for the Account template's `withdraw_confidential` /
741
+ * `join_confidential` methods, and returns it `tari_bor`-encoded -- ready to hex-encode and wrap
742
+ * as an instruction `Literal` arg exactly like `microTariLiteral`/`amountLiteral` do for simpler
743
+ * types. Unlike those, this is NOT re-encoded on the JS side: the bytes are already the encoding
744
+ * the chain itself decodes, produced by the same derive-generated `Encode` impl.
745
+ *
746
+ * `inputs_json` is a JSON array of `{ value, mask }` for each confidential UTXO being spent — `"[]"`
747
+ * for a revealed-only withdrawal (depositing into the vault). `output_json` / `change_json` are each
748
+ * an optional JSON object (see `createStealthOutputWitness`'s `OutputWitnessJson` shape) — omit to
749
+ * skip that side. `*_revealed_amount` is the plaintext portion on each side; confidential and
750
+ * revealed amounts can be mixed on either side.
751
+ *
752
+ * Throws if `inputs_json`/`output_json`/`change_json` don't parse, or if any mask isn't a valid
753
+ * 32-byte Ristretto scalar.
754
+ * @param {string} inputs_json
755
+ * @param {bigint} input_revealed_amount
756
+ * @param {string | null | undefined} output_json
757
+ * @param {bigint} output_revealed_amount
758
+ * @param {string | null | undefined} change_json
759
+ * @param {bigint} change_revealed_amount
760
+ * @returns {Uint8Array}
761
+ */
762
+ export function createConfidentialWithdrawProofLiteral(inputs_json, input_revealed_amount, output_json, output_revealed_amount, change_json, change_revealed_amount) {
763
+ const ptr0 = passStringToWasm0(inputs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
764
+ const len0 = WASM_VECTOR_LEN;
765
+ var ptr1 = isLikeNone(output_json) ? 0 : passStringToWasm0(output_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
766
+ var len1 = WASM_VECTOR_LEN;
767
+ var ptr2 = isLikeNone(change_json) ? 0 : passStringToWasm0(change_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
768
+ var len2 = WASM_VECTOR_LEN;
769
+ const ret = wasm.createConfidentialWithdrawProofLiteral(ptr0, len0, input_revealed_amount, ptr1, len1, output_revealed_amount, ptr2, len2, change_revealed_amount);
770
+ if (ret[3]) {
771
+ throw takeFromExternrefTable0(ret[2]);
772
+ }
773
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
774
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
775
+ return v4;
776
+ }
777
+
778
+ /**
779
+ * Build a single stealth output witness entirely client-side (sender side), mirroring the wallet
780
+ * daemon's `create_output_witness`.
781
+ *
782
+ * A fresh commitment mask and ephemeral nonce are generated internally; the recipient recovers the
783
+ * value and mask by decrypting `encrypted_data`. Returns one witness as a JSON string with the shape:
784
+ * ```text
785
+ * {
786
+ * "witness": {
787
+ * "amount": <u64>,
788
+ * "mask": <hex 32 bytes>,
789
+ * "sender_public_nonce": <hex 32 bytes>,
790
+ * "minimum_value_promise": <u64>,
791
+ * "encrypted_data": <hex variable-length>,
792
+ * "resource_view_key": <hex 32 bytes | null>
793
+ * },
794
+ * "auth": <SpendAuthorization>,
795
+ * "tag": <u32>
796
+ * }
797
+ * ```
798
+ * Collect one witness per output (including change) into a JSON array and pass it to
799
+ * `generateStealthOutputsStatement`.
800
+ *
801
+ * - `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
802
+ * - `destination_account_public_key` / `destination_view_public_key` are the recipient's 32-byte keys.
803
+ * - `resource_address` is the `resource_<hex>` string of the resource being sent.
804
+ * - `resource_view_key` is the resource view-key holder's 32-byte public key, or `null` for resources without a
805
+ * viewable balance (when set, the output receives an ElGamal proof at statement time).
806
+ * - `memo_json` is an optional JSON-encoded `Memo` to embed in the encrypted payload.
807
+ * - `pay_to_json` is an optional JSON-encoded `PayTo`: `"StealthPublicKey"` (the default when `null`, producing a
808
+ * one-time stealth spend key) or `{"AccessRule": <AccessRule>}`.
809
+ * - `minimum_value_promise` is the range-proof lower bound and must be `<= amount` (use `0` normally).
810
+ * @param {number} network
811
+ * @param {Uint8Array} destination_account_public_key
812
+ * @param {Uint8Array} destination_view_public_key
813
+ * @param {bigint} amount
814
+ * @param {string} resource_address
815
+ * @param {Uint8Array | null | undefined} resource_view_key
816
+ * @param {string | null | undefined} memo_json
817
+ * @param {string | null | undefined} pay_to_json
818
+ * @param {bigint} minimum_value_promise
819
+ * @returns {string}
820
+ */
821
+ export function createStealthOutputWitness(network, destination_account_public_key, destination_view_public_key, amount, resource_address, resource_view_key, memo_json, pay_to_json, minimum_value_promise) {
822
+ let deferred8_0;
823
+ let deferred8_1;
824
+ try {
825
+ const ptr0 = passArray8ToWasm0(destination_account_public_key, wasm.__wbindgen_malloc);
826
+ const len0 = WASM_VECTOR_LEN;
827
+ const ptr1 = passArray8ToWasm0(destination_view_public_key, wasm.__wbindgen_malloc);
828
+ const len1 = WASM_VECTOR_LEN;
829
+ const ptr2 = passStringToWasm0(resource_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
830
+ const len2 = WASM_VECTOR_LEN;
831
+ var ptr3 = isLikeNone(resource_view_key) ? 0 : passArray8ToWasm0(resource_view_key, wasm.__wbindgen_malloc);
832
+ var len3 = WASM_VECTOR_LEN;
833
+ var ptr4 = isLikeNone(memo_json) ? 0 : passStringToWasm0(memo_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
834
+ var len4 = WASM_VECTOR_LEN;
835
+ var ptr5 = isLikeNone(pay_to_json) ? 0 : passStringToWasm0(pay_to_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
836
+ var len5 = WASM_VECTOR_LEN;
837
+ const ret = wasm.createStealthOutputWitness(network, ptr0, len0, ptr1, len1, amount, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, minimum_value_promise);
838
+ var ptr7 = ret[0];
839
+ var len7 = ret[1];
840
+ if (ret[3]) {
841
+ ptr7 = 0; len7 = 0;
842
+ throw takeFromExternrefTable0(ret[2]);
843
+ }
844
+ deferred8_0 = ptr7;
845
+ deferred8_1 = len7;
846
+ return getStringFromWasm0(ptr7, len7);
847
+ } finally {
848
+ wasm.__wbindgen_free(deferred8_0, deferred8_1, 1);
849
+ }
850
+ }
851
+
852
+ /**
853
+ * Brute-force decrypt an ElGamal viewable-balance proof to recover the bound value.
854
+ *
855
+ * Tries each value in `[min_value, max_value]` (inclusive). Returns `null` (via `Option`) if no
856
+ * candidate matches. Uses an on-the-fly value lookup — there is no precomputed table dependency, so
857
+ * callers should keep the range tight (large ranges produce proportional CPU cost).
858
+ *
859
+ * `commitment` is the Pedersen commitment the proof is bound to. Both the view public key and the
860
+ * view secret key are required: the public key is used to re-verify the ZK proof (rejecting tampered
861
+ * proofs before decrypting), the secret key performs the ElGamal decryption itself.
862
+ * @param {string} proof_json
863
+ * @param {Uint8Array} commitment
864
+ * @param {Uint8Array} view_public_key
865
+ * @param {Uint8Array} view_secret_key
866
+ * @param {bigint} min_value
867
+ * @param {bigint} max_value
868
+ * @returns {bigint | undefined}
869
+ */
870
+ export function decryptElgamalViewableBalance(proof_json, commitment, view_public_key, view_secret_key, min_value, max_value) {
871
+ const ptr0 = passStringToWasm0(proof_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
872
+ const len0 = WASM_VECTOR_LEN;
873
+ const ptr1 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
874
+ const len1 = WASM_VECTOR_LEN;
875
+ const ptr2 = passArray8ToWasm0(view_public_key, wasm.__wbindgen_malloc);
876
+ const len2 = WASM_VECTOR_LEN;
877
+ const ptr3 = passArray8ToWasm0(view_secret_key, wasm.__wbindgen_malloc);
878
+ const len3 = WASM_VECTOR_LEN;
879
+ const ret = wasm.decryptElgamalViewableBalance(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, min_value, max_value);
880
+ if (ret[3]) {
881
+ throw takeFromExternrefTable0(ret[2]);
882
+ }
883
+ return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
884
+ }
885
+
886
+ /**
887
+ * Derive the AEAD encryption key for `encrypted_data` from a Diffie-Hellman shared secret: `H(DH(s, P))`.
888
+ * Sender derives it with `(sender_secret_nonce, recipient_view_pub)`; receiver derives the same key
889
+ * with `(recipient_view_secret, sender_public_nonce)`.
890
+ * @param {Uint8Array} private_key
891
+ * @param {Uint8Array} public_key
892
+ * @returns {Uint8Array}
893
+ */
894
+ export function encryptedDataDhKdfAead(private_key, public_key) {
895
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
896
+ const len0 = WASM_VECTOR_LEN;
897
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
898
+ const len1 = WASM_VECTOR_LEN;
899
+ const ret = wasm.encryptedDataDhKdfAead(ptr0, len0, ptr1, len1);
900
+ if (ret[3]) {
901
+ throw takeFromExternrefTable0(ret[2]);
902
+ }
903
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
904
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
905
+ return v3;
906
+ }
907
+
908
+ /**
909
+ * Generate an ElGamal viewable-balance proof: a zero-knowledge proof that `amount` is the value bound
910
+ * by `commitment`, encrypted to the resource view-key holder.
911
+ *
912
+ * Returns the JSON-encoded `ViewableBalanceProof` (8 × 32-byte fields).
913
+ * @param {Uint8Array} mask
914
+ * @param {bigint} amount
915
+ * @param {Uint8Array} commitment
916
+ * @param {Uint8Array} view_public_key
917
+ * @returns {string}
918
+ */
919
+ export function generateElgamalViewableBalanceProof(mask, amount, commitment, view_public_key) {
920
+ let deferred5_0;
921
+ let deferred5_1;
922
+ try {
923
+ const ptr0 = passArray8ToWasm0(mask, wasm.__wbindgen_malloc);
924
+ const len0 = WASM_VECTOR_LEN;
925
+ const ptr1 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
926
+ const len1 = WASM_VECTOR_LEN;
927
+ const ptr2 = passArray8ToWasm0(view_public_key, wasm.__wbindgen_malloc);
928
+ const len2 = WASM_VECTOR_LEN;
929
+ const ret = wasm.generateElgamalViewableBalanceProof(ptr0, len0, amount, ptr1, len1, ptr2, len2);
930
+ var ptr4 = ret[0];
931
+ var len4 = ret[1];
932
+ if (ret[3]) {
933
+ ptr4 = 0; len4 = 0;
934
+ throw takeFromExternrefTable0(ret[2]);
935
+ }
936
+ deferred5_0 = ptr4;
937
+ deferred5_1 = len4;
938
+ return getStringFromWasm0(ptr4, len4);
939
+ } finally {
940
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
941
+ }
942
+ }
943
+
944
+ /**
945
+ * Generate an extended bulletproof aggregating range proofs for a set of output witnesses, proving
946
+ * each amount is in `[minimum_value_promise, 2^64)`. The number of witnesses is padded to the next
947
+ * power of two internally.
948
+ *
949
+ * `witnesses_json` is a JSON array of "flat" output witnesses (the `witness` field shape from
950
+ * [`generate_stealth_outputs_statement`] — without the surrounding `auth` / `tag`).
951
+ *
952
+ * Returns the raw range proof bytes (may be empty if the input array is empty).
953
+ * @param {string} witnesses_json
954
+ * @returns {Uint8Array}
955
+ */
956
+ export function generateExtendedBulletProof(witnesses_json) {
957
+ const ptr0 = passStringToWasm0(witnesses_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
958
+ const len0 = WASM_VECTOR_LEN;
959
+ const ret = wasm.generateExtendedBulletProof(ptr0, len0);
960
+ if (ret[3]) {
961
+ throw takeFromExternrefTable0(ret[2]);
962
+ }
963
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
964
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
965
+ return v2;
966
+ }
967
+
968
+ /**
969
+ * Generate a new random Ristretto keypair.
970
+ * Returns { secret_key: Uint8Array, public_key: Uint8Array }.
971
+ * @returns {KeypairResult}
972
+ */
973
+ export function generateKeypair() {
974
+ const ret = wasm.generateKeypair();
975
+ return KeypairResult.__wrap(ret);
976
+ }
977
+
978
+ /**
979
+ * Generate an Ootle address (bech32m string) from public keys.
980
+ *
981
+ * `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, etc.).
982
+ * `memo` is an optional pay reference (max 64 bytes).
983
+ * @param {Uint8Array} owner_public_key
984
+ * @param {Uint8Array} view_public_key
985
+ * @param {number} network
986
+ * @param {Uint8Array | null} [memo]
987
+ * @returns {string}
988
+ */
989
+ export function generateOotleAddress(owner_public_key, view_public_key, network, memo) {
990
+ let deferred5_0;
991
+ let deferred5_1;
992
+ try {
993
+ const ptr0 = passArray8ToWasm0(owner_public_key, wasm.__wbindgen_malloc);
994
+ const len0 = WASM_VECTOR_LEN;
995
+ const ptr1 = passArray8ToWasm0(view_public_key, wasm.__wbindgen_malloc);
996
+ const len1 = WASM_VECTOR_LEN;
997
+ var ptr2 = isLikeNone(memo) ? 0 : passArray8ToWasm0(memo, wasm.__wbindgen_malloc);
998
+ var len2 = WASM_VECTOR_LEN;
999
+ const ret = wasm.generateOotleAddress(ptr0, len0, ptr1, len1, network, ptr2, len2);
1000
+ var ptr4 = ret[0];
1001
+ var len4 = ret[1];
1002
+ if (ret[3]) {
1003
+ ptr4 = 0; len4 = 0;
1004
+ throw takeFromExternrefTable0(ret[2]);
1005
+ }
1006
+ deferred5_0 = ptr4;
1007
+ deferred5_1 = len4;
1008
+ return getStringFromWasm0(ptr4, len4);
1009
+ } finally {
1010
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1011
+ }
1012
+ }
1013
+
1014
+ /**
1015
+ * Generate a new random pair of Ootle secret keys (owner + view).
1016
+ * Returns { owner_key: Uint8Array, view_key: Uint8Array }.
1017
+ * @returns {OotleSecretKey}
1018
+ */
1019
+ export function generateOotleSecretKey() {
1020
+ const ret = wasm.generateOotleSecretKey();
1021
+ return OotleSecretKey.__wrap(ret);
1022
+ }
1023
+
1024
+ /**
1025
+ * Sign the balance proof for a stealth transfer.
1026
+ *
1027
+ * `aggregated_input_mask` and `aggregated_output_mask` are the 32-byte sums of all input / output
1028
+ * commitment masks respectively. Returns a `(public_nonce, signature)` pair (each 32 bytes); the pair
1029
+ * may be all-zeros for revealed-only transfers — callers normally omit the balance proof in that case.
1030
+ * @param {Uint8Array} aggregated_input_mask
1031
+ * @param {Uint8Array} aggregated_output_mask
1032
+ * @param {string} inputs_statement_json
1033
+ * @param {string} outputs_statement_json
1034
+ * @returns {SchnorrSignatureResult}
1035
+ */
1036
+ export function generateStealthBalanceProofSignature(aggregated_input_mask, aggregated_output_mask, inputs_statement_json, outputs_statement_json) {
1037
+ const ptr0 = passArray8ToWasm0(aggregated_input_mask, wasm.__wbindgen_malloc);
1038
+ const len0 = WASM_VECTOR_LEN;
1039
+ const ptr1 = passArray8ToWasm0(aggregated_output_mask, wasm.__wbindgen_malloc);
1040
+ const len1 = WASM_VECTOR_LEN;
1041
+ const ptr2 = passStringToWasm0(inputs_statement_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1042
+ const len2 = WASM_VECTOR_LEN;
1043
+ const ptr3 = passStringToWasm0(outputs_statement_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1044
+ const len3 = WASM_VECTOR_LEN;
1045
+ const ret = wasm.generateStealthBalanceProofSignature(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1046
+ if (ret[2]) {
1047
+ throw takeFromExternrefTable0(ret[1]);
1048
+ }
1049
+ return SchnorrSignatureResult.__wrap(ret[0]);
1050
+ }
1051
+
1052
+ /**
1053
+ * Generate the output side of a stealth transfer: per-output Pedersen commitments and encrypted data,
1054
+ * optional ElGamal viewable-balance proofs (for outputs with a `resource_view_key`), and an aggregated
1055
+ * bulletproof range proof.
1056
+ *
1057
+ * `witnesses_json` is a JSON array of stealth output witnesses. Each entry has the shape:
1058
+ * ```text
1059
+ * {
1060
+ * "witness": {
1061
+ * "amount": <u64>,
1062
+ * "mask": <hex 32 bytes>,
1063
+ * "sender_public_nonce": <hex 32 bytes>,
1064
+ * "minimum_value_promise": <u64>,
1065
+ * "encrypted_data": <hex variable-length>,
1066
+ * "resource_view_key": <hex 32 bytes | null>
1067
+ * },
1068
+ * "auth": <SpendAuthorization>,
1069
+ * "tag": <u32>
1070
+ * }
1071
+ * ```
1072
+ *
1073
+ * Returns the serialized statement plus the aggregated output mask, which the sender feeds to
1074
+ * `generateStealthBalanceProofSignature` together with the aggregated input mask.
1075
+ * @param {string} witnesses_json
1076
+ * @param {bigint} revealed_output_amount_microtari
1077
+ * @returns {StealthOutputsResult}
1078
+ */
1079
+ export function generateStealthOutputsStatement(witnesses_json, revealed_output_amount_microtari) {
1080
+ const ptr0 = passStringToWasm0(witnesses_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1081
+ const len0 = WASM_VECTOR_LEN;
1082
+ const ret = wasm.generateStealthOutputsStatement(ptr0, len0, revealed_output_amount_microtari);
1083
+ if (ret[2]) {
1084
+ throw takeFromExternrefTable0(ret[1]);
1085
+ }
1086
+ return StealthOutputsResult.__wrap(ret[0]);
1087
+ }
1088
+
1089
+ /**
1090
+ * Hash an UnsignedTransactionV1 (JSON string) for signing.
1091
+ * Returns the 64-byte signing message that must be Schnorr-signed.
1092
+ *
1093
+ * `seal_signer_public_key` is the raw bytes of the seal signer's public key (account owner).
1094
+ * @param {string} unsigned_tx_json
1095
+ * @param {Uint8Array} seal_signer_public_key
1096
+ * @returns {Uint8Array}
1097
+ */
1098
+ export function hashUnsignedTransaction(unsigned_tx_json, seal_signer_public_key) {
1099
+ const ptr0 = passStringToWasm0(unsigned_tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1100
+ const len0 = WASM_VECTOR_LEN;
1101
+ const ptr1 = passArray8ToWasm0(seal_signer_public_key, wasm.__wbindgen_malloc);
1102
+ const len1 = WASM_VECTOR_LEN;
1103
+ const ret = wasm.hashUnsignedTransaction(ptr0, len0, ptr1, len1);
1104
+ if (ret[3]) {
1105
+ throw takeFromExternrefTable0(ret[2]);
1106
+ }
1107
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1108
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1109
+ return v3;
1110
+ }
1111
+
1112
+ /**
1113
+ * Called automatically when the WASM module is instantiated. Do not call directly.
1114
+ */
1115
+ export function on_start() {
1116
+ wasm.on_start();
1117
+ }
1118
+
1119
+ /**
1120
+ * Derive the Ootle public keys from a pair of secret keys.
1121
+ * Returns { owner_key: Uint8Array, view_key: Uint8Array }.
1122
+ * @param {Uint8Array} owner_key
1123
+ * @param {Uint8Array} view_key
1124
+ * @returns {OotlePublicKey}
1125
+ */
1126
+ export function ootlePublicKeyFromSecretKey(owner_key, view_key) {
1127
+ const ptr0 = passArray8ToWasm0(owner_key, wasm.__wbindgen_malloc);
1128
+ const len0 = WASM_VECTOR_LEN;
1129
+ const ptr1 = passArray8ToWasm0(view_key, wasm.__wbindgen_malloc);
1130
+ const len1 = WASM_VECTOR_LEN;
1131
+ const ret = wasm.ootlePublicKeyFromSecretKey(ptr0, len0, ptr1, len1);
1132
+ if (ret[2]) {
1133
+ throw takeFromExternrefTable0(ret[1]);
1134
+ }
1135
+ return OotlePublicKey.__wrap(ret[0]);
1136
+ }
1137
+
1138
+ /**
1139
+ * Parse a bech32m Ootle address string into its components.
1140
+ * Returns { owner_key: Uint8Array, view_key: Uint8Array, network: number, memo: Uint8Array | undefined }.
1141
+ * @param {string} address
1142
+ * @returns {ParsedOotleAddress}
1143
+ */
1144
+ export function parseOotleAddress(address) {
1145
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1146
+ const len0 = WASM_VECTOR_LEN;
1147
+ const ret = wasm.parseOotleAddress(ptr0, len0);
1148
+ if (ret[2]) {
1149
+ throw takeFromExternrefTable0(ret[1]);
1150
+ }
1151
+ return ParsedOotleAddress.__wrap(ret[0]);
1152
+ }
1153
+
1154
+ /**
1155
+ * Derive the public key from a secret key (both raw bytes).
1156
+ * @param {Uint8Array} secret_key
1157
+ * @returns {Uint8Array}
1158
+ */
1159
+ export function publicKeyFromSecretKey(secret_key) {
1160
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
1161
+ const len0 = WASM_VECTOR_LEN;
1162
+ const ret = wasm.publicKeyFromSecretKey(ptr0, len0);
1163
+ if (ret[3]) {
1164
+ throw takeFromExternrefTable0(ret[2]);
1165
+ }
1166
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1167
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1168
+ return v2;
1169
+ }
1170
+
1171
+ /**
1172
+ * Schnorr-sign a message with a secret key.
1173
+ * Returns { public_nonce: Uint8Array, signature: Uint8Array }.
1174
+ * @param {Uint8Array} secret_key
1175
+ * @param {Uint8Array} message
1176
+ * @returns {SchnorrSignatureResult}
1177
+ */
1178
+ export function schnorrSign(secret_key, message) {
1179
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
1180
+ const len0 = WASM_VECTOR_LEN;
1181
+ const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
1182
+ const len1 = WASM_VECTOR_LEN;
1183
+ const ret = wasm.schnorrSign(ptr0, len0, ptr1, len1);
1184
+ if (ret[2]) {
1185
+ throw takeFromExternrefTable0(ret[1]);
1186
+ }
1187
+ return SchnorrSignatureResult.__wrap(ret[0]);
1188
+ }
1189
+
1190
+ /**
1191
+ * Seal a transaction (unsigned or unsealed JSON) with the seal signer's secret key.
1192
+ *
1193
+ * Accepts either an `UnsignedTransactionV1` or `UnsealedTransactionV1` JSON string.
1194
+ * Returns the sealed `Transaction` as a JSON string.
1195
+ * @param {string} tx_json
1196
+ * @param {Uint8Array} seal_signer_secret_key
1197
+ * @returns {string}
1198
+ */
1199
+ export function sealTransaction(tx_json, seal_signer_secret_key) {
1200
+ let deferred4_0;
1201
+ let deferred4_1;
1202
+ try {
1203
+ const ptr0 = passStringToWasm0(tx_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1204
+ const len0 = WASM_VECTOR_LEN;
1205
+ const ptr1 = passArray8ToWasm0(seal_signer_secret_key, wasm.__wbindgen_malloc);
1206
+ const len1 = WASM_VECTOR_LEN;
1207
+ const ret = wasm.sealTransaction(ptr0, len0, ptr1, len1);
1208
+ var ptr3 = ret[0];
1209
+ var len3 = ret[1];
1210
+ if (ret[3]) {
1211
+ ptr3 = 0; len3 = 0;
1212
+ throw takeFromExternrefTable0(ret[2]);
1213
+ }
1214
+ deferred4_0 = ptr3;
1215
+ deferred4_1 = len3;
1216
+ return getStringFromWasm0(ptr3, len3);
1217
+ } finally {
1218
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1219
+ }
1220
+ }
1221
+
1222
+ /**
1223
+ * Derive the recipient's stealth spending scalar `c + k`, where `c = H(network || k.G * r)`. The
1224
+ * receiver runs this with their account secret key (`private_key`) and the sender-provided public
1225
+ * nonce to obtain the one-time secret that controls the stealth output.
1226
+ *
1227
+ * `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
1228
+ * @param {number} network
1229
+ * @param {Uint8Array} private_key
1230
+ * @param {Uint8Array} public_nonce
1231
+ * @returns {Uint8Array}
1232
+ */
1233
+ export function stealthDhSecret(network, private_key, public_nonce) {
1234
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
1235
+ const len0 = WASM_VECTOR_LEN;
1236
+ const ptr1 = passArray8ToWasm0(public_nonce, wasm.__wbindgen_malloc);
1237
+ const len1 = WASM_VECTOR_LEN;
1238
+ const ret = wasm.stealthDhSecret(network, ptr0, len0, ptr1, len1);
1239
+ if (ret[3]) {
1240
+ throw takeFromExternrefTable0(ret[2]);
1241
+ }
1242
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1243
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1244
+ return v3;
1245
+ }
1246
+
1247
+ /**
1248
+ * Decrypt and verify the AEAD payload of an inbound stealth UTXO.
1249
+ *
1250
+ * `output_commitment` is the 32-byte Pedersen commitment; `encrypted_data` is the variable-length
1251
+ * XChaCha20Poly1305-encrypted blob; `encryption_key` is the 32-byte AEAD key derived via
1252
+ * `encryptedDataDhKdfAead`. Setting `skip_memo` to `true` returns no memo even if the payload carries
1253
+ * one (useful when only the value / mask are needed).
1254
+ *
1255
+ * Throws on AEAD failure or on a commitment mismatch — either indicates the payload was not produced
1256
+ * for this view key.
1257
+ * @param {Uint8Array} output_commitment
1258
+ * @param {Uint8Array} encrypted_data
1259
+ * @param {Uint8Array} encryption_key
1260
+ * @param {boolean} skip_memo
1261
+ * @returns {DecryptedOutputResult}
1262
+ */
1263
+ export function unblindOutput(output_commitment, encrypted_data, encryption_key, skip_memo) {
1264
+ const ptr0 = passArray8ToWasm0(output_commitment, wasm.__wbindgen_malloc);
1265
+ const len0 = WASM_VECTOR_LEN;
1266
+ const ptr1 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
1267
+ const len1 = WASM_VECTOR_LEN;
1268
+ const ptr2 = passArray8ToWasm0(encryption_key, wasm.__wbindgen_malloc);
1269
+ const len2 = WASM_VECTOR_LEN;
1270
+ const ret = wasm.unblindOutput(ptr0, len0, ptr1, len1, ptr2, len2, skip_memo);
1271
+ if (ret[2]) {
1272
+ throw takeFromExternrefTable0(ret[1]);
1273
+ }
1274
+ return DecryptedOutputResult.__wrap(ret[0]);
1275
+ }
1276
+
1277
+ /**
1278
+ * Pre-flight check that a balance proof signature is cryptographically valid for the given input /
1279
+ * output statements. Returns `false` on a malformed proof or invalid signature; the engine performs
1280
+ * the authoritative check at submission.
1281
+ * @param {Uint8Array} public_nonce
1282
+ * @param {Uint8Array} signature
1283
+ * @param {string} inputs_statement_json
1284
+ * @param {string} outputs_statement_json
1285
+ * @returns {boolean}
1286
+ */
1287
+ export function validateBalanceProofSignature(public_nonce, signature, inputs_statement_json, outputs_statement_json) {
1288
+ const ptr0 = passArray8ToWasm0(public_nonce, wasm.__wbindgen_malloc);
1289
+ const len0 = WASM_VECTOR_LEN;
1290
+ const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
1291
+ const len1 = WASM_VECTOR_LEN;
1292
+ const ptr2 = passStringToWasm0(inputs_statement_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1293
+ const len2 = WASM_VECTOR_LEN;
1294
+ const ptr3 = passStringToWasm0(outputs_statement_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1295
+ const len3 = WASM_VECTOR_LEN;
1296
+ const ret = wasm.validateBalanceProofSignature(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1297
+ if (ret[2]) {
1298
+ throw takeFromExternrefTable0(ret[1]);
1299
+ }
1300
+ return ret[0] !== 0;
1301
+ }
1302
+
1303
+ /**
1304
+ * Run the same validation the engine performs on a complete `StealthTransferStatement` envelope:
1305
+ * structural sanity, commitment well-formedness, range and balance-proof verification.
1306
+ *
1307
+ * `view_key` is the 32-byte resource view public key, required for resources with a viewable balance
1308
+ * and rejected otherwise. Pass `null` for resources without a view key.
1309
+ *
1310
+ * Throws on a validation failure; returns successfully on a valid statement.
1311
+ * @param {string} transfer_json
1312
+ * @param {Uint8Array | null} [view_key]
1313
+ */
1314
+ export function validateStealthTransfer(transfer_json, view_key) {
1315
+ const ptr0 = passStringToWasm0(transfer_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1316
+ const len0 = WASM_VECTOR_LEN;
1317
+ var ptr1 = isLikeNone(view_key) ? 0 : passArray8ToWasm0(view_key, wasm.__wbindgen_malloc);
1318
+ var len1 = WASM_VECTOR_LEN;
1319
+ const ret = wasm.validateStealthTransfer(ptr0, len0, ptr1, len1);
1320
+ if (ret[1]) {
1321
+ throw takeFromExternrefTable0(ret[0]);
1322
+ }
1323
+ }
1324
+ export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
1325
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1326
+ return ret;
1327
+ }
1328
+ export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
1329
+ throw new Error(getStringFromWasm0(arg0, arg1));
1330
+ }
1331
+ export function __wbg_getRandomValues_e9de607763a970bd() { return handleError(function (arg0, arg1) {
1332
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1333
+ }, arguments); }
1334
+ export function __wbindgen_init_externref_table() {
1335
+ const table = wasm.__wbindgen_externrefs;
1336
+ const offset = table.grow(4);
1337
+ table.set(0, undefined);
1338
+ table.set(offset + 0, undefined);
1339
+ table.set(offset + 1, null);
1340
+ table.set(offset + 2, true);
1341
+ table.set(offset + 3, false);
1342
+ }
1343
+ const DecryptedOutputResultFinalization = (typeof FinalizationRegistry === 'undefined')
1344
+ ? { register: () => {}, unregister: () => {} }
1345
+ : new FinalizationRegistry(ptr => wasm.__wbg_decryptedoutputresult_free(ptr >>> 0, 1));
1346
+ const KeypairResultFinalization = (typeof FinalizationRegistry === 'undefined')
1347
+ ? { register: () => {}, unregister: () => {} }
1348
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypairresult_free(ptr >>> 0, 1));
1349
+ const OotlePublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1350
+ ? { register: () => {}, unregister: () => {} }
1351
+ : new FinalizationRegistry(ptr => wasm.__wbg_ootlepublickey_free(ptr >>> 0, 1));
1352
+ const OotleSecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1353
+ ? { register: () => {}, unregister: () => {} }
1354
+ : new FinalizationRegistry(ptr => wasm.__wbg_ootlesecretkey_free(ptr >>> 0, 1));
1355
+ const ParsedOotleAddressFinalization = (typeof FinalizationRegistry === 'undefined')
1356
+ ? { register: () => {}, unregister: () => {} }
1357
+ : new FinalizationRegistry(ptr => wasm.__wbg_parsedootleaddress_free(ptr >>> 0, 1));
1358
+ const SchnorrSignatureResultFinalization = (typeof FinalizationRegistry === 'undefined')
1359
+ ? { register: () => {}, unregister: () => {} }
1360
+ : new FinalizationRegistry(ptr => wasm.__wbg_schnorrsignatureresult_free(ptr >>> 0, 1));
1361
+ const StealthOutputsResultFinalization = (typeof FinalizationRegistry === 'undefined')
1362
+ ? { register: () => {}, unregister: () => {} }
1363
+ : new FinalizationRegistry(ptr => wasm.__wbg_stealthoutputsresult_free(ptr >>> 0, 1));
1364
+
1365
+ function addToExternrefTable0(obj) {
1366
+ const idx = wasm.__externref_table_alloc();
1367
+ wasm.__wbindgen_externrefs.set(idx, obj);
1368
+ return idx;
1369
+ }
1370
+
1371
+ function getArrayU8FromWasm0(ptr, len) {
1372
+ ptr = ptr >>> 0;
1373
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1374
+ }
1375
+
1376
+ function getStringFromWasm0(ptr, len) {
1377
+ ptr = ptr >>> 0;
1378
+ return decodeText(ptr, len);
1379
+ }
1380
+
1381
+ let cachedUint8ArrayMemory0 = null;
1382
+ function getUint8ArrayMemory0() {
1383
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1384
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1385
+ }
1386
+ return cachedUint8ArrayMemory0;
1387
+ }
1388
+
1389
+ function handleError(f, args) {
1390
+ try {
1391
+ return f.apply(this, args);
1392
+ } catch (e) {
1393
+ const idx = addToExternrefTable0(e);
1394
+ wasm.__wbindgen_exn_store(idx);
1395
+ }
1396
+ }
1397
+
1398
+ function isLikeNone(x) {
1399
+ return x === undefined || x === null;
1400
+ }
1401
+
1402
+ function passArray8ToWasm0(arg, malloc) {
1403
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1404
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1405
+ WASM_VECTOR_LEN = arg.length;
1406
+ return ptr;
1407
+ }
1408
+
1409
+ function passStringToWasm0(arg, malloc, realloc) {
1410
+ if (realloc === undefined) {
1411
+ const buf = cachedTextEncoder.encode(arg);
1412
+ const ptr = malloc(buf.length, 1) >>> 0;
1413
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1414
+ WASM_VECTOR_LEN = buf.length;
1415
+ return ptr;
1416
+ }
1417
+
1418
+ let len = arg.length;
1419
+ let ptr = malloc(len, 1) >>> 0;
1420
+
1421
+ const mem = getUint8ArrayMemory0();
1422
+
1423
+ let offset = 0;
1424
+
1425
+ for (; offset < len; offset++) {
1426
+ const code = arg.charCodeAt(offset);
1427
+ if (code > 0x7F) break;
1428
+ mem[ptr + offset] = code;
1429
+ }
1430
+ if (offset !== len) {
1431
+ if (offset !== 0) {
1432
+ arg = arg.slice(offset);
1433
+ }
1434
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1435
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1436
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1437
+
1438
+ offset += ret.written;
1439
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1440
+ }
1441
+
1442
+ WASM_VECTOR_LEN = offset;
1443
+ return ptr;
1444
+ }
1445
+
1446
+ function takeFromExternrefTable0(idx) {
1447
+ const value = wasm.__wbindgen_externrefs.get(idx);
1448
+ wasm.__externref_table_dealloc(idx);
1449
+ return value;
1450
+ }
1451
+
1452
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1453
+ cachedTextDecoder.decode();
1454
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1455
+ let numBytesDecoded = 0;
1456
+ function decodeText(ptr, len) {
1457
+ numBytesDecoded += len;
1458
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1459
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1460
+ cachedTextDecoder.decode();
1461
+ numBytesDecoded = len;
1462
+ }
1463
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1464
+ }
1465
+
1466
+ const cachedTextEncoder = new TextEncoder();
1467
+
1468
+ if (!('encodeInto' in cachedTextEncoder)) {
1469
+ cachedTextEncoder.encodeInto = function (arg, view) {
1470
+ const buf = cachedTextEncoder.encode(arg);
1471
+ view.set(buf);
1472
+ return {
1473
+ read: arg.length,
1474
+ written: buf.length
1475
+ };
1476
+ };
1477
+ }
1478
+
1479
+ let WASM_VECTOR_LEN = 0;
1480
+
1481
+
1482
+ let wasm;
1483
+ export function __wbg_set_wasm(val) {
1484
+ wasm = val;
1485
+ }