@provablehq/wasm 0.7.3 → 0.8.0

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.
@@ -202,15 +202,40 @@ export class Execution {
202
202
  free(): void;
203
203
  /**
204
204
  * Returns the string representation of the execution.
205
+ *
206
+ * @returns {string} The string representation of the execution.
205
207
  * @returns {string}
206
208
  */
207
209
  toString(): string;
208
210
  /**
209
211
  * Creates an execution object from a string representation of an execution.
212
+ *
213
+ * @returns {Execution | Error} The wasm representation of an execution object.
210
214
  * @param {string} execution
211
215
  * @returns {Execution}
212
216
  */
213
217
  static fromString(execution: string): Execution;
218
+ /**
219
+ * Returns the global state root of the execution.
220
+ *
221
+ * @returns {Execution | Error} The global state root used in the execution.
222
+ * @returns {string}
223
+ */
224
+ globalStateRoot(): string;
225
+ /**
226
+ * Returns the proof of the execution.
227
+ *
228
+ * @returns {string} The execution proof.
229
+ * @returns {string}
230
+ */
231
+ proof(): string;
232
+ /**
233
+ * Returns the transitions present in the execution.
234
+ *
235
+ * @returns Array<Transition> the array of transitions present in the execution.
236
+ * @returns {Array<any>}
237
+ */
238
+ transitions(): Array<any>;
214
239
  }
215
240
  /**
216
241
  * Webassembly Representation of an Aleo function execution response
@@ -641,11 +666,11 @@ export class Plaintext {
641
666
  *
642
667
  * @param {string} name The name of the plaintext member to find.
643
668
  *
644
- * @returns {Plaintext | undefined} The plaintext member.
669
+ * @returns {Plaintext} The plaintext member.
645
670
  * @param {string} name
646
- * @returns {Plaintext | undefined}
671
+ * @returns {Plaintext}
647
672
  */
648
- find(name: string): Plaintext | undefined;
673
+ find(name: string): Plaintext;
649
674
  /**
650
675
  * Encrypt a plaintext with an address and randomizer.
651
676
  * @param {Address} address
@@ -694,6 +719,13 @@ export class Plaintext {
694
719
  */
695
720
  toString(): string;
696
721
  /**
722
+ * Gives the type of the plaintext.
723
+ *
724
+ * @returns {string} The type of the plaintext.
725
+ * @returns {string}
726
+ */
727
+ plaintextType(): string;
728
+ /**
697
729
  * Attempt to convert the plaintext to a JS object.
698
730
  *
699
731
  * @returns {Object} The JS object representation of the plaintext.
@@ -2009,6 +2041,21 @@ export class Transaction {
2009
2041
  */
2010
2042
  isFee(): boolean;
2011
2043
  /**
2044
+ * Returns the program deployed within the transaction if the transaction is a deployment
2045
+ * transaction.
2046
+ *
2047
+ * @returns {Program | undefined} The program deployed within the transaction.
2048
+ * @returns {Program | undefined}
2049
+ */
2050
+ deployedProgram(): Program | undefined;
2051
+ /**
2052
+ * Returns the execution within the transaction (if present).
2053
+ *
2054
+ * @returns {Execution | undefined} The execution within the transaction.
2055
+ * @returns {Execution | undefined}
2056
+ */
2057
+ execution(): Execution | undefined;
2058
+ /**
2012
2059
  * Get the record plaintext present in a transaction owned by a specific view key.
2013
2060
  *
2014
2061
  * @param {ViewKey} view_key View key used to decrypt the ciphertext
@@ -2063,9 +2110,18 @@ export class Transaction {
2063
2110
  transactionType(): string;
2064
2111
  /**
2065
2112
  * Get the transitions in a transaction.
2113
+ *
2114
+ * @returns {Array<Transition>} Array of transition objects
2066
2115
  * @returns {Array<any>}
2067
2116
  */
2068
2117
  transitions(): Array<any>;
2118
+ /**
2119
+ * Get the verifying keys in a transaction.
2120
+ *
2121
+ * @returns {Array<Object>} Array of verifying keys.
2122
+ * @returns {Array<any>}
2123
+ */
2124
+ verifyingKeys(): Array<any>;
2069
2125
  }
2070
2126
  /**
2071
2127
  */
