@puzzlehq/aleo-wasm-web 0.6.14 → 0.6.15

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-57777c8959d12193/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) {
@@ -247,12 +230,32 @@ function _assertClass(instance, klass) {
247
230
  }
248
231
  return instance.ptr;
249
232
  }
233
+ /**
234
+ * @param {number} receiver
235
+ */
236
+ export function runRayonThread(receiver) {
237
+ wasm.runRayonThread(receiver);
238
+ }
250
239
 
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;
240
+ /**
241
+ */
242
+ export function init_panic_hook() {
243
+ wasm.init_panic_hook();
244
+ }
245
+
246
+ /**
247
+ * @param {URL} url
248
+ * @param {number} num_threads
249
+ * @returns {Promise<void>}
250
+ */
251
+ export function initThreadPool(url, num_threads) {
252
+ const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
253
+ return takeObject(ret);
254
+ }
255
+
256
+ function getArrayU8FromWasm0(ptr, len) {
257
+ ptr = ptr >>> 0;
258
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
256
259
  }
257
260
  /**
258
261
  * Verify an execution with a single function and a single transition. Executions with multiple
@@ -270,7 +273,7 @@ function passArray8ToWasm0(arg, malloc) {
270
273
  * @param {string} function_id
271
274
  * @returns {boolean}
272
275
  */
