@provablehq/wasm 0.9.8 → 0.9.10-testnet-rc

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.
@@ -264,6 +264,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
264
264
  }
265
265
  }
266
266
 
267
+ /**
268
+ * Set test consensus version heights for testing.
269
+ *
270
+ * @params {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.
271
+ *
272
+ * @example
273
+ * import { getOrInitConsensusVersionHeights } from @provablehq/sdk;
274
+ *
275
+ * Set the consensus version heights.
276
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9");
277
+ * @param {string | null} [heights]
278
+ * @returns {Array<any>}
279
+ */
280
+ function getOrInitConsensusVersionTestHeights(heights) {
281
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
282
+ var len0 = WASM_VECTOR_LEN;
283
+ const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
284
+ return takeObject(ret);
285
+ }
286
+
267
287
  function passArrayJsValueToWasm0(array, malloc) {
268
288
  const ptr = malloc(array.length * 4, 4) >>> 0;
269
289
  const mem = getDataViewMemory0();
@@ -287,7 +307,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
287
307
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
288
308
  }
289
309
 
290
- function __wbg_adapter_856(arg0, arg1, arg2, arg3) {
310
+ function __wbg_adapter_867(arg0, arg1, arg2, arg3) {
291
311
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
292
312
  }
293
313
 
@@ -2996,6 +3016,17 @@ class Field {
2996
3016
  heap[stack_pointer++] = undefined;
2997
3017
  }
2998
3018
  }
