@provablehq/wasm 0.10.0 → 0.10.2-rc.1
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/dist/mainnet/aleo_wasm.d.ts +5655 -4634
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +14025 -9981
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +14026 -9980
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +1077 -60
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +4263 -556
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +4263 -555
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,18 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function runRayonThread(receiver: number): void;
|
|
4
4
|
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
5
|
-
/**
|
|
6
|
-
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
7
|
-
*
|
|
8
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
9
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
10
|
-
*
|
|
11
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
12
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
13
|
-
* @param {Proof} proof The batch proof to verify
|
|
14
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
15
|
-
*/
|
|
16
|
-
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
17
5
|
/**
|
|
18
6
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
19
7
|
*
|
|
@@ -39,7 +27,20 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
39
27
|
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
40
28
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
41
29
|
*/
|
|
42
|
-
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number): boolean;
|
|
30
|
+
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
33
|
+
*
|
|
34
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
35
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
36
|
+
*
|
|
37
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
38
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
39
|
+
* @param {Proof} proof The batch proof to verify
|
|
40
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
43
|
+
export function stringToField(string: string): Field;
|
|
43
44
|
/**
|
|
44
45
|
* Set test consensus version heights for testing.
|
|
45
46
|
*
|
|
@@ -52,7 +53,6 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
52
53
|
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
|
|
53
54
|
*/
|
|
54
55
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
55
|
-
export function stringToField(string: string): Field;
|
|
56
56
|
/**
|
|
57
57
|
* Public address of an Aleo account
|
|
58
58
|
*/
|
|
@@ -92,6 +92,14 @@ export class Address {
|
|
|
92
92
|
* Get the left endian byte array representation of the address.
|
|
93
93
|
*/
|
|
94
94
|
toBytesLe(): Uint8Array;
|
|
95
|
+
/**
|
|
96
|
+
* Cast the address to an I8 with lossy truncation.
|
|
97
|
+
*/
|
|
98
|
+
toI8Lossy(): I8;
|
|
99
|
+
/**
|
|
100
|
+
* Cast the address to a U8 with lossy truncation.
|
|
101
|
+
*/
|
|
102
|
+
toU8Lossy(): U8;
|
|
95
103
|
/**
|
|
96
104
|
* Get an address from a series of bits represented as a boolean array.
|
|
97
105
|
*
|
|
@@ -100,6 +108,18 @@ export class Address {
|
|
|
100
108
|
* @returns {Address} The address object.
|
|
101
109
|
*/
|
|
102
110
|
static fromBitsLe(bits: Array<any>): Address;
|
|
111
|
+
/**
|
|
112
|
+
* Cast the address to an I16 with lossy truncation.
|
|
113
|
+
*/
|
|
114
|
+
toI16Lossy(): I16;
|
|
115
|
+
/**
|
|
116
|
+
* Cast the address to an I32 with lossy truncation.
|
|
117
|
+
*/
|
|
118
|
+
toI32Lossy(): I32;
|
|
119
|
+
/**
|
|
120
|
+
* Cast the address to an I64 with lossy truncation.
|
|
121
|
+
*/
|
|
122
|
+
toI64Lossy(): I64;
|
|
103
123
|
/**
|
|
104
124
|
* Get the plaintext representation of the address.
|
|
105
125
|
*/
|
|
@@ -110,6 +130,18 @@ export class Address {
|
|
|
110
130
|
* @returns {string} String representation of the address
|
|
111
131
|
*/
|
|
112
132
|
toString(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Cast the address to a U16 with lossy truncation.
|
|
135
|
+
*/
|
|
136
|
+
toU16Lossy(): U16;
|
|
137
|
+
/**
|
|
138
|
+
* Cast the address to a U32 with lossy truncation.
|
|
139
|
+
*/
|
|
140
|
+
toU32Lossy(): U32;
|
|
141
|
+
/**
|
|
142
|
+
* Cast the address to a U64 with lossy truncation.
|
|
143
|
+
*/
|
|
144
|
+
toU64Lossy(): U64;
|
|
113
145
|
/**
|
|
114
146
|
* Get an address from a series of bytes.
|
|
115
147
|
*
|
|
@@ -125,6 +157,14 @@ export class Address {
|
|
|
125
157
|
* @returns {Address} Address corresponding to the view key
|
|
126
158
|
*/
|
|
127
159
|
static from_view_key(view_key: ViewKey): Address;
|
|
160
|
+
/**
|
|
161
|
+
* Cast the address to an I128 with lossy truncation.
|
|
162
|
+
*/
|
|
163
|
+
toI128Lossy(): I128;
|
|
164
|
+
/**
|
|
165
|
+
* Cast the address to a U128 with lossy truncation.
|
|
166
|
+
*/
|
|
167
|
+
toU128Lossy(): U128;
|
|
128
168
|
/**
|
|
129
169
|
* Get the address of a program based on the program ID.
|
|
130
170
|
*
|
|
@@ -132,6 +172,10 @@ export class Address {
|
|
|
132
172
|
* @returns {Address} The address corresponding to the program ID.
|
|
133
173
|
*/
|
|
134
174
|
static fromProgramId(program_id: string): Address;
|
|
175
|
+
/**
|
|
176
|
+
* Cast the address to a Scalar with lossy truncation (via x-coordinate).
|
|
177
|
+
*/
|
|
178
|
+
toScalarLossy(): Scalar;
|
|
135
179
|
/**
|
|
136
180
|
* Derive an Aleo address from a compute key.
|
|
137
181
|
*
|
|
@@ -145,6 +189,10 @@ export class Address {
|
|
|
145
189
|
* @returns {Address} Address corresponding to the private key
|
|
146
190
|
*/
|
|
147
191
|
static from_private_key(private_key: PrivateKey): Address;
|
|
192
|
+
/**
|
|
193
|
+
* Cast the address to a Boolean with lossy truncation (LSB of x-coordinate).
|
|
194
|
+
*/
|
|
195
|
+
toBooleanLossy(): Boolean;
|
|
148
196
|
/**
|
|
149
197
|
* Verify a signature for a message signed by the address
|
|
150
198
|
*
|
|
@@ -161,6 +209,10 @@ export class Address {
|
|
|
161
209
|
* @returns {boolean} True if the input is a valid address, false otherwise.
|
|
162
210
|
*/
|
|
163
211
|
static isValid(address: any): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Cast the address to a Field element (x-coordinate of the underlying group point).
|
|
214
|
+
*/
|
|
215
|
+
toField(): Field;
|
|
164
216
|
/**
|
|
165
217
|
* Get the group representation of the address object.
|
|
166
218
|
*/
|
|
@@ -383,6 +435,10 @@ export class BHP768 {
|
|
|
383
435
|
export class Boolean {
|
|
384
436
|
free(): void;
|
|
385
437
|
[Symbol.dispose](): void;
|
|
438
|
+
/**
|
|
439
|
+
* Cast the boolean to an Address (strict, via Group). Returns an error if conversion fails.
|
|
440
|
+
*/
|
|
441
|
+
toAddress(): Address;
|
|
386
442
|
/**
|
|
387
443
|
* Get the left endian boolean array representation of the boolean element.
|
|
388
444
|
*/
|
|
@@ -407,6 +463,15 @@ export class Boolean {
|
|
|
407
463
|
* Create a boolean element from a Uint8Array of left endian bytes.
|
|
408
464
|
*/
|
|
409
465
|
static fromBytesLe(bytes: Uint8Array): Boolean;
|
|
466
|
+
/**
|
|
467
|
+
* Cast the boolean to a Group element (lossy, via Field with Elligator-2 fallback).
|
|
468
|
+
* This conversion never fails.
|
|
469
|
+
*/
|
|
470
|
+
toGroupLossy(): Group;
|
|
471
|
+
/**
|
|
472
|
+
* Cast the boolean to an Address (lossy, via Group with Elligator-2 fallback).
|
|
473
|
+
*/
|
|
474
|
+
toAddressLossy(): Address;
|
|
410
475
|
/**
|
|
411
476
|
* Logical OR.
|
|
412
477
|
*/
|
|
@@ -439,6 +504,14 @@ export class Boolean {
|
|
|
439
504
|
* Clone the boolean element.
|
|
440
505
|
*/
|
|
441
506
|
clone(): Boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Cast the boolean to an I8 (false=0, true=1).
|
|
509
|
+
*/
|
|
510
|
+
toI8(): I8;
|
|
511
|
+
/**
|
|
512
|
+
* Cast the boolean to a U8 (false=0, true=1).
|
|
513
|
+
*/
|
|
514
|
+
toU8(): U8;
|
|
442
515
|
/**
|
|
443
516
|
* Check if one boolean element equals another.
|
|
444
517
|
*/
|
|
@@ -447,6 +520,51 @@ export class Boolean {
|
|
|
447
520
|
* Generate a random boolean element.
|
|
448
521
|
*/
|
|
449
522
|
static random(): Boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Cast the boolean to an I16 (false=0, true=1).
|
|
525
|
+
*/
|
|
526
|
+
toI16(): I16;
|
|
527
|
+
/**
|
|
528
|
+
* Cast the boolean to an I32 (false=0, true=1).
|
|
529
|
+
*/
|
|
530
|
+
toI32(): I32;
|
|
531
|
+
/**
|
|
532
|
+
* Cast the boolean to an I64 (false=0, true=1).
|
|
533
|
+
*/
|
|
534
|
+
toI64(): I64;
|
|
535
|
+
/**
|
|
536
|
+
* Cast the boolean to a U16 (false=0, true=1).
|
|
537
|
+
*/
|
|
538
|
+
toU16(): U16;
|
|
539
|
+
/**
|
|
540
|
+
* Cast the boolean to a U32 (false=0, true=1).
|
|
541
|
+
*/
|
|
542
|
+
toU32(): U32;
|
|
543
|
+
/**
|
|
544
|
+
* Cast the boolean to a U64 (false=0, true=1).
|
|
545
|
+
*/
|
|
546
|
+
toU64(): U64;
|
|
547
|
+
/**
|
|
548
|
+
* Cast the boolean to an I128 (false=0, true=1).
|
|
549
|
+
*/
|
|
550
|
+
toI128(): I128;
|
|
551
|
+
/**
|
|
552
|
+
* Cast the boolean to a U128 (false=0, true=1).
|
|
553
|
+
*/
|
|
554
|
+
toU128(): U128;
|
|
555
|
+
/**
|
|
556
|
+
* Cast the boolean to a Field element (false=0, true=1). Lossless.
|
|
557
|
+
*/
|
|
558
|
+
toField(): Field;
|
|
559
|
+
/**
|
|
560
|
+
* Cast the boolean to a Group element (strict, via Field x-coordinate recovery).
|
|
561
|
+
* Returns an error if the resulting field is not a valid x-coordinate.
|
|
562
|
+
*/
|
|
563
|
+
toGroup(): Group;
|
|
564
|
+
/**
|
|
565
|
+
* Cast the boolean to a Scalar element (false=0, true=1). Lossless.
|
|
566
|
+
*/
|
|
567
|
+
toScalar(): Scalar;
|
|
450
568
|
/**
|
|
451
569
|
* Returns the string representation of the boolean element.
|
|
452
570
|
*/
|
|
@@ -1029,10 +1147,20 @@ export class Field {
|
|
|
1029
1147
|
private constructor();
|
|
1030
1148
|
free(): void;
|
|
1031
1149
|
[Symbol.dispose](): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Cast the field element to an Address (strict, via Group x-coordinate recovery).
|
|
1152
|
+
* Returns an error if the field is not a valid x-coordinate on the curve.
|
|
1153
|
+
*/
|
|
1154
|
+
toAddress(): Address;
|
|
1032
1155
|
/**
|
|
1033
1156
|
* Get the left endian boolean array representation of the field element.
|
|
1034
1157
|
*/
|
|
1035
1158
|
toBitsLe(): Array<any>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Cast the field element to a Boolean (strict).
|
|
1161
|
+
* Returns an error if the field is not zero or one.
|
|
1162
|
+
*/
|
|
1163
|
+
toBoolean(): Boolean;
|
|
1036
1164
|
/**
|
|
1037
1165
|
* Creates a field object from a string representation of a field element.
|
|
1038
1166
|
*/
|
|
@@ -1041,18 +1169,78 @@ export class Field {
|
|
|
1041
1169
|
* Encode the field element as a Uint8Array of left endian bytes.
|
|
1042
1170
|
*/
|
|
1043
1171
|
toBytesLe(): Uint8Array;
|
|
1172
|
+
/**
|
|
1173
|
+
* Cast the field to an I8 with lossy truncation.
|
|
1174
|
+
*/
|
|
1175
|
+
toI8Lossy(): I8;
|
|
1176
|
+
/**
|
|
1177
|
+
* Cast the field to a U8 with lossy truncation.
|
|
1178
|
+
*/
|
|
1179
|
+
toU8Lossy(): U8;
|
|
1044
1180
|
/**
|
|
1045
1181
|
* Reconstruct a field element from a boolean array representation.
|
|
1046
1182
|
*/
|
|
1047
1183
|
static fromBitsLe(bits: Array<any>): Field;
|
|
1184
|
+
/**
|
|
1185
|
+
* Cast the field to an I16 with lossy truncation.
|
|
1186
|
+
*/
|
|
1187
|
+
toI16Lossy(): I16;
|
|
1188
|
+
/**
|
|
1189
|
+
* Cast the field to an I32 with lossy truncation.
|
|
1190
|
+
*/
|
|
1191
|
+
toI32Lossy(): I32;
|
|
1192
|
+
/**
|
|
1193
|
+
* Cast the field to an I64 with lossy truncation.
|
|
1194
|
+
*/
|
|
1195
|
+
toI64Lossy(): I64;
|
|
1048
1196
|
/**
|
|
1049
1197
|
* Create a plaintext from the field element.
|
|
1050
1198
|
*/
|
|
1051
1199
|
toPlaintext(): Plaintext;
|
|
1200
|
+
/**
|
|
1201
|
+
* Cast the field to a U16 with lossy truncation.
|
|
1202
|
+
*/
|
|
1203
|
+
toU16Lossy(): U16;
|
|
1204
|
+
/**
|
|
1205
|
+
* Cast the field to a U32 with lossy truncation.
|
|
1206
|
+
*/
|
|
1207
|
+
toU32Lossy(): U32;
|
|
1208
|
+
/**
|
|
1209
|
+
* Cast the field to a U64 with lossy truncation.
|
|
1210
|
+
*/
|
|
1211
|
+
toU64Lossy(): U64;
|
|
1052
1212
|
/**
|
|
1053
1213
|
* Create a field element from a Uint8Array of left endian bytes.
|
|
1054
1214
|
*/
|
|
1055
1215
|
static fromBytesLe(bytes: Uint8Array): Field;
|
|
1216
|
+
/**
|
|
1217
|
+
* Cast the field to an I128 with lossy truncation.
|
|
1218
|
+
*/
|
|
1219
|
+
toI128Lossy(): I128;
|
|
1220
|
+
/**
|
|
1221
|
+
* Cast the field to a U128 with lossy truncation.
|
|
1222
|
+
*/
|
|
1223
|
+
toU128Lossy(): U128;
|
|
1224
|
+
/**
|
|
1225
|
+
* Cast the field element to a Group element with lossy conversion.
|
|
1226
|
+
*
|
|
1227
|
+
* Uses the snarkVM cast_lossy path: tries x-coordinate recovery first,
|
|
1228
|
+
* falls back to the generator for field == 1, and applies Elligator-2
|
|
1229
|
+
* otherwise. This conversion never fails.
|
|
1230
|
+
*/
|
|
1231
|
+
toGroupLossy(): Group;
|
|
1232
|
+
/**
|
|
1233
|
+
* Cast the field element to a Scalar with lossy truncation.
|
|
1234
|
+
*/
|
|
1235
|
+
toScalarLossy(): Scalar;
|
|
1236
|
+
/**
|
|
1237
|
+
* Cast the field element to an Address with lossy conversion (via Group, Elligator-2 fallback).
|
|
1238
|
+
*/
|
|
1239
|
+
toAddressLossy(): Address;
|
|
1240
|
+
/**
|
|
1241
|
+
* Cast the field element to a Boolean with lossy truncation (extracts least-significant bit).
|
|
1242
|
+
*/
|
|
1243
|
+
toBooleanLossy(): Boolean;
|
|
1056
1244
|
/**
|
|
1057
1245
|
* Initializes a new field as a domain separator.
|
|
1058
1246
|
*/
|
|
@@ -1105,6 +1293,13 @@ export class Field {
|
|
|
1105
1293
|
* Subtract two field elements.
|
|
1106
1294
|
*/
|
|
1107
1295
|
subtract(other: Field): Field;
|
|
1296
|
+
/**
|
|
1297
|
+
* Cast the field element to a Group element (strict).
|
|
1298
|
+
*
|
|
1299
|
+
* Attempts to recover the group element from the field as an x-coordinate.
|
|
1300
|
+
* Returns an error if the field is not a valid x-coordinate on the curve.
|
|
1301
|
+
*/
|
|
1302
|
+
toGroup(): Group;
|
|
1108
1303
|
/**
|
|
1109
1304
|
* Returns the string representation of the field element.
|
|
1110
1305
|
*/
|
|
@@ -1156,6 +1351,10 @@ export class Group {
|
|
|
1156
1351
|
* Generate the group element from the x coordinate of the group.
|
|
1157
1352
|
*/
|
|
1158
1353
|
static fromField(field: Field): Group;
|
|
1354
|
+
/**
|
|
1355
|
+
* Cast the group element to an Address (lossless — Address wraps Group).
|
|
1356
|
+
*/
|
|
1357
|
+
toAddress(): Address;
|
|
1159
1358
|
/**
|
|
1160
1359
|
* Get the left endian boolean array representation of the group element.
|
|
1161
1360
|
*/
|
|
@@ -1168,26 +1367,74 @@ export class Group {
|
|
|
1168
1367
|
* Encode the group element as a Uint8Array of left endian bytes.
|
|
1169
1368
|
*/
|
|
1170
1369
|
toBytesLe(): Uint8Array;
|
|
1370
|
+
/**
|
|
1371
|
+
* Cast the group to an I8 with lossy truncation.
|
|
1372
|
+
*/
|
|
1373
|
+
toI8Lossy(): I8;
|
|
1374
|
+
/**
|
|
1375
|
+
* Cast the group to a U8 with lossy truncation.
|
|
1376
|
+
*/
|
|
1377
|
+
toU8Lossy(): U8;
|
|
1171
1378
|
/**
|
|
1172
1379
|
* Reconstruct a group element from a boolean array representation.
|
|
1173
1380
|
*/
|
|
1174
1381
|
static fromBitsLe(bits: Array<any>): Group;
|
|
1382
|
+
/**
|
|
1383
|
+
* Cast the group to an I16 with lossy truncation.
|
|
1384
|
+
*/
|
|
1385
|
+
toI16Lossy(): I16;
|
|
1386
|
+
/**
|
|
1387
|
+
* Cast the group to an I32 with lossy truncation.
|
|
1388
|
+
*/
|
|
1389
|
+
toI32Lossy(): I32;
|
|
1390
|
+
/**
|
|
1391
|
+
* Cast the group to an I64 with lossy truncation.
|
|
1392
|
+
*/
|
|
1393
|
+
toI64Lossy(): I64;
|
|
1175
1394
|
/**
|
|
1176
1395
|
* Create a plaintext element from a group element.
|
|
1177
1396
|
*/
|
|
1178
1397
|
toPlaintext(): Plaintext;
|
|
1398
|
+
/**
|
|
1399
|
+
* Cast the group to a U16 with lossy truncation.
|
|
1400
|
+
*/
|
|
1401
|
+
toU16Lossy(): U16;
|
|
1402
|
+
/**
|
|
1403
|
+
* Cast the group to a U32 with lossy truncation.
|
|
1404
|
+
*/
|
|
1405
|
+
toU32Lossy(): U32;
|
|
1406
|
+
/**
|
|
1407
|
+
* Cast the group to a U64 with lossy truncation.
|
|
1408
|
+
*/
|
|
1409
|
+
toU64Lossy(): U64;
|
|
1179
1410
|
/**
|
|
1180
1411
|
* Create a group element from a Uint8Array of left endian bytes.
|
|
1181
1412
|
*/
|
|
1182
1413
|
static fromBytesLe(bytes: Uint8Array): Group;
|
|
1414
|
+
/**
|
|
1415
|
+
* Cast the group to an I128 with lossy truncation.
|
|
1416
|
+
*/
|
|
1417
|
+
toI128Lossy(): I128;
|
|
1418
|
+
/**
|
|
1419
|
+
* Cast the group to a U128 with lossy truncation.
|
|
1420
|
+
*/
|
|
1421
|
+
toU128Lossy(): U128;
|
|
1183
1422
|
/**
|
|
1184
1423
|
* Multiply a group element by a scalar element.
|
|
1185
1424
|
*/
|
|
1186
1425
|
scalarMultiply(scalar: Scalar): Group;
|
|
1426
|
+
/**
|
|
1427
|
+
* Cast the group element to a Scalar with lossy truncation (via x-coordinate).
|
|
1428
|
+
*/
|
|
1429
|
+
toScalarLossy(): Scalar;
|
|
1187
1430
|
/**
|
|
1188
1431
|
* Get the x-coordinate of the group element.
|
|
1189
1432
|
*/
|
|
1190
1433
|
toXCoordinate(): Field;
|
|
1434
|
+
/**
|
|
1435
|
+
* Cast the group element to a Boolean with lossy truncation (LSB of x-coordinate).
|
|
1436
|
+
*/
|
|
1437
|
+
toBooleanLossy(): Boolean;
|
|
1191
1438
|
/**
|
|
1192
1439
|
* Generate the group element from a string representation of the x coordinate of the group.
|
|
1193
1440
|
*/
|
|
@@ -1225,6 +1472,11 @@ export class Group {
|
|
|
1225
1472
|
* Subtract two group elements (equivalently: add the inverse of an element).
|
|
1226
1473
|
*/
|
|
1227
1474
|
subtract(other: Group): Group;
|
|
1475
|
+
/**
|
|
1476
|
+
* Cast the group element to a Field (returns x-coordinate).
|
|
1477
|
+
* This is an alias for `toXCoordinate()`.
|
|
1478
|
+
*/
|
|
1479
|
+
toField(): Field;
|
|
1228
1480
|
/**
|
|
1229
1481
|
* Get the generator of the group.
|
|
1230
1482
|
*/
|
|
@@ -1290,18 +1542,66 @@ export class I128 {
|
|
|
1290
1542
|
* Construct an integer from a byte array representation.
|
|
1291
1543
|
*/
|
|
1292
1544
|
toBytesLe(): Uint8Array;
|
|
1545
|
+
/**
|
|
1546
|
+
* Cast to I8 with lossy truncation.
|
|
1547
|
+
*/
|
|
1548
|
+
toI8Lossy(): I8;
|
|
1549
|
+
/**
|
|
1550
|
+
* Cast to U8 with lossy truncation.
|
|
1551
|
+
*/
|
|
1552
|
+
toU8Lossy(): U8;
|
|
1293
1553
|
/**
|
|
1294
1554
|
* Construct an integer from a boolean array representation.
|
|
1295
1555
|
*/
|
|
1296
1556
|
static fromBitsLe(bits: Array<any>): I128;
|
|
1557
|
+
/**
|
|
1558
|
+
* Cast to I16 with lossy truncation.
|
|
1559
|
+
*/
|
|
1560
|
+
toI16Lossy(): I16;
|
|
1561
|
+
/**
|
|
1562
|
+
* Cast to I32 with lossy truncation.
|
|
1563
|
+
*/
|
|
1564
|
+
toI32Lossy(): I32;
|
|
1565
|
+
/**
|
|
1566
|
+
* Cast to I64 with lossy truncation.
|
|
1567
|
+
*/
|
|
1568
|
+
toI64Lossy(): I64;
|
|
1297
1569
|
/**
|
|
1298
1570
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
1299
1571
|
*/
|
|
1300
1572
|
toPlaintext(): Plaintext;
|
|
1573
|
+
/**
|
|
1574
|
+
* Cast to U16 with lossy truncation.
|
|
1575
|
+
*/
|
|
1576
|
+
toU16Lossy(): U16;
|
|
1577
|
+
/**
|
|
1578
|
+
* Cast to U32 with lossy truncation.
|
|
1579
|
+
*/
|
|
1580
|
+
toU32Lossy(): U32;
|
|
1581
|
+
/**
|
|
1582
|
+
* Cast to U64 with lossy truncation.
|
|
1583
|
+
*/
|
|
1584
|
+
toU64Lossy(): U64;
|
|
1301
1585
|
/**
|
|
1302
1586
|
* Get the byte array representation of the integer.
|
|
1303
1587
|
*/
|
|
1304
1588
|
static fromBytesLe(bytes: Uint8Array): I128;
|
|
1589
|
+
/**
|
|
1590
|
+
* Cast to I128 with lossy truncation.
|
|
1591
|
+
*/
|
|
1592
|
+
toI128Lossy(): I128;
|
|
1593
|
+
/**
|
|
1594
|
+
* Cast to U128 with lossy truncation.
|
|
1595
|
+
*/
|
|
1596
|
+
toU128Lossy(): U128;
|
|
1597
|
+
/**
|
|
1598
|
+
* Construct an integer from a field element with lossy truncation.
|
|
1599
|
+
*/
|
|
1600
|
+
static fromFieldLossy(field: Field): I128;
|
|
1601
|
+
/**
|
|
1602
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
1603
|
+
*/
|
|
1604
|
+
toBooleanLossy(): Boolean;
|
|
1305
1605
|
/**
|
|
1306
1606
|
* Negate the integer (e.g., 5 → -5).
|
|
1307
1607
|
*/
|
|
@@ -1330,6 +1630,10 @@ export class I128 {
|
|
|
1330
1630
|
* Exponentiate the integer with a u32 exponent.
|
|
1331
1631
|
*/
|
|
1332
1632
|
powU32(exponent: U32): I128;
|
|
1633
|
+
/**
|
|
1634
|
+
* Convert the integer to a Field element (lossless).
|
|
1635
|
+
*/
|
|
1636
|
+
toField(): Field;
|
|
1333
1637
|
/**
|
|
1334
1638
|
* Convert the integer to a Scalar value.
|
|
1335
1639
|
*/
|
|
@@ -1391,18 +1695,66 @@ export class I16 {
|
|
|
1391
1695
|
* Construct an integer from a byte array representation.
|
|
1392
1696
|
*/
|
|
1393
1697
|
toBytesLe(): Uint8Array;
|
|
1698
|
+
/**
|
|
1699
|
+
* Cast to I8 with lossy truncation.
|
|
1700
|
+
*/
|
|
1701
|
+
toI8Lossy(): I8;
|
|
1702
|
+
/**
|
|
1703
|
+
* Cast to U8 with lossy truncation.
|
|
1704
|
+
*/
|
|
1705
|
+
toU8Lossy(): U8;
|
|
1394
1706
|
/**
|
|
1395
1707
|
* Construct an integer from a boolean array representation.
|
|
1396
1708
|
*/
|
|
1397
1709
|
static fromBitsLe(bits: Array<any>): I16;
|
|
1710
|
+
/**
|
|
1711
|
+
* Cast to I16 with lossy truncation.
|
|
1712
|
+
*/
|
|
1713
|
+
toI16Lossy(): I16;
|
|
1714
|
+
/**
|
|
1715
|
+
* Cast to I32 with lossy truncation.
|
|
1716
|
+
*/
|
|
1717
|
+
toI32Lossy(): I32;
|
|
1718
|
+
/**
|
|
1719
|
+
* Cast to I64 with lossy truncation.
|
|
1720
|
+
*/
|
|
1721
|
+
toI64Lossy(): I64;
|
|
1398
1722
|
/**
|
|
1399
1723
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
1400
1724
|
*/
|
|
1401
1725
|
toPlaintext(): Plaintext;
|
|
1726
|
+
/**
|
|
1727
|
+
* Cast to U16 with lossy truncation.
|
|
1728
|
+
*/
|
|
1729
|
+
toU16Lossy(): U16;
|
|
1730
|
+
/**
|
|
1731
|
+
* Cast to U32 with lossy truncation.
|
|
1732
|
+
*/
|
|
1733
|
+
toU32Lossy(): U32;
|
|
1734
|
+
/**
|
|
1735
|
+
* Cast to U64 with lossy truncation.
|
|
1736
|
+
*/
|
|
1737
|
+
toU64Lossy(): U64;
|
|
1402
1738
|
/**
|
|
1403
1739
|
* Get the byte array representation of the integer.
|
|
1404
1740
|
*/
|
|
1405
1741
|
static fromBytesLe(bytes: Uint8Array): I16;
|
|
1742
|
+
/**
|
|
1743
|
+
* Cast to I128 with lossy truncation.
|
|
1744
|
+
*/
|
|
1745
|
+
toI128Lossy(): I128;
|
|
1746
|
+
/**
|
|
1747
|
+
* Cast to U128 with lossy truncation.
|
|
1748
|
+
*/
|
|
1749
|
+
toU128Lossy(): U128;
|
|
1750
|
+
/**
|
|
1751
|
+
* Construct an integer from a field element with lossy truncation.
|
|
1752
|
+
*/
|
|
1753
|
+
static fromFieldLossy(field: Field): I16;
|
|
1754
|
+
/**
|
|
1755
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
1756
|
+
*/
|
|
1757
|
+
toBooleanLossy(): Boolean;
|
|
1406
1758
|
/**
|
|
1407
1759
|
* Negate the integer (e.g., 5 → -5).
|
|
1408
1760
|
*/
|
|
@@ -1431,6 +1783,10 @@ export class I16 {
|
|
|
1431
1783
|
* Exponentiate the integer with a u32 exponent.
|
|
1432
1784
|
*/
|
|
1433
1785
|
powU32(exponent: U32): I16;
|
|
1786
|
+
/**
|
|
1787
|
+
* Convert the integer to a Field element (lossless).
|
|
1788
|
+
*/
|
|
1789
|
+
toField(): Field;
|
|
1434
1790
|
/**
|
|
1435
1791
|
* Convert the integer to a Scalar value.
|
|
1436
1792
|
*/
|
|
@@ -1492,18 +1848,66 @@ export class I32 {
|
|
|
1492
1848
|
* Construct an integer from a byte array representation.
|
|
1493
1849
|
*/
|
|
1494
1850
|
toBytesLe(): Uint8Array;
|
|
1851
|
+
/**
|
|
1852
|
+
* Cast to I8 with lossy truncation.
|
|
1853
|
+
*/
|
|
1854
|
+
toI8Lossy(): I8;
|
|
1855
|
+
/**
|
|
1856
|
+
* Cast to U8 with lossy truncation.
|
|
1857
|
+
*/
|
|
1858
|
+
toU8Lossy(): U8;
|
|
1495
1859
|
/**
|
|
1496
1860
|
* Construct an integer from a boolean array representation.
|
|
1497
1861
|
*/
|
|
1498
1862
|
static fromBitsLe(bits: Array<any>): I32;
|
|
1863
|
+
/**
|
|
1864
|
+
* Cast to I16 with lossy truncation.
|
|
1865
|
+
*/
|
|
1866
|
+
toI16Lossy(): I16;
|
|
1867
|
+
/**
|
|
1868
|
+
* Cast to I32 with lossy truncation.
|
|
1869
|
+
*/
|
|
1870
|
+
toI32Lossy(): I32;
|
|
1871
|
+
/**
|
|
1872
|
+
* Cast to I64 with lossy truncation.
|
|
1873
|
+
*/
|
|
1874
|
+
toI64Lossy(): I64;
|
|
1499
1875
|
/**
|
|
1500
1876
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
1501
1877
|
*/
|
|
1502
1878
|
toPlaintext(): Plaintext;
|
|
1879
|
+
/**
|
|
1880
|
+
* Cast to U16 with lossy truncation.
|
|
1881
|
+
*/
|
|
1882
|
+
toU16Lossy(): U16;
|
|
1883
|
+
/**
|
|
1884
|
+
* Cast to U32 with lossy truncation.
|
|
1885
|
+
*/
|
|
1886
|
+
toU32Lossy(): U32;
|
|
1887
|
+
/**
|
|
1888
|
+
* Cast to U64 with lossy truncation.
|
|
1889
|
+
*/
|
|
1890
|
+
toU64Lossy(): U64;
|
|
1503
1891
|
/**
|
|
1504
1892
|
* Get the byte array representation of the integer.
|
|
1505
1893
|
*/
|
|
1506
1894
|
static fromBytesLe(bytes: Uint8Array): I32;
|
|
1895
|
+
/**
|
|
1896
|
+
* Cast to I128 with lossy truncation.
|
|
1897
|
+
*/
|
|
1898
|
+
toI128Lossy(): I128;
|
|
1899
|
+
/**
|
|
1900
|
+
* Cast to U128 with lossy truncation.
|
|
1901
|
+
*/
|
|
1902
|
+
toU128Lossy(): U128;
|
|
1903
|
+
/**
|
|
1904
|
+
* Construct an integer from a field element with lossy truncation.
|
|
1905
|
+
*/
|
|
1906
|
+
static fromFieldLossy(field: Field): I32;
|
|
1907
|
+
/**
|
|
1908
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
1909
|
+
*/
|
|
1910
|
+
toBooleanLossy(): Boolean;
|
|
1507
1911
|
/**
|
|
1508
1912
|
* Negate the integer (e.g., 5 → -5).
|
|
1509
1913
|
*/
|
|
@@ -1532,6 +1936,10 @@ export class I32 {
|
|
|
1532
1936
|
* Exponentiate the integer with a u32 exponent.
|
|
1533
1937
|
*/
|
|
1534
1938
|
powU32(exponent: U32): I32;
|
|
1939
|
+
/**
|
|
1940
|
+
* Convert the integer to a Field element (lossless).
|
|
1941
|
+
*/
|
|
1942
|
+
toField(): Field;
|
|
1535
1943
|
/**
|
|
1536
1944
|
* Convert the integer to a Scalar value.
|
|
1537
1945
|
*/
|
|
@@ -1593,18 +2001,66 @@ export class I64 {
|
|
|
1593
2001
|
* Construct an integer from a byte array representation.
|
|
1594
2002
|
*/
|
|
1595
2003
|
toBytesLe(): Uint8Array;
|
|
2004
|
+
/**
|
|
2005
|
+
* Cast to I8 with lossy truncation.
|
|
2006
|
+
*/
|
|
2007
|
+
toI8Lossy(): I8;
|
|
2008
|
+
/**
|
|
2009
|
+
* Cast to U8 with lossy truncation.
|
|
2010
|
+
*/
|
|
2011
|
+
toU8Lossy(): U8;
|
|
1596
2012
|
/**
|
|
1597
2013
|
* Construct an integer from a boolean array representation.
|
|
1598
2014
|
*/
|
|
1599
2015
|
static fromBitsLe(bits: Array<any>): I64;
|
|
2016
|
+
/**
|
|
2017
|
+
* Cast to I16 with lossy truncation.
|
|
2018
|
+
*/
|
|
2019
|
+
toI16Lossy(): I16;
|
|
2020
|
+
/**
|
|
2021
|
+
* Cast to I32 with lossy truncation.
|
|
2022
|
+
*/
|
|
2023
|
+
toI32Lossy(): I32;
|
|
2024
|
+
/**
|
|
2025
|
+
* Cast to I64 with lossy truncation.
|
|
2026
|
+
*/
|
|
2027
|
+
toI64Lossy(): I64;
|
|
1600
2028
|
/**
|
|
1601
2029
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
1602
2030
|
*/
|
|
1603
2031
|
toPlaintext(): Plaintext;
|
|
2032
|
+
/**
|
|
2033
|
+
* Cast to U16 with lossy truncation.
|
|
2034
|
+
*/
|
|
2035
|
+
toU16Lossy(): U16;
|
|
2036
|
+
/**
|
|
2037
|
+
* Cast to U32 with lossy truncation.
|
|
2038
|
+
*/
|
|
2039
|
+
toU32Lossy(): U32;
|
|
2040
|
+
/**
|
|
2041
|
+
* Cast to U64 with lossy truncation.
|
|
2042
|
+
*/
|
|
2043
|
+
toU64Lossy(): U64;
|
|
1604
2044
|
/**
|
|
1605
2045
|
* Get the byte array representation of the integer.
|
|
1606
2046
|
*/
|
|
1607
2047
|
static fromBytesLe(bytes: Uint8Array): I64;
|
|
2048
|
+
/**
|
|
2049
|
+
* Cast to I128 with lossy truncation.
|
|
2050
|
+
*/
|
|
2051
|
+
toI128Lossy(): I128;
|
|
2052
|
+
/**
|
|
2053
|
+
* Cast to U128 with lossy truncation.
|
|
2054
|
+
*/
|
|
2055
|
+
toU128Lossy(): U128;
|
|
2056
|
+
/**
|
|
2057
|
+
* Construct an integer from a field element with lossy truncation.
|
|
2058
|
+
*/
|
|
2059
|
+
static fromFieldLossy(field: Field): I64;
|
|
2060
|
+
/**
|
|
2061
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
2062
|
+
*/
|
|
2063
|
+
toBooleanLossy(): Boolean;
|
|
1608
2064
|
/**
|
|
1609
2065
|
* Negate the integer (e.g., 5 → -5).
|
|
1610
2066
|
*/
|
|
@@ -1633,6 +2089,10 @@ export class I64 {
|
|
|
1633
2089
|
* Exponentiate the integer with a u32 exponent.
|
|
1634
2090
|
*/
|
|
1635
2091
|
powU32(exponent: U32): I64;
|
|
2092
|
+
/**
|
|
2093
|
+
* Convert the integer to a Field element (lossless).
|
|
2094
|
+
*/
|
|
2095
|
+
toField(): Field;
|
|
1636
2096
|
/**
|
|
1637
2097
|
* Convert the integer to a Scalar value.
|
|
1638
2098
|
*/
|
|
@@ -1691,21 +2151,69 @@ export class I8 {
|
|
|
1691
2151
|
*/
|
|
1692
2152
|
subWrapped(other: I8): I8;
|
|
1693
2153
|
/**
|
|
1694
|
-
* Construct an integer from a byte array representation.
|
|
2154
|
+
* Construct an integer from a byte array representation.
|
|
2155
|
+
*/
|
|
2156
|
+
toBytesLe(): Uint8Array;
|
|
2157
|
+
/**
|
|
2158
|
+
* Cast to I8 with lossy truncation.
|
|
2159
|
+
*/
|
|
2160
|
+
toI8Lossy(): I8;
|
|
2161
|
+
/**
|
|
2162
|
+
* Cast to U8 with lossy truncation.
|
|
2163
|
+
*/
|
|
2164
|
+
toU8Lossy(): U8;
|
|
2165
|
+
/**
|
|
2166
|
+
* Construct an integer from a boolean array representation.
|
|
2167
|
+
*/
|
|
2168
|
+
static fromBitsLe(bits: Array<any>): I8;
|
|
2169
|
+
/**
|
|
2170
|
+
* Cast to I16 with lossy truncation.
|
|
2171
|
+
*/
|
|
2172
|
+
toI16Lossy(): I16;
|
|
2173
|
+
/**
|
|
2174
|
+
* Cast to I32 with lossy truncation.
|
|
2175
|
+
*/
|
|
2176
|
+
toI32Lossy(): I32;
|
|
2177
|
+
/**
|
|
2178
|
+
* Cast to I64 with lossy truncation.
|
|
2179
|
+
*/
|
|
2180
|
+
toI64Lossy(): I64;
|
|
2181
|
+
/**
|
|
2182
|
+
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
2183
|
+
*/
|
|
2184
|
+
toPlaintext(): Plaintext;
|
|
2185
|
+
/**
|
|
2186
|
+
* Cast to U16 with lossy truncation.
|
|
2187
|
+
*/
|
|
2188
|
+
toU16Lossy(): U16;
|
|
2189
|
+
/**
|
|
2190
|
+
* Cast to U32 with lossy truncation.
|
|
2191
|
+
*/
|
|
2192
|
+
toU32Lossy(): U32;
|
|
2193
|
+
/**
|
|
2194
|
+
* Cast to U64 with lossy truncation.
|
|
2195
|
+
*/
|
|
2196
|
+
toU64Lossy(): U64;
|
|
2197
|
+
/**
|
|
2198
|
+
* Get the byte array representation of the integer.
|
|
2199
|
+
*/
|
|
2200
|
+
static fromBytesLe(bytes: Uint8Array): I8;
|
|
2201
|
+
/**
|
|
2202
|
+
* Cast to I128 with lossy truncation.
|
|
1695
2203
|
*/
|
|
1696
|
-
|
|
2204
|
+
toI128Lossy(): I128;
|
|
1697
2205
|
/**
|
|
1698
|
-
*
|
|
2206
|
+
* Cast to U128 with lossy truncation.
|
|
1699
2207
|
*/
|
|
1700
|
-
|
|
2208
|
+
toU128Lossy(): U128;
|
|
1701
2209
|
/**
|
|
1702
|
-
*
|
|
2210
|
+
* Construct an integer from a field element with lossy truncation.
|
|
1703
2211
|
*/
|
|
1704
|
-
|
|
2212
|
+
static fromFieldLossy(field: Field): I8;
|
|
1705
2213
|
/**
|
|
1706
|
-
*
|
|
2214
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
1707
2215
|
*/
|
|
1708
|
-
|
|
2216
|
+
toBooleanLossy(): Boolean;
|
|
1709
2217
|
/**
|
|
1710
2218
|
* Negate the integer (e.g., 5 → -5).
|
|
1711
2219
|
*/
|
|
@@ -1734,6 +2242,10 @@ export class I8 {
|
|
|
1734
2242
|
* Exponentiate the integer with a u32 exponent.
|
|
1735
2243
|
*/
|
|
1736
2244
|
powU32(exponent: U32): I8;
|
|
2245
|
+
/**
|
|
2246
|
+
* Convert the integer to a Field element (lossless).
|
|
2247
|
+
*/
|
|
2248
|
+
toField(): Field;
|
|
1737
2249
|
/**
|
|
1738
2250
|
* Convert the integer to a Scalar value.
|
|
1739
2251
|
*/
|
|
@@ -2500,6 +3012,198 @@ export class Program {
|
|
|
2500
3012
|
*/
|
|
2501
3013
|
toString(): string;
|
|
2502
3014
|
}
|
|
3015
|
+
/**
|
|
3016
|
+
* Backed by `Rc<RefCell<>>` for interior mutability — cloning produces a cheap
|
|
3017
|
+
* reference-counted copy that shares the same underlying data. This allows
|
|
3018
|
+
* execution functions to clone the builder internally while the caller's
|
|
3019
|
+
* original reference automatically sees any mutations (e.g. synthesized keys).
|
|
3020
|
+
*/
|
|
3021
|
+
export class ProgramImports {
|
|
3022
|
+
free(): void;
|
|
3023
|
+
[Symbol.dispose](): void;
|
|
3024
|
+
/**
|
|
3025
|
+
* Add a program's source code to the imports.
|
|
3026
|
+
*
|
|
3027
|
+
* The source is parsed, validated, and added to the internal Process.
|
|
3028
|
+
* Static imports of the program are resolved depth-first from programs
|
|
3029
|
+
* already present in this builder.
|
|
3030
|
+
*
|
|
3031
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
3032
|
+
* @param {string} source The program source code.
|
|
3033
|
+
* @param {number | undefined} edition The program edition (defaults to 1).
|
|
3034
|
+
*/
|
|
3035
|
+
addProgram(name: string, source: string, edition?: number | null): void;
|
|
3036
|
+
/**
|
|
3037
|
+
* Create a ProgramImports from a plain JavaScript object.
|
|
3038
|
+
*
|
|
3039
|
+
* Accepts three formats:
|
|
3040
|
+
* ```js
|
|
3041
|
+
* // 1. Plain string — source code only.
|
|
3042
|
+
* { "my_program.aleo": "program source..." }
|
|
3043
|
+
*
|
|
3044
|
+
* // 2. Structured — program source with optional edition.
|
|
3045
|
+
* { "my_program.aleo": { program: "program source..." } }
|
|
3046
|
+
*
|
|
3047
|
+
* // 3. Structured with keys — program source plus proving/verifying keys per function.
|
|
3048
|
+
* {
|
|
3049
|
+
* "my_program.aleo": {
|
|
3050
|
+
* program: "program source...",
|
|
3051
|
+
* keys: {
|
|
3052
|
+
* "my_function": {
|
|
3053
|
+
* provingKey: Uint8Array,
|
|
3054
|
+
* verifyingKey: Uint8Array
|
|
3055
|
+
* }
|
|
3056
|
+
* }
|
|
3057
|
+
* }
|
|
3058
|
+
* }
|
|
3059
|
+
* ```
|
|
3060
|
+
*
|
|
3061
|
+
* Programs created via this method default to edition 1.
|
|
3062
|
+
*
|
|
3063
|
+
* @param {Object} object A plain JavaScript object mapping program names to source code
|
|
3064
|
+
* and optional keys.
|
|
3065
|
+
* @returns {ProgramImports}
|
|
3066
|
+
*/
|
|
3067
|
+
static fromObject(object: object): ProgramImports;
|
|
3068
|
+
/**
|
|
3069
|
+
* Return the source code of a program by name, without serializing keys.
|
|
3070
|
+
*
|
|
3071
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
3072
|
+
* @returns {string | undefined}
|
|
3073
|
+
*/
|
|
3074
|
+
getProgram(name: string): string | undefined;
|
|
3075
|
+
/**
|
|
3076
|
+
* Return the names of all programs in this builder as a JS `Array<string>`.
|
|
3077
|
+
*
|
|
3078
|
+
* This is a lightweight alternative to `toObject()` when you only need to
|
|
3079
|
+
* enumerate program names without serializing keys.
|
|
3080
|
+
*
|
|
3081
|
+
* @returns {Array<string>}
|
|
3082
|
+
*/
|
|
3083
|
+
programNames(): Array<any>;
|
|
3084
|
+
/**
|
|
3085
|
+
* Add a proving key for a function or record within an imported program.
|
|
3086
|
+
*
|
|
3087
|
+
* The key is transferred directly from the WASM `ProvingKey` type with no
|
|
3088
|
+
* serialization overhead.
|
|
3089
|
+
*
|
|
3090
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3091
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3092
|
+
* @param {ProvingKey} key The proving key.
|
|
3093
|
+
*/
|
|
3094
|
+
addProvingKey(program_name: string, identifier: string, key: ProvingKey): void;
|
|
3095
|
+
/**
|
|
3096
|
+
* Get a proving key for a specific program and identifier (function or record name).
|
|
3097
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
3098
|
+
* remains available for future calls.
|
|
3099
|
+
*
|
|
3100
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3101
|
+
* @param {string} identifier The function or record name.
|
|
3102
|
+
* @returns {ProvingKey | undefined}
|
|
3103
|
+
*/
|
|
3104
|
+
getProvingKey(program_name: string, identifier: string): ProvingKey | undefined;
|
|
3105
|
+
/**
|
|
3106
|
+
* Add a verifying key for a function or record within an imported program.
|
|
3107
|
+
*
|
|
3108
|
+
* The key is transferred directly from the WASM `VerifyingKey` type with no
|
|
3109
|
+
* serialization overhead.
|
|
3110
|
+
*
|
|
3111
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3112
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3113
|
+
* @param {VerifyingKey} key The verifying key.
|
|
3114
|
+
*/
|
|
3115
|
+
addVerifyingKey(program_name: string, identifier: string, key: VerifyingKey): void;
|
|
3116
|
+
/**
|
|
3117
|
+
* Get a verifying key for a specific program and identifier (function or record name).
|
|
3118
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
3119
|
+
* remains available for future calls.
|
|
3120
|
+
*
|
|
3121
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3122
|
+
* @param {string} identifier The function or record name.
|
|
3123
|
+
* @returns {VerifyingKey | undefined}
|
|
3124
|
+
*/
|
|
3125
|
+
getVerifyingKey(program_name: string, identifier: string): VerifyingKey | undefined;
|
|
3126
|
+
/**
|
|
3127
|
+
* Add a proving key from its byte representation.
|
|
3128
|
+
*
|
|
3129
|
+
* Deserializes the bytes into a native proving key and stores it. The program
|
|
3130
|
+
* must already have been added via `addProgram`.
|
|
3131
|
+
*
|
|
3132
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3133
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3134
|
+
* @param {Uint8Array} bytes The proving key bytes.
|
|
3135
|
+
*/
|
|
3136
|
+
addProvingKeyBytes(program_name: string, identifier: string, bytes: Uint8Array): void;
|
|
3137
|
+
/**
|
|
3138
|
+
* Add a verifying key from its byte representation.
|
|
3139
|
+
*
|
|
3140
|
+
* Deserializes the bytes into a native verifying key and stores it. The program
|
|
3141
|
+
* must already have been added via `addProgram`.
|
|
3142
|
+
*
|
|
3143
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3144
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3145
|
+
* @param {Uint8Array} bytes The verifying key bytes.
|
|
3146
|
+
*/
|
|
3147
|
+
addVerifyingKeyBytes(program_name: string, identifier: string, bytes: Uint8Array): void;
|
|
3148
|
+
/**
|
|
3149
|
+
* Return the names of functions that have both a proving key and a verifying key
|
|
3150
|
+
* stored for the given program.
|
|
3151
|
+
*
|
|
3152
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3153
|
+
* @returns {Array<string>}
|
|
3154
|
+
*/
|
|
3155
|
+
functionKeysAvailable(program_name: string): Array<any>;
|
|
3156
|
+
/**
|
|
3157
|
+
* Create a new empty ProgramImports builder.
|
|
3158
|
+
*
|
|
3159
|
+
* Initializes an internal snarkVM Process. This is the same cost as a
|
|
3160
|
+
* single execution call, but is paid once and reused across all operations.
|
|
3161
|
+
*/
|
|
3162
|
+
constructor();
|
|
3163
|
+
/**
|
|
3164
|
+
* Create a cheap clone that shares the same underlying data.
|
|
3165
|
+
*
|
|
3166
|
+
* Useful for passing to WASM execution functions which consume ownership:
|
|
3167
|
+
* the caller keeps the original, and both copies see any mutations
|
|
3168
|
+
* (e.g. synthesized keys) through the shared interior state.
|
|
3169
|
+
*/
|
|
3170
|
+
clone(): ProgramImports;
|
|
3171
|
+
/**
|
|
3172
|
+
* Check whether a specific program has been added.
|
|
3173
|
+
*
|
|
3174
|
+
* @param {string} name The program name.
|
|
3175
|
+
* @returns {boolean}
|
|
3176
|
+
*/
|
|
3177
|
+
contains(name: string): boolean;
|
|
3178
|
+
/**
|
|
3179
|
+
* Check whether any programs have been added to this builder.
|
|
3180
|
+
*
|
|
3181
|
+
* @returns {boolean}
|
|
3182
|
+
*/
|
|
3183
|
+
isEmpty(): boolean;
|
|
3184
|
+
/**
|
|
3185
|
+
* Convert this ProgramImports to a plain JavaScript object.
|
|
3186
|
+
*
|
|
3187
|
+
* Entries without keys use the simple `{ "name.aleo": "source" }` format.
|
|
3188
|
+
* Entries with keys use the structured format:
|
|
3189
|
+
* ```js
|
|
3190
|
+
* {
|
|
3191
|
+
* "name.aleo": {
|
|
3192
|
+
* program: "program source...",
|
|
3193
|
+
* keys: {
|
|
3194
|
+
* "function_name": {
|
|
3195
|
+
* provingKey: Uint8Array,
|
|
3196
|
+
* verifyingKey: Uint8Array
|
|
3197
|
+
* }
|
|
3198
|
+
* }
|
|
3199
|
+
* }
|
|
3200
|
+
* }
|
|
3201
|
+
* ```
|
|
3202
|
+
*
|
|
3203
|
+
* @returns {Object}
|
|
3204
|
+
*/
|
|
3205
|
+
toObject(): object;
|
|
3206
|
+
}
|
|
2503
3207
|
export class ProgramManager {
|
|
2504
3208
|
private constructor();
|
|
2505
3209
|
free(): void;
|
|
@@ -2512,7 +3216,7 @@ export class ProgramManager {
|
|
|
2512
3216
|
* @param {Array} inputs The inputs to the function
|
|
2513
3217
|
* @param {Object | undefined} imports The imports for the program
|
|
2514
3218
|
*/
|
|
2515
|
-
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<KeyPair>;
|
|
3219
|
+
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<KeyPair>;
|
|
2516
3220
|
static loadInclusionProver(proving_key: ProvingKey): void;
|
|
2517
3221
|
/**
|
|
2518
3222
|
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
@@ -2531,7 +3235,7 @@ export class ProgramManager {
|
|
|
2531
3235
|
* @param broadcast (optional) Flag to indicate if the transaction should be broadcast
|
|
2532
3236
|
* @returns {Authorization}
|
|
2533
3237
|
*/
|
|
2534
|
-
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean): Promise<ProvingRequest>;
|
|
3238
|
+
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean, program_imports?: ProgramImports | null): Promise<ProvingRequest>;
|
|
2535
3239
|
/**
|
|
2536
3240
|
* Build a proving request from a `Request` object. By default this method currently uses the feemaster.
|
|
2537
3241
|
*
|
|
@@ -2543,7 +3247,7 @@ export class ProgramManager {
|
|
|
2543
3247
|
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2544
3248
|
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
2545
3249
|
*/
|
|
2546
|
-
static buildProvingRequestFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, broadcast: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<ProvingRequest>;
|
|
3250
|
+
static buildProvingRequestFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, broadcast: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null, program_imports?: ProgramImports | null): Promise<ProvingRequest>;
|
|
2547
3251
|
/**
|
|
2548
3252
|
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
2549
3253
|
* of the credits of the two original records
|
|
@@ -2594,7 +3298,7 @@ export class ProgramManager {
|
|
|
2594
3298
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2595
3299
|
* @returns {Transaction}
|
|
2596
3300
|
*/
|
|
2597
|
-
static buildDevnodeDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null): Promise<Transaction>;
|
|
3301
|
+
static buildDevnodeDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2598
3302
|
/**
|
|
2599
3303
|
* Upgrade a deployed Aleo program without synthesizing keys and generating certificates.
|
|
2600
3304
|
* Intended for use with Leo Devnode.
|
|
@@ -2615,7 +3319,7 @@ export class ProgramManager {
|
|
|
2615
3319
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2616
3320
|
* @returns {Transaction}
|
|
2617
3321
|
*/
|
|
2618
|
-
static buildDevnodeUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null): Promise<Transaction>;
|
|
3322
|
+
static buildDevnodeUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2619
3323
|
/**
|
|
2620
3324
|
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
2621
3325
|
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
@@ -2638,7 +3342,7 @@ export class ProgramManager {
|
|
|
2638
3342
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2639
3343
|
* @returns {u64}
|
|
2640
3344
|
*/
|
|
2641
|
-
static estimateDeploymentFee(program: string, imports?: object | null): Promise<bigint>;
|
|
3345
|
+
static estimateDeploymentFee(program: string, imports?: object | null, program_imports?: ProgramImports | null): Promise<bigint>;
|
|
2642
3346
|
/**
|
|
2643
3347
|
* Deploy an Aleo program
|
|
2644
3348
|
*
|
|
@@ -2658,7 +3362,7 @@ export class ProgramManager {
|
|
|
2658
3362
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2659
3363
|
* @returns {Transaction}
|
|
2660
3364
|
*/
|
|
2661
|
-
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>;
|
|
3365
|
+
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, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2662
3366
|
/**
|
|
2663
3367
|
* Upgrade an Aleo program
|
|
2664
3368
|
*
|
|
@@ -2676,7 +3380,7 @@ export class ProgramManager {
|
|
|
2676
3380
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2677
3381
|
* @returns {Transaction}
|
|
2678
3382
|
*/
|
|
2679
|
-
static buildUpgradeTransaction(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>;
|
|
3383
|
+
static buildUpgradeTransaction(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, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2680
3384
|
/**
|
|
2681
3385
|
* Generate an execution transaction without a proof.
|
|
2682
3386
|
* Intended for use with the Leo devnode tool.
|
|
@@ -2688,22 +3392,13 @@ export class ProgramManager {
|
|
|
2688
3392
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2689
3393
|
* @param fee_record The record to spend the fee from
|
|
2690
3394
|
* @param url The url of the Aleo network node to send the transaction to
|
|
2691
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
2692
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
2693
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
2694
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
2695
3395
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
2696
3396
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
2697
3397
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2698
|
-
* @param
|
|
2699
|
-
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2700
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2701
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2702
|
-
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
2703
|
-
* @param edition The edition of the program to execute. Defaults to the latest found on the network, or 1 if the program does not exist on the network.
|
|
3398
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
2704
3399
|
* @returns {Transaction}
|
|
2705
3400
|
*/
|
|
2706
|
-
static buildDevnodeExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, edition?: number | null): Promise<Transaction>;
|
|
3401
|
+
static buildDevnodeExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2707
3402
|
/**
|
|
2708
3403
|
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
2709
3404
|
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
@@ -2725,22 +3420,21 @@ export class ProgramManager {
|
|
|
2725
3420
|
* @param imports The imports of the program being executed.
|
|
2726
3421
|
* @param url The url to get the inclusion proving information from.
|
|
2727
3422
|
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
3423
|
+
* @param edition The program edition (defaults to 1).
|
|
2728
3424
|
*/
|
|
2729
|
-
static executeAuthorization(authorization: Authorization, fee_authorization: Authorization | null | undefined, program: string, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, imports?: object | null, url?: string | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
3425
|
+
static executeAuthorization(authorization: Authorization, fee_authorization: Authorization | null | undefined, program: string, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, imports?: object | null, url?: string | null, offline_query?: OfflineQuery | null, program_imports?: ProgramImports | null, edition?: number | null): Promise<Transaction>;
|
|
2730
3426
|
/**
|
|
2731
|
-
* Estimate Fee for Aleo function execution.
|
|
2732
|
-
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
2733
|
-
* program executions.
|
|
3427
|
+
* Estimate Fee for Aleo function execution.
|
|
2734
3428
|
*
|
|
2735
3429
|
* @param program The source code of the program to estimate the execution fee for.
|
|
2736
3430
|
* @param function The name of the function to estimate the execution fee for.
|
|
2737
3431
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
2738
3432
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
2739
3433
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2740
|
-
* @param edition
|
|
3434
|
+
* @param edition The edition of the program. Defaults to 1.
|
|
2741
3435
|
* @returns {u64} Fee in microcredits
|
|
2742
3436
|
*/
|
|
2743
|
-
static estimateExecutionFee(program: string, _function: string, imports?: object | null, edition?: number | null): bigint;
|
|
3437
|
+
static estimateExecutionFee(program: string, _function: string, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): bigint;
|
|
2744
3438
|
/**
|
|
2745
3439
|
* Execute an arbitrary function locally
|
|
2746
3440
|
*
|
|
@@ -2758,10 +3452,10 @@ export class ProgramManager {
|
|
|
2758
3452
|
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
2759
3453
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
2760
3454
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2761
|
-
* @param {ProvingKey | undefined} proving_key (optional) Provide a
|
|
3455
|
+
* @param {ProvingKey | undefined} proving_key (optional) Provide a proving key to use for the function execution
|
|
2762
3456
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2763
3457
|
*/
|
|
2764
|
-
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, offline_query?: OfflineQuery | null, edition?: number | null): Promise<ExecutionResponse>;
|
|
3458
|
+
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, offline_query?: OfflineQuery | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<ExecutionResponse>;
|
|
2765
3459
|
/**
|
|
2766
3460
|
* Estimate Fee for an Authorization.
|
|
2767
3461
|
*
|
|
@@ -2775,7 +3469,7 @@ export class ProgramManager {
|
|
|
2775
3469
|
* @param edition: Optional edition to estimate the fee for.
|
|
2776
3470
|
* @returns {u64} Fee in microcredits
|
|
2777
3471
|
*/
|
|
2778
|
-
static estimateFeeForAuthorization(authorization: Authorization, program: string, imports?: object | null, edition?: number | null): bigint;
|
|
3472
|
+
static estimateFeeForAuthorization(authorization: Authorization, program: string, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): bigint;
|
|
2779
3473
|
/**
|
|
2780
3474
|
* Execute Aleo function and create an Aleo execution transaction
|
|
2781
3475
|
*
|
|
@@ -2786,22 +3480,18 @@ export class ProgramManager {
|
|
|
2786
3480
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2787
3481
|
* @param fee_record The record to spend the fee from
|
|
2788
3482
|
* @param url The url of the Aleo network node to send the transaction to
|
|
2789
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
2790
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
2791
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
2792
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
2793
3483
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
2794
3484
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
2795
3485
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2796
|
-
* @param proving_key (optional) Provide a
|
|
3486
|
+
* @param proving_key (optional) Provide a proving key to use for the function execution
|
|
2797
3487
|
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2798
3488
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2799
3489
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2800
3490
|
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
2801
|
-
* @param edition The edition of the program to execute. Defaults to
|
|
3491
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
2802
3492
|
* @returns {Transaction}
|
|
2803
3493
|
*/
|
|
2804
|
-
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, edition?: number | null): Promise<Transaction>;
|
|
3494
|
+
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, edition?: number | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
2805
3495
|
/**
|
|
2806
3496
|
* Send credits from one Aleo account to another
|
|
2807
3497
|
*
|
|
@@ -2843,7 +3533,7 @@ export class ProgramManager {
|
|
|
2843
3533
|
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2844
3534
|
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
2845
3535
|
*/
|
|
2846
|
-
static buildAuthorizationFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<Authorization>;
|
|
3536
|
+
static buildAuthorizationFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
2847
3537
|
/**
|
|
2848
3538
|
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
2849
3539
|
* fast delegated proving is needed.
|
|
@@ -2854,7 +3544,7 @@ export class ProgramManager {
|
|
|
2854
3544
|
* @param inputs A javascript array of inputs to the function.
|
|
2855
3545
|
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2856
3546
|
*/
|
|
2857
|
-
static buildAuthorizationUnchecked(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<Authorization>;
|
|
3547
|
+
static buildAuthorizationUnchecked(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
2858
3548
|
/**
|
|
2859
3549
|
* Create an execution `Authorization` for a given program:function tuple with specified inputs.
|
|
2860
3550
|
*
|
|
@@ -2864,7 +3554,7 @@ export class ProgramManager {
|
|
|
2864
3554
|
* @param inputs A javascript array of inputs to the function.
|
|
2865
3555
|
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2866
3556
|
*/
|
|
2867
|
-
static authorize(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<Authorization>;
|
|
3557
|
+
static authorize(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
2868
3558
|
}
|
|
2869
3559
|
/**
|
|
2870
3560
|
* SNARK proof for verification of program execution
|
|
@@ -3427,10 +4117,20 @@ export class Scalar {
|
|
|
3427
4117
|
private constructor();
|
|
3428
4118
|
free(): void;
|
|
3429
4119
|
[Symbol.dispose](): void;
|
|
4120
|
+
/**
|
|
4121
|
+
* Cast the scalar to an Address (strict, via Field x-coordinate recovery).
|
|
4122
|
+
* Returns an error if the resulting field is not a valid x-coordinate on the curve.
|
|
4123
|
+
*/
|
|
4124
|
+
toAddress(): Address;
|
|
3430
4125
|
/**
|
|
3431
4126
|
* Get the left endian boolean array representation of the scalar element.
|
|
3432
4127
|
*/
|
|
3433
4128
|
toBitsLe(): Array<any>;
|
|
4129
|
+
/**
|
|
4130
|
+
* Cast the scalar to a Boolean (strict).
|
|
4131
|
+
* Returns an error if the scalar is not zero or one.
|
|
4132
|
+
*/
|
|
4133
|
+
toBoolean(): Boolean;
|
|
3434
4134
|
/**
|
|
3435
4135
|
* Creates a scalar object from a string representation of a scalar element.
|
|
3436
4136
|
*/
|
|
@@ -3439,18 +4139,70 @@ export class Scalar {
|
|
|
3439
4139
|
* Encode the scalar element as a Uint8Array of left endian bytes.
|
|
3440
4140
|
*/
|
|
3441
4141
|
toBytesLe(): Uint8Array;
|
|
4142
|
+
/**
|
|
4143
|
+
* Cast the scalar to an I8 with lossy truncation.
|
|
4144
|
+
*/
|
|
4145
|
+
toI8Lossy(): I8;
|
|
4146
|
+
/**
|
|
4147
|
+
* Cast the scalar to a U8 with lossy truncation.
|
|
4148
|
+
*/
|
|
4149
|
+
toU8Lossy(): U8;
|
|
3442
4150
|
/**
|
|
3443
4151
|
* Reconstruct a scalar element from a boolean array representation.
|
|
3444
4152
|
*/
|
|
3445
4153
|
static fromBitsLe(bits: Array<any>): Scalar;
|
|
4154
|
+
/**
|
|
4155
|
+
* Cast the scalar to an I16 with lossy truncation.
|
|
4156
|
+
*/
|
|
4157
|
+
toI16Lossy(): I16;
|
|
4158
|
+
/**
|
|
4159
|
+
* Cast the scalar to an I32 with lossy truncation.
|
|
4160
|
+
*/
|
|
4161
|
+
toI32Lossy(): I32;
|
|
4162
|
+
/**
|
|
4163
|
+
* Cast the scalar to an I64 with lossy truncation.
|
|
4164
|
+
*/
|
|
4165
|
+
toI64Lossy(): I64;
|
|
3446
4166
|
/**
|
|
3447
4167
|
* Create a plaintext element from a scalar element.
|
|
3448
4168
|
*/
|
|
3449
4169
|
toPlaintext(): Plaintext;
|
|
4170
|
+
/**
|
|
4171
|
+
* Cast the scalar to a U16 with lossy truncation.
|
|
4172
|
+
*/
|
|
4173
|
+
toU16Lossy(): U16;
|
|
4174
|
+
/**
|
|
4175
|
+
* Cast the scalar to a U32 with lossy truncation.
|
|
4176
|
+
*/
|
|
4177
|
+
toU32Lossy(): U32;
|
|
4178
|
+
/**
|
|
4179
|
+
* Cast the scalar to a U64 with lossy truncation.
|
|
4180
|
+
*/
|
|
4181
|
+
toU64Lossy(): U64;
|
|
3450
4182
|
/**
|
|
3451
4183
|
* Create a scalar element from a Uint8Array of left endian bytes.
|
|
3452
4184
|
*/
|
|
3453
4185
|
static fromBytesLe(bytes: Uint8Array): Scalar;
|
|
4186
|
+
/**
|
|
4187
|
+
* Cast the scalar to an I128 with lossy truncation.
|
|
4188
|
+
*/
|
|
4189
|
+
toI128Lossy(): I128;
|
|
4190
|
+
/**
|
|
4191
|
+
* Cast the scalar to a U128 with lossy truncation.
|
|
4192
|
+
*/
|
|
4193
|
+
toU128Lossy(): U128;
|
|
4194
|
+
/**
|
|
4195
|
+
* Cast the scalar to a Group element with lossy conversion (via Field, Elligator-2 fallback).
|
|
4196
|
+
*/
|
|
4197
|
+
toGroupLossy(): Group;
|
|
4198
|
+
/**
|
|
4199
|
+
* Cast the scalar to an Address with lossy conversion (via Group, Elligator-2 fallback).
|
|
4200
|
+
*/
|
|
4201
|
+
toAddressLossy(): Address;
|
|
4202
|
+
/**
|
|
4203
|
+
* Cast the scalar to a Boolean with lossy truncation (extracts least-significant bit).
|
|
4204
|
+
*/
|
|
4205
|
+
toBooleanLossy(): Boolean;
|
|
3454
4206
|
/**
|
|
3455
4207
|
* Add two scalar elements.
|
|
3456
4208
|
*/
|
|
@@ -3503,6 +4255,11 @@ export class Scalar {
|
|
|
3503
4255
|
* Cast the scalar element to a field element.
|
|
3504
4256
|
*/
|
|
3505
4257
|
toField(): Field;
|
|
4258
|
+
/**
|
|
4259
|
+
* Cast the scalar to a Group element (strict, via Field x-coordinate recovery).
|
|
4260
|
+
* Returns an error if the resulting field is not a valid x-coordinate on the curve.
|
|
4261
|
+
*/
|
|
4262
|
+
toGroup(): Group;
|
|
3506
4263
|
/**
|
|
3507
4264
|
* Returns the string representation of the scalar element.
|
|
3508
4265
|
*/
|
|
@@ -3951,18 +4708,66 @@ export class U128 {
|
|
|
3951
4708
|
* Construct an integer from a byte array representation.
|
|
3952
4709
|
*/
|
|
3953
4710
|
toBytesLe(): Uint8Array;
|
|
4711
|
+
/**
|
|
4712
|
+
* Cast to I8 with lossy truncation.
|
|
4713
|
+
*/
|
|
4714
|
+
toI8Lossy(): I8;
|
|
4715
|
+
/**
|
|
4716
|
+
* Cast to U8 with lossy truncation.
|
|
4717
|
+
*/
|
|
4718
|
+
toU8Lossy(): U8;
|
|
3954
4719
|
/**
|
|
3955
4720
|
* Construct an integer from a boolean array representation.
|
|
3956
4721
|
*/
|
|
3957
4722
|
static fromBitsLe(bits: Array<any>): U128;
|
|
4723
|
+
/**
|
|
4724
|
+
* Cast to I16 with lossy truncation.
|
|
4725
|
+
*/
|
|
4726
|
+
toI16Lossy(): I16;
|
|
4727
|
+
/**
|
|
4728
|
+
* Cast to I32 with lossy truncation.
|
|
4729
|
+
*/
|
|
4730
|
+
toI32Lossy(): I32;
|
|
4731
|
+
/**
|
|
4732
|
+
* Cast to I64 with lossy truncation.
|
|
4733
|
+
*/
|
|
4734
|
+
toI64Lossy(): I64;
|
|
3958
4735
|
/**
|
|
3959
4736
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
3960
4737
|
*/
|
|
3961
4738
|
toPlaintext(): Plaintext;
|
|
4739
|
+
/**
|
|
4740
|
+
* Cast to U16 with lossy truncation.
|
|
4741
|
+
*/
|
|
4742
|
+
toU16Lossy(): U16;
|
|
4743
|
+
/**
|
|
4744
|
+
* Cast to U32 with lossy truncation.
|
|
4745
|
+
*/
|
|
4746
|
+
toU32Lossy(): U32;
|
|
4747
|
+
/**
|
|
4748
|
+
* Cast to U64 with lossy truncation.
|
|
4749
|
+
*/
|
|
4750
|
+
toU64Lossy(): U64;
|
|
3962
4751
|
/**
|
|
3963
4752
|
* Get the byte array representation of the integer.
|
|
3964
4753
|
*/
|
|
3965
4754
|
static fromBytesLe(bytes: Uint8Array): U128;
|
|
4755
|
+
/**
|
|
4756
|
+
* Cast to I128 with lossy truncation.
|
|
4757
|
+
*/
|
|
4758
|
+
toI128Lossy(): I128;
|
|
4759
|
+
/**
|
|
4760
|
+
* Cast to U128 with lossy truncation.
|
|
4761
|
+
*/
|
|
4762
|
+
toU128Lossy(): U128;
|
|
4763
|
+
/**
|
|
4764
|
+
* Construct an integer from a field element with lossy truncation.
|
|
4765
|
+
*/
|
|
4766
|
+
static fromFieldLossy(field: Field): U128;
|
|
4767
|
+
/**
|
|
4768
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
4769
|
+
*/
|
|
4770
|
+
toBooleanLossy(): Boolean;
|
|
3966
4771
|
/**
|
|
3967
4772
|
* Negate the integer (e.g., 5 → -5).
|
|
3968
4773
|
*/
|
|
@@ -3991,6 +4796,10 @@ export class U128 {
|
|
|
3991
4796
|
* Exponentiate the integer with a u32 exponent.
|
|
3992
4797
|
*/
|
|
3993
4798
|
powU32(exponent: U32): U128;
|
|
4799
|
+
/**
|
|
4800
|
+
* Convert the integer to a Field element (lossless).
|
|
4801
|
+
*/
|
|
4802
|
+
toField(): Field;
|
|
3994
4803
|
/**
|
|
3995
4804
|
* Convert the integer to a Scalar value.
|
|
3996
4805
|
*/
|
|
@@ -4052,18 +4861,66 @@ export class U16 {
|
|
|
4052
4861
|
* Construct an integer from a byte array representation.
|
|
4053
4862
|
*/
|
|
4054
4863
|
toBytesLe(): Uint8Array;
|
|
4864
|
+
/**
|
|
4865
|
+
* Cast to I8 with lossy truncation.
|
|
4866
|
+
*/
|
|
4867
|
+
toI8Lossy(): I8;
|
|
4868
|
+
/**
|
|
4869
|
+
* Cast to U8 with lossy truncation.
|
|
4870
|
+
*/
|
|
4871
|
+
toU8Lossy(): U8;
|
|
4055
4872
|
/**
|
|
4056
4873
|
* Construct an integer from a boolean array representation.
|
|
4057
4874
|
*/
|
|
4058
4875
|
static fromBitsLe(bits: Array<any>): U16;
|
|
4876
|
+
/**
|
|
4877
|
+
* Cast to I16 with lossy truncation.
|
|
4878
|
+
*/
|
|
4879
|
+
toI16Lossy(): I16;
|
|
4880
|
+
/**
|
|
4881
|
+
* Cast to I32 with lossy truncation.
|
|
4882
|
+
*/
|
|
4883
|
+
toI32Lossy(): I32;
|
|
4884
|
+
/**
|
|
4885
|
+
* Cast to I64 with lossy truncation.
|
|
4886
|
+
*/
|
|
4887
|
+
toI64Lossy(): I64;
|
|
4059
4888
|
/**
|
|
4060
4889
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
4061
4890
|
*/
|
|
4062
4891
|
toPlaintext(): Plaintext;
|
|
4892
|
+
/**
|
|
4893
|
+
* Cast to U16 with lossy truncation.
|
|
4894
|
+
*/
|
|
4895
|
+
toU16Lossy(): U16;
|
|
4896
|
+
/**
|
|
4897
|
+
* Cast to U32 with lossy truncation.
|
|
4898
|
+
*/
|
|
4899
|
+
toU32Lossy(): U32;
|
|
4900
|
+
/**
|
|
4901
|
+
* Cast to U64 with lossy truncation.
|
|
4902
|
+
*/
|
|
4903
|
+
toU64Lossy(): U64;
|
|
4063
4904
|
/**
|
|
4064
4905
|
* Get the byte array representation of the integer.
|
|
4065
4906
|
*/
|
|
4066
4907
|
static fromBytesLe(bytes: Uint8Array): U16;
|
|
4908
|
+
/**
|
|
4909
|
+
* Cast to I128 with lossy truncation.
|
|
4910
|
+
*/
|
|
4911
|
+
toI128Lossy(): I128;
|
|
4912
|
+
/**
|
|
4913
|
+
* Cast to U128 with lossy truncation.
|
|
4914
|
+
*/
|
|
4915
|
+
toU128Lossy(): U128;
|
|
4916
|
+
/**
|
|
4917
|
+
* Construct an integer from a field element with lossy truncation.
|
|
4918
|
+
*/
|
|
4919
|
+
static fromFieldLossy(field: Field): U16;
|
|
4920
|
+
/**
|
|
4921
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
4922
|
+
*/
|
|
4923
|
+
toBooleanLossy(): Boolean;
|
|
4067
4924
|
/**
|
|
4068
4925
|
* Negate the integer (e.g., 5 → -5).
|
|
4069
4926
|
*/
|
|
@@ -4092,6 +4949,10 @@ export class U16 {
|
|
|
4092
4949
|
* Exponentiate the integer with a u32 exponent.
|
|
4093
4950
|
*/
|
|
4094
4951
|
powU32(exponent: U32): U16;
|
|
4952
|
+
/**
|
|
4953
|
+
* Convert the integer to a Field element (lossless).
|
|
4954
|
+
*/
|
|
4955
|
+
toField(): Field;
|
|
4095
4956
|
/**
|
|
4096
4957
|
* Convert the integer to a Scalar value.
|
|
4097
4958
|
*/
|
|
@@ -4153,18 +5014,66 @@ export class U32 {
|
|
|
4153
5014
|
* Construct an integer from a byte array representation.
|
|
4154
5015
|
*/
|
|
4155
5016
|
toBytesLe(): Uint8Array;
|
|
5017
|
+
/**
|
|
5018
|
+
* Cast to I8 with lossy truncation.
|
|
5019
|
+
*/
|
|
5020
|
+
toI8Lossy(): I8;
|
|
5021
|
+
/**
|
|
5022
|
+
* Cast to U8 with lossy truncation.
|
|
5023
|
+
*/
|
|
5024
|
+
toU8Lossy(): U8;
|
|
4156
5025
|
/**
|
|
4157
5026
|
* Construct an integer from a boolean array representation.
|
|
4158
5027
|
*/
|
|
4159
5028
|
static fromBitsLe(bits: Array<any>): U32;
|
|
5029
|
+
/**
|
|
5030
|
+
* Cast to I16 with lossy truncation.
|
|
5031
|
+
*/
|
|
5032
|
+
toI16Lossy(): I16;
|
|
5033
|
+
/**
|
|
5034
|
+
* Cast to I32 with lossy truncation.
|
|
5035
|
+
*/
|
|
5036
|
+
toI32Lossy(): I32;
|
|
5037
|
+
/**
|
|
5038
|
+
* Cast to I64 with lossy truncation.
|
|
5039
|
+
*/
|
|
5040
|
+
toI64Lossy(): I64;
|
|
4160
5041
|
/**
|
|
4161
5042
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
4162
5043
|
*/
|
|
4163
5044
|
toPlaintext(): Plaintext;
|
|
5045
|
+
/**
|
|
5046
|
+
* Cast to U16 with lossy truncation.
|
|
5047
|
+
*/
|
|
5048
|
+
toU16Lossy(): U16;
|
|
5049
|
+
/**
|
|
5050
|
+
* Cast to U32 with lossy truncation.
|
|
5051
|
+
*/
|
|
5052
|
+
toU32Lossy(): U32;
|
|
5053
|
+
/**
|
|
5054
|
+
* Cast to U64 with lossy truncation.
|
|
5055
|
+
*/
|
|
5056
|
+
toU64Lossy(): U64;
|
|
4164
5057
|
/**
|
|
4165
5058
|
* Get the byte array representation of the integer.
|
|
4166
5059
|
*/
|
|
4167
5060
|
static fromBytesLe(bytes: Uint8Array): U32;
|
|
5061
|
+
/**
|
|
5062
|
+
* Cast to I128 with lossy truncation.
|
|
5063
|
+
*/
|
|
5064
|
+
toI128Lossy(): I128;
|
|
5065
|
+
/**
|
|
5066
|
+
* Cast to U128 with lossy truncation.
|
|
5067
|
+
*/
|
|
5068
|
+
toU128Lossy(): U128;
|
|
5069
|
+
/**
|
|
5070
|
+
* Construct an integer from a field element with lossy truncation.
|
|
5071
|
+
*/
|
|
5072
|
+
static fromFieldLossy(field: Field): U32;
|
|
5073
|
+
/**
|
|
5074
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
5075
|
+
*/
|
|
5076
|
+
toBooleanLossy(): Boolean;
|
|
4168
5077
|
/**
|
|
4169
5078
|
* Negate the integer (e.g., 5 → -5).
|
|
4170
5079
|
*/
|
|
@@ -4193,6 +5102,10 @@ export class U32 {
|
|
|
4193
5102
|
* Exponentiate the integer with a u32 exponent.
|
|
4194
5103
|
*/
|
|
4195
5104
|
powU32(exponent: U32): U32;
|
|
5105
|
+
/**
|
|
5106
|
+
* Convert the integer to a Field element (lossless).
|
|
5107
|
+
*/
|
|
5108
|
+
toField(): Field;
|
|
4196
5109
|
/**
|
|
4197
5110
|
* Convert the integer to a Scalar value.
|
|
4198
5111
|
*/
|
|
@@ -4254,18 +5167,66 @@ export class U64 {
|
|
|
4254
5167
|
* Construct an integer from a byte array representation.
|
|
4255
5168
|
*/
|
|
4256
5169
|
toBytesLe(): Uint8Array;
|
|
5170
|
+
/**
|
|
5171
|
+
* Cast to I8 with lossy truncation.
|
|
5172
|
+
*/
|
|
5173
|
+
toI8Lossy(): I8;
|
|
5174
|
+
/**
|
|
5175
|
+
* Cast to U8 with lossy truncation.
|
|
5176
|
+
*/
|
|
5177
|
+
toU8Lossy(): U8;
|
|
4257
5178
|
/**
|
|
4258
5179
|
* Construct an integer from a boolean array representation.
|
|
4259
5180
|
*/
|
|
4260
5181
|
static fromBitsLe(bits: Array<any>): U64;
|
|
5182
|
+
/**
|
|
5183
|
+
* Cast to I16 with lossy truncation.
|
|
5184
|
+
*/
|
|
5185
|
+
toI16Lossy(): I16;
|
|
5186
|
+
/**
|
|
5187
|
+
* Cast to I32 with lossy truncation.
|
|
5188
|
+
*/
|
|
5189
|
+
toI32Lossy(): I32;
|
|
5190
|
+
/**
|
|
5191
|
+
* Cast to I64 with lossy truncation.
|
|
5192
|
+
*/
|
|
5193
|
+
toI64Lossy(): I64;
|
|
4261
5194
|
/**
|
|
4262
5195
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
4263
5196
|
*/
|
|
4264
5197
|
toPlaintext(): Plaintext;
|
|
5198
|
+
/**
|
|
5199
|
+
* Cast to U16 with lossy truncation.
|
|
5200
|
+
*/
|
|
5201
|
+
toU16Lossy(): U16;
|
|
5202
|
+
/**
|
|
5203
|
+
* Cast to U32 with lossy truncation.
|
|
5204
|
+
*/
|
|
5205
|
+
toU32Lossy(): U32;
|
|
5206
|
+
/**
|
|
5207
|
+
* Cast to U64 with lossy truncation.
|
|
5208
|
+
*/
|
|
5209
|
+
toU64Lossy(): U64;
|
|
4265
5210
|
/**
|
|
4266
5211
|
* Get the byte array representation of the integer.
|
|
4267
5212
|
*/
|
|
4268
5213
|
static fromBytesLe(bytes: Uint8Array): U64;
|
|
5214
|
+
/**
|
|
5215
|
+
* Cast to I128 with lossy truncation.
|
|
5216
|
+
*/
|
|
5217
|
+
toI128Lossy(): I128;
|
|
5218
|
+
/**
|
|
5219
|
+
* Cast to U128 with lossy truncation.
|
|
5220
|
+
*/
|
|
5221
|
+
toU128Lossy(): U128;
|
|
5222
|
+
/**
|
|
5223
|
+
* Construct an integer from a field element with lossy truncation.
|
|
5224
|
+
*/
|
|
5225
|
+
static fromFieldLossy(field: Field): U64;
|
|
5226
|
+
/**
|
|
5227
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
5228
|
+
*/
|
|
5229
|
+
toBooleanLossy(): Boolean;
|
|
4269
5230
|
/**
|
|
4270
5231
|
* Negate the integer (e.g., 5 → -5).
|
|
4271
5232
|
*/
|
|
@@ -4294,6 +5255,10 @@ export class U64 {
|
|
|
4294
5255
|
* Exponentiate the integer with a u32 exponent.
|
|
4295
5256
|
*/
|
|
4296
5257
|
powU32(exponent: U32): U64;
|
|
5258
|
+
/**
|
|
5259
|
+
* Convert the integer to a Field element (lossless).
|
|
5260
|
+
*/
|
|
5261
|
+
toField(): Field;
|
|
4297
5262
|
/**
|
|
4298
5263
|
* Convert the integer to a Scalar value.
|
|
4299
5264
|
*/
|
|
@@ -4355,18 +5320,66 @@ export class U8 {
|
|
|
4355
5320
|
* Construct an integer from a byte array representation.
|
|
4356
5321
|
*/
|
|
4357
5322
|
toBytesLe(): Uint8Array;
|
|
5323
|
+
/**
|
|
5324
|
+
* Cast to I8 with lossy truncation.
|
|
5325
|
+
*/
|
|
5326
|
+
toI8Lossy(): I8;
|
|
5327
|
+
/**
|
|
5328
|
+
* Cast to U8 with lossy truncation.
|
|
5329
|
+
*/
|
|
5330
|
+
toU8Lossy(): U8;
|
|
4358
5331
|
/**
|
|
4359
5332
|
* Construct an integer from a boolean array representation.
|
|
4360
5333
|
*/
|
|
4361
5334
|
static fromBitsLe(bits: Array<any>): U8;
|
|
5335
|
+
/**
|
|
5336
|
+
* Cast to I16 with lossy truncation.
|
|
5337
|
+
*/
|
|
5338
|
+
toI16Lossy(): I16;
|
|
5339
|
+
/**
|
|
5340
|
+
* Cast to I32 with lossy truncation.
|
|
5341
|
+
*/
|
|
5342
|
+
toI32Lossy(): I32;
|
|
5343
|
+
/**
|
|
5344
|
+
* Cast to I64 with lossy truncation.
|
|
5345
|
+
*/
|
|
5346
|
+
toI64Lossy(): I64;
|
|
4362
5347
|
/**
|
|
4363
5348
|
* Convert the integer to the Plaintext type. This must be done before hashing an integer to ensure it matches hashes with a leo/aleo program.
|
|
4364
5349
|
*/
|
|
4365
5350
|
toPlaintext(): Plaintext;
|
|
5351
|
+
/**
|
|
5352
|
+
* Cast to U16 with lossy truncation.
|
|
5353
|
+
*/
|
|
5354
|
+
toU16Lossy(): U16;
|
|
5355
|
+
/**
|
|
5356
|
+
* Cast to U32 with lossy truncation.
|
|
5357
|
+
*/
|
|
5358
|
+
toU32Lossy(): U32;
|
|
5359
|
+
/**
|
|
5360
|
+
* Cast to U64 with lossy truncation.
|
|
5361
|
+
*/
|
|
5362
|
+
toU64Lossy(): U64;
|
|
4366
5363
|
/**
|
|
4367
5364
|
* Get the byte array representation of the integer.
|
|
4368
5365
|
*/
|
|
4369
5366
|
static fromBytesLe(bytes: Uint8Array): U8;
|
|
5367
|
+
/**
|
|
5368
|
+
* Cast to I128 with lossy truncation.
|
|
5369
|
+
*/
|
|
5370
|
+
toI128Lossy(): I128;
|
|
5371
|
+
/**
|
|
5372
|
+
* Cast to U128 with lossy truncation.
|
|
5373
|
+
*/
|
|
5374
|
+
toU128Lossy(): U128;
|
|
5375
|
+
/**
|
|
5376
|
+
* Construct an integer from a field element with lossy truncation.
|
|
5377
|
+
*/
|
|
5378
|
+
static fromFieldLossy(field: Field): U8;
|
|
5379
|
+
/**
|
|
5380
|
+
* Cast the integer to a Boolean with lossy truncation (extracts least-significant bit).
|
|
5381
|
+
*/
|
|
5382
|
+
toBooleanLossy(): Boolean;
|
|
4370
5383
|
/**
|
|
4371
5384
|
* Negate the integer (e.g., 5 → -5).
|
|
4372
5385
|
*/
|
|
@@ -4395,6 +5408,10 @@ export class U8 {
|
|
|
4395
5408
|
* Exponentiate the integer with a u32 exponent.
|
|
4396
5409
|
*/
|
|
4397
5410
|
powU32(exponent: U32): U8;
|
|
5411
|
+
/**
|
|
5412
|
+
* Convert the integer to a Field element (lossless).
|
|
5413
|
+
*/
|
|
5414
|
+
toField(): Field;
|
|
4398
5415
|
/**
|
|
4399
5416
|
* Convert the integer to a Scalar value.
|
|
4400
5417
|
*/
|