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