@provablehq/wasm 0.9.16-rc → 0.9.16

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.
@@ -120,6 +120,14 @@ export class Address {
120
120
  * @returns {boolean} Boolean representing whether or not the signature is valid
121
121
  */
122
122
  verify(message: Uint8Array, signature: Signature): boolean;
123
+ /**
124
+ * Check if the input is a valid Aleo address.
125
+ *
126
+ * @param {string | Uint8Array} address - Either a string representation of an address
127
+ * or a Uint8Array of bytes in little-endian format.
128
+ * @returns {boolean} True if the input is a valid address, false otherwise.
129
+ */
130
+ static isValid(address: any): boolean;
123
131
  /**
124
132
  * Get the group representation of the address object.
125
133
  */
@@ -1678,7 +1686,7 @@ export class Pedersen64 {
1678
1686
  *
1679
1687
  * @example
1680
1688
  * // Get the bond state of an existing address.
1681
- * const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
1689
+ * const bondState = await fetch(https://api.provable.com/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
1682
1690
  * // Convert the bond state to a Plaintext object.
1683
1691
  * const bondStatePlaintext = Plaintext.fromString(bond_state);
1684
1692
  * // Convert the Plaintext object to a JS object.
@@ -2292,7 +2300,7 @@ export class ProgramManager {
2292
2300
  * @param broadcast (optional) Flag to indicate if the transaction should be broadcast
2293
2301
  * @returns {Authorization}
2294
2302
  */
2295
- static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition?: number | null): Promise<ProvingRequest>;
2303
+ static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean): Promise<ProvingRequest>;
2296
2304
  /**
2297
2305
  * Join two records together to create a new record with an amount of credits equal to the sum
2298
2306
  * of the credits of the two original records
@@ -4342,6 +4350,20 @@ export class ViewKey {
4342
4350
  * @returns {ViewKey} View key
4343
4351
  */
4344
4352
  static from_string(view_key: string): ViewKey;
4353
+ /**
4354
+ * Get the underlying bytes of a view key.
4355
+ *
4356
+ * @returns {Uint8Array} Left endian byte array representation of the view key.
4357
+ */
4358
+ toBytesLe(): Uint8Array;
4359
+ /**
4360
+ * Get a ViewKey from a series of bytes.
4361
+ *
4362
+ * @param {Uint8Array} bytes A left endian byte array representing the view key.
4363
+ *
4364
+ * @returns {ViewKey} The view key object.
4365
+ */
4366
+ static fromBytesLe(bytes: Uint8Array): ViewKey;
4345
4367
  /**
4346
4368
  * Create a new view key from a private key
4347
4369
  *
Binary file
@@ -384,12 +384,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
384
384
  }
385
385
  return result;
386
386
  }
387
- function __wasm_bindgen_func_elem_7844(arg0, arg1, arg2) {
388
- wasm.__wasm_bindgen_func_elem_7844(arg0, arg1, addHeapObject(arg2));
387
+ function __wasm_bindgen_func_elem_7853(arg0, arg1, arg2) {
388
+ wasm.__wasm_bindgen_func_elem_7853(arg0, arg1, addHeapObject(arg2));
389
389
  }
390
390
 
391
- function __wasm_bindgen_func_elem_6787(arg0, arg1, arg2, arg3) {
392
- wasm.__wasm_bindgen_func_elem_6787(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
391
+ function __wasm_bindgen_func_elem_6534(arg0, arg1) {
392
+ wasm.__wasm_bindgen_func_elem_6534(arg0, arg1);
393
+ }
394
+
395
+ function __wasm_bindgen_func_elem_6807(arg0, arg1, arg2, arg3) {
396
+ wasm.__wasm_bindgen_func_elem_6807(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
393
397
  }
394
398
 
395
399
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -638,6 +642,19 @@ class Address {
638
642
  const ret = wasm.address_verify(this.__wbg_ptr, ptr0, len0, signature.__wbg_ptr);
639
643
  return ret !== 0;
640
644
  }
645
+ /**
646
+ * Check if the input is a valid Aleo address.
647
+ *
648
+ * @param {string | Uint8Array} address - Either a string representation of an address
649
+ * or a Uint8Array of bytes in little-endian format.
650
+ * @returns {boolean} True if the input is a valid address, false otherwise.
651
+ * @param {any} address
652
+ * @returns {boolean}
653
+ */
654
+ static isValid(address) {
655
+ const ret = wasm.address_isValid(addHeapObject(address));
656
+ return ret !== 0;
657
+ }
641
658
  /**
642
659
  * Get the group representation of the address object.
643
660
  * @returns {Group}
@@ -6057,7 +6074,7 @@ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
6057
6074
  *
6058
6075
  * @example
6059
6076
  * // Get the bond state of an existing address.
6060
- * const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
6077
+ * const bondState = await fetch(https://api.provable.com/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
6061
6078
  * // Convert the bond state to a Plaintext object.
6062
6079
  * const bondStatePlaintext = Plaintext.fromString(bond_state);
6063
6080
  * // Convert the Plaintext object to a JS object.
@@ -7757,10 +7774,11 @@ class ProgramManager {
7757
7774
  * @param {object | null | undefined} imports
7758
7775
  * @param {boolean} broadcast
7759
7776
  * @param {boolean} unchecked
7760
- * @param {number | null} [edition]
7777
+ * @param {number | null | undefined} edition
7778
+ * @param {boolean} use_fee_master
7761
7779
  * @returns {Promise<ProvingRequest>}
7762
7780
  */
7763
- static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition) {
7781
+ static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition, use_fee_master) {
7764
7782
  _assertClass(private_key, PrivateKey);
7765
7783
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7766
7784
  const len0 = WASM_VECTOR_LEN;
@@ -7771,7 +7789,7 @@ class ProgramManager {
7771
7789
  _assertClass(fee_record, RecordPlaintext);
7772
7790
  ptr2 = fee_record.__destroy_into_raw();
7773
7791
  }
7774
- const ret = wasm.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition);
7792
+ const ret = wasm.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, use_fee_master);
7775
7793
  return takeObject(ret);