@@ -328,7 +328,7 @@ function handleError(f, args) {
328
328
  wasm.__wbindgen_exn_store(addHeapObject(e));
329
329
  }
330
330
  }
331
- function __wbg_adapter_408(arg0, arg1, arg2, arg3) {
331
+ function __wbg_adapter_419(arg0, arg1, arg2, arg3) {
332
332
  wasm.wasm_bindgen__convert__closures__invoke2_mut__hc5c49be524f0cde8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
333
333
  }
334
334
 
@@ -745,6 +745,8 @@ class Execution {
745
745
  }
746
746
  /**
747
747
  * Returns the string representation of the execution.
748
+ *
749
+ * @returns {string} The string representation of the execution.
748
750
  * @returns {string}
749
751
  */
750
752
  toString() {
@@ -765,6 +767,8 @@ class Execution {
765
767
  }
766
768
  /**
767
769
  * Creates an execution object from a string representation of an execution.
770
+ *
771
+ * @returns {Execution | Error} The wasm representation of an execution object.
768
772
  * @param {string} execution
769
773
  * @returns {Execution}
770
774
  */
@@ -785,6 +789,60 @@ class Execution {
785
789
  wasm.__wbindgen_add_to_stack_pointer(16);
786
790
  }
787
791
  }
792
+ /**
793
+ * Returns the global state root of the execution.
794
+ *
795
+ * @returns {Execution | Error} The global state root used in the execution.
796
+ * @returns {string}
797
+ */
798
+ globalStateRoot() {
799
+ let deferred1_0;
800
+ let deferred1_1;
801
+ try {
802
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
803
+ wasm.execution_globalStateRoot(retptr, this.__wbg_ptr);
804
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
805
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
806
+ deferred1_0 = r0;
807
+ deferred1_1 = r1;
808
+ return getStringFromWasm0(r0, r1);
809
+ } finally {
810
+ wasm.__wbindgen_add_to_stack_pointer(16);
811
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
812
+ }
813
+ }
814
+ /**
815
+ * Returns the proof of the execution.
816
+ *
817
+ * @returns {string} The execution proof.
818
+ * @returns {string}
819
+ */
820
+ proof() {
821
+ let deferred1_0;
822
+ let deferred1_1;
823
+ try {
824
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
825
+ wasm.execution_proof(retptr, this.__wbg_ptr);
826
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
827
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
828
+ deferred1_0 = r0;
829
+ deferred1_1 = r1;
830
+ return getStringFromWasm0(r0, r1);
831
+ } finally {
832
+ wasm.__wbindgen_add_to_stack_pointer(16);
833
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
834
+ }
835
+ }
836
+ /**
837
+ * Returns the transitions present in the execution.
838
+ *
839
+ * @returns Array<Transition> the array of transitions present in the execution.
840
+ * @returns {Array<any>}
841
+ */
842
+ transitions() {
843
+ const ret = wasm.execution_transitions(this.__wbg_ptr);
844
+ return takeObject(ret);
845
+ }
788
846
  }
789
847
 
