@puzzlehq/aleo-wasm-web 0.6.15 → 0.6.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.
package/aleo_wasm.d.ts CHANGED
@@ -298,6 +298,9 @@ export class Metadata {
298
298
  */
299
299
  locator: string;
300
300
  /**
301
+ */
302
+ name: string;
303
+ /**
301
304
  */
302
305
  prover: string;
303
306
  /**
@@ -340,6 +343,24 @@ export class OfflineQuery {
340
343
  static fromString(s: string): OfflineQuery;
341
344
  }
342
345
  /**
346
+ */
347
+ export class Plaintext {
348
+ free(): void;
349
+ /**
350
+ * @returns {string}
351
+ */
352
+ toString(): string;
353
+ /**
354
+ * @param {string} plaintext
355
+ * @returns {Plaintext}
356
+ */
357
+ static fromString(plaintext: string): Plaintext;
358
+ /**
359
+ * @returns {string}
360
+ */
361
+ hashBhp256(): string;
362
+ }
363
+ /**
343
364
  * Private key of an Aleo account
344
365
  */
345
366
  export class PrivateKey {
@@ -758,39 +779,6 @@ export class ProgramManager {
758
779
  */
759
780
  static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object): Promise<KeyPair>;
760
781
  /**
761
- * Send credits from one Aleo account to another
762
- *
763
- * @param private_key The private key of the sender
764
- * @param amount_credits The amount of credits to send
765
- * @param recipient The recipient of the transaction
766
- * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
767
- * @param amount_record The record to fund the amount from
768
- * @param fee_credits The amount of credits to pay as a fee
769
- * @param fee_record The record to spend the fee from
770
- * @param url The url of the Aleo network node to send the transaction to
771
- * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
772
- * function
773
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
774
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
775
- * @returns {Transaction | Error}
776
- * @param {PrivateKey} private_key
777
- * @param {number} amount_credits
778
- * @param {string} recipient
779
- * @param {string} transfer_type
780
- * @param {string | undefined} caller
781
- * @param {RecordPlaintext | undefined} amount_record
782
- * @param {number} fee_credits
783
- * @param {RecordPlaintext | undefined} [fee_record]
784
- * @param {string | undefined} [url]
785
- * @param {ProvingKey | undefined} [transfer_proving_key]
786
- * @param {VerifyingKey | undefined} [transfer_verifying_key]
787
- * @param {ProvingKey | undefined} [fee_proving_key]
788
- * @param {VerifyingKey | undefined} [fee_verifying_key]
789
- * @param {OfflineQuery | undefined} [offline_query]
790
- * @returns {Promise<Transaction>}
791
- */
792
- static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, caller: string | undefined, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record?: RecordPlaintext, url?: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
793
- /**
794
782
  * Join two records together to create a new record with an amount of credits equal to the sum
795
783
  * of the credits of the two original records
796
784
  *
@@ -841,6 +829,38 @@ export class ProgramManager {
841
829
  */
842
830
  static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string, split_proving_key?: ProvingKey, split_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
843
831
  /**
832
+ * Send credits from one Aleo account to another
833
+ *
834
+ * @param private_key The private key of the sender
835
+ * @param amount_credits The amount of credits to send
836
+ * @param recipient The recipient of the transaction
837
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
838
+ * @param amount_record The record to fund the amount from
839
+ * @param fee_credits The amount of credits to pay as a fee
840
+ * @param fee_record The record to spend the fee from
841
+ * @param url The url of the Aleo network node to send the transaction to
842
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
843
+ * function
844
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
845
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
846
+ * @returns {Transaction | Error}
847
+ * @param {PrivateKey} private_key
848
+ * @param {number} amount_credits
849
+ * @param {string} recipient
850
+ * @param {string} transfer_type
851
+ * @param {RecordPlaintext | undefined} amount_record
852
+ * @param {number} fee_credits
853
+ * @param {RecordPlaintext | undefined} [fee_record]
854
+ * @param {string | undefined} [url]
855
+ * @param {ProvingKey | undefined} [transfer_proving_key]
856
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
857
+ * @param {ProvingKey | undefined} [fee_proving_key]
858
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
859
+ * @param {OfflineQuery | undefined} [offline_query]
860
+ * @returns {Promise<Transaction>}
861
+ */
862
+ static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record?: RecordPlaintext, url?: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
863
+ /**
844
864
  * Deploy an Aleo program
845
865
  *
846
866
  * @param private_key The private key of the sender
@@ -1780,6 +1800,8 @@ export interface InitOutput {
1780
1800
  readonly viewkey_decrypt: (a: number, b: number, c: number, d: number) => void;
1781
1801
  readonly viewkey_decrypt_ciphertext: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
1782
1802
  readonly __wbg_metadata_free: (a: number) => void;
1803
+ readonly __wbg_get_metadata_name: (a: number, b: number) => void;
1804
+ readonly __wbg_set_metadata_name: (a: number, b: number, c: number) => void;
1783
1805
  readonly __wbg_get_metadata_locator: (a: number, b: number) => void;
1784
1806
  readonly __wbg_set_metadata_locator: (a: number, b: number, c: number) => void;
1785
1807
  readonly __wbg_get_metadata_prover: (a: number, b: number) => void;
@@ -1804,9 +1826,28 @@ export interface InitOutput {
1804
1826
  readonly metadata_transfer_public_as_signer: () => number;
1805
1827
  readonly metadata_transfer_public_to_private: () => number;
1806
1828
  readonly metadata_unbond_public: () => number;
1807
- readonly __wbg_field_free: (a: number) => void;
1808
- readonly field_toString: (a: number, b: number) => void;
1809
- readonly field_fromString: (a: number, b: number, c: number) => void;
1829
+ readonly __wbg_address_free: (a: number) => void;
1830
+ readonly address_from_private_key: (a: number) => number;
1831
+ readonly address_from_view_key: (a: number) => number;
1832
+ readonly address_from_string: (a: number, b: number) => number;
1833
+ readonly address_to_string: (a: number, b: number) => void;
1834
+ readonly address_verify: (a: number, b: number, c: number, d: number) => number;
1835
+ readonly __wbg_verifyingkey_free: (a: number) => void;
1836
+ readonly verifyingkey_checksum: (a: number, b: number) => void;
1837
+ readonly verifyingkey_copy: (a: number) => number;
1838
+ readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
1839
+ readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
1840
+ readonly verifyingkey_toBytes: (a: number, b: number) => void;
1841
+ readonly verifyingkey_toString: (a: number, b: number) => void;
1842
+ readonly __wbg_recordciphertext_free: (a: number) => void;
1843
+ readonly recordciphertext_fromString: (a: number, b: number, c: number) => void;
1844
+ readonly recordciphertext_toString: (a: number, b: number) => void;
1845
+ readonly recordciphertext_decrypt: (a: number, b: number, c: number) => void;
1846
+ readonly recordciphertext_isOwner: (a: number, b: number) => number;
1847
+ readonly __wbg_plaintext_free: (a: number) => void;
1848
+ readonly plaintext_toString: (a: number, b: number) => void;
1849
+ readonly plaintext_fromString: (a: number, b: number, c: number) => void;
1850
+ readonly plaintext_hashBhp256: (a: number, b: number) => void;
1810
1851
  readonly programmanager_synthesizeKeyPair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
1811
1852
  readonly __wbg_executionresponse_free: (a: number) => void;
1812
1853
  readonly executionresponse_getOutputs: (a: number) => number;
@@ -1824,52 +1865,12 @@ export interface InitOutput {
1824
1865
  readonly recordplaintext_nonce: (a: number, b: number) => void;
1825
1866
  readonly recordplaintext_serialNumberString: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1826
1867
  readonly __wbg_programmanager_free: (a: number) => void;
1868
+ readonly __wbg_field_free: (a: number) => void;
1869
+ readonly field_toString: (a: number, b: number) => void;
1870
+ readonly field_fromString: (a: number, b: number, c: number) => void;
1827
1871
  readonly runRayonThread: (a: number) => void;
1828
1872
  readonly initThreadPool: (a: number, b: number) => number;
1829
1873
  readonly init_panic_hook: () => void;
1830
- readonly __wbg_address_free: (a: number) => void;
1831
- readonly address_from_private_key: (a: number) => number;
1832
- readonly address_from_view_key: (a: number) => number;
1833
- readonly address_from_string: (a: number, b: number) => number;
1834
- readonly address_to_string: (a: number, b: number) => void;
1835
- readonly address_verify: (a: number, b: number, c: number, d: number) => number;
1836
- readonly __wbg_privatekeyciphertext_free: (a: number) => void;
1837
- readonly privatekeyciphertext_encryptPrivateKey: (a: number, b: number, c: number, d: number) => void;
1838
- readonly privatekeyciphertext_decryptToPrivateKey: (a: number, b: number, c: number, d: number) => void;
1839
- readonly privatekeyciphertext_toString: (a: number, b: number) => void;
1840
- readonly privatekeyciphertext_fromString: (a: number, b: number, c: number) => void;
1841
- readonly __wbg_verifyingkey_free: (a: number) => void;
1842
- readonly verifyingkey_checksum: (a: number, b: number) => void;
1843
- readonly verifyingkey_copy: (a: number) => number;
1844
- readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
1845
- readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
1846
- readonly verifyingkey_toBytes: (a: number, b: number) => void;
1847
- readonly verifyingkey_toString: (a: number, b: number) => void;
1848
- readonly __wbg_jsfield_free: (a: number) => void;
1849
- readonly jsfield_generate_message_leo: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1850
- readonly jsfield_generate_message_clients: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1851
- readonly __wbg_signature_free: (a: number) => void;
1852
- readonly signature_sign: (a: number, b: number, c: number) => number;
1853
- readonly signature_sign_message: (a: number, b: number, c: number, d: number, e: number) => number;
1854
- readonly signature_verify: (a: number, b: number, c: number, d: number) => number;
1855
- readonly signature_from_string: (a: number, b: number) => number;
1856
- readonly signature_to_string: (a: number, b: number) => void;
1857
- readonly programmanager_buildTransferTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number) => number;
1858
- readonly provingkey_isBondPublicProver: (a: number) => number;
1859
- readonly provingkey_isBondValidatorProver: (a: number) => number;
1860
- readonly provingkey_isClaimUnbondPublicProver: (a: number) => number;
1861
- readonly provingkey_isFeePrivateProver: (a: number) => number;
1862
- readonly provingkey_isFeePublicProver: (a: number) => number;
1863
- readonly provingkey_isInclusionProver: (a: number) => number;
1864
- readonly provingkey_isJoinProver: (a: number) => number;
1865
- readonly provingkey_isSetValidatorStateProver: (a: number) => number;
1866
- readonly provingkey_isSplitProver: (a: number) => number;
1867
- readonly provingkey_isTransferPrivateProver: (a: number) => number;
1868
- readonly provingkey_isTransferPrivateToPublicProver: (a: number) => number;
1869
- readonly provingkey_isTransferPublicProver: (a: number) => number;
1870
- readonly provingkey_isTransferPublicAsSignerProver: (a: number) => number;
1871
- readonly provingkey_isTransferPublicToPrivateProver: (a: number) => number;
1872
- readonly provingkey_isUnbondPublicProver: (a: number) => number;
1873
1874
  readonly __wbg_execution_free: (a: number) => void;
1874
1875
  readonly execution_toString: (a: number, b: number) => void;
1875
1876
  readonly execution_fromString: (a: number, b: number, c: number) => void;
@@ -1923,8 +1924,38 @@ export interface InitOutput {
1923
1924
  readonly verifyingkey_isTransferPublicAsSignerVerifier: (a: number) => number;
1924
1925
  readonly verifyingkey_isTransferPublicToPrivateVerifier: (a: number) => number;
1925
1926
  readonly verifyingkey_isUnbondPublicVerifier: (a: number) => number;
1927
+ readonly __wbg_jsfield_free: (a: number) => void;
1928
+ readonly jsfield_generate_message_leo: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1929
+ readonly jsfield_generate_message_clients: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1930
+ readonly __wbg_signature_free: (a: number) => void;
1931
+ readonly signature_sign: (a: number, b: number, c: number) => number;
1932
+ readonly signature_sign_message: (a: number, b: number, c: number, d: number, e: number) => number;
1933
+ readonly signature_verify: (a: number, b: number, c: number, d: number) => number;
1934
+ readonly signature_from_string: (a: number, b: number) => number;
1935
+ readonly signature_to_string: (a: number, b: number) => void;
1926
1936
  readonly programmanager_buildJoinTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => number;
1927
1937
  readonly programmanager_buildSplitTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
1938
+ readonly provingkey_isBondPublicProver: (a: number) => number;
1939
+ readonly provingkey_isBondValidatorProver: (a: number) => number;
1940
+ readonly provingkey_isClaimUnbondPublicProver: (a: number) => number;
1941
+ readonly provingkey_isFeePrivateProver: (a: number) => number;
1942
+ readonly provingkey_isFeePublicProver: (a: number) => number;
1943
+ readonly provingkey_isInclusionProver: (a: number) => number;
1944
+ readonly provingkey_isJoinProver: (a: number) => number;
1945
+ readonly provingkey_isSetValidatorStateProver: (a: number) => number;
1946
+ readonly provingkey_isSplitProver: (a: number) => number;
1947
+ readonly provingkey_isTransferPrivateProver: (a: number) => number;
1948
+ readonly provingkey_isTransferPrivateToPublicProver: (a: number) => number;
1949
+ readonly provingkey_isTransferPublicProver: (a: number) => number;
1950
+ readonly provingkey_isTransferPublicAsSignerProver: (a: number) => number;
1951
+ readonly provingkey_isTransferPublicToPrivateProver: (a: number) => number;
1952
+ readonly provingkey_isUnbondPublicProver: (a: number) => number;
1953
+ readonly programmanager_buildTransferTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => number;
1954
+ readonly __wbg_privatekeyciphertext_free: (a: number) => void;
1955
+ readonly privatekeyciphertext_encryptPrivateKey: (a: number, b: number, c: number, d: number) => void;
1956
+ readonly privatekeyciphertext_decryptToPrivateKey: (a: number, b: number, c: number, d: number) => void;
1957
+ readonly privatekeyciphertext_toString: (a: number, b: number) => void;
1958
+ readonly privatekeyciphertext_fromString: (a: number, b: number, c: number) => void;
1928
1959
  readonly __wbg_keypair_free: (a: number) => void;
1929
1960
  readonly keypair_new: (a: number, b: number) => number;
1930
1961
  readonly keypair_provingKey: (a: number, b: number) => void;
@@ -1952,11 +1983,6 @@ export interface InitOutput {
1952
1983
  readonly transaction_toString: (a: number, b: number) => void;
1953
1984
  readonly transaction_transactionId: (a: number, b: number) => void;
1954
1985
  readonly transaction_transactionType: (a: number, b: number) => void;
1955
- readonly __wbg_recordciphertext_free: (a: number) => void;
1956
- readonly recordciphertext_fromString: (a: number, b: number, c: number) => void;
1957
- readonly recordciphertext_toString: (a: number, b: number) => void;
1958
- readonly recordciphertext_decrypt: (a: number, b: number, c: number) => void;
1959
- readonly recordciphertext_isOwner: (a: number, b: number) => number;
1960
1986
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1961
1987
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1962
1988
  readonly __wbindgen_export_2: WebAssembly.Table;
package/aleo_wasm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { spawnWorker } from './snippets/aleo-wasm-57777c8959d12193/inline0.js';
1
+ import { spawnWorker } from './snippets/aleo-wasm-917a63011190b7ca/inline0.js';
2
2
 
3
3
  let wasm;
4
4
 
@@ -230,6 +230,11 @@ function _assertClass(instance, klass) {
230
230
  }
231
231
  return instance.ptr;
232
232
  }
233
+
234
+ function getArrayU8FromWasm0(ptr, len) {
235
+ ptr = ptr >>> 0;
236
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
237
+ }
233
238
  /**
234
239
  * @param {number} receiver
235
240
  */
@@ -253,10 +258,6 @@ export function initThreadPool(url, num_threads) {
253
258
  return takeObject(ret);
254
259
  }
255
260
 
256
- function getArrayU8FromWasm0(ptr, len) {
257
- ptr = ptr >>> 0;
258
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
259
- }
260
261
  /**
261
262
  * Verify an execution with a single function and a single transition. Executions with multiple
262
263
  * transitions or functions will fail to verify. Also, this does not verify that the state root of
@@ -310,7 +311,7 @@ function handleError(f, args) {
310
311
  wasm.__wbindgen_exn_store(addHeapObject(e));
311
312
  }
312
313
  }
313
- function __wbg_adapter_322(arg0, arg1, arg2, arg3) {
314
+ function __wbg_adapter_327(arg0, arg1, arg2, arg3) {
314
315
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h69b3d6b389ddc7fb(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
315
316
  }
316
317
 
@@ -940,6 +941,33 @@ export class Metadata {
940
941
  /**
941
942
  * @returns {string}
942
943
  */
944
+ get name() {
945
+ let deferred1_0;
946
+ let deferred1_1;
947
+ try {
948
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
949
+ wasm.__wbg_get_metadata_name(retptr, this.__wbg_ptr);
950
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
951
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
952
+ deferred1_0 = r0;
953
+ deferred1_1 = r1;
954
+ return getStringFromWasm0(r0, r1);
955
+ } finally {
956
+ wasm.__wbindgen_add_to_stack_pointer(16);
957
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
958
+ }
959
+ }
960
+ /**
961
+ * @param {string} arg0
962
+ */
963
+ set name(arg0) {
964
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
965
+ const len0 = WASM_VECTOR_LEN;
966
+ wasm.__wbg_set_metadata_name(this.__wbg_ptr, ptr0, len0);
967
+ }
968
+ /**
969
+ * @returns {string}
970
+ */
943
971
  get locator() {
944
972
  let deferred1_0;
945
973
  let deferred1_1;
@@ -1290,6 +1318,101 @@ export class OfflineQuery {
1290
1318
  }
1291
1319
  }
1292
1320
 
1321
+ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
1322
+ ? { register: () => {}, unregister: () => {} }
1323
+ : new FinalizationRegistry(ptr => wasm.__wbg_plaintext_free(ptr >>> 0));
1324
+ /**
1325
+ */
1326
+ export class Plaintext {
1327
+
1328
+ static __wrap(ptr) {
1329
+ ptr = ptr >>> 0;
1330
+ const obj = Object.create(Plaintext.prototype);
1331
+ obj.__wbg_ptr = ptr;
1332
+ PlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
1333
+ return obj;
1334
+ }
1335
+
1336
+ __destroy_into_raw() {
1337
+ const ptr = this.__wbg_ptr;
1338
+ this.__wbg_ptr = 0;
1339
+ PlaintextFinalization.unregister(this);
1340
+ return ptr;
1341
+ }
1342
+
1343
+ free() {
1344
+ const ptr = this.__destroy_into_raw();
1345
+ wasm.__wbg_plaintext_free(ptr);
1346
+ }
1347
+ /**
1348
+ * @returns {string}
1349
+ */
1350
+ toString() {
1351
+ let deferred1_0;
1352
+ let deferred1_1;
1353
+ try {
1354
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1355
+ wasm.plaintext_toString(retptr, this.__wbg_ptr);
1356
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1357
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1358
+ deferred1_0 = r0;
1359
+ deferred1_1 = r1;
1360
+ return getStringFromWasm0(r0, r1);
1361
+ } finally {
1362
+ wasm.__wbindgen_add_to_stack_pointer(16);
1363
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1364
+ }
1365
+ }
1366
+ /**
1367
+ * @param {string} plaintext
1368
+ * @returns {Plaintext}
1369
+ */
1370
+ static fromString(plaintext) {
1371
+ try {
1372
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1373
+ const ptr0 = passStringToWasm0(plaintext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1374
+ const len0 = WASM_VECTOR_LEN;
1375
+ wasm.plaintext_fromString(retptr, ptr0, len0);
1376
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1377
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1378
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1379
+ if (r2) {
1380
+ throw takeObject(r1);
1381
+ }
1382
+ return Plaintext.__wrap(r0);
1383
+ } finally {
1384
+ wasm.__wbindgen_add_to_stack_pointer(16);
1385
+ }
1386
+ }
1387
+ /**
1388
+ * @returns {string}
1389
+ */
1390
+ hashBhp256() {
1391
+ let deferred2_0;
1392
+ let deferred2_1;
1393
+ try {
1394
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1395
+ wasm.plaintext_hashBhp256(retptr, this.__wbg_ptr);
1396
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1397
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1398
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1399
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1400
+ var ptr1 = r0;
1401
+ var len1 = r1;
1402
+ if (r3) {
1403
+ ptr1 = 0; len1 = 0;
1404
+ throw takeObject(r2);
1405
+ }
1406
+ deferred2_0 = ptr1;
1407
+ deferred2_1 = len1;
1408
+ return getStringFromWasm0(ptr1, len1);
1409
+ } finally {
1410
+ wasm.__wbindgen_add_to_stack_pointer(16);
1411
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1412
+ }
1413
+ }
1414
+ }
1415
+
1293
1416
  const PrivateKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1294
1417
  ? { register: () => {}, unregister: () => {} }
1295
1418
  : new FinalizationRegistry(ptr => wasm.__wbg_privatekey_free(ptr >>> 0));
@@ -2119,86 +2242,6 @@ export class ProgramManager {
2119
2242
  return takeObject(ret);
2120
2243
  }
2121
2244
  /**
2122
- * Send credits from one Aleo account to another
2123
- *
2124
- * @param private_key The private key of the sender
2125
- * @param amount_credits The amount of credits to send
2126
- * @param recipient The recipient of the transaction
2127
- * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2128
- * @param amount_record The record to fund the amount from
2129
- * @param fee_credits The amount of credits to pay as a fee
2130
- * @param fee_record The record to spend the fee from
2131
- * @param url The url of the Aleo network node to send the transaction to
2132
- * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2133
- * function
2134
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2135
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2136
- * @returns {Transaction | Error}
2137
- * @param {PrivateKey} private_key
2138
- * @param {number} amount_credits
2139
- * @param {string} recipient
2140
- * @param {string} transfer_type
2141
- * @param {string | undefined} caller
2142
- * @param {RecordPlaintext | undefined} amount_record
2143
- * @param {number} fee_credits
2144
- * @param {RecordPlaintext | undefined} [fee_record]
2145
- * @param {string | undefined} [url]
2146
- * @param {ProvingKey | undefined} [transfer_proving_key]
2147
- * @param {VerifyingKey | undefined} [transfer_verifying_key]
2148
- * @param {ProvingKey | undefined} [fee_proving_key]
2149
- * @param {VerifyingKey | undefined} [fee_verifying_key]
2150
- * @param {OfflineQuery | undefined} [offline_query]
2151
- * @returns {Promise<Transaction>}
2152
- */
2153
- static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, caller, amount_record, fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2154
- _assertClass(private_key, PrivateKey);
2155
- const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2156
- const len0 = WASM_VECTOR_LEN;
2157
- const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2158
- const len1 = WASM_VECTOR_LEN;
2159
- var ptr2 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2160
- var len2 = WASM_VECTOR_LEN;
2161
- let ptr3 = 0;
2162
- if (!isLikeNone(amount_record)) {
2163
- _assertClass(amount_record, RecordPlaintext);
2164
- ptr3 = amount_record.__destroy_into_raw();
2165
- }
2166
- let ptr4 = 0;
2167
- if (!isLikeNone(fee_record)) {
2168
- _assertClass(fee_record, RecordPlaintext);
2169
- ptr4 = fee_record.__destroy_into_raw();
2170
- }
2171
- var ptr5 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2172
- var len5 = WASM_VECTOR_LEN;
2173
- let ptr6 = 0;
2174
- if (!isLikeNone(transfer_proving_key)) {
2175
- _assertClass(transfer_proving_key, ProvingKey);
2176
- ptr6 = transfer_proving_key.__destroy_into_raw();
2177
- }
2178
- let ptr7 = 0;
2179
- if (!isLikeNone(transfer_verifying_key)) {
2180
- _assertClass(transfer_verifying_key, VerifyingKey);
2181
- ptr7 = transfer_verifying_key.__destroy_into_raw();
2182
- }
2183
- let ptr8 = 0;
2184
- if (!isLikeNone(fee_proving_key)) {
2185
- _assertClass(fee_proving_key, ProvingKey);
2186
- ptr8 = fee_proving_key.__destroy_into_raw();
2187
- }
2188
- let ptr9 = 0;
2189
- if (!isLikeNone(fee_verifying_key)) {
2190
- _assertClass(fee_verifying_key, VerifyingKey);
2191
- ptr9 = fee_verifying_key.__destroy_into_raw();
2192
- }
2193
- let ptr10 = 0;
2194
- if (!isLikeNone(offline_query)) {
2195
- _assertClass(offline_query, OfflineQuery);
2196
- ptr10 = offline_query.__destroy_into_raw();
2197
- }
2198
- const ret = wasm.programmanager_buildTransferTransaction(private_key.__wbg_ptr, amount_credits, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, fee_credits, ptr4, ptr5, len5, ptr6, ptr7, ptr8, ptr9, ptr10);
2199
- return takeObject(ret);
2200
- }
2201
- /**
2202
2245
  * Join two records together to create a new record with an amount of credits equal to the sum
2203
2246
  * of the credits of the two original records
2204
2247
  *
@@ -2312,6 +2355,83 @@ export class ProgramManager {
2312
2355
  return takeObject(ret);
2313
2356
  }
2314
2357
  /**
2358
+ * Send credits from one Aleo account to another
2359
+ *
2360
+ * @param private_key The private key of the sender
2361
+ * @param amount_credits The amount of credits to send
2362
+ * @param recipient The recipient of the transaction
2363
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
2364
+ * @param amount_record The record to fund the amount from
2365
+ * @param fee_credits The amount of credits to pay as a fee
2366
+ * @param fee_record The record to spend the fee from
2367
+ * @param url The url of the Aleo network node to send the transaction to
2368
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
2369
+ * function
2370
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
2371
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
2372
+ * @returns {Transaction | Error}
2373
+ * @param {PrivateKey} private_key
2374
+ * @param {number} amount_credits
2375
+ * @param {string} recipient
2376
+ * @param {string} transfer_type
2377
+ * @param {RecordPlaintext | undefined} amount_record
2378
+ * @param {number} fee_credits
2379
+ * @param {RecordPlaintext | undefined} [fee_record]
2380
+ * @param {string | undefined} [url]
2381
+ * @param {ProvingKey | undefined} [transfer_proving_key]
2382
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
2383
+ * @param {ProvingKey | undefined} [fee_proving_key]
2384
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
2385
+ * @param {OfflineQuery | undefined} [offline_query]
2386
+ * @returns {Promise<Transaction>}
2387
+ */
2388
+ static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, amount_record, fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
2389
+ _assertClass(private_key, PrivateKey);
2390
+ const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2391
+ const len0 = WASM_VECTOR_LEN;
2392
+ const ptr1 = passStringToWasm0(transfer_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2393
+ const len1 = WASM_VECTOR_LEN;
2394
+ let ptr2 = 0;
2395
+ if (!isLikeNone(amount_record)) {
2396
+ _assertClass(amount_record, RecordPlaintext);
2397
+ ptr2 = amount_record.__destroy_into_raw();
2398
+ }
2399
+ let ptr3 = 0;
2400
+ if (!isLikeNone(fee_record)) {
2401
+ _assertClass(fee_record, RecordPlaintext);
2402
+ ptr3 = fee_record.__destroy_into_raw();
2403
+ }
2404
+ var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2405
+ var len4 = WASM_VECTOR_LEN;
2406
+ let ptr5 = 0;
2407
+ if (!isLikeNone(transfer_proving_key)) {
2408
+ _assertClass(transfer_proving_key, ProvingKey);
2409
+ ptr5 = transfer_proving_key.__destroy_into_raw();
2410
+ }
2411
+ let ptr6 = 0;
2412
+ if (!isLikeNone(transfer_verifying_key)) {
2413
+ _assertClass(transfer_verifying_key, VerifyingKey);
2414
+ ptr6 = transfer_verifying_key.__destroy_into_raw();
2415
+ }
2416
+ let ptr7 = 0;
2417
+ if (!isLikeNone(fee_proving_key)) {
2418
+ _assertClass(fee_proving_key, ProvingKey);
2419
+ ptr7 = fee_proving_key.__destroy_into_raw();
2420
+ }
2421
+ let ptr8 = 0;
2422
+ if (!isLikeNone(fee_verifying_key)) {
2423
+ _assertClass(fee_verifying_key, VerifyingKey);
2424
+ ptr8 = fee_verifying_key.__destroy_into_raw();
2425
+ }
2426
+ let ptr9 = 0;
2427
+ if (!isLikeNone(offline_query)) {
2428
+ _assertClass(offline_query, OfflineQuery);
2429
+ ptr9 = offline_query.__destroy_into_raw();
2430
+ }
2431
+ const ret = wasm.programmanager_buildTransferTransaction(private_key.__wbg_ptr, amount_credits, ptr0, len0, ptr1, len1, ptr2, fee_credits, ptr3, ptr4, len4, ptr5, ptr6, ptr7, ptr8, ptr9);
2432
+ return takeObject(ret);
2433
+ }
2434
+ /**
2315
2435
  * Deploy an Aleo program
2316
2436
  *
2317
2437
  * @param private_key The private key of the sender
@@ -4221,6 +4341,10 @@ function __wbg_get_imports() {
4221
4341
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
4222
4342
  takeObject(arg0);
4223
4343
  };
4344
+ imports.wbg.__wbg_executionresponse_new = function(arg0) {
4345
+ const ret = ExecutionResponse.__wrap(arg0);
4346
+ return addHeapObject(ret);
4347
+ };
4224
4348
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
4225
4349
  const ret = getStringFromWasm0(arg0, arg1);
4226
4350
  return addHeapObject(ret);
@@ -4229,13 +4353,9 @@ function __wbg_get_imports() {
4229
4353
  const ret = Transaction.__wrap(arg0);
4230
4354
  return addHeapObject(ret);
4231
4355
  };
4232
- imports.wbg.__wbg_log_a9e431931e09a09d = function(arg0, arg1) {
4356
+ imports.wbg.__wbg_log_b46ba1e74db5adee = function(arg0, arg1) {
4233
4357
  console.log(getStringFromWasm0(arg0, arg1));
4234
4358
  };
4235
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4236
- const ret = getObject(arg0);
4237
- return addHeapObject(ret);
4238
- };
4239
4359
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
4240
4360
  const obj = getObject(arg1);
4241
4361
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -4244,10 +4364,6 @@ function __wbg_get_imports() {
4244
4364
  getInt32Memory0()[arg0 / 4 + 1] = len1;
4245
4365
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
4246
4366
  };
4247
- imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4248
- const ret = AuthorizationResponse.__wrap(arg0);
4249
- return addHeapObject(ret);
4250
- };
4251
4367
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
4252
4368
  const ret = BigInt.asUintN(64, arg0);
4253
4369
  return addHeapObject(ret);
@@ -4256,11 +4372,15 @@ function __wbg_get_imports() {
4256
4372
  const ret = KeyPair.__wrap(arg0);
4257
4373
  return addHeapObject(ret);
4258
4374
  };
4259
- imports.wbg.__wbg_executionresponse_new = function(arg0) {
4260
- const ret = ExecutionResponse.__wrap(arg0);
4375
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
4376
+ const ret = getObject(arg0);
4377
+ return addHeapObject(ret);
4378
+ };
4379
+ imports.wbg.__wbg_authorizationresponse_new = function(arg0) {
4380
+ const ret = AuthorizationResponse.__wrap(arg0);
4261
4381
  return addHeapObject(ret);
4262
4382
  };
4263
- imports.wbg.__wbg_spawnWorker_8783a81153476045 = function(arg0, arg1, arg2, arg3) {
4383
+ imports.wbg.__wbg_spawnWorker_d4740fc67f78311c = function(arg0, arg1, arg2, arg3) {
4264
4384
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
4265
4385
  return addHeapObject(ret);
4266
4386
  };
@@ -4534,7 +4654,7 @@ function __wbg_get_imports() {
4534
4654
  const a = state0.a;
4535
4655
  state0.a = 0;
4536
4656
  try {
4537
- return __wbg_adapter_322(a, state0.b, arg0, arg1);
4657
+ return __wbg_adapter_327(a, state0.b, arg0, arg1);
4538
4658
  } finally {
4539
4659
  state0.a = a;
4540
4660
  }
@@ -4614,8 +4734,8 @@ function __wbg_get_imports() {
4614
4734
  const ret = wasm.memory;
4615
4735
  return addHeapObject(ret);
4616
4736
  };
4617
- imports.wbg.__wbindgen_closure_wrapper6149 = function(arg0, arg1, arg2) {
4618
- const ret = makeMutClosure(arg0, arg1, 868, __wbg_adapter_32);
4737
+ imports.wbg.__wbindgen_closure_wrapper6161 = function(arg0, arg1, arg2) {
4738
+ const ret = makeMutClosure(arg0, arg1, 865, __wbg_adapter_32);
4619
4739
  return addHeapObject(ret);
4620
4740
  };
4621
4741
 
package/aleo_wasm_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "The Aleo Team <hello@aleo.org>"
5
5
  ],
6
6
  "description": "WebAssembly based toolkit for developing zero-knowledge applications with Aleo",
7
- "version": "0.6.15",
7
+ "version": "0.6.16",
8
8
  "license": "GPL-3.0",
9
9
  "repository": {
10
10
  "type": "git",