@puzzlehq/aleo-wasm-web 0.6.14 → 0.6.16

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.
@@ -1,33 +1,4 @@
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
- }
1
+ import { spawnWorker } from './snippets/aleo-wasm-917a63011190b7ca/inline0.js';
31
2
 
32
3
  let wasm;
33
4
 
@@ -53,11 +24,12 @@ function takeObject(idx) {
53
24
 
54
25
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
55
26
 
56
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
27
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
28
+
57
29
  let cachedUint8Memory0 = null;
58
30
 
59
31
  function getUint8Memory0() {
60
- if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
32
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
61
33
  cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
62
34
  }
63
35
  return cachedUint8Memory0;
@@ -65,7 +37,7 @@ function getUint8Memory0() {
65
37
 
66
38
  function getStringFromWasm0(ptr, len) {
67
39
  ptr = ptr >>> 0;
68
- return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
40
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
69
41
  }
70
42
 
71
43
  function addHeapObject(obj) {
@@ -81,14 +53,18 @@ let WASM_VECTOR_LEN = 0;
81
53
 
82
54
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
83
55
 
84
- const encodeString = function (arg, view) {
56
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
57
+ ? function (arg, view) {
58
+ return cachedTextEncoder.encodeInto(arg, view);
59
+ }
60
+ : function (arg, view) {
85
61
  const buf = cachedTextEncoder.encode(arg);
86
62
  view.set(buf);
87
63
  return {
88
64
  read: arg.length,
89
65
  written: buf.length
90
66
  };
91
- };
67
+ });
92
68
 
93
69
  function passStringToWasm0(arg, malloc, realloc) {
94
70
 
@@ -136,7 +112,7 @@ function isLikeNone(x) {
136
112
  let cachedInt32Memory0 = null;
137
113
 
138
114
  function getInt32Memory0() {
139
- if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
115
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
140
116
  cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
141
117
  }
142
118
  return cachedInt32Memory0;
@@ -210,7 +186,7 @@ function debugString(val) {
210
186
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
211
187
  ? { register: () => {}, unregister: () => {} }
212
188
  : new FinalizationRegistry(state => {
213
- wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b);
189
+ wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
214
190
  });
215
191
 
216
192
  function makeMutClosure(arg0, arg1, dtor, f) {
@@ -226,7 +202,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
226
202
  return f(a, state.b, ...args);
227
203
  } finally {
228
204
  if (--state.cnt === 0) {
229
- wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
205
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
230
206
  CLOSURE_DTORS.unregister(state);
231
207
  } else {
232
208
  state.a = a;
@@ -237,8 +213,15 @@ function makeMutClosure(arg0, arg1, dtor, f) {
237
213
  CLOSURE_DTORS.register(real, state, state);
238
214
  return real;
239
215
  }
240
- function __wbg_adapter_34(arg0, arg1, arg2) {
241
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0d5bc0f77f63013f(arg0, arg1, addHeapObject(arg2));
216
+ function __wbg_adapter_32(arg0, arg1, arg2) {
217
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdf1d9b89567002b9(arg0, arg1, addHeapObject(arg2));
218
+ }
219
+
220
+ function passArray8ToWasm0(arg, malloc) {
221
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
222
+ getUint8Memory0().set(arg, ptr / 1);
223
+ WASM_VECTOR_LEN = arg.length;
224
+ return ptr;
242
225
  }
243
226
 
244
227
  function _assertClass(instance, klass) {
@@ -248,12 +231,33 @@ function _assertClass(instance, klass) {
248
231
  return instance.ptr;
249
232
  }
250
233
 
251
- function passArray8ToWasm0(arg, malloc) {
252
- const ptr = malloc(arg.length * 1, 1) >>> 0;
253
- getUint8Memory0().set(arg, ptr / 1);
254
- WASM_VECTOR_LEN = arg.length;
255
- return ptr;
234
+ function getArrayU8FromWasm0(ptr, len) {
235
+ ptr = ptr >>> 0;
236
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
237
+ }
238
+ /**
239
+ * @param {number} receiver
240
+ */
241
+ export function runRayonThread(receiver) {
242
+ wasm.runRayonThread(receiver);
243
+ }
244
+
245
+ /**
246
+ */
247
+ export function init_panic_hook() {
248
+ wasm.init_panic_hook();
249
+ }
250
+
251
+ /**
252
+ * @param {URL} url
253
+ * @param {number} num_threads
254
+ * @returns {Promise<void>}
255
+ */
256
+ export function initThreadPool(url, num_threads) {
257
+ const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
258
+ return takeObject(ret);
256
259
  }
260
+
257
261
  /**
258
262
  * Verify an execution with a single function and a single transition. Executions with multiple
259
263
  * transitions or functions will fail to verify. Also, this does not verify that the state root of
@@ -270,7 +274,7 @@ function passArray8ToWasm0(arg, malloc) {
270
274
  * @param {string} function_id
271
275
  * @returns {boolean}
272
276
  */
273
- function verifyFunctionExecution(execution, verifying_key, program, function_id) {
277
+ export function verifyFunctionExecution(execution, verifying_key, program, function_id) {
274
278
  try {
275
279
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
280
  _assertClass(execution, Execution);
@@ -294,39 +298,12 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id)
294
298
  let cachedBigInt64Memory0 = null;
295
299
 
296
300
  function getBigInt64Memory0() {
297
- if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.buffer !== wasm.memory.buffer) {
301
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
298
302
  cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
299
303
  }
300
304
  return cachedBigInt64Memory0;
301
305
  }
302
306
 
303
- function getArrayU8FromWasm0(ptr, len) {
304
- ptr = ptr >>> 0;
305
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
306
- }
307
- /**
308
- * @param {number} receiver
309
- */
310
- function runRayonThread(receiver) {
311
- wasm.runRayonThread(receiver);
312
- }
313
-
314
- /**
315
- */
316
- function init_panic_hook() {
317
- wasm.init_panic_hook();
318
- }
319
-
320
- /**
321
- * @param {URL} url
322
- * @param {number} num_threads
323
- * @returns {Promise<void>}
324
- */
325
- function initThreadPool(url, num_threads) {
326
- const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
327
- return takeObject(ret);
328
- }
329
-
330
307
  function handleError(f, args) {
331
308
  try {
332
309
  return f.apply(this, args);
@@ -334,8 +311,8 @@ function handleError(f, args) {
334
311
  wasm.__wbindgen_exn_store(addHeapObject(e));
335
312
  }
336
313
  }
337
- function __wbg_adapter_290(arg0, arg1, arg2, arg3) {
338
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h630419b3c55d46e4(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
314
+ function __wbg_adapter_327(arg0, arg1, arg2, arg3) {
315
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h69b3d6b389ddc7fb(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
339
316
  }
340
317
 
341
318
  const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -344,7 +321,7 @@ const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
344
321
  /**
345
322
  * Public address of an Aleo account
346
323
  */
347
- class Address {
324
+ export class Address {
348
325
 
349
326
  static __wrap(ptr) {
350
327
  ptr = ptr >>> 0;
@@ -451,7 +428,7 @@ const AuthorizationResponseFinalization = (typeof FinalizationRegistry === 'unde
451
428
  : new FinalizationRegistry(ptr => wasm.__wbg_authorizationresponse_free(ptr >>> 0));
452
429
  /**
453
430
  */
454
- class AuthorizationResponse {
431
+ export class AuthorizationResponse {
455
432
 
456
433
  static __wrap(ptr) {
457
434
  ptr = ptr >>> 0;
@@ -480,7 +457,7 @@ class AuthorizationResponse {
480
457
  let deferred1_1;
481
458
  try {
482
459
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
- wasm.__wbg_get_metadata_locator(retptr, this.__wbg_ptr);
460
+ wasm.authorizationresponse_authorization(retptr, this.__wbg_ptr);
484
461
  var r0 = getInt32Memory0()[retptr / 4 + 0];
485
462
  var r1 = getInt32Memory0()[retptr / 4 + 1];
486
463
  deferred1_0 = r0;
@@ -499,7 +476,7 @@ class AuthorizationResponse {
499
476
  let deferred1_1;
500
477
  try {
501
478
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
502
- wasm.__wbg_get_metadata_prover(retptr, this.__wbg_ptr);
479
+ wasm.authorizationresponse_fee_authorization(retptr, this.__wbg_ptr);
503
480
  var r0 = getInt32Memory0()[retptr / 4 + 0];
504
481
  var r1 = getInt32Memory0()[retptr / 4 + 1];
505
482
  deferred1_0 = r0;
@@ -518,7 +495,7 @@ const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
518
495
  /**
519
496
  * Execution of an Aleo program.
520
497
  */
521
- class Execution {
498
+ export class Execution {
522
499
 
523
500
  static __wrap(ptr) {
524
501
  ptr = ptr >>> 0;
@@ -592,7 +569,7 @@ const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefine
592
569
  * This object is returned by the execution of an Aleo function off-chain. It provides methods for
593
570
  * retrieving the outputs of the function execution.
594
571
  */
595
- class ExecutionResponse {
572
+ export class ExecutionResponse {
596
573
 
597
574
  static __wrap(ptr) {
598
575
  ptr = ptr >>> 0;
@@ -709,7 +686,7 @@ const FieldFinalization = (typeof FinalizationRegistry === 'undefined')
709
686
  : new FinalizationRegistry(ptr => wasm.__wbg_field_free(ptr >>> 0));
710
687
  /**
711
688
  */
712
- class Field {
689
+ export class Field {
713
690
 
714
691
  static __wrap(ptr) {
715
692
  ptr = ptr >>> 0;
@@ -777,7 +754,7 @@ const JsFieldFinalization = (typeof FinalizationRegistry === 'undefined')
777
754
  : new FinalizationRegistry(ptr => wasm.__wbg_jsfield_free(ptr >>> 0));
778
755
  /**
779
756
  */
780
- class JsField {
757
+ export class JsField {
781
758
 
782
759
  __destroy_into_raw() {
783
760
  const ptr = this.__wbg_ptr;
@@ -852,7 +829,7 @@ const KeyPairFinalization = (typeof FinalizationRegistry === 'undefined')
852
829
  /**
853
830
  * Key pair object containing both the function proving and verifying keys
854
831
  */
855
- class KeyPair {
832
+ export class KeyPair {
856
833
 
857
834
  static __wrap(ptr) {
858
835
  ptr = ptr >>> 0;
@@ -940,7 +917,7 @@ const MetadataFinalization = (typeof FinalizationRegistry === 'undefined')
940
917
  : new FinalizationRegistry(ptr => wasm.__wbg_metadata_free(ptr >>> 0));
941
918
  /**
942
919
  */
943
- class Metadata {
920
+ export class Metadata {
944
921
 
945
922
  static __wrap(ptr) {
946
923
  ptr = ptr >>> 0;
@@ -964,6 +941,33 @@ class Metadata {
964
941
  /**
965
942
  * @returns {string}
966
943
  */
944
+ get name() {
945
+ let deferred1_0;
946
+ let deferred1_1;
947
+ try {
948
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
949
+ wasm.__wbg_get_metadata_name(retptr, this.__wbg_ptr);
950
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
951
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
952
+ deferred1_0 = r0;
953
+ deferred1_1 = r1;
954
+ return getStringFromWasm0(r0, r1);
955
+ } finally {
956
+ wasm.__wbindgen_add_to_stack_pointer(16);
957
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
958
+ }
959
+ }
960
+ /**
961
+ * @param {string} arg0
962
+ */
963
+ set name(arg0) {
964
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
965
+ const len0 = WASM_VECTOR_LEN;
966
+ wasm.__wbg_set_metadata_name(this.__wbg_ptr, ptr0, len0);
967
+ }
968
+ /**
969
+ * @returns {string}
970
+ */
967
971
  get locator() {
968
972
  let deferred1_0;
969
973
  let deferred1_1;
@@ -1202,7 +1206,7 @@ const OfflineQueryFinalization = (typeof FinalizationRegistry === 'undefined')
1202
1206
  * An offline query object used to insert the global state root and state paths needed to create
1203
1207
  * a valid inclusion proof offline.
1204
1208
  */
1205
- class OfflineQuery {
1209
+ export class OfflineQuery {
1206
1210
 
1207
1211
  static __wrap(ptr) {
1208
1212
  ptr = ptr >>> 0;
@@ -1314,13 +1318,108 @@ class OfflineQuery {
1314
1318
  }
1315
1319
  }
1316
1320
 
1321
+ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
1322
+ ? { register: () => {}, unregister: () => {} }
1323
+ : new FinalizationRegistry(ptr => wasm.__wbg_plaintext_free(ptr >>> 0));
1324
+ /**
1325
+ */
1326
+ export class Plaintext {
1327
+
1328
+ static __wrap(ptr) {
1329
+ ptr = ptr >>> 0;
1330
+ const obj = Object.create(Plaintext.prototype);
1331
+ obj.__wbg_ptr = ptr;
1332
+ PlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
1333
+ return obj;
1334
+ }
1335
+
1336
+ __destroy_into_raw() {
1337
+ const ptr = this.__wbg_ptr;
1338
+ this.__wbg_ptr = 0;
1339
+ PlaintextFinalization.unregister(this);
1340
+ return ptr;
1341
+ }
1342
+
1343
+ free() {
1344
+ const ptr = this.__destroy_into_raw();
1345
+ wasm.__wbg_plaintext_free(ptr);
1346
+ }
1347
+ /**
1348
+ * @returns {string}
1349
+ */
1350
+ toString() {
1351
+ let deferred1_0;
1352
+ let deferred1_1;
1353
+ try {
1354
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1355
+ wasm.plaintext_toString(retptr, this.__wbg_ptr);
1356
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1357
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1358
+ deferred1_0 = r0;
1359
+ deferred1_1 = r1;
1360
+ return getStringFromWasm0(r0, r1);
1361
+ } finally {
1362
+ wasm.__wbindgen_add_to_stack_pointer(16);
1363
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1364
+ }
1365
+ }
1366
+ /**
1367
+ * @param {string} plaintext
1368
+ * @returns {Plaintext}
1369
+ */
1370
+ static fromString(plaintext) {
1371
+ try {
1372
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1373
+ const ptr0 = passStringToWasm0(plaintext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1374
+ const len0 = WASM_VECTOR_LEN;
1375
+ wasm.plaintext_fromString(retptr, ptr0, len0);
1376
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1377
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1378
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1379
+ if (r2) {
1380
+ throw takeObject(r1);
1381
+ }
1382
+ return Plaintext.__wrap(r0);
1383
+ } finally {
1384
+ wasm.__wbindgen_add_to_stack_pointer(16);
1385
+ }
1386
+ }
1387
+ /**
1388
+ * @returns {string}
1389
+ */
1390
+ hashBhp256() {
1391
+ let deferred2_0;
1392
+ let deferred2_1;
1393
+ try {
1394
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1395
+ wasm.plaintext_hashBhp256(retptr, this.__wbg_ptr);
1396
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1397
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1398
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1399
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1400
+ var ptr1 = r0;
1401
+ var len1 = r1;
1402
+ if (r3) {
1403
+ ptr1 = 0; len1 = 0;
1404
+ throw takeObject(r2);
1405
+ }
1406
+ deferred2_0 = ptr1;
1407
+ deferred2_1 = len1;
1408
+ return getStringFromWasm0(ptr1, len1);
1409
+ } finally {
1410
+ wasm.__wbindgen_add_to_stack_pointer(16);
1411
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1412
+ }
1413
+ }
1414
+ }
1415
+
1317
1416
  const PrivateKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1318
1417
  ? { register: () => {}, unregister: () => {} }
1319
1418
  : new FinalizationRegistry(ptr => wasm.__wbg_privatekey_free(ptr >>> 0));
1320
1419
  /**
1321
1420
  * Private key of an Aleo account
1322
1421
  */
1323
- class PrivateKey {
1422
+ export class PrivateKey {
1324
1423
 
1325
1424
  static __wrap(ptr) {
1326
1425
  ptr = ptr >>> 0;
@@ -1558,7 +1657,7 @@ const PrivateKeyCiphertextFinalization = (typeof FinalizationRegistry === 'undef
1558
1657
  /**
1559
1658
  * Private Key in ciphertext form
1560
1659
  */
1561
- class PrivateKeyCiphertext {
1660
+ export class PrivateKeyCiphertext {
1562
1661
 
1563
1662
  static __wrap(ptr) {
1564
1663
  ptr = ptr >>> 0;
@@ -1596,7 +1695,7 @@ class PrivateKeyCiphertext {
1596
1695
  _assertClass(private_key, PrivateKey);
1597
1696
  const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1598
1697
  const len0 = WASM_VECTOR_LEN;
1599
- wasm.privatekey_toCiphertext(retptr, private_key.__wbg_ptr, ptr0, len0);
1698
+ wasm.privatekeyciphertext_encryptPrivateKey(retptr, private_key.__wbg_ptr, ptr0, len0);
1600
1699
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1601
1700
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1602
1701
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1689,7 +1788,7 @@ const ProgramFinalization = (typeof FinalizationRegistry === 'undefined')
1689
1788
  /**
1690
1789
  * Webassembly Representation of an Aleo program
1691
1790
  */
1692
- class Program {
1791
+ export class Program {
1693
1792
 
1694
1793
  static __wrap(ptr) {
1695
1794
  ptr = ptr >>> 0;
@@ -2106,7 +2205,7 @@ const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
2106
2205
  : new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0));
2107
2206
  /**
2108
2207
  */
2109
- class ProgramManager {
2208
+ export class ProgramManager {
2110
2209
 
2111
2210
  __destroy_into_raw() {
2112
2211
  const ptr = this.__wbg_ptr;
@@ -2120,76 +2219,289 @@ class ProgramManager {
2120
2219
  wasm.__wbg_programmanager_free(ptr);
2121
2220
  }
2122
2221
  /**
2123
- * Deploy an Aleo program
2222
+ * Synthesize proving and verifying keys for a program
2223
+ *
2224
+ * @param program {string} The program source code of the program to synthesize keys for
2225
+ * @param function_id {string} The function to synthesize keys for
2226
+ * @param inputs {Array} The inputs to the function
2227
+ * @param imports {Object | undefined} The imports for the program
2228
+ * @param {PrivateKey} private_key
2229
+ * @param {string} program
2230
+ * @param {string} function_id
2231
+ * @param {Array<any>} inputs
2232
+ * @param {object | undefined} [imports]
2233
+ * @returns {Promise<KeyPair>}
2234
+ */
2235
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports) {
2236
+ _assertClass(private_key, PrivateKey);
2237
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2238
+ const len0 = WASM_VECTOR_LEN;
2239
+ const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2240
+ const len1 = WASM_VECTOR_LEN;
2241
+ const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
2242
+ return takeObject(ret);
2243
+ }
2244
+ /**
2245
+ * Join two records together to create a new record with an amount of credits equal to the sum
2246
+ * of the credits of the two original records
2124
2247
  *
2125
2248
  * @param private_key The private key of the sender
2126
- * @param program The source code of the program being deployed
2127
- * @param imports A javascript object holding the source code of any imported programs in the
2128
- * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
2129
- * Note that all imported programs must be deployed on chain before the main program in order
2130
- * for the deployment to succeed
2249
+ * @param record_1 The first record to combine
2250
+ * @param record_2 The second record to combine
2131
2251
  * @param fee_credits The amount of credits to pay as a fee
2132
2252
  * @param fee_record The record to spend the fee from
2133
2253
  * @param url The url of the Aleo network node to send the transaction to
2134
- * @param imports (optional) Provide a list of imports to use for the program deployment in the
2135
- * form of a javascript object where the keys are a string of the program name and the values
2136
- * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2254
+ * @param join_proving_key (optional) Provide a proving key to use for the join function
2255
+ * @param join_verifying_key (optional) Provide a verifying key to use for the join function
2137
2256
  * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2138
2257
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2139
- * @returns {Transaction | Error}
2258
+ * @returns {Transaction | Error} Transaction object
2140
2259
  * @param {PrivateKey} private_key
2141
- * @param {string} program
2260
+ * @param {RecordPlaintext} record_1
2261
+ * @param {RecordPlaintext} record_2
2142
2262
  * @param {number} fee_credits
2143
2263
  * @param {RecordPlaintext | undefined} [fee_record]
2144
2264
  * @param {string | undefined} [url]
2145
- * @param {object | undefined} [imports]
2265
+ * @param {ProvingKey | undefined} [join_proving_key]
2266
+ * @param {VerifyingKey | undefined} [join_verifying_key]
2146
2267
  * @param {ProvingKey | undefined} [fee_proving_key]
2147
2268
  * @param {VerifyingKey | undefined} [fee_verifying_key]
2148
2269
  * @param {OfflineQuery | undefined} [offline_query]
2149
2270
  * @returns {Promise<Transaction>}
2150
2271
  */
2151
- static buildDeploymentTransaction(private_key, program, fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
2272
+ 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) {
2152
2273
  _assertClass(private_key, PrivateKey);
2153
- const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2154
- const len0 = WASM_VECTOR_LEN;
2155
- let ptr1 = 0;
2274
+ _assertClass(record_1, RecordPlaintext);
2275
+ var ptr0 = record_1.__destroy_into_raw();
2276
+ _assertClass(record_2, RecordPlaintext);
2277
+ var ptr1 = record_2.__destroy_into_raw();
2278
+ let ptr2 = 0;
2156
2279
  if (!isLikeNone(fee_record)) {
2157
2280
  _assertClass(fee_record, RecordPlaintext);
2158
- ptr1 = fee_record.__destroy_into_raw();
2281
+ ptr2 = fee_record.__destroy_into_raw();
2159
2282
  }
2160
- var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2161
- var len2 = WASM_VECTOR_LEN;
2162
- let ptr3 = 0;
2283
+ var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2284
+ var len3 = WASM_VECTOR_LEN;
2285
+ let ptr4 = 0;
2286
+ if (!isLikeNone(join_proving_key)) {
2287
+ _assertClass(join_proving_key, ProvingKey);
2288
+ ptr4 = join_proving_key.__destroy_into_raw();
2289
+ }
2290
+ let ptr5 = 0;
2291
+ if (!isLikeNone(join_verifying_key)) {
2292
+ _assertClass(join_verifying_key, VerifyingKey);
2293
+ ptr5 = join_verifying_key.__destroy_into_raw();
2294
+ }
2295
+ let ptr6 = 0;
2163
2296
  if (!isLikeNone(fee_proving_key)) {
2164
2297
  _assertClass(fee_proving_key, ProvingKey);
2165
- ptr3 = fee_proving_key.__destroy_into_raw();
2298
+ ptr6 = fee_proving_key.__destroy_into_raw();
2166
2299
  }
2167
- let ptr4 = 0;
2300
+ let ptr7 = 0;
2168
2301
  if (!isLikeNone(fee_verifying_key)) {
2169
2302
  _assertClass(fee_verifying_key, VerifyingKey);
2170
- ptr4 = fee_verifying_key.__destroy_into_raw();
2303
+ ptr7 = fee_verifying_key.__destroy_into_raw();
2171
2304
  }
2172
- let ptr5 = 0;
2305
+ let ptr8 = 0;
2173
2306
  if (!isLikeNone(offline_query)) {
2174
2307
  _assertClass(offline_query, OfflineQuery);
2175
- ptr5 = offline_query.__destroy_into_raw();
2308
+ ptr8 = offline_query.__destroy_into_raw();
2176
2309
  }
2177
- const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
2310
+ const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
2178
2311
  return takeObject(ret);
2179
2312
  }
2180
2313
  /**
2181
- * Estimate the fee for a program deployment
2182
- *
2183
- * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2314
+ * Split an Aleo credits record into two separate records. This function does not require a fee.
2184
2315
  *
2185
- * @param program The source code of the program being deployed
2186
- * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
2187
- * in the form of a javascript object where the keys are a string of the program name and the values
2188
- * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2189
- * @returns {u64 | Error}
2190
- * @param {string} program
2191
- * @param {object | undefined} [imports]
2192
- * @returns {Promise<bigint>}
2316
+ * @param private_key The private key of the sender
2317
+ * @param split_amount The amount of the credit split. This amount will be subtracted from the
2318
+ * value of the record and two new records will be created with the split amount and the remainder
2319
+ * @param amount_record The record to split
2320
+ * @param url The url of the Aleo network node to send the transaction to
2321
+ * @param split_proving_key (optional) Provide a proving key to use for the split function
2322
+ * @param split_verifying_key (optional) Provide a verifying key to use for the split function
2323
+ * @returns {Transaction | Error} Transaction object
2324
+ * @param {PrivateKey} private_key
2325
+ * @param {number} split_amount
2326
+ * @param {RecordPlaintext} amount_record
2327
+ * @param {string | undefined} [url]
2328
+ * @param {ProvingKey | undefined} [split_proving_key]
2329
+ * @param {VerifyingKey | undefined} [split_verifying_key]
2330
+ * @param {OfflineQuery | undefined} [offline_query]
2331
+ * @returns {Promise<Transaction>}
2332
+ */
2333
+ static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, offline_query) {
2334
+ _assertClass(private_key, PrivateKey);
2335
+ _assertClass(amount_record, RecordPlaintext);
2336
+ var ptr0 = amount_record.__destroy_into_raw();
2337
+ var ptr1 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2338
+ var len1 = WASM_VECTOR_LEN;
2339
+ let ptr2 = 0;
2340
+ if (!isLikeNone(split_proving_key)) {
2341
+ _assertClass(split_proving_key, ProvingKey);
2342
+ ptr2 = split_proving_key.__destroy_into_raw();
2343
+ }
2344
+ let ptr3 = 0;
2345
+ if (!isLikeNone(split_verifying_key)) {
2346
+ _assertClass(split_verifying_key, VerifyingKey);
2347
+ ptr3 = split_verifying_key.__destroy_into_raw();
2348
+ }
2349
+ let ptr4 = 0;
2350
+ if (!isLikeNone(offline_query)) {
2351
+ _assertClass(offline_query, OfflineQuery);
2352
+ ptr4 = offline_query.__destroy_into_raw();
2353
+ }
2354
+ const ret = wasm.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
2355
+ return takeObject(ret);
2356
+ }
2357
+ /**
2358
+ * Send credits from one Aleo account to another
2359
+ *
2360
+ * @param private_key The private key of the sender
2361
+ * @param amount_credits The amount of credits to send
2362
+ * @param recipient The recipient of the transaction
2363
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2364
+ * @param amount_record The record to fund the amount from
2365
+ * @param fee_credits The amount of credits to pay as a fee
2366
+ * @param fee_record The record to spend the fee from
2367
+ * @param url The url of the Aleo network node to send the transaction to
2368
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2369
+ * function
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 {number} amount_credits
2375
+ * @param {string} recipient
2376
+ * @param {string} transfer_type
2377
+ * @param {RecordPlaintext | undefined} amount_record
2378
+ * @param {number} fee_credits
2379
+ * @param {RecordPlaintext | undefined} [fee_record]
2380
+ * @param {string | undefined} [url]
2381
+ * @param {ProvingKey | undefined} [transfer_proving_key]
2382
+ * @param {VerifyingKey | undefined} [transfer_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 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) {
2389
+ _assertClass(private_key, PrivateKey);
2390
+ const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2391
+ const len0 = WASM_VECTOR_LEN;
2392
+ const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2393
+ const len1 = WASM_VECTOR_LEN;
2394
+ let ptr2 = 0;
2395
+ if (!isLikeNone(amount_record)) {
2396
+ _assertClass(amount_record, RecordPlaintext);
2397
+ ptr2 = amount_record.__destroy_into_raw();
2398
+ }
2399
+ let ptr3 = 0;
2400
+ if (!isLikeNone(fee_record)) {
2401
+ _assertClass(fee_record, RecordPlaintext);
2402
+ ptr3 = fee_record.__destroy_into_raw();
2403
+ }
2404
+ var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2405
+ var len4 = WASM_VECTOR_LEN;
2406
+ let ptr5 = 0;
2407
+ if (!isLikeNone(transfer_proving_key)) {
2408
+ _assertClass(transfer_proving_key, ProvingKey);
2409
+ ptr5 = transfer_proving_key.__destroy_into_raw();
2410
+ }
2411
+ let ptr6 = 0;
2412
+ if (!isLikeNone(transfer_verifying_key)) {
2413
+ _assertClass(transfer_verifying_key, VerifyingKey);
2414
+ ptr6 = transfer_verifying_key.__destroy_into_raw();
2415
+ }
2416
+ let ptr7 = 0;
2417
+ if (!isLikeNone(fee_proving_key)) {
2418
+ _assertClass(fee_proving_key, ProvingKey);
2419
+ ptr7 = fee_proving_key.__destroy_into_raw();
2420
+ }
2421
+ let ptr8 = 0;
2422
+ if (!isLikeNone(fee_verifying_key)) {
2423
+ _assertClass(fee_verifying_key, VerifyingKey);
2424
+ ptr8 = fee_verifying_key.__destroy_into_raw();
2425
+ }
2426
+ let ptr9 = 0;
2427
+ if (!isLikeNone(offline_query)) {
2428
+ _assertClass(offline_query, OfflineQuery);
2429
+ ptr9 = offline_query.__destroy_into_raw();
2430
+ }
2431
+ 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);
2432
+ return takeObject(ret);
2433
+ }
2434
+ /**
2435
+ * Deploy an Aleo program
2436
+ *
2437
+ * @param private_key The private key of the sender
2438
+ * @param program The source code of the program being deployed
2439
+ * @param imports A javascript object holding the source code of any imported programs in the
2440
+ * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
2441
+ * Note that all imported programs must be deployed on chain before the main program in order
2442
+ * for the deployment to succeed
2443
+ * @param fee_credits The amount of credits to pay as a fee
2444
+ * @param fee_record The record to spend the fee from
2445
+ * @param url The url of the Aleo network node to send the transaction to
2446
+ * @param imports (optional) Provide a list of imports to use for the program deployment in the
2447
+ * form of a javascript object where the keys are a string of the program name and the values
2448
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2449
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2450
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2451
+ * @returns {Transaction | Error}
2452
+ * @param {PrivateKey} private_key
2453
+ * @param {string} program
2454
+ * @param {number} fee_credits
2455
+ * @param {RecordPlaintext | undefined} [fee_record]
2456
+ * @param {string | undefined} [url]
2457
+ * @param {object | undefined} [imports]
2458
+ * @param {ProvingKey | undefined} [fee_proving_key]
2459
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2460
+ * @param {OfflineQuery | undefined} [offline_query]
2461
+ * @returns {Promise<Transaction>}
2462
+ */
2463
+ static buildDeploymentTransaction(private_key, program, fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
2464
+ _assertClass(private_key, PrivateKey);
2465
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2466
+ const len0 = WASM_VECTOR_LEN;
2467
+ let ptr1 = 0;
2468
+ if (!isLikeNone(fee_record)) {
2469
+ _assertClass(fee_record, RecordPlaintext);
2470
+ ptr1 = fee_record.__destroy_into_raw();
2471
+ }
2472
+ var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2473
+ var len2 = WASM_VECTOR_LEN;
2474
+ let ptr3 = 0;
2475
+ if (!isLikeNone(fee_proving_key)) {
2476
+ _assertClass(fee_proving_key, ProvingKey);
2477
+ ptr3 = fee_proving_key.__destroy_into_raw();
2478
+ }
2479
+ let ptr4 = 0;
2480
+ if (!isLikeNone(fee_verifying_key)) {
2481
+ _assertClass(fee_verifying_key, VerifyingKey);
2482
+ ptr4 = fee_verifying_key.__destroy_into_raw();
2483
+ }
2484
+ let ptr5 = 0;
2485
+ if (!isLikeNone(offline_query)) {
2486
+ _assertClass(offline_query, OfflineQuery);
2487
+ ptr5 = offline_query.__destroy_into_raw();
2488
+ }
2489
+ const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
2490
+ return takeObject(ret);
2491
+ }
2492
+ /**
2493
+ * Estimate the fee for a program deployment
2494
+ *
2495
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2496
+ *
2497
+ * @param program The source code of the program being deployed
2498
+ * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
2499
+ * in the form of a javascript object where the keys are a string of the program name and the values
2500
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2501
+ * @returns {u64 | Error}
2502
+ * @param {string} program
2503
+ * @param {object | undefined} [imports]
2504
+ * @returns {Promise<bigint>}
2193
2505
  */
2194
2506
  static estimateDeploymentFee(program, imports) {
2195
2507
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -2472,260 +2784,44 @@ class ProgramManager {
2472
2784
  wasm.__wbindgen_add_to_stack_pointer(16);
2473
2785
  }
2474
2786
  }
2787
+ }
2788
+
2789
+ const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
2790
+ ? { register: () => {}, unregister: () => {} }
2791
+ : new FinalizationRegistry(ptr => wasm.__wbg_provingkey_free(ptr >>> 0));
2792
+ /**
2793
+ * Proving key for a function within an Aleo program
2794
+ */
2795
+ export class ProvingKey {
2796
+
2797
+ static __wrap(ptr) {
2798
+ ptr = ptr >>> 0;
2799
+ const obj = Object.create(ProvingKey.prototype);
2800
+ obj.__wbg_ptr = ptr;
2801
+ ProvingKeyFinalization.register(obj, obj.__wbg_ptr, obj);
2802
+ return obj;
2803
+ }
2804
+
2805
+ __destroy_into_raw() {
2806
+ const ptr = this.__wbg_ptr;
2807
+ this.__wbg_ptr = 0;
2808
+ ProvingKeyFinalization.unregister(this);
2809
+ return ptr;
2810
+ }
2811
+
2812
+ free() {
2813
+ const ptr = this.__destroy_into_raw();
2814
+ wasm.__wbg_provingkey_free(ptr);
2815
+ }
2475
2816
  /**
2476
- * Join two records together to create a new record with an amount of credits equal to the sum
2477
- * of the credits of the two original records
2817
+ * Verify if the proving key is for the bond_public function
2478
2818
  *
2479
- * @param private_key The private key of the sender
2480
- * @param record_1 The first record to combine
2481
- * @param record_2 The second record to combine
2482
- * @param fee_credits The amount of credits to pay as a fee
2483
- * @param fee_record The record to spend the fee from
2484
- * @param url The url of the Aleo network node to send the transaction to
2485
- * @param join_proving_key (optional) Provide a proving key to use for the join function
2486
- * @param join_verifying_key (optional) Provide a verifying key to use for the join function
2487
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2488
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2489
- * @returns {Transaction | Error} Transaction object
2490
- * @param {PrivateKey} private_key
2491
- * @param {RecordPlaintext} record_1
2492
- * @param {RecordPlaintext} record_2
2493
- * @param {number} fee_credits
2494
- * @param {RecordPlaintext | undefined} [fee_record]
2495
- * @param {string | undefined} [url]
2496
- * @param {ProvingKey | undefined} [join_proving_key]
2497
- * @param {VerifyingKey | undefined} [join_verifying_key]
2498
- * @param {ProvingKey | undefined} [fee_proving_key]
2499
- * @param {VerifyingKey | undefined} [fee_verifying_key]
2500
- * @param {OfflineQuery | undefined} [offline_query]
2501
- * @returns {Promise<Transaction>}
2502
- */
2503
- static buildJoinTransaction(private_key, record_1, record_2, fee_credits, fee_record, url, join_proving_key, join_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2504
- _assertClass(private_key, PrivateKey);
2505
- _assertClass(record_1, RecordPlaintext);
2506
- var ptr0 = record_1.__destroy_into_raw();
2507
- _assertClass(record_2, RecordPlaintext);
2508
- var ptr1 = record_2.__destroy_into_raw();
2509
- let ptr2 = 0;
2510
- if (!isLikeNone(fee_record)) {
2511
- _assertClass(fee_record, RecordPlaintext);
2512
- ptr2 = fee_record.__destroy_into_raw();
2513
- }
2514
- var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2515
- var len3 = WASM_VECTOR_LEN;
2516
- let ptr4 = 0;
2517
- if (!isLikeNone(join_proving_key)) {
2518
- _assertClass(join_proving_key, ProvingKey);
2519
- ptr4 = join_proving_key.__destroy_into_raw();
2520
- }
2521
- let ptr5 = 0;
2522
- if (!isLikeNone(join_verifying_key)) {
2523
- _assertClass(join_verifying_key, VerifyingKey);
2524
- ptr5 = join_verifying_key.__destroy_into_raw();
2525
- }
2526
- let ptr6 = 0;
2527
- if (!isLikeNone(fee_proving_key)) {
2528
- _assertClass(fee_proving_key, ProvingKey);
2529
- ptr6 = fee_proving_key.__destroy_into_raw();
2530
- }
2531
- let ptr7 = 0;
2532
- if (!isLikeNone(fee_verifying_key)) {
2533
- _assertClass(fee_verifying_key, VerifyingKey);
2534
- ptr7 = fee_verifying_key.__destroy_into_raw();
2535
- }
2536
- let ptr8 = 0;
2537
- if (!isLikeNone(offline_query)) {
2538
- _assertClass(offline_query, OfflineQuery);
2539
- ptr8 = offline_query.__destroy_into_raw();
2540
- }
2541
- const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
2542
- return takeObject(ret);
2543
- }
2544
- /**
2545
- * Split an Aleo credits record into two separate records. This function does not require a fee.
2546
- *
2547
- * @param private_key The private key of the sender
2548
- * @param split_amount The amount of the credit split. This amount will be subtracted from the
2549
- * value of the record and two new records will be created with the split amount and the remainder
2550
- * @param amount_record The record to split
2551
- * @param url The url of the Aleo network node to send the transaction to
2552
- * @param split_proving_key (optional) Provide a proving key to use for the split function
2553
- * @param split_verifying_key (optional) Provide a verifying key to use for the split function
2554
- * @returns {Transaction | Error} Transaction object
2555
- * @param {PrivateKey} private_key
2556
- * @param {number} split_amount
2557
- * @param {RecordPlaintext} amount_record
2558
- * @param {string | undefined} [url]
2559
- * @param {ProvingKey | undefined} [split_proving_key]
2560
- * @param {VerifyingKey | undefined} [split_verifying_key]
2561
- * @param {OfflineQuery | undefined} [offline_query]
2562
- * @returns {Promise<Transaction>}
2563
- */
2564
- static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, offline_query) {
2565
- _assertClass(private_key, PrivateKey);
2566
- _assertClass(amount_record, RecordPlaintext);
2567
- var ptr0 = amount_record.__destroy_into_raw();
2568
- var ptr1 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2569
- var len1 = WASM_VECTOR_LEN;
2570
- let ptr2 = 0;
2571
- if (!isLikeNone(split_proving_key)) {
2572
- _assertClass(split_proving_key, ProvingKey);
2573
- ptr2 = split_proving_key.__destroy_into_raw();
2574
- }
2575
- let ptr3 = 0;
2576
- if (!isLikeNone(split_verifying_key)) {
2577
- _assertClass(split_verifying_key, VerifyingKey);
2578
- ptr3 = split_verifying_key.__destroy_into_raw();
2579
- }
2580
- let ptr4 = 0;
2581
- if (!isLikeNone(offline_query)) {
2582
- _assertClass(offline_query, OfflineQuery);
2583
- ptr4 = offline_query.__destroy_into_raw();
2584
- }
2585
- const ret = wasm.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
2586
- return takeObject(ret);
2587
- }
2588
- /**
2589
- * Send credits from one Aleo account to another
2590
- *
2591
- * @param private_key The private key of the sender
2592
- * @param amount_credits The amount of credits to send
2593
- * @param recipient The recipient of the transaction
2594
- * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2595
- * @param amount_record The record to fund the amount from
2596
- * @param fee_credits The amount of credits to pay as a fee
2597
- * @param fee_record The record to spend the fee from
2598
- * @param url The url of the Aleo network node to send the transaction to
2599
- * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2600
- * function
2601
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2602
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2603
- * @returns {Transaction | Error}
2604
- * @param {PrivateKey} private_key
2605
- * @param {number} amount_credits
2606
- * @param {string} recipient
2607
- * @param {string} transfer_type
2608
- * @param {string | undefined} caller
2609
- * @param {RecordPlaintext | undefined} amount_record
2610
- * @param {number} fee_credits
2611
- * @param {RecordPlaintext | undefined} [fee_record]
2612
- * @param {string | undefined} [url]
2613
- * @param {ProvingKey | undefined} [transfer_proving_key]
2614
- * @param {VerifyingKey | undefined} [transfer_verifying_key]
2615
- * @param {ProvingKey | undefined} [fee_proving_key]
2616
- * @param {VerifyingKey | undefined} [fee_verifying_key]
2617
- * @param {OfflineQuery | undefined} [offline_query]
2618
- * @returns {Promise<Transaction>}
2619
- */
2620
- static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, caller, amount_record, fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2621
- _assertClass(private_key, PrivateKey);
2622
- const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2623
- const len0 = WASM_VECTOR_LEN;
2624
- const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2625
- const len1 = WASM_VECTOR_LEN;
2626
- var ptr2 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2627
- var len2 = WASM_VECTOR_LEN;
2628
- let ptr3 = 0;
2629
- if (!isLikeNone(amount_record)) {
2630
- _assertClass(amount_record, RecordPlaintext);
2631
- ptr3 = amount_record.__destroy_into_raw();
2632
- }
2633
- let ptr4 = 0;
2634
- if (!isLikeNone(fee_record)) {
2635
- _assertClass(fee_record, RecordPlaintext);
2636
- ptr4 = fee_record.__destroy_into_raw();
2637
- }
2638
- var ptr5 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2639
- var len5 = WASM_VECTOR_LEN;
2640
- let ptr6 = 0;
2641
- if (!isLikeNone(transfer_proving_key)) {
2642
- _assertClass(transfer_proving_key, ProvingKey);
2643
- ptr6 = transfer_proving_key.__destroy_into_raw();
2644
- }
2645
- let ptr7 = 0;
2646
- if (!isLikeNone(transfer_verifying_key)) {
2647
- _assertClass(transfer_verifying_key, VerifyingKey);
2648
- ptr7 = transfer_verifying_key.__destroy_into_raw();
2649
- }
2650
- let ptr8 = 0;
2651
- if (!isLikeNone(fee_proving_key)) {
2652
- _assertClass(fee_proving_key, ProvingKey);
2653
- ptr8 = fee_proving_key.__destroy_into_raw();
2654
- }
2655
- let ptr9 = 0;
2656
- if (!isLikeNone(fee_verifying_key)) {
2657
- _assertClass(fee_verifying_key, VerifyingKey);
2658
- ptr9 = fee_verifying_key.__destroy_into_raw();
2659
- }
2660
- let ptr10 = 0;
2661
- if (!isLikeNone(offline_query)) {
2662
- _assertClass(offline_query, OfflineQuery);
2663
- ptr10 = offline_query.__destroy_into_raw();
2664
- }
2665
- const ret = wasm.programmanager_buildTransferTransaction(private_key.__wbg_ptr, amount_credits, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, fee_credits, ptr4, ptr5, len5, ptr6, ptr7, ptr8, ptr9, ptr10);
2666
- return takeObject(ret);
2667
- }
2668
- /**
2669
- * Synthesize proving and verifying keys for a program
2670
- *
2671
- * @param program {string} The program source code of the program to synthesize keys for
2672
- * @param function_id {string} The function to synthesize keys for
2673
- * @param inputs {Array} The inputs to the function
2674
- * @param imports {Object | undefined} The imports for the program
2675
- * @param {PrivateKey} private_key
2676
- * @param {string} program
2677
- * @param {string} function_id
2678
- * @param {Array<any>} inputs
2679
- * @param {object | undefined} [imports]
2680
- * @returns {Promise<KeyPair>}
2681
- */
2682
- static synthesizeKeyPair(private_key, program, function_id, inputs, imports) {
2683
- _assertClass(private_key, PrivateKey);
2684
- const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2685
- const len0 = WASM_VECTOR_LEN;
2686
- const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2687
- const len1 = WASM_VECTOR_LEN;
2688
- const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
2689
- return takeObject(ret);
2690
- }
2691
- }
2692
-
2693
- const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
2694
- ? { register: () => {}, unregister: () => {} }
2695
- : new FinalizationRegistry(ptr => wasm.__wbg_provingkey_free(ptr >>> 0));
2696
- /**
2697
- * Proving key for a function within an Aleo program
2698
- */
2699
- class ProvingKey {
2700
-
2701
- static __wrap(ptr) {
2702
- ptr = ptr >>> 0;
2703
- const obj = Object.create(ProvingKey.prototype);
2704
- obj.__wbg_ptr = ptr;
2705
- ProvingKeyFinalization.register(obj, obj.__wbg_ptr, obj);
2706
- return obj;
2707
- }
2708
-
2709
- __destroy_into_raw() {
2710
- const ptr = this.__wbg_ptr;
2711
- this.__wbg_ptr = 0;
2712
- ProvingKeyFinalization.unregister(this);
2713
- return ptr;
2714
- }
2715
-
2716
- free() {
2717
- const ptr = this.__destroy_into_raw();
2718
- wasm.__wbg_provingkey_free(ptr);
2719
- }
2720
- /**
2721
- * Verify if the proving key is for the bond_public function
2722
- *
2723
- * @example
2724
- * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
2725
- * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2726
- *
2727
- * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
2728
- * @returns {boolean}
2819
+ * @example
2820
+ * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
2821
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2822
+ *
2823
+ * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
2824
+ * @returns {boolean}
2729
2825
  */
2730
2826
  isBondPublicProver() {
2731
2827
  const ret = wasm.provingkey_isBondPublicProver(this.__wbg_ptr);
@@ -3062,7 +3158,7 @@ const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined
3062
3158
  /**
3063
3159
  * Encrypted Aleo record
3064
3160
  */
3065
- class RecordCiphertext {
3161
+ export class RecordCiphertext {
3066
3162
 
3067
3163
  static __wrap(ptr) {
3068
3164
  ptr = ptr >>> 0;
@@ -3176,7 +3272,7 @@ const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined'
3176
3272
  /**
3177
3273
  * Plaintext representation of an Aleo record
3178
3274
  */
3179
- class RecordPlaintext {
3275
+ export class RecordPlaintext {
3180
3276
 
3181
3277
  static __wrap(ptr) {
3182
3278
  ptr = ptr >>> 0;
@@ -3349,7 +3445,7 @@ const SignatureFinalization = (typeof FinalizationRegistry === 'undefined')
3349
3445
  /**
3350
3446
  * Cryptographic signature of a message signed by an Aleo account
3351
3447
  */
3352
- class Signature {
3448
+ export class Signature {
3353
3449
 
3354
3450
  static __wrap(ptr) {
3355
3451
  ptr = ptr >>> 0;
@@ -3384,7 +3480,7 @@ class Signature {
3384
3480
  _assertClass(private_key, PrivateKey);
3385
3481
  const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
3386
3482
  const len0 = WASM_VECTOR_LEN;
3387
- const ret = wasm.privatekey_sign(private_key.__wbg_ptr, ptr0, len0);
3483
+ const ret = wasm.signature_sign(private_key.__wbg_ptr, ptr0, len0);
3388
3484
  return Signature.__wrap(ret);
3389
3485
  }
3390
3486
  /**
@@ -3471,7 +3567,7 @@ const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
3471
3567
  * This object is created when generating an on-chain function deployment or execution and is the
3472
3568
  * object that should be submitted to the Aleo Network in order to deploy or execute a function.
3473
3569
  */
3474
- class Transaction {
3570
+ export class Transaction {
3475
3571
 
3476
3572
  static __wrap(ptr) {
3477
3573
  ptr = ptr >>> 0;
@@ -3596,7 +3692,7 @@ const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
3596
3692
  /**
3597
3693
  * Verifying key for a function within an Aleo program
3598
3694
  */
3599
- class VerifyingKey {
3695
+ export class VerifyingKey {
3600
3696
 
3601
3697
  static __wrap(ptr) {
3602
3698
  ptr = ptr >>> 0;
@@ -3618,39 +3714,167 @@ class VerifyingKey {
3618
3714
  wasm.__wbg_verifyingkey_free(ptr);
3619
3715
  }
3620
3716
  /**
3621
- * Returns the verifying key for the bond_public function
3717
+ * Get the checksum of the verifying key
3622
3718
  *
3623
- * @returns {VerifyingKey} Verifying key for the bond_public function
3624
- * @returns {VerifyingKey}
3719
+ * @returns {string} Checksum of the verifying key
3720
+ * @returns {string}
3625
3721
  */
3626
- static bondPublicVerifier() {
3627
- const ret = wasm.verifyingkey_bondPublicVerifier();
3628
- return VerifyingKey.__wrap(ret);
3722
+ checksum() {
3723
+ let deferred1_0;
3724
+ let deferred1_1;
3725
+ try {
3726
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3727
+ wasm.verifyingkey_checksum(retptr, this.__wbg_ptr);
3728
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3729
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3730
+ deferred1_0 = r0;
3731
+ deferred1_1 = r1;
3732
+ return getStringFromWasm0(r0, r1);
3733
+ } finally {
3734
+ wasm.__wbindgen_add_to_stack_pointer(16);
3735
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3736
+ }
3629
3737
  }
3630
3738
  /**
3631
- * Returns the verifying key for the bond_validator function
3739
+ * Create a copy of the verifying key
3632
3740
  *
3633
- * @returns {VerifyingKey} Verifying key for the bond_validator function
3741
+ * @returns {VerifyingKey} A copy of the verifying key
3634
3742
  * @returns {VerifyingKey}
3635
3743
  */
3636
- static bondValidatorVerifier() {
3637
- const ret = wasm.verifyingkey_bondValidatorVerifier();
3744
+ copy() {
3745
+ const ret = wasm.verifyingkey_copy(this.__wbg_ptr);
3638
3746
  return VerifyingKey.__wrap(ret);
3639
3747
  }
3640
3748
  /**
3641
- * Returns the verifying key for the claim_delegator function
3749
+ * Construct a new verifying key from a byte array
3642
3750
  *
3643
- * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
3751
+ * @param {Uint8Array} bytes Byte representation of a verifying key
3752
+ * @returns {VerifyingKey | Error}
3753
+ * @param {Uint8Array} bytes
3644
3754
  * @returns {VerifyingKey}
3645
3755
  */
3646
- static claimUnbondPublicVerifier() {
3647
- const ret = wasm.verifyingkey_claimUnbondPublicVerifier();
3648
- return VerifyingKey.__wrap(ret);
3756
+ static fromBytes(bytes) {
3757
+ try {
3758
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3759
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
3760
+ const len0 = WASM_VECTOR_LEN;
3761
+ wasm.verifyingkey_fromBytes(retptr, ptr0, len0);
3762
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3763
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3764
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3765
+ if (r2) {
3766
+ throw takeObject(r1);
3767
+ }
3768
+ return VerifyingKey.__wrap(r0);
3769
+ } finally {
3770
+ wasm.__wbindgen_add_to_stack_pointer(16);
3771
+ }
3649
3772
  }
3650
3773
  /**
3651
- * Returns the verifying key for the fee_private function
3774
+ * Create a verifying key from string
3652
3775
  *
3653
- * @returns {VerifyingKey} Verifying key for the fee_private function
3776
+ * @param {String} string String representation of a verifying key
3777
+ * @returns {VerifyingKey | Error}
3778
+ * @param {string} string
3779
+ * @returns {VerifyingKey}
3780
+ */
3781
+ static fromString(string) {
3782
+ try {
3783
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3784
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3785
+ const len0 = WASM_VECTOR_LEN;
3786
+ wasm.verifyingkey_fromString(retptr, ptr0, len0);
3787
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3788
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3789
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3790
+ if (r2) {
3791
+ throw takeObject(r1);
3792
+ }
3793
+ return VerifyingKey.__wrap(r0);
3794
+ } finally {
3795
+ wasm.__wbindgen_add_to_stack_pointer(16);
3796
+ }
3797
+ }
3798
+ /**
3799
+ * Create a byte array from a verifying key
3800
+ *
3801
+ * @returns {Uint8Array | Error} Byte representation of a verifying key
3802
+ * @returns {Uint8Array}
3803
+ */
3804
+ toBytes() {
3805
+ try {
3806
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3807
+ wasm.verifyingkey_toBytes(retptr, this.__wbg_ptr);
3808
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3809
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3810
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3811
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3812
+ if (r3) {
3813
+ throw takeObject(r2);
3814
+ }
3815
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3816
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3817
+ return v1;
3818
+ } finally {
3819
+ wasm.__wbindgen_add_to_stack_pointer(16);
3820
+ }
3821
+ }
3822
+ /**
3823
+ * Get a string representation of the verifying key
3824
+ *
3825
+ * @returns {String} String representation of the verifying key
3826
+ * @returns {string}
3827
+ */
3828
+ toString() {
3829
+ let deferred1_0;
3830
+ let deferred1_1;
3831
+ try {
3832
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3833
+ wasm.verifyingkey_toString(retptr, this.__wbg_ptr);
3834
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3835
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3836
+ deferred1_0 = r0;
3837
+ deferred1_1 = r1;
3838
+ return getStringFromWasm0(r0, r1);
3839
+ } finally {
3840
+ wasm.__wbindgen_add_to_stack_pointer(16);
3841
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3842
+ }
3843
+ }
3844
+ /**
3845
+ * Returns the verifying key for the bond_public function
3846
+ *
3847
+ * @returns {VerifyingKey} Verifying key for the bond_public function
3848
+ * @returns {VerifyingKey}
3849
+ */
3850
+ static bondPublicVerifier() {
3851
+ const ret = wasm.verifyingkey_bondPublicVerifier();
3852
+ return VerifyingKey.__wrap(ret);
3853
+ }
3854
+ /**
3855
+ * Returns the verifying key for the bond_validator function
3856
+ *
3857
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
3858
+ * @returns {VerifyingKey}
3859
+ */
3860
+ static bondValidatorVerifier() {
3861
+ const ret = wasm.verifyingkey_bondValidatorVerifier();
3862
+ return VerifyingKey.__wrap(ret);
3863
+ }
3864
+ /**
3865
+ * Returns the verifying key for the claim_delegator function
3866
+ *
3867
+ * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
3868
+ * @returns {VerifyingKey}
3869
+ */
3870
+ static claimUnbondPublicVerifier() {
3871
+ const ret = wasm.verifyingkey_claimUnbondPublicVerifier();
3872
+ return VerifyingKey.__wrap(ret);
3873
+ }
3874
+ /**
3875
+ * Returns the verifying key for the fee_private function
3876
+ *
3877
+ * @returns {VerifyingKey} Verifying key for the fee_private function
3654
3878
  * @returns {VerifyingKey}
3655
3879
  */
3656
3880
  static feePrivateVerifier() {
@@ -3917,134 +4141,6 @@ class VerifyingKey {
3917
4141
  const ret = wasm.verifyingkey_isUnbondPublicVerifier(this.__wbg_ptr);
3918
4142
  return ret !== 0;
3919
4143
  }
3920
- /**
3921
- * Get the checksum of the verifying key
3922
- *
3923
- * @returns {string} Checksum of the verifying key
3924
- * @returns {string}
3925
- */
3926
- checksum() {
3927
- let deferred1_0;
3928
- let deferred1_1;
3929
- try {
3930
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3931
- wasm.verifyingkey_checksum(retptr, this.__wbg_ptr);
3932
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3933
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3934
- deferred1_0 = r0;
3935
- deferred1_1 = r1;
3936
- return getStringFromWasm0(r0, r1);
3937
- } finally {
3938
- wasm.__wbindgen_add_to_stack_pointer(16);
3939
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3940
- }
3941
- }
3942
- /**
3943
- * Create a copy of the verifying key
3944
- *
3945
- * @returns {VerifyingKey} A copy of the verifying key
3946
- * @returns {VerifyingKey}
3947
- */
3948
- copy() {
3949
- const ret = wasm.verifyingkey_copy(this.__wbg_ptr);
3950
- return VerifyingKey.__wrap(ret);
3951
- }
3952
- /**
3953
- * Construct a new verifying key from a byte array
3954
- *
3955
- * @param {Uint8Array} bytes Byte representation of a verifying key
3956
- * @returns {VerifyingKey | Error}
3957
- * @param {Uint8Array} bytes
3958
- * @returns {VerifyingKey}
3959
- */
3960
- static fromBytes(bytes) {
3961
- try {
3962
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3963
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
3964
- const len0 = WASM_VECTOR_LEN;
3965
- wasm.verifyingkey_fromBytes(retptr, ptr0, len0);
3966
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3967
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3968
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3969
- if (r2) {
3970
- throw takeObject(r1);
3971
- }
3972
- return VerifyingKey.__wrap(r0);
3973
- } finally {
3974
- wasm.__wbindgen_add_to_stack_pointer(16);
3975
- }
3976
- }
3977
- /**
3978
- * Create a verifying key from string
3979
- *
3980
- * @param {String} string String representation of a verifying key
3981
- * @returns {VerifyingKey | Error}
3982
- * @param {string} string
3983
- * @returns {VerifyingKey}
3984
- */
3985
- static fromString(string) {
3986
- try {
3987
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3988
- const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3989
- const len0 = WASM_VECTOR_LEN;
3990
- wasm.verifyingkey_fromString(retptr, ptr0, len0);
3991
- var r0 = getInt32Memory0()[retptr / 4 + 0];
3992
- var r1 = getInt32Memory0()[retptr / 4 + 1];
3993
- var r2 = getInt32Memory0()[retptr / 4 + 2];
3994
- if (r2) {
3995
- throw takeObject(r1);
3996
- }
3997
- return VerifyingKey.__wrap(r0);
3998
- } finally {
3999
- wasm.__wbindgen_add_to_stack_pointer(16);
4000
- }
4001
- }
4002
- /**
4003
- * Create a byte array from a verifying key
4004
- *
4005
- * @returns {Uint8Array | Error} Byte representation of a verifying key
4006
- * @returns {Uint8Array}
4007
- */
4008
- toBytes() {
4009
- try {
4010
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4011
- wasm.verifyingkey_toBytes(retptr, this.__wbg_ptr);
4012
- var r0 = getInt32Memory0()[retptr / 4 + 0];
4013
- var r1 = getInt32Memory0()[retptr / 4 + 1];
4014
- var r2 = getInt32Memory0()[retptr / 4 + 2];
4015
- var r3 = getInt32Memory0()[retptr / 4 + 3];
4016
- if (r3) {
4017
- throw takeObject(r2);
4018
- }
4019
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
4020
- wasm.__wbindgen_free(r0, r1 * 1, 1);
4021
- return v1;
4022
- } finally {
4023
- wasm.__wbindgen_add_to_stack_pointer(16);
4024
- }
4025
- }
4026
- /**
4027
- * Get a string representation of the verifying key
4028
- *
4029
- * @returns {String} String representation of the verifying key
4030
- * @returns {string}
4031
- */
4032
- toString() {
4033
- let deferred1_0;
4034
- let deferred1_1;
4035
- try {
4036
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4037
- wasm.verifyingkey_toString(retptr, this.__wbg_ptr);
4038
- var r0 = getInt32Memory0()[retptr / 4 + 0];
4039
- var r1 = getInt32Memory0()[retptr / 4 + 1];
4040
- deferred1_0 = r0;
4041
- deferred1_1 = r1;
4042
- return getStringFromWasm0(r0, r1);
4043
- } finally {
4044
- wasm.__wbindgen_add_to_stack_pointer(16);
4045
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4046
- }
4047
- }
4048
4144
  }
4049
4145
 
4050
4146
  const ViewKeyFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4052,7 +4148,7 @@ const ViewKeyFinalization = (typeof FinalizationRegistry === 'undefined')
4052
4148
  : new FinalizationRegistry(ptr => wasm.__wbg_viewkey_free(ptr >>> 0));
4053
4149
  /**
4054
4150
  */
4055
- class ViewKey {
4151
+ export class ViewKey {
4056
4152
 
4057
4153
  static __wrap(ptr) {
4058
4154
  ptr = ptr >>> 0;
@@ -4083,7 +4179,7 @@ class ViewKey {
4083
4179
  */
4084
4180
  static from_private_key(private_key) {
4085
4181
  _assertClass(private_key, PrivateKey);
4086
- const ret = wasm.privatekey_to_view_key(private_key.__wbg_ptr);
4182
+ const ret = wasm.viewkey_from_private_key(private_key.__wbg_ptr);
4087
4183
  return ViewKey.__wrap(ret);
4088
4184
  }
4089
4185
  /**
@@ -4129,7 +4225,7 @@ class ViewKey {
4129
4225
  * @returns {Address}
4130
4226
  */
4131
4227
  to_address() {
4132
- const ret = wasm.address_from_view_key(this.__wbg_ptr);
4228
+ const ret = wasm.viewkey_to_address(this.__wbg_ptr);
4133
4229
  return Address.__wrap(ret);
4134
4230
  }
4135
4231
  /**
@@ -4245,127 +4341,21 @@ function __wbg_get_imports() {
4245
4341
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
4246
4342
  takeObject(arg0);
4247
4343
  };
4248
- imports.wbg.__wbg_new_71801a555ad9f2aa = function() { return handleError(function () {
4249
- const ret = new XMLHttpRequest();
4250
- return addHeapObject(ret);
4251
- }, arguments) };
4252
- imports.wbg.__wbg_overrideMimeType_ee9c51919ceb418b = function() { return handleError(function (arg0, arg1, arg2) {
4253
- getObject(arg0).overrideMimeType(getStringFromWasm0(arg1, arg2));
4254
- }, arguments) };
4255
- imports.wbg.__wbg_open_c9eb0cf2c9d95679 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
4256
- getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
4257
- }, arguments) };
4258
- imports.wbg.__wbg_send_80d29985093c1ec5 = function() { return handleError(function (arg0) {
4259
- getObject(arg0).send();
4260
- }, arguments) };
4261
- imports.wbg.__wbg_response_7c2e2759084f7279 = function() { return handleError(function (arg0) {
4262
- const ret = getObject(arg0).response;
4263
- return addHeapObject(ret);
4264
- }, arguments) };
4265
- imports.wbg.__wbg_status_d485fb5a478426fb = function() { return handleError(function (arg0) {
4266
- const ret = getObject(arg0).status;
4267
- return ret;
4268
- }, arguments) };
4269
- imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
4270
- const ret = new Object();
4344
+ imports.wbg.__wbg_executionresponse_new = function(arg0) {
4345
+ const ret = ExecutionResponse.__wrap(arg0);
4271
4346
  return addHeapObject(ret);
4272
4347
  };
4273
4348
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
4274
4349
  const ret = getStringFromWasm0(arg0, arg1);
4275
4350
  return addHeapObject(ret);
4276
4351
  };
4277
- imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
4278
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
4279
- return ret;
4280
- }, arguments) };
4281
- imports.wbg.__wbg_new_ab6fd82b10560829 = function() { return handleError(function () {
4282
- const ret = new Headers();
4283
- return addHeapObject(ret);
4284
- }, arguments) };
4285
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4286
- const ret = getObject(arg0);
4287
- return addHeapObject(ret);
4288
- };
4289
- imports.wbg.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
4290
- const ret = new AbortController();
4291
- return addHeapObject(ret);
4292
- }, arguments) };
4293
- imports.wbg.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
4294
- const ret = getObject(arg0).signal;
4295
- return addHeapObject(ret);
4296
- };
4297
- imports.wbg.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4298
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4299
- }, arguments) };
4300
- imports.wbg.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
4301
- let result;
4302
- try {
4303
- result = getObject(arg0) instanceof Response;
4304
- } catch (_) {
4305
- result = false;
4306
- }
4307
- const ret = result;
4308
- return ret;
4309
- };
4310
- imports.wbg.__wbg_status_61a01141acd3cf74 = function(arg0) {
4311
- const ret = getObject(arg0).status;
4312
- return ret;
4313
- };
4314
- imports.wbg.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
4315
- const ret = getObject(arg1).url;
4316
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4317
- const len1 = WASM_VECTOR_LEN;
4318
- getInt32Memory0()[arg0 / 4 + 1] = len1;
4319
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4320
- };
4321
- imports.wbg.__wbg_headers_9620bfada380764a = function(arg0) {
4322
- const ret = getObject(arg0).headers;
4323
- return addHeapObject(ret);
4324
- };
4325
- imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
4326
- const ret = Symbol.iterator;
4327
- return addHeapObject(ret);
4328
- };
4329
- imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
4330
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
4331
- return addHeapObject(ret);
4332
- }, arguments) };
4333
- imports.wbg.__wbindgen_is_function = function(arg0) {
4334
- const ret = typeof(getObject(arg0)) === 'function';
4335
- return ret;
4336
- };
4337
- imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
4338
- const ret = getObject(arg0).call(getObject(arg1));
4339
- return addHeapObject(ret);
4340
- }, arguments) };
4341
- imports.wbg.__wbindgen_is_object = function(arg0) {
4342
- const val = getObject(arg0);
4343
- const ret = typeof(val) === 'object' && val !== null;
4344
- return ret;
4345
- };
4346
- imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
4347
- const ret = getObject(arg0).next;
4348
- return addHeapObject(ret);
4349
- };
4350
- imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
4351
- const ret = getObject(arg0).next();
4352
- return addHeapObject(ret);
4353
- }, arguments) };
4354
- imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
4355
- const ret = getObject(arg0).done;
4356
- return ret;
4357
- };
4358
- imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
4359
- const ret = getObject(arg0).value;
4352
+ imports.wbg.__wbg_transaction_new = function(arg0) {
4353
+ const ret = Transaction.__wrap(arg0);
4360
4354
  return addHeapObject(ret);
4361
4355
  };
4362
- imports.wbg.__wbg_abort_2aa7521d5690750e = function(arg0) {
4363
- getObject(arg0).abort();
4356
+ imports.wbg.__wbg_log_b46ba1e74db5adee = function(arg0, arg1) {
4357
+ console.log(getStringFromWasm0(arg0, arg1));
4364
4358
  };
4365
- imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
4366
- const ret = JSON.stringify(getObject(arg0));
4367
- return addHeapObject(ret);
4368
- }, arguments) };
4369
4359
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
4370
4360
  const obj = getObject(arg1);
4371
4361
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -4374,49 +4364,23 @@ function __wbg_get_imports() {
4374
4364
  getInt32Memory0()[arg0 / 4 + 1] = len1;
4375
4365
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4376
4366
  };
4377
- imports.wbg.__wbg_log_f3433265eb640baa = function(arg0, arg1) {
4378
- console.log(getStringFromWasm0(arg0, arg1));
4379
- };
4380
- imports.wbg.__wbg_newwithlength_66ae46612e7f0234 = function(arg0) {
4381
- const ret = new Array(arg0 >>> 0);
4382
- return addHeapObject(ret);
4383
- };
4384
- imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
4385
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4386
- };
4387
- imports.wbg.__wbg_transaction_new = function(arg0) {
4388
- const ret = Transaction.__wrap(arg0);
4367
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4368
+ const ret = BigInt.asUintN(64, arg0);
4389
4369
  return addHeapObject(ret);
4390
4370
  };
4391
- imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
4392
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
4393
- return addHeapObject(ret);
4394
- }, arguments) };
4395
4371
  imports.wbg.__wbg_keypair_new = function(arg0) {
4396
4372
  const ret = KeyPair.__wrap(arg0);
4397
4373
  return addHeapObject(ret);
4398
4374
  };
4399
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4400
- const ret = BigInt.asUintN(64, arg0);
4401
- return addHeapObject(ret);
4402
- };
4403
- imports.wbg.__wbg_executionresponse_new = function(arg0) {
4404
- const ret = ExecutionResponse.__wrap(arg0);
4375
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4376
+ const ret = getObject(arg0);
4405
4377
  return addHeapObject(ret);
4406
4378
  };
4407
4379
  imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4408
4380
  const ret = AuthorizationResponse.__wrap(arg0);
4409
4381
  return addHeapObject(ret);
4410
4382
  };
4411
- imports.wbg.__wbindgen_module = function() {
4412
- const ret = __wbg_init.__wbindgen_wasm_module;
4413
- return addHeapObject(ret);
4414
- };
4415
- imports.wbg.__wbindgen_memory = function() {
4416
- const ret = wasm.memory;
4417
- return addHeapObject(ret);
4418
- };
4419
- imports.wbg.__wbg_spawnWorker_1bc5a4548b5096bf = function(arg0, arg1, arg2, arg3) {
4383
+ imports.wbg.__wbg_spawnWorker_d4740fc67f78311c = function(arg0, arg1, arg2, arg3) {
4420
4384
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
4421
4385
  return addHeapObject(ret);
4422
4386
  };
@@ -4429,44 +4393,6 @@ function __wbg_get_imports() {
4429
4393
  const ret = false;
4430
4394
  return ret;
4431
4395
  };
4432
- imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
4433
- const ret = new Array();
4434
- return addHeapObject(ret);
4435
- };
4436
- imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
4437
- const ret = getObject(arg0).push(getObject(arg1));
4438
- return ret;
4439
- };
4440
- imports.wbg.__wbg_arrayBuffer_29931d52c7206b02 = function() { return handleError(function (arg0) {
4441
- const ret = getObject(arg0).arrayBuffer();
4442
- return addHeapObject(ret);
4443
- }, arguments) };
4444
- imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
4445
- const ret = new Uint8Array(getObject(arg0));
4446
- return addHeapObject(ret);
4447
- };
4448
- imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
4449
- const ret = getObject(arg0).length;
4450
- return ret;
4451
- };
4452
- imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
4453
- try {
4454
- var state0 = {a: arg0, b: arg1};
4455
- var cb0 = (arg0, arg1) => {
4456
- const a = state0.a;
4457
- state0.a = 0;
4458
- try {
4459
- return __wbg_adapter_290(a, state0.b, arg0, arg1);
4460
- } finally {
4461
- state0.a = a;
4462
- }
4463
- };
4464
- const ret = new Promise(cb0);
4465
- return addHeapObject(ret);
4466
- } finally {
4467
- state0.a = state0.b = 0;
4468
- }
4469
- };
4470
4396
  imports.wbg.__wbindgen_number_new = function(arg0) {
4471
4397
  const ret = arg0;
4472
4398
  return addHeapObject(ret);
@@ -4493,31 +4419,121 @@ function __wbg_get_imports() {
4493
4419
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4494
4420
  }
4495
4421
  };
4496
- imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
4497
- const ret = getObject(arg0).buffer;
4422
+ imports.wbg.__wbg_fetch_bc7c8e27076a5c84 = function(arg0) {
4423
+ const ret = fetch(getObject(arg0));
4498
4424
  return addHeapObject(ret);
4499
4425
  };
4500
- imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
4501
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4426
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
4427
+ queueMicrotask(getObject(arg0));
4428
+ };
4429
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
4430
+ const ret = getObject(arg0).queueMicrotask;
4502
4431
  return addHeapObject(ret);
4503
4432
  };
4504
- imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
4505
- getObject(arg0).randomFillSync(takeObject(arg1));
4433
+ imports.wbg.__wbindgen_is_function = function(arg0) {
4434
+ const ret = typeof(getObject(arg0)) === 'function';
4435
+ return ret;
4436
+ };
4437
+ imports.wbg.__wbg_navigator_6c8fa55c5cc8796e = function(arg0) {
4438
+ const ret = getObject(arg0).navigator;
4439
+ return addHeapObject(ret);
4440
+ };
4441
+ imports.wbg.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
4442
+ const ret = getObject(arg0).fetch(getObject(arg1));
4443
+ return addHeapObject(ret);
4444
+ };
4445
+ imports.wbg.__wbg_hardwareConcurrency_cffbaa73aab5ff44 = function(arg0) {
4446
+ const ret = getObject(arg0).hardwareConcurrency;
4447
+ return ret;
4448
+ };
4449
+ imports.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0 = function() { return handleError(function (arg0, arg1, arg2) {
4450
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
4451
+ return addHeapObject(ret);
4506
4452
  }, arguments) };
4507
- imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
4508
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4453
+ imports.wbg.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
4454
+ const ret = getObject(arg0).signal;
4509
4455
  return addHeapObject(ret);
4510
4456
  };
4511
- imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
4512
- getObject(arg0).getRandomValues(getObject(arg1));
4457
+ imports.wbg.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
4458
+ const ret = new AbortController();
4459
+ return addHeapObject(ret);
4513
4460
  }, arguments) };
4514
- imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
4515
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4461
+ imports.wbg.__wbg_abort_2aa7521d5690750e = function(arg0) {
4462
+ getObject(arg0).abort();
4463
+ };
4464
+ imports.wbg.__wbg_new_ab6fd82b10560829 = function() { return handleError(function () {
4465
+ const ret = new Headers();
4466
+ return addHeapObject(ret);
4467
+ }, arguments) };
4468
+ imports.wbg.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4469
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4470
+ }, arguments) };
4471
+ imports.wbg.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
4472
+ let result;
4473
+ try {
4474
+ result = getObject(arg0) instanceof Response;
4475
+ } catch (_) {
4476
+ result = false;
4477
+ }
4478
+ const ret = result;
4479
+ return ret;
4480
+ };
4481
+ imports.wbg.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
4482
+ const ret = getObject(arg1).url;
4483
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4484
+ const len1 = WASM_VECTOR_LEN;
4485
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4486
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4487
+ };
4488
+ imports.wbg.__wbg_status_61a01141acd3cf74 = function(arg0) {
4489
+ const ret = getObject(arg0).status;
4490
+ return ret;
4491
+ };
4492
+ imports.wbg.__wbg_headers_9620bfada380764a = function(arg0) {
4493
+ const ret = getObject(arg0).headers;
4494
+ return addHeapObject(ret);
4516
4495
  };
4496
+ imports.wbg.__wbg_arrayBuffer_29931d52c7206b02 = function() { return handleError(function (arg0) {
4497
+ const ret = getObject(arg0).arrayBuffer();
4498
+ return addHeapObject(ret);
4499
+ }, arguments) };
4500
+ imports.wbg.__wbg_status_d485fb5a478426fb = function() { return handleError(function (arg0) {
4501
+ const ret = getObject(arg0).status;
4502
+ return ret;
4503
+ }, arguments) };
4504
+ imports.wbg.__wbg_response_7c2e2759084f7279 = function() { return handleError(function (arg0) {
4505
+ const ret = getObject(arg0).response;
4506
+ return addHeapObject(ret);
4507
+ }, arguments) };
4508
+ imports.wbg.__wbg_responseText_c67ed2d48db10769 = function() { return handleError(function (arg0, arg1) {
4509
+ const ret = getObject(arg1).responseText;
4510
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4511
+ var len1 = WASM_VECTOR_LEN;
4512
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4513
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4514
+ }, arguments) };
4515
+ imports.wbg.__wbg_new_71801a555ad9f2aa = function() { return handleError(function () {
4516
+ const ret = new XMLHttpRequest();
4517
+ return addHeapObject(ret);
4518
+ }, arguments) };
4519
+ imports.wbg.__wbg_open_c9eb0cf2c9d95679 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
4520
+ getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
4521
+ }, arguments) };
4522
+ imports.wbg.__wbg_overrideMimeType_ee9c51919ceb418b = function() { return handleError(function (arg0, arg1, arg2) {
4523
+ getObject(arg0).overrideMimeType(getStringFromWasm0(arg1, arg2));
4524
+ }, arguments) };
4525
+ imports.wbg.__wbg_send_80d29985093c1ec5 = function() { return handleError(function (arg0) {
4526
+ getObject(arg0).send();
4527
+ }, arguments) };
4517
4528
  imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
4518
4529
  const ret = getObject(arg0).crypto;
4519
4530
  return addHeapObject(ret);
4520
4531
  };
4532
+ imports.wbg.__wbindgen_is_object = function(arg0) {
4533
+ const val = getObject(arg0);
4534
+ const ret = typeof(val) === 'object' && val !== null;
4535
+ return ret;
4536
+ };
4521
4537
  imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
4522
4538
  const ret = getObject(arg0).process;
4523
4539
  return addHeapObject(ret);
@@ -4542,16 +4558,58 @@ function __wbg_get_imports() {
4542
4558
  const ret = getObject(arg0).msCrypto;
4543
4559
  return addHeapObject(ret);
4544
4560
  };
4545
- imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
4546
- const ret = new Uint8Array(arg0 >>> 0);
4561
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
4562
+ getObject(arg0).randomFillSync(takeObject(arg1));
4563
+ }, arguments) };
4564
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
4565
+ getObject(arg0).getRandomValues(getObject(arg1));
4566
+ }, arguments) };
4567
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
4568
+ const ret = getObject(arg0)[arg1 >>> 0];
4547
4569
  return addHeapObject(ret);
4548
4570
  };
4549
4571
  imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
4550
4572
  const ret = getObject(arg0).length;
4551
4573
  return ret;
4552
4574
  };
4553
- imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
4554
- const ret = getObject(arg0)[arg1 >>> 0];
4575
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
4576
+ const ret = new Array();
4577
+ return addHeapObject(ret);
4578
+ };
4579
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
4580
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
4581
+ return addHeapObject(ret);
4582
+ };
4583
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
4584
+ const ret = getObject(arg0).next;
4585
+ return addHeapObject(ret);
4586
+ };
4587
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
4588
+ const ret = getObject(arg0).next();
4589
+ return addHeapObject(ret);
4590
+ }, arguments) };
4591
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
4592
+ const ret = getObject(arg0).done;
4593
+ return ret;
4594
+ };
4595
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
4596
+ const ret = getObject(arg0).value;
4597
+ return addHeapObject(ret);
4598
+ };
4599
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
4600
+ const ret = Symbol.iterator;
4601
+ return addHeapObject(ret);
4602
+ };
4603
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
4604
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4605
+ return addHeapObject(ret);
4606
+ }, arguments) };
4607
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
4608
+ const ret = getObject(arg0).call(getObject(arg1));
4609
+ return addHeapObject(ret);
4610
+ }, arguments) };
4611
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
4612
+ const ret = new Object();
4555
4613
  return addHeapObject(ret);
4556
4614
  };
4557
4615
  imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
@@ -4574,122 +4632,110 @@ function __wbg_get_imports() {
4574
4632
  const ret = getObject(arg0) === undefined;
4575
4633
  return ret;
4576
4634
  };
4577
- imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
4578
- const ret = new Function(getStringFromWasm0(arg0, arg1));
4635
+ imports.wbg.__wbg_newwithlength_66ae46612e7f0234 = function(arg0) {
4636
+ const ret = new Array(arg0 >>> 0);
4579
4637
  return addHeapObject(ret);
4580
4638
  };
4581
- imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
4582
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
4639
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
4640
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4641
+ };
4642
+ imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
4643
+ const ret = getObject(arg0).push(getObject(arg1));
4583
4644
  return ret;
4584
- }, arguments) };
4585
- imports.wbg.__wbg_fetch_bc7c8e27076a5c84 = function(arg0) {
4586
- const ret = fetch(getObject(arg0));
4587
- return addHeapObject(ret);
4588
4645
  };
4589
- imports.wbg.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
4590
- const ret = getObject(arg0).fetch(getObject(arg1));
4646
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
4647
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
4591
4648
  return addHeapObject(ret);
4649
+ }, arguments) };
4650
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
4651
+ try {
4652
+ var state0 = {a: arg0, b: arg1};
4653
+ var cb0 = (arg0, arg1) => {
4654
+ const a = state0.a;
4655
+ state0.a = 0;
4656
+ try {
4657
+ return __wbg_adapter_327(a, state0.b, arg0, arg1);
4658
+ } finally {
4659
+ state0.a = a;
4660
+ }
4661
+ };
4662
+ const ret = new Promise(cb0);
4663
+ return addHeapObject(ret);
4664
+ } finally {
4665
+ state0.a = state0.b = 0;
4666
+ }
4592
4667
  };
4593
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
4594
- const ret = debugString(getObject(arg1));
4595
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4596
- const len1 = WASM_VECTOR_LEN;
4597
- getInt32Memory0()[arg0 / 4 + 1] = len1;
4598
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4599
- };
4600
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
4601
- throw new Error(getStringFromWasm0(arg0, arg1));
4602
- };
4603
- imports.wbg.__wbindgen_rethrow = function(arg0) {
4604
- throw takeObject(arg0);
4605
- };
4606
- imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
4607
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
4668
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
4669
+ const ret = Promise.resolve(getObject(arg0));
4608
4670
  return addHeapObject(ret);
4609
4671
  };
4610
4672
  imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
4611
4673
  const ret = getObject(arg0).then(getObject(arg1));
4612
4674
  return addHeapObject(ret);
4613
4675
  };
4614
- imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
4615
- queueMicrotask(getObject(arg0));
4616
- };
4617
- imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
4618
- const ret = getObject(arg0).queueMicrotask;
4676
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
4677
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
4619
4678
  return addHeapObject(ret);
4620
4679
  };
4621
- imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
4622
- const ret = Promise.resolve(getObject(arg0));
4680
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
4681
+ const ret = getObject(arg0).buffer;
4623
4682
  return addHeapObject(ret);
4624
4683
  };
4625
- imports.wbg.__wbg_waitAsync_5d743fc9058ba01a = function() {
4626
- const ret = Atomics.waitAsync;
4684
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
4685
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4627
4686
  return addHeapObject(ret);
4628
4687
  };
4629
- imports.wbg.__wbg_new_8cccba86b0f574cb = function(arg0) {
4630
- const ret = new Int32Array(getObject(arg0));
4688
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
4689
+ const ret = new Uint8Array(getObject(arg0));
4631
4690
  return addHeapObject(ret);
4632
4691
  };
4633
- imports.wbg.__wbg_waitAsync_46d5c36955b71a79 = function(arg0, arg1, arg2) {
4634
- const ret = Atomics.waitAsync(getObject(arg0), arg1, arg2);
4635
- return addHeapObject(ret);
4692
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
4693
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4636
4694
  };
4637
- imports.wbg.__wbg_async_19c0400d97cc72fe = function(arg0) {
4638
- const ret = getObject(arg0).async;
4695
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
4696
+ const ret = getObject(arg0).length;
4639
4697
  return ret;
4640
4698
  };
4641
- imports.wbg.__wbg_value_571d60108110e917 = function(arg0) {
4642
- const ret = getObject(arg0).value;
4699
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
4700
+ const ret = new Uint8Array(arg0 >>> 0);
4701
+ return addHeapObject(ret);
4702
+ };
4703
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
4704
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4643
4705
  return addHeapObject(ret);
4644
4706
  };
4645
- imports.wbg.__wbindgen_link_fc1eedd35dc7e0a6 = function(arg0) {
4646
- const ret = "data:application/javascript," + encodeURIComponent(`onmessage = function (ev) {
4647
- let [ia, index, value] = ev.data;
4648
- ia = new Int32Array(ia.buffer);
4649
- let result = Atomics.wait(ia, index, value);
4650
- postMessage(result);
4651
- };
4652
- `);
4707
+ imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
4708
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
4709
+ return ret;
4710
+ }, arguments) };
4711
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
4712
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
4713
+ return ret;
4714
+ }, arguments) };
4715
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
4716
+ const ret = JSON.stringify(getObject(arg0));
4717
+ return addHeapObject(ret);
4718
+ }, arguments) };
4719
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
4720
+ const ret = debugString(getObject(arg1));
4653
4721
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4654
4722
  const len1 = WASM_VECTOR_LEN;
4655
4723
  getInt32Memory0()[arg0 / 4 + 1] = len1;
4656
4724
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4657
4725
  };
4658
- imports.wbg.__wbg_new_d1187ae36d662ef9 = function() { return handleError(function (arg0, arg1) {
4659
- const ret = new Worker(getStringFromWasm0(arg0, arg1));
4660
- return addHeapObject(ret);
4661
- }, arguments) };
4662
- imports.wbg.__wbg_setonmessage_503809e5bb51bd33 = function(arg0, arg1) {
4663
- getObject(arg0).onmessage = getObject(arg1);
4664
- };
4665
- imports.wbg.__wbg_of_6a70eed8d41f469c = function(arg0, arg1, arg2) {
4666
- const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
4667
- return addHeapObject(ret);
4726
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
4727
+ throw new Error(getStringFromWasm0(arg0, arg1));
4668
4728
  };
4669
- imports.wbg.__wbg_postMessage_7380d10e8b8269df = function() { return handleError(function (arg0, arg1) {
4670
- getObject(arg0).postMessage(getObject(arg1));
4671
- }, arguments) };
4672
- imports.wbg.__wbg_data_3ce7c145ca4fbcdc = function(arg0) {
4673
- const ret = getObject(arg0).data;
4729
+ imports.wbg.__wbindgen_module = function() {
4730
+ const ret = __wbg_init.__wbindgen_wasm_module;
4674
4731
  return addHeapObject(ret);
4675
4732
  };
4676
- imports.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0 = function() { return handleError(function (arg0, arg1, arg2) {
4677
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
4678
- return addHeapObject(ret);
4679
- }, arguments) };
4680
- imports.wbg.__wbg_responseText_c67ed2d48db10769 = function() { return handleError(function (arg0, arg1) {
4681
- const ret = getObject(arg1).responseText;
4682
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4683
- var len1 = WASM_VECTOR_LEN;
4684
- getInt32Memory0()[arg0 / 4 + 1] = len1;
4685
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4686
- }, arguments) };
4687
- imports.wbg.__wbindgen_closure_wrapper5806 = function(arg0, arg1, arg2) {
4688
- const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_34);
4733
+ imports.wbg.__wbindgen_memory = function() {
4734
+ const ret = wasm.memory;
4689
4735
  return addHeapObject(ret);
4690
4736
  };
4691
- imports.wbg.__wbindgen_closure_wrapper5831 = function(arg0, arg1, arg2) {
4692
- const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_34);
4737
+ imports.wbg.__wbindgen_closure_wrapper6161 = function(arg0, arg1, arg2) {
4738
+ const ret = makeMutClosure(arg0, arg1, 865, __wbg_adapter_32);
4693
4739
  return addHeapObject(ret);
4694
4740
  };
4695
4741
 
@@ -4697,7 +4743,7 @@ function __wbg_get_imports() {
4697
4743
  }
4698
4744
 
4699
4745
  function __wbg_init_memory(imports, maybe_memory) {
4700
- imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:25,maximum:65536,shared:true});
4746
+
4701
4747
  }
4702
4748
 
4703
4749
  function __wbg_finalize_init(instance, module) {
@@ -4707,16 +4753,16 @@ function __wbg_finalize_init(instance, module) {
4707
4753
  cachedInt32Memory0 = null;
4708
4754
  cachedUint8Memory0 = null;
4709
4755
 
4710
- wasm.__wbindgen_start();
4756
+
4711
4757
  return wasm;
4712
4758
  }
4713
4759
 
4714
- function initSync(module, maybe_memory) {
4760
+ function initSync(module) {
4715
4761
  if (wasm !== undefined) return wasm;
4716
4762
 
4717
4763
  const imports = __wbg_get_imports();
4718
4764
 
4719
- __wbg_init_memory(imports, maybe_memory);
4765
+ __wbg_init_memory(imports);
4720
4766
 
4721
4767
  if (!(module instanceof WebAssembly.Module)) {
4722
4768
  module = new WebAssembly.Module(module);
@@ -4727,111 +4773,24 @@ function initSync(module, maybe_memory) {
4727
4773
  return __wbg_finalize_init(instance, module);
4728
4774
  }
4729
4775
 
4730
- async function __wbg_init(input, maybe_memory) {
4776
+ async function __wbg_init(input) {
4731
4777
  if (wasm !== undefined) return wasm;
4732
4778
 
4733
-
4779
+ if (typeof input === 'undefined') {
4780
+ input = new URL('aleo_wasm_bg.wasm', import.meta.url);
4781
+ }
4734
4782
  const imports = __wbg_get_imports();
4735
4783
 
4736
4784
  if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
4737
4785
  input = fetch(input);
4738
4786
  }
4739
4787
 
4740
- __wbg_init_memory(imports, maybe_memory);
4788
+ __wbg_init_memory(imports);
4741
4789
 
4742
4790
  const { instance, module } = await __wbg_load(await input, imports);
4743
4791
 
4744
4792
  return __wbg_finalize_init(instance, module);
4745
4793
  }
4746
4794
 
4747
- var exports = /*#__PURE__*/Object.freeze({
4748
- __proto__: null,
4749
- Address: Address,
4750
- AuthorizationResponse: AuthorizationResponse,
4751
- Execution: Execution,
4752
- ExecutionResponse: ExecutionResponse,
4753
- Field: Field,
4754
- JsField: JsField,
4755
- KeyPair: KeyPair,
4756
- Metadata: Metadata,
4757
- OfflineQuery: OfflineQuery,
4758
- PrivateKey: PrivateKey,
4759
- PrivateKeyCiphertext: PrivateKeyCiphertext,
4760
- Program: Program,
4761
- ProgramManager: ProgramManager,
4762
- ProvingKey: ProvingKey,
4763
- RecordCiphertext: RecordCiphertext,
4764
- RecordPlaintext: RecordPlaintext,
4765
- Signature: Signature,
4766
- Transaction: Transaction,
4767
- VerifyingKey: VerifyingKey,
4768
- ViewKey: ViewKey,
4769
- default: __wbg_init,
4770
- initSync: initSync,
4771
- initThreadPool: initThreadPool,
4772
- init_panic_hook: init_panic_hook,
4773
- runRayonThread: runRayonThread,
4774
- verifyFunctionExecution: verifyFunctionExecution
4775
- });
4776
-
4777
- const wasm_path = "assets/aleo_wasm.wasm";
4778
-
4779
-
4780
- var Cargo = async (opt = {}) => {
4781
- let {importHook, serverPath, initializeHook} = opt;
4782
-
4783
- let final_path = wasm_path;
4784
-
4785
- if (serverPath != null) {
4786
- final_path = serverPath + /[^\/\\]*$/.exec(final_path)[0];
4787
- }
4788
-
4789
- if (importHook != null) {
4790
- final_path = importHook(final_path);
4791
- }
4792
-
4793
- if (initializeHook != null) {
4794
- await initializeHook(__wbg_init, final_path);
4795
-
4796
- } else {
4797
- await __wbg_init(final_path);
4798
- }
4799
-
4800
- return exports;
4801
- };
4802
-
4803
- async function initializeWorker(wasm) {
4804
- // Wait for the main thread to send us the Module, Memory, and Rayon thread pointer.
4805
- function wait() {
4806
- return new Promise((resolve) => {
4807
- addEventListener("message", (event) => {
4808
- resolve(event.data);
4809
- }, {
4810
- capture: true,
4811
- once: true,
4812
- });
4813
- });
4814
- }
4815
-
4816
- const [initWasm, { module, memory, address }] = await Promise.all([
4817
- wasm,
4818
- wait(),
4819
- ]);
4820
-
4821
- // Runs the Wasm inside of the Worker, but using the main thread's Module and Memory.
4822
- const exports = await initWasm({
4823
- initializeHook: (init, path) => init(module, memory),
4824
- });
4825
-
4826
- // Tells the main thread that we're finished initializing.
4827
- postMessage(null);
4828
-
4829
- // This will hang the Worker while running the Rayon thread.
4830
- exports.runRayonThread(address);
4831
-
4832
- // When the Rayon thread is finished, close the Worker.
4833
- close();
4834
- }
4835
-
4836
- await initializeWorker(Cargo);
4837
- //# sourceMappingURL=worker.js.map
4795
+ export { initSync }
4796
+ export default __wbg_init;