790
848
  const ExecutionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1893,15 +1951,26 @@ class Plaintext {
1893
1951
  *
1894
1952
  * @param {string} name The name of the plaintext member to find.
1895
1953
  *
1896
- * @returns {Plaintext | undefined} The plaintext member.
1954
+ * @returns {Plaintext} The plaintext member.
1897
1955
  * @param {string} name
1898
- * @returns {Plaintext | undefined}
1956
+ * @returns {Plaintext}
1899
1957
  */
1900
1958
  find(name) {
1901
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1902
- const len0 = WASM_VECTOR_LEN;
1903
- const ret = wasm.plaintext_find(this.__wbg_ptr, ptr0, len0);
1904
- return ret === 0 ? undefined : Plaintext.__wrap(ret);
1959
+ try {
1960
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1961
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1962
+ const len0 = WASM_VECTOR_LEN;
1963
+ wasm.plaintext_find(retptr, this.__wbg_ptr, ptr0, len0);
1964
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1965
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1966
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1967
+ if (r2) {
1968
+ throw takeObject(r1);
1969
+ }
1970
+ return Plaintext.__wrap(r0);
1971
+ } finally {
1972
+ wasm.__wbindgen_add_to_stack_pointer(16);
1973
+ }
1905
1974
  }
1906
1975
  /**
1907
1976
  * Encrypt a plaintext with an address and randomizer.
@@ -2041,6 +2110,28 @@ class Plaintext {
2041
2110
  }
2042
2111
  }
2043
2112
  /**
2113
+ * Gives the type of the plaintext.
2114
+ *
2115
+ * @returns {string} The type of the plaintext.
2116
+ * @returns {string}
2117
+ */
2118
+ plaintextType() {
2119
+ let deferred1_0;
2120
+ let deferred1_1;
2121
+ try {
2122
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2123
+ wasm.plaintext_plaintextType(retptr, this.__wbg_ptr);
2124
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2125
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2126
+ deferred1_0 = r0;
2127
+ deferred1_1 = r1;
2128
+ return getStringFromWasm0(r0, r1);
2129
+ } finally {
2130
+ wasm.__wbindgen_add_to_stack_pointer(16);
2131
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2132
+ }
2133
+ }
2134
+ /**
2044
2135
  * Attempt to convert the plaintext to a JS object.
2045
2136
  *
2046
2137
  * @returns {Object} The JS object representation of the plaintext.
@@ -4722,6 +4813,27 @@ class Transaction {
4722
4813
  return ret !== 0;
4723
4814
  }
4724
4815
  /**
4816
+ * Returns the program deployed within the transaction if the transaction is a deployment
4817
+ * transaction.
4818
+ *
4819
+ * @returns {Program | undefined} The program deployed within the transaction.
4820
+ * @returns {Program | undefined}
4821
+ */
4822
+ deployedProgram() {
4823
+ const ret = wasm.transaction_deployedProgram(this.__wbg_ptr);
4824
+ return ret === 0 ? undefined : Program.__wrap(ret);
4825
+ }
4826
+ /**
4827
+ * Returns the execution within the transaction (if present).
4828
+ *
4829
+ * @returns {Execution | undefined} The execution within the transaction.
4830
+ * @returns {Execution | undefined}
4831
+ */
4832
+ execution() {
4833
+ const ret = wasm.transaction_execution(this.__wbg_ptr);
4834
+ return ret === 0 ? undefined : Execution.__wrap(ret);
4835
+ }
4836
+ /**
4725
4837
  * Get the record plaintext present in a transaction owned by a specific view key.
4726
4838
  *
4727
4839
  * @param {ViewKey} view_key View key used to decrypt the ciphertext
@@ -4816,12 +4928,24 @@ class Transaction {
4816
4928
  }
4817
4929
  /**
4818
4930
  * Get the transitions in a transaction.
4931
+ *
4932
+ * @returns {Array<Transition>} Array of transition objects
4819
4933
  * @returns {Array<any>}
4820
4934
  */
4821
4935
  transitions() {
4822
4936
  const ret = wasm.transaction_transitions(this.__wbg_ptr);
4823
4937
  return takeObject(ret);
4824
4938
  }
4939
+ /**
4940
+ * Get the verifying keys in a transaction.
4941
+ *
4942
+ * @returns {Array<Object>} Array of verifying keys.
4943
+ * @returns {Array<any>}
4944
+ */
4945
+ verifyingKeys() {
4946
+ const ret = wasm.transaction_verifyingKeys(this.__wbg_ptr);
4947
+ return takeObject(ret);
4948
+ }
4825
4949
  }
4826
4950
 
4827
4951
  const TransitionFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -5870,9 +5994,6 @@ function __wbg_get_imports() {
5870
5994
  getInt32Memory0()[arg0 / 4 + 1] = len1;
5871
5995
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
5872
5996
  };
5873
- imports.wbg.__wbg_log_66c8ad8d212e4a5d = function(arg0, arg1) {
5874
- console.log(getStringFromWasm0(arg0, arg1));
5875
- };
5876
5997
  imports.wbg.__wbg_transaction_new = function(arg0) {
5877
5998
  const ret = Transaction.__wrap(arg0);
5878
5999
  return addHeapObject(ret);
@@ -5881,16 +6002,11 @@ function __wbg_get_imports() {
5881
6002
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
5882
6003
  return addHeapObject(ret);
5883
6004
  }, arguments) };
