@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.
@@ -427,6 +427,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
427
427
  }
428
428
  }
429
429
 
430
+ /**
431
+ * Set test consensus version heights for testing.
432
+ *
433
+ * @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.
434
+ *
435
+ * @example
436
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
437
+ *
438
+ * Set the consensus version heights.
439
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
440
+ * @param {string | null} [heights]
441
+ * @returns {Array<any>}
442
+ */
443
+ function getOrInitConsensusVersionTestHeights(heights) {
444
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
445
+ var len0 = WASM_VECTOR_LEN;
446
+ const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
447
+ return takeObject(ret);
448
+ }
449
+
430
450
  /**
431
451
  * @param {string} string
432
452
  * @returns {Field}
@@ -449,26 +469,6 @@ function stringToField(string) {
449
469
  }
450
470
  }
451
471
 
452
- /**
453
- * Set test consensus version heights for testing.
454
- *
455
- * @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.
456
- *
457
- * @example
458
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
459
- *
460
- * Set the consensus version heights.
461
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
462
- * @param {string | null} [heights]
463
- * @returns {Array<any>}
464
- */
465
- function getOrInitConsensusVersionTestHeights(heights) {
466
- var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
467
- var len0 = WASM_VECTOR_LEN;
468
- const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
469
- return takeObject(ret);
470
- }
471
-
472
472
  function passArrayJsValueToWasm0(array, malloc) {
473
473
  const ptr = malloc(array.length * 4, 4) >>> 0;
474
474
  const mem = getDataViewMemory0();
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_7389(arg0, arg1) {
492
- wasm.__wasm_bindgen_func_elem_7389(arg0, arg1);
491
+ function __wasm_bindgen_func_elem_7392(arg0, arg1) {
492
+ wasm.__wasm_bindgen_func_elem_7392(arg0, arg1);
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
496
- wasm.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
495
+ function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
496
+ wasm.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
497
497
  }
498
498
 
499
- function __wasm_bindgen_func_elem_7660(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7660(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7664(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7664(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_e77f2654b14580d9 = 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_7660(a, state0.b, arg0, arg1);
19323
+ return __wasm_bindgen_func_elem_7664(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_77887968658d2179 = 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
  };
@@ -19506,7 +19576,7 @@ function __wbg_get_imports(memory) {
19506
19576
  };
19507
19577
  imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
19508
19578
  // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19509
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_7389);
19579
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_7392);
19510
19580
  return addHeapObject(ret);
19511
19581
  };
19512
19582
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -19516,7 +19586,7 @@ function __wbg_get_imports(memory) {
19516
19586
  };
19517
19587
  imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
19518
19588
  // 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`.
19519
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19589
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19520
19590
  return addHeapObject(ret);
19521
19591
  };
19522
19592
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
@@ -19531,7 +19601,7 @@ function __wbg_get_imports(memory) {
19531
19601
  };
19532
19602
  imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
19533
19603
  // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19534
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19604
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19535
19605
  return addHeapObject(ret);
19536
19606
  };
19537
19607
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {