@provablehq/wasm 0.8.7 → 0.8.8

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.
@@ -40,6 +40,54 @@ export class Address {
40
40
  * @param {ComputeKey} compute_key The compute key to derive the address from
41
41
  */
42
42
  static from_compute_key(compute_key: ComputeKey): Address;
43
+ /**
44
+ * Get an address from a series of bytes.
45
+ *
46
+ * @param {Uint8Array} bytes A left endian byte array representing the address.
47
+ *
48
+ * @returns {Address} The address object.
49
+ */
50
+ static fromBytesLe(bytes: Uint8Array): Address;
51
+ /**
52
+ * Get the left endian byte array representation of the address.
53
+ */
54
+ toBytesLe(): Uint8Array;
55
+ /**
56
+ * Get an address from a series of bits represented as a boolean array.
57
+ *
58
+ * @param {Array} bits A left endian boolean array representing the bits of the address.
59
+ *
60
+ * @returns {Address} The address object.
61
+ */
62
+ static fromBitsLe(bits: Array<any>): Address;
63
+ /**
64
+ * Get the left endian boolean array representation of the bits of the address.
65
+ */
66
+ toBitsLe(): Array<any>;
67
+ /**
68
+ * Get an address object from an array of fields.
69
+ *
70
+ * @param {Array} fields An array of fields.
71
+ *
72
+ * @returns {Plaintext} The address object.
73
+ */
74
+ static fromFields(fields: Array<any>): Address;
75
+ /**
76
+ * Get the field array representation of the address.
77
+ */
78
+ toFields(): Array<any>;
79
+ /**
80
+ * Get an address object from a group.
81
+ *
82
+ * @param {Group} group The group object.
83
+ *
84
+ * @returns {Address} The address object.
85
+ */
86
+ static fromGroup(group: Group): Address;
87
+ /**
88
+ * Get the group representation of the address object.
89
+ */
90
+ toGroup(): Group;
43
91
  /**
44
92
  * Create an aleo address object from a string representation of an address
45
93
  *
@@ -54,6 +102,10 @@ export class Address {
54
102
  * @returns {string} String representation of the address
55
103
  */
56
104
  to_string(): string;
105
+ /**
106
+ * Get the plaintext representation of the address.
107
+ */
108
+ toPlaintext(): Plaintext;
57
109
  /**
58
110
  * Verify a signature for a message signed by the address
59
111
  *
@@ -214,6 +266,34 @@ export class Ciphertext {
214
266
  * @returns {Ciphertext} The Ciphertext object.
215
267
  */
216
268
  static fromBytesLe(bytes: Uint8Array): Ciphertext;
269
+ /**
270
+ * Get the left endian byte array representation of the ciphertext.
271
+ */
272
+ toBytesLe(): Uint8Array;
273
+ /**
274
+ * Get a ciphertext object from a series of bits represented as a boolean array.
275
+ *
276
+ * @param {Array} bits A left endian boolean array representing the bits of the ciphertext.
277
+ *
278
+ * @returns {Ciphertext} The ciphertext object.
279
+ */
280
+ static fromBitsLe(bits: Array<any>): Ciphertext;
281
+ /**
282
+ * Get the left endian boolean array representation of the bits of the ciphertext.
283
+ */
284
+ toBitsLe(): Array<any>;
285
+ /**
286
+ * Get a ciphertext object from an array of fields.
287
+ *
288
+ * @param {Array} fields An array of fields.
289
+ *
290
+ * @returns {Ciphertext} The ciphertext object.
291
+ */
292
+ static fromFields(fields: Array<any>): Ciphertext;
293
+ /**
294
+ * Get the field array representation of the ciphertext.
295
+ */
296
+ toFields(): Array<any>;
217
297
  /**
218
298
  * Deserialize a Ciphertext string into a Ciphertext object.
219
299
  *
@@ -497,6 +577,10 @@ export class Group {
497
577
  * Get the left endian boolean array representation of the group element.
498
578
  */
499
579
  toBitsLe(): Array<any>;
580
+ /**
581
+ * Get the field array representation of the group.
582
+ */
583
+ toFields(): Array<any>;
500
584
  /**
501
585
  * Get the x-coordinate of the group element.
502
586
  */
@@ -731,11 +815,33 @@ export class Plaintext {
731
815
  */
732
816
  static fromBytesLe(bytes: Uint8Array): Plaintext;
733
817
  /**
734
- * Generate a random plaintext element from a series of bytes.
735
- *
736
- * @param {Uint8Array} bytes A left endian byte array representing the plaintext.
818
+ * Get the left endian byte array representation of the plaintext.
737
819
  */
738
820
  toBytesLe(): Uint8Array;
821
+ /**
822
+ * Get a plaintext object from a series of bits represented as a boolean array.
823
+ *
824
+ * @param {Array} bits A left endian boolean array representing the bits plaintext.
825
+ *
826
+ * @returns {Plaintext} The plaintext object.
827
+ */
828
+ static fromBitsLe(bits: Array<any>): Plaintext;
829
+ /**
830
+ * Get the left endian boolean array representation of the bits of the plaintext.
831
+ */
832
+ toBitsLe(): Array<any>;
833
+ /**
834
+ * Get a plaintext object from an array of fields.
835
+ *
836
+ * @param {Array} fields An array of fields.
837
+ *
838
+ * @returns {Plaintext} The plaintext object.
839
+ */
840
+ static fromFields(fields: Array<any>): Plaintext;
841
+ /**
842
+ * Get the field array representation of the plaintext.
843
+ */
844
+ toFields(): Array<any>;
739
845
  /**
740
846
  * Returns the string representation of the plaintext.
741
847
  *
@@ -1198,7 +1304,7 @@ export class ProgramManager {
1198
1304
  * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
1199
1305
  * Note that all imported programs must be deployed on chain before the main program in order
1200
1306
  * for the deployment to succeed
1201
- * @param fee_credits The amount of credits to pay as a fee
1307
+ * @param priority_fee_credits The optional priority fee to be paid for the transaction
1202
1308
  * @param fee_record The record to spend the fee from
1203
1309
  * @param url The url of the Aleo network node to send the transaction to
1204
1310
  * @param imports (optional) Provide a list of imports to use for the program deployment in the
@@ -1208,7 +1314,7 @@ export class ProgramManager {
1208
1314
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
1209
1315
  * @returns {Transaction}
1210
1316
  */
1211
- static buildDeploymentTransaction(private_key: PrivateKey, program: string, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1317
+ static buildDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1212
1318
  /**
1213
1319
  * Estimate the fee for a program deployment
1214
1320
  *
@@ -1260,7 +1366,7 @@ export class ProgramManager {
1260
1366
  * @param program The source code of the program being executed
1261
1367
  * @param function The name of the function to execute
1262
1368
  * @param inputs A javascript array of inputs to the function
1263
- * @param fee_credits The amount of credits to pay as a fee
1369
+ * @param priority_fee_credits The optional priority fee to be paid for the transaction
1264
1370
  * @param fee_record The record to spend the fee from
1265
1371
  * @param url The url of the Aleo network node to send the transaction to
1266
1372
  * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
@@ -1276,7 +1382,7 @@ export class ProgramManager {
1276
1382
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
1277
1383
  * @returns {Transaction}
1278
1384
  */
1279
- static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1385
+ static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1280
1386
  /**
1281
1387
  * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
1282
1388
  * verifying keys will be stored in the ProgramManager's memory and used for subsequent
@@ -1316,7 +1422,7 @@ export class ProgramManager {
1316
1422
  * @param private_key The private key of the sender
1317
1423
  * @param record_1 The first record to combine
1318
1424
  * @param record_2 The second record to combine
1319
- * @param fee_credits The amount of credits to pay as a fee
1425
+ * @param priority_fee_credits The opptional priority fee to be paid for the transaction
1320
1426
  * @param fee_record The record to spend the fee from
1321
1427
  * @param url The url of the Aleo network node to send the transaction to
1322
1428
  * @param join_proving_key (optional) Provide a proving key to use for the join function
@@ -1325,7 +1431,7 @@ export class ProgramManager {
1325
1431
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
1326
1432
  * @returns {Transaction} Transaction object
1327
1433
  */
1328
- static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1434
+ static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1329
1435
  /**
1330
1436
  * Split an Aleo credits record into two separate records. This function does not require a fee.
1331
1437
  *
@@ -1347,7 +1453,7 @@ export class ProgramManager {
1347
1453
  * @param recipient The recipient of the transaction
1348
1454
  * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
1349
1455
  * @param amount_record The record to fund the amount from
1350
- * @param fee_credits The amount of credits to pay as a fee
1456
+ * @param priority_fee_credits The optional priority fee to be paid for the transaction
1351
1457
  * @param fee_record The record to spend the fee from
1352
1458
  * @param url The url of the Aleo network node to send the transaction to
1353
1459
  * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
@@ -1356,7 +1462,7 @@ export class ProgramManager {
1356
1462
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
1357
1463
  * @returns {Transaction}
1358
1464
  */
1359
- static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1465
+ static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
1360
1466
  /**
1361
1467
  * Synthesize proving and verifying keys for a program
1362
1468
  *
@@ -1604,6 +1710,26 @@ export class RecordCiphertext {
1604
1710
  * @returns {Field} tag of the record.
1605
1711
  */
1606
1712
  static tag(graph_key: GraphKey, commitment: Field): Field;
1713
+ /**
1714
+ * Get a record ciphertext object from a series of bytes.
1715
+ *
1716
+ * @param {Uint8Array} bytes A left endian byte array representing the record ciphertext.
1717
+ *
1718
+ * @returns {RecordCiphertext}
1719
+ */
1720
+ static fromBytesLe(bytes: Uint8Array): RecordCiphertext;
1721
+ /**
1722
+ * Get the left endian byte array representation of the record ciphertext.
1723
+ */
1724
+ toBytesLe(): Uint8Array;
1725
+ /**
1726
+ * Get the left endian boolean array representation of the record ciphertext bits.
1727
+ */
1728
+ toBitsLe(): Array<any>;
1729
+ /**
1730
+ * Get the field array representation of the record ciphertext.
1731
+ */
1732
+ toFields(): Array<any>;
1607
1733
  }
1608
1734
  /**
1609
1735
  * Plaintext representation of an Aleo record
@@ -1682,6 +1808,30 @@ export class RecordPlaintext {
1682
1808
  * @returns {string} String representation of the record plaintext
1683
1809
  */
1684
1810
  toString(): string;
1811
+ /**
1812
+ * Get a record plaintext object from a series of bytes.
1813
+ *
1814
+ * @param {Uint8Array} bytes A left endian byte array representing the record plaintext.
1815
+ *
1816
+ * @returns {RecordPlaintext} The record plaintext.
1817
+ */
1818
+ static fromBytesLe(bytes: Uint8Array): RecordPlaintext;
1819
+ /**
1820
+ * Returns the left endian byte array representation of the record plaintext.
1821
+ *
1822
+ * @returns {Uint8Array} Byte array representation of the record plaintext.
1823
+ */
1824
+ toBytesLe(): Uint8Array;
1825
+ /**
1826
+ * Returns the left endian boolean array representation of the record plaintext bits.
1827
+ *
1828
+ * @returns {Array} Boolean array representation of the record plaintext bits.
1829
+ */
1830
+ toBitsLe(): Array<any>;
1831
+ /**
1832
+ * Get the field array representation of the record plaintext.
1833
+ */
1834
+ toFields(): Array<any>;
1685
1835
  /**
1686
1836
  * Returns the amount of microcredits in the record
1687
1837
  *
@@ -1828,6 +1978,34 @@ export class Signature {
1828
1978
  * @returns {boolean} True if the signature is valid, false otherwise
1829
1979
  */
1830
1980
  verify(address: Address, message: Uint8Array): boolean;
1981
+ /**
1982
+ * Get a signature from a series of bytes.
1983
+ *
1984
+ * @param {Uint8Array} bytes A left endian byte array representing the signature.
1985
+ *
1986
+ * @returns {Signature} The signature object.
1987
+ */
1988
+ static fromBytesLe(bytes: Uint8Array): Signature;
1989
+ /**
1990
+ * Get the left endian byte array representation of the signature.
1991
+ */
1992
+ toBytesLe(): Uint8Array;
1993
+ /**
1994
+ * Get a signature from a series of bits represented as a boolean array.
1995
+ *
1996
+ * @param {Array} bits A left endian boolean array representing the bits of the signature.
1997
+ *
1998
+ * @returns {Signature} The signature object.
1999
+ */
2000
+ static fromBitsLe(bits: Array<any>): Signature;
2001
+ /**
2002
+ * Get the left endian boolean array representation of the bits of the signature.
2003
+ */
2004
+ toBitsLe(): Array<any>;
2005
+ /**
2006
+ * Get the field array representation of the signature.
2007
+ */
2008
+ toFields(): Array<any>;
1831
2009
  /**
1832
2010
  * Get a signature from a string representation of a signature
1833
2011
  *
@@ -1841,6 +2019,10 @@ export class Signature {
1841
2019
  * @returns {string} String representation of a signature
1842
2020
  */
1843
2021
  to_string(): string;
2022
+ /**
2023
+ * Get the plaintext representation of the signature.
2024
+ */
2025
+ toPlaintext(): Plaintext;
1844
2026
  }
1845
2027
  /**
1846
2028
  * Webassembly Representation of an Aleo transaction
Binary file