7776
7794
  }
7777
7795
  /**
@@ -13330,6 +13348,56 @@ class ViewKey {
13330
13348
  const ret = wasm.viewkey_from_string(ptr0, len0);
13331
13349
  return ViewKey.__wrap(ret);
13332
13350
  }
13351
+ /**
13352
+ * Get the underlying bytes of a view key.
13353
+ *
13354
+ * @returns {Uint8Array} Left endian byte array representation of the view key.
13355
+ * @returns {Uint8Array}
13356
+ */
13357
+ toBytesLe() {
13358
+ try {
13359
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13360
+ wasm.viewkey_toBytesLe(retptr, this.__wbg_ptr);
13361
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13362
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13363
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
13364
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
13365
+ if (r3) {
13366
+ throw takeObject(r2);
13367
+ }
13368
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
13369
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
13370
+ return v1;
13371
+ } finally {
13372
+ wasm.__wbindgen_add_to_stack_pointer(16);
13373
+ }
13374
+ }
13375
+ /**
13376
+ * Get a ViewKey from a series of bytes.
13377
+ *
13378
+ * @param {Uint8Array} bytes A left endian byte array representing the view key.
13379
+ *
13380
+ * @returns {ViewKey} The view key object.
13381
+ * @param {Uint8Array} bytes
13382
+ * @returns {ViewKey}
13383
+ */
13384
+ static fromBytesLe(bytes) {
13385
+ try {
13386
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13387
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
13388
+ const len0 = WASM_VECTOR_LEN;
13389
+ wasm.viewkey_fromBytesLe(retptr, ptr0, len0);
13390
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13391
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13392
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
13393
+ if (r2) {
13394
+ throw takeObject(r1);
13395
+ }
13396
+ return ViewKey.__wrap(r0);
13397
+ } finally {
13398
+ wasm.__wbindgen_add_to_stack_pointer(16);
13399
+ }
13400
+ }
13333
13401
  /**
13334
13402
  * Create a new view key from a private key
13335
13403
  *
@@ -13559,6 +13627,10 @@ function __wbg_get_imports(memory) {
13559
13627
  const ret = Ciphertext.__wrap(arg0);
13560
13628
  return addHeapObject(ret);
13561
13629
  };
13630
+ imports.wbg.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) {
13631
+ const ret = clearTimeout(takeObject(arg0));
13632
+ return addHeapObject(ret);
13633
+ };
13562
13634
  imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
13563
13635
  const ret = getObject(arg0).crypto;
13564
13636
  return addHeapObject(ret);
@@ -13635,6 +13707,16 @@ function __wbg_get_imports(memory) {
13635
13707
  const ret = result;
13636
13708
  return ret;
13637
13709
  };
13710
+ imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
13711
+ let result;
13712
+ try {
13713
+ result = getObject(arg0) instanceof Uint8Array;
13714
+ } catch (_) {
13715
+ result = false;
13716
+ }
13717
+ const ret = result;
13718
+ return ret;
13719
+ };
13638
13720
  imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
13639
13721
  const ret = Symbol.iterator;
13640
13722
  return addHeapObject(ret);
@@ -13655,7 +13737,7 @@ function __wbg_get_imports(memory) {
13655
13737
  const ret = getObject(arg0).length;
13656
13738
  return ret;
13657
13739
  };
13658
- imports.wbg.__wbg_log_c4f23d8ab0ebf7c1 = function(arg0, arg1) {
13740
+ imports.wbg.__wbg_log_6bd18bf94843f657 = function(arg0, arg1) {
13659
13741
  console.log(getStringFromWasm0(arg0, arg1));
13660
13742
  };
13661
13743
  imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
@@ -13677,7 +13759,7 @@ function __wbg_get_imports(memory) {
13677
13759
  const a = state0.a;
13678
13760
  state0.a = 0;
13679
13761
  try {
13680
- return __wasm_bindgen_func_elem_6787(a, state0.b, arg0, arg1);
13762
+ return __wasm_bindgen_func_elem_6807(a, state0.b, arg0, arg1);
13681
13763
  } finally {
13682
13764
  state0.a = a;
13683
13765
  }
@@ -13824,6 +13906,10 @@ function __wbg_get_imports(memory) {
13824
13906
  imports.wbg.__wbg_send_2e90b7c1fa1cdaf6 = function() { return handleError(function (arg0) {
13825
13907
  getObject(arg0).send();
13826
13908
  }, arguments) };
13909
+ imports.wbg.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
13910
+ const ret = setTimeout(getObject(arg0), arg1);
13911
+ return addHeapObject(ret);
13912
+ }, arguments) };
13827
13913
  imports.wbg.__wbg_set_body_3c365989753d61f4 = function(arg0, arg1) {
13828
13914
  getObject(arg0).body = getObject(arg1);
13829
13915
  };
@@ -13860,7 +13946,7 @@ function __wbg_get_imports(memory) {
13860
13946
  const ret = Signature.__wrap(arg0);
13861
13947
  return addHeapObject(ret);
13862
13948
  };
13863
- imports.wbg.__wbg_spawnWorker_ac6256d3825045f7 = function(arg0, arg1, arg2, arg3) {
13949
+ imports.wbg.__wbg_spawnWorker_7454d183f3803c13 = function(arg0, arg1, arg2, arg3) {
13864
13950
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
13865
13951
  return addHeapObject(ret);
13866
13952
  };
@@ -13950,6 +14036,16 @@ function __wbg_get_imports(memory) {
13950
14036
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
13951
14037
  return addHeapObject(ret);
13952
14038
  };
14039
+ imports.wbg.__wbindgen_cast_06d105bd9273956e = function(arg0, arg1) {
14040
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 418, function: Function { arguments: [], shim_idx: 507, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
14041
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_6533, __wasm_bindgen_func_elem_6534);
14042
+ return addHeapObject(ret);
14043
+ };
14044
+ imports.wbg.__wbindgen_cast_07555e2579ff3863 = function(arg0, arg1) {
14045
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 418, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 419, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
14046
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_6533, __wasm_bindgen_func_elem_7853);
14047
+ return addHeapObject(ret);
14048
+ };
13953
14049
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
13954
14050
  // Cast intrinsic for `Ref(String) -> Externref`.
13955
14051
  const ret = getStringFromWasm0(arg0, arg1);
@@ -13960,16 +14056,16 @@ function __wbg_get_imports(memory) {
13960
14056
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
13961
14057
  return addHeapObject(ret);
13962
14058
  };
13963
- imports.wbg.__wbindgen_cast_3e8b1a28e9899889 = function(arg0, arg1) {
13964
- // Cast intrinsic for `Closure(Closure { dtor_idx: 416, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 417, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13965
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7843, __wasm_bindgen_func_elem_7844);
13966
- return addHeapObject(ret);
13967
- };
13968
14059
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
13969
14060
  // Cast intrinsic for `U64 -> Externref`.
13970
14061
  const ret = BigInt.asUintN(64, arg0);
13971
14062
  return addHeapObject(ret);
13972
14063
  };
14064
+ imports.wbg.__wbindgen_cast_72bd42f236eeae61 = function(arg0, arg1) {
14065
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 418, function: Function { arguments: [Externref], shim_idx: 419, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
14066
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_6533, __wasm_bindgen_func_elem_7853);
14067
+ return addHeapObject(ret);
14068
+ };
13973
14069
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
13974
14070
  // Cast intrinsic for `I64 -> Externref`.
13975
14071
  const ret = arg0;
@@ -13990,11 +14086,6 @@ function __wbg_get_imports(memory) {
13990
14086
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
13991
14087
  return addHeapObject(ret);
13992
14088
  };
13993
- imports.wbg.__wbindgen_cast_f45fc07d50d9127c = function(arg0, arg1) {
13994
- // Cast intrinsic for `Closure(Closure { dtor_idx: 416, function: Function { arguments: [Externref], shim_idx: 417, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13995
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7843, __wasm_bindgen_func_elem_7844);
13996
- return addHeapObject(ret);
13997
- };
13998
14089
  imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
13999
14090
  const val = `onmessage = function (ev) {
14000
14091
  let [ia, index, value] = ev.data;