273
- function verifyFunctionExecution(execution, verifying_key, program, function_id) {
276
+ export function verifyFunctionExecution(execution, verifying_key, program, function_id) {
274
277
  try {
275
278
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
279
  _assertClass(execution, Execution);
@@ -294,39 +297,12 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id)
294
297
  let cachedBigInt64Memory0 = null;
295
298
 
296
299
  function getBigInt64Memory0() {
297
- if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.buffer !== wasm.memory.buffer) {
300
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
298
301
  cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
299
302
  }
300
303
  return cachedBigInt64Memory0;
301
304
  }
302
305
 
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
306
  function handleError(f, args) {
331
307
  try {
332
308
  return f.apply(this, args);
@@ -334,8 +310,8 @@ function handleError(f, args) {
334
310
  wasm.__wbindgen_exn_store(addHeapObject(e));
335
311
  }
336
312
  }
337
- function __wbg_adapter_290(arg0, arg1, arg2, arg3) {
338
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h630419b3c55d46e4(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
313
+ function __wbg_adapter_322(arg0, arg1, arg2, arg3) {
314
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h69b3d6b389ddc7fb(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
339
315
  }
340
316
 
341
317
  const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -344,7 +320,7 @@ const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
344
320
  /**
345
321
  * Public address of an Aleo account
346
322
  */
347
- class Address {
323
+ export class Address {
348
324
 
349
325
  static __wrap(ptr) {
350
326
  ptr = ptr >>> 0;
@@ -451,7 +427,7 @@ const AuthorizationResponseFinalization = (typeof FinalizationRegistry === 'unde
451
427
  : new FinalizationRegistry(ptr => wasm.__wbg_authorizationresponse_free(ptr >>> 0));
452
428
  /**
453
429
  */
454
- class AuthorizationResponse {
430
+ export class AuthorizationResponse {
455
431
 
456
432
  static __wrap(ptr) {
457
433
  ptr = ptr >>> 0;
@@ -480,7 +456,7 @@ class AuthorizationResponse {
480
456
  let deferred1_1;
481
457
  try {
482
458
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
- wasm.__wbg_get_metadata_locator(retptr, this.__wbg_ptr);
459
+ wasm.authorizationresponse_authorization(retptr, this.__wbg_ptr);
484
460
  var r0 = getInt32Memory0()[retptr / 4 + 0];
485
461
  var r1 = getInt32Memory0()[retptr / 4 + 1];
486
462
  deferred1_0 = r0;
@@ -499,7 +475,7 @@ class AuthorizationResponse {
499
475
  let deferred1_1;
500
476
  try {
501
477
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
502
- wasm.__wbg_get_metadata_prover(retptr, this.__wbg_ptr);
478
+ wasm.authorizationresponse_fee_authorization(retptr, this.__wbg_ptr);
503
479
  var r0 = getInt32Memory0()[retptr / 4 + 0];
504
480
  var r1 = getInt32Memory0()[retptr / 4 + 1];
505
481
  deferred1_0 = r0;
@@ -518,7 +494,7 @@ const ExecutionFinalization = (typeof FinalizationRegistry === 'undefined')
518
494
  /**
519
495
  * Execution of an Aleo program.
520
496
  */
521
- class Execution {
497
+ export class Execution {
522
498
 
523
499
  static __wrap(ptr) {
524
500
  ptr = ptr >>> 0;
@@ -592,7 +568,7 @@ const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefine
592
568
  * This object is returned by the execution of an Aleo function off-chain. It provides methods for
593
569
  * retrieving the outputs of the function execution.
594
570
  */
595
- class ExecutionResponse {
571
+ export class ExecutionResponse {
596
572
 
597
573
  static __wrap(ptr) {
598
574
  ptr = ptr >>> 0;
@@ -709,7 +685,7 @@ const FieldFinalization = (typeof FinalizationRegistry === 'undefined')
709
685
  : new FinalizationRegistry(ptr => wasm.__wbg_field_free(ptr >>> 0));
710
686
  /**
711
687
  */
712
- class Field {
688
+ export class Field {
713
689
 
714
690
  static __wrap(ptr) {
715
691
  ptr = ptr >>> 0;
@@ -777,7 +753,7 @@ const JsFieldFinalization = (typeof FinalizationRegistry === 'undefined')
777
753
  : new FinalizationRegistry(ptr => wasm.__wbg_jsfield_free(ptr >>> 0));
778
754
  /**
779
755
  */
780
- class JsField {
756
+ export class JsField {
781
757
 
782
758
  __destroy_into_raw() {
783
759
  const ptr = this.__wbg_ptr;
@@ -852,7 +828,7 @@ const KeyPairFinalization = (typeof FinalizationRegistry === 'undefined')
852
828
  /**
853
829
  * Key pair object containing both the function proving and verifying keys
854
830
  */
855
- class KeyPair {
831
+ export class KeyPair {
856
832
 
857
833
  static __wrap(ptr) {
858
834
  ptr = ptr >>> 0;
@@ -940,7 +916,7 @@ const MetadataFinalization = (typeof FinalizationRegistry === 'undefined')
940
916
  : new FinalizationRegistry(ptr => wasm.__wbg_metadata_free(ptr >>> 0));
941
917
  /**
942
918
  */
943
- class Metadata {
919
+ export class Metadata {
944
920
 
945
921
  static __wrap(ptr) {
946
922
  ptr = ptr >>> 0;
@@ -1202,7 +1178,7 @@ const OfflineQueryFinalization = (typeof FinalizationRegistry === 'undefined')
1202
1178
  * An offline query object used to insert the global state root and state paths needed to create
1203
1179
  * a valid inclusion proof offline.
1204
1180
  */
1205
- class OfflineQuery {
1181
+ export class OfflineQuery {
1206
1182
 
1207
1183
  static __wrap(ptr) {
1208
1184
  ptr = ptr >>> 0;
@@ -1320,7 +1296,7 @@ const PrivateKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1320
1296
  /**
1321
1297
  * Private key of an Aleo account
1322
1298
  */
1323
- class PrivateKey {
1299
+ export class PrivateKey {
1324
1300
 
1325
1301
  static __wrap(ptr) {
1326
1302
  ptr = ptr >>> 0;
@@ -1558,7 +1534,7 @@ const PrivateKeyCiphertextFinalization = (typeof FinalizationRegistry === 'undef
1558
1534
  /**
1559
1535
  * Private Key in ciphertext form
1560
1536
  */
1561
- class PrivateKeyCiphertext {
1537
+ export class PrivateKeyCiphertext {
1562
1538
 
1563
1539
  static __wrap(ptr) {
1564
1540
  ptr = ptr >>> 0;
@@ -1596,7 +1572,7 @@ class PrivateKeyCiphertext {
1596
1572
  _assertClass(private_key, PrivateKey);
1597
1573
  const ptr0 = passStringToWasm0(secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1598
1574
  const len0 = WASM_VECTOR_LEN;
1599
- wasm.privatekey_toCiphertext(retptr, private_key.__wbg_ptr, ptr0, len0);
1575
+ wasm.privatekeyciphertext_encryptPrivateKey(retptr, private_key.__wbg_ptr, ptr0, len0);
1600
1576
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1601
1577
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1602
1578
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1689,7 +1665,7 @@ const ProgramFinalization = (typeof FinalizationRegistry === 'undefined')
1689
1665
  /**
1690
1666
  * Webassembly Representation of an Aleo program
1691
1667
  */
1692
- class Program {
1668
+ export class Program {
1693
1669
 
1694
1670
  static __wrap(ptr) {
1695
1671
  ptr = ptr >>> 0;
@@ -2106,7 +2082,7 @@ const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
2106
2082
  : new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0));
2107
2083
  /**
2108
2084
  */
2109
- class ProgramManager {
2085
+ export class ProgramManager {
2110
2086
 
2111
2087
  __destroy_into_raw() {
2112
2088
  const ptr = this.__wbg_ptr;
@@ -2120,104 +2096,320 @@ class ProgramManager {
2120
2096
  wasm.__wbg_programmanager_free(ptr);
2121
2097
  }
2122
2098
  /**
2123
- * Deploy an Aleo program
2099
+ * Synthesize proving and verifying keys for a program
2100
+ *
2101
+ * @param program {string} The program source code of the program to synthesize keys for
2102
+ * @param function_id {string} The function to synthesize keys for
2103
+ * @param inputs {Array} The inputs to the function
2104
+ * @param imports {Object | undefined} The imports for the program
2105
+ * @param {PrivateKey} private_key
2106
+ * @param {string} program
2107
+ * @param {string} function_id
2108
+ * @param {Array<any>} inputs
2109
+ * @param {object | undefined} [imports]
2110
+ * @returns {Promise<KeyPair>}
2111
+ */
2112
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports) {
2113
+ _assertClass(private_key, PrivateKey);
2114
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2115
+ const len0 = WASM_VECTOR_LEN;
2116
+ const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2117
+ const len1 = WASM_VECTOR_LEN;
2118
+ const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
2119
+ return takeObject(ret);
2120
+ }
2121
+ /**
2122
+ * Send credits from one Aleo account to another
2124
2123
  *
2125
2124
  * @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
2125
+ * @param amount_credits The amount of credits to send
2126
+ * @param recipient The recipient of the transaction
2127
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2128
+ * @param amount_record The record to fund the amount from
2131
2129
  * @param fee_credits The amount of credits to pay as a fee
2132
2130
  * @param fee_record The record to spend the fee from
2133
2131
  * @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" \}
2132
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2133
+ * function
2137
2134
  * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2138
2135
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2139
2136
  * @returns {Transaction | Error}
2140
2137
  * @param {PrivateKey} private_key
2141
- * @param {string} program
2138
+ * @param {number} amount_credits
2139
+ * @param {string} recipient
2140
+ * @param {string} transfer_type
2141
+ * @param {string | undefined} caller
2142
+ * @param {RecordPlaintext | undefined} amount_record
2142
2143
  * @param {number} fee_credits
2143
2144
  * @param {RecordPlaintext | undefined} [fee_record]
2144
2145
  * @param {string | undefined} [url]
2145
- * @param {object | undefined} [imports]
2146
+ * @param {ProvingKey | undefined} [transfer_proving_key]
2147
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
2146
2148
  * @param {ProvingKey | undefined} [fee_proving_key]
2147
2149
  * @param {VerifyingKey | undefined} [fee_verifying_key]
2148
2150
  * @param {OfflineQuery | undefined} [offline_query]
2149
2151
  * @returns {Promise<Transaction>}
2150
2152
  */
2151
- static buildDeploymentTransaction(private_key, program, fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
2153
+ 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) {
2152
2154
  _assertClass(private_key, PrivateKey);
2153
- const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2155
+ const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2154
2156
  const len0 = WASM_VECTOR_LEN;
2155
- let ptr1 = 0;
2157
+ const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2158
+ const len1 = WASM_VECTOR_LEN;
2159
+ var ptr2 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2160
+ var len2 = WASM_VECTOR_LEN;
2161
+ let ptr3 = 0;
2162
+ if (!isLikeNone(amount_record)) {
2163
+ _assertClass(amount_record, RecordPlaintext);
2164
+ ptr3 = amount_record.__destroy_into_raw();
2165
+ }
2166
+ let ptr4 = 0;
2156
2167
  if (!isLikeNone(fee_record)) {
2157
2168
  _assertClass(fee_record, RecordPlaintext);
2158
- ptr1 = fee_record.__destroy_into_raw();
2169
+ ptr4 = fee_record.__destroy_into_raw();
2159
2170
  }
2160
- var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2161
- var len2 = WASM_VECTOR_LEN;
2162
- let ptr3 = 0;
2171
+ var ptr5 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2172
+ var len5 = WASM_VECTOR_LEN;
2173
+ let ptr6 = 0;
2174
+ if (!isLikeNone(transfer_proving_key)) {
2175
+ _assertClass(transfer_proving_key, ProvingKey);
2176
+ ptr6 = transfer_proving_key.__destroy_into_raw();
2177
+ }
2178
+ let ptr7 = 0;
2179
+ if (!isLikeNone(transfer_verifying_key)) {
2180
+ _assertClass(transfer_verifying_key, VerifyingKey);
2181
+ ptr7 = transfer_verifying_key.__destroy_into_raw();
2182
+ }
2183
+ let ptr8 = 0;
2163
2184
  if (!isLikeNone(fee_proving_key)) {
2164
2185
  _assertClass(fee_proving_key, ProvingKey);
2165
- ptr3 = fee_proving_key.__destroy_into_raw();
2186
+ ptr8 = fee_proving_key.__destroy_into_raw();
2166
2187
  }
2167
- let ptr4 = 0;
2188
+ let ptr9 = 0;
2168
2189
  if (!isLikeNone(fee_verifying_key)) {
2169
2190
  _assertClass(fee_verifying_key, VerifyingKey);
2170
- ptr4 = fee_verifying_key.__destroy_into_raw();
2191
+ ptr9 = fee_verifying_key.__destroy_into_raw();
2171
2192
  }
2172
- let ptr5 = 0;
2193
+ let ptr10 = 0;
2173
2194
  if (!isLikeNone(offline_query)) {
2174
2195
  _assertClass(offline_query, OfflineQuery);
2175
- ptr5 = offline_query.__destroy_into_raw();
2196
+ ptr10 = offline_query.__destroy_into_raw();
2176
2197
  }
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);
2198
+ 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);
2178
2199
  return takeObject(ret);
2179
2200
  }
2180
2201
  /**
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
2202
+ * Join two records together to create a new record with an amount of credits equal to the sum
2203
+ * of the credits of the two original records
2184
2204
  *
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>}
2205
+ * @param private_key The private key of the sender
2206
+ * @param record_1 The first record to combine
2207
+ * @param record_2 The second record to combine
2208
+ * @param fee_credits The amount of credits to pay as a fee
2209
+ * @param fee_record The record to spend the fee from
2210
+ * @param url The url of the Aleo network node to send the transaction to
2211
+ * @param join_proving_key (optional) Provide a proving key to use for the join function
2212
+ * @param join_verifying_key (optional) Provide a verifying key to use for the join function
2213
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2214
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2215
+ * @returns {Transaction | Error} Transaction object
2216
+ * @param {PrivateKey} private_key
2217
+ * @param {RecordPlaintext} record_1
2218
+ * @param {RecordPlaintext} record_2
2219
+ * @param {number} fee_credits
2220
+ * @param {RecordPlaintext | undefined} [fee_record]
2221
+ * @param {string | undefined} [url]
2222
+ * @param {ProvingKey | undefined} [join_proving_key]
2223
+ * @param {VerifyingKey | undefined} [join_verifying_key]
2224
+ * @param {ProvingKey | undefined} [fee_proving_key]
2225
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2226
+ * @param {OfflineQuery | undefined} [offline_query]
2227
+ * @returns {Promise<Transaction>}
2193
2228
  */
2194
- static estimateDeploymentFee(program, imports) {
2195
- const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2196
- const len0 = WASM_VECTOR_LEN;
2197
- const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports));
2229
+ 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) {
2230
+ _assertClass(private_key, PrivateKey);
2231
+ _assertClass(record_1, RecordPlaintext);
2232
+ var ptr0 = record_1.__destroy_into_raw();
2233
+ _assertClass(record_2, RecordPlaintext);
2234
+ var ptr1 = record_2.__destroy_into_raw();
2235
+ let ptr2 = 0;
2236
+ if (!isLikeNone(fee_record)) {
2237
+ _assertClass(fee_record, RecordPlaintext);
2238
+ ptr2 = fee_record.__destroy_into_raw();
2239
+ }
2240
+ var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2241
+ var len3 = WASM_VECTOR_LEN;
2242
+ let ptr4 = 0;
2243
+ if (!isLikeNone(join_proving_key)) {
2244
+ _assertClass(join_proving_key, ProvingKey);
2245
+ ptr4 = join_proving_key.__destroy_into_raw();
2246
+ }
2247
+ let ptr5 = 0;
2248
+ if (!isLikeNone(join_verifying_key)) {
2249
+ _assertClass(join_verifying_key, VerifyingKey);
2250
+ ptr5 = join_verifying_key.__destroy_into_raw();
2251
+ }
2252
+ let ptr6 = 0;
2253
+ if (!isLikeNone(fee_proving_key)) {
2254
+ _assertClass(fee_proving_key, ProvingKey);
2255
+ ptr6 = fee_proving_key.__destroy_into_raw();
2256
+ }
2257
+ let ptr7 = 0;
2258
+ if (!isLikeNone(fee_verifying_key)) {
2259
+ _assertClass(fee_verifying_key, VerifyingKey);
2260
+ ptr7 = fee_verifying_key.__destroy_into_raw();
2261
+ }
2262
+ let ptr8 = 0;
2263
+ if (!isLikeNone(offline_query)) {
2264
+ _assertClass(offline_query, OfflineQuery);
2265
+ ptr8 = offline_query.__destroy_into_raw();
2266
+ }
2267
+ const ret = wasm.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
2198
2268
  return takeObject(ret);
2199
2269
  }
2200
2270
  /**
2201
- * Estimate the component of the deployment cost which comes from the fee for the program name.
2202
- * Note that this cost does not represent the entire cost of deployment. It is additional to
2203
- * the cost of the size (in bytes) of the deployment.
2204
- *
2205
- * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2271
+ * Split an Aleo credits record into two separate records. This function does not require a fee.
2206
2272
  *
2207
- * @param name The name of the program to be deployed
2208
- * @returns {u64 | Error}
2209
- * @param {string} name
2210
- * @returns {bigint}
2211
- */
2212
- static estimateProgramNameCost(name) {
2213
- try {
2214
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2215
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2216
- const len0 = WASM_VECTOR_LEN;
2217
- wasm.programmanager_estimateProgramNameCost(retptr, ptr0, len0);
2218
- var r0 = getBigInt64Memory0()[retptr / 8 + 0];
2219
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2220
- var r3 = getInt32Memory0()[retptr / 4 + 3];
2273
+ * @param private_key The private key of the sender
2274
+ * @param split_amount The amount of the credit split. This amount will be subtracted from the
2275
+ * value of the record and two new records will be created with the split amount and the remainder
2276
+ * @param amount_record The record to split
2277
+ * @param url The url of the Aleo network node to send the transaction to
2278
+ * @param split_proving_key (optional) Provide a proving key to use for the split function
2279
+ * @param split_verifying_key (optional) Provide a verifying key to use for the split function
2280
+ * @returns {Transaction | Error} Transaction object
2281
+ * @param {PrivateKey} private_key
2282
+ * @param {number} split_amount
2283
+ * @param {RecordPlaintext} amount_record
2284
+ * @param {string | undefined} [url]
2285
+ * @param {ProvingKey | undefined} [split_proving_key]
2286
+ * @param {VerifyingKey | undefined} [split_verifying_key]
2287
+ * @param {OfflineQuery | undefined} [offline_query]
2288
+ * @returns {Promise<Transaction>}
2289
+ */
2290
+ static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, offline_query) {
2291
+ _assertClass(private_key, PrivateKey);
2292
+ _assertClass(amount_record, RecordPlaintext);
2293
+ var ptr0 = amount_record.__destroy_into_raw();
2294
+ var ptr1 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2295
+ var len1 = WASM_VECTOR_LEN;
2296
+ let ptr2 = 0;
2297
+ if (!isLikeNone(split_proving_key)) {
2298
+ _assertClass(split_proving_key, ProvingKey);
2299
+ ptr2 = split_proving_key.__destroy_into_raw();
2300
+ }
2301
+ let ptr3 = 0;
2302
+ if (!isLikeNone(split_verifying_key)) {
2303
+ _assertClass(split_verifying_key, VerifyingKey);
2304
+ ptr3 = split_verifying_key.__destroy_into_raw();
2305
+ }
2306
+ let ptr4 = 0;
2307
+ if (!isLikeNone(offline_query)) {
2308
+ _assertClass(offline_query, OfflineQuery);
2309
+ ptr4 = offline_query.__destroy_into_raw();
2310
+ }
2311
+ const ret = wasm.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
2312
+ return takeObject(ret);
2313
+ }
2314
+ /**
2315
+ * Deploy an Aleo program
2316
+ *
2317
+ * @param private_key The private key of the sender
2318
+ * @param program The source code of the program being deployed
2319
+ * @param imports A javascript object holding the source code of any imported programs in the
2320
+ * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
2321
+ * Note that all imported programs must be deployed on chain before the main program in order
2322
+ * for the deployment to succeed
2323
+ * @param fee_credits The amount of credits to pay as a fee
2324
+ * @param fee_record The record to spend the fee from
2325
+ * @param url The url of the Aleo network node to send the transaction to
2326
+ * @param imports (optional) Provide a list of imports to use for the program deployment in the
2327
+ * form of a javascript object where the keys are a string of the program name and the values
2328
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2329
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2330
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2331
+ * @returns {Transaction | Error}
2332
+ * @param {PrivateKey} private_key
2333
+ * @param {string} program
2334
+ * @param {number} fee_credits
2335
+ * @param {RecordPlaintext | undefined} [fee_record]
2336
+ * @param {string | undefined} [url]
2337
+ * @param {object | undefined} [imports]
2338
+ * @param {ProvingKey | undefined} [fee_proving_key]
2339
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2340
+ * @param {OfflineQuery | undefined} [offline_query]
2341
+ * @returns {Promise<Transaction>}
2342
+ */
2343
+ static buildDeploymentTransaction(private_key, program, fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
2344
+ _assertClass(private_key, PrivateKey);
2345
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2346
+ const len0 = WASM_VECTOR_LEN;
2347
+ let ptr1 = 0;
2348
+ if (!isLikeNone(fee_record)) {
2349
+ _assertClass(fee_record, RecordPlaintext);
2350
+ ptr1 = fee_record.__destroy_into_raw();
2351
+ }
2352
+ var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2353
+ var len2 = WASM_VECTOR_LEN;
2354
+ let ptr3 = 0;
2355
+ if (!isLikeNone(fee_proving_key)) {
2356
+ _assertClass(fee_proving_key, ProvingKey);
2357
+ ptr3 = fee_proving_key.__destroy_into_raw();
2358
+ }
2359
+ let ptr4 = 0;
2360
+ if (!isLikeNone(fee_verifying_key)) {
2361
+ _assertClass(fee_verifying_key, VerifyingKey);
2362
+ ptr4 = fee_verifying_key.__destroy_into_raw();
2363
+ }
2364
+ let ptr5 = 0;
2365
+ if (!isLikeNone(offline_query)) {
2366
+ _assertClass(offline_query, OfflineQuery);
2367
+ ptr5 = offline_query.__destroy_into_raw();
2368
+ }
2369
+ const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
2370
+ return takeObject(ret);
2371
+ }
2372
+ /**
2373
+ * Estimate the fee for a program deployment
2374
+ *
2375
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2376
+ *
2377
+ * @param program The source code of the program being deployed
2378
+ * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
2379
+ * in the form of a javascript object where the keys are a string of the program name and the values
2380
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
2381
+ * @returns {u64 | Error}
2382
+ * @param {string} program
2383
+ * @param {object | undefined} [imports]
2384
+ * @returns {Promise<bigint>}
2385
+ */
2386
+ static estimateDeploymentFee(program, imports) {
2387
+ const ptr0 = passStringToWasm0(program, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2388
+ const len0 = WASM_VECTOR_LEN;
2389
+ const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports));
2390
+ return takeObject(ret);
2391
+ }
2392
+ /**
2393
+ * Estimate the component of the deployment cost which comes from the fee for the program name.
2394
+ * Note that this cost does not represent the entire cost of deployment. It is additional to
2395
+ * the cost of the size (in bytes) of the deployment.
2396
+ *
2397
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
2398
+ *
2399
+ * @param name The name of the program to be deployed
2400
+ * @returns {u64 | Error}
2401
+ * @param {string} name
2402
+ * @returns {bigint}
2403
+ */
2404
+ static estimateProgramNameCost(name) {
2405
+ try {
2406
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2407
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2408
+ const len0 = WASM_VECTOR_LEN;
2409
+ wasm.programmanager_estimateProgramNameCost(retptr, ptr0, len0);
2410
+ var r0 = getBigInt64Memory0()[retptr / 8 + 0];
2411
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2412
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2221
2413
  if (r3) {
2222
2414
  throw takeObject(r2);
2223
2415
  }
@@ -2472,267 +2664,51 @@ class ProgramManager {
2472
2664
  wasm.__wbindgen_add_to_stack_pointer(16);
2473
2665
  }
2474
2666
  }
2667
+ }
2668
+
2669
+ const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
2670
+ ? { register: () => {}, unregister: () => {} }
2671
+ : new FinalizationRegistry(ptr => wasm.__wbg_provingkey_free(ptr >>> 0));
2672
+ /**
2673
+ * Proving key for a function within an Aleo program
2674
+ */
2675
+ export class ProvingKey {
2676
+
2677
+ static __wrap(ptr) {
2678
+ ptr = ptr >>> 0;
2679
+ const obj = Object.create(ProvingKey.prototype);
2680
+ obj.__wbg_ptr = ptr;
2681
+ ProvingKeyFinalization.register(obj, obj.__wbg_ptr, obj);
2682
+ return obj;
2683
+ }
2684
+
2685
+ __destroy_into_raw() {
2686
+ const ptr = this.__wbg_ptr;
2687
+ this.__wbg_ptr = 0;
2688
+ ProvingKeyFinalization.unregister(this);
2689
+ return ptr;
2690
+ }
2691
+
2692
+ free() {
2693
+ const ptr = this.__destroy_into_raw();
2694
+ wasm.__wbg_provingkey_free(ptr);
2695
+ }
2475
2696
  /**
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
2697
+ * Verify if the proving key is for the bond_public function
2478
2698
  *
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>}
2699
+ * @example
2700
+ * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
2701
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
2702
+ *
2703
+ * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
2704
+ * @returns {boolean}
2502
2705
  */
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);
2706
+ isBondPublicProver() {
2707
+ const ret = wasm.provingkey_isBondPublicProver(this.__wbg_ptr);
2708
+ return ret !== 0;
2543
2709
  }
2544
2710
  /**
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}
2729
- */
2730
- isBondPublicProver() {
2731
- const ret = wasm.provingkey_isBondPublicProver(this.__wbg_ptr);
2732
- return ret !== 0;
2733
- }
2734
- /**
2735
- * Verify if the proving key is for the bond_validator function
2711
+ * Verify if the proving key is for the bond_validator function
2736
2712
  *
2737
2713
  * @example
2738
2714
  * const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
@@ -3062,7 +3038,7 @@ const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined
3062
3038
  /**
3063
3039
  * Encrypted Aleo record
3064
3040
  */
3065
- class RecordCiphertext {
3041
+ export class RecordCiphertext {
3066
3042
 
3067
3043
  static __wrap(ptr) {
3068
3044
  ptr = ptr >>> 0;
@@ -3176,7 +3152,7 @@ const RecordPlaintextFinalization = (typeof FinalizationRegistry === 'undefined'
3176
3152
  /**
3177
3153
  * Plaintext representation of an Aleo record
3178
3154
  */
3179
- class RecordPlaintext {
3155
+ export class RecordPlaintext {
3180
3156
 
3181
3157
  static __wrap(ptr) {
3182
3158
  ptr = ptr >>> 0;
@@ -3349,7 +3325,7 @@ const SignatureFinalization = (typeof FinalizationRegistry === 'undefined')
3349
3325
  /**
3350
3326
  * Cryptographic signature of a message signed by an Aleo account
3351
3327
  */
3352
- class Signature {
3328
+ export class Signature {
3353
3329
 
3354
3330
  static __wrap(ptr) {
3355
3331
  ptr = ptr >>> 0;
@@ -3384,7 +3360,7 @@ class Signature {
3384
3360
  _assertClass(private_key, PrivateKey);
3385
3361
  const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
3386
3362
  const len0 = WASM_VECTOR_LEN;
3387
- const ret = wasm.privatekey_sign(private_key.__wbg_ptr, ptr0, len0);
3363
+ const ret = wasm.signature_sign(private_key.__wbg_ptr, ptr0, len0);
3388
3364
  return Signature.__wrap(ret);
3389
3365
  }
3390
3366
  /**
@@ -3471,7 +3447,7 @@ const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
3471
3447
  * This object is created when generating an on-chain function deployment or execution and is the
3472
3448
  * object that should be submitted to the Aleo Network in order to deploy or execute a function.
3473
3449
  */
3474
- class Transaction {
3450
+ export class Transaction {
3475
3451
 
3476
3452
  static __wrap(ptr) {
3477
3453
  ptr = ptr >>> 0;
@@ -3596,7 +3572,7 @@ const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
3596
3572
  /**
3597
3573
  * Verifying key for a function within an Aleo program
3598
3574
  */
3599
- class VerifyingKey {
3575
+ export class VerifyingKey {
3600
3576
 
3601
3577
  static __wrap(ptr) {
3602
3578
  ptr = ptr >>> 0;
@@ -3618,56 +3594,184 @@ class VerifyingKey {
3618
3594
  wasm.__wbg_verifyingkey_free(ptr);
3619
3595
  }
3620
3596
  /**
3621
- * Returns the verifying key for the bond_public function
3622
- *
3623
- * @returns {VerifyingKey} Verifying key for the bond_public function
3624
- * @returns {VerifyingKey}
3625
- */
3626
- static bondPublicVerifier() {
3627
- const ret = wasm.verifyingkey_bondPublicVerifier();
3628
- return VerifyingKey.__wrap(ret);
3629
- }
3630
- /**
3631
- * Returns the verifying key for the bond_validator function
3597
+ * Get the checksum of the verifying key
3632
3598
  *
3633
- * @returns {VerifyingKey} Verifying key for the bond_validator function
3634
- * @returns {VerifyingKey}
3599
+ * @returns {string} Checksum of the verifying key
3600
+ * @returns {string}
3635
3601
  */
3636
- static bondValidatorVerifier() {
3637
- const ret = wasm.verifyingkey_bondValidatorVerifier();
3638
- return VerifyingKey.__wrap(ret);
3602
+ checksum() {
3603
+ let deferred1_0;
3604
+ let deferred1_1;
3605
+ try {
3606
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3607
+ wasm.verifyingkey_checksum(retptr, this.__wbg_ptr);
3608
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3609
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3610
+ deferred1_0 = r0;
3611
+ deferred1_1 = r1;
3612
+ return getStringFromWasm0(r0, r1);
3613
+ } finally {
3614
+ wasm.__wbindgen_add_to_stack_pointer(16);
3615
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3616
+ }
3639
3617
  }
3640
3618
  /**
3641
- * Returns the verifying key for the claim_delegator function
3619
+ * Create a copy of the verifying key
3642
3620
  *
3643
- * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
3621
+ * @returns {VerifyingKey} A copy of the verifying key
3644
3622
  * @returns {VerifyingKey}
3645
3623
  */
3646
- static claimUnbondPublicVerifier() {
3647
- const ret = wasm.verifyingkey_claimUnbondPublicVerifier();
3624
+ copy() {
3625
+ const ret = wasm.verifyingkey_copy(this.__wbg_ptr);
3648
3626
  return VerifyingKey.__wrap(ret);
3649
3627
  }
3650
3628
  /**
3651
- * Returns the verifying key for the fee_private function
3629
+ * Construct a new verifying key from a byte array
3652
3630
  *
3653
- * @returns {VerifyingKey} Verifying key for the fee_private function
3631
+ * @param {Uint8Array} bytes Byte representation of a verifying key
3632
+ * @returns {VerifyingKey | Error}
3633
+ * @param {Uint8Array} bytes
3654
3634
  * @returns {VerifyingKey}
3655
3635
  */
3656
- static feePrivateVerifier() {
3657
- const ret = wasm.verifyingkey_feePrivateVerifier();
3658
- return VerifyingKey.__wrap(ret);
3636
+ static fromBytes(bytes) {
3637
+ try {
3638
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3639
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
3640
+ const len0 = WASM_VECTOR_LEN;
3641
+ wasm.verifyingkey_fromBytes(retptr, ptr0, len0);
3642
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3643
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3644
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3645
+ if (r2) {
3646
+ throw takeObject(r1);
3647
+ }
3648
+ return VerifyingKey.__wrap(r0);
3649
+ } finally {
3650
+ wasm.__wbindgen_add_to_stack_pointer(16);
3651
+ }
3659
3652
  }
3660
3653
  /**
3661
- * Returns the verifying key for the fee_public function
3654
+ * Create a verifying key from string
3662
3655
  *
3663
- * @returns {VerifyingKey} Verifying key for the fee_public function
3656
+ * @param {String} string String representation of a verifying key
3657
+ * @returns {VerifyingKey | Error}
3658
+ * @param {string} string
3664
3659
  * @returns {VerifyingKey}
3665
3660
  */
3666
- static feePublicVerifier() {
3667
- const ret = wasm.verifyingkey_feePublicVerifier();
3668
- return VerifyingKey.__wrap(ret);
3669
- }
3670
- /**
3661
+ static fromString(string) {
3662
+ try {
3663
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3664
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3665
+ const len0 = WASM_VECTOR_LEN;
3666
+ wasm.verifyingkey_fromString(retptr, ptr0, len0);
3667
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3668
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3669
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3670
+ if (r2) {
3671
+ throw takeObject(r1);
3672
+ }
3673
+ return VerifyingKey.__wrap(r0);
3674
+ } finally {
3675
+ wasm.__wbindgen_add_to_stack_pointer(16);
3676
+ }
3677
+ }
3678
+ /**
3679
+ * Create a byte array from a verifying key
3680
+ *
3681
+ * @returns {Uint8Array | Error} Byte representation of a verifying key
3682
+ * @returns {Uint8Array}
3683
+ */
3684
+ toBytes() {
3685
+ try {
3686
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3687
+ wasm.verifyingkey_toBytes(retptr, this.__wbg_ptr);
3688
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3689
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3690
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3691
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3692
+ if (r3) {
3693
+ throw takeObject(r2);
3694
+ }
3695
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3696
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3697
+ return v1;
3698
+ } finally {
3699
+ wasm.__wbindgen_add_to_stack_pointer(16);
3700
+ }
3701
+ }
3702
+ /**
3703
+ * Get a string representation of the verifying key
3704
+ *
3705
+ * @returns {String} String representation of the verifying key
3706
+ * @returns {string}
3707
+ */
3708
+ toString() {
3709
+ let deferred1_0;
3710
+ let deferred1_1;
3711
+ try {
3712
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3713
+ wasm.verifyingkey_toString(retptr, this.__wbg_ptr);
3714
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3715
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3716
+ deferred1_0 = r0;
3717
+ deferred1_1 = r1;
3718
+ return getStringFromWasm0(r0, r1);
3719
+ } finally {
3720
+ wasm.__wbindgen_add_to_stack_pointer(16);
3721
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3722
+ }
3723
+ }
3724
+ /**
3725
+ * Returns the verifying key for the bond_public function
3726
+ *
3727
+ * @returns {VerifyingKey} Verifying key for the bond_public function
3728
+ * @returns {VerifyingKey}
3729
+ */
3730
+ static bondPublicVerifier() {
3731
+ const ret = wasm.verifyingkey_bondPublicVerifier();
3732
+ return VerifyingKey.__wrap(ret);
3733
+ }
3734
+ /**
3735
+ * Returns the verifying key for the bond_validator function
3736
+ *
3737
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
3738
+ * @returns {VerifyingKey}
3739
+ */
3740
+ static bondValidatorVerifier() {
3741
+ const ret = wasm.verifyingkey_bondValidatorVerifier();
3742
+ return VerifyingKey.__wrap(ret);
3743
+ }
3744
+ /**
3745
+ * Returns the verifying key for the claim_delegator function
3746
+ *
3747
+ * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
3748
+ * @returns {VerifyingKey}
3749
+ */
3750
+ static claimUnbondPublicVerifier() {
3751
+ const ret = wasm.verifyingkey_claimUnbondPublicVerifier();
3752
+ return VerifyingKey.__wrap(ret);
3753
+ }
3754
+ /**
3755
+ * Returns the verifying key for the fee_private function
3756
+ *
3757
+ * @returns {VerifyingKey} Verifying key for the fee_private function
3758
+ * @returns {VerifyingKey}
3759
+ */
3760
+ static feePrivateVerifier() {
3761
+ const ret = wasm.verifyingkey_feePrivateVerifier();
3762
+ return VerifyingKey.__wrap(ret);
3763
+ }
3764
+ /**
3765
+ * Returns the verifying key for the fee_public function
3766
+ *
3767
+ * @returns {VerifyingKey} Verifying key for the fee_public function
3768
+ * @returns {VerifyingKey}
3769
+ */
3770
+ static feePublicVerifier() {
3771
+ const ret = wasm.verifyingkey_feePublicVerifier();
3772
+ return VerifyingKey.__wrap(ret);
3773
+ }
3774
+ /**
3671
3775
  * Returns the verifying key for the inclusion function
3672
3776
  *
3673
3777
  * @returns {VerifyingKey} Verifying key for the inclusion function
@@ -3917,134 +4021,6 @@ class VerifyingKey {
3917
4021
  const ret = wasm.verifyingkey_isUnbondPublicVerifier(this.__wbg_ptr);
3918
4022
  return ret !== 0;
3919
4023
  }
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
4024
  }
4049
4025
 
4050
4026
  const ViewKeyFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4052,7 +4028,7 @@ const ViewKeyFinalization = (typeof FinalizationRegistry === 'undefined')
4052
4028
  : new FinalizationRegistry(ptr => wasm.__wbg_viewkey_free(ptr >>> 0));
4053
4029
  /**
4054
4030
  */
4055
- class ViewKey {
4031
+ export class ViewKey {
4056
4032
 
4057
4033
  static __wrap(ptr) {
4058
4034
  ptr = ptr >>> 0;
@@ -4083,7 +4059,7 @@ class ViewKey {
4083
4059
  */
4084
4060
  static from_private_key(private_key) {
4085
4061
  _assertClass(private_key, PrivateKey);
4086
- const ret = wasm.privatekey_to_view_key(private_key.__wbg_ptr);
4062
+ const ret = wasm.viewkey_from_private_key(private_key.__wbg_ptr);
4087
4063
  return ViewKey.__wrap(ret);
4088
4064
  }
4089
4065
  /**
@@ -4129,7 +4105,7 @@ class ViewKey {
4129
4105
  * @returns {Address}
4130
4106
  */
4131
4107
  to_address() {
4132
- const ret = wasm.address_from_view_key(this.__wbg_ptr);
4108
+ const ret = wasm.viewkey_to_address(this.__wbg_ptr);
4133
4109
  return Address.__wrap(ret);
4134
4110
  }
4135
4111
  /**
@@ -4245,127 +4221,21 @@ function __wbg_get_imports() {
4245
4221
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
4246
4222
  takeObject(arg0);
4247
4223
  };
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();
4224
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
4225
+ const ret = getStringFromWasm0(arg0, arg1);
4271
4226
  return addHeapObject(ret);
4272
4227
  };
4273
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
4274
- const ret = getStringFromWasm0(arg0, arg1);
4228
+ imports.wbg.__wbg_transaction_new = function(arg0) {
4229
+ const ret = Transaction.__wrap(arg0);
4275
4230
  return addHeapObject(ret);
4276
4231
  };
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) };
4232
+ imports.wbg.__wbg_log_a9e431931e09a09d = function(arg0, arg1) {
4233
+ console.log(getStringFromWasm0(arg0, arg1));
4234
+ };
4285
4235
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4286
4236
  const ret = getObject(arg0);
4287
4237
  return addHeapObject(ret);
4288
4238
  };
4289
- imports.wbg.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
4290
- const ret = new AbortController();
4291
- return addHeapObject(ret);
4292
- }, arguments) };
4293
- imports.wbg.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
4294
- const ret = getObject(arg0).signal;
4295
- return addHeapObject(ret);
4296
- };
4297
- imports.wbg.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4298
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4299
- }, arguments) };
4300
- imports.wbg.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
4301
- let result;
4302
- try {
4303
- result = getObject(arg0) instanceof Response;
4304
- } catch (_) {
4305
- result = false;
4306
- }
4307
- const ret = result;
4308
- return ret;
4309
- };
4310
- imports.wbg.__wbg_status_61a01141acd3cf74 = function(arg0) {
4311
- const ret = getObject(arg0).status;
4312
- return ret;
4313
- };
4314
- imports.wbg.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
4315
- const ret = getObject(arg1).url;
4316
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4317
- const len1 = WASM_VECTOR_LEN;
4318
- getInt32Memory0()[arg0 / 4 + 1] = len1;
4319
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4320
- };
4321
- imports.wbg.__wbg_headers_9620bfada380764a = function(arg0) {
4322
- const ret = getObject(arg0).headers;
4323
- return addHeapObject(ret);
4324
- };
4325
- imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
4326
- const ret = Symbol.iterator;
4327
- return addHeapObject(ret);
4328
- };
4329
- imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
4330
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
4331
- return addHeapObject(ret);
4332
- }, arguments) };
4333
- imports.wbg.__wbindgen_is_function = function(arg0) {
4334
- const ret = typeof(getObject(arg0)) === 'function';
4335
- return ret;
4336
- };
4337
- imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
4338
- const ret = getObject(arg0).call(getObject(arg1));
4339
- return addHeapObject(ret);
4340
- }, arguments) };
4341
- imports.wbg.__wbindgen_is_object = function(arg0) {
4342
- const val = getObject(arg0);
4343
- const ret = typeof(val) === 'object' && val !== null;
4344
- return ret;
4345
- };
4346
- imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
4347
- const ret = getObject(arg0).next;
4348
- return addHeapObject(ret);
4349
- };
4350
- imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
4351
- const ret = getObject(arg0).next();
4352
- return addHeapObject(ret);
4353
- }, arguments) };
4354
- imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
4355
- const ret = getObject(arg0).done;
4356
- return ret;
4357
- };
4358
- imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
4359
- const ret = getObject(arg0).value;
4360
- return addHeapObject(ret);
4361
- };
4362
- imports.wbg.__wbg_abort_2aa7521d5690750e = function(arg0) {
4363
- getObject(arg0).abort();
4364
- };
4365
- imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
4366
- const ret = JSON.stringify(getObject(arg0));
4367
- return addHeapObject(ret);
4368
- }, arguments) };
4369
4239
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
4370
4240
  const obj = getObject(arg1);
4371
4241
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -4374,49 +4244,23 @@ function __wbg_get_imports() {
4374
4244
  getInt32Memory0()[arg0 / 4 + 1] = len1;
4375
4245
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4376
4246
  };
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);
4247
+ imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4248
+ const ret = AuthorizationResponse.__wrap(arg0);
4382
4249
  return addHeapObject(ret);
4383
4250
  };
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);
4251
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4252
+ const ret = BigInt.asUintN(64, arg0);
4389
4253
  return addHeapObject(ret);
4390
4254
  };
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
4255
  imports.wbg.__wbg_keypair_new = function(arg0) {
4396
4256
  const ret = KeyPair.__wrap(arg0);
4397
4257
  return addHeapObject(ret);
4398
4258
  };
4399
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4400
- const ret = BigInt.asUintN(64, arg0);
4401
- return addHeapObject(ret);
4402
- };
4403
4259
  imports.wbg.__wbg_executionresponse_new = function(arg0) {
4404
4260
  const ret = ExecutionResponse.__wrap(arg0);
4405
4261
  return addHeapObject(ret);
4406
4262
  };
4407
- imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4408
- const ret = AuthorizationResponse.__wrap(arg0);
4409
- return addHeapObject(ret);
4410
- };
4411
- imports.wbg.__wbindgen_module = function() {
4412
- const ret = __wbg_init.__wbindgen_wasm_module;
4413
- return addHeapObject(ret);
4414
- };
4415
- imports.wbg.__wbindgen_memory = function() {
4416
- const ret = wasm.memory;
4417
- return addHeapObject(ret);
4418
- };
4419
- imports.wbg.__wbg_spawnWorker_1bc5a4548b5096bf = function(arg0, arg1, arg2, arg3) {
4263
+ imports.wbg.__wbg_spawnWorker_8783a81153476045 = function(arg0, arg1, arg2, arg3) {
4420
4264
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
4421
4265
  return addHeapObject(ret);
4422
4266
  };
@@ -4429,44 +4273,6 @@ function __wbg_get_imports() {
4429
4273
  const ret = false;
4430
4274
  return ret;
4431
4275
  };
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
4276
  imports.wbg.__wbindgen_number_new = function(arg0) {
4471
4277
  const ret = arg0;
4472
4278
  return addHeapObject(ret);
@@ -4493,31 +4299,121 @@ function __wbg_get_imports() {
4493
4299
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4494
4300
  }
4495
4301
  };
4496
- imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
4497
- const ret = getObject(arg0).buffer;
4302
+ imports.wbg.__wbg_fetch_bc7c8e27076a5c84 = function(arg0) {
4303
+ const ret = fetch(getObject(arg0));
4498
4304
  return addHeapObject(ret);
4499
4305
  };
4500
- imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
4501
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4306
+ imports.wbg.__wbg_queueMicrotask_481971b0d87f3dd4 = function(arg0) {
4307
+ queueMicrotask(getObject(arg0));
4308
+ };
4309
+ imports.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6 = function(arg0) {
4310
+ const ret = getObject(arg0).queueMicrotask;
4502
4311
  return addHeapObject(ret);
4503
4312
  };
4504
- imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
4505
- getObject(arg0).randomFillSync(takeObject(arg1));
4313
+ imports.wbg.__wbindgen_is_function = function(arg0) {
4314
+ const ret = typeof(getObject(arg0)) === 'function';
4315
+ return ret;
4316
+ };
4317
+ imports.wbg.__wbg_navigator_6c8fa55c5cc8796e = function(arg0) {
4318
+ const ret = getObject(arg0).navigator;
4319
+ return addHeapObject(ret);
4320
+ };
4321
+ imports.wbg.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
4322
+ const ret = getObject(arg0).fetch(getObject(arg1));
4323
+ return addHeapObject(ret);
4324
+ };
4325
+ imports.wbg.__wbg_hardwareConcurrency_cffbaa73aab5ff44 = function(arg0) {
4326
+ const ret = getObject(arg0).hardwareConcurrency;
4327
+ return ret;
4328
+ };
4329
+ imports.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0 = function() { return handleError(function (arg0, arg1, arg2) {
4330
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
4331
+ return addHeapObject(ret);
4506
4332
  }, arguments) };
4507
- imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
4508
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4333
+ imports.wbg.__wbg_signal_a61f78a3478fd9bc = function(arg0) {
4334
+ const ret = getObject(arg0).signal;
4509
4335
  return addHeapObject(ret);
4510
4336
  };
4511
- imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
4512
- getObject(arg0).getRandomValues(getObject(arg1));
4337
+ imports.wbg.__wbg_new_0d76b0581eca6298 = function() { return handleError(function () {
4338
+ const ret = new AbortController();
4339
+ return addHeapObject(ret);
4513
4340
  }, arguments) };
4514
- imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
4515
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4341
+ imports.wbg.__wbg_abort_2aa7521d5690750e = function(arg0) {
4342
+ getObject(arg0).abort();
4343
+ };
4344
+ imports.wbg.__wbg_new_ab6fd82b10560829 = function() { return handleError(function () {
4345
+ const ret = new Headers();
4346
+ return addHeapObject(ret);
4347
+ }, arguments) };
4348
+ imports.wbg.__wbg_append_7bfcb4937d1d5e29 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4349
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4350
+ }, arguments) };
4351
+ imports.wbg.__wbg_instanceof_Response_849eb93e75734b6e = function(arg0) {
4352
+ let result;
4353
+ try {
4354
+ result = getObject(arg0) instanceof Response;
4355
+ } catch (_) {
4356
+ result = false;
4357
+ }
4358
+ const ret = result;
4359
+ return ret;
4360
+ };
4361
+ imports.wbg.__wbg_url_5f6dc4009ac5f99d = function(arg0, arg1) {
4362
+ const ret = getObject(arg1).url;
4363
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4364
+ const len1 = WASM_VECTOR_LEN;
4365
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4366
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4516
4367
  };
4368
+ imports.wbg.__wbg_status_61a01141acd3cf74 = function(arg0) {
4369
+ const ret = getObject(arg0).status;
4370
+ return ret;
4371
+ };
4372
+ imports.wbg.__wbg_headers_9620bfada380764a = function(arg0) {
4373
+ const ret = getObject(arg0).headers;
4374
+ return addHeapObject(ret);
4375
+ };
4376
+ imports.wbg.__wbg_arrayBuffer_29931d52c7206b02 = function() { return handleError(function (arg0) {
4377
+ const ret = getObject(arg0).arrayBuffer();
4378
+ return addHeapObject(ret);
4379
+ }, arguments) };
4380
+ imports.wbg.__wbg_status_d485fb5a478426fb = function() { return handleError(function (arg0) {
4381
+ const ret = getObject(arg0).status;
4382
+ return ret;
4383
+ }, arguments) };
4384
+ imports.wbg.__wbg_response_7c2e2759084f7279 = function() { return handleError(function (arg0) {
4385
+ const ret = getObject(arg0).response;
4386
+ return addHeapObject(ret);
4387
+ }, arguments) };
4388
+ imports.wbg.__wbg_responseText_c67ed2d48db10769 = function() { return handleError(function (arg0, arg1) {
4389
+ const ret = getObject(arg1).responseText;
4390
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4391
+ var len1 = WASM_VECTOR_LEN;
4392
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
4393
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4394
+ }, arguments) };
4395
+ imports.wbg.__wbg_new_71801a555ad9f2aa = function() { return handleError(function () {
4396
+ const ret = new XMLHttpRequest();
4397
+ return addHeapObject(ret);
4398
+ }, arguments) };
4399
+ imports.wbg.__wbg_open_c9eb0cf2c9d95679 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
4400
+ getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
4401
+ }, arguments) };
4402
+ imports.wbg.__wbg_overrideMimeType_ee9c51919ceb418b = function() { return handleError(function (arg0, arg1, arg2) {
4403
+ getObject(arg0).overrideMimeType(getStringFromWasm0(arg1, arg2));
4404
+ }, arguments) };
4405
+ imports.wbg.__wbg_send_80d29985093c1ec5 = function() { return handleError(function (arg0) {
4406
+ getObject(arg0).send();
4407
+ }, arguments) };
4517
4408
  imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
4518
4409
  const ret = getObject(arg0).crypto;
4519
4410
  return addHeapObject(ret);
4520
4411
  };
4412
+ imports.wbg.__wbindgen_is_object = function(arg0) {
4413
+ const val = getObject(arg0);
4414
+ const ret = typeof(val) === 'object' && val !== null;
4415
+ return ret;
4416
+ };
4521
4417
  imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
4522
4418
  const ret = getObject(arg0).process;
4523
4419
  return addHeapObject(ret);
@@ -4542,16 +4438,58 @@ function __wbg_get_imports() {
4542
4438
  const ret = getObject(arg0).msCrypto;
4543
4439
  return addHeapObject(ret);
4544
4440
  };
4545
- imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
4546
- const ret = new Uint8Array(arg0 >>> 0);
4441
+ imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
4442
+ getObject(arg0).randomFillSync(takeObject(arg1));
4443
+ }, arguments) };
4444
+ imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
4445
+ getObject(arg0).getRandomValues(getObject(arg1));
4446
+ }, arguments) };
4447
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
4448
+ const ret = getObject(arg0)[arg1 >>> 0];
4547
4449
  return addHeapObject(ret);
4548
4450
  };
4549
4451
  imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
4550
4452
  const ret = getObject(arg0).length;
4551
4453
  return ret;
4552
4454
  };
4553
- imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
4554
- const ret = getObject(arg0)[arg1 >>> 0];
4455
+ imports.wbg.__wbg_new_16b304a2cfa7ff4a = function() {
4456
+ const ret = new Array();
4457
+ return addHeapObject(ret);
4458
+ };
4459
+ imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
4460
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
4461
+ return addHeapObject(ret);
4462
+ };
4463
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
4464
+ const ret = getObject(arg0).next;
4465
+ return addHeapObject(ret);
4466
+ };
4467
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
4468
+ const ret = getObject(arg0).next();
4469
+ return addHeapObject(ret);
4470
+ }, arguments) };
4471
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
4472
+ const ret = getObject(arg0).done;
4473
+ return ret;
4474
+ };
4475
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
4476
+ const ret = getObject(arg0).value;
4477
+ return addHeapObject(ret);
4478
+ };
4479
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
4480
+ const ret = Symbol.iterator;
4481
+ return addHeapObject(ret);
4482
+ };
4483
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
4484
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4485
+ return addHeapObject(ret);
4486
+ }, arguments) };
4487
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
4488
+ const ret = getObject(arg0).call(getObject(arg1));
4489
+ return addHeapObject(ret);
4490
+ }, arguments) };
4491
+ imports.wbg.__wbg_new_72fb9a18b5ae2624 = function() {
4492
+ const ret = new Object();
4555
4493
  return addHeapObject(ret);
4556
4494
  };
4557
4495
  imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
@@ -4574,122 +4512,110 @@ function __wbg_get_imports() {
4574
4512
  const ret = getObject(arg0) === undefined;
4575
4513
  return ret;
4576
4514
  };
4577
- imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
4578
- const ret = new Function(getStringFromWasm0(arg0, arg1));
4515
+ imports.wbg.__wbg_newwithlength_66ae46612e7f0234 = function(arg0) {
4516
+ const ret = new Array(arg0 >>> 0);
4579
4517
  return addHeapObject(ret);
4580
4518
  };
4581
- imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
4582
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
4519
+ imports.wbg.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
4520
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4521
+ };
4522
+ imports.wbg.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
4523
+ const ret = getObject(arg0).push(getObject(arg1));
4583
4524
  return ret;
4584
- }, arguments) };
4585
- imports.wbg.__wbg_fetch_bc7c8e27076a5c84 = function(arg0) {
4586
- const ret = fetch(getObject(arg0));
4587
- return addHeapObject(ret);
4588
4525
  };
4589
- imports.wbg.__wbg_fetch_921fad6ef9e883dd = function(arg0, arg1) {
4590
- const ret = getObject(arg0).fetch(getObject(arg1));
4526
+ imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
4527
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
4591
4528
  return addHeapObject(ret);
4529
+ }, arguments) };
4530
+ imports.wbg.__wbg_new_81740750da40724f = function(arg0, arg1) {
4531
+ try {
4532
+ var state0 = {a: arg0, b: arg1};
4533
+ var cb0 = (arg0, arg1) => {
4534
+ const a = state0.a;
4535
+ state0.a = 0;
4536
+ try {
4537
+ return __wbg_adapter_322(a, state0.b, arg0, arg1);
4538
+ } finally {
4539
+ state0.a = a;
4540
+ }
4541
+ };
4542
+ const ret = new Promise(cb0);
4543
+ return addHeapObject(ret);
4544
+ } finally {
4545
+ state0.a = state0.b = 0;
4546
+ }
4592
4547
  };
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));
4548
+ imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
4549
+ const ret = Promise.resolve(getObject(arg0));
4608
4550
  return addHeapObject(ret);
4609
4551
  };
4610
4552
  imports.wbg.__wbg_then_0c86a60e8fcfe9f6 = function(arg0, arg1) {
4611
4553
  const ret = getObject(arg0).then(getObject(arg1));
4612
4554
  return addHeapObject(ret);
4613
4555
  };
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;
4556
+ imports.wbg.__wbg_then_a73caa9a87991566 = function(arg0, arg1, arg2) {
4557
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
4619
4558
  return addHeapObject(ret);
4620
4559
  };
4621
- imports.wbg.__wbg_resolve_b0083a7967828ec8 = function(arg0) {
4622
- const ret = Promise.resolve(getObject(arg0));
4560
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
4561
+ const ret = getObject(arg0).buffer;
4623
4562
  return addHeapObject(ret);
4624
4563
  };
4625
- imports.wbg.__wbg_waitAsync_5d743fc9058ba01a = function() {
4626
- const ret = Atomics.waitAsync;
4564
+ imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
4565
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4627
4566
  return addHeapObject(ret);
4628
4567
  };
4629
- imports.wbg.__wbg_new_8cccba86b0f574cb = function(arg0) {
4630
- const ret = new Int32Array(getObject(arg0));
4568
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
4569
+ const ret = new Uint8Array(getObject(arg0));
4631
4570
  return addHeapObject(ret);
4632
4571
  };
4633
- imports.wbg.__wbg_waitAsync_46d5c36955b71a79 = function(arg0, arg1, arg2) {
4634
- const ret = Atomics.waitAsync(getObject(arg0), arg1, arg2);
4635
- return addHeapObject(ret);
4572
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
4573
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4636
4574
  };
4637
- imports.wbg.__wbg_async_19c0400d97cc72fe = function(arg0) {
4638
- const ret = getObject(arg0).async;
4575
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
4576
+ const ret = getObject(arg0).length;
4639
4577
  return ret;
4640
4578
  };
4641
- imports.wbg.__wbg_value_571d60108110e917 = function(arg0) {
4642
- const ret = getObject(arg0).value;
4579
+ imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
4580
+ const ret = new Uint8Array(arg0 >>> 0);
4643
4581
  return addHeapObject(ret);
4644
4582
  };
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
- `);
4583
+ imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
4584
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4585
+ return addHeapObject(ret);
4586
+ };
4587
+ imports.wbg.__wbg_has_0af94d20077affa2 = function() { return handleError(function (arg0, arg1) {
4588
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
4589
+ return ret;
4590
+ }, arguments) };
4591
+ imports.wbg.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
4592
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
4593
+ return ret;
4594
+ }, arguments) };
4595
+ imports.wbg.__wbg_stringify_8887fe74e1c50d81 = function() { return handleError(function (arg0) {
4596
+ const ret = JSON.stringify(getObject(arg0));
4597
+ return addHeapObject(ret);
4598
+ }, arguments) };
4599
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
4600
+ const ret = debugString(getObject(arg1));
4653
4601
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4654
4602
  const len1 = WASM_VECTOR_LEN;
4655
4603
  getInt32Memory0()[arg0 / 4 + 1] = len1;
4656
4604
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4657
4605
  };
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);
4606
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
4607
+ throw new Error(getStringFromWasm0(arg0, arg1));
4668
4608
  };
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;
4609
+ imports.wbg.__wbindgen_module = function() {
4610
+ const ret = __wbg_init.__wbindgen_wasm_module;
4674
4611
  return addHeapObject(ret);
4675
4612
  };
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);
4613
+ imports.wbg.__wbindgen_memory = function() {
4614
+ const ret = wasm.memory;
4689
4615
  return addHeapObject(ret);
4690
4616
  };
4691
- imports.wbg.__wbindgen_closure_wrapper5831 = function(arg0, arg1, arg2) {
4692
- const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_34);
4617
+ imports.wbg.__wbindgen_closure_wrapper6149 = function(arg0, arg1, arg2) {
4618
+ const ret = makeMutClosure(arg0, arg1, 868, __wbg_adapter_32);
4693
4619
  return addHeapObject(ret);
4694
4620
  };
4695
4621
 
@@ -4697,7 +4623,7 @@ function __wbg_get_imports() {
4697
4623
  }
4698
4624
 
4699
4625
  function __wbg_init_memory(imports, maybe_memory) {
4700
- imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:25,maximum:65536,shared:true});
4626
+
4701
4627
  }
4702
4628
 
4703
4629
  function __wbg_finalize_init(instance, module) {
@@ -4707,16 +4633,16 @@ function __wbg_finalize_init(instance, module) {
4707
4633
  cachedInt32Memory0 = null;
4708
4634
  cachedUint8Memory0 = null;
4709
4635
 
4710
- wasm.__wbindgen_start();
4636
+
4711
4637
  return wasm;
4712
4638
  }
4713
4639
 
4714
- function initSync(module, maybe_memory) {
4640
+ function initSync(module) {
4715
4641
  if (wasm !== undefined) return wasm;
4716
4642
 
4717
4643
  const imports = __wbg_get_imports();
4718
4644
 
4719
- __wbg_init_memory(imports, maybe_memory);
4645
+ __wbg_init_memory(imports);
4720
4646
 
4721
4647
  if (!(module instanceof WebAssembly.Module)) {
4722
4648
  module = new WebAssembly.Module(module);
@@ -4727,111 +4653,24 @@ function initSync(module, maybe_memory) {
4727
4653
  return __wbg_finalize_init(instance, module);
4728
4654
  }
4729
4655
 
4730
- async function __wbg_init(input, maybe_memory) {
4656
+ async function __wbg_init(input) {
4731
4657
  if (wasm !== undefined) return wasm;
4732
4658
 
4733
-
4659
+ if (typeof input === 'undefined') {
4660
+ input = new URL('aleo_wasm_bg.wasm', import.meta.url);
4661
+ }
4734
4662
  const imports = __wbg_get_imports();
4735
4663
 
4736
4664
  if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
4737
4665
  input = fetch(input);
4738
4666
  }
4739
4667
 
4740
- __wbg_init_memory(imports, maybe_memory);
4668
+ __wbg_init_memory(imports);
4741
4669
 
4742
4670
  const { instance, module } = await __wbg_load(await input, imports);
4743
4671
 
4744
4672
  return __wbg_finalize_init(instance, module);
4745
4673
  }
4746
4674
 
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
4675
+ export { initSync }
4676
+ export default __wbg_init;