@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.
@@ -9,18 +9,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
9
9
  * Values above 4 are clamped to debug.
10
10
  */
11
11
  export function setWasmLogLevel(level: number): void;
12
- /**
13
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
14
- *
15
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
16
- * Each verifying key is paired with one or more sets of public inputs (instances).
17
- *
18
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
19
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
20
- * @param {Proof} proof The batch proof to verify
21
- * @returns {boolean} True if the batch proof is valid, false otherwise
22
- */
23
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
24
12
  /**
25
13
  * Verify an execution. Executions with multiple transitions must have the program source code and
26
14
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -35,6 +23,18 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
35
23
  * @returns {boolean} True if the execution is valid, false otherwise
36
24
  */
37
25
  export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
26
+ /**
27
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
28
+ *
29
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
30
+ * Each verifying key is paired with one or more sets of public inputs (instances).
31
+ *
32
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
33
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
34
+ * @param {Proof} proof The batch proof to verify
35
+ * @returns {boolean} True if the batch proof is valid, false otherwise
36
+ */
37
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
38
38
  /**
39
39
  * Verify a SNARK proof against a verifying key and public inputs.
40
40
  *
@@ -57,7 +57,7 @@ export function stringToField(string: string): Field;
57
57
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
58
58
  *
59
59
  * Set the consensus version heights.
60
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
60
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
61
61
  */
62
62
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
63
63
  /**
@@ -2894,6 +2894,20 @@ export class Program {
2894
2894
  * console.log(credits_functions === expected_functions); // Output should be "true"
2895
2895
  */
2896
2896
  getFunctions(): Array<any>;
2897
+ /**
2898
+ * Get the program's name (without the `.aleo` suffix) encoded as a field element.
2899
+ *
2900
+ * This is the same value as casting the program name identifier to a field on-chain
2901
+ * (e.g. `my_program.aleo` -> `Identifier("my_program") as field`), which is used as
2902
+ * the program id in dynamic dispatch calls such as `IARC20@(token_id)`.
2903
+ *
2904
+ * @example
2905
+ * const program = aleo_wasm.Program.getCreditsProgram();
2906
+ * const field = program.nameToField(); // Field encoding of "credits"
2907
+ *
2908
+ * @returns {Field} The program name as a field element
2909
+ */
2910
+ nameToField(): Field;
2897
2911
  /**
2898
2912
  * Get the external call graph reachable from a specific entry function.
2899
2913
  *
@@ -3042,6 +3056,39 @@ export class Program {
3042
3056
  * @returns {Address} The address of the program
3043
3057
  */
3044
3058
  address(): Address;
