@provablehq/wasm 0.11.2 → 0.11.4

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.
@@ -314,38 +314,6 @@ function addBorrowedObject(obj) {
314
314
  heap[--stack_pointer] = obj;
315
315
  return stack_pointer;
316
316
  }
317
- /**
318
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
319
- *
320
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
321
- * Each verifying key is paired with one or more sets of public inputs (instances).
322
- *
323
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
324
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
325
- * @param {Proof} proof The batch proof to verify
326
- * @returns {boolean} True if the batch proof is valid, false otherwise
327
- * @param {Array<any>} verifying_keys
328
- * @param {Array<any>} inputs
329
- * @param {Proof} proof
330
- * @returns {boolean}
331
- */
332
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
333
- try {
334
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- _assertClass(proof, Proof);
336
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
337
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
340
- if (r2) {
341
- throw takeObject(r1);
342
- }
343
- return r0 !== 0;
344
- } finally {
345
- wasm.__wbindgen_add_to_stack_pointer(16);
346
- }
347
- }
348
-
349
317
  /**
350
318
  * Verify an execution. Executions with multiple transitions must have the program source code and
351
319
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -394,6 +362,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
394
362
  }
395
363
  }
396
364
 
365
+ /**
366
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
367
+ *
368
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
369
+ * Each verifying key is paired with one or more sets of public inputs (instances).
370
+ *
371
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
372
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
373
+ * @param {Proof} proof The batch proof to verify
374
+ * @returns {boolean} True if the batch proof is valid, false otherwise
375
+ * @param {Array<any>} verifying_keys
376
+ * @param {Array<any>} inputs
377
+ * @param {Proof} proof
378
+ * @returns {boolean}
379
+ */
380
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ _assertClass(proof, Proof);
384
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
385
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
386
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
387
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
388
+ if (r2) {
389
+ throw takeObject(r1);
390
+ }
391
+ return r0 !== 0;
392
+ } finally {
393
+ wasm.__wbindgen_add_to_stack_pointer(16);
394
+ }
395
+ }
396
+
397
397
  /**
398
398
  * Verify a SNARK proof against a verifying key and public inputs.
399
399
  *
@@ -458,7 +458,7 @@ function stringToField(string) {
458
458
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
459
459
  *
460
460
  * Set the consensus version heights.
461
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
461
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
462
462
  * @param {string | null} [heights]
463
463
  * @returns {Array<any>}
464
464
  */
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
492
- wasm.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
491
+ function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
492
+ wasm.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_7376(arg0, arg1) {
496
- wasm.__wasm_bindgen_func_elem_7376(arg0, arg1);
495
+ function __wasm_bindgen_func_elem_7397(arg0, arg1) {
496
+ wasm.__wasm_bindgen_func_elem_7397(arg0, arg1);
497
497
  }
498
498
 
499
- function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7669(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7669(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
501
501
  }
502
502
 
503
503
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -10014,6 +10014,35 @@ class Program {
10014
10014
  const ret = wasm.program_getFunctions(this.__wbg_ptr);
10015
10015
  return takeObject(ret);
10016
10016
  }
10017
+ /**
10018
+ * Get the program's name (without the `.aleo` suffix) encoded as a field element.
10019
+ *
10020
+ * This is the same value as casting the program name identifier to a field on-chain
10021
+ * (e.g. `my_program.aleo` -> `Identifier("my_program") as field`), which is used as
10022
+ * the program id in dynamic dispatch calls such as `IARC20@(token_id)`.
10023
+ *
10024
+ * @example
10025
+ * const program = aleo_wasm.Program.getCreditsProgram();
10026
+ * const field = program.nameToField(); // Field encoding of "credits"
10027
+ *
10028
+ * @returns {Field} The program name as a field element
10029
+ * @returns {Field}
10030
+ */
10031
+ nameToField() {
10032
+ try {
10033
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10034
+ wasm.program_nameToField(retptr, this.__wbg_ptr);
10035
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10036
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10037
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10038
+ if (r2) {
10039
+ throw takeObject(r1);
10040
+ }
10041
+ return Field.__wrap(r0);
10042
+ } finally {
10043
+ wasm.__wbindgen_add_to_stack_pointer(16);
10044
+ }
10045
+ }
10017
10046
  /**
10018
10047
  * Get the external call graph reachable from a specific entry function.
10019
10048
  *
@@ -10269,6 +10298,47 @@ class Program {
10269
10298
  wasm.__wbindgen_add_to_stack_pointer(16);
10270
10299
  }
10271
10300
  }
10301
+ /**
10302
+ * Determine if the program implements the ARC-20 fungible token interface (IARC20).
10303
+ *
10304
+ * This checks that the program defines a `Token` record with an `amount: u128` entry
10305
+ * (additional entries are permitted, per the interface's open record definition) and
10306
+ * that every function and view function required by ARC-20 is present with the exact
10307
+ * input and output signature defined by the standard.
10308
+ *
10309
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0020/README.md
10310
+ *
10311
+ * @returns {boolean} True if the program implements the ARC-20 token interface
10312
+ * @returns {boolean}
10313
+ */
10314
+ isArc20() {
10315
+ const ret = wasm.program_isArc20(this.__wbg_ptr);
10316
+ return ret !== 0;
10317
+ }
10318
+ /**
10319
+ * Determine if the program implements the ARC-22 compliant token interface (IARC22).
10320
+ *
10321
+ * This checks that the program defines `Token` and `ComplianceRecord` records with the
10322
+ * entries required by the standard (additional entries are permitted, per the
10323
+ * interface's open record definitions), and that every function and view function
10324
+ * required by ARC-22 is present with the exact input and output signature defined by
10325
+ * the standard. The `MerkleProof` struct used by the private transfer functions may be
10326
+ * declared locally (in which case its shape must match the standard exactly) or
10327
+ * imported from another program such as a freeze list registry.
10328
+ *
10329
+ * Note: this checks the token interface (IARC22) only. The freeze list registry
10330
+ * interface (IARC22Freezelist) is typically implemented by a separate program and is
10331
+ * not required for a token program to be considered ARC-22 compliant.
10332
+ *
10333
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0022/README.md
10334
+ *
10335
+ * @returns {boolean} True if the program implements the ARC-22 token interface
10336
+ * @returns {boolean}
10337
+ */
10338
+ isArc22() {
10339
+ const ret = wasm.program_isArc22(this.__wbg_ptr);
10340
+ return ret !== 0;
10341
+ }
10272
10342
  /**
10273
10343
  * Determine equality with another program
10274
10344
  *
@@ -19232,7 +19302,7 @@ function __wbg_get_imports(memory) {
19232
19302
  const ret = getObject(arg0).length;
19233
19303
  return ret;
19234
19304
  };
19235
- imports.wbg.__wbg_log_a61781f88cdec01a = function(arg0, arg1) {
19305
+ imports.wbg.__wbg_log_4507b73801c06872 = function(arg0, arg1) {
19236
19306
  console.log(getStringFromWasm0(arg0, arg1));
19237
19307
  };
19238
19308
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19250,7 +19320,7 @@ function __wbg_get_imports(memory) {
19250
19320
  const a = state0.a;
19251
19321
  state0.a = 0;
19252
19322
  try {
19253
- return __wasm_bindgen_func_elem_7648(a, state0.b, arg0, arg1);
19323
+ return __wasm_bindgen_func_elem_7669(a, state0.b, arg0, arg1);
19254
19324
  } finally {
19255
19325
  state0.a = a;
19256
19326
  }
@@ -19422,7 +19492,7 @@ function __wbg_get_imports(memory) {
19422
19492
  const ret = Signature.__wrap(arg0);
19423
19493
  return addHeapObject(ret);
19424
19494
  };
19425
- imports.wbg.__wbg_spawnWorker_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19495
+ imports.wbg.__wbg_spawnWorker_6197e35077a8baba = function(arg0, arg1, arg2, arg3) {
19426
19496
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19427
19497
  return addHeapObject(ret);
19428
19498
  };
@@ -19521,12 +19591,12 @@ function __wbg_get_imports(memory) {
19521
19591
  };
19522
19592
  imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19523
19593
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19524
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19594
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_8765);
19525
19595
  return addHeapObject(ret);
19526
19596
  };
19527
19597
  imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19528
19598
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19529
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19599
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_8765);
19530
19600
  return addHeapObject(ret);
19531
19601
  };
19532
19602
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19536,7 +19606,7 @@ function __wbg_get_imports(memory) {
19536
19606
  };
19537
19607
  imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19538
19608
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19539
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_7376);
19609
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_7397);
19540
19610
  return addHeapObject(ret);
19541
19611
  };
19542
19612
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {