@puzzlehq/aleo-wasm-web 0.6.16 → 0.6.18

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