3059
+ /**
3060
+ * Determine if the program implements the ARC-20 fungible token interface (IARC20).
3061
+ *
3062
+ * This checks that the program defines a `Token` record with an `amount: u128` entry
3063
+ * (additional entries are permitted, per the interface's open record definition) and
3064
+ * that every function and view function required by ARC-20 is present with the exact
3065
+ * input and output signature defined by the standard.
3066
+ *
3067
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0020/README.md
3068
+ *
3069
+ * @returns {boolean} True if the program implements the ARC-20 token interface
3070
+ */
3071
+ isArc20(): boolean;
3072
+ /**
3073
+ * Determine if the program implements the ARC-22 compliant token interface (IARC22).
3074
+ *
3075
+ * This checks that the program defines `Token` and `ComplianceRecord` records with the
3076
+ * entries required by the standard (additional entries are permitted, per the
3077
+ * interface's open record definitions), and that every function and view function
3078
+ * required by ARC-22 is present with the exact input and output signature defined by
3079
+ * the standard. The `MerkleProof` struct used by the private transfer functions may be
3080
+ * declared locally (in which case its shape must match the standard exactly) or
3081
+ * imported from another program such as a freeze list registry.
3082
+ *
3083
+ * Note: this checks the token interface (IARC22) only. The freeze list registry
3084
+ * interface (IARC22Freezelist) is typically implemented by a separate program and is
3085
+ * not required for a token program to be considered ARC-22 compliant.
3086
+ *
3087
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0022/README.md
3088
+ *
3089
+ * @returns {boolean} True if the program implements the ARC-22 token interface
3090
+ */
3091
+ isArc22(): boolean;
3045
3092
  /**
3046
3093
  * Determine equality with another program
3047
3094
  *
Binary file
@@ -320,38 +320,6 @@ function addBorrowedObject(obj) {
320
320
  heap[--stack_pointer] = obj;
321
321
  return stack_pointer;
322
322
  }
323
- /**
324
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
325
- *
326
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
327
- * Each verifying key is paired with one or more sets of public inputs (instances).
328
- *
329
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
330
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
331
- * @param {Proof} proof The batch proof to verify
332
- * @returns {boolean} True if the batch proof is valid, false otherwise
333
- * @param {Array<any>} verifying_keys
334
- * @param {Array<any>} inputs
335
- * @param {Proof} proof
336
- * @returns {boolean}
337
- */
338
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
339
- try {
340
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
- _assertClass(proof, Proof);
342
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
343
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
346
- if (r2) {
347
- throw takeObject(r1);
348
- }
349
- return r0 !== 0;
350
- } finally {
351
- wasm$1.__wbindgen_add_to_stack_pointer(16);
352
- }
353
- }
354
-
355
323
  /**
356
324
  * Verify an execution. Executions with multiple transitions must have the program source code and
357
325
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -400,6 +368,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
400
368
  }
401
369
  }
402
370
 
371
+ /**
372
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
373
+ *
374
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
375
+ * Each verifying key is paired with one or more sets of public inputs (instances).
376
+ *
377
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
378
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
379
+ * @param {Proof} proof The batch proof to verify
380
+ * @returns {boolean} True if the batch proof is valid, false otherwise
381
+ * @param {Array<any>} verifying_keys
382
+ * @param {Array<any>} inputs
383
+ * @param {Proof} proof
384
+ * @returns {boolean}
385
+ */
386
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
387
+ try {
388
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
389
+ _assertClass(proof, Proof);
390
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
391
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
392
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
393
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
394
+ if (r2) {
395
+ throw takeObject(r1);
396
+ }
397
+ return r0 !== 0;
398
+ } finally {
399
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
400
+ }
401
+ }
402
+
403
403
  /**
404
404
  * Verify a SNARK proof against a verifying key and public inputs.
405
405
  *
@@ -464,7 +464,7 @@ function stringToField(string) {
464
464
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
465
465
  *
466
466
  * Set the consensus version heights.
467
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
467
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
468
468
  * @param {string | null} [heights]
469
469
  * @returns {Array<any>}
470
470
  */
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
494
494
  }
495
495
  return result;
496
496
  }
497
- function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
498
- wasm$1.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
497
+ function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
498
+ wasm$1.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
499
499
  }
500
500
 
