@puzzlehq/aleo-wasm-web 0.6.12 → 0.6.14

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.
package/dist/index.js ADDED
@@ -0,0 +1,4844 @@
1
+ function spawnWorker(url, module, memory, address) {
2
+ return new Promise((resolve) => {
3
+ const worker = new Worker(url, {
4
+ type: "module",
5
+ });
6
+
7
+ worker.addEventListener("message", (event) => {
8
+ // This is needed in Node to wait one extra tick, so that way
9
+ // the Worker can fully initialize before we return.
10
+ setTimeout(() => {
11
+ resolve(worker);
12
+
13
+ // When running in Node, this allows the process to exit
14
+ // even though the Worker is still running.
15
+ if (worker.unref) {
16
+ worker.unref();
17
+ }
18
+ }, 0);
19
+ }, {
20
+ capture: true,
21
+ once: true,
22
+ });
23
+
24
+ worker.postMessage({
25
+ module,
26
+ memory,
27
+ address,
28
+ });
29
+ });
30
+ }
31
+
32
+ let wasm;
33
+
34
+ const heap = new Array(128).fill(undefined);
35
+
36
+ heap.push(undefined, null, true, false);
37
+
38
+ function getObject(idx) { return heap[idx]; }
39
+
40
+ let heap_next = heap.length;
41
+
42
+ function dropObject(idx) {
43
+ if (idx < 132) return;
44
+ heap[idx] = heap_next;
45
+ heap_next = idx;
46
+ }
47
+
48
+ function takeObject(idx) {
49
+ const ret = getObject(idx);
50
+ dropObject(idx);
51
+ return ret;
52
+ }
53
+
54
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
55
+
56
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
57
+ let cachedUint8Memory0 = null;
58
+
59
+ function getUint8Memory0() {
60
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
61
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
62
+ }
63
+ return cachedUint8Memory0;
64
+ }
65
+
66
+ function getStringFromWasm0(ptr, len) {
67
+ ptr = ptr >>> 0;
68
+ return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
69
+ }
70
+
71
+ function addHeapObject(obj) {
72
+ if (heap_next === heap.length) heap.push(heap.length + 1);
73
+ const idx = heap_next;
74
+ heap_next = heap[idx];
75
+
76
+ heap[idx] = obj;
77
+ return idx;
78
+ }
79
+
80
+ let WASM_VECTOR_LEN = 0;
81
+
82
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
83
+
84
+ const encodeString = function (arg, view) {
85
+ const buf = cachedTextEncoder.encode(arg);
86
+ view.set(buf);
87
+ return {
88
+ read: arg.length,
89
+ written: buf.length
90
+ };
91
+ };
92
+
93
+ function passStringToWasm0(arg, malloc, realloc) {
94
+
95
+ if (realloc === undefined) {
96
+ const buf = cachedTextEncoder.encode(arg);
97
+ const ptr = malloc(buf.length, 1) >>> 0;
98
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
99
+ WASM_VECTOR_LEN = buf.length;
100
+ return ptr;
101
+ }
102
+
103
+ let len = arg.length;
104
+ let ptr = malloc(len, 1) >>> 0;
105
+
106
+ const mem = getUint8Memory0();
107
+
108
+ let offset = 0;
109
+
110
+ for (; offset < len; offset++) {
111
+ const code = arg.charCodeAt(offset);
112
+ if (code > 0x7F) break;
113
+ mem[ptr + offset] = code;
114
+ }
115
+
116
+ if (offset !== len) {
117
+ if (offset !== 0) {
118
+ arg = arg.slice(offset);
119
+ }
120
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
121
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
122
+ const ret = encodeString(arg, view);
123
+
124
+ offset += ret.written;
125
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
126
+ }
127
+
128
+ WASM_VECTOR_LEN = offset;
129
+ return ptr;
130
+ }
131
+
132
+ function isLikeNone(x) {
133
+ return x === undefined || x === null;
134
+ }
135
+
136
+ let cachedInt32Memory0 = null;
137
+
138
+ function getInt32Memory0() {
139
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
140
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
141
+ }
142
+ return cachedInt32Memory0;
143
+ }
144
+
145
+ function debugString(val) {
146
+ // primitive types
147
+ const type = typeof val;
148
+ if (type == 'number' || type == 'boolean' || val == null) {
149
+ return `${val}`;
150
+ }
151
+ if (type == 'string') {
152
+ return `"${val}"`;
153
+ }
154
+ if (type == 'symbol') {
155
+ const description = val.description;
156
+ if (description == null) {
157
+ return 'Symbol';
158
+ } else {
159
+ return `Symbol(${description})`;
160
+ }
161
+ }
162
+ if (type == 'function') {
163
+ const name = val.name;
164
+ if (typeof name == 'string' && name.length > 0) {
165
+ return `Function(${name})`;
166
+ } else {
167
+ return 'Function';
168
+ }
169
+ }
170
+ // objects
171
+ if (Array.isArray(val)) {
172
+ const length = val.length;
173
+ let debug = '[';
174
+ if (length > 0) {
175
+ debug += debugString(val[0]);
176
+ }
177
+ for(let i = 1; i < length; i++) {
178
+ debug += ', ' + debugString(val[i]);
179
+ }
180
+ debug += ']';
181
+ return debug;
182
+ }
183
+ // Test for built-in
184
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
185
+ let className;
186
+ if (builtInMatches.length > 1) {
187
+ className = builtInMatches[1];
188
+ } else {
189
+ // Failed to match the standard '[object ClassName]'
190
+ return toString.call(val);
191
+ }
192
+ if (className == 'Object') {
193
+ // we're a user defined class or Object
194
+ // JSON.stringify avoids problems with cycles, and is generally much
195
+ // easier than looping through ownProperties of `val`.
196
+ try {
197
+ return 'Object(' + JSON.stringify(val) + ')';
198
+ } catch (_) {
199
+ return 'Object';
200
+ }
201
+ }
202
+ // errors
203
+ if (val instanceof Error) {
204
+ return `${val.name}: ${val.message}\n${val.stack}`;
205
+ }
206
+ // TODO we could test for more things here, like `Set`s and `Map`s.
207
+ return className;
208
+ }
209
+
210
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
211
+ ? { register: () => {}, unregister: () => {} }
212
+ : new FinalizationRegistry(state => {
213
+ wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b);
214
+ });
215
+
216
+ function makeMutClosure(arg0, arg1, dtor, f) {
217
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
218
+ const real = (...args) => {
219
+ // First up with a closure we increment the internal reference
220
+ // count. This ensures that the Rust closure environment won't
221
+ // be deallocated while we're invoking it.
222
+ state.cnt++;
223
+ const a = state.a;
224
+ state.a = 0;
225
+ try {
226
+ return f(a, state.b, ...args);
227
+ } finally {
228
+ if (--state.cnt === 0) {
229
+ wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
230
+ CLOSURE_DTORS.unregister(state);
231
+ } else {
232
+ state.a = a;
233
+ }
234
+ }
235
+ };
236
+ real.original = state;
237
+ CLOSURE_DTORS.register(real, state, state);
238
+ return real;
239
+ }
240
+ function __wbg_adapter_34(arg0, arg1, arg2) {
241
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0d5bc0f77f63013f(arg0, arg1, addHeapObject(arg2));
242
+ }
243
+
244
+ function _assertClass(instance, klass) {
245
+ if (!(instance instanceof klass)) {
246
+ throw new Error(`expected instance of ${klass.name}`);
247
+ }
248
+ return instance.ptr;
249
+ }
250
+
251
+ function passArray8ToWasm0(arg, malloc) {
252
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
253
+ getUint8Memory0().set(arg, ptr / 1);
254
+ WASM_VECTOR_LEN = arg.length;
255
+ return ptr;
256
+ }
257
+ /**
258
+ * Verify an execution with a single function and a single transition. Executions with multiple
259
+ * transitions or functions will fail to verify. Also, this does not verify that the state root of
260
+ * the execution is included in the Aleo Network ledger.
261
+ *
262
+ * @param {Execution} execution The function execution to verify
263
+ * @param {VerifyingKey} verifying_key The verifying key for the function
264
+ * @param {Program} program The program that the function execution belongs to
265
+ * @param {String} function_id The name of the function that was executed
266
+ * @returns {boolean} True if the execution is valid, false otherwise
267
+ * @param {Execution} execution
268
+ * @param {VerifyingKey} verifying_key
269
+ * @param {Program} program
270
+ * @param {string} function_id
271
+ * @returns {boolean}
272
+ */
273
+ function verifyFunctionExecution$1(execution, verifying_key, program, function_id) {
274
+ try {
275
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
+ _assertClass(execution, Execution$1);
277
+ _assertClass(verifying_key, VerifyingKey$1);
278
+ _assertClass(program, Program$1);
279
+ const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
+ const len0 = WASM_VECTOR_LEN;
281
+ wasm.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0);
282
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
283
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
284
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
285
+ if (r2) {
286
+ throw takeObject(r1);
287
+ }
288
+ return r0 !== 0;
289
+ } finally {
290
+ wasm.__wbindgen_add_to_stack_pointer(16);
291
+ }
292
+ }
293
+
294
+ let cachedBigInt64Memory0 = null;
295
+
296
+ function getBigInt64Memory0() {
297
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.buffer !== wasm.memory.buffer) {
298
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
299
+ }
300
+ return cachedBigInt64Memory0;
301
+ }
302
+
303
+ function getArrayU8FromWasm0(ptr, len) {
304
+ ptr = ptr >>> 0;
305
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
306
+ }
307
+ /**
308
+ * @param {number} receiver
309
+ */
310
+ function runRayonThread(receiver) {
311
+ wasm.runRayonThread(receiver);
312
+ }
313
+
314
+ /**
315
+ */
316
+ function init_panic_hook$1() {
317
+ wasm.init_panic_hook();
318
+ }
319
+
320
+ /**
321
+ * @param {URL} url
322
+ * @param {number} num_threads
323
+ * @returns {Promise<void>}
324
+ */
325
+ function initThreadPool$1(url, num_threads) {
326
+ const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
327
+ return takeObject(ret);
328
+ }
329
+
330
+ function handleError(f, args) {
331
+ try {
332
+ return f.apply(this, args);
333
+ } catch (e) {
334
+ wasm.__wbindgen_exn_store(addHeapObject(e));
335
+ }
336
+ }
337
+ function __wbg_adapter_290(arg0, arg1, arg2, arg3) {
338
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h630419b3c55d46e4(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
339
+ }
340
+
341
+ const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
342
+ ? { register: () => {}, unregister: () => {} }
343
+ : new FinalizationRegistry(ptr => wasm.__wbg_address_free(ptr >>> 0));
344
+ /**
345
+ * Public address of an Aleo account
346
+ */
347
+ let Address$1 = class Address {
348
+
349
+ static __wrap(ptr) {
350
+ ptr = ptr >>> 0;
351
+ const obj = Object.create(Address.prototype);
352
+ obj.__wbg_ptr = ptr;
353
+ AddressFinalization.register(obj, obj.__wbg_ptr, obj);
354
+ return obj;
355
+ }
356
+
357
+ __destroy_into_raw() {
358
+ const ptr = this.__wbg_ptr;
359
+ this.__wbg_ptr = 0;
360
+ AddressFinalization.unregister(this);
361
+ return ptr;
362
+ }
363
+
364
+ free() {
365
+ const ptr = this.__destroy_into_raw();
366
+ wasm.__wbg_address_free(ptr);
367
+ }
368
+ /**
369
+ * Derive an Aleo address from a private key
370
+ *
371
+ * @param {PrivateKey} private_key The private key to derive the address from
372
+ * @returns {Address} Address corresponding to the private key
373
+ * @param {PrivateKey} private_key
374
+ * @returns {Address}
375
+ */
376
+ static from_private_key(private_key) {
377
+ _assertClass(private_key, PrivateKey$1);
378
+ const ret = wasm.address_from_private_key(private_key.__wbg_ptr);
379
+ return Address.__wrap(ret);
380
+ }
381
+ /**
382
+ * Derive an Aleo address from a view key
383
+ *
384
+ * @param {ViewKey} view_key The view key to derive the address from
385
+ * @returns {Address} Address corresponding to the view key
386
+ * @param {ViewKey} view_key
387
+ * @returns {Address}
388
+ */
389
+ static from_view_key(view_key) {
390
+ _assertClass(view_key, ViewKey$1);
391
+ const ret = wasm.address_from_view_key(view_key.__wbg_ptr);
392
+ return Address.__wrap(ret);
393
+ }
394
+ /**
395
+ * Create an aleo address object from a string representation of an address
396
+ *
397
+ * @param {string} address String representation of an addressm
398
+ * @returns {Address} Address
399
+ * @param {string} address
400
+ * @returns {Address}
401
+ */
402
+ static from_string(address) {
403
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
404
+ const len0 = WASM_VECTOR_LEN;
405
+ const ret = wasm.address_from_string(ptr0, len0);
406
+ return Address.__wrap(ret);
407
+ }
408
+ /**
409
+ * Get a string representation of an Aleo address object
410
+ *
411
+ * @param {Address} Address
412
+ * @returns {string} String representation of the address
413
+ * @returns {string}
414
+ */
415
+ to_string() {
416
+ let deferred1_0;
417
+ let deferred1_1;
418
+ try {
419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
+ wasm.address_to_string(retptr, this.__wbg_ptr);
421
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
422
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
423
+ deferred1_0 = r0;
424
+ deferred1_1 = r1;
425
+ return getStringFromWasm0(r0, r1);
426
+ } finally {
427
+ wasm.__wbindgen_add_to_stack_pointer(16);
428
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
429
+ }
430
+ }
431
+ /**
432
+ * Verify a signature for a message signed by the address
433
+ *
434
+ * @param {Uint8Array} Byte array representing a message signed by the address
435
+ * @returns {boolean} Boolean representing whether or not the signature is valid
436
+ * @param {Uint8Array} message
437
+ * @param {Signature} signature
438
+ * @returns {boolean}
439
+ */
440
+ verify(message, signature) {
441
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
442
+ const len0 = WASM_VECTOR_LEN;
443
+ _assertClass(signature, Signature$1);
444
+ const ret = wasm.address_verify(this.__wbg_ptr, ptr0, len0, signature.__wbg_ptr);
445
+ return ret !== 0;
446
+ }
447
+ };
448
+
449
+ const AuthorizationResponseFinalization = (typeof FinalizationRegistry === 'undefined')
450
+ ? { register: () => {}, unregister: () => {} }
451
+ : new FinalizationRegistry(ptr => wasm.__wbg_authorizationresponse_free(ptr >>> 0));
452
+ /**
453
+ */
454
+ class AuthorizationResponse {
455
+
456
+ static __wrap(ptr) {
457
+ ptr = ptr >>> 0;
458
+ const obj = Object.create(AuthorizationResponse.prototype);
459
+ obj.__wbg_ptr = ptr;
460
+ AuthorizationResponseFinalization.register(obj, obj.__wbg_ptr, obj);
461
+ return obj;
462
+ }
463
+
464
+ __destroy_into_raw() {
465
+ const ptr = this.__wbg_ptr;
466
+ this.__wbg_ptr = 0;
467
+ AuthorizationResponseFinalization.unregister(this);
468
+ return ptr;
469
+ }
470
+
471
+ free() {
472
+ const ptr = this.__destroy_into_raw();
473
+ wasm.__wbg_authorizationresponse_free(ptr);
474
+ }
475
+ /**
476
+ * @returns {string}
477
+ */
478
+ get authorization() {
479
+ let deferred1_0;
480
+ let deferred1_1;
481
+ try {
482
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
+ wasm.__wbg_get_metadata_locator(retptr, this.__wbg_ptr);
484
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
485
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
486
+ deferred1_0 = r0;
487
+ deferred1_1 = r1;
488
+ return getStringFromWasm0(r0, r1);
489
+ } finally {
490
+ wasm.__wbindgen_add_to_stack_pointer(16);
491
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
492
+ }
493
+ }
494
+ /**
495
+ * @returns {string}
496
+ */
497
+ get fee_authorization() {
498
+ let deferred1_0;
499
+ let deferred1_1;
500
+ try {
501
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
502
+ wasm.__wbg_get_metadata_prover(retptr, this.__wbg_ptr);
503
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
504
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
505
+ deferred1_0 = r0;
506
+ deferred1_1 = r1;
507
+ return getStringFromWasm0(r0, r1);
508
+ } finally {
509
+ wasm.__wbindgen_add_to_stack_pointer(16);
510
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
511
+ }
512
+ }
513
+ }
514
+
515
+ const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
516
+ ? { register: () => {}, unregister: () => {} }
517
+ : new FinalizationRegistry(ptr => wasm.__wbg_execution_free(ptr >>> 0));
518
+ /**
519
+ * Execution of an Aleo program.
520
+ */
521
+ let Execution$1 = class Execution {
522
+
523
+ static __wrap(ptr) {
524
+ ptr = ptr >>> 0;
525
+ const obj = Object.create(Execution.prototype);
526
+ obj.__wbg_ptr = ptr;
527
+ ExecutionFinalization.register(obj, obj.__wbg_ptr, obj);
528
+ return obj;
529
+ }
530
+
531
+ __destroy_into_raw() {
532
+ const ptr = this.__wbg_ptr;
533
+ this.__wbg_ptr = 0;
534
+ ExecutionFinalization.unregister(this);
535
+ return ptr;
536
+ }
537
+
538
+ free() {
539
+ const ptr = this.__destroy_into_raw();
540
+ wasm.__wbg_execution_free(ptr);
541
+ }
542
+ /**
543
+ * Returns the string representation of the execution.
544
+ * @returns {string}
545
+ */
546
+ toString() {
547
+ let deferred1_0;
548
+ let deferred1_1;
549
+ try {
550
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
551
+ wasm.execution_toString(retptr, this.__wbg_ptr);
552
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
553
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
554
+ deferred1_0 = r0;
555
+ deferred1_1 = r1;
556
+ return getStringFromWasm0(r0, r1);
557
+ } finally {
558
+ wasm.__wbindgen_add_to_stack_pointer(16);
559
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
560
+ }
561
+ }
562
+ /**
563
+ * Creates an execution object from a string representation of an execution.
564
+ * @param {string} execution
565
+ * @returns {Execution}
566
+ */
567
+ static fromString(execution) {
568
+ try {
569
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
570
+ const ptr0 = passStringToWasm0(execution, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
+ const len0 = WASM_VECTOR_LEN;
572
+ wasm.execution_fromString(retptr, ptr0, len0);
573
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
574
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
575
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
576
+ if (r2) {
577
+ throw takeObject(r1);
578
+ }
579
+ return Execution.__wrap(r0);
580
+ } finally {
581
+ wasm.__wbindgen_add_to_stack_pointer(16);
582
+ }
583
+ }
584
+ };
585
+
586
+ const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
587
+ ? { register: () => {}, unregister: () => {} }
588
+ : new FinalizationRegistry(ptr => wasm.__wbg_executionresponse_free(ptr >>> 0));
589
+ /**
590
+ * Webassembly Representation of an Aleo function execution response
591
+ *
592
+ * This object is returned by the execution of an Aleo function off-chain. It provides methods for
593
+ * retrieving the outputs of the function execution.
594
+ */
595
+ let ExecutionResponse$1 = class ExecutionResponse {
596
+
597
+ static __wrap(ptr) {
598
+ ptr = ptr >>> 0;
599
+ const obj = Object.create(ExecutionResponse.prototype);
600
+ obj.__wbg_ptr = ptr;
601
+ ExecutionResponseFinalization.register(obj, obj.__wbg_ptr, obj);
602
+ return obj;
603
+ }
604
+
605
+ __destroy_into_raw() {
606
+ const ptr = this.__wbg_ptr;
607
+ this.__wbg_ptr = 0;
608
+ ExecutionResponseFinalization.unregister(this);
609
+ return ptr;
610
+ }
611
+
612
+ free() {
613
+ const ptr = this.__destroy_into_raw();
614
+ wasm.__wbg_executionresponse_free(ptr);
615
+ }
616
+ /**
617
+ * Get the outputs of the executed function
618
+ *
619
+ * @returns {Array} Array of strings representing the outputs of the function
620
+ * @returns {Array<any>}
621
+ */
622
+ getOutputs() {
623
+ const ret = wasm.executionresponse_getOutputs(this.__wbg_ptr);
624
+ return takeObject(ret);
625
+ }
626
+ /**
627
+ * Returns the execution object if present, null if otherwise.
628
+ *
629
+ * @returns {Execution | undefined} The execution object if present, null if otherwise
630
+ * @returns {Execution | undefined}
631
+ */
632
+ getExecution() {
633
+ const ret = wasm.executionresponse_getExecution(this.__wbg_ptr);
634
+ return ret === 0 ? undefined : Execution$1.__wrap(ret);
635
+ }
636
+ /**
637
+ * Returns the program keys if present
638
+ * @returns {KeyPair}
639
+ */
640
+ getKeys() {
641
+ try {
642
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
643
+ wasm.executionresponse_getKeys(retptr, this.__wbg_ptr);
644
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
645
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
646
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
647
+ if (r2) {
648
+ throw takeObject(r1);
649
+ }
650
+ return KeyPair.__wrap(r0);
651
+ } finally {
652
+ wasm.__wbindgen_add_to_stack_pointer(16);
653
+ }
654
+ }
655
+ /**
656
+ * Returns the proving_key if the proving key was cached in the Execution response.
657
+ * Note the proving key is removed from the response object after the first call to this
658
+ * function. Subsequent calls will return null.
659
+ *
660
+ * @returns {ProvingKey | undefined} The proving key
661
+ * @returns {ProvingKey | undefined}
662
+ */
663
+ getProvingKey() {
664
+ const ret = wasm.executionresponse_getProvingKey(this.__wbg_ptr);
665
+ return ret === 0 ? undefined : ProvingKey$1.__wrap(ret);
666
+ }
667
+ /**
668
+ * Returns the verifying_key associated with the program
669
+ *
670
+ * @returns {VerifyingKey} The verifying key
671
+ * @returns {VerifyingKey}
672
+ */
673
+ getVerifyingKey() {
674
+ const ret = wasm.executionresponse_getVerifyingKey(this.__wbg_ptr);
675
+ return VerifyingKey$1.__wrap(ret);
676
+ }
677
+ /**
678
+ * Returns the function identifier
679
+ * @returns {string}
680
+ */
681
+ getFunctionId() {
682
+ let deferred1_0;
683
+ let deferred1_1;
684
+ try {
685
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
686
+ wasm.executionresponse_getFunctionId(retptr, this.__wbg_ptr);
687
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
688
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
689
+ deferred1_0 = r0;
690
+ deferred1_1 = r1;
691
+ return getStringFromWasm0(r0, r1);
692
+ } finally {
693
+ wasm.__wbindgen_add_to_stack_pointer(16);
694
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
695
+ }
696
+ }
697
+ /**
698
+ * Returns the program
699
+ * @returns {Program}
700
+ */
701
+ getProgram() {
702
+ const ret = wasm.executionresponse_getProgram(this.__wbg_ptr);
703
+ return Program$1.__wrap(ret);
704
+ }
705
+ };
706
+
707
+ const FieldFinalization = (typeof FinalizationRegistry === 'undefined')
708
+ ? { register: () => {}, unregister: () => {} }
709
+ : new FinalizationRegistry(ptr => wasm.__wbg_field_free(ptr >>> 0));
710
+ /**
711
+ */
712
+ let Field$1 = class Field {
713
+
714
+ static __wrap(ptr) {
715
+ ptr = ptr >>> 0;
716
+ const obj = Object.create(Field.prototype);
717
+ obj.__wbg_ptr = ptr;
718
+ FieldFinalization.register(obj, obj.__wbg_ptr, obj);
719
+ return obj;
720
+ }
721
+
722
+ __destroy_into_raw() {
723
+ const ptr = this.__wbg_ptr;
724
+ this.__wbg_ptr = 0;
725
+ FieldFinalization.unregister(this);
726
+ return ptr;
727
+ }
728
+
729
+ free() {
730
+ const ptr = this.__destroy_into_raw();
731
+ wasm.__wbg_field_free(ptr);
732
+ }
733
+ /**
734
+ * @returns {string}
735
+ */
736
+ toString() {
737
+ let deferred1_0;
738
+ let deferred1_1;
739
+ try {
740
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
741
+ wasm.field_toString(retptr, this.__wbg_ptr);
742
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
743
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
744
+ deferred1_0 = r0;
745
+ deferred1_1 = r1;
746
+ return getStringFromWasm0(r0, r1);
747
+ } finally {
748
+ wasm.__wbindgen_add_to_stack_pointer(16);
749
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
750
+ }
751
+ }
752
+ /**
753
+ * @param {string} field
754
+ * @returns {Field}
755
+ */
756
+ static fromString(field) {
757
+ try {
758
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
759
+ const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
760
+ const len0 = WASM_VECTOR_LEN;
761
+ wasm.field_fromString(retptr, ptr0, len0);
762
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
763
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
764
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
765
+ if (r2) {
766
+ throw takeObject(r1);
767
+ }
768
+ return Field.__wrap(r0);
769
+ } finally {
770
+ wasm.__wbindgen_add_to_stack_pointer(16);
771
+ }
772
+ }
773
+ };
774
+
775
+ const JsFieldFinalization = (typeof FinalizationRegistry === 'undefined')
776
+ ? { register: () => {}, unregister: () => {} }
777
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsfield_free(ptr >>> 0));
778
+ /**
779
+ */
780
+ let JsField$1 = class JsField {
781
+
782
+ __destroy_into_raw() {
783
+ const ptr = this.__wbg_ptr;
784
+ this.__wbg_ptr = 0;
785
+ JsFieldFinalization.unregister(this);
786
+ return ptr;
787
+ }
788
+
789
+ free() {
790
+ const ptr = this.__destroy_into_raw();
791
+ wasm.__wbg_jsfield_free(ptr);
792
+ }
793
+ /**
794
+ * @param {PrivateKey} private_key
795
+ * @param {Uint8Array} message
796
+ * @param {Uint8Array} seed
797
+ * @returns {string}
798
+ */
799
+ static generate_message_leo(private_key, message, seed) {
800
+ let deferred3_0;
801
+ let deferred3_1;
802
+ try {
803
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
804
+ _assertClass(private_key, PrivateKey$1);
805
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
806
+ const len0 = WASM_VECTOR_LEN;
807
+ const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
808
+ const len1 = WASM_VECTOR_LEN;
809
+ wasm.jsfield_generate_message_leo(retptr, private_key.__wbg_ptr, ptr0, len0, ptr1, len1);
810
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
811
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
812
+ deferred3_0 = r0;
813
+ deferred3_1 = r1;
814
+ return getStringFromWasm0(r0, r1);
815
+ } finally {
816
+ wasm.__wbindgen_add_to_stack_pointer(16);
817
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
818
+ }
819
+ }
820
+ /**
821
+ * @param {PrivateKey} private_key
822
+ * @param {Uint8Array} message
823
+ * @param {Uint8Array} seed
824
+ * @returns {string}
825
+ */
826
+ static generate_message_clients(private_key, message, seed) {
827
+ let deferred3_0;
828
+ let deferred3_1;
829
+ try {
830
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
831
+ _assertClass(private_key, PrivateKey$1);
832
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
833
+ const len0 = WASM_VECTOR_LEN;
834
+ const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
835
+ const len1 = WASM_VECTOR_LEN;
836
+ wasm.jsfield_generate_message_clients(retptr, private_key.__wbg_ptr, ptr0, len0, ptr1, len1);
837
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
838
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
839
+ deferred3_0 = r0;
840
+ deferred3_1 = r1;
841
+ return getStringFromWasm0(r0, r1);
842
+ } finally {
843
+ wasm.__wbindgen_add_to_stack_pointer(16);
844
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
845
+ }
846
+ }
847
+ };
848
+
849
+ const KeyPairFinalization = (typeof FinalizationRegistry === 'undefined')
850
+ ? { register: () => {}, unregister: () => {} }
851
+ : new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0));
852
+ /**
853
+ * Key pair object containing both the function proving and verifying keys
854
+ */
855
+ class KeyPair {
856
+
857
+ static __wrap(ptr) {
858
+ ptr = ptr >>> 0;
859
+ const obj = Object.create(KeyPair.prototype);
860
+ obj.__wbg_ptr = ptr;
861
+ KeyPairFinalization.register(obj, obj.__wbg_ptr, obj);
862
+ return obj;
863
+ }
864
+
865
+ __destroy_into_raw() {
866
+ const ptr = this.__wbg_ptr;
867
+ this.__wbg_ptr = 0;
868
+ KeyPairFinalization.unregister(this);
869
+ return ptr;
870
+ }
871
+
872
+ free() {
873
+ const ptr = this.__destroy_into_raw();
874
+ wasm.__wbg_keypair_free(ptr);
875
+ }
876
+ /**
877
+ * Create new key pair from proving and verifying keys
878
+ *
879
+ * @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
880
+ * @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
881
+ * @returns {KeyPair} Key pair object containing both the function proving and verifying keys
882
+ * @param {ProvingKey} proving_key
883
+ * @param {VerifyingKey} verifying_key
884
+ */
885
+ constructor(proving_key, verifying_key) {
886
+ _assertClass(proving_key, ProvingKey$1);
887
+ var ptr0 = proving_key.__destroy_into_raw();
888
+ _assertClass(verifying_key, VerifyingKey$1);
889
+ var ptr1 = verifying_key.__destroy_into_raw();
890
+ const ret = wasm.keypair_new(ptr0, ptr1);
891
+ this.__wbg_ptr = ret >>> 0;
892
+ return this;
893
+ }
894
+ /**
895
+ * Get the proving key. This method will remove the proving key from the key pair
896
+ *
897
+ * @returns {ProvingKey | Error}
898
+ * @returns {ProvingKey}
899
+ */
900
+ provingKey() {
901
+ try {
902
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
903
+ wasm.keypair_provingKey(retptr, this.__wbg_ptr);
904
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
905
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
906
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
907
+ if (r2) {
908
+ throw takeObject(r1);
909
+ }
910
+ return ProvingKey$1.__wrap(r0);
911
+ } finally {
912
+ wasm.__wbindgen_add_to_stack_pointer(16);
913
+ }
914
+ }
915
+ /**
916
+ * Get the verifying key. This method will remove the verifying key from the key pair
917
+ *
918
+ * @returns {VerifyingKey | Error}
919
+ * @returns {VerifyingKey}
920
+ */
921
+ verifyingKey() {
922
+ try {
923
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
924
+ wasm.keypair_verifyingKey(retptr, this.__wbg_ptr);
925
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
926
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
927
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
928
+ if (r2) {
929
+ throw takeObject(r1);
930
+ }
931
+ return VerifyingKey$1.__wrap(r0);
932
+ } finally {
933
+ wasm.__wbindgen_add_to_stack_pointer(16);
934
+ }
935
+ }
936
+ }
937
+
938
+ const MetadataFinalization = (typeof FinalizationRegistry === 'undefined')
939
+ ? { register: () => {}, unregister: () => {} }
940
+ : new FinalizationRegistry(ptr => wasm.__wbg_metadata_free(ptr >>> 0));
941
+ /**
942
+ */
943
+ let Metadata$1 = class Metadata {
944
+
945
+ static __wrap(ptr) {
946
+ ptr = ptr >>> 0;
947
+ const obj = Object.create(Metadata.prototype);
948
+ obj.__wbg_ptr = ptr;
949
+ MetadataFinalization.register(obj, obj.__wbg_ptr, obj);
950
+ return obj;
951
+ }
952
+
953
+ __destroy_into_raw() {
954
+ const ptr = this.__wbg_ptr;
955
+ this.__wbg_ptr = 0;
956
+ MetadataFinalization.unregister(this);
957
+ return ptr;
958
+ }
959
+
960
+ free() {
961
+ const ptr = this.__destroy_into_raw();
962
+ wasm.__wbg_metadata_free(ptr);
963
+ }
964
+ /**
965
+ * @returns {string}
966
+ */
967
+ get locator() {
968
+ let deferred1_0;
969
+ let deferred1_1;
970
+ try {
971
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
972
+ wasm.__wbg_get_metadata_locator(retptr, this.__wbg_ptr);
973
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
974
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
975
+ deferred1_0 = r0;
976
+ deferred1_1 = r1;
977
+ return getStringFromWasm0(r0, r1);
978
+ } finally {
979
+ wasm.__wbindgen_add_to_stack_pointer(16);
980
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
981
+ }
982
+ }
983
+ /**
984
+ * @param {string} arg0
985
+ */
986
+ set locator(arg0) {
987
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
988
+ const len0 = WASM_VECTOR_LEN;
989
+ wasm.__wbg_set_metadata_locator(this.__wbg_ptr, ptr0, len0);
990
+ }
991
+ /**
992
+ * @returns {string}
993
+ */
994
+ get prover() {
995
+ let deferred1_0;
996
+ let deferred1_1;
997
+ try {
998
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
999
+ wasm.__wbg_get_metadata_prover(retptr, this.__wbg_ptr);
1000
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1001
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1002
+ deferred1_0 = r0;
1003
+ deferred1_1 = r1;
1004
+ return getStringFromWasm0(r0, r1);
1005
+ } finally {
1006
+ wasm.__wbindgen_add_to_stack_pointer(16);
1007
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1008
+ }
1009
+ }
1010
+ /**
1011
+ * @param {string} arg0
1012
+ */
1013
+ set prover(arg0) {
1014
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1015
+ const len0 = WASM_VECTOR_LEN;
1016
+ wasm.__wbg_set_metadata_prover(this.__wbg_ptr, ptr0, len0);
1017
+ }
1018
+ /**
1019
+ * @returns {string}
1020
+ */
1021
+ get verifier() {
1022
+ let deferred1_0;
1023
+ let deferred1_1;
1024
+ try {
1025
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1026
+ wasm.__wbg_get_metadata_verifier(retptr, this.__wbg_ptr);
1027
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1028
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1029
+ deferred1_0 = r0;
1030
+ deferred1_1 = r1;
1031
+ return getStringFromWasm0(r0, r1);
1032
+ } finally {
1033
+ wasm.__wbindgen_add_to_stack_pointer(16);
1034
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1035
+ }
1036
+ }
1037
+ /**
1038
+ * @param {string} arg0
1039
+ */
1040
+ set verifier(arg0) {
1041
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1042
+ const len0 = WASM_VECTOR_LEN;
1043
+ wasm.__wbg_set_metadata_verifier(this.__wbg_ptr, ptr0, len0);
1044
+ }
1045
+ /**
1046
+ * @returns {string}
1047
+ */
1048
+ get verifyingKey() {
1049
+ let deferred1_0;
1050
+ let deferred1_1;
1051
+ try {
1052
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1053
+ wasm.__wbg_get_metadata_verifyingKey(retptr, this.__wbg_ptr);
1054
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1055
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1056
+ deferred1_0 = r0;
1057
+ deferred1_1 = r1;
1058
+ return getStringFromWasm0(r0, r1);
1059
+ } finally {
1060
+ wasm.__wbindgen_add_to_stack_pointer(16);
1061
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1062
+ }
1063
+ }
1064
+ /**
1065
+ * @param {string} arg0
1066
+ */
1067
+ set verifyingKey(arg0) {
1068
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1069
+ const len0 = WASM_VECTOR_LEN;
1070
+ wasm.__wbg_set_metadata_verifyingKey(this.__wbg_ptr, ptr0, len0);
1071
+ }
1072
+ /**
1073
+ * @returns {string}
1074
+ */
1075
+ static baseUrl() {
1076
+ let deferred1_0;
1077
+ let deferred1_1;
1078
+ try {
1079
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1080
+ wasm.metadata_baseUrl(retptr);
1081
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1082
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1083
+ deferred1_0 = r0;
1084
+ deferred1_1 = r1;
1085
+ return getStringFromWasm0(r0, r1);
1086
+ } finally {
1087
+ wasm.__wbindgen_add_to_stack_pointer(16);
1088
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1089
+ }
1090
+ }
1091
+ /**
1092
+ * @returns {Metadata}
1093
+ */
1094
+ static bond_public() {
1095
+ const ret = wasm.metadata_bond_public();
1096
+ return Metadata.__wrap(ret);
1097
+ }
1098
+ /**
1099
+ * @returns {Metadata}
1100
+ */
1101
+ static bond_validator() {
1102
+ const ret = wasm.metadata_bond_validator();
1103
+ return Metadata.__wrap(ret);
1104
+ }
1105
+ /**
1106
+ * @returns {Metadata}
1107
+ */
1108
+ static claim_unbond_public() {
1109
+ const ret = wasm.metadata_claim_unbond_public();
1110
+ return Metadata.__wrap(ret);
1111
+ }
1112
+ /**
1113
+ * @returns {Metadata}
1114
+ */
1115
+ static fee_private() {
1116
+ const ret = wasm.metadata_fee_private();
1117
+ return Metadata.__wrap(ret);
1118
+ }
1119
+ /**
1120
+ * @returns {Metadata}
1121
+ */
1122
+ static fee_public() {
1123
+ const ret = wasm.metadata_fee_public();
1124
+ return Metadata.__wrap(ret);
1125
+ }
1126
+ /**
1127
+ * @returns {Metadata}
1128
+ */
1129
+ static inclusion() {
1130
+ const ret = wasm.metadata_inclusion();
1131
+ return Metadata.__wrap(ret);
1132
+ }
1133
+ /**
1134
+ * @returns {Metadata}
1135
+ */
1136
+ static join() {
1137
+ const ret = wasm.metadata_join();
1138
+ return Metadata.__wrap(ret);
1139
+ }
1140
+ /**
1141
+ * @returns {Metadata}
1142
+ */
1143
+ static set_validator_state() {
1144
+ const ret = wasm.metadata_set_validator_state();
1145
+ return Metadata.__wrap(ret);
1146
+ }
1147
+ /**
1148
+ * @returns {Metadata}
1149
+ */
1150
+ static split() {
1151
+ const ret = wasm.metadata_split();
1152
+ return Metadata.__wrap(ret);
1153
+ }
1154
+ /**
1155
+ * @returns {Metadata}
1156
+ */
1157
+ static transfer_private() {
1158
+ const ret = wasm.metadata_transfer_private();
1159
+ return Metadata.__wrap(ret);
1160
+ }
1161
+ /**
1162
+ * @returns {Metadata}
1163
+ */
1164
+ static transfer_private_to_public() {
1165
+ const ret = wasm.metadata_transfer_private_to_public();
1166
+ return Metadata.__wrap(ret);
1167
+ }
1168
+ /**
1169
+ * @returns {Metadata}
1170
+ */
1171
+ static transfer_public() {
1172
+ const ret = wasm.metadata_transfer_public();
1173
+ return Metadata.__wrap(ret);
1174
+ }
1175
+ /**
1176
+ * @returns {Metadata}
1177
+ */
1178
+ static transfer_public_as_signer() {
1179
+ const ret = wasm.metadata_transfer_public_as_signer();
1180
+ return Metadata.__wrap(ret);
1181
+ }
1182
+ /**
1183
+ * @returns {Metadata}
1184
+ */
1185
+ static transfer_public_to_private() {
1186
+ const ret = wasm.metadata_transfer_public_to_private();
1187
+ return Metadata.__wrap(ret);
1188
+ }
1189
+ /**
1190
+ * @returns {Metadata}
1191
+ */
1192
+ static unbond_public() {
1193
+ const ret = wasm.metadata_unbond_public();
1194
+ return Metadata.__wrap(ret);
1195
+ }
1196
+ };
1197
+
1198
+ const OfflineQueryFinalization = (typeof FinalizationRegistry === 'undefined')
1199
+ ? { register: () => {}, unregister: () => {} }
1200
+ : new FinalizationRegistry(ptr => wasm.__wbg_offlinequery_free(ptr >>> 0));
1201
+ /**
1202
+ * An offline query object used to insert the global state root and state paths needed to create
1203
+ * a valid inclusion proof offline.
1204
+ */
1205
+ let OfflineQuery$1 = class OfflineQuery {
1206
+
1207
+ static __wrap(ptr) {
1208
+ ptr = ptr >>> 0;
1209
+ const obj = Object.create(OfflineQuery.prototype);
1210
+ obj.__wbg_ptr = ptr;
1211
+ OfflineQueryFinalization.register(obj, obj.__wbg_ptr, obj);
1212
+ return obj;
1213
+ }
1214
+
1215
+ __destroy_into_raw() {
1216
+ const ptr = this.__wbg_ptr;
1217
+ this.__wbg_ptr = 0;
1218
+ OfflineQueryFinalization.unregister(this);
1219
+ return ptr;
1220
+ }
1221
+
1222
+ free() {
1223
+ const ptr = this.__destroy_into_raw();
1224
+ wasm.__wbg_offlinequery_free(ptr);
1225
+ }
1226
+ /**
1227
+ * Creates a new offline query object. The state root is required to be passed in as a string
1228
+ * @param {string} state_root
1229
+ */
1230
+ constructor(state_root) {
1231
+ try {
1232
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1233
+ const ptr0 = passStringToWasm0(state_root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1234
+ const len0 = WASM_VECTOR_LEN;
1235
+ wasm.offlinequery_new(retptr, ptr0, len0);
1236
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1237
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1238
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1239
+ if (r2) {
1240
+ throw takeObject(r1);
1241
+ }
1242
+ this.__wbg_ptr = r0 >>> 0;
1243
+ return this;
1244
+ } finally {
1245
+ wasm.__wbindgen_add_to_stack_pointer(16);
1246
+ }
1247
+ }
1248
+ /**
1249
+ * Add a new state path to the offline query object.
1250
+ *
1251
+ * @param {string} commitment: The commitment corresponding to a record inpout
1252
+ * @param {string} state_path: The state path corresponding to the commitment
1253
+ * @param {string} commitment
1254
+ * @param {string} state_path
1255
+ */
1256
+ addStatePath(commitment, state_path) {
1257
+ try {
1258
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1259
+ const ptr0 = passStringToWasm0(commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1260
+ const len0 = WASM_VECTOR_LEN;
1261
+ const ptr1 = passStringToWasm0(state_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1262
+ const len1 = WASM_VECTOR_LEN;
1263
+ wasm.offlinequery_addStatePath(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1264
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1265
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1266
+ if (r1) {
1267
+ throw takeObject(r0);
1268
+ }
1269
+ } finally {
1270
+ wasm.__wbindgen_add_to_stack_pointer(16);
1271
+ }
1272
+ }
1273
+ /**
1274
+ * Get a json string representation of the offline query object
1275
+ * @returns {string}
1276
+ */
1277
+ toString() {
1278
+ let deferred1_0;
1279
+ let deferred1_1;
1280
+ try {
1281
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1282
+ wasm.offlinequery_toString(retptr, this.__wbg_ptr);
1283
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1284
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1285
+ deferred1_0 = r0;
1286
+ deferred1_1 = r1;
1287
+ return getStringFromWasm0(r0, r1);
1288
+ } finally {
1289
+ wasm.__wbindgen_add_to_stack_pointer(16);
1290
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1291
+ }
1292
+ }
1293
+ /**
1294
+ * Create an offline query object from a json string representation
1295
+ * @param {string} s
1296
+ * @returns {OfflineQuery}
1297
+ */
1298
+ static fromString(s) {
1299
+ try {
1300
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1301
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1302
+ const len0 = WASM_VECTOR_LEN;
1303
+ wasm.offlinequery_fromString(retptr, ptr0, len0);
1304
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1305
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1306
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1307
+ if (r2) {
1308
+ throw takeObject(r1);
1309
+ }
1310
+ return OfflineQuery.__wrap(r0);
1311
+ } finally {
1312
+ wasm.__wbindgen_add_to_stack_pointer(16);
1313
+ }
1314
+ }
1315
+ };
1316
+
1317
+ const PrivateKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1318
+ ? { register: () => {}, unregister: () => {} }
1319
+ : new FinalizationRegistry(ptr => wasm.__wbg_privatekey_free(ptr >>> 0));
1320
+ /**
1321
+ * Private key of an Aleo account
1322
+ */
1323
+ let PrivateKey$1 = class PrivateKey {
1324
+
1325
+ static __wrap(ptr) {
1326
+ ptr = ptr >>> 0;
1327
+ const obj = Object.create(PrivateKey.prototype);
1328
+ obj.__wbg_ptr = ptr;
1329
+ PrivateKeyFinalization.register(obj, obj.__wbg_ptr, obj);
1330
+ return obj;
1331
+ }
1332
+
1333
+ __destroy_into_raw() {
1334
+ const ptr = this.__wbg_ptr;
1335
+ this.__wbg_ptr = 0;
1336
+ PrivateKeyFinalization.unregister(this);
1337
+ return ptr;
1338
+ }
1339
+
1340
+ free() {
1341
+ const ptr = this.__destroy_into_raw();
1342
+ wasm.__wbg_privatekey_free(ptr);
1343
+ }
1344
+ /**
1345
+ * Generate a new private key using a cryptographically secure random number generator
1346
+ *
1347
+ * @returns {PrivateKey}
1348
+ */
1349
+ constructor() {
1350
+ const ret = wasm.privatekey_new();
1351
+ this.__wbg_ptr = ret >>> 0;
1352
+ return this;
1353
+ }
1354
+ /**
1355
+ * Get a private key from a series of unchecked bytes
1356
+ *
1357
+ * @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
1358
+ * @returns {PrivateKey}
1359
+ * @param {Uint8Array} seed
1360
+ * @returns {PrivateKey}
1361
+ */
1362
+ static from_seed_unchecked(seed) {
1363
+ const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
1364
+ const len0 = WASM_VECTOR_LEN;
1365
+ const ret = wasm.privatekey_from_seed_unchecked(ptr0, len0);
1366
+ return PrivateKey.__wrap(ret);
1367
+ }
1368
+ /**
1369
+ * Get a private key from a string representation of a private key
1370
+ *
1371
+ * @param {string} seed String representation of a private key
1372
+ * @returns {PrivateKey}
1373
+ * @param {string} private_key
1374
+ * @returns {PrivateKey}
1375
+ */
1376
+ static from_string(private_key) {
1377
+ try {
1378
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1379
+ const ptr0 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1380
+ const len0 = WASM_VECTOR_LEN;
1381
+ wasm.privatekey_from_string(retptr, ptr0, len0);
1382
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1383
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1384
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1385
+ if (r2) {
1386
+ throw takeObject(r1);
1387
+ }
1388
+ return PrivateKey.__wrap(r0);
1389
+ } finally {
1390
+ wasm.__wbindgen_add_to_stack_pointer(16);
1391
+ }
1392
+ }
1393
+ /**
1394
+ * Get a string representation of the private key. This function should be used very carefully
1395
+ * as it exposes the private key plaintext
1396
+ *
1397
+ * @returns {string} String representation of a private key
1398
+ * @returns {string}
1399
+ */
1400
+ to_string() {
1401
+ let deferred1_0;
1402
+ let deferred1_1;
1403
+ try {
1404
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1405
+ wasm.privatekey_to_string(retptr, this.__wbg_ptr);
1406
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1407
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1408
+ deferred1_0 = r0;
1409
+ deferred1_1 = r1;
1410
+ return getStringFromWasm0(r0, r1);
1411
+ } finally {
1412
+ wasm.__wbindgen_add_to_stack_pointer(16);
1413
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1414
+ }
1415
+ }
1416
+ /**
1417
+ * Get a string representation of the seed. This function should be used very carefully
1418
+ * as it exposes the private key seed
1419
+ *
1420
+ * @returns {string} String representation of a private key seed
1421
+ * @returns {string}
1422
+ */
1423
+ to_seed() {
1424
+ let deferred1_0;
1425
+ let deferred1_1;
1426
+ try {
1427
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1428
+ wasm.privatekey_to_seed(retptr, this.__wbg_ptr);
1429
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1430
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1431
+ deferred1_0 = r0;
1432
+ deferred1_1 = r1;
1433
+ return getStringFromWasm0(r0, r1);
1434
+ } finally {
1435
+ wasm.__wbindgen_add_to_stack_pointer(16);
1436
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1437
+ }
1438
+ }
1439
+ /**
1440
+ * Get the view key corresponding to the private key
1441
+ *
1442
+ * @returns {ViewKey}
1443
+ * @returns {ViewKey}
1444
+ */
1445
+ to_view_key() {
1446
+ const ret = wasm.privatekey_to_view_key(this.__wbg_ptr);
1447
+ return ViewKey$1.__wrap(ret);
1448
+ }
1449
+ /**
1450
+ * Get the address corresponding to the private key
1451
+ *
1452
+ * @returns {Address}
1453
+ * @returns {Address}
1454
+ */
1455
+ to_address() {
1456
+ const ret = wasm.privatekey_to_address(this.__wbg_ptr);
1457
+ return Address$1.__wrap(ret);
1458
+ }
1459
+ /**
1460
+ * Sign a message with the private key
1461
+ *
1462
+ * @param {Uint8Array} Byte array representing a message signed by the address
1463
+ * @returns {Signature} Signature generated by signing the message with the address
1464
+ * @param {Uint8Array} message
1465
+ * @returns {Signature}
1466
+ */
1467
+ sign(message) {
1468
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
1469
+ const len0 = WASM_VECTOR_LEN;
1470
+ const ret = wasm.privatekey_sign(this.__wbg_ptr, ptr0, len0);
1471
+ return Signature$1.__wrap(ret);
1472
+ }
1473
+ /**
1474
+ * Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
1475
+ * and will be needed to decrypt the private key later, so it should be stored securely
1476
+ *
1477
+ * @param {string} secret Secret used to encrypt the private key
1478
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
1479
+ * @param {string} secret
1480
+ * @returns {PrivateKeyCiphertext}
1481
+ */
1482
+ static newEncrypted(secret) {
1483
+ try {
1484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1485
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1486
+ const len0 = WASM_VECTOR_LEN;
1487
+ wasm.privatekey_newEncrypted(retptr, ptr0, len0);
1488
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1489
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1490
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1491
+ if (r2) {
1492
+ throw takeObject(r1);
1493
+ }
1494
+ return PrivateKeyCiphertext$1.__wrap(r0);
1495
+ } finally {
1496
+ wasm.__wbindgen_add_to_stack_pointer(16);
1497
+ }
1498
+ }
1499
+ /**
1500
+ * Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
1501
+ * decrypt the private key later, so it should be stored securely
1502
+ *
1503
+ * @param {string} secret Secret used to encrypt the private key
1504
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
1505
+ * @param {string} secret
1506
+ * @returns {PrivateKeyCiphertext}
1507
+ */
1508
+ toCiphertext(secret) {
1509
+ try {
1510
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1511
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1512
+ const len0 = WASM_VECTOR_LEN;
1513
+ wasm.privatekey_toCiphertext(retptr, this.__wbg_ptr, ptr0, len0);
1514
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1515
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1516
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1517
+ if (r2) {
1518
+ throw takeObject(r1);
1519
+ }
1520
+ return PrivateKeyCiphertext$1.__wrap(r0);
1521
+ } finally {
1522
+ wasm.__wbindgen_add_to_stack_pointer(16);
1523
+ }
1524
+ }
1525
+ /**
1526
+ * Get private key from a private key ciphertext and secret originally used to encrypt it
1527
+ *
1528
+ * @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
1529
+ * @param {string} secret Secret originally used to encrypt the private key
1530
+ * @returns {PrivateKey | Error} Private key
1531
+ * @param {PrivateKeyCiphertext} ciphertext
1532
+ * @param {string} secret
1533
+ * @returns {PrivateKey}
1534
+ */
1535
+ static fromPrivateKeyCiphertext(ciphertext, secret) {
1536
+ try {
1537
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1538
+ _assertClass(ciphertext, PrivateKeyCiphertext$1);
1539
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1540
+ const len0 = WASM_VECTOR_LEN;
1541
+ wasm.privatekey_fromPrivateKeyCiphertext(retptr, ciphertext.__wbg_ptr, ptr0, len0);
1542
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1543
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1544
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1545
+ if (r2) {
1546
+ throw takeObject(r1);
1547
+ }
1548
+ return PrivateKey.__wrap(r0);
1549
+ } finally {
1550
+ wasm.__wbindgen_add_to_stack_pointer(16);
1551
+ }
1552
+ }
1553
+ };
1554
+
1555
+ const PrivateKeyCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
1556
+ ? { register: () => {}, unregister: () => {} }
1557
+ : new FinalizationRegistry(ptr => wasm.__wbg_privatekeyciphertext_free(ptr >>> 0));
1558
+ /**
1559
+ * Private Key in ciphertext form
1560
+ */
1561
+ let PrivateKeyCiphertext$1 = class PrivateKeyCiphertext {
1562
+
1563
+ static __wrap(ptr) {
1564
+ ptr = ptr >>> 0;
1565
+ const obj = Object.create(PrivateKeyCiphertext.prototype);
1566
+ obj.__wbg_ptr = ptr;
1567
+ PrivateKeyCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
1568
+ return obj;
1569
+ }
1570
+
1571
+ __destroy_into_raw() {
1572
+ const ptr = this.__wbg_ptr;
1573
+ this.__wbg_ptr = 0;
1574
+ PrivateKeyCiphertextFinalization.unregister(this);
1575
+ return ptr;
1576
+ }
1577
+
1578
+ free() {
1579
+ const ptr = this.__destroy_into_raw();
1580
+ wasm.__wbg_privatekeyciphertext_free(ptr);
1581
+ }
1582
+ /**
1583
+ * Encrypt a private key using a secret string. The secret is sensitive and will be needed to
1584
+ * decrypt the private key later, so it should be stored securely
1585
+ *
1586
+ * @param {PrivateKey} private_key Private key to encrypt
1587
+ * @param {string} secret Secret to encrypt the private key with
1588
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
1589
+ * @param {PrivateKey} private_key
1590
+ * @param {string} secret
1591
+ * @returns {PrivateKeyCiphertext}
1592
+ */
1593
+ static encryptPrivateKey(private_key, secret) {
1594
+ try {
1595
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1596
+ _assertClass(private_key, PrivateKey$1);
1597
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1598
+ const len0 = WASM_VECTOR_LEN;
1599
+ wasm.privatekey_toCiphertext(retptr, private_key.__wbg_ptr, ptr0, len0);
1600
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1601
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1602
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1603
+ if (r2) {
1604
+ throw takeObject(r1);
1605
+ }
1606
+ return PrivateKeyCiphertext.__wrap(r0);
1607
+ } finally {
1608
+ wasm.__wbindgen_add_to_stack_pointer(16);
1609
+ }
1610
+ }
1611
+ /**
1612
+ * Decrypts a private ciphertext using a secret string. This must be the same secret used to
1613
+ * encrypt the private key
1614
+ *
1615
+ * @param {string} secret Secret used to encrypt the private key
1616
+ * @returns {PrivateKey | Error} Private key
1617
+ * @param {string} secret
1618
+ * @returns {PrivateKey}
1619
+ */
1620
+ decryptToPrivateKey(secret) {
1621
+ try {
1622
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1623
+ const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1624
+ const len0 = WASM_VECTOR_LEN;
1625
+ wasm.privatekeyciphertext_decryptToPrivateKey(retptr, this.__wbg_ptr, ptr0, len0);
1626
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1627
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1628
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1629
+ if (r2) {
1630
+ throw takeObject(r1);
1631
+ }
1632
+ return PrivateKey$1.__wrap(r0);
1633
+ } finally {
1634
+ wasm.__wbindgen_add_to_stack_pointer(16);
1635
+ }
1636
+ }
1637
+ /**
1638
+ * Returns the ciphertext string
1639
+ *
1640
+ * @returns {string} Ciphertext string
1641
+ * @returns {string}
1642
+ */
1643
+ toString() {
1644
+ let deferred1_0;
1645
+ let deferred1_1;
1646
+ try {
1647
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1648
+ wasm.privatekeyciphertext_toString(retptr, this.__wbg_ptr);
1649
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1650
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1651
+ deferred1_0 = r0;
1652
+ deferred1_1 = r1;
1653
+ return getStringFromWasm0(r0, r1);
1654
+ } finally {
1655
+ wasm.__wbindgen_add_to_stack_pointer(16);
1656
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1657
+ }
1658
+ }
1659
+ /**
1660
+ * Creates a PrivateKeyCiphertext from a string
1661
+ *
1662
+ * @param {string} ciphertext Ciphertext string
1663
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
1664
+ * @param {string} ciphertext
1665
+ * @returns {PrivateKeyCiphertext}
1666
+ */
1667
+ static fromString(ciphertext) {
1668
+ try {
1669
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1670
+ const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1671
+ const len0 = WASM_VECTOR_LEN;
1672
+ wasm.privatekeyciphertext_fromString(retptr, ptr0, len0);
1673
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1674
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1675
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1676
+ if (r2) {
1677
+ throw takeObject(r1);
1678
+ }
1679
+ return PrivateKeyCiphertext.__wrap(r0);
1680
+ } finally {
1681
+ wasm.__wbindgen_add_to_stack_pointer(16);
1682
+ }
1683
+ }
1684
+ };
1685
+
1686
+ const ProgramFinalization = (typeof FinalizationRegistry === 'undefined')
1687
+ ? { register: () => {}, unregister: () => {} }
1688
+ : new FinalizationRegistry(ptr => wasm.__wbg_program_free(ptr >>> 0));
1689
+ /**
1690
+ * Webassembly Representation of an Aleo program
1691
+ */
1692
+ let Program$1 = class Program {
1693
+
1694
+ static __wrap(ptr) {
1695
+ ptr = ptr >>> 0;
1696
+ const obj = Object.create(Program.prototype);
1697
+ obj.__wbg_ptr = ptr;
1698
+ ProgramFinalization.register(obj, obj.__wbg_ptr, obj);
1699
+ return obj;
1700
+ }
1701
+
1702
+ __destroy_into_raw() {
1703
+ const ptr = this.__wbg_ptr;
1704
+ this.__wbg_ptr = 0;
1705
+ ProgramFinalization.unregister(this);
1706
+ return ptr;
1707
+ }
1708
+
1709
+ free() {
1710
+ const ptr = this.__destroy_into_raw();
1711
+ wasm.__wbg_program_free(ptr);
1712
+ }
1713
+ /**
1714
+ * Create a program from a program string
1715
+ *
1716
+ * @param {string} program Aleo program source code
1717
+ * @returns {Program | Error} Program object
1718
+ * @param {string} program
1719
+ * @returns {Program}
1720
+ */
1721
+ static fromString(program) {
1722
+ try {
1723
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1724
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1725
+ const len0 = WASM_VECTOR_LEN;
1726
+ wasm.program_fromString(retptr, ptr0, len0);
1727
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1728
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1729
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1730
+ if (r2) {
1731
+ throw takeObject(r1);
1732
+ }
1733
+ return Program.__wrap(r0);
1734
+ } finally {
1735
+ wasm.__wbindgen_add_to_stack_pointer(16);
1736
+ }
1737
+ }
1738
+ /**
1739
+ * Get a string representation of the program
1740
+ *
1741
+ * @returns {string} String containing the program source code
1742
+ * @returns {string}
1743
+ */
1744
+ toString() {
1745
+ let deferred1_0;
1746
+ let deferred1_1;
1747
+ try {
1748
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1749
+ wasm.program_toString(retptr, this.__wbg_ptr);
1750
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1751
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1752
+ deferred1_0 = r0;
1753
+ deferred1_1 = r1;
1754
+ return getStringFromWasm0(r0, r1);
1755
+ } finally {
1756
+ wasm.__wbindgen_add_to_stack_pointer(16);
1757
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1758
+ }
1759
+ }
1760
+ /**
1761
+ * Determine if a function is present in the program
1762
+ *
1763
+ * @param {string} functionName Name of the function to check for
1764
+ * @returns {boolean} True if the program is valid, false otherwise
1765
+ * @param {string} function_name
1766
+ * @returns {boolean}
1767
+ */
1768
+ hasFunction(function_name) {
1769
+ const ptr0 = passStringToWasm0(function_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1770
+ const len0 = WASM_VECTOR_LEN;
1771
+ const ret = wasm.program_hasFunction(this.__wbg_ptr, ptr0, len0);
1772
+ return ret !== 0;
1773
+ }
1774
+ /**
1775
+ * Get javascript array of functions names in the program
1776
+ *
1777
+ * @returns {Array} Array of all function names present in the program
1778
+ *
1779
+ * @example
1780
+ * const expected_functions = [
1781
+ * "mint",
1782
+ * "transfer_private",
1783
+ * "transfer_private_to_public",
1784
+ * "transfer_public",
1785
+ * "transfer_public_to_private",
1786
+ * "join",
1787
+ * "split",
1788
+ * "fee"
1789
+ * ]
1790
+ *
1791
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
1792
+ * const credits_functions = credits_program.getFunctions();
1793
+ * console.log(credits_functions === expected_functions); // Output should be "true"
1794
+ * @returns {Array<any>}
1795
+ */
1796
+ getFunctions() {
1797
+ const ret = wasm.program_getFunctions(this.__wbg_ptr);
1798
+ return takeObject(ret);
1799
+ }
1800
+ /**
1801
+ * Get a javascript object representation of the function inputs and types. This can be used
1802
+ * to generate a web form to capture user inputs for an execution of a function.
1803
+ *
1804
+ * @param {string} function_name Name of the function to get inputs for
1805
+ * @returns {Array | Error} Array of function inputs
1806
+ *
1807
+ * @example
1808
+ * const expected_inputs = [
1809
+ * {
1810
+ * type:"record",
1811
+ * visibility:"private",
1812
+ * record:"credits",
1813
+ * members:[
1814
+ * {
1815
+ * name:"microcredits",
1816
+ * type:"u64",
1817
+ * visibility:"private"
1818
+ * }
1819
+ * ],
1820
+ * register:"r0"
1821
+ * },
1822
+ * {
1823
+ * type:"address",
1824
+ * visibility:"private",
1825
+ * register:"r1"
1826
+ * },
1827
+ * {
1828
+ * type:"u64",
1829
+ * visibility:"private",
1830
+ * register:"r2"
1831
+ * }
1832
+ * ];
1833
+ *
1834
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
1835
+ * const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
1836
+ * console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
1837
+ * @param {string} function_name
1838
+ * @returns {Array<any>}
1839
+ */
1840
+ getFunctionInputs(function_name) {
1841
+ try {
1842
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1843
+ const ptr0 = passStringToWasm0(function_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1844
+ const len0 = WASM_VECTOR_LEN;
1845
+ wasm.program_getFunctionInputs(retptr, this.__wbg_ptr, ptr0, len0);
1846
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1847
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1848
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1849
+ if (r2) {
1850
+ throw takeObject(r1);
1851
+ }
1852
+ return takeObject(r0);
1853
+ } finally {
1854
+ wasm.__wbindgen_add_to_stack_pointer(16);
1855
+ }
1856
+ }
1857
+ /**
1858
+ * Get a the list of a program's mappings and the names/types of their keys and values.
1859
+ *
1860
+ * @returns {Array | Error} - An array of objects representing the mappings in the program
1861
+ * @example
1862
+ * const expected_mappings = [
1863
+ * {
1864
+ * name: "account",
1865
+ * key_name: "owner",
1866
+ * key_type: "address",
1867
+ * value_name: "microcredits",
1868
+ * value_type: "u64"
1869
+ * }
1870
+ * ]
1871
+ *
1872
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
1873
+ * const credits_mappings = credits_program.getMappings();
1874
+ * console.log(credits_mappings === expected_mappings); // Output should be "true"
1875
+ * @returns {Array<any>}
1876
+ */
1877
+ getMappings() {
1878
+ try {
1879
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1880
+ wasm.program_getMappings(retptr, this.__wbg_ptr);
1881
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1882
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1883
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1884
+ if (r2) {
1885
+ throw takeObject(r1);
1886
+ }
1887
+ return takeObject(r0);
1888
+ } finally {
1889
+ wasm.__wbindgen_add_to_stack_pointer(16);
1890
+ }
1891
+ }
1892
+ /**
1893
+ * Get a javascript object representation of a program record and its types
1894
+ *
1895
+ * @param {string} record_name Name of the record to get members for
1896
+ * @returns {Object | Error} Object containing the record name, type, and members
1897
+ *
1898
+ * @example
1899
+ *
1900
+ * const expected_record = {
1901
+ * type: "record",
1902
+ * record: "Credits",
1903
+ * members: [
1904
+ * {
1905
+ * name: "owner",
1906
+ * type: "address",
1907
+ * visibility: "private"
1908
+ * },
1909
+ * {
1910
+ * name: "microcredits",
1911
+ * type: "u64",
1912
+ * visibility: "private"
1913
+ * }
1914
+ * ];
1915
+ * };
1916
+ *
1917
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
1918
+ * const credits_record = credits_program.getRecordMembers("Credits");
1919
+ * console.log(credits_record === expected_record); // Output should be "true"
1920
+ * @param {string} record_name
1921
+ * @returns {object}
1922
+ */
1923
+ getRecordMembers(record_name) {
1924
+ try {
1925
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1926
+ const ptr0 = passStringToWasm0(record_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1927
+ const len0 = WASM_VECTOR_LEN;
1928
+ wasm.program_getRecordMembers(retptr, this.__wbg_ptr, ptr0, len0);
1929
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1930
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1931
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1932
+ if (r2) {
1933
+ throw takeObject(r1);
1934
+ }
1935
+ return takeObject(r0);
1936
+ } finally {
1937
+ wasm.__wbindgen_add_to_stack_pointer(16);
1938
+ }
1939
+ }
1940
+ /**
1941
+ * Get a javascript object representation of a program struct and its types
1942
+ *
1943
+ * @param {string} struct_name Name of the struct to get members for
1944
+ * @returns {Array | Error} Array containing the struct members
1945
+ *
1946
+ * @example
1947
+ *
1948
+ * const STRUCT_PROGRAM = "program token_issue.aleo;
1949
+ *
1950
+ * struct token_metadata:
1951
+ * network as u32;
1952
+ * version as u32;
1953
+ *
1954
+ * struct token:
1955
+ * token_id as u32;
1956
+ * metadata as token_metadata;
1957
+ *
1958
+ * function no_op:
1959
+ * input r0 as u64;
1960
+ * output r0 as u64;"
1961
+ *
1962
+ * const expected_struct_members = [
1963
+ * {
1964
+ * name: "token_id",
1965
+ * type: "u32",
1966
+ * },
1967
+ * {
1968
+ * name: "metadata",
1969
+ * type: "struct",
1970
+ * struct_id: "token_metadata",
1971
+ * members: [
1972
+ * {
1973
+ * name: "network",
1974
+ * type: "u32",
1975
+ * }
1976
+ * {
1977
+ * name: "version",
1978
+ * type: "u32",
1979
+ * }
1980
+ * ]
1981
+ * }
1982
+ * ];
1983
+ *
1984
+ * const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
1985
+ * const struct_members = program.getStructMembers("token");
1986
+ * console.log(struct_members === expected_struct_members); // Output should be "true"
1987
+ * @param {string} struct_name
1988
+ * @returns {Array<any>}
1989
+ */
1990
+ getStructMembers(struct_name) {
1991
+ try {
1992
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1993
+ const ptr0 = passStringToWasm0(struct_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1994
+ const len0 = WASM_VECTOR_LEN;
1995
+ wasm.program_getStructMembers(retptr, this.__wbg_ptr, ptr0, len0);
1996
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1997
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1998
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1999
+ if (r2) {
2000
+ throw takeObject(r1);
2001
+ }
2002
+ return takeObject(r0);
2003
+ } finally {
2004
+ wasm.__wbindgen_add_to_stack_pointer(16);
2005
+ }
2006
+ }
2007
+ /**
2008
+ * Get the credits.aleo program
2009
+ *
2010
+ * @returns {Program} The credits.aleo program
2011
+ * @returns {Program}
2012
+ */
2013
+ static getCreditsProgram() {
2014
+ const ret = wasm.program_getCreditsProgram();
2015
+ return Program.__wrap(ret);
2016
+ }
2017
+ /**
2018
+ * Get the id of the program
2019
+ *
2020
+ * @returns {string} The id of the program
2021
+ * @returns {string}
2022
+ */
2023
+ id() {
2024
+ let deferred1_0;
2025
+ let deferred1_1;
2026
+ try {
2027
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2028
+ wasm.program_id(retptr, this.__wbg_ptr);
2029
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2030
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2031
+ deferred1_0 = r0;
2032
+ deferred1_1 = r1;
2033
+ return getStringFromWasm0(r0, r1);
2034
+ } finally {
2035
+ wasm.__wbindgen_add_to_stack_pointer(16);
2036
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2037
+ }
2038
+ }
2039
+ /**
2040
+ * Get a unique address of the program
2041
+ *
2042
+ * @returns {Address} The address of the program
2043
+ * @returns {Address}
2044
+ */
2045
+ address() {
2046
+ try {
2047
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2048
+ wasm.program_address(retptr, this.__wbg_ptr);
2049
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2050
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2051
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2052
+ if (r2) {
2053
+ throw takeObject(r1);
2054
+ }
2055
+ return Address$1.__wrap(r0);
2056
+ } finally {
2057
+ wasm.__wbindgen_add_to_stack_pointer(16);
2058
+ }
2059
+ }
2060
+ /**
2061
+ * Determine equality with another program
2062
+ *
2063
+ * @param {Program} other The other program to compare
2064
+ * @returns {boolean} True if the programs are equal, false otherwise
2065
+ * @param {Program} other
2066
+ * @returns {boolean}
2067
+ */
2068
+ isEqual(other) {
2069
+ _assertClass(other, Program);
2070
+ const ret = wasm.program_isEqual(this.__wbg_ptr, other.__wbg_ptr);
2071
+ return ret !== 0;
2072
+ }
2073
+ /**
2074
+ * Get program_imports
2075
+ *
2076
+ * @returns {Array} The program imports
2077
+ *
2078
+ * @example
2079
+ *
2080
+ * const DOUBLE_TEST = "import multiply_test.aleo;
2081
+ *
2082
+ * program double_test.aleo;
2083
+ *
2084
+ * function double_it:
2085
+ * input r0 as u32.private;
2086
+ * call multiply_test.aleo/multiply 2u32 r0 into r1;
2087
+ * output r1 as u32.private;";
2088
+ *
2089
+ * const expected_imports = [
2090
+ * "multiply_test.aleo"
2091
+ * ];
2092
+ *
2093
+ * const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
2094
+ * const imports = program.getImports();
2095
+ * console.log(imports === expected_imports); // Output should be "true"
2096
+ * @returns {Array<any>}
2097
+ */
2098
+ getImports() {
2099
+ const ret = wasm.program_getImports(this.__wbg_ptr);
2100
+ return takeObject(ret);
2101
+ }
2102
+ };
2103
+
2104
+ const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
2105
+ ? { register: () => {}, unregister: () => {} }
2106
+ : new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0));
2107
+ /**
2108
+ */
2109
+ let ProgramManager$1 = class ProgramManager {
2110
+
2111
+ __destroy_into_raw() {
2112
+ const ptr = this.__wbg_ptr;
2113
+ this.__wbg_ptr = 0;
2114
+ ProgramManagerFinalization.unregister(this);
2115
+ return ptr;
2116
+ }
2117
+
2118
+ free() {
2119
+ const ptr = this.__destroy_into_raw();
2120
+ wasm.__wbg_programmanager_free(ptr);
2121
+ }
2122
+ /**
2123
+ * Deploy an Aleo program
2124
+ *
2125
+ * @param private_key The private key of the sender
2126
+ * @param program The source code of the program being deployed
2127
+ * @param imports A javascript object holding the source code of any imported programs in the
2128
+ * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
2129
+ * Note that all imported programs must be deployed on chain before the main program in order
2130
+ * for the deployment to succeed
2131
+ * @param fee_credits The amount of credits to pay as a fee
2132
+ * @param fee_record The record to spend the fee from
2133
+ * @param url The url of the Aleo network node to send the transaction to
2134
+ * @param imports (optional) Provide a list of imports to use for the program deployment in the
2135
+ * form of a javascript object where the keys are a string of the program name and the values
2136
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2137
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2138
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2139
+ * @returns {Transaction | Error}
2140
+ * @param {PrivateKey} private_key
2141
+ * @param {string} program
2142
+ * @param {number} fee_credits
2143
+ * @param {RecordPlaintext | undefined} [fee_record]
2144
+ * @param {string | undefined} [url]
2145
+ * @param {object | undefined} [imports]
2146
+ * @param {ProvingKey | undefined} [fee_proving_key]
2147
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2148
+ * @param {OfflineQuery | undefined} [offline_query]
2149
+ * @returns {Promise<Transaction>}
2150
+ */
2151
+ static buildDeploymentTransaction(private_key, program, fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
2152
+ _assertClass(private_key, PrivateKey$1);
2153
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2154
+ const len0 = WASM_VECTOR_LEN;
2155
+ let ptr1 = 0;
2156
+ if (!isLikeNone(fee_record)) {
2157
+ _assertClass(fee_record, RecordPlaintext$1);
2158
+ ptr1 = fee_record.__destroy_into_raw();
2159
+ }
2160
+ var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2161
+ var len2 = WASM_VECTOR_LEN;
2162
+ let ptr3 = 0;
2163
+ if (!isLikeNone(fee_proving_key)) {
2164
+ _assertClass(fee_proving_key, ProvingKey$1);
2165
+ ptr3 = fee_proving_key.__destroy_into_raw();
2166
+ }
2167
+ let ptr4 = 0;
2168
+ if (!isLikeNone(fee_verifying_key)) {
2169
+ _assertClass(fee_verifying_key, VerifyingKey$1);
2170
+ ptr4 = fee_verifying_key.__destroy_into_raw();
2171
+ }
2172
+ let ptr5 = 0;
2173
+ if (!isLikeNone(offline_query)) {
2174
+ _assertClass(offline_query, OfflineQuery$1);
2175
+ ptr5 = offline_query.__destroy_into_raw();
2176
+ }
2177
+ const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
2178
+ return takeObject(ret);
2179
+ }
2180
+ /**
2181
+ * Estimate the fee for a program deployment
2182
+ *
2183
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2184
+ *
2185
+ * @param program The source code of the program being deployed
2186
+ * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
2187
+ * in the form of a javascript object where the keys are a string of the program name and the values
2188
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2189
+ * @returns {u64 | Error}
2190
+ * @param {string} program
2191
+ * @param {object | undefined} [imports]
2192
+ * @returns {Promise<bigint>}
2193
+ */
2194
+ static estimateDeploymentFee(program, imports) {
2195
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2196
+ const len0 = WASM_VECTOR_LEN;
2197
+ const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports));
2198
+ return takeObject(ret);
2199
+ }
2200
+ /**
2201
+ * Estimate the component of the deployment cost which comes from the fee for the program name.
2202
+ * Note that this cost does not represent the entire cost of deployment. It is additional to
2203
+ * the cost of the size (in bytes) of the deployment.
2204
+ *
2205
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2206
+ *
2207
+ * @param name The name of the program to be deployed
2208
+ * @returns {u64 | Error}
2209
+ * @param {string} name
2210
+ * @returns {bigint}
2211
+ */
2212
+ static estimateProgramNameCost(name) {
2213
+ try {
2214
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2215
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2216
+ const len0 = WASM_VECTOR_LEN;
2217
+ wasm.programmanager_estimateProgramNameCost(retptr, ptr0, len0);
2218
+ var r0 = getBigInt64Memory0()[retptr / 8 + 0];
2219
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2220
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2221
+ if (r3) {
2222
+ throw takeObject(r2);
2223
+ }
2224
+ return BigInt.asUintN(64, r0);
2225
+ } finally {
2226
+ wasm.__wbindgen_add_to_stack_pointer(16);
2227
+ }
2228
+ }
2229
+ /**
2230
+ * @param {string} program
2231
+ * @param {string} function_id
2232
+ * @param {Array<any>} inputs_str
2233
+ * @param {string} private_key
2234
+ * @param {object | undefined} imports
2235
+ * @param {bigint} fee_microcredits
2236
+ * @param {string | undefined} [fee_record]
2237
+ * @returns {Promise<AuthorizationResponse>}
2238
+ */
2239
+ static authExecute(program, function_id, inputs_str, private_key, imports, fee_microcredits, fee_record) {
2240
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2241
+ const len0 = WASM_VECTOR_LEN;
2242
+ const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2243
+ const len1 = WASM_VECTOR_LEN;
2244
+ const ptr2 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2245
+ const len2 = WASM_VECTOR_LEN;
2246
+ var ptr3 = isLikeNone(fee_record) ? 0 : passStringToWasm0(fee_record, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2247
+ var len3 = WASM_VECTOR_LEN;
2248
+ const ret = wasm.programmanager_authExecute(ptr0, len0, ptr1, len1, addHeapObject(inputs_str), ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), fee_microcredits, ptr3, len3);
2249
+ return takeObject(ret);
2250
+ }
2251
+ /**
2252
+ * Execute an arbitrary function locally
2253
+ *
2254
+ * @param {PrivateKey} private_key The private key of the sender
2255
+ * @param {string} program The source code of the program being executed
2256
+ * @param {string} function The name of the function to execute
2257
+ * @param {Array} inputs A javascript array of inputs to the function
2258
+ * @param {boolean} prove_execution If true, the execution will be proven and an execution object
2259
+ * containing the proof and the encrypted inputs and outputs needed to verify the proof offline
2260
+ * will be returned.
2261
+ * @param {boolean} cache Cache the proving and verifying keys in the Execution response.
2262
+ * If this is set to 'true' the keys synthesized will be stored in the Execution Response
2263
+ * and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
2264
+ * method.
2265
+ * @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
2266
+ * form of a javascript object where the keys are a string of the program name and the values
2267
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2268
+ * @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
2269
+ * @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
2270
+ * @param {PrivateKey} private_key
2271
+ * @param {string} program
2272
+ * @param {string} _function
2273
+ * @param {Array<any>} inputs
2274
+ * @param {boolean} prove_execution
2275
+ * @param {boolean} cache
2276
+ * @param {object | undefined} [imports]
2277
+ * @param {ProvingKey | undefined} [proving_key]
2278
+ * @param {VerifyingKey | undefined} [verifying_key]
2279
+ * @param {string | undefined} [url]
2280
+ * @param {OfflineQuery | undefined} [offline_query]
2281
+ * @returns {Promise<ExecutionResponse>}
2282
+ */
2283
+ static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query) {
2284
+ _assertClass(private_key, PrivateKey$1);
2285
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2286
+ const len0 = WASM_VECTOR_LEN;
2287
+ const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2288
+ const len1 = WASM_VECTOR_LEN;
2289
+ let ptr2 = 0;
2290
+ if (!isLikeNone(proving_key)) {
2291
+ _assertClass(proving_key, ProvingKey$1);
2292
+ ptr2 = proving_key.__destroy_into_raw();
2293
+ }
2294
+ let ptr3 = 0;
2295
+ if (!isLikeNone(verifying_key)) {
2296
+ _assertClass(verifying_key, VerifyingKey$1);
2297
+ ptr3 = verifying_key.__destroy_into_raw();
2298
+ }
2299
+ var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2300
+ var len4 = WASM_VECTOR_LEN;
2301
+ let ptr5 = 0;
2302
+ if (!isLikeNone(offline_query)) {
2303
+ _assertClass(offline_query, OfflineQuery$1);
2304
+ ptr5 = offline_query.__destroy_into_raw();
2305
+ }
2306
+ const ret = wasm.programmanager_executeFunctionOffline(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), prove_execution, cache, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr2, ptr3, ptr4, len4, ptr5);
2307
+ return takeObject(ret);
2308
+ }
2309
+ /**
2310
+ * Execute Aleo function and create an Aleo execution transaction
2311
+ *
2312
+ * @param private_key The private key of the sender
2313
+ * @param program The source code of the program being executed
2314
+ * @param function The name of the function to execute
2315
+ * @param inputs A javascript array of inputs to the function
2316
+ * @param fee_credits The amount of credits to pay as a fee
2317
+ * @param fee_record The record to spend the fee from
2318
+ * @param url The url of the Aleo network node to send the transaction to
2319
+ * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
2320
+ * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
2321
+ * and used for subsequent transactions. If this is set to 'false' the proving and verifying
2322
+ * keys will be deallocated from memory after the transaction is executed.
2323
+ * @param imports (optional) Provide a list of imports to use for the function execution in the
2324
+ * form of a javascript object where the keys are a string of the program name and the values
2325
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2326
+ * @param proving_key (optional) Provide a verifying key to use for the function execution
2327
+ * @param verifying_key (optional) Provide a verifying key to use for the function execution
2328
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2329
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2330
+ * @returns {Transaction | Error}
2331
+ * @param {PrivateKey} private_key
2332
+ * @param {string} program
2333
+ * @param {string} _function
2334
+ * @param {Array<any>} inputs
2335
+ * @param {number} fee_credits
2336
+ * @param {RecordPlaintext | undefined} [fee_record]
2337
+ * @param {string | undefined} [url]
2338
+ * @param {object | undefined} [imports]
2339
+ * @param {ProvingKey | undefined} [proving_key]
2340
+ * @param {VerifyingKey | undefined} [verifying_key]
2341
+ * @param {ProvingKey | undefined} [fee_proving_key]
2342
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2343
+ * @param {OfflineQuery | undefined} [offline_query]
2344
+ * @returns {Promise<Transaction>}
2345
+ */
2346
+ static buildExecutionTransaction(private_key, program, _function, inputs, fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2347
+ _assertClass(private_key, PrivateKey$1);
2348
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2349
+ const len0 = WASM_VECTOR_LEN;
2350
+ const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2351
+ const len1 = WASM_VECTOR_LEN;
2352
+ let ptr2 = 0;
2353
+ if (!isLikeNone(fee_record)) {
2354
+ _assertClass(fee_record, RecordPlaintext$1);
2355
+ ptr2 = fee_record.__destroy_into_raw();
2356
+ }
2357
+ var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2358
+ var len3 = WASM_VECTOR_LEN;
2359
+ let ptr4 = 0;
2360
+ if (!isLikeNone(proving_key)) {
2361
+ _assertClass(proving_key, ProvingKey$1);
2362
+ ptr4 = proving_key.__destroy_into_raw();
2363
+ }
2364
+ let ptr5 = 0;
2365
+ if (!isLikeNone(verifying_key)) {
2366
+ _assertClass(verifying_key, VerifyingKey$1);
2367
+ ptr5 = verifying_key.__destroy_into_raw();
2368
+ }
2369
+ let ptr6 = 0;
2370
+ if (!isLikeNone(fee_proving_key)) {
2371
+ _assertClass(fee_proving_key, ProvingKey$1);
2372
+ ptr6 = fee_proving_key.__destroy_into_raw();
2373
+ }
2374
+ let ptr7 = 0;
2375
+ if (!isLikeNone(fee_verifying_key)) {
2376
+ _assertClass(fee_verifying_key, VerifyingKey$1);
2377
+ ptr7 = fee_verifying_key.__destroy_into_raw();
2378
+ }
2379
+ let ptr8 = 0;
2380
+ if (!isLikeNone(offline_query)) {
2381
+ _assertClass(offline_query, OfflineQuery$1);
2382
+ ptr8 = offline_query.__destroy_into_raw();
2383
+ }
2384
+ const ret = wasm.programmanager_buildExecutionTransaction(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), fee_credits, ptr2, ptr3, len3, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr4, ptr5, ptr6, ptr7, ptr8);
2385
+ return takeObject(ret);
2386
+ }
2387
+ /**
2388
+ * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
2389
+ * verifying keys will be stored in the ProgramManager's memory and used for subsequent
2390
+ * program executions.
2391
+ *
2392
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2393
+ *
2394
+ * @param private_key The private key of the sender
2395
+ * @param program The source code of the program to estimate the execution fee for
2396
+ * @param function The name of the function to execute
2397
+ * @param inputs A javascript array of inputs to the function
2398
+ * @param url The url of the Aleo network node to send the transaction to
2399
+ * @param imports (optional) Provide a list of imports to use for the fee estimation in the
2400
+ * form of a javascript object where the keys are a string of the program name and the values
2401
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2402
+ * @param proving_key (optional) Provide a verifying key to use for the fee estimation
2403
+ * @param verifying_key (optional) Provide a verifying key to use for the fee estimation
2404
+ * @returns {u64 | Error} Fee in microcredits
2405
+ * @param {PrivateKey} private_key
2406
+ * @param {string} program
2407
+ * @param {string} _function
2408
+ * @param {Array<any>} inputs
2409
+ * @param {string | undefined} [url]
2410
+ * @param {object | undefined} [imports]
2411
+ * @param {ProvingKey | undefined} [proving_key]
2412
+ * @param {VerifyingKey | undefined} [verifying_key]
2413
+ * @param {OfflineQuery | undefined} [offline_query]
2414
+ * @returns {Promise<bigint>}
2415
+ */
2416
+ static estimateExecutionFee(private_key, program, _function, inputs, url, imports, proving_key, verifying_key, offline_query) {
2417
+ _assertClass(private_key, PrivateKey$1);
2418
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2419
+ const len0 = WASM_VECTOR_LEN;
2420
+ const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2421
+ const len1 = WASM_VECTOR_LEN;
2422
+ var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2423
+ var len2 = WASM_VECTOR_LEN;
2424
+ let ptr3 = 0;
2425
+ if (!isLikeNone(proving_key)) {
2426
+ _assertClass(proving_key, ProvingKey$1);
2427
+ ptr3 = proving_key.__destroy_into_raw();
2428
+ }
2429
+ let ptr4 = 0;
2430
+ if (!isLikeNone(verifying_key)) {
2431
+ _assertClass(verifying_key, VerifyingKey$1);
2432
+ ptr4 = verifying_key.__destroy_into_raw();
2433
+ }
2434
+ let ptr5 = 0;
2435
+ if (!isLikeNone(offline_query)) {
2436
+ _assertClass(offline_query, OfflineQuery$1);
2437
+ ptr5 = offline_query.__destroy_into_raw();
2438
+ }
2439
+ const ret = wasm.programmanager_estimateExecutionFee(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
2440
+ return takeObject(ret);
2441
+ }
2442
+ /**
2443
+ * Estimate the finalize fee component for executing a function. This fee is additional to the
2444
+ * size of the execution of the program in bytes. If the function does not have a finalize
2445
+ * step, then the finalize fee is 0.
2446
+ *
2447
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2448
+ *
2449
+ * @param program The program containing the function to estimate the finalize fee for
2450
+ * @param function The function to estimate the finalize fee for
2451
+ * @returns {u64 | Error} Fee in microcredits
2452
+ * @param {string} program
2453
+ * @param {string} _function
2454
+ * @returns {bigint}
2455
+ */
2456
+ static estimateFinalizeFee(program, _function) {
2457
+ try {
2458
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2459
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2460
+ const len0 = WASM_VECTOR_LEN;
2461
+ const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2462
+ const len1 = WASM_VECTOR_LEN;
2463
+ wasm.programmanager_estimateFinalizeFee(retptr, ptr0, len0, ptr1, len1);
2464
+ var r0 = getBigInt64Memory0()[retptr / 8 + 0];
2465
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2466
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2467
+ if (r3) {
2468
+ throw takeObject(r2);
2469
+ }
2470
+ return BigInt.asUintN(64, r0);
2471
+ } finally {
2472
+ wasm.__wbindgen_add_to_stack_pointer(16);
2473
+ }
2474
+ }
2475
+ /**
2476
+ * Join two records together to create a new record with an amount of credits equal to the sum
2477
+ * of the credits of the two original records
2478
+ *
2479
+ * @param private_key The private key of the sender
2480
+ * @param record_1 The first record to combine
2481
+ * @param record_2 The second record to combine
2482
+ * @param fee_credits The amount of credits to pay as a fee
2483
+ * @param fee_record The record to spend the fee from
2484
+ * @param url The url of the Aleo network node to send the transaction to
2485
+ * @param join_proving_key (optional) Provide a proving key to use for the join function
2486
+ * @param join_verifying_key (optional) Provide a verifying key to use for the join function
2487
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2488
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2489
+ * @returns {Transaction | Error} Transaction object
2490
+ * @param {PrivateKey} private_key
2491
+ * @param {RecordPlaintext} record_1
2492
+ * @param {RecordPlaintext} record_2
2493
+ * @param {number} fee_credits
2494
+ * @param {RecordPlaintext | undefined} [fee_record]
2495
+ * @param {string | undefined} [url]
2496
+ * @param {ProvingKey | undefined} [join_proving_key]
2497
+ * @param {VerifyingKey | undefined} [join_verifying_key]
2498
+ * @param {ProvingKey | undefined} [fee_proving_key]
2499
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2500
+ * @param {OfflineQuery | undefined} [offline_query]
2501
+ * @returns {Promise<Transaction>}
2502
+ */
2503
+ static buildJoinTransaction(private_key, record_1, record_2, fee_credits, fee_record, url, join_proving_key, join_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2504
+ _assertClass(private_key, PrivateKey$1);
2505
+ _assertClass(record_1, RecordPlaintext$1);
2506
+ var ptr0 = record_1.__destroy_into_raw();
2507
+ _assertClass(record_2, RecordPlaintext$1);
2508
+ var ptr1 = record_2.__destroy_into_raw();
2509
+ let ptr2 = 0;
2510
+ if (!isLikeNone(fee_record)) {
2511
+ _assertClass(fee_record, RecordPlaintext$1);
2512
+ ptr2 = fee_record.__destroy_into_raw();
2513
+ }
2514
+ var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2515
+ var len3 = WASM_VECTOR_LEN;
2516
+ let ptr4 = 0;
2517
+ if (!isLikeNone(join_proving_key)) {
2518
+ _assertClass(join_proving_key, ProvingKey$1);
2519
+ ptr4 = join_proving_key.__destroy_into_raw();
2520
+ }
2521
+ let ptr5 = 0;
2522
+ if (!isLikeNone(join_verifying_key)) {
2523
+ _assertClass(join_verifying_key, VerifyingKey$1);
2524
+ ptr5 = join_verifying_key.__destroy_into_raw();
2525
+ }
2526
+ let ptr6 = 0;
2527
+ if (!isLikeNone(fee_proving_key)) {
2528
+ _assertClass(fee_proving_key, ProvingKey$1);
2529
+ ptr6 = fee_proving_key.__destroy_into_raw();
2530
+ }
2531
+ let ptr7 = 0;
2532
+ if (!isLikeNone(fee_verifying_key)) {
2533
+ _assertClass(fee_verifying_key, VerifyingKey$1);
2534
+ ptr7 = fee_verifying_key.__destroy_into_raw();
2535
+ }
2536
+ let ptr8 = 0;
2537
+ if (!isLikeNone(offline_query)) {
2538
+ _assertClass(offline_query, OfflineQuery$1);
2539
+ ptr8 = offline_query.__destroy_into_raw();
2540
+ }
2541
+ const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
2542
+ return takeObject(ret);
2543
+ }
2544
+ /**
2545
+ * Split an Aleo credits record into two separate records. This function does not require a fee.
2546
+ *
2547
+ * @param private_key The private key of the sender
2548
+ * @param split_amount The amount of the credit split. This amount will be subtracted from the
2549
+ * value of the record and two new records will be created with the split amount and the remainder
2550
+ * @param amount_record The record to split
2551
+ * @param url The url of the Aleo network node to send the transaction to
2552
+ * @param split_proving_key (optional) Provide a proving key to use for the split function
2553
+ * @param split_verifying_key (optional) Provide a verifying key to use for the split function
2554
+ * @returns {Transaction | Error} Transaction object
2555
+ * @param {PrivateKey} private_key
2556
+ * @param {number} split_amount
2557
+ * @param {RecordPlaintext} amount_record
2558
+ * @param {string | undefined} [url]
2559
+ * @param {ProvingKey | undefined} [split_proving_key]
2560
+ * @param {VerifyingKey | undefined} [split_verifying_key]
2561
+ * @param {OfflineQuery | undefined} [offline_query]
2562
+ * @returns {Promise<Transaction>}
2563
+ */
2564
+ static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, offline_query) {
2565
+ _assertClass(private_key, PrivateKey$1);
2566
+ _assertClass(amount_record, RecordPlaintext$1);
2567
+ var ptr0 = amount_record.__destroy_into_raw();
2568
+ var ptr1 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2569
+ var len1 = WASM_VECTOR_LEN;
2570
+ let ptr2 = 0;
2571
+ if (!isLikeNone(split_proving_key)) {
2572
+ _assertClass(split_proving_key, ProvingKey$1);
2573
+ ptr2 = split_proving_key.__destroy_into_raw();
2574
+ }
2575
+ let ptr3 = 0;
2576
+ if (!isLikeNone(split_verifying_key)) {
2577
+ _assertClass(split_verifying_key, VerifyingKey$1);
2578
+ ptr3 = split_verifying_key.__destroy_into_raw();
2579
+ }
2580
+ let ptr4 = 0;
2581
+ if (!isLikeNone(offline_query)) {
2582
+ _assertClass(offline_query, OfflineQuery$1);
2583
+ ptr4 = offline_query.__destroy_into_raw();
2584
+ }
2585
+ const ret = wasm.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
2586
+ return takeObject(ret);
2587
+ }
2588
+ /**
2589
+ * Send credits from one Aleo account to another
2590
+ *
2591
+ * @param private_key The private key of the sender
2592
+ * @param amount_credits The amount of credits to send
2593
+ * @param recipient The recipient of the transaction
2594
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2595
+ * @param amount_record The record to fund the amount from
2596
+ * @param fee_credits The amount of credits to pay as a fee
2597
+ * @param fee_record The record to spend the fee from
2598
+ * @param url The url of the Aleo network node to send the transaction to
2599
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2600
+ * function
2601
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2602
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2603
+ * @returns {Transaction | Error}
2604
+ * @param {PrivateKey} private_key
2605
+ * @param {number} amount_credits
2606
+ * @param {string} recipient
2607
+ * @param {string} transfer_type
2608
+ * @param {string | undefined} caller
2609
+ * @param {RecordPlaintext | undefined} amount_record
2610
+ * @param {number} fee_credits
2611
+ * @param {RecordPlaintext | undefined} [fee_record]
2612
+ * @param {string | undefined} [url]
2613
+ * @param {ProvingKey | undefined} [transfer_proving_key]
2614
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
2615
+ * @param {ProvingKey | undefined} [fee_proving_key]
2616
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2617
+ * @param {OfflineQuery | undefined} [offline_query]
2618
+ * @returns {Promise<Transaction>}
2619
+ */
2620
+ static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, caller, amount_record, fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2621
+ _assertClass(private_key, PrivateKey$1);
2622
+ const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2623
+ const len0 = WASM_VECTOR_LEN;
2624
+ const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2625
+ const len1 = WASM_VECTOR_LEN;
2626
+ var ptr2 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2627
+ var len2 = WASM_VECTOR_LEN;
2628
+ let ptr3 = 0;
2629
+ if (!isLikeNone(amount_record)) {
2630
+ _assertClass(amount_record, RecordPlaintext$1);
2631
+ ptr3 = amount_record.__destroy_into_raw();
2632
+ }
2633
+ let ptr4 = 0;
2634
+ if (!isLikeNone(fee_record)) {
2635
+ _assertClass(fee_record, RecordPlaintext$1);
2636
+ ptr4 = fee_record.__destroy_into_raw();
2637
+ }
2638
+ var ptr5 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2639
+ var len5 = WASM_VECTOR_LEN;
2640
+ let ptr6 = 0;
2641
+ if (!isLikeNone(transfer_proving_key)) {
2642
+ _assertClass(transfer_proving_key, ProvingKey$1);
2643
+ ptr6 = transfer_proving_key.__destroy_into_raw();
2644
+ }
2645
+ let ptr7 = 0;
2646
+ if (!isLikeNone(transfer_verifying_key)) {
2647
+ _assertClass(transfer_verifying_key, VerifyingKey$1);
2648
+ ptr7 = transfer_verifying_key.__destroy_into_raw();
2649
+ }
2650
+ let ptr8 = 0;
2651
+ if (!isLikeNone(fee_proving_key)) {
2652
+ _assertClass(fee_proving_key, ProvingKey$1);
2653
+ ptr8 = fee_proving_key.__destroy_into_raw();
2654
+ }
2655
+ let ptr9 = 0;
2656
+ if (!isLikeNone(fee_verifying_key)) {
2657
+ _assertClass(fee_verifying_key, VerifyingKey$1);
2658
+ ptr9 = fee_verifying_key.__destroy_into_raw();
2659
+ }
2660
+ let ptr10 = 0;
2661
+ if (!isLikeNone(offline_query)) {
2662
+ _assertClass(offline_query, OfflineQuery$1);
2663
+ ptr10 = offline_query.__destroy_into_raw();
2664
+ }
2665
+ const ret = wasm.programmanager_buildTransferTransaction(private_key.__wbg_ptr, amount_credits, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, fee_credits, ptr4, ptr5, len5, ptr6, ptr7, ptr8, ptr9, ptr10);
2666
+ return takeObject(ret);
2667
+ }
2668
+ /**
2669
+ * Synthesize proving and verifying keys for a program
2670
+ *
2671
+ * @param program {string} The program source code of the program to synthesize keys for
2672
+ * @param function_id {string} The function to synthesize keys for
2673
+ * @param inputs {Array} The inputs to the function
2674
+ * @param imports {Object | undefined} The imports for the program
2675
+ * @param {PrivateKey} private_key
2676
+ * @param {string} program
2677
+ * @param {string} function_id
2678
+ * @param {Array<any>} inputs
2679
+ * @param {object | undefined} [imports]
2680
+ * @returns {Promise<KeyPair>}
2681
+ */
2682
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports) {
2683
+ _assertClass(private_key, PrivateKey$1);
2684
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2685
+ const len0 = WASM_VECTOR_LEN;
2686
+ const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2687
+ const len1 = WASM_VECTOR_LEN;
2688
+ const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
2689
+ return takeObject(ret);
2690
+ }
2691
+ };
2692
+
2693
+ const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
2694
+ ? { register: () => {}, unregister: () => {} }
2695
+ : new FinalizationRegistry(ptr => wasm.__wbg_provingkey_free(ptr >>> 0));
2696
+ /**
2697
+ * Proving key for a function within an Aleo program
2698
+ */
2699
+ let ProvingKey$1 = class ProvingKey {
2700
+
2701
+ static __wrap(ptr) {
2702
+ ptr = ptr >>> 0;
2703
+ const obj = Object.create(ProvingKey.prototype);
2704
+ obj.__wbg_ptr = ptr;
2705
+ ProvingKeyFinalization.register(obj, obj.__wbg_ptr, obj);
2706
+ return obj;
2707
+ }
2708
+
2709
+ __destroy_into_raw() {
2710
+ const ptr = this.__wbg_ptr;
2711
+ this.__wbg_ptr = 0;
2712
+ ProvingKeyFinalization.unregister(this);
2713
+ return ptr;
2714
+ }
2715
+
2716
+ free() {
2717
+ const ptr = this.__destroy_into_raw();
2718
+ wasm.__wbg_provingkey_free(ptr);
2719
+ }
2720
+ /**
2721
+ * Verify if the proving key is for the bond_public function
2722
+ *
2723
+ * @example
2724
+ * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
2725
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2726
+ *
2727
+ * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
2728
+ * @returns {boolean}
2729
+ */
2730
+ isBondPublicProver() {
2731
+ const ret = wasm.provingkey_isBondPublicProver(this.__wbg_ptr);
2732
+ return ret !== 0;
2733
+ }
2734
+ /**
2735
+ * Verify if the proving key is for the bond_validator function
2736
+ *
2737
+ * @example
2738
+ * const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
2739
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2740
+ *
2741
+ * @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
2742
+ * @returns {boolean}
2743
+ */
2744
+ isBondValidatorProver() {
2745
+ const ret = wasm.provingkey_isBondValidatorProver(this.__wbg_ptr);
2746
+ return ret !== 0;
2747
+ }
2748
+ /**
2749
+ * Verify if the proving key is for the claim_unbond function
2750
+ *
2751
+ * @example
2752
+ * const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
2753
+ * provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
2754
+ *
2755
+ * @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
2756
+ * @returns {boolean}
2757
+ */
2758
+ isClaimUnbondPublicProver() {
2759
+ const ret = wasm.provingkey_isClaimUnbondPublicProver(this.__wbg_ptr);
2760
+ return ret !== 0;
2761
+ }
2762
+ /**
2763
+ * Verify if the proving key is for the fee_private function
2764
+ *
2765
+ * @example
2766
+ * const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
2767
+ * provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
2768
+ *
2769
+ * @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
2770
+ * @returns {boolean}
2771
+ */
2772
+ isFeePrivateProver() {
2773
+ const ret = wasm.provingkey_isFeePrivateProver(this.__wbg_ptr);
2774
+ return ret !== 0;
2775
+ }
2776
+ /**
2777
+ * Verify if the proving key is for the fee_public function
2778
+ *
2779
+ * @example
2780
+ * const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
2781
+ * provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2782
+ *
2783
+ * @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
2784
+ * @returns {boolean}
2785
+ */
2786
+ isFeePublicProver() {
2787
+ const ret = wasm.provingkey_isFeePublicProver(this.__wbg_ptr);
2788
+ return ret !== 0;
2789
+ }
2790
+ /**
2791
+ * Verify if the proving key is for the inclusion function
2792
+ *
2793
+ * @example
2794
+ * const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
2795
+ * provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
2796
+ *
2797
+ * @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
2798
+ * @returns {boolean}
2799
+ */
2800
+ isInclusionProver() {
2801
+ const ret = wasm.provingkey_isInclusionProver(this.__wbg_ptr);
2802
+ return ret !== 0;
2803
+ }
2804
+ /**
2805
+ * Verify if the proving key is for the join function
2806
+ *
2807
+ * @example
2808
+ * const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
2809
+ * provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
2810
+ *
2811
+ * @returns {boolean} returns true if the proving key is for the join function, false if otherwise
2812
+ * @returns {boolean}
2813
+ */
2814
+ isJoinProver() {
2815
+ const ret = wasm.provingkey_isJoinProver(this.__wbg_ptr);
2816
+ return ret !== 0;
2817
+ }
2818
+ /**
2819
+ * Verify if the proving key is for the set_validator_state function
2820
+ *
2821
+ * @example
2822
+ * const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
2823
+ * provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
2824
+ *
2825
+ * @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
2826
+ * @returns {boolean}
2827
+ */
2828
+ isSetValidatorStateProver() {
2829
+ const ret = wasm.provingkey_isSetValidatorStateProver(this.__wbg_ptr);
2830
+ return ret !== 0;
2831
+ }
2832
+ /**
2833
+ * Verify if the proving key is for the split function
2834
+ *
2835
+ * @example
2836
+ * const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
2837
+ * provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
2838
+ *
2839
+ * @returns {boolean} returns true if the proving key is for the split function, false if otherwise
2840
+ * @returns {boolean}
2841
+ */
2842
+ isSplitProver() {
2843
+ const ret = wasm.provingkey_isSplitProver(this.__wbg_ptr);
2844
+ return ret !== 0;
2845
+ }
2846
+ /**
2847
+ * Verify if the proving key is for the transfer_private function
2848
+ *
2849
+ * @example
2850
+ * const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
2851
+ * provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
2852
+ *
2853
+ * @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
2854
+ * @returns {boolean}
2855
+ */
2856
+ isTransferPrivateProver() {
2857
+ const ret = wasm.provingkey_isTransferPrivateProver(this.__wbg_ptr);
2858
+ return ret !== 0;
2859
+ }
2860
+ /**
2861
+ * Verify if the proving key is for the transfer_private_to_public function
2862
+ *
2863
+ * @example
2864
+ * const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
2865
+ * provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2866
+ *
2867
+ * @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
2868
+ * @returns {boolean}
2869
+ */
2870
+ isTransferPrivateToPublicProver() {
2871
+ const ret = wasm.provingkey_isTransferPrivateToPublicProver(this.__wbg_ptr);
2872
+ return ret !== 0;
2873
+ }
2874
+ /**
2875
+ * Verify if the proving key is for the transfer_public function
2876
+ *
2877
+ * @example
2878
+ * const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
2879
+ * provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2880
+ *
2881
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
2882
+ * @returns {boolean}
2883
+ */
2884
+ isTransferPublicProver() {
2885
+ const ret = wasm.provingkey_isTransferPublicProver(this.__wbg_ptr);
2886
+ return ret !== 0;
2887
+ }
2888
+ /**
2889
+ * Verify if the proving key is for the transfer_public_as_signer function
2890
+ *
2891
+ * @example
2892
+ * const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
2893
+ * provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
2894
+ *
2895
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
2896
+ * @returns {boolean}
2897
+ */
2898
+ isTransferPublicAsSignerProver() {
2899
+ const ret = wasm.provingkey_isTransferPublicAsSignerProver(this.__wbg_ptr);
2900
+ return ret !== 0;
2901
+ }
2902
+ /**
2903
+ * Verify if the proving key is for the transfer_public_to_private function
2904
+ *
2905
+ * @example
2906
+ * const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
2907
+ * provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
2908
+ *
2909
+ * @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
2910
+ * @returns {boolean}
2911
+ */
2912
+ isTransferPublicToPrivateProver() {
2913
+ const ret = wasm.provingkey_isTransferPublicToPrivateProver(this.__wbg_ptr);
2914
+ return ret !== 0;
2915
+ }
2916
+ /**
2917
+ * Verify if the proving key is for the unbond_public function
2918
+ *
2919
+ * @example
2920
+ * const provingKey = ProvingKey.fromBytes("unbond_public.bin");
2921
+ * provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2922
+ *
2923
+ * @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
2924
+ * @returns {boolean}
2925
+ */
2926
+ isUnbondPublicProver() {
2927
+ const ret = wasm.provingkey_isUnbondPublicProver(this.__wbg_ptr);
2928
+ return ret !== 0;
2929
+ }
2930
+ /**
2931
+ * Return the checksum of the proving key
2932
+ *
2933
+ * @returns {string} Checksum of the proving key
2934
+ * @returns {string}
2935
+ */
2936
+ checksum() {
2937
+ let deferred1_0;
2938
+ let deferred1_1;
2939
+ try {
2940
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2941
+ wasm.provingkey_checksum(retptr, this.__wbg_ptr);
2942
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2943
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2944
+ deferred1_0 = r0;
2945
+ deferred1_1 = r1;
2946
+ return getStringFromWasm0(r0, r1);
2947
+ } finally {
2948
+ wasm.__wbindgen_add_to_stack_pointer(16);
2949
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2950
+ }
2951
+ }
2952
+ /**
2953
+ * Create a copy of the proving key
2954
+ *
2955
+ * @returns {ProvingKey} A copy of the proving key
2956
+ * @returns {ProvingKey}
2957
+ */
2958
+ copy() {
2959
+ const ret = wasm.provingkey_copy(this.__wbg_ptr);
2960
+ return ProvingKey.__wrap(ret);
2961
+ }
2962
+ /**
2963
+ * Construct a new proving key from a byte array
2964
+ *
2965
+ * @param {Uint8Array} bytes Byte array representation of a proving key
2966
+ * @returns {ProvingKey | Error}
2967
+ * @param {Uint8Array} bytes
2968
+ * @returns {ProvingKey}
2969
+ */
2970
+ static fromBytes(bytes) {
2971
+ try {
2972
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2973
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
2974
+ const len0 = WASM_VECTOR_LEN;
2975
+ wasm.provingkey_fromBytes(retptr, ptr0, len0);
2976
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2977
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2978
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2979
+ if (r2) {
2980
+ throw takeObject(r1);
2981
+ }
2982
+ return ProvingKey.__wrap(r0);
2983
+ } finally {
2984
+ wasm.__wbindgen_add_to_stack_pointer(16);
2985
+ }
2986
+ }
2987
+ /**
2988
+ * Create a proving key from string
2989
+ *
2990
+ * @param {string | Error} String representation of the proving key
2991
+ * @param {string} string
2992
+ * @returns {ProvingKey}
2993
+ */
2994
+ static fromString(string) {
2995
+ try {
2996
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2997
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2998
+ const len0 = WASM_VECTOR_LEN;
2999
+ wasm.provingkey_fromString(retptr, ptr0, len0);
3000
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3001
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3002
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3003
+ if (r2) {
3004
+ throw takeObject(r1);
3005
+ }
3006
+ return ProvingKey.__wrap(r0);
3007
+ } finally {
3008
+ wasm.__wbindgen_add_to_stack_pointer(16);
3009
+ }
3010
+ }
3011
+ /**
3012
+ * Return the byte representation of a proving key
3013
+ *
3014
+ * @returns {Uint8Array | Error} Byte array representation of a proving key
3015
+ * @returns {Uint8Array}
3016
+ */
3017
+ toBytes() {
3018
+ try {
3019
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3020
+ wasm.provingkey_toBytes(retptr, this.__wbg_ptr);
3021
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3022
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3023
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3024
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3025
+ if (r3) {
3026
+ throw takeObject(r2);
3027
+ }
3028
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3029
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3030
+ return v1;
3031
+ } finally {
3032
+ wasm.__wbindgen_add_to_stack_pointer(16);
3033
+ }
3034
+ }
3035
+ /**
3036
+ * Get a string representation of the proving key
3037
+ *
3038
+ * @returns {string} String representation of the proving key
3039
+ * @returns {string}
3040
+ */
3041
+ toString() {
3042
+ let deferred1_0;
3043
+ let deferred1_1;
3044
+ try {
3045
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3046
+ wasm.provingkey_toString(retptr, this.__wbg_ptr);
3047
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3048
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3049
+ deferred1_0 = r0;
3050
+ deferred1_1 = r1;
3051
+ return getStringFromWasm0(r0, r1);
3052
+ } finally {
3053
+ wasm.__wbindgen_add_to_stack_pointer(16);
3054
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3055
+ }
3056
+ }
3057
+ };
3058
+
3059
+ const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
3060
+ ? { register: () => {}, unregister: () => {} }
3061
+ : new FinalizationRegistry(ptr => wasm.__wbg_recordciphertext_free(ptr >>> 0));
3062
+ /**
3063
+ * Encrypted Aleo record
3064
+ */
3065
+ let RecordCiphertext$1 = class RecordCiphertext {
3066
+
3067
+ static __wrap(ptr) {
3068
+ ptr = ptr >>> 0;
3069
+ const obj = Object.create(RecordCiphertext.prototype);
3070
+ obj.__wbg_ptr = ptr;
3071
+ RecordCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
3072
+ return obj;
3073
+ }
3074
+
3075
+ __destroy_into_raw() {
3076
+ const ptr = this.__wbg_ptr;
3077
+ this.__wbg_ptr = 0;
3078
+ RecordCiphertextFinalization.unregister(this);
3079
+ return ptr;
3080
+ }
3081
+
3082
+ free() {
3083
+ const ptr = this.__destroy_into_raw();
3084
+ wasm.__wbg_recordciphertext_free(ptr);
3085
+ }
3086
+ /**
3087
+ * Create a record ciphertext from a string
3088
+ *
3089
+ * @param {string} record String representation of a record ciphertext
3090
+ * @returns {RecordCiphertext | Error} Record ciphertext
3091
+ * @param {string} record
3092
+ * @returns {RecordCiphertext}
3093
+ */
3094
+ static fromString(record) {
3095
+ try {
3096
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3097
+ const ptr0 = passStringToWasm0(record, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3098
+ const len0 = WASM_VECTOR_LEN;
3099
+ wasm.recordciphertext_fromString(retptr, ptr0, len0);
3100
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3101
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3102
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3103
+ if (r2) {
3104
+ throw takeObject(r1);
3105
+ }
3106
+ return RecordCiphertext.__wrap(r0);
3107
+ } finally {
3108
+ wasm.__wbindgen_add_to_stack_pointer(16);
3109
+ }
3110
+ }
3111
+ /**
3112
+ * Return the string reprensentation of the record ciphertext
3113
+ *
3114
+ * @returns {string} String representation of the record ciphertext
3115
+ * @returns {string}
3116
+ */
3117
+ toString() {
3118
+ let deferred1_0;
3119
+ let deferred1_1;
3120
+ try {
3121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3122
+ wasm.recordciphertext_toString(retptr, this.__wbg_ptr);
3123
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3124
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3125
+ deferred1_0 = r0;
3126
+ deferred1_1 = r1;
3127
+ return getStringFromWasm0(r0, r1);
3128
+ } finally {
3129
+ wasm.__wbindgen_add_to_stack_pointer(16);
3130
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3131
+ }
3132
+ }
3133
+ /**
3134
+ * Decrypt the record ciphertext into plaintext using the view key. The record will only
3135
+ * decrypt if the record was encrypted by the account corresponding to the view key
3136
+ *
3137
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
3138
+ * @returns {RecordPlaintext | Error} Record plaintext object
3139
+ * @param {ViewKey} view_key
3140
+ * @returns {RecordPlaintext}
3141
+ */
3142
+ decrypt(view_key) {
3143
+ try {
3144
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3145
+ _assertClass(view_key, ViewKey$1);
3146
+ wasm.recordciphertext_decrypt(retptr, this.__wbg_ptr, view_key.__wbg_ptr);
3147
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3148
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3149
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3150
+ if (r2) {
3151
+ throw takeObject(r1);
3152
+ }
3153
+ return RecordPlaintext$1.__wrap(r0);
3154
+ } finally {
3155
+ wasm.__wbindgen_add_to_stack_pointer(16);
3156
+ }
3157
+ }
3158
+ /**
3159
+ * Determines if the account corresponding to the view key is the owner of the record
3160
+ *
3161
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
3162
+ * @returns {boolean}
3163
+ * @param {ViewKey} view_key
3164
+ * @returns {boolean}
3165
+ */
3166
+ isOwner(view_key) {
3167
+ _assertClass(view_key, ViewKey$1);
3168
+ const ret = wasm.recordciphertext_isOwner(this.__wbg_ptr, view_key.__wbg_ptr);
3169
+ return ret !== 0;
3170
+ }
3171
+ };
3172
+
3173
+ const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
3174
+ ? { register: () => {}, unregister: () => {} }
3175
+ : new FinalizationRegistry(ptr => wasm.__wbg_recordplaintext_free(ptr >>> 0));
3176
+ /**
3177
+ * Plaintext representation of an Aleo record
3178
+ */
3179
+ let RecordPlaintext$1 = class RecordPlaintext {
3180
+
3181
+ static __wrap(ptr) {
3182
+ ptr = ptr >>> 0;
3183
+ const obj = Object.create(RecordPlaintext.prototype);
3184
+ obj.__wbg_ptr = ptr;
3185
+ RecordPlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
3186
+ return obj;
3187
+ }
3188
+
3189
+ __destroy_into_raw() {
3190
+ const ptr = this.__wbg_ptr;
3191
+ this.__wbg_ptr = 0;
3192
+ RecordPlaintextFinalization.unregister(this);
3193
+ return ptr;
3194
+ }
3195
+
3196
+ free() {
3197
+ const ptr = this.__destroy_into_raw();
3198
+ wasm.__wbg_recordplaintext_free(ptr);
3199
+ }
3200
+ /**
3201
+ * @param {string} program_id
3202
+ * @param {string} record_name
3203
+ * @returns {Field}
3204
+ */
3205
+ commitment(program_id, record_name) {
3206
+ try {
3207
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3208
+ const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3209
+ const len0 = WASM_VECTOR_LEN;
3210
+ const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3211
+ const len1 = WASM_VECTOR_LEN;
3212
+ wasm.recordplaintext_commitment(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
3213
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3214
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3215
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3216
+ if (r2) {
3217
+ throw takeObject(r1);
3218
+ }
3219
+ return Field$1.__wrap(r0);
3220
+ } finally {
3221
+ wasm.__wbindgen_add_to_stack_pointer(16);
3222
+ }
3223
+ }
3224
+ /**
3225
+ * Return a record plaintext from a string.
3226
+ *
3227
+ * @param {string} record String representation of a plaintext representation of an Aleo record
3228
+ * @returns {RecordPlaintext | Error} Record plaintext
3229
+ * @param {string} record
3230
+ * @returns {RecordPlaintext}
3231
+ */
3232
+ static fromString(record) {
3233
+ try {
3234
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3235
+ const ptr0 = passStringToWasm0(record, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3236
+ const len0 = WASM_VECTOR_LEN;
3237
+ wasm.recordplaintext_fromString(retptr, ptr0, len0);
3238
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3239
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3240
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3241
+ if (r2) {
3242
+ throw takeObject(r1);
3243
+ }
3244
+ return RecordPlaintext.__wrap(r0);
3245
+ } finally {
3246
+ wasm.__wbindgen_add_to_stack_pointer(16);
3247
+ }
3248
+ }
3249
+ /**
3250
+ * Returns the record plaintext string
3251
+ *
3252
+ * @returns {string} String representation of the record plaintext
3253
+ * @returns {string}
3254
+ */
3255
+ toString() {
3256
+ let deferred1_0;
3257
+ let deferred1_1;
3258
+ try {
3259
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3260
+ wasm.recordplaintext_toString(retptr, this.__wbg_ptr);
3261
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3262
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3263
+ deferred1_0 = r0;
3264
+ deferred1_1 = r1;
3265
+ return getStringFromWasm0(r0, r1);
3266
+ } finally {
3267
+ wasm.__wbindgen_add_to_stack_pointer(16);
3268
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3269
+ }
3270
+ }
3271
+ /**
3272
+ * Returns the amount of microcredits in the record
3273
+ *
3274
+ * @returns {u64} Amount of microcredits in the record
3275
+ * @returns {bigint}
3276
+ */
3277
+ microcredits() {
3278
+ const ret = wasm.recordplaintext_microcredits(this.__wbg_ptr);
3279
+ return BigInt.asUintN(64, ret);
3280
+ }
3281
+ /**
3282
+ * Returns the nonce of the record. This can be used to uniquely identify a record.
3283
+ *
3284
+ * @returns {string} Nonce of the record
3285
+ * @returns {string}
3286
+ */
3287
+ nonce() {
3288
+ let deferred1_0;
3289
+ let deferred1_1;
3290
+ try {
3291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3292
+ wasm.recordplaintext_nonce(retptr, this.__wbg_ptr);
3293
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3294
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3295
+ deferred1_0 = r0;
3296
+ deferred1_1 = r1;
3297
+ return getStringFromWasm0(r0, r1);
3298
+ } finally {
3299
+ wasm.__wbindgen_add_to_stack_pointer(16);
3300
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3301
+ }
3302
+ }
3303
+ /**
3304
+ * Attempt to get the serial number of a record to determine whether or not is has been spent
3305
+ *
3306
+ * @param {PrivateKey} private_key Private key of the account that owns the record
3307
+ * @param {string} program_id Program ID of the program that the record is associated with
3308
+ * @param {string} record_name Name of the record
3309
+ * @returns {string | Error} Serial number of the record
3310
+ * @param {PrivateKey} private_key
3311
+ * @param {string} program_id
3312
+ * @param {string} record_name
3313
+ * @returns {string}
3314
+ */
3315
+ serialNumberString(private_key, program_id, record_name) {
3316
+ let deferred4_0;
3317
+ let deferred4_1;
3318
+ try {
3319
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3320
+ _assertClass(private_key, PrivateKey$1);
3321
+ const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3322
+ const len0 = WASM_VECTOR_LEN;
3323
+ const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3324
+ const len1 = WASM_VECTOR_LEN;
3325
+ wasm.recordplaintext_serialNumberString(retptr, this.__wbg_ptr, private_key.__wbg_ptr, ptr0, len0, ptr1, len1);
3326
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3327
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3328
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3329
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3330
+ var ptr3 = r0;
3331
+ var len3 = r1;
3332
+ if (r3) {
3333
+ ptr3 = 0; len3 = 0;
3334
+ throw takeObject(r2);
3335
+ }
3336
+ deferred4_0 = ptr3;
3337
+ deferred4_1 = len3;
3338
+ return getStringFromWasm0(ptr3, len3);
3339
+ } finally {
3340
+ wasm.__wbindgen_add_to_stack_pointer(16);
3341
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3342
+ }
3343
+ }
3344
+ };
3345
+
3346
+ const SignatureFinalization = (typeof FinalizationRegistry === 'undefined')
3347
+ ? { register: () => {}, unregister: () => {} }
3348
+ : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0));
3349
+ /**
3350
+ * Cryptographic signature of a message signed by an Aleo account
3351
+ */
3352
+ let Signature$1 = class Signature {
3353
+
3354
+ static __wrap(ptr) {
3355
+ ptr = ptr >>> 0;
3356
+ const obj = Object.create(Signature.prototype);
3357
+ obj.__wbg_ptr = ptr;
3358
+ SignatureFinalization.register(obj, obj.__wbg_ptr, obj);
3359
+ return obj;
3360
+ }
3361
+
3362
+ __destroy_into_raw() {
3363
+ const ptr = this.__wbg_ptr;
3364
+ this.__wbg_ptr = 0;
3365
+ SignatureFinalization.unregister(this);
3366
+ return ptr;
3367
+ }
3368
+
3369
+ free() {
3370
+ const ptr = this.__destroy_into_raw();
3371
+ wasm.__wbg_signature_free(ptr);
3372
+ }
3373
+ /**
3374
+ * Sign a message with a private key
3375
+ *
3376
+ * @param {PrivateKey} private_key The private key to sign the message with
3377
+ * @param {Uint8Array} message Byte representation of the message to sign
3378
+ * @returns {Signature} Signature of the message
3379
+ * @param {PrivateKey} private_key
3380
+ * @param {Uint8Array} message
3381
+ * @returns {Signature}
3382
+ */
3383
+ static sign(private_key, message) {
3384
+ _assertClass(private_key, PrivateKey$1);
3385
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
3386
+ const len0 = WASM_VECTOR_LEN;
3387
+ const ret = wasm.privatekey_sign(private_key.__wbg_ptr, ptr0, len0);
3388
+ return Signature.__wrap(ret);
3389
+ }
3390
+ /**
3391
+ * @param {PrivateKey} private_key
3392
+ * @param {Uint8Array} message
3393
+ * @param {Uint8Array} seed
3394
+ * @returns {Signature}
3395
+ */
3396
+ static sign_message(private_key, message, seed) {
3397
+ _assertClass(private_key, PrivateKey$1);
3398
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
3399
+ const len0 = WASM_VECTOR_LEN;
3400
+ const ptr1 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
3401
+ const len1 = WASM_VECTOR_LEN;
3402
+ const ret = wasm.signature_sign_message(private_key.__wbg_ptr, ptr0, len0, ptr1, len1);
3403
+ return Signature.__wrap(ret);
3404
+ }
3405
+ /**
3406
+ * Ignore the mess below -- me testing things
3407
+ * Turn a message into bits
3408
+ *
3409
+ * @param {Uint8Array} message Byte representation of the message to sign
3410
+ * @returns {Vec<bool>} Vec of bool of the message
3411
+ * Verify a signature of a message with an address
3412
+ *
3413
+ * @param {Address} address The address to verify the signature with
3414
+ * @param {Uint8Array} message Byte representation of the message to verify
3415
+ * @returns {boolean} True if the signature is valid, false otherwise
3416
+ * @param {Address} address
3417
+ * @param {Uint8Array} message
3418
+ * @returns {boolean}
3419
+ */
3420
+ verify(address, message) {
3421
+ _assertClass(address, Address$1);
3422
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
3423
+ const len0 = WASM_VECTOR_LEN;
3424
+ const ret = wasm.signature_verify(this.__wbg_ptr, address.__wbg_ptr, ptr0, len0);
3425
+ return ret !== 0;
3426
+ }
3427
+ /**
3428
+ * Get a signature from a string representation of a signature
3429
+ *
3430
+ * @param {string} signature String representation of a signature
3431
+ * @returns {Signature} Signature
3432
+ * @param {string} signature
3433
+ * @returns {Signature}
3434
+ */
3435
+ static from_string(signature) {
3436
+ const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3437
+ const len0 = WASM_VECTOR_LEN;
3438
+ const ret = wasm.signature_from_string(ptr0, len0);
3439
+ return Signature.__wrap(ret);
3440
+ }
3441
+ /**
3442
+ * Get a string representation of a signature
3443
+ *
3444
+ * @returns {string} String representation of a signature
3445
+ * @returns {string}
3446
+ */
3447
+ to_string() {
3448
+ let deferred1_0;
3449
+ let deferred1_1;
3450
+ try {
3451
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3452
+ wasm.signature_to_string(retptr, this.__wbg_ptr);
3453
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3454
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3455
+ deferred1_0 = r0;
3456
+ deferred1_1 = r1;
3457
+ return getStringFromWasm0(r0, r1);
3458
+ } finally {
3459
+ wasm.__wbindgen_add_to_stack_pointer(16);
3460
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3461
+ }
3462
+ }
3463
+ };
3464
+
3465
+ const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
3466
+ ? { register: () => {}, unregister: () => {} }
3467
+ : new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0));
3468
+ /**
3469
+ * Webassembly Representation of an Aleo transaction
3470
+ *
3471
+ * This object is created when generating an on-chain function deployment or execution and is the
3472
+ * object that should be submitted to the Aleo Network in order to deploy or execute a function.
3473
+ */
3474
+ let Transaction$1 = class Transaction {
3475
+
3476
+ static __wrap(ptr) {
3477
+ ptr = ptr >>> 0;
3478
+ const obj = Object.create(Transaction.prototype);
3479
+ obj.__wbg_ptr = ptr;
3480
+ TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
3481
+ return obj;
3482
+ }
3483
+
3484
+ __destroy_into_raw() {
3485
+ const ptr = this.__wbg_ptr;
3486
+ this.__wbg_ptr = 0;
3487
+ TransactionFinalization.unregister(this);
3488
+ return ptr;
3489
+ }
3490
+
3491
+ free() {
3492
+ const ptr = this.__destroy_into_raw();
3493
+ wasm.__wbg_transaction_free(ptr);
3494
+ }
3495
+ /**
3496
+ * Create a transaction from a string
3497
+ *
3498
+ * @param {string} transaction String representation of a transaction
3499
+ * @returns {Transaction | Error}
3500
+ * @param {string} transaction
3501
+ * @returns {Transaction}
3502
+ */
3503
+ static fromString(transaction) {
3504
+ try {
3505
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3506
+ const ptr0 = passStringToWasm0(transaction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3507
+ const len0 = WASM_VECTOR_LEN;
3508
+ wasm.transaction_fromString(retptr, ptr0, len0);
3509
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3510
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3511
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3512
+ if (r2) {
3513
+ throw takeObject(r1);
3514
+ }
3515
+ return Transaction.__wrap(r0);
3516
+ } finally {
3517
+ wasm.__wbindgen_add_to_stack_pointer(16);
3518
+ }
3519
+ }
3520
+ /**
3521
+ * Get the transaction as a string. If you want to submit this transaction to the Aleo Network
3522
+ * this function will create the string that should be submitted in the `POST` data.
3523
+ *
3524
+ * @returns {string} String representation of the transaction
3525
+ * @returns {string}
3526
+ */
3527
+ toString() {
3528
+ let deferred1_0;
3529
+ let deferred1_1;
3530
+ try {
3531
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3532
+ wasm.transaction_toString(retptr, this.__wbg_ptr);
3533
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3534
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3535
+ deferred1_0 = r0;
3536
+ deferred1_1 = r1;
3537
+ return getStringFromWasm0(r0, r1);
3538
+ } finally {
3539
+ wasm.__wbindgen_add_to_stack_pointer(16);
3540
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3541
+ }
3542
+ }
3543
+ /**
3544
+ * Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
3545
+ *
3546
+ * This value can be used to query the status of the transaction on the Aleo Network to see
3547
+ * if it was successful. If successful, the transaction will be included in a block and this
3548
+ * value can be used to lookup the transaction data on-chain.
3549
+ *
3550
+ * @returns {string} Transaction id
3551
+ * @returns {string}
3552
+ */
3553
+ transactionId() {
3554
+ let deferred1_0;
3555
+ let deferred1_1;
3556
+ try {
3557
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3558
+ wasm.transaction_transactionId(retptr, this.__wbg_ptr);
3559
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3560
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3561
+ deferred1_0 = r0;
3562
+ deferred1_1 = r1;
3563
+ return getStringFromWasm0(r0, r1);
3564
+ } finally {
3565
+ wasm.__wbindgen_add_to_stack_pointer(16);
3566
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3567
+ }
3568
+ }
3569
+ /**
3570
+ * Get the type of the transaction (will return "deploy" or "execute")
3571
+ *
3572
+ * @returns {string} Transaction type
3573
+ * @returns {string}
3574
+ */
3575
+ transactionType() {
3576
+ let deferred1_0;
3577
+ let deferred1_1;
3578
+ try {
3579
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3580
+ wasm.transaction_transactionType(retptr, this.__wbg_ptr);
3581
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3582
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3583
+ deferred1_0 = r0;
3584
+ deferred1_1 = r1;
3585
+ return getStringFromWasm0(r0, r1);
3586
+ } finally {
3587
+ wasm.__wbindgen_add_to_stack_pointer(16);
3588
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3589
+ }
3590
+ }
3591
+ };
3592
+
3593
+ const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
3594
+ ? { register: () => {}, unregister: () => {} }
3595
+ : new FinalizationRegistry(ptr => wasm.__wbg_verifyingkey_free(ptr >>> 0));
3596
+ /**
3597
+ * Verifying key for a function within an Aleo program
3598
+ */
3599
+ let VerifyingKey$1 = class VerifyingKey {
3600
+
3601
+ static __wrap(ptr) {
3602
+ ptr = ptr >>> 0;
3603
+ const obj = Object.create(VerifyingKey.prototype);
3604
+ obj.__wbg_ptr = ptr;
3605
+ VerifyingKeyFinalization.register(obj, obj.__wbg_ptr, obj);
3606
+ return obj;
3607
+ }
3608
+
3609
+ __destroy_into_raw() {
3610
+ const ptr = this.__wbg_ptr;
3611
+ this.__wbg_ptr = 0;
3612
+ VerifyingKeyFinalization.unregister(this);
3613
+ return ptr;
3614
+ }
3615
+
3616
+ free() {
3617
+ const ptr = this.__destroy_into_raw();
3618
+ wasm.__wbg_verifyingkey_free(ptr);
3619
+ }
3620
+ /**
3621
+ * Returns the verifying key for the bond_public function
3622
+ *
3623
+ * @returns {VerifyingKey} Verifying key for the bond_public function
3624
+ * @returns {VerifyingKey}
3625
+ */
3626
+ static bondPublicVerifier() {
3627
+ const ret = wasm.verifyingkey_bondPublicVerifier();
3628
+ return VerifyingKey.__wrap(ret);
3629
+ }
3630
+ /**
3631
+ * Returns the verifying key for the bond_validator function
3632
+ *
3633
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
3634
+ * @returns {VerifyingKey}
3635
+ */
3636
+ static bondValidatorVerifier() {
3637
+ const ret = wasm.verifyingkey_bondValidatorVerifier();
3638
+ return VerifyingKey.__wrap(ret);
3639
+ }
3640
+ /**
3641
+ * Returns the verifying key for the claim_delegator function
3642
+ *
3643
+ * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
3644
+ * @returns {VerifyingKey}
3645
+ */
3646
+ static claimUnbondPublicVerifier() {
3647
+ const ret = wasm.verifyingkey_claimUnbondPublicVerifier();
3648
+ return VerifyingKey.__wrap(ret);
3649
+ }
3650
+ /**
3651
+ * Returns the verifying key for the fee_private function
3652
+ *
3653
+ * @returns {VerifyingKey} Verifying key for the fee_private function
3654
+ * @returns {VerifyingKey}
3655
+ */
3656
+ static feePrivateVerifier() {
3657
+ const ret = wasm.verifyingkey_feePrivateVerifier();
3658
+ return VerifyingKey.__wrap(ret);
3659
+ }
3660
+ /**
3661
+ * Returns the verifying key for the fee_public function
3662
+ *
3663
+ * @returns {VerifyingKey} Verifying key for the fee_public function
3664
+ * @returns {VerifyingKey}
3665
+ */
3666
+ static feePublicVerifier() {
3667
+ const ret = wasm.verifyingkey_feePublicVerifier();
3668
+ return VerifyingKey.__wrap(ret);
3669
+ }
3670
+ /**
3671
+ * Returns the verifying key for the inclusion function
3672
+ *
3673
+ * @returns {VerifyingKey} Verifying key for the inclusion function
3674
+ * @returns {VerifyingKey}
3675
+ */
3676
+ static inclusionVerifier() {
3677
+ const ret = wasm.verifyingkey_inclusionVerifier();
3678
+ return VerifyingKey.__wrap(ret);
3679
+ }
3680
+ /**
3681
+ * Returns the verifying key for the join function
3682
+ *
3683
+ * @returns {VerifyingKey} Verifying key for the join function
3684
+ * @returns {VerifyingKey}
3685
+ */
3686
+ static joinVerifier() {
3687
+ const ret = wasm.verifyingkey_joinVerifier();
3688
+ return VerifyingKey.__wrap(ret);
3689
+ }
3690
+ /**
3691
+ * Returns the verifying key for the set_validator_state function
3692
+ *
3693
+ * @returns {VerifyingKey} Verifying key for the set_validator_state function
3694
+ * @returns {VerifyingKey}
3695
+ */
3696
+ static setValidatorStateVerifier() {
3697
+ const ret = wasm.verifyingkey_setValidatorStateVerifier();
3698
+ return VerifyingKey.__wrap(ret);
3699
+ }
3700
+ /**
3701
+ * Returns the verifying key for the split function
3702
+ *
3703
+ * @returns {VerifyingKey} Verifying key for the split function
3704
+ * @returns {VerifyingKey}
3705
+ */
3706
+ static splitVerifier() {
3707
+ const ret = wasm.verifyingkey_splitVerifier();
3708
+ return VerifyingKey.__wrap(ret);
3709
+ }
3710
+ /**
3711
+ * Returns the verifying key for the transfer_private function
3712
+ *
3713
+ * @returns {VerifyingKey} Verifying key for the transfer_private function
3714
+ * @returns {VerifyingKey}
3715
+ */
3716
+ static transferPrivateVerifier() {
3717
+ const ret = wasm.verifyingkey_transferPrivateVerifier();
3718
+ return VerifyingKey.__wrap(ret);
3719
+ }
3720
+ /**
3721
+ * Returns the verifying key for the transfer_private_to_public function
3722
+ *
3723
+ * @returns {VerifyingKey} Verifying key for the transfer_private_to_public function
3724
+ * @returns {VerifyingKey}
3725
+ */
3726
+ static transferPrivateToPublicVerifier() {
3727
+ const ret = wasm.verifyingkey_transferPrivateToPublicVerifier();
3728
+ return VerifyingKey.__wrap(ret);
3729
+ }
3730
+ /**
3731
+ * Returns the verifying key for the transfer_public function
3732
+ *
3733
+ * @returns {VerifyingKey} Verifying key for the transfer_public function
3734
+ * @returns {VerifyingKey}
3735
+ */
3736
+ static transferPublicVerifier() {
3737
+ const ret = wasm.verifyingkey_transferPublicVerifier();
3738
+ return VerifyingKey.__wrap(ret);
3739
+ }
3740
+ /**
3741
+ * Returns the verifying key for the transfer_public_as_signer function
3742
+ *
3743
+ * @returns {VerifyingKey} Verifying key for the transfer_public_as_signer function
3744
+ * @returns {VerifyingKey}
3745
+ */
3746
+ static transferPublicAsSignerVerifier() {
3747
+ const ret = wasm.verifyingkey_transferPublicAsSignerVerifier();
3748
+ return VerifyingKey.__wrap(ret);
3749
+ }
3750
+ /**
3751
+ * Returns the verifying key for the transfer_public_to_private function
3752
+ *
3753
+ * @returns {VerifyingKey} Verifying key for the transfer_public_to_private function
3754
+ * @returns {VerifyingKey}
3755
+ */
3756
+ static transferPublicToPrivateVerifier() {
3757
+ const ret = wasm.verifyingkey_transferPublicToPrivateVerifier();
3758
+ return VerifyingKey.__wrap(ret);
3759
+ }
3760
+ /**
3761
+ * Returns the verifying key for the unbond_public function
3762
+ *
3763
+ * @returns {VerifyingKey} Verifying key for the unbond_public function
3764
+ * @returns {VerifyingKey}
3765
+ */
3766
+ static unbondPublicVerifier() {
3767
+ const ret = wasm.verifyingkey_unbondPublicVerifier();
3768
+ return VerifyingKey.__wrap(ret);
3769
+ }
3770
+ /**
3771
+ * Returns the verifying key for the bond_public function
3772
+ *
3773
+ * @returns {VerifyingKey} Verifying key for the bond_public function
3774
+ * @returns {boolean}
3775
+ */
3776
+ isBondPublicVerifier() {
3777
+ const ret = wasm.verifyingkey_isBondPublicVerifier(this.__wbg_ptr);
3778
+ return ret !== 0;
3779
+ }
3780
+ /**
3781
+ * Returns the verifying key for the bond_validator function
3782
+ *
3783
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
3784
+ * @returns {boolean}
3785
+ */
3786
+ isBondValidatorVerifier() {
3787
+ const ret = wasm.verifyingkey_isBondValidatorVerifier(this.__wbg_ptr);
3788
+ return ret !== 0;
3789
+ }
3790
+ /**
3791
+ * Verifies the verifying key is for the claim_delegator function
3792
+ *
3793
+ * @returns {bool}
3794
+ * @returns {boolean}
3795
+ */
3796
+ isClaimUnbondPublicVerifier() {
3797
+ const ret = wasm.verifyingkey_isClaimUnbondPublicVerifier(this.__wbg_ptr);
3798
+ return ret !== 0;
3799
+ }
3800
+ /**
3801
+ * Verifies the verifying key is for the fee_private function
3802
+ *
3803
+ * @returns {bool}
3804
+ * @returns {boolean}
3805
+ */
3806
+ isFeePrivateVerifier() {
3807
+ const ret = wasm.verifyingkey_isFeePrivateVerifier(this.__wbg_ptr);
3808
+ return ret !== 0;
3809
+ }
3810
+ /**
3811
+ * Verifies the verifying key is for the fee_public function
3812
+ *
3813
+ * @returns {bool}
3814
+ * @returns {boolean}
3815
+ */
3816
+ isFeePublicVerifier() {
3817
+ const ret = wasm.verifyingkey_isFeePublicVerifier(this.__wbg_ptr);
3818
+ return ret !== 0;
3819
+ }
3820
+ /**
3821
+ * Verifies the verifying key is for the inclusion function
3822
+ *
3823
+ * @returns {bool}
3824
+ * @returns {boolean}
3825
+ */
3826
+ isInclusionVerifier() {
3827
+ const ret = wasm.verifyingkey_isInclusionVerifier(this.__wbg_ptr);
3828
+ return ret !== 0;
3829
+ }
3830
+ /**
3831
+ * Verifies the verifying key is for the join function
3832
+ *
3833
+ * @returns {bool}
3834
+ * @returns {boolean}
3835
+ */
3836
+ isJoinVerifier() {
3837
+ const ret = wasm.verifyingkey_isJoinVerifier(this.__wbg_ptr);
3838
+ return ret !== 0;
3839
+ }
3840
+ /**
3841
+ * Verifies the verifying key is for the set_validator_state function
3842
+ *
3843
+ * @returns {bool}
3844
+ * @returns {boolean}
3845
+ */
3846
+ isSetValidatorStateVerifier() {
3847
+ const ret = wasm.verifyingkey_isSetValidatorStateVerifier(this.__wbg_ptr);
3848
+ return ret !== 0;
3849
+ }
3850
+ /**
3851
+ * Verifies the verifying key is for the split function
3852
+ *
3853
+ * @returns {bool}
3854
+ * @returns {boolean}
3855
+ */
3856
+ isSplitVerifier() {
3857
+ const ret = wasm.verifyingkey_isSplitVerifier(this.__wbg_ptr);
3858
+ return ret !== 0;
3859
+ }
3860
+ /**
3861
+ * Verifies the verifying key is for the transfer_private function
3862
+ *
3863
+ * @returns {bool}
3864
+ * @returns {boolean}
3865
+ */
3866
+ isTransferPrivateVerifier() {
3867
+ const ret = wasm.verifyingkey_isTransferPrivateVerifier(this.__wbg_ptr);
3868
+ return ret !== 0;
3869
+ }
3870
+ /**
3871
+ * Verifies the verifying key is for the transfer_private_to_public function
3872
+ *
3873
+ * @returns {bool}
3874
+ * @returns {boolean}
3875
+ */
3876
+ isTransferPrivateToPublicVerifier() {
3877
+ const ret = wasm.verifyingkey_isTransferPrivateToPublicVerifier(this.__wbg_ptr);
3878
+ return ret !== 0;
3879
+ }
3880
+ /**
3881
+ * Verifies the verifying key is for the transfer_public function
3882
+ *
3883
+ * @returns {bool}
3884
+ * @returns {boolean}
3885
+ */
3886
+ isTransferPublicVerifier() {
3887
+ const ret = wasm.verifyingkey_isTransferPublicVerifier(this.__wbg_ptr);
3888
+ return ret !== 0;
3889
+ }
3890
+ /**
3891
+ * Verifies the verifying key is for the transfer_public_as_signer function
3892
+ *
3893
+ * @returns {bool}
3894
+ * @returns {boolean}
3895
+ */
3896
+ isTransferPublicAsSignerVerifier() {
3897
+ const ret = wasm.verifyingkey_isTransferPublicAsSignerVerifier(this.__wbg_ptr);
3898
+ return ret !== 0;
3899
+ }
3900
+ /**
3901
+ * Verifies the verifying key is for the transfer_public_to_private function
3902
+ *
3903
+ * @returns {bool}
3904
+ * @returns {boolean}
3905
+ */
3906
+ isTransferPublicToPrivateVerifier() {
3907
+ const ret = wasm.verifyingkey_isTransferPublicToPrivateVerifier(this.__wbg_ptr);
3908
+ return ret !== 0;
3909
+ }
3910
+ /**
3911
+ * Verifies the verifying key is for the unbond_public function
3912
+ *
3913
+ * @returns {bool}
3914
+ * @returns {boolean}
3915
+ */
3916
+ isUnbondPublicVerifier() {
3917
+ const ret = wasm.verifyingkey_isUnbondPublicVerifier(this.__wbg_ptr);
3918
+ return ret !== 0;
3919
+ }
3920
+ /**
3921
+ * Get the checksum of the verifying key
3922
+ *
3923
+ * @returns {string} Checksum of the verifying key
3924
+ * @returns {string}
3925
+ */
3926
+ checksum() {
3927
+ let deferred1_0;
3928
+ let deferred1_1;
3929
+ try {
3930
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3931
+ wasm.verifyingkey_checksum(retptr, this.__wbg_ptr);
3932
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3933
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3934
+ deferred1_0 = r0;
3935
+ deferred1_1 = r1;
3936
+ return getStringFromWasm0(r0, r1);
3937
+ } finally {
3938
+ wasm.__wbindgen_add_to_stack_pointer(16);
3939
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3940
+ }
3941
+ }
3942
+ /**
3943
+ * Create a copy of the verifying key
3944
+ *
3945
+ * @returns {VerifyingKey} A copy of the verifying key
3946
+ * @returns {VerifyingKey}
3947
+ */
3948
+ copy() {
3949
+ const ret = wasm.verifyingkey_copy(this.__wbg_ptr);
3950
+ return VerifyingKey.__wrap(ret);
3951
+ }
3952
+ /**
3953
+ * Construct a new verifying key from a byte array
3954
+ *
3955
+ * @param {Uint8Array} bytes Byte representation of a verifying key
3956
+ * @returns {VerifyingKey | Error}
3957
+ * @param {Uint8Array} bytes
3958
+ * @returns {VerifyingKey}
3959
+ */
3960
+ static fromBytes(bytes) {
3961
+ try {
3962
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3963
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
3964
+ const len0 = WASM_VECTOR_LEN;
3965
+ wasm.verifyingkey_fromBytes(retptr, ptr0, len0);
3966
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3967
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3968
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3969
+ if (r2) {
3970
+ throw takeObject(r1);
3971
+ }
3972
+ return VerifyingKey.__wrap(r0);
3973
+ } finally {
3974
+ wasm.__wbindgen_add_to_stack_pointer(16);
3975
+ }
3976
+ }
3977
+ /**
3978
+ * Create a verifying key from string
3979
+ *
3980
+ * @param {String} string String representation of a verifying key
3981
+ * @returns {VerifyingKey | Error}
3982
+ * @param {string} string
3983
+ * @returns {VerifyingKey}
3984
+ */
3985
+ static fromString(string) {
3986
+ try {
3987
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3988
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3989
+ const len0 = WASM_VECTOR_LEN;
3990
+ wasm.verifyingkey_fromString(retptr, ptr0, len0);
3991
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3992
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3993
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3994
+ if (r2) {
3995
+ throw takeObject(r1);
3996
+ }
3997
+ return VerifyingKey.__wrap(r0);
3998
+ } finally {
3999
+ wasm.__wbindgen_add_to_stack_pointer(16);
4000
+ }
4001
+ }
4002
+ /**
4003
+ * Create a byte array from a verifying key
4004
+ *
4005
+ * @returns {Uint8Array | Error} Byte representation of a verifying key
4006
+ * @returns {Uint8Array}
4007
+ */
4008
+ toBytes() {
4009
+ try {
4010
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4011
+ wasm.verifyingkey_toBytes(retptr, this.__wbg_ptr);
4012
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4013
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4014
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4015
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4016
+ if (r3) {
4017
+ throw takeObject(r2);
4018
+ }
4019
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4020
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
4021
+ return v1;
4022
+ } finally {
4023
+ wasm.__wbindgen_add_to_stack_pointer(16);
4024
+ }
4025
+ }
4026
+ /**
4027
+ * Get a string representation of the verifying key
4028
+ *
4029
+ * @returns {String} String representation of the verifying key
4030
+ * @returns {string}
4031
+ */
4032
+ toString() {
4033
+ let deferred1_0;
4034
+ let deferred1_1;
4035
+ try {
4036
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4037
+ wasm.verifyingkey_toString(retptr, this.__wbg_ptr);
4038
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4039
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4040
+ deferred1_0 = r0;
4041
+ deferred1_1 = r1;
4042
+ return getStringFromWasm0(r0, r1);
4043
+ } finally {
4044
+ wasm.__wbindgen_add_to_stack_pointer(16);
4045
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4046
+ }
4047
+ }
4048
+ };
4049
+
4050
+ const ViewKeyFinalization = (typeof FinalizationRegistry === 'undefined')
4051
+ ? { register: () => {}, unregister: () => {} }
4052
+ : new FinalizationRegistry(ptr => wasm.__wbg_viewkey_free(ptr >>> 0));
4053
+ /**
4054
+ */
4055
+ let ViewKey$1 = class ViewKey {
4056
+
4057
+ static __wrap(ptr) {
4058
+ ptr = ptr >>> 0;
4059
+ const obj = Object.create(ViewKey.prototype);
4060
+ obj.__wbg_ptr = ptr;
4061
+ ViewKeyFinalization.register(obj, obj.__wbg_ptr, obj);
4062
+ return obj;
4063
+ }
4064
+
4065
+ __destroy_into_raw() {
4066
+ const ptr = this.__wbg_ptr;
4067
+ this.__wbg_ptr = 0;
4068
+ ViewKeyFinalization.unregister(this);
4069
+ return ptr;
4070
+ }
4071
+
4072
+ free() {
4073
+ const ptr = this.__destroy_into_raw();
4074
+ wasm.__wbg_viewkey_free(ptr);
4075
+ }
4076
+ /**
4077
+ * Create a new view key from a private key
4078
+ *
4079
+ * @param {PrivateKey} private_key Private key
4080
+ * @returns {ViewKey} View key
4081
+ * @param {PrivateKey} private_key
4082
+ * @returns {ViewKey}
4083
+ */
4084
+ static from_private_key(private_key) {
4085
+ _assertClass(private_key, PrivateKey$1);
4086
+ const ret = wasm.privatekey_to_view_key(private_key.__wbg_ptr);
4087
+ return ViewKey.__wrap(ret);
4088
+ }
4089
+ /**
4090
+ * Create a new view key from a string representation of a view key
4091
+ *
4092
+ * @param {string} view_key String representation of a view key
4093
+ * @returns {ViewKey} View key
4094
+ * @param {string} view_key
4095
+ * @returns {ViewKey}
4096
+ */
4097
+ static from_string(view_key) {
4098
+ const ptr0 = passStringToWasm0(view_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4099
+ const len0 = WASM_VECTOR_LEN;
4100
+ const ret = wasm.viewkey_from_string(ptr0, len0);
4101
+ return ViewKey.__wrap(ret);
4102
+ }
4103
+ /**
4104
+ * Get a string representation of a view key
4105
+ *
4106
+ * @returns {string} String representation of a view key
4107
+ * @returns {string}
4108
+ */
4109
+ to_string() {
4110
+ let deferred1_0;
4111
+ let deferred1_1;
4112
+ try {
4113
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4114
+ wasm.viewkey_to_string(retptr, this.__wbg_ptr);
4115
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4116
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4117
+ deferred1_0 = r0;
4118
+ deferred1_1 = r1;
4119
+ return getStringFromWasm0(r0, r1);
4120
+ } finally {
4121
+ wasm.__wbindgen_add_to_stack_pointer(16);
4122
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4123
+ }
4124
+ }
4125
+ /**
4126
+ * Get the address corresponding to a view key
4127
+ *
4128
+ * @returns {Address} Address
4129
+ * @returns {Address}
4130
+ */
4131
+ to_address() {
4132
+ const ret = wasm.address_from_view_key(this.__wbg_ptr);
4133
+ return Address$1.__wrap(ret);
4134
+ }
4135
+ /**
4136
+ * Decrypt a record ciphertext with a view key
4137
+ *
4138
+ * @param {string} ciphertext String representation of a record ciphertext
4139
+ * @returns {string} String representation of a record plaintext
4140
+ * @param {string} ciphertext
4141
+ * @returns {string}
4142
+ */
4143
+ decrypt(ciphertext) {
4144
+ let deferred3_0;
4145
+ let deferred3_1;
4146
+ try {
4147
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4148
+ const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4149
+ const len0 = WASM_VECTOR_LEN;
4150
+ wasm.viewkey_decrypt(retptr, this.__wbg_ptr, ptr0, len0);
4151
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4152
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4153
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4154
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4155
+ var ptr2 = r0;
4156
+ var len2 = r1;
4157
+ if (r3) {
4158
+ ptr2 = 0; len2 = 0;
4159
+ throw takeObject(r2);
4160
+ }
4161
+ deferred3_0 = ptr2;
4162
+ deferred3_1 = len2;
4163
+ return getStringFromWasm0(ptr2, len2);
4164
+ } finally {
4165
+ wasm.__wbindgen_add_to_stack_pointer(16);
4166
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
4167
+ }
4168
+ }
4169
+ /**
4170
+ * @param {string} ciphertext
4171
+ * @param {string} tpk
4172
+ * @param {string} program_name
4173
+ * @param {string} function_name
4174
+ * @param {number} index
4175
+ * @returns {string}
4176
+ */
4177
+ decrypt_ciphertext(ciphertext, tpk, program_name, function_name, index) {
4178
+ let deferred6_0;
4179
+ let deferred6_1;
4180
+ try {
4181
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4182
+ const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4183
+ const len0 = WASM_VECTOR_LEN;
4184
+ const ptr1 = passStringToWasm0(tpk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4185
+ const len1 = WASM_VECTOR_LEN;
4186
+ const ptr2 = passStringToWasm0(program_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4187
+ const len2 = WASM_VECTOR_LEN;
4188
+ const ptr3 = passStringToWasm0(function_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4189
+ const len3 = WASM_VECTOR_LEN;
4190
+ wasm.viewkey_decrypt_ciphertext(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, index);
4191
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4192
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4193
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4194
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4195
+ var ptr5 = r0;
4196
+ var len5 = r1;
4197
+ if (r3) {
4198
+ ptr5 = 0; len5 = 0;
4199
+ throw takeObject(r2);
4200
+ }
4201
+ deferred6_0 = ptr5;
4202
+ deferred6_1 = len5;
4203
+ return getStringFromWasm0(ptr5, len5);
4204
+ } finally {
4205
+ wasm.__wbindgen_add_to_stack_pointer(16);
4206
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
4207
+ }
4208
+ }
4209
+ };
4210
+
4211
+ async function __wbg_load(module, imports) {
4212
+ if (typeof Response === 'function' && module instanceof Response) {
4213
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
4214
+ try {
4215
+ return await WebAssembly.instantiateStreaming(module, imports);
4216
+
4217
+ } catch (e) {
4218
+ if (module.headers.get('Content-Type') != 'application/wasm') {
4219
+ 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);
4220
+
4221
+ } else {
4222
+ throw e;
4223
+ }
4224
+ }
4225
+ }
4226
+
4227
+ const bytes = await module.arrayBuffer();
4228
+ return await WebAssembly.instantiate(bytes, imports);
4229
+
4230
+ } else {
4231
+ const instance = await WebAssembly.instantiate(module, imports);
4232
+
4233
+ if (instance instanceof WebAssembly.Instance) {
4234
+ return { instance, module };
4235
+
4236
+ } else {
4237
+ return instance;
4238
+ }
4239
+ }
4240
+ }
4241
+
4242
+ function __wbg_get_imports() {
4243
+ const imports = {};
4244
+ imports.wbg = {};
4245
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
4246
+ takeObject(arg0);
4247
+ };
4248
+ imports.wbg.__wbg_new_71801a555ad9f2aa = function() { return handleError(function () {
4249
+ const ret = new XMLHttpRequest();
4250
+ return addHeapObject(ret);
4251
+ }, arguments) };
4252
+ imports.wbg.__wbg_overrideMimeType_ee9c51919ceb418b = function() { return handleError(function (arg0, arg1, arg2) {
4253
+ getObject(arg0).overrideMimeType(getStringFromWasm0(arg1, arg2));
4254
+ }, arguments) };
4255
+ imports.wbg.__wbg_open_c9eb0cf2c9d95679 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
4256
+ getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
4257
+ }, arguments) };
4258
+ imports.wbg.__wbg_send_80d29985093c1ec5 = function() { return handleError(function (arg0) {
4259
+ getObject(arg0).send();
4260
+ }, arguments) };
4261
+ imports.wbg.__wbg_response_7c2e2759084f7279 = function() { return handleError(function (arg0) {
4262
+ const ret = getObject(arg0).response;
4263
+ return addHeapObject(ret);
4264
+ }, arguments) };
4265
+ imports.wbg.__wbg_status_d485fb5a478426fb = function() { return handleError(function (arg0) {
4266
+ const ret = getObject(arg0).status;
4267
+ return ret;
4268
+ }, arguments) };
4269
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
4270
+ const ret = new Object();
4271
+ return addHeapObject(ret);
4272
+ };
4273
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
4274
+ const ret = getStringFromWasm0(arg0, arg1);
4275
+ return addHeapObject(ret);
4276
+ };
4277
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
4278
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
4279
+ return ret;
4280
+ }, arguments) };
4281
+ imports.wbg.__wbg_new_ab6fd82b10560829 = function() { return handleError(function () {
4282
+ const ret = new Headers();
4283
+ return addHeapObject(ret);
4284
+ }, arguments) };
4285
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4286
+ const ret = getObject(arg0);
4287
+ return addHeapObject(ret);
4288
+ };
4289
+ imports.wbg.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
4290
+ const ret = new AbortController();
4291
+ return addHeapObject(ret);
4292
+ }, arguments) };
4293
+ imports.wbg.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
4294
+ const ret = getObject(arg0).signal;
4295
+ return addHeapObject(ret);
4296
+ };
4297
+ imports.wbg.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4298
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4299
+ }, arguments) };
4300
+ imports.wbg.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
4301
+ let result;
4302
+ try {
4303
+ result = getObject(arg0) instanceof Response;
4304
+ } catch (_) {
4305
+ result = false;
4306
+ }
4307
+ const ret = result;
4308
+ return ret;
4309
+ };
4310
+ imports.wbg.__wbg_status_61a01141acd3cf74 = function(arg0) {
4311
+ const ret = getObject(arg0).status;
4312
+ return ret;
4313
+ };
4314
+ imports.wbg.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
4315
+ const ret = getObject(arg1).url;
4316
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4317
+ const len1 = WASM_VECTOR_LEN;
4318
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4319
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4320
+ };
4321
+ imports.wbg.__wbg_headers_9620bfada380764a = function(arg0) {
4322
+ const ret = getObject(arg0).headers;
4323
+ return addHeapObject(ret);
4324
+ };
4325
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
4326
+ const ret = Symbol.iterator;
4327
+ return addHeapObject(ret);
4328
+ };
4329
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
4330
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4331
+ return addHeapObject(ret);
4332
+ }, arguments) };
4333
+ imports.wbg.__wbindgen_is_function = function(arg0) {
4334
+ const ret = typeof(getObject(arg0)) === 'function';
4335
+ return ret;
4336
+ };
4337
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
4338
+ const ret = getObject(arg0).call(getObject(arg1));
4339
+ return addHeapObject(ret);
4340
+ }, arguments) };
4341
+ imports.wbg.__wbindgen_is_object = function(arg0) {
4342
+ const val = getObject(arg0);
4343
+ const ret = typeof(val) === 'object' && val !== null;
4344
+ return ret;
4345
+ };
4346
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
4347
+ const ret = getObject(arg0).next;
4348
+ return addHeapObject(ret);
4349
+ };
4350
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
4351
+ const ret = getObject(arg0).next();
4352
+ return addHeapObject(ret);
4353
+ }, arguments) };
4354
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
4355
+ const ret = getObject(arg0).done;
4356
+ return ret;
4357
+ };
4358
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
4359
+ const ret = getObject(arg0).value;
4360
+ return addHeapObject(ret);
4361
+ };
4362
+ imports.wbg.__wbg_abort_2aa7521d5690750e = function(arg0) {
4363
+ getObject(arg0).abort();
4364
+ };
4365
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
4366
+ const ret = JSON.stringify(getObject(arg0));
4367
+ return addHeapObject(ret);
4368
+ }, arguments) };
4369
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
4370
+ const obj = getObject(arg1);
4371
+ const ret = typeof(obj) === 'string' ? obj : undefined;
4372
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4373
+ var len1 = WASM_VECTOR_LEN;
4374
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4375
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4376
+ };
4377
+ imports.wbg.__wbg_log_f3433265eb640baa = function(arg0, arg1) {
4378
+ console.log(getStringFromWasm0(arg0, arg1));
4379
+ };
4380
+ imports.wbg.__wbg_newwithlength_66ae46612e7f0234 = function(arg0) {
4381
+ const ret = new Array(arg0 >>> 0);
4382
+ return addHeapObject(ret);
4383
+ };
4384
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
4385
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4386
+ };
4387
+ imports.wbg.__wbg_transaction_new = function(arg0) {
4388
+ const ret = Transaction$1.__wrap(arg0);
4389
+ return addHeapObject(ret);
4390
+ };
4391
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
4392
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
4393
+ return addHeapObject(ret);
4394
+ }, arguments) };
4395
+ imports.wbg.__wbg_keypair_new = function(arg0) {
4396
+ const ret = KeyPair.__wrap(arg0);
4397
+ return addHeapObject(ret);
4398
+ };
4399
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4400
+ const ret = BigInt.asUintN(64, arg0);
4401
+ return addHeapObject(ret);
4402
+ };
4403
+ imports.wbg.__wbg_executionresponse_new = function(arg0) {
4404
+ const ret = ExecutionResponse$1.__wrap(arg0);
4405
+ return addHeapObject(ret);
4406
+ };
4407
+ imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4408
+ const ret = AuthorizationResponse.__wrap(arg0);
4409
+ return addHeapObject(ret);
4410
+ };
4411
+ imports.wbg.__wbindgen_module = function() {
4412
+ const ret = __wbg_init.__wbindgen_wasm_module;
4413
+ return addHeapObject(ret);
4414
+ };
4415
+ imports.wbg.__wbindgen_memory = function() {
4416
+ const ret = wasm.memory;
4417
+ return addHeapObject(ret);
4418
+ };
4419
+ imports.wbg.__wbg_spawnWorker_1bc5a4548b5096bf = function(arg0, arg1, arg2, arg3) {
4420
+ const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
4421
+ return addHeapObject(ret);
4422
+ };
4423
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
4424
+ const obj = takeObject(arg0).original;
4425
+ if (obj.cnt-- == 1) {
4426
+ obj.a = 0;
4427
+ return true;
4428
+ }
4429
+ const ret = false;
4430
+ return ret;
4431
+ };
4432
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
4433
+ const ret = new Array();
4434
+ return addHeapObject(ret);
4435
+ };
4436
+ imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
4437
+ const ret = getObject(arg0).push(getObject(arg1));
4438
+ return ret;
4439
+ };
4440
+ imports.wbg.__wbg_arrayBuffer_29931d52c7206b02 = function() { return handleError(function (arg0) {
4441
+ const ret = getObject(arg0).arrayBuffer();
4442
+ return addHeapObject(ret);
4443
+ }, arguments) };
4444
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
4445
+ const ret = new Uint8Array(getObject(arg0));
4446
+ return addHeapObject(ret);
4447
+ };
4448
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
4449
+ const ret = getObject(arg0).length;
4450
+ return ret;
4451
+ };
4452
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
4453
+ try {
4454
+ var state0 = {a: arg0, b: arg1};
4455
+ var cb0 = (arg0, arg1) => {
4456
+ const a = state0.a;
4457
+ state0.a = 0;
4458
+ try {
4459
+ return __wbg_adapter_290(a, state0.b, arg0, arg1);
4460
+ } finally {
4461
+ state0.a = a;
4462
+ }
4463
+ };
4464
+ const ret = new Promise(cb0);
4465
+ return addHeapObject(ret);
4466
+ } finally {
4467
+ state0.a = state0.b = 0;
4468
+ }
4469
+ };
4470
+ imports.wbg.__wbindgen_number_new = function(arg0) {
4471
+ const ret = arg0;
4472
+ return addHeapObject(ret);
4473
+ };
4474
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
4475
+ const ret = new Error();
4476
+ return addHeapObject(ret);
4477
+ };
4478
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
4479
+ const ret = getObject(arg1).stack;
4480
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4481
+ const len1 = WASM_VECTOR_LEN;
4482
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4483
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4484
+ };
4485
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
4486
+ let deferred0_0;
4487
+ let deferred0_1;
4488
+ try {
4489
+ deferred0_0 = arg0;
4490
+ deferred0_1 = arg1;
4491
+ console.error(getStringFromWasm0(arg0, arg1));
4492
+ } finally {
4493
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4494
+ }
4495
+ };
4496
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
4497
+ const ret = getObject(arg0).buffer;
4498
+ return addHeapObject(ret);
4499
+ };
4500
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
4501
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4502
+ return addHeapObject(ret);
4503
+ };
4504
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
4505
+ getObject(arg0).randomFillSync(takeObject(arg1));
4506
+ }, arguments) };
4507
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
4508
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4509
+ return addHeapObject(ret);
4510
+ };
4511
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
4512
+ getObject(arg0).getRandomValues(getObject(arg1));
4513
+ }, arguments) };
4514
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
4515
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4516
+ };
4517
+ imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
4518
+ const ret = getObject(arg0).crypto;
4519
+ return addHeapObject(ret);
4520
+ };
4521
+ imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
4522
+ const ret = getObject(arg0).process;
4523
+ return addHeapObject(ret);
4524
+ };
4525
+ imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
4526
+ const ret = getObject(arg0).versions;
4527
+ return addHeapObject(ret);
4528
+ };
4529
+ imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
4530
+ const ret = getObject(arg0).node;
4531
+ return addHeapObject(ret);
4532
+ };
4533
+ imports.wbg.__wbindgen_is_string = function(arg0) {
4534
+ const ret = typeof(getObject(arg0)) === 'string';
4535
+ return ret;
4536
+ };
4537
+ imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
4538
+ const ret = module.require;
4539
+ return addHeapObject(ret);
4540
+ }, arguments) };
4541
+ imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
4542
+ const ret = getObject(arg0).msCrypto;
4543
+ return addHeapObject(ret);
4544
+ };
4545
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
4546
+ const ret = new Uint8Array(arg0 >>> 0);
4547
+ return addHeapObject(ret);
4548
+ };
4549
+ imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
4550
+ const ret = getObject(arg0).length;
4551
+ return ret;
4552
+ };
4553
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
4554
+ const ret = getObject(arg0)[arg1 >>> 0];
4555
+ return addHeapObject(ret);
4556
+ };
4557
+ imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
4558
+ const ret = self.self;
4559
+ return addHeapObject(ret);
4560
+ }, arguments) };
4561
+ imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
4562
+ const ret = window.window;
4563
+ return addHeapObject(ret);
4564
+ }, arguments) };
4565
+ imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
4566
+ const ret = globalThis.globalThis;
4567
+ return addHeapObject(ret);
4568
+ }, arguments) };
4569
+ imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
4570
+ const ret = global.global;
4571
+ return addHeapObject(ret);
4572
+ }, arguments) };
4573
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
4574
+ const ret = getObject(arg0) === undefined;
4575
+ return ret;
4576
+ };
4577
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
4578
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
4579
+ return addHeapObject(ret);
4580
+ };
4581
+ imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
4582
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
4583
+ return ret;
4584
+ }, arguments) };
4585
+ imports.wbg.__wbg_fetch_bc7c8e27076a5c84 = function(arg0) {
4586
+ const ret = fetch(getObject(arg0));
4587
+ return addHeapObject(ret);
4588
+ };
4589
+ imports.wbg.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
4590
+ const ret = getObject(arg0).fetch(getObject(arg1));
4591
+ return addHeapObject(ret);
4592
+ };
4593
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
4594
+ const ret = debugString(getObject(arg1));
4595
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4596
+ const len1 = WASM_VECTOR_LEN;
4597
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4598
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4599
+ };
4600
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
4601
+ throw new Error(getStringFromWasm0(arg0, arg1));
4602
+ };
4603
+ imports.wbg.__wbindgen_rethrow = function(arg0) {
4604
+ throw takeObject(arg0);
4605
+ };
4606
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
4607
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
4608
+ return addHeapObject(ret);
4609
+ };
4610
+ imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
4611
+ const ret = getObject(arg0).then(getObject(arg1));
4612
+ return addHeapObject(ret);
4613
+ };
4614
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
4615
+ queueMicrotask(getObject(arg0));
4616
+ };
4617
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
4618
+ const ret = getObject(arg0).queueMicrotask;
4619
+ return addHeapObject(ret);
4620
+ };
4621
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
4622
+ const ret = Promise.resolve(getObject(arg0));
4623
+ return addHeapObject(ret);
4624
+ };
4625
+ imports.wbg.__wbg_waitAsync_5d743fc9058ba01a = function() {
4626
+ const ret = Atomics.waitAsync;
4627
+ return addHeapObject(ret);
4628
+ };
4629
+ imports.wbg.__wbg_new_8cccba86b0f574cb = function(arg0) {
4630
+ const ret = new Int32Array(getObject(arg0));
4631
+ return addHeapObject(ret);
4632
+ };
4633
+ imports.wbg.__wbg_waitAsync_46d5c36955b71a79 = function(arg0, arg1, arg2) {
4634
+ const ret = Atomics.waitAsync(getObject(arg0), arg1, arg2);
4635
+ return addHeapObject(ret);
4636
+ };
4637
+ imports.wbg.__wbg_async_19c0400d97cc72fe = function(arg0) {
4638
+ const ret = getObject(arg0).async;
4639
+ return ret;
4640
+ };
4641
+ imports.wbg.__wbg_value_571d60108110e917 = function(arg0) {
4642
+ const ret = getObject(arg0).value;
4643
+ return addHeapObject(ret);
4644
+ };
4645
+ imports.wbg.__wbindgen_link_fc1eedd35dc7e0a6 = function(arg0) {
4646
+ const ret = "data:application/javascript," + encodeURIComponent(`onmessage = function (ev) {
4647
+ let [ia, index, value] = ev.data;
4648
+ ia = new Int32Array(ia.buffer);
4649
+ let result = Atomics.wait(ia, index, value);
4650
+ postMessage(result);
4651
+ };
4652
+ `);
4653
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4654
+ const len1 = WASM_VECTOR_LEN;
4655
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4656
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4657
+ };
4658
+ imports.wbg.__wbg_new_d1187ae36d662ef9 = function() { return handleError(function (arg0, arg1) {
4659
+ const ret = new Worker(getStringFromWasm0(arg0, arg1));
4660
+ return addHeapObject(ret);
4661
+ }, arguments) };
4662
+ imports.wbg.__wbg_setonmessage_503809e5bb51bd33 = function(arg0, arg1) {
4663
+ getObject(arg0).onmessage = getObject(arg1);
4664
+ };
4665
+ imports.wbg.__wbg_of_6a70eed8d41f469c = function(arg0, arg1, arg2) {
4666
+ const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
4667
+ return addHeapObject(ret);
4668
+ };
4669
+ imports.wbg.__wbg_postMessage_7380d10e8b8269df = function() { return handleError(function (arg0, arg1) {
4670
+ getObject(arg0).postMessage(getObject(arg1));
4671
+ }, arguments) };
4672
+ imports.wbg.__wbg_data_3ce7c145ca4fbcdc = function(arg0) {
4673
+ const ret = getObject(arg0).data;
4674
+ return addHeapObject(ret);
4675
+ };
4676
+ imports.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0 = function() { return handleError(function (arg0, arg1, arg2) {
4677
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
4678
+ return addHeapObject(ret);
4679
+ }, arguments) };
4680
+ imports.wbg.__wbg_responseText_c67ed2d48db10769 = function() { return handleError(function (arg0, arg1) {
4681
+ const ret = getObject(arg1).responseText;
4682
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4683
+ var len1 = WASM_VECTOR_LEN;
4684
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4685
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4686
+ }, arguments) };
4687
+ imports.wbg.__wbindgen_closure_wrapper5806 = function(arg0, arg1, arg2) {
4688
+ const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_34);
4689
+ return addHeapObject(ret);
4690
+ };
4691
+ imports.wbg.__wbindgen_closure_wrapper5831 = function(arg0, arg1, arg2) {
4692
+ const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_34);
4693
+ return addHeapObject(ret);
4694
+ };
4695
+
4696
+ return imports;
4697
+ }
4698
+
4699
+ function __wbg_init_memory(imports, maybe_memory) {
4700
+ imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:25,maximum:65536,shared:true});
4701
+ }
4702
+
4703
+ function __wbg_finalize_init(instance, module) {
4704
+ wasm = instance.exports;
4705
+ __wbg_init.__wbindgen_wasm_module = module;
4706
+ cachedBigInt64Memory0 = null;
4707
+ cachedInt32Memory0 = null;
4708
+ cachedUint8Memory0 = null;
4709
+
4710
+ wasm.__wbindgen_start();
4711
+ return wasm;
4712
+ }
4713
+
4714
+ function initSync(module, maybe_memory) {
4715
+ if (wasm !== undefined) return wasm;
4716
+
4717
+ const imports = __wbg_get_imports();
4718
+
4719
+ __wbg_init_memory(imports, maybe_memory);
4720
+
4721
+ if (!(module instanceof WebAssembly.Module)) {
4722
+ module = new WebAssembly.Module(module);
4723
+ }
4724
+
4725
+ const instance = new WebAssembly.Instance(module, imports);
4726
+
4727
+ return __wbg_finalize_init(instance, module);
4728
+ }
4729
+
4730
+ async function __wbg_init(input, maybe_memory) {
4731
+ if (wasm !== undefined) return wasm;
4732
+
4733
+
4734
+ const imports = __wbg_get_imports();
4735
+
4736
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
4737
+ input = fetch(input);
4738
+ }
4739
+
4740
+ __wbg_init_memory(imports, maybe_memory);
4741
+
4742
+ const { instance, module } = await __wbg_load(await input, imports);
4743
+
4744
+ return __wbg_finalize_init(instance, module);
4745
+ }
4746
+
4747
+ var exports = /*#__PURE__*/Object.freeze({
4748
+ __proto__: null,
4749
+ Address: Address$1,
4750
+ AuthorizationResponse: AuthorizationResponse,
4751
+ Execution: Execution$1,
4752
+ ExecutionResponse: ExecutionResponse$1,
4753
+ Field: Field$1,
4754
+ JsField: JsField$1,
4755
+ KeyPair: KeyPair,
4756
+ Metadata: Metadata$1,
4757
+ OfflineQuery: OfflineQuery$1,
4758
+ PrivateKey: PrivateKey$1,
4759
+ PrivateKeyCiphertext: PrivateKeyCiphertext$1,
4760
+ Program: Program$1,
4761
+ ProgramManager: ProgramManager$1,
4762
+ ProvingKey: ProvingKey$1,
4763
+ RecordCiphertext: RecordCiphertext$1,
4764
+ RecordPlaintext: RecordPlaintext$1,
4765
+ Signature: Signature$1,
4766
+ Transaction: Transaction$1,
4767
+ VerifyingKey: VerifyingKey$1,
4768
+ ViewKey: ViewKey$1,
4769
+ default: __wbg_init,
4770
+ initSync: initSync,
4771
+ initThreadPool: initThreadPool$1,
4772
+ init_panic_hook: init_panic_hook$1,
4773
+ runRayonThread: runRayonThread,
4774
+ verifyFunctionExecution: verifyFunctionExecution$1
4775
+ });
4776
+
4777
+ const wasm_path = "assets/aleo_wasm.wasm";
4778
+
4779
+
4780
+ var Cargo = async (opt = {}) => {
4781
+ let {importHook, serverPath, initializeHook} = opt;
4782
+
4783
+ let final_path = wasm_path;
4784
+
4785
+ if (serverPath != null) {
4786
+ final_path = serverPath + /[^\/\\]*$/.exec(final_path)[0];
4787
+ }
4788
+
4789
+ if (importHook != null) {
4790
+ final_path = importHook(final_path);
4791
+ }
4792
+
4793
+ if (initializeHook != null) {
4794
+ await initializeHook(__wbg_init, final_path);
4795
+
4796
+ } else {
4797
+ await __wbg_init(final_path);
4798
+ }
4799
+
4800
+ return exports;
4801
+ };
4802
+
4803
+ const {
4804
+ initThreadPool: wasmInitThreadPool,
4805
+ init_panic_hook,
4806
+ Address,
4807
+ Execution,
4808
+ ExecutionResponse,
4809
+ Field,
4810
+ default: _wbg_init,
4811
+ JsField,
4812
+ Metadata,
4813
+ OfflineQuery,
4814
+ Private,
4815
+ PrivateKey,
4816
+ PrivateKeyCiphertext,
4817
+ Program,
4818
+ ProvingKey,
4819
+ RecordCiphertext,
4820
+ RecordPlaintext,
4821
+ ProgramManager,
4822
+ Signature,
4823
+ Transaction,
4824
+ ViewKey,
4825
+ VerifyingKey,
4826
+ verifyFunctionExecution,
4827
+ } = await Cargo({
4828
+ importHook: () => {
4829
+ return new URL("assets/aleo_wasm.wasm", import.meta.url);
4830
+ },
4831
+ });
4832
+
4833
+ async function initThreadPool(threads) {
4834
+ if (threads == null) {
4835
+ threads = navigator.hardwareConcurrency;
4836
+ }
4837
+
4838
+ console.info(`Spawning ${threads} threads`);
4839
+
4840
+ await wasmInitThreadPool(new URL("worker.js", import.meta.url), threads);
4841
+ }
4842
+
4843
+ export { Address, Execution, ExecutionResponse, Field, JsField, Metadata, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, _wbg_init, initThreadPool, init_panic_hook, verifyFunctionExecution };
4844
+ //# sourceMappingURL=index.js.map