5884
- imports.wbg.__wbindgen_module = function() {
5885
- const ret = __wbg_init.__wbindgen_wasm_module;
5886
- return addHeapObject(ret);
5887
- };
5888
- imports.wbg.__wbindgen_memory = function() {
5889
- const ret = wasm.memory;
5890
- return addHeapObject(ret);
6005
+ imports.wbg.__wbg_log_0373a28c0a891b83 = function(arg0, arg1) {
6006
+ console.log(getStringFromWasm0(arg0, arg1));
5891
6007
  };
5892
- imports.wbg.__wbg_spawnWorker_758137458d40462e = function(arg0, arg1, arg2, arg3) {
5893
- const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
6008
+ imports.wbg.__wbg_executionresponse_new = function(arg0) {
6009
+ const ret = ExecutionResponse.__wrap(arg0);
5894
6010
  return addHeapObject(ret);
5895
6011
  };
5896
6012
  imports.wbg.__wbg_newwithlength_66ae46612e7f0234 = function(arg0) {
@@ -5904,8 +6020,16 @@ function __wbg_get_imports() {
5904
6020
  const ret = BigInt.asUintN(64, arg0);
5905
6021
  return addHeapObject(ret);
5906
6022
  };
5907
- imports.wbg.__wbg_executionresponse_new = function(arg0) {
5908
- const ret = ExecutionResponse.__wrap(arg0);
6023
+ imports.wbg.__wbindgen_module = function() {
6024
+ const ret = __wbg_init.__wbindgen_wasm_module;
6025
+ return addHeapObject(ret);
6026
+ };
6027
+ imports.wbg.__wbindgen_memory = function() {
6028
+ const ret = wasm.memory;
6029
+ return addHeapObject(ret);
6030
+ };
6031
+ imports.wbg.__wbg_spawnWorker_bf2b4274ab1ad344 = function(arg0, arg1, arg2, arg3) {
6032
+ const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
5909
6033
  return addHeapObject(ret);
5910
6034
  };
5911
6035
  imports.wbg.__wbg_keypair_new = function(arg0) {
@@ -5993,6 +6117,14 @@ function __wbg_get_imports() {
5993
6117
  const ret = VerifyingKey.__wrap(arg0);
5994
6118
  return addHeapObject(ret);
5995
6119
  };
6120
+ imports.wbg.__wbg_address_new = function(arg0) {
6121
+ const ret = Address.__wrap(arg0);
6122
+ return addHeapObject(ret);
6123
+ };
6124
+ imports.wbg.__wbg_signature_new = function(arg0) {
6125
+ const ret = Signature.__wrap(arg0);
6126
+ return addHeapObject(ret);
6127
+ };
5996
6128
  imports.wbg.__wbg_transition_new = function(arg0) {
5997
6129
  const ret = Transition.__wrap(arg0);
5998
6130
  return addHeapObject(ret);
@@ -6004,7 +6136,7 @@ function __wbg_get_imports() {
6004
6136
  const a = state0.a;
6005
6137
  state0.a = 0;
6006
6138
  try {
6007
- return __wbg_adapter_408(a, state0.b, arg0, arg1);
6139
+ return __wbg_adapter_419(a, state0.b, arg0, arg1);
6008
6140
  } finally {
6009
6141
  state0.a = a;
6010
6142
  }
@@ -6220,11 +6352,11 @@ function __wbg_get_imports() {
6220
6352
  getInt32Memory0()[arg0 / 4 + 1] = len1;
6221
6353
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
6222
6354
  }, arguments) };
6223
- imports.wbg.__wbindgen_closure_wrapper6311 = function(arg0, arg1, arg2) {
6355
+ imports.wbg.__wbindgen_closure_wrapper6326 = function(arg0, arg1, arg2) {
6224
6356
  const ret = makeMutClosure(arg0, arg1, 624, __wbg_adapter_40);
6225
6357
  return addHeapObject(ret);
6226
6358
  };
6227
- imports.wbg.__wbindgen_closure_wrapper6337 = function(arg0, arg1, arg2) {
6359
+ imports.wbg.__wbindgen_closure_wrapper6352 = function(arg0, arg1, arg2) {
6228
6360
  const ret = makeMutClosure(arg0, arg1, 624, __wbg_adapter_40);
6229
6361
  return addHeapObject(ret);
6230
6362
  };