501
- function __wasm_bindgen_func_elem_7376(arg0, arg1) {
502
- wasm$1.__wasm_bindgen_func_elem_7376(arg0, arg1);
501
+ function __wasm_bindgen_func_elem_7397(arg0, arg1) {
502
+ wasm$1.__wasm_bindgen_func_elem_7397(arg0, arg1);
503
503
  }
504
504
 
505
- function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
506
- wasm$1.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7669(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7669(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
507
507
  }
508
508
 
509
509
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -10020,6 +10020,35 @@ class Program {
10020
10020
  const ret = wasm$1.program_getFunctions(this.__wbg_ptr);
10021
10021
  return takeObject(ret);
10022
10022
  }
10023
+ /**
10024
+ * Get the program's name (without the `.aleo` suffix) encoded as a field element.
10025
+ *
10026
+ * This is the same value as casting the program name identifier to a field on-chain
10027
+ * (e.g. `my_program.aleo` -> `Identifier("my_program") as field`), which is used as
10028
+ * the program id in dynamic dispatch calls such as `IARC20@(token_id)`.
10029
+ *
10030
+ * @example
10031
+ * const program = aleo_wasm.Program.getCreditsProgram();
10032
+ * const field = program.nameToField(); // Field encoding of "credits"
10033
+ *
10034
+ * @returns {Field} The program name as a field element
10035
+ * @returns {Field}
10036
+ */
10037
+ nameToField() {
10038
+ try {
10039
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
10040
+ wasm$1.program_nameToField(retptr, this.__wbg_ptr);
10041
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10042
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10043
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10044
+ if (r2) {
10045
+ throw takeObject(r1);
10046
+ }
10047
+ return Field.__wrap(r0);
10048
+ } finally {
10049
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
10050
+ }
10051
+ }
10023
10052
  /**
10024
10053
  * Get the external call graph reachable from a specific entry function.
10025
10054
  *
@@ -10275,6 +10304,47 @@ class Program {
10275
10304
  wasm$1.__wbindgen_add_to_stack_pointer(16);
10276
10305
  }
10277
10306
  }
10307
+ /**
10308
+ * Determine if the program implements the ARC-20 fungible token interface (IARC20).
10309
+ *
10310
+ * This checks that the program defines a `Token` record with an `amount: u128` entry
10311
+ * (additional entries are permitted, per the interface's open record definition) and
10312
+ * that every function and view function required by ARC-20 is present with the exact
10313
+ * input and output signature defined by the standard.
10314
+ *
10315
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0020/README.md
10316
+ *
10317
+ * @returns {boolean} True if the program implements the ARC-20 token interface
10318
+ * @returns {boolean}
10319
+ */
10320
+ isArc20() {
10321
+ const ret = wasm$1.program_isArc20(this.__wbg_ptr);
10322
+ return ret !== 0;
10323
+ }
10324
+ /**
10325
+ * Determine if the program implements the ARC-22 compliant token interface (IARC22).
10326
+ *
10327
+ * This checks that the program defines `Token` and `ComplianceRecord` records with the
10328
+ * entries required by the standard (additional entries are permitted, per the
10329
+ * interface's open record definitions), and that every function and view function
10330
+ * required by ARC-22 is present with the exact input and output signature defined by
10331
+ * the standard. The `MerkleProof` struct used by the private transfer functions may be
10332
+ * declared locally (in which case its shape must match the standard exactly) or
10333
+ * imported from another program such as a freeze list registry.
10334
+ *
10335
+ * Note: this checks the token interface (IARC22) only. The freeze list registry
10336
+ * interface (IARC22Freezelist) is typically implemented by a separate program and is
10337
+ * not required for a token program to be considered ARC-22 compliant.
10338
+ *
10339
+ * @see https://github.com/ProvableHQ/ARCs/blob/master/arc-0022/README.md
10340
+ *
10341
+ * @returns {boolean} True if the program implements the ARC-22 token interface
10342
+ * @returns {boolean}
10343
+ */
10344
+ isArc22() {
10345
+ const ret = wasm$1.program_isArc22(this.__wbg_ptr);
10346
+ return ret !== 0;
10347
+ }
10278
10348
  /**
10279
10349
  * Determine equality with another program
10280
10350
  *
@@ -19238,7 +19308,7 @@ function __wbg_get_imports(memory) {
19238
19308
  const ret = getObject(arg0).length;
19239
19309
  return ret;
19240
19310
  };
19241
- imports.wbg.__wbg_log_a61781f88cdec01a = function(arg0, arg1) {
19311
+ imports.wbg.__wbg_log_4507b73801c06872 = function(arg0, arg1) {
19242
19312
  console.log(getStringFromWasm0(arg0, arg1));
19243
19313
  };
19244
19314
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19256,7 +19326,7 @@ function __wbg_get_imports(memory) {
19256
19326
  const a = state0.a;
19257
19327
  state0.a = 0;
19258
19328
  try {
19259
- return __wasm_bindgen_func_elem_7648(a, state0.b, arg0, arg1);
19329
+ return __wasm_bindgen_func_elem_7669(a, state0.b, arg0, arg1);
19260
19330
  } finally {
19261
19331
  state0.a = a;
19262
19332
  }
@@ -19428,7 +19498,7 @@ function __wbg_get_imports(memory) {
19428
19498
  const ret = Signature.__wrap(arg0);
19429
19499
  return addHeapObject(ret);
19430
19500
  };
19431
- imports.wbg.__wbg_spawnWorker_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19501
+ imports.wbg.__wbg_spawnWorker_6197e35077a8baba = function(arg0, arg1, arg2, arg3) {
19432
19502
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19433
19503
  return addHeapObject(ret);
19434
19504
  };
@@ -19527,12 +19597,12 @@ function __wbg_get_imports(memory) {
19527
19597
  };
19528
19598
  imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19529
19599
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19530
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19600
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_8765);
19531
19601
  return addHeapObject(ret);
19532
19602
  };
19533
19603
  imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19534
19604
  // 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`.
19535
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19605
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_8765);
19536
19606
  return addHeapObject(ret);
19537
19607
  };
19538
19608
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19542,7 +19612,7 @@ function __wbg_get_imports(memory) {
19542
19612
  };
19543
19613
  imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19544
19614
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19545
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_7376);
19615
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7396, __wasm_bindgen_func_elem_7397);
19546
19616
  return addHeapObject(ret);
19547
19617
  };
19548
19618
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {