@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.
@@ -47,7 +47,6 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
47
47
  * @returns {boolean} True if the execution is valid, false otherwise
48
48
  */
49
49
  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;
50
- export function stringToField(string: string): Field;
51
50
  /**
52
51
  * Set test consensus version heights for testing.
53
52
  *
@@ -57,9 +56,10 @@ export function stringToField(string: string): Field;
57
56
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
58
57
  *
59
58
  * Set the consensus version heights.
60
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
59
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
61
60
  */
62
61
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
62
+ export function stringToField(string: string): Field;
63
63
  /**
64
64
  * Public address of an Aleo account
65
65
  */
@@ -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
@@ -433,6 +433,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
433
433
  }
434
434
  }
435
435
 
436
+ /**
437
+ * Set test consensus version heights for testing.
438
+ *
439
+ * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
440
+ *
441
+ * @example
442
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
443
+ *
444
+ * Set the consensus version heights.
445
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
446
+ * @param {string | null} [heights]
447
+ * @returns {Array<any>}
448
+ */
449
+ function getOrInitConsensusVersionTestHeights(heights) {
450
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
451
+ var len0 = WASM_VECTOR_LEN;
452
+ const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
453
+ return takeObject(ret);
454
+ }
455
+
436
456
  /**
437
457
  * @param {string} string
438
458
  * @returns {Field}
@@ -455,26 +475,6 @@ function stringToField(string) {
455
475
  }
456
476
  }
457
477
 
458
- /**
459
- * Set test consensus version heights for testing.
460
- *
461
- * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
462
- *
463
- * @example
464
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
465
- *
466
- * Set the consensus version heights.
467
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
468
- * @param {string | null} [heights]
469
- * @returns {Array<any>}
470
- */
471
- function getOrInitConsensusVersionTestHeights(heights) {
472
- var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
473
- var len0 = WASM_VECTOR_LEN;
474
- const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
475
- return takeObject(ret);
476
- }
477
-
478
478
  function passArrayJsValueToWasm0(array, malloc) {
479
479
  const ptr = malloc(array.length * 4, 4) >>> 0;
480
480
  const mem = getDataViewMemory0();
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
494
494
  }
495
495
  return result;
496
496
  }
497
- function __wasm_bindgen_func_elem_7389(arg0, arg1) {
498
- wasm$1.__wasm_bindgen_func_elem_7389(arg0, arg1);
497
+ function __wasm_bindgen_func_elem_7392(arg0, arg1) {
498
+ wasm$1.__wasm_bindgen_func_elem_7392(arg0, arg1);
499
499
  }
500
500
 
501
- function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
502
- wasm$1.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
501
+ function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
502
+ wasm$1.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
503
503
  }
504
504
 
505
- function __wasm_bindgen_func_elem_7660(arg0, arg1, arg2, arg3) {
506
- wasm$1.__wasm_bindgen_func_elem_7660(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7664(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7664(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_e77f2654b14580d9 = 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_7660(a, state0.b, arg0, arg1);
19329
+ return __wasm_bindgen_func_elem_7664(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_77887968658d2179 = 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
  };
@@ -19512,7 +19582,7 @@ function __wbg_get_imports(memory) {
19512
19582
  };
19513
19583
  imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
19514
19584
  // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19515
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_7389);
19585
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_7392);
19516
19586
  return addHeapObject(ret);
19517
19587
  };
19518
19588
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -19522,7 +19592,7 @@ function __wbg_get_imports(memory) {
19522
19592
  };
19523
19593
  imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
19524
19594
  // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19525
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19595
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19526
19596
  return addHeapObject(ret);
19527
19597
  };
19528
19598
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
@@ -19537,7 +19607,7 @@ function __wbg_get_imports(memory) {
19537
19607
  };
19538
19608
  imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
19539
19609
  // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19540
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19610
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19541
19611
  return addHeapObject(ret);
19542
19612
  };
19543
19613
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {