@provablehq/wasm 0.6.9

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.
@@ -0,0 +1,1684 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
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.
7
+ *
8
+ * @param {Execution} execution The function execution to verify
9
+ * @param {VerifyingKey} verifying_key The verifying key for the function
10
+ * @param {Program} program The program that the function execution belongs to
11
+ * @param {String} function_id The name of the function that was executed
12
+ * @returns {boolean} True if the execution is valid, false otherwise
13
+ * @param {Execution} execution
14
+ * @param {VerifyingKey} verifying_key
15
+ * @param {Program} program
16
+ * @param {string} function_id
17
+ * @returns {boolean}
18
+ */
19
+ export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string): boolean;
20
+ /**
21
+ * @param {number} receiver
22
+ */
23
+ export function runRayonThread(receiver: number): void;
24
+ /**
25
+ * @param {URL} url
26
+ * @param {number} num_threads
27
+ * @returns {Promise<void>}
28
+ */
29
+ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
30
+ /**
31
+ * Public address of an Aleo account
32
+ */
33
+ export class Address {
34
+ free(): void;
35
+ /**
36
+ * Derive an Aleo address from a private key
37
+ *
38
+ * @param {PrivateKey} private_key The private key to derive the address from
39
+ * @returns {Address} Address corresponding to the private key
40
+ * @param {PrivateKey} private_key
41
+ * @returns {Address}
42
+ */
43
+ static from_private_key(private_key: PrivateKey): Address;
44
+ /**
45
+ * Derive an Aleo address from a view key
46
+ *
47
+ * @param {ViewKey} view_key The view key to derive the address from
48
+ * @returns {Address} Address corresponding to the view key
49
+ * @param {ViewKey} view_key
50
+ * @returns {Address}
51
+ */
52
+ static from_view_key(view_key: ViewKey): Address;
53
+ /**
54
+ * Create an aleo address object from a string representation of an address
55
+ *
56
+ * @param {string} address String representation of an addressm
57
+ * @returns {Address} Address
58
+ * @param {string} address
59
+ * @returns {Address}
60
+ */
61
+ static from_string(address: string): Address;
62
+ /**
63
+ * Get a string representation of an Aleo address object
64
+ *
65
+ * @param {Address} Address
66
+ * @returns {string} String representation of the address
67
+ * @returns {string}
68
+ */
69
+ to_string(): string;
70
+ /**
71
+ * Verify a signature for a message signed by the address
72
+ *
73
+ * @param {Uint8Array} Byte array representing a message signed by the address
74
+ * @returns {boolean} Boolean representing whether or not the signature is valid
75
+ * @param {Uint8Array} message
76
+ * @param {Signature} signature
77
+ * @returns {boolean}
78
+ */
79
+ verify(message: Uint8Array, signature: Signature): boolean;
80
+ }
81
+ /**
82
+ * Execution of an Aleo program.
83
+ */
84
+ export class Execution {
85
+ free(): void;
86
+ /**
87
+ * Returns the string representation of the execution.
88
+ * @returns {string}
89
+ */
90
+ toString(): string;
91
+ /**
92
+ * Creates an execution object from a string representation of an execution.
93
+ * @param {string} execution
94
+ * @returns {Execution}
95
+ */
96
+ static fromString(execution: string): Execution;
97
+ }
98
+ /**
99
+ * Webassembly Representation of an Aleo function execution response
100
+ *
101
+ * This object is returned by the execution of an Aleo function off-chain. It provides methods for
102
+ * retrieving the outputs of the function execution.
103
+ */
104
+ export class ExecutionResponse {
105
+ free(): void;
106
+ /**
107
+ * Get the outputs of the executed function
108
+ *
109
+ * @returns {Array} Array of strings representing the outputs of the function
110
+ * @returns {Array<any>}
111
+ */
112
+ getOutputs(): Array<any>;
113
+ /**
114
+ * Returns the execution object if present, null if otherwise.
115
+ *
116
+ * @returns {Execution | undefined} The execution object if present, null if otherwise
117
+ * @returns {Execution | undefined}
118
+ */
119
+ getExecution(): Execution | undefined;
120
+ /**
121
+ * Returns the program keys if present
122
+ * @returns {KeyPair}
123
+ */
124
+ getKeys(): KeyPair;
125
+ /**
126
+ * Returns the proving_key if the proving key was cached in the Execution response.
127
+ * Note the proving key is removed from the response object after the first call to this
128
+ * function. Subsequent calls will return null.
129
+ *
130
+ * @returns {ProvingKey | undefined} The proving key
131
+ * @returns {ProvingKey | undefined}
132
+ */
133
+ getProvingKey(): ProvingKey | undefined;
134
+ /**
135
+ * Returns the verifying_key associated with the program
136
+ *
137
+ * @returns {VerifyingKey} The verifying key
138
+ * @returns {VerifyingKey}
139
+ */
140
+ getVerifyingKey(): VerifyingKey;
141
+ /**
142
+ * Returns the function identifier
143
+ * @returns {string}
144
+ */
145
+ getFunctionId(): string;
146
+ /**
147
+ * Returns the program
148
+ * @returns {Program}
149
+ */
150
+ getProgram(): Program;
151
+ }
152
+ /**
153
+ */
154
+ export class Field {
155
+ free(): void;
156
+ /**
157
+ * @returns {string}
158
+ */
159
+ toString(): string;
160
+ /**
161
+ * @param {string} field
162
+ * @returns {Field}
163
+ */
164
+ static fromString(field: string): Field;
165
+ }
166
+ /**
167
+ * Key pair object containing both the function proving and verifying keys
168
+ */
169
+ export class KeyPair {
170
+ free(): void;
171
+ /**
172
+ * Create new key pair from proving and verifying keys
173
+ *
174
+ * @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
175
+ * @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
176
+ * @returns {KeyPair} Key pair object containing both the function proving and verifying keys
177
+ * @param {ProvingKey} proving_key
178
+ * @param {VerifyingKey} verifying_key
179
+ */
180
+ constructor(proving_key: ProvingKey, verifying_key: VerifyingKey);
181
+ /**
182
+ * Get the proving key. This method will remove the proving key from the key pair
183
+ *
184
+ * @returns {ProvingKey | Error}
185
+ * @returns {ProvingKey}
186
+ */
187
+ provingKey(): ProvingKey;
188
+ /**
189
+ * Get the verifying key. This method will remove the verifying key from the key pair
190
+ *
191
+ * @returns {VerifyingKey | Error}
192
+ * @returns {VerifyingKey}
193
+ */
194
+ verifyingKey(): VerifyingKey;
195
+ }
196
+ /**
197
+ */
198
+ export class Metadata {
199
+ free(): void;
200
+ /**
201
+ * @returns {string}
202
+ */
203
+ static baseUrl(): string;
204
+ /**
205
+ * @returns {Metadata}
206
+ */
207
+ static bond_public(): Metadata;
208
+ /**
209
+ * @returns {Metadata}
210
+ */
211
+ static bond_validator(): Metadata;
212
+ /**
213
+ * @returns {Metadata}
214
+ */
215
+ static claim_unbond_public(): Metadata;
216
+ /**
217
+ * @returns {Metadata}
218
+ */
219
+ static fee_private(): Metadata;
220
+ /**
221
+ * @returns {Metadata}
222
+ */
223
+ static fee_public(): Metadata;
224
+ /**
225
+ * @returns {Metadata}
226
+ */
227
+ static inclusion(): Metadata;
228
+ /**
229
+ * @returns {Metadata}
230
+ */
231
+ static join(): Metadata;
232
+ /**
233
+ * @returns {Metadata}
234
+ */
235
+ static set_validator_state(): Metadata;
236
+ /**
237
+ * @returns {Metadata}
238
+ */
239
+ static split(): Metadata;
240
+ /**
241
+ * @returns {Metadata}
242
+ */
243
+ static transfer_private(): Metadata;
244
+ /**
245
+ * @returns {Metadata}
246
+ */
247
+ static transfer_private_to_public(): Metadata;
248
+ /**
249
+ * @returns {Metadata}
250
+ */
251
+ static transfer_public(): Metadata;
252
+ /**
253
+ * @returns {Metadata}
254
+ */
255
+ static transfer_public_as_signer(): Metadata;
256
+ /**
257
+ * @returns {Metadata}
258
+ */
259
+ static transfer_public_to_private(): Metadata;
260
+ /**
261
+ * @returns {Metadata}
262
+ */
263
+ static unbond_public(): Metadata;
264
+ /**
265
+ */
266
+ locator: string;
267
+ /**
268
+ */
269
+ prover: string;
270
+ /**
271
+ */
272
+ verifier: string;
273
+ /**
274
+ */
275
+ verifyingKey: string;
276
+ }
277
+ /**
278
+ * An offline query object used to insert the global state root and state paths needed to create
279
+ * a valid inclusion proof offline.
280
+ */
281
+ export class OfflineQuery {
282
+ free(): void;
283
+ /**
284
+ * Creates a new offline query object. The state root is required to be passed in as a string
285
+ * @param {string} state_root
286
+ */
287
+ constructor(state_root: string);
288
+ /**
289
+ * Add a new state path to the offline query object.
290
+ *
291
+ * @param {string} commitment: The commitment corresponding to a record inpout
292
+ * @param {string} state_path: The state path corresponding to the commitment
293
+ * @param {string} commitment
294
+ * @param {string} state_path
295
+ */
296
+ addStatePath(commitment: string, state_path: string): void;
297
+ /**
298
+ * Get a json string representation of the offline query object
299
+ * @returns {string}
300
+ */
301
+ toString(): string;
302
+ /**
303
+ * Create an offline query object from a json string representation
304
+ * @param {string} s
305
+ * @returns {OfflineQuery}
306
+ */
307
+ static fromString(s: string): OfflineQuery;
308
+ }
309
+ /**
310
+ * Private key of an Aleo account
311
+ */
312
+ export class PrivateKey {
313
+ free(): void;
314
+ /**
315
+ * Generate a new private key using a cryptographically secure random number generator
316
+ *
317
+ * @returns {PrivateKey}
318
+ */
319
+ constructor();
320
+ /**
321
+ * Get a private key from a series of unchecked bytes
322
+ *
323
+ * @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
324
+ * @returns {PrivateKey}
325
+ * @param {Uint8Array} seed
326
+ * @returns {PrivateKey}
327
+ */
328
+ static from_seed_unchecked(seed: Uint8Array): PrivateKey;
329
+ /**
330
+ * Get a private key from a string representation of a private key
331
+ *
332
+ * @param {string} seed String representation of a private key
333
+ * @returns {PrivateKey}
334
+ * @param {string} private_key
335
+ * @returns {PrivateKey}
336
+ */
337
+ static from_string(private_key: string): PrivateKey;
338
+ /**
339
+ * Get a string representation of the private key. This function should be used very carefully
340
+ * as it exposes the private key plaintext
341
+ *
342
+ * @returns {string} String representation of a private key
343
+ * @returns {string}
344
+ */
345
+ to_string(): string;
346
+ /**
347
+ * Get the view key corresponding to the private key
348
+ *
349
+ * @returns {ViewKey}
350
+ * @returns {ViewKey}
351
+ */
352
+ to_view_key(): ViewKey;
353
+ /**
354
+ * Get the address corresponding to the private key
355
+ *
356
+ * @returns {Address}
357
+ * @returns {Address}
358
+ */
359
+ to_address(): Address;
360
+ /**
361
+ * Sign a message with the private key
362
+ *
363
+ * @param {Uint8Array} Byte array representing a message signed by the address
364
+ * @returns {Signature} Signature generated by signing the message with the address
365
+ * @param {Uint8Array} message
366
+ * @returns {Signature}
367
+ */
368
+ sign(message: Uint8Array): Signature;
369
+ /**
370
+ * Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
371
+ * and will be needed to decrypt the private key later, so it should be stored securely
372
+ *
373
+ * @param {string} secret Secret used to encrypt the private key
374
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
375
+ * @param {string} secret
376
+ * @returns {PrivateKeyCiphertext}
377
+ */
378
+ static newEncrypted(secret: string): PrivateKeyCiphertext;
379
+ /**
380
+ * Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
381
+ * decrypt the private key later, so it should be stored securely
382
+ *
383
+ * @param {string} secret Secret used to encrypt the private key
384
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
385
+ * @param {string} secret
386
+ * @returns {PrivateKeyCiphertext}
387
+ */
388
+ toCiphertext(secret: string): PrivateKeyCiphertext;
389
+ /**
390
+ * Get private key from a private key ciphertext and secret originally used to encrypt it
391
+ *
392
+ * @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
393
+ * @param {string} secret Secret originally used to encrypt the private key
394
+ * @returns {PrivateKey | Error} Private key
395
+ * @param {PrivateKeyCiphertext} ciphertext
396
+ * @param {string} secret
397
+ * @returns {PrivateKey}
398
+ */
399
+ static fromPrivateKeyCiphertext(ciphertext: PrivateKeyCiphertext, secret: string): PrivateKey;
400
+ }
401
+ /**
402
+ * Private Key in ciphertext form
403
+ */
404
+ export class PrivateKeyCiphertext {
405
+ free(): void;
406
+ /**
407
+ * Encrypt a private key using a secret string. The secret is sensitive and will be needed to
408
+ * decrypt the private key later, so it should be stored securely
409
+ *
410
+ * @param {PrivateKey} private_key Private key to encrypt
411
+ * @param {string} secret Secret to encrypt the private key with
412
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
413
+ * @param {PrivateKey} private_key
414
+ * @param {string} secret
415
+ * @returns {PrivateKeyCiphertext}
416
+ */
417
+ static encryptPrivateKey(private_key: PrivateKey, secret: string): PrivateKeyCiphertext;
418
+ /**
419
+ * Decrypts a private ciphertext using a secret string. This must be the same secret used to
420
+ * encrypt the private key
421
+ *
422
+ * @param {string} secret Secret used to encrypt the private key
423
+ * @returns {PrivateKey | Error} Private key
424
+ * @param {string} secret
425
+ * @returns {PrivateKey}
426
+ */
427
+ decryptToPrivateKey(secret: string): PrivateKey;
428
+ /**
429
+ * Returns the ciphertext string
430
+ *
431
+ * @returns {string} Ciphertext string
432
+ * @returns {string}
433
+ */
434
+ toString(): string;
435
+ /**
436
+ * Creates a PrivateKeyCiphertext from a string
437
+ *
438
+ * @param {string} ciphertext Ciphertext string
439
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
440
+ * @param {string} ciphertext
441
+ * @returns {PrivateKeyCiphertext}
442
+ */
443
+ static fromString(ciphertext: string): PrivateKeyCiphertext;
444
+ }
445
+ /**
446
+ * Webassembly Representation of an Aleo program
447
+ */
448
+ export class Program {
449
+ free(): void;
450
+ /**
451
+ * Create a program from a program string
452
+ *
453
+ * @param {string} program Aleo program source code
454
+ * @returns {Program | Error} Program object
455
+ * @param {string} program
456
+ * @returns {Program}
457
+ */
458
+ static fromString(program: string): Program;
459
+ /**
460
+ * Get a string representation of the program
461
+ *
462
+ * @returns {string} String containing the program source code
463
+ * @returns {string}
464
+ */
465
+ toString(): string;
466
+ /**
467
+ * Determine if a function is present in the program
468
+ *
469
+ * @param {string} functionName Name of the function to check for
470
+ * @returns {boolean} True if the program is valid, false otherwise
471
+ * @param {string} function_name
472
+ * @returns {boolean}
473
+ */
474
+ hasFunction(function_name: string): boolean;
475
+ /**
476
+ * Get javascript array of functions names in the program
477
+ *
478
+ * @returns {Array} Array of all function names present in the program
479
+ *
480
+ * @example
481
+ * const expected_functions = [
482
+ * "mint",
483
+ * "transfer_private",
484
+ * "transfer_private_to_public",
485
+ * "transfer_public",
486
+ * "transfer_public_to_private",
487
+ * "join",
488
+ * "split",
489
+ * "fee"
490
+ * ]
491
+ *
492
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
493
+ * const credits_functions = credits_program.getFunctions();
494
+ * console.log(credits_functions === expected_functions); // Output should be "true"
495
+ * @returns {Array<any>}
496
+ */
497
+ getFunctions(): Array<any>;
498
+ /**
499
+ * Get a javascript object representation of the function inputs and types. This can be used
500
+ * to generate a web form to capture user inputs for an execution of a function.
501
+ *
502
+ * @param {string} function_name Name of the function to get inputs for
503
+ * @returns {Array | Error} Array of function inputs
504
+ *
505
+ * @example
506
+ * const expected_inputs = [
507
+ * {
508
+ * type:"record",
509
+ * visibility:"private",
510
+ * record:"credits",
511
+ * members:[
512
+ * {
513
+ * name:"microcredits",
514
+ * type:"u64",
515
+ * visibility:"private"
516
+ * }
517
+ * ],
518
+ * register:"r0"
519
+ * },
520
+ * {
521
+ * type:"address",
522
+ * visibility:"private",
523
+ * register:"r1"
524
+ * },
525
+ * {
526
+ * type:"u64",
527
+ * visibility:"private",
528
+ * register:"r2"
529
+ * }
530
+ * ];
531
+ *
532
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
533
+ * const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
534
+ * console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
535
+ * @param {string} function_name
536
+ * @returns {Array<any>}
537
+ */
538
+ getFunctionInputs(function_name: string): Array<any>;
539
+ /**
540
+ * Get a the list of a program's mappings and the names/types of their keys and values.
541
+ *
542
+ * @returns {Array | Error} - An array of objects representing the mappings in the program
543
+ * @example
544
+ * const expected_mappings = [
545
+ * {
546
+ * name: "account",
547
+ * key_name: "owner",
548
+ * key_type: "address",
549
+ * value_name: "microcredits",
550
+ * value_type: "u64"
551
+ * }
552
+ * ]
553
+ *
554
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
555
+ * const credits_mappings = credits_program.getMappings();
556
+ * console.log(credits_mappings === expected_mappings); // Output should be "true"
557
+ * @returns {Array<any>}
558
+ */
559
+ getMappings(): Array<any>;
560
+ /**
561
+ * Get a javascript object representation of a program record and its types
562
+ *
563
+ * @param {string} record_name Name of the record to get members for
564
+ * @returns {Object | Error} Object containing the record name, type, and members
565
+ *
566
+ * @example
567
+ *
568
+ * const expected_record = {
569
+ * type: "record",
570
+ * record: "Credits",
571
+ * members: [
572
+ * {
573
+ * name: "owner",
574
+ * type: "address",
575
+ * visibility: "private"
576
+ * },
577
+ * {
578
+ * name: "microcredits",
579
+ * type: "u64",
580
+ * visibility: "private"
581
+ * }
582
+ * ];
583
+ * };
584
+ *
585
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
586
+ * const credits_record = credits_program.getRecordMembers("Credits");
587
+ * console.log(credits_record === expected_record); // Output should be "true"
588
+ * @param {string} record_name
589
+ * @returns {object}
590
+ */
591
+ getRecordMembers(record_name: string): object;
592
+ /**
593
+ * Get a javascript object representation of a program struct and its types
594
+ *
595
+ * @param {string} struct_name Name of the struct to get members for
596
+ * @returns {Array | Error} Array containing the struct members
597
+ *
598
+ * @example
599
+ *
600
+ * const STRUCT_PROGRAM = "program token_issue.aleo;
601
+ *
602
+ * struct token_metadata:
603
+ * network as u32;
604
+ * version as u32;
605
+ *
606
+ * struct token:
607
+ * token_id as u32;
608
+ * metadata as token_metadata;
609
+ *
610
+ * function no_op:
611
+ * input r0 as u64;
612
+ * output r0 as u64;"
613
+ *
614
+ * const expected_struct_members = [
615
+ * {
616
+ * name: "token_id",
617
+ * type: "u32",
618
+ * },
619
+ * {
620
+ * name: "metadata",
621
+ * type: "struct",
622
+ * struct_id: "token_metadata",
623
+ * members: [
624
+ * {
625
+ * name: "network",
626
+ * type: "u32",
627
+ * }
628
+ * {
629
+ * name: "version",
630
+ * type: "u32",
631
+ * }
632
+ * ]
633
+ * }
634
+ * ];
635
+ *
636
+ * const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
637
+ * const struct_members = program.getStructMembers("token");
638
+ * console.log(struct_members === expected_struct_members); // Output should be "true"
639
+ * @param {string} struct_name
640
+ * @returns {Array<any>}
641
+ */
642
+ getStructMembers(struct_name: string): Array<any>;
643
+ /**
644
+ * Get the credits.aleo program
645
+ *
646
+ * @returns {Program} The credits.aleo program
647
+ * @returns {Program}
648
+ */
649
+ static getCreditsProgram(): Program;
650
+ /**
651
+ * Get the id of the program
652
+ *
653
+ * @returns {string} The id of the program
654
+ * @returns {string}
655
+ */
656
+ id(): string;
657
+ /**
658
+ * Get a unique address of the program
659
+ *
660
+ * @returns {Address} The address of the program
661
+ * @returns {Address}
662
+ */
663
+ address(): Address;
664
+ /**
665
+ * Determine equality with another program
666
+ *
667
+ * @param {Program} other The other program to compare
668
+ * @returns {boolean} True if the programs are equal, false otherwise
669
+ * @param {Program} other
670
+ * @returns {boolean}
671
+ */
672
+ isEqual(other: Program): boolean;
673
+ /**
674
+ * Get program_imports
675
+ *
676
+ * @returns {Array} The program imports
677
+ *
678
+ * @example
679
+ *
680
+ * const DOUBLE_TEST = "import multiply_test.aleo;
681
+ *
682
+ * program double_test.aleo;
683
+ *
684
+ * function double_it:
685
+ * input r0 as u32.private;
686
+ * call multiply_test.aleo/multiply 2u32 r0 into r1;
687
+ * output r1 as u32.private;";
688
+ *
689
+ * const expected_imports = [
690
+ * "multiply_test.aleo"
691
+ * ];
692
+ *
693
+ * const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
694
+ * const imports = program.getImports();
695
+ * console.log(imports === expected_imports); // Output should be "true"
696
+ * @returns {Array<any>}
697
+ */
698
+ getImports(): Array<any>;
699
+ }
700
+ /**
701
+ */
702
+ export class ProgramManager {
703
+ free(): void;
704
+ /**
705
+ * Deploy an Aleo program
706
+ *
707
+ * @param private_key The private key of the sender
708
+ * @param program The source code of the program being deployed
709
+ * @param imports A javascript object holding the source code of any imported programs in the
710
+ * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
711
+ * Note that all imported programs must be deployed on chain before the main program in order
712
+ * for the deployment to succeed
713
+ * @param fee_credits The amount of credits to pay as a fee
714
+ * @param fee_record The record to spend the fee from
715
+ * @param url The url of the Aleo network node to send the transaction to
716
+ * @param imports (optional) Provide a list of imports to use for the program deployment in the
717
+ * form of a javascript object where the keys are a string of the program name and the values
718
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
719
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
720
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
721
+ * @returns {Transaction | Error}
722
+ * @param {PrivateKey} private_key
723
+ * @param {string} program
724
+ * @param {number} fee_credits
725
+ * @param {RecordPlaintext | undefined} [fee_record]
726
+ * @param {string | undefined} [url]
727
+ * @param {object | undefined} [imports]
728
+ * @param {ProvingKey | undefined} [fee_proving_key]
729
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
730
+ * @param {OfflineQuery | undefined} [offline_query]
731
+ * @returns {Promise<Transaction>}
732
+ */
733
+ static buildDeploymentTransaction(private_key: PrivateKey, program: string, fee_credits: number, fee_record?: RecordPlaintext, url?: string, imports?: object, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
734
+ /**
735
+ * Estimate the fee for a program deployment
736
+ *
737
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
738
+ *
739
+ * @param program The source code of the program being deployed
740
+ * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
741
+ * in the form of a javascript object where the keys are a string of the program name and the values
742
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
743
+ * @returns {u64 | Error}
744
+ * @param {string} program
745
+ * @param {object | undefined} [imports]
746
+ * @returns {Promise<bigint>}
747
+ */
748
+ static estimateDeploymentFee(program: string, imports?: object): Promise<bigint>;
749
+ /**
750
+ * Estimate the component of the deployment cost which comes from the fee for the program name.
751
+ * Note that this cost does not represent the entire cost of deployment. It is additional to
752
+ * the cost of the size (in bytes) of the deployment.
753
+ *
754
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
755
+ *
756
+ * @param name The name of the program to be deployed
757
+ * @returns {u64 | Error}
758
+ * @param {string} name
759
+ * @returns {bigint}
760
+ */
761
+ static estimateProgramNameCost(name: string): bigint;
762
+ /**
763
+ * Execute an arbitrary function locally
764
+ *
765
+ * @param {PrivateKey} private_key The private key of the sender
766
+ * @param {string} program The source code of the program being executed
767
+ * @param {string} function The name of the function to execute
768
+ * @param {Array} inputs A javascript array of inputs to the function
769
+ * @param {boolean} prove_execution If true, the execution will be proven and an execution object
770
+ * containing the proof and the encrypted inputs and outputs needed to verify the proof offline
771
+ * will be returned.
772
+ * @param {boolean} cache Cache the proving and verifying keys in the Execution response.
773
+ * If this is set to 'true' the keys synthesized will be stored in the Execution Response
774
+ * and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
775
+ * method.
776
+ * @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
777
+ * form of a javascript object where the keys are a string of the program name and the values
778
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
779
+ * @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
780
+ * @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
781
+ * @param {PrivateKey} private_key
782
+ * @param {string} program
783
+ * @param {string} _function
784
+ * @param {Array<any>} inputs
785
+ * @param {boolean} prove_execution
786
+ * @param {boolean} cache
787
+ * @param {object | undefined} [imports]
788
+ * @param {ProvingKey | undefined} [proving_key]
789
+ * @param {VerifyingKey | undefined} [verifying_key]
790
+ * @param {string | undefined} [url]
791
+ * @param {OfflineQuery | undefined} [offline_query]
792
+ * @returns {Promise<ExecutionResponse>}
793
+ */
794
+ static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey, url?: string, offline_query?: OfflineQuery): Promise<ExecutionResponse>;
795
+ /**
796
+ * Execute Aleo function and create an Aleo execution transaction
797
+ *
798
+ * @param private_key The private key of the sender
799
+ * @param program The source code of the program being executed
800
+ * @param function The name of the function to execute
801
+ * @param inputs A javascript array of inputs to the function
802
+ * @param fee_credits The amount of credits to pay as a fee
803
+ * @param fee_record The record to spend the fee from
804
+ * @param url The url of the Aleo network node to send the transaction to
805
+ * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
806
+ * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
807
+ * and used for subsequent transactions. If this is set to 'false' the proving and verifying
808
+ * keys will be deallocated from memory after the transaction is executed.
809
+ * @param imports (optional) Provide a list of imports to use for the function execution in the
810
+ * form of a javascript object where the keys are a string of the program name and the values
811
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
812
+ * @param proving_key (optional) Provide a verifying key to use for the function execution
813
+ * @param verifying_key (optional) Provide a verifying key to use for the function execution
814
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
815
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
816
+ * @returns {Transaction | Error}
817
+ * @param {PrivateKey} private_key
818
+ * @param {string} program
819
+ * @param {string} _function
820
+ * @param {Array<any>} inputs
821
+ * @param {number} fee_credits
822
+ * @param {RecordPlaintext | undefined} [fee_record]
823
+ * @param {string | undefined} [url]
824
+ * @param {object | undefined} [imports]
825
+ * @param {ProvingKey | undefined} [proving_key]
826
+ * @param {VerifyingKey | undefined} [verifying_key]
827
+ * @param {ProvingKey | undefined} [fee_proving_key]
828
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
829
+ * @param {OfflineQuery | undefined} [offline_query]
830
+ * @returns {Promise<Transaction>}
831
+ */
832
+ static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, fee_credits: number, fee_record?: RecordPlaintext, url?: string, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
833
+ /**
834
+ * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
835
+ * verifying keys will be stored in the ProgramManager's memory and used for subsequent
836
+ * program executions.
837
+ *
838
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
839
+ *
840
+ * @param private_key The private key of the sender
841
+ * @param program The source code of the program to estimate the execution fee for
842
+ * @param function The name of the function to execute
843
+ * @param inputs A javascript array of inputs to the function
844
+ * @param url The url of the Aleo network node to send the transaction to
845
+ * @param imports (optional) Provide a list of imports to use for the fee estimation in the
846
+ * form of a javascript object where the keys are a string of the program name and the values
847
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
848
+ * @param proving_key (optional) Provide a verifying key to use for the fee estimation
849
+ * @param verifying_key (optional) Provide a verifying key to use for the fee estimation
850
+ * @returns {u64 | Error} Fee in microcredits
851
+ * @param {PrivateKey} private_key
852
+ * @param {string} program
853
+ * @param {string} _function
854
+ * @param {Array<any>} inputs
855
+ * @param {string | undefined} [url]
856
+ * @param {object | undefined} [imports]
857
+ * @param {ProvingKey | undefined} [proving_key]
858
+ * @param {VerifyingKey | undefined} [verifying_key]
859
+ * @param {OfflineQuery | undefined} [offline_query]
860
+ * @returns {Promise<bigint>}
861
+ */
862
+ static estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url?: string, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<bigint>;
863
+ /**
864
+ * Estimate the finalize fee component for executing a function. This fee is additional to the
865
+ * size of the execution of the program in bytes. If the function does not have a finalize
866
+ * step, then the finalize fee is 0.
867
+ *
868
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
869
+ *
870
+ * @param program The program containing the function to estimate the finalize fee for
871
+ * @param function The function to estimate the finalize fee for
872
+ * @returns {u64 | Error} Fee in microcredits
873
+ * @param {string} program
874
+ * @param {string} _function
875
+ * @returns {bigint}
876
+ */
877
+ static estimateFinalizeFee(program: string, _function: string): bigint;
878
+ /**
879
+ * Join two records together to create a new record with an amount of credits equal to the sum
880
+ * of the credits of the two original records
881
+ *
882
+ * @param private_key The private key of the sender
883
+ * @param record_1 The first record to combine
884
+ * @param record_2 The second record to combine
885
+ * @param fee_credits The amount of credits to pay as a fee
886
+ * @param fee_record The record to spend the fee from
887
+ * @param url The url of the Aleo network node to send the transaction to
888
+ * @param join_proving_key (optional) Provide a proving key to use for the join function
889
+ * @param join_verifying_key (optional) Provide a verifying key to use for the join function
890
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
891
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
892
+ * @returns {Transaction | Error} Transaction object
893
+ * @param {PrivateKey} private_key
894
+ * @param {RecordPlaintext} record_1
895
+ * @param {RecordPlaintext} record_2
896
+ * @param {number} fee_credits
897
+ * @param {RecordPlaintext | undefined} [fee_record]
898
+ * @param {string | undefined} [url]
899
+ * @param {ProvingKey | undefined} [join_proving_key]
900
+ * @param {VerifyingKey | undefined} [join_verifying_key]
901
+ * @param {ProvingKey | undefined} [fee_proving_key]
902
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
903
+ * @param {OfflineQuery | undefined} [offline_query]
904
+ * @returns {Promise<Transaction>}
905
+ */
906
+ static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, fee_credits: number, fee_record?: RecordPlaintext, url?: string, join_proving_key?: ProvingKey, join_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
907
+ /**
908
+ * Split an Aleo credits record into two separate records. This function does not require a fee.
909
+ *
910
+ * @param private_key The private key of the sender
911
+ * @param split_amount The amount of the credit split. This amount will be subtracted from the
912
+ * value of the record and two new records will be created with the split amount and the remainder
913
+ * @param amount_record The record to split
914
+ * @param url The url of the Aleo network node to send the transaction to
915
+ * @param split_proving_key (optional) Provide a proving key to use for the split function
916
+ * @param split_verifying_key (optional) Provide a verifying key to use for the split function
917
+ * @returns {Transaction | Error} Transaction object
918
+ * @param {PrivateKey} private_key
919
+ * @param {number} split_amount
920
+ * @param {RecordPlaintext} amount_record
921
+ * @param {string | undefined} [url]
922
+ * @param {ProvingKey | undefined} [split_proving_key]
923
+ * @param {VerifyingKey | undefined} [split_verifying_key]
924
+ * @param {OfflineQuery | undefined} [offline_query]
925
+ * @returns {Promise<Transaction>}
926
+ */
927
+ static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string, split_proving_key?: ProvingKey, split_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
928
+ /**
929
+ * Send credits from one Aleo account to another
930
+ *
931
+ * @param private_key The private key of the sender
932
+ * @param amount_credits The amount of credits to send
933
+ * @param recipient The recipient of the transaction
934
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
935
+ * @param amount_record The record to fund the amount from
936
+ * @param fee_credits The amount of credits to pay as a fee
937
+ * @param fee_record The record to spend the fee from
938
+ * @param url The url of the Aleo network node to send the transaction to
939
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
940
+ * function
941
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
942
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
943
+ * @returns {Transaction | Error}
944
+ * @param {PrivateKey} private_key
945
+ * @param {number} amount_credits
946
+ * @param {string} recipient
947
+ * @param {string} transfer_type
948
+ * @param {string | undefined} caller
949
+ * @param {RecordPlaintext | undefined} amount_record
950
+ * @param {number} fee_credits
951
+ * @param {RecordPlaintext | undefined} [fee_record]
952
+ * @param {string | undefined} [url]
953
+ * @param {ProvingKey | undefined} [transfer_proving_key]
954
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
955
+ * @param {ProvingKey | undefined} [fee_proving_key]
956
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
957
+ * @param {OfflineQuery | undefined} [offline_query]
958
+ * @returns {Promise<Transaction>}
959
+ */
960
+ static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, caller: string | undefined, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record?: RecordPlaintext, url?: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
961
+ /**
962
+ * Synthesize proving and verifying keys for a program
963
+ *
964
+ * @param program {string} The program source code of the program to synthesize keys for
965
+ * @param function_id {string} The function to synthesize keys for
966
+ * @param inputs {Array} The inputs to the function
967
+ * @param imports {Object | undefined} The imports for the program
968
+ * @param {PrivateKey} private_key
969
+ * @param {string} program
970
+ * @param {string} function_id
971
+ * @param {Array<any>} inputs
972
+ * @param {object | undefined} [imports]
973
+ * @returns {Promise<KeyPair>}
974
+ */
975
+ static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object): Promise<KeyPair>;
976
+ }
977
+ /**
978
+ * Proving key for a function within an Aleo program
979
+ */
980
+ export class ProvingKey {
981
+ free(): void;
982
+ /**
983
+ * Verify if the proving key is for the bond_public function
984
+ *
985
+ * @example
986
+ * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
987
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
988
+ *
989
+ * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
990
+ * @returns {boolean}
991
+ */
992
+ isBondPublicProver(): boolean;
993
+ /**
994
+ * Verify if the proving key is for the bond_validator function
995
+ *
996
+ * @example
997
+ * const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
998
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
999
+ *
1000
+ * @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
1001
+ * @returns {boolean}
1002
+ */
1003
+ isBondValidatorProver(): boolean;
1004
+ /**
1005
+ * Verify if the proving key is for the claim_unbond function
1006
+ *
1007
+ * @example
1008
+ * const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
1009
+ * provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
1010
+ *
1011
+ * @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
1012
+ * @returns {boolean}
1013
+ */
1014
+ isClaimUnbondPublicProver(): boolean;
1015
+ /**
1016
+ * Verify if the proving key is for the fee_private function
1017
+ *
1018
+ * @example
1019
+ * const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
1020
+ * provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1021
+ *
1022
+ * @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
1023
+ * @returns {boolean}
1024
+ */
1025
+ isFeePrivateProver(): boolean;
1026
+ /**
1027
+ * Verify if the proving key is for the fee_public function
1028
+ *
1029
+ * @example
1030
+ * const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
1031
+ * provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1032
+ *
1033
+ * @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
1034
+ * @returns {boolean}
1035
+ */
1036
+ isFeePublicProver(): boolean;
1037
+ /**
1038
+ * Verify if the proving key is for the inclusion function
1039
+ *
1040
+ * @example
1041
+ * const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
1042
+ * provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
1043
+ *
1044
+ * @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
1045
+ * @returns {boolean}
1046
+ */
1047
+ isInclusionProver(): boolean;
1048
+ /**
1049
+ * Verify if the proving key is for the join function
1050
+ *
1051
+ * @example
1052
+ * const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
1053
+ * provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
1054
+ *
1055
+ * @returns {boolean} returns true if the proving key is for the join function, false if otherwise
1056
+ * @returns {boolean}
1057
+ */
1058
+ isJoinProver(): boolean;
1059
+ /**
1060
+ * Verify if the proving key is for the set_validator_state function
1061
+ *
1062
+ * @example
1063
+ * const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
1064
+ * provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1065
+ *
1066
+ * @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
1067
+ * @returns {boolean}
1068
+ */
1069
+ isSetValidatorStateProver(): boolean;
1070
+ /**
1071
+ * Verify if the proving key is for the split function
1072
+ *
1073
+ * @example
1074
+ * const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
1075
+ * provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
1076
+ *
1077
+ * @returns {boolean} returns true if the proving key is for the split function, false if otherwise
1078
+ * @returns {boolean}
1079
+ */
1080
+ isSplitProver(): boolean;
1081
+ /**
1082
+ * Verify if the proving key is for the transfer_private function
1083
+ *
1084
+ * @example
1085
+ * const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
1086
+ * provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1087
+ *
1088
+ * @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
1089
+ * @returns {boolean}
1090
+ */
1091
+ isTransferPrivateProver(): boolean;
1092
+ /**
1093
+ * Verify if the proving key is for the transfer_private_to_public function
1094
+ *
1095
+ * @example
1096
+ * const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
1097
+ * provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1098
+ *
1099
+ * @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
1100
+ * @returns {boolean}
1101
+ */
1102
+ isTransferPrivateToPublicProver(): boolean;
1103
+ /**
1104
+ * Verify if the proving key is for the transfer_public function
1105
+ *
1106
+ * @example
1107
+ * const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
1108
+ * provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1109
+ *
1110
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
1111
+ * @returns {boolean}
1112
+ */
1113
+ isTransferPublicProver(): boolean;
1114
+ /**
1115
+ * Verify if the proving key is for the transfer_public_as_signer function
1116
+ *
1117
+ * @example
1118
+ * const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
1119
+ * provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
1120
+ *
1121
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
1122
+ * @returns {boolean}
1123
+ */
1124
+ isTransferPublicAsSignerProver(): boolean;
1125
+ /**
1126
+ * Verify if the proving key is for the transfer_public_to_private function
1127
+ *
1128
+ * @example
1129
+ * const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
1130
+ * provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1131
+ *
1132
+ * @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
1133
+ * @returns {boolean}
1134
+ */
1135
+ isTransferPublicToPrivateProver(): boolean;
1136
+ /**
1137
+ * Verify if the proving key is for the unbond_public function
1138
+ *
1139
+ * @example
1140
+ * const provingKey = ProvingKey.fromBytes("unbond_public.bin");
1141
+ * provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1142
+ *
1143
+ * @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
1144
+ * @returns {boolean}
1145
+ */
1146
+ isUnbondPublicProver(): boolean;
1147
+ /**
1148
+ * Return the checksum of the proving key
1149
+ *
1150
+ * @returns {string} Checksum of the proving key
1151
+ * @returns {string}
1152
+ */
1153
+ checksum(): string;
1154
+ /**
1155
+ * Create a copy of the proving key
1156
+ *
1157
+ * @returns {ProvingKey} A copy of the proving key
1158
+ * @returns {ProvingKey}
1159
+ */
1160
+ copy(): ProvingKey;
1161
+ /**
1162
+ * Construct a new proving key from a byte array
1163
+ *
1164
+ * @param {Uint8Array} bytes Byte array representation of a proving key
1165
+ * @returns {ProvingKey | Error}
1166
+ * @param {Uint8Array} bytes
1167
+ * @returns {ProvingKey}
1168
+ */
1169
+ static fromBytes(bytes: Uint8Array): ProvingKey;
1170
+ /**
1171
+ * Create a proving key from string
1172
+ *
1173
+ * @param {string | Error} String representation of the proving key
1174
+ * @param {string} string
1175
+ * @returns {ProvingKey}
1176
+ */
1177
+ static fromString(string: string): ProvingKey;
1178
+ /**
1179
+ * Return the byte representation of a proving key
1180
+ *
1181
+ * @returns {Uint8Array | Error} Byte array representation of a proving key
1182
+ * @returns {Uint8Array}
1183
+ */
1184
+ toBytes(): Uint8Array;
1185
+ /**
1186
+ * Get a string representation of the proving key
1187
+ *
1188
+ * @returns {string} String representation of the proving key
1189
+ * @returns {string}
1190
+ */
1191
+ toString(): string;
1192
+ }
1193
+ /**
1194
+ * Encrypted Aleo record
1195
+ */
1196
+ export class RecordCiphertext {
1197
+ free(): void;
1198
+ /**
1199
+ * Create a record ciphertext from a string
1200
+ *
1201
+ * @param {string} record String representation of a record ciphertext
1202
+ * @returns {RecordCiphertext | Error} Record ciphertext
1203
+ * @param {string} record
1204
+ * @returns {RecordCiphertext}
1205
+ */
1206
+ static fromString(record: string): RecordCiphertext;
1207
+ /**
1208
+ * Return the string reprensentation of the record ciphertext
1209
+ *
1210
+ * @returns {string} String representation of the record ciphertext
1211
+ * @returns {string}
1212
+ */
1213
+ toString(): string;
1214
+ /**
1215
+ * Decrypt the record ciphertext into plaintext using the view key. The record will only
1216
+ * decrypt if the record was encrypted by the account corresponding to the view key
1217
+ *
1218
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
1219
+ * @returns {RecordPlaintext | Error} Record plaintext object
1220
+ * @param {ViewKey} view_key
1221
+ * @returns {RecordPlaintext}
1222
+ */
1223
+ decrypt(view_key: ViewKey): RecordPlaintext;
1224
+ /**
1225
+ * Determines if the account corresponding to the view key is the owner of the record
1226
+ *
1227
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
1228
+ * @returns {boolean}
1229
+ * @param {ViewKey} view_key
1230
+ * @returns {boolean}
1231
+ */
1232
+ isOwner(view_key: ViewKey): boolean;
1233
+ }
1234
+ /**
1235
+ * Plaintext representation of an Aleo record
1236
+ */
1237
+ export class RecordPlaintext {
1238
+ free(): void;
1239
+ /**
1240
+ * @param {string} program_id
1241
+ * @param {string} record_name
1242
+ * @returns {Field}
1243
+ */
1244
+ commitment(program_id: string, record_name: string): Field;
1245
+ /**
1246
+ * Return a record plaintext from a string.
1247
+ *
1248
+ * @param {string} record String representation of a plaintext representation of an Aleo record
1249
+ * @returns {RecordPlaintext | Error} Record plaintext
1250
+ * @param {string} record
1251
+ * @returns {RecordPlaintext}
1252
+ */
1253
+ static fromString(record: string): RecordPlaintext;
1254
+ /**
1255
+ * Returns the record plaintext string
1256
+ *
1257
+ * @returns {string} String representation of the record plaintext
1258
+ * @returns {string}
1259
+ */
1260
+ toString(): string;
1261
+ /**
1262
+ * Returns the amount of microcredits in the record
1263
+ *
1264
+ * @returns {u64} Amount of microcredits in the record
1265
+ * @returns {bigint}
1266
+ */
1267
+ microcredits(): bigint;
1268
+ /**
1269
+ * Returns the nonce of the record. This can be used to uniquely identify a record.
1270
+ *
1271
+ * @returns {string} Nonce of the record
1272
+ * @returns {string}
1273
+ */
1274
+ nonce(): string;
1275
+ /**
1276
+ * Attempt to get the serial number of a record to determine whether or not is has been spent
1277
+ *
1278
+ * @param {PrivateKey} private_key Private key of the account that owns the record
1279
+ * @param {string} program_id Program ID of the program that the record is associated with
1280
+ * @param {string} record_name Name of the record
1281
+ * @returns {string | Error} Serial number of the record
1282
+ * @param {PrivateKey} private_key
1283
+ * @param {string} program_id
1284
+ * @param {string} record_name
1285
+ * @returns {string}
1286
+ */
1287
+ serialNumberString(private_key: PrivateKey, program_id: string, record_name: string): string;
1288
+ }
1289
+ /**
1290
+ * Cryptographic signature of a message signed by an Aleo account
1291
+ */
1292
+ export class Signature {
1293
+ free(): void;
1294
+ /**
1295
+ * Sign a message with a private key
1296
+ *
1297
+ * @param {PrivateKey} private_key The private key to sign the message with
1298
+ * @param {Uint8Array} message Byte representation of the message to sign
1299
+ * @returns {Signature} Signature of the message
1300
+ * @param {PrivateKey} private_key
1301
+ * @param {Uint8Array} message
1302
+ * @returns {Signature}
1303
+ */
1304
+ static sign(private_key: PrivateKey, message: Uint8Array): Signature;
1305
+ /**
1306
+ * Verify a signature of a message with an address
1307
+ *
1308
+ * @param {Address} address The address to verify the signature with
1309
+ * @param {Uint8Array} message Byte representation of the message to verify
1310
+ * @returns {boolean} True if the signature is valid, false otherwise
1311
+ * @param {Address} address
1312
+ * @param {Uint8Array} message
1313
+ * @returns {boolean}
1314
+ */
1315
+ verify(address: Address, message: Uint8Array): boolean;
1316
+ /**
1317
+ * Get a signature from a string representation of a signature
1318
+ *
1319
+ * @param {string} signature String representation of a signature
1320
+ * @returns {Signature} Signature
1321
+ * @param {string} signature
1322
+ * @returns {Signature}
1323
+ */
1324
+ static from_string(signature: string): Signature;
1325
+ /**
1326
+ * Get a string representation of a signature
1327
+ *
1328
+ * @returns {string} String representation of a signature
1329
+ * @returns {string}
1330
+ */
1331
+ to_string(): string;
1332
+ }
1333
+ /**
1334
+ * Webassembly Representation of an Aleo transaction
1335
+ *
1336
+ * This object is created when generating an on-chain function deployment or execution and is the
1337
+ * object that should be submitted to the Aleo Network in order to deploy or execute a function.
1338
+ */
1339
+ export class Transaction {
1340
+ free(): void;
1341
+ /**
1342
+ * Create a transaction from a string
1343
+ *
1344
+ * @param {string} transaction String representation of a transaction
1345
+ * @returns {Transaction | Error}
1346
+ * @param {string} transaction
1347
+ * @returns {Transaction}
1348
+ */
1349
+ static fromString(transaction: string): Transaction;
1350
+ /**
1351
+ * Get the transaction as a string. If you want to submit this transaction to the Aleo Network
1352
+ * this function will create the string that should be submitted in the `POST` data.
1353
+ *
1354
+ * @returns {string} String representation of the transaction
1355
+ * @returns {string}
1356
+ */
1357
+ toString(): string;
1358
+ /**
1359
+ * Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
1360
+ *
1361
+ * This value can be used to query the status of the transaction on the Aleo Network to see
1362
+ * if it was successful. If successful, the transaction will be included in a block and this
1363
+ * value can be used to lookup the transaction data on-chain.
1364
+ *
1365
+ * @returns {string} Transaction id
1366
+ * @returns {string}
1367
+ */
1368
+ transactionId(): string;
1369
+ /**
1370
+ * Get the type of the transaction (will return "deploy" or "execute")
1371
+ *
1372
+ * @returns {string} Transaction type
1373
+ * @returns {string}
1374
+ */
1375
+ transactionType(): string;
1376
+ }
1377
+ /**
1378
+ * Verifying key for a function within an Aleo program
1379
+ */
1380
+ export class VerifyingKey {
1381
+ free(): void;
1382
+ /**
1383
+ * Returns the verifying key for the bond_public function
1384
+ *
1385
+ * @returns {VerifyingKey} Verifying key for the bond_public function
1386
+ * @returns {VerifyingKey}
1387
+ */
1388
+ static bondPublicVerifier(): VerifyingKey;
1389
+ /**
1390
+ * Returns the verifying key for the bond_validator function
1391
+ *
1392
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
1393
+ * @returns {VerifyingKey}
1394
+ */
1395
+ static bondValidatorVerifier(): VerifyingKey;
1396
+ /**
1397
+ * Returns the verifying key for the claim_delegator function
1398
+ *
1399
+ * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
1400
+ * @returns {VerifyingKey}
1401
+ */
1402
+ static claimUnbondPublicVerifier(): VerifyingKey;
1403
+ /**
1404
+ * Returns the verifying key for the fee_private function
1405
+ *
1406
+ * @returns {VerifyingKey} Verifying key for the fee_private function
1407
+ * @returns {VerifyingKey}
1408
+ */
1409
+ static feePrivateVerifier(): VerifyingKey;
1410
+ /**
1411
+ * Returns the verifying key for the fee_public function
1412
+ *
1413
+ * @returns {VerifyingKey} Verifying key for the fee_public function
1414
+ * @returns {VerifyingKey}
1415
+ */
1416
+ static feePublicVerifier(): VerifyingKey;
1417
+ /**
1418
+ * Returns the verifying key for the inclusion function
1419
+ *
1420
+ * @returns {VerifyingKey} Verifying key for the inclusion function
1421
+ * @returns {VerifyingKey}
1422
+ */
1423
+ static inclusionVerifier(): VerifyingKey;
1424
+ /**
1425
+ * Returns the verifying key for the join function
1426
+ *
1427
+ * @returns {VerifyingKey} Verifying key for the join function
1428
+ * @returns {VerifyingKey}
1429
+ */
1430
+ static joinVerifier(): VerifyingKey;
1431
+ /**
1432
+ * Returns the verifying key for the set_validator_state function
1433
+ *
1434
+ * @returns {VerifyingKey} Verifying key for the set_validator_state function
1435
+ * @returns {VerifyingKey}
1436
+ */
1437
+ static setValidatorStateVerifier(): VerifyingKey;
1438
+ /**
1439
+ * Returns the verifying key for the split function
1440
+ *
1441
+ * @returns {VerifyingKey} Verifying key for the split function
1442
+ * @returns {VerifyingKey}
1443
+ */
1444
+ static splitVerifier(): VerifyingKey;
1445
+ /**
1446
+ * Returns the verifying key for the transfer_private function
1447
+ *
1448
+ * @returns {VerifyingKey} Verifying key for the transfer_private function
1449
+ * @returns {VerifyingKey}
1450
+ */
1451
+ static transferPrivateVerifier(): VerifyingKey;
1452
+ /**
1453
+ * Returns the verifying key for the transfer_private_to_public function
1454
+ *
1455
+ * @returns {VerifyingKey} Verifying key for the transfer_private_to_public function
1456
+ * @returns {VerifyingKey}
1457
+ */
1458
+ static transferPrivateToPublicVerifier(): VerifyingKey;
1459
+ /**
1460
+ * Returns the verifying key for the transfer_public function
1461
+ *
1462
+ * @returns {VerifyingKey} Verifying key for the transfer_public function
1463
+ * @returns {VerifyingKey}
1464
+ */
1465
+ static transferPublicVerifier(): VerifyingKey;
1466
+ /**
1467
+ * Returns the verifying key for the transfer_public_as_signer function
1468
+ *
1469
+ * @returns {VerifyingKey} Verifying key for the transfer_public_as_signer function
1470
+ * @returns {VerifyingKey}
1471
+ */
1472
+ static transferPublicAsSignerVerifier(): VerifyingKey;
1473
+ /**
1474
+ * Returns the verifying key for the transfer_public_to_private function
1475
+ *
1476
+ * @returns {VerifyingKey} Verifying key for the transfer_public_to_private function
1477
+ * @returns {VerifyingKey}
1478
+ */
1479
+ static transferPublicToPrivateVerifier(): VerifyingKey;
1480
+ /**
1481
+ * Returns the verifying key for the unbond_public function
1482
+ *
1483
+ * @returns {VerifyingKey} Verifying key for the unbond_public function
1484
+ * @returns {VerifyingKey}
1485
+ */
1486
+ static unbondPublicVerifier(): VerifyingKey;
1487
+ /**
1488
+ * Returns the verifying key for the bond_public function
1489
+ *
1490
+ * @returns {VerifyingKey} Verifying key for the bond_public function
1491
+ * @returns {boolean}
1492
+ */
1493
+ isBondPublicVerifier(): boolean;
1494
+ /**
1495
+ * Returns the verifying key for the bond_validator function
1496
+ *
1497
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
1498
+ * @returns {boolean}
1499
+ */
1500
+ isBondValidatorVerifier(): boolean;
1501
+ /**
1502
+ * Verifies the verifying key is for the claim_delegator function
1503
+ *
1504
+ * @returns {bool}
1505
+ * @returns {boolean}
1506
+ */
1507
+ isClaimUnbondPublicVerifier(): boolean;
1508
+ /**
1509
+ * Verifies the verifying key is for the fee_private function
1510
+ *
1511
+ * @returns {bool}
1512
+ * @returns {boolean}
1513
+ */
1514
+ isFeePrivateVerifier(): boolean;
1515
+ /**
1516
+ * Verifies the verifying key is for the fee_public function
1517
+ *
1518
+ * @returns {bool}
1519
+ * @returns {boolean}
1520
+ */
1521
+ isFeePublicVerifier(): boolean;
1522
+ /**
1523
+ * Verifies the verifying key is for the inclusion function
1524
+ *
1525
+ * @returns {bool}
1526
+ * @returns {boolean}
1527
+ */
1528
+ isInclusionVerifier(): boolean;
1529
+ /**
1530
+ * Verifies the verifying key is for the join function
1531
+ *
1532
+ * @returns {bool}
1533
+ * @returns {boolean}
1534
+ */
1535
+ isJoinVerifier(): boolean;
1536
+ /**
1537
+ * Verifies the verifying key is for the set_validator_state function
1538
+ *
1539
+ * @returns {bool}
1540
+ * @returns {boolean}
1541
+ */
1542
+ isSetValidatorStateVerifier(): boolean;
1543
+ /**
1544
+ * Verifies the verifying key is for the split function
1545
+ *
1546
+ * @returns {bool}
1547
+ * @returns {boolean}
1548
+ */
1549
+ isSplitVerifier(): boolean;
1550
+ /**
1551
+ * Verifies the verifying key is for the transfer_private function
1552
+ *
1553
+ * @returns {bool}
1554
+ * @returns {boolean}
1555
+ */
1556
+ isTransferPrivateVerifier(): boolean;
1557
+ /**
1558
+ * Verifies the verifying key is for the transfer_private_to_public function
1559
+ *
1560
+ * @returns {bool}
1561
+ * @returns {boolean}
1562
+ */
1563
+ isTransferPrivateToPublicVerifier(): boolean;
1564
+ /**
1565
+ * Verifies the verifying key is for the transfer_public function
1566
+ *
1567
+ * @returns {bool}
1568
+ * @returns {boolean}
1569
+ */
1570
+ isTransferPublicVerifier(): boolean;
1571
+ /**
1572
+ * Verifies the verifying key is for the transfer_public_as_signer function
1573
+ *
1574
+ * @returns {bool}
1575
+ * @returns {boolean}
1576
+ */
1577
+ isTransferPublicAsSignerVerifier(): boolean;
1578
+ /**
1579
+ * Verifies the verifying key is for the transfer_public_to_private function
1580
+ *
1581
+ * @returns {bool}
1582
+ * @returns {boolean}
1583
+ */
1584
+ isTransferPublicToPrivateVerifier(): boolean;
1585
+ /**
1586
+ * Verifies the verifying key is for the unbond_public function
1587
+ *
1588
+ * @returns {bool}
1589
+ * @returns {boolean}
1590
+ */
1591
+ isUnbondPublicVerifier(): boolean;
1592
+ /**
1593
+ * Get the checksum of the verifying key
1594
+ *
1595
+ * @returns {string} Checksum of the verifying key
1596
+ * @returns {string}
1597
+ */
1598
+ checksum(): string;
1599
+ /**
1600
+ * Create a copy of the verifying key
1601
+ *
1602
+ * @returns {VerifyingKey} A copy of the verifying key
1603
+ * @returns {VerifyingKey}
1604
+ */
1605
+ copy(): VerifyingKey;
1606
+ /**
1607
+ * Construct a new verifying key from a byte array
1608
+ *
1609
+ * @param {Uint8Array} bytes Byte representation of a verifying key
1610
+ * @returns {VerifyingKey | Error}
1611
+ * @param {Uint8Array} bytes
1612
+ * @returns {VerifyingKey}
1613
+ */
1614
+ static fromBytes(bytes: Uint8Array): VerifyingKey;
1615
+ /**
1616
+ * Create a verifying key from string
1617
+ *
1618
+ * @param {String} string String representation of a verifying key
1619
+ * @returns {VerifyingKey | Error}
1620
+ * @param {string} string
1621
+ * @returns {VerifyingKey}
1622
+ */
1623
+ static fromString(string: string): VerifyingKey;
1624
+ /**
1625
+ * Create a byte array from a verifying key
1626
+ *
1627
+ * @returns {Uint8Array | Error} Byte representation of a verifying key
1628
+ * @returns {Uint8Array}
1629
+ */
1630
+ toBytes(): Uint8Array;
1631
+ /**
1632
+ * Get a string representation of the verifying key
1633
+ *
1634
+ * @returns {String} String representation of the verifying key
1635
+ * @returns {string}
1636
+ */
1637
+ toString(): string;
1638
+ }
1639
+ /**
1640
+ */
1641
+ export class ViewKey {
1642
+ free(): void;
1643
+ /**
1644
+ * Create a new view key from a private key
1645
+ *
1646
+ * @param {PrivateKey} private_key Private key
1647
+ * @returns {ViewKey} View key
1648
+ * @param {PrivateKey} private_key
1649
+ * @returns {ViewKey}
1650
+ */
1651
+ static from_private_key(private_key: PrivateKey): ViewKey;
1652
+ /**
1653
+ * Create a new view key from a string representation of a view key
1654
+ *
1655
+ * @param {string} view_key String representation of a view key
1656
+ * @returns {ViewKey} View key
1657
+ * @param {string} view_key
1658
+ * @returns {ViewKey}
1659
+ */
1660
+ static from_string(view_key: string): ViewKey;
1661
+ /**
1662
+ * Get a string representation of a view key
1663
+ *
1664
+ * @returns {string} String representation of a view key
1665
+ * @returns {string}
1666
+ */
1667
+ to_string(): string;
1668
+ /**
1669
+ * Get the address corresponding to a view key
1670
+ *
1671
+ * @returns {Address} Address
1672
+ * @returns {Address}
1673
+ */
1674
+ to_address(): Address;
1675
+ /**
1676
+ * Decrypt a record ciphertext with a view key
1677
+ *
1678
+ * @param {string} ciphertext String representation of a record ciphertext
1679
+ * @returns {string} String representation of a record plaintext
1680
+ * @param {string} ciphertext
1681
+ * @returns {string}
1682
+ */
1683
+ decrypt(ciphertext: string): string;
1684
+ }