3019
+ /**
3020
+ * Initializes a new field as a domain separator.
3021
+ * @param {string} domain
3022
+ * @returns {Field}
3023
+ */
3024
+ static newDomainSeparator(domain) {
3025
+ const ptr0 = passStringToWasm0(domain, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
3026
+ const len0 = WASM_VECTOR_LEN;
3027
+ const ret = wasm.field_newDomainSeparator(ptr0, len0);
3028
+ return Field.__wrap(ret);
3029
+ }
2999
3030
  /**
3000
3031
  * Add two field elements.
3001
3032
  * @param {Field} other
@@ -5895,9 +5926,9 @@ class Plaintext {
5895
5926
  wasm.__wbg_plaintext_free(ptr, 0);
5896
5927
  }
5897
5928
  /**
5898
- * Get the left endian boolean array representation of the bits of the plaintext.
5929
+ * Get the little endian boolean array representation of the bits of the plaintext.
5899
5930
  *
5900
- * @returns {Array} The left endian boolean array representation of the bits of the plaintext.
5931
+ * @returns {Array} The little endian boolean array representation of the bits of the plaintext.
5901
5932
  * @returns {Array<any>}
5902
5933
  */
5903
5934
  toBitsLe() {
@@ -5955,9 +5986,9 @@ class Plaintext {
5955
5986
  }
5956
5987
  }
5957
5988
  /**
5958
- * Get the left endian byte array representation of the plaintext.
5989
+ * Get the little endian byte array representation of the plaintext.
5959
5990
  *
5960
- * @returns {Uint8Array} The left endian byte array representation of the plaintext.
5991
+ * @returns {Uint8Array} The little endian byte array representation of the plaintext.
5961
5992
  * @returns {Uint8Array}
5962
5993
  */
5963
5994
  toBytesLe() {
@@ -5978,7 +6009,7 @@ class Plaintext {
5978
6009
  /**
5979
6010
  * Get a plaintext object from a series of bits represented as a boolean array.
5980
6011
  *
5981
- * @param {Array} bits A left endian boolean array representing the bits plaintext.
6012
+ * @param {Array} bits A little endian boolean array representing the bits plaintext.
5982
6013
  *
5983
6014
  * @returns {Plaintext} The plaintext object.
5984
6015
  * @param {Array<any>} bits
@@ -6002,7 +6033,7 @@ class Plaintext {
6002
6033
  /**
6003
6034
  * Get a plaintext object from a series of bytes.
6004
6035
  *
6005
- * @param {Uint8Array} bytes A left endian byte array representing the plaintext.
6036
+ * @param {Uint8Array} bytes A little endian byte array representing the plaintext.
6006
6037
  *
6007
6038
  * @returns {Plaintext} The plaintext object.
6008
6039
  * @param {Uint8Array} bytes
@@ -6023,6 +6054,27 @@ class Plaintext {
6023
6054
  wasm.__wbindgen_add_to_stack_pointer(16);
6024
6055
  }
6025
6056
  }
6057
+ /**
6058
+ * Get the raw field array representation of the plaintext.
6059
+ *
6060
+ * @returns {Array} The raw field array representation of the plaintext.
6061
+ * @returns {Array<any>}
6062
+ */
6063
+ toFieldsRaw() {
6064
+ try {
6065
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6066
+ wasm.plaintext_toFieldsRaw(retptr, this.__wbg_ptr);
6067
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6068
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6069
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6070
+ if (r2) {
6071
+ throw takeObject(r1);
6072
+ }
6073
+ return takeObject(r0);
6074
+ } finally {
6075
+ wasm.__wbindgen_add_to_stack_pointer(16);
6076
+ }
6077
+ }
6026
6078
  /**
6027
6079
  * Gives the type of the plaintext.
6028
6080
  *
@@ -6045,6 +6097,68 @@ class Plaintext {
6045
6097
  wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
6046
6098
  }
6047
6099
  }
6100
+ /**
6101
+ * Get the raw big endian boolean array representation of the bits of the plaintext.
6102
+ *
6103
+ * @returns {Array} The raw big endian boolean array representation of the bits of the plaintext.
6104
+ * @returns {Array<any>}
6105
+ */
6106
+ toBitsRawBe() {
6107
+ const ret = wasm.plaintext_toBitsRawBe(this.__wbg_ptr);
6108
+ return takeObject(ret);
6109
+ }
6110
+ /**
6111
+ * Get the raw little endian boolean array representation of the bits of the plaintext.
6112
+ *
6113
+ * @returns {Array} The raw little endian boolean array representation of the bits of the plaintext.
6114
+ * @returns {Array<any>}
6115
+ */
6116
+ toBitsRawLe() {
6117
+ const ret = wasm.plaintext_toBitsRawLe(this.__wbg_ptr);
6118
+ return takeObject(ret);
6119
+ }
6120
+ /**
6121
+ * Get the raw big endian byte array representation of the plaintext.
6122
+ *
6123
+ * @returns {Uint8Array} The raw big endian byte array representation of the plaintext.
6124
+ * @returns {Uint8Array}
6125
+ */
6126
+ toBytesRawBe() {
6127
+ try {
6128
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6129
+ wasm.plaintext_toBytesRawBe(retptr, this.__wbg_ptr);
6130
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6131
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6132
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6133
+ if (r2) {
6134
+ throw takeObject(r1);
6135
+ }
6136
+ return takeObject(r0);
6137
+ } finally {
6138
+ wasm.__wbindgen_add_to_stack_pointer(16);
6139
+ }
6140
+ }
6141
+ /**
6142
+ * Get the raw little endian byte array representation of the plaintext.
6143
+ *
6144
+ * @returns {Uint8Array} The raw little endian byte array representation of the plaintext.
6145
+ * @returns {Uint8Array}
6146
+ */
6147
+ toBytesRawLe() {
6148
+ try {
6149
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6150
+ wasm.plaintext_toBytesRawLe(retptr, this.__wbg_ptr);
6151
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6152
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6153
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6154
+ if (r2) {
6155
+ throw takeObject(r1);
6156
+ }
6157
+ return takeObject(r0);
6158
+ } finally {
6159
+ wasm.__wbindgen_add_to_stack_pointer(16);
6160
+ }
6161
+ }
6048
6162
  /**
6049
6163
  * Encrypt a plaintext with a transition view key.
6050
6164
  *
@@ -6636,6 +6750,31 @@ class PrivateKey {
6636
6750
  const ptr = this.__destroy_into_raw();
6637
6751
  wasm.__wbg_privatekey_free(ptr, 0);
6638
6752
  }
6753
+ /**
6754
+ * Sign an instance of a valid Aleo data type or record.
6755
+ *
6756
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
6757
+ * @returns {Signature} Signature of the message.
6758
+ * @param {string} message
6759
+ * @returns {Signature}
6760
+ */
6761
+ signValue(message) {
6762
+ try {
6763
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6764
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
6765
+ const len0 = WASM_VECTOR_LEN;
6766
+ wasm.privatekey_signValue(retptr, this.__wbg_ptr, ptr0, len0);
6767
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6768
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6769
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6770
+ if (r2) {
6771
+ throw takeObject(r1);
6772
+ }
6773
+ return Signature.__wrap(r0);
6774
+ } finally {
6775
+ wasm.__wbindgen_add_to_stack_pointer(16);
6776
+ }
6777
+ }
6639
6778
  /**
6640
6779
  * Get the address corresponding to the private key
6641
6780
  *
@@ -7394,10 +7533,10 @@ class ProgramManager {
7394
7533
  /**
7395
7534
  * Synthesize proving and verifying keys for a program
7396
7535
  *
7397
- * @param program {string} The program source code of the program to synthesize keys for
7398
- * @param function_id {string} The function to synthesize keys for
7399
- * @param inputs {Array} The inputs to the function
7400
- * @param imports {Object | undefined} The imports for the program
7536
+ * @param {string} program The program source code of the program to synthesize keys for
7537
+ * @param {string} function_id The function to synthesize keys for
7538
+ * @param {Array} inputs The inputs to the function
7539
+ * @param {Object | undefined} imports The imports for the program
7401
7540
  * @param {PrivateKey} private_key
7402
7541
  * @param {string} program
7403
7542
  * @param {string} function_id
@@ -7415,6 +7554,14 @@ class ProgramManager {
7415
7554
  const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
7416
7555
  return takeObject(ret);
7417
7556
  }
7557
+ /**
7558
+ * @param {ProvingKey} proving_key
7559
+ */
7560
+ static loadInclusionProver(proving_key) {
7561
+ _assertClass(proving_key, ProvingKey);
7562
+ var ptr0 = proving_key.__destroy_into_raw();
7563
+ wasm.programmanager_loadInclusionProver(ptr0);
7564
+ }
7418
7565
  /**
7419
7566
  * Create a `ProvingRequest` object. This object creates authorizations for the top level
7420
7567
  * function and associated fee function. This object can be sent directly to a remote prover
@@ -9639,6 +9786,34 @@ class Signature {
9639
9786
  const ptr = this.__destroy_into_raw();
9640
9787
  wasm.__wbg_signature_free(ptr, 0);
9641
9788
  }
9789
+ /**
9790
+ * Sign an instance of a valid Aleo data type or record.
9791
+ *
9792
+ * @param {PrivateKey} private_key The private key used to sign the message.
9793
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
9794
+ * @returns {Signature} Signature of the message.
9795
+ * @param {PrivateKey} private_key
9796
+ * @param {string} message
9797
+ * @returns {Signature}
9798
+ */
9799
+ static signValue(private_key, message) {
9800
+ try {
9801
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9802
+ _assertClass(private_key, PrivateKey);
9803
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
9804
+ const len0 = WASM_VECTOR_LEN;
9805
+ wasm.signature_signValue(retptr, private_key.__wbg_ptr, ptr0, len0);
9806
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9807
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9808
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
9809
+ if (r2) {
9810
+ throw takeObject(r1);
9811
+ }
9812
+ return Signature.__wrap(r0);
9813
+ } finally {
9814
+ wasm.__wbindgen_add_to_stack_pointer(16);
9815
+ }
9816
+ }
9642
9817
  /**
9643
9818
  * Get an address from a signature.
9644
9819
  *
@@ -9722,6 +9897,34 @@ class Signature {
9722
9897
  const ret = wasm.signature_toPlaintext(this.__wbg_ptr);
9723
9898
  return Plaintext.__wrap(ret);
9724
9899
  }
9900
+ /**
9901
+ * Verify a signature over an Aleo datatype or record by an address.
9902
+ *
9903
+ * @param {Address} address The address used to verify the signature.
9904
+ * @param {String} message The message to verify, which must be the string representation of a valid Aleo datatype or record.
9905
+ * @returns {boolean} True if the signature is valid, false otherwise.
9906
+ * @param {Address} address
9907
+ * @param {string} message
9908
+ * @returns {boolean}
9909
+ */
9910
+ verifyValue(address, message) {
9911
+ try {
9912
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9913
+ _assertClass(address, Address);
9914
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
9915
+ const len0 = WASM_VECTOR_LEN;
9916
+ wasm.signature_verifyValue(retptr, this.__wbg_ptr, address.__wbg_ptr, ptr0, len0);
9917
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9918
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9919
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
9920
+ if (r2) {
9921
+ throw takeObject(r1);
9922
+ }
9923
+ return r0 !== 0;
9924
+ } finally {
9925
+ wasm.__wbindgen_add_to_stack_pointer(16);
9926
+ }
9927
+ }
9725
9928
  /**
9726
9929
  * Get a signature from a series of bytes.
9727
9930
  *
@@ -12941,7 +13144,7 @@ function __wbg_get_imports() {
12941
13144
  const ret = getObject(arg0).length;
12942
13145
  return ret;
12943
13146
  };
12944
- imports.wbg.__wbg_log_941d3627df3e4a6f = function(arg0, arg1) {
13147
+ imports.wbg.__wbg_log_bac25b70f2db29a3 = function(arg0, arg1) {
12945
13148
  console.log(getStringFromWasm0(arg0, arg1));
12946
13149
  };
12947
13150
  imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
@@ -12959,7 +13162,7 @@ function __wbg_get_imports() {
12959
13162
  const a = state0.a;
12960
13163
  state0.a = 0;
12961
13164
  try {
12962
- return __wbg_adapter_856(a, state0.b, arg0, arg1);
13165
+ return __wbg_adapter_867(a, state0.b, arg0, arg1);
12963
13166
  } finally {
12964
13167
  state0.a = a;
12965
13168
  }
@@ -13146,7 +13349,7 @@ function __wbg_get_imports() {
13146
13349
  const ret = Signature.__wrap(arg0);
13147
13350
  return addHeapObject(ret);
13148
13351
  };
13149
- imports.wbg.__wbg_spawnWorker_ffdd33a3c185ce11 = function(arg0, arg1, arg2, arg3) {
13352
+ imports.wbg.__wbg_spawnWorker_231c975bbb3598af = function(arg0, arg1, arg2, arg3) {
13150
13353
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
13151
13354
  return addHeapObject(ret);
13152
13355
  };
@@ -13266,12 +13469,12 @@ function __wbg_get_imports() {
13266
13469
  const ret = false;
13267
13470
  return ret;
13268
13471
  };
13269
- imports.wbg.__wbindgen_closure_wrapper6729 = function(arg0, arg1, arg2) {
13270
- const ret = makeMutClosure(arg0, arg1, 492, __wbg_adapter_40);
13472
+ imports.wbg.__wbindgen_closure_wrapper7347 = function(arg0, arg1, arg2) {
13473
+ const ret = makeMutClosure(arg0, arg1, 548, __wbg_adapter_40);
13271
13474
  return addHeapObject(ret);
13272
13475
  };
13273
- imports.wbg.__wbindgen_closure_wrapper6734 = function(arg0, arg1, arg2) {
13274
- const ret = makeMutClosure(arg0, arg1, 492, __wbg_adapter_40);
13476
+ imports.wbg.__wbindgen_closure_wrapper7352 = function(arg0, arg1, arg2) {
13477
+ const ret = makeMutClosure(arg0, arg1, 548, __wbg_adapter_40);
13275
13478
  return addHeapObject(ret);
13276
13479
  };
13277
13480
  imports.wbg.__wbindgen_is_function = function(arg0) {
@@ -13347,7 +13550,7 @@ function __wbg_get_imports() {
13347
13550
  }
13348
13551
 
13349
13552
  function __wbg_init_memory(imports, memory) {
13350
- imports.wbg.memory = memory || new WebAssembly.Memory({initial:23,maximum:65536,shared:true});
13553
+ imports.wbg.memory = memory || new WebAssembly.Memory({initial:167,maximum:65536,shared:true});
13351
13554
  }
13352
13555
 
13353
13556
  function __wbg_finalize_init(instance, module, thread_stack_size) {
@@ -13464,6 +13667,7 @@ var exports = /*#__PURE__*/Object.freeze({
13464
13667
  VerifyingKey: VerifyingKey,
13465
13668
  ViewKey: ViewKey,
13466
13669
  default: __wbg_init,
13670
+ getOrInitConsensusVersionTestHeights: getOrInitConsensusVersionTestHeights,
13467
13671
  initSync: initSync,
13468
13672
  initThreadPool: initThreadPool,
13469
13673
  runRayonThread: runRayonThread,