@puzzlehq/aleo-wasm-web 0.6.13 → 0.6.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/aleo_wasm.d.ts ADDED
@@ -0,0 +1,1989 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {number} receiver
5
+ */
6
+ export function runRayonThread(receiver: number): void;
7
+ /**
8
+ */
9
+ export function init_panic_hook(): void;
10
+ /**
11
+ * @param {URL} url
12
+ * @param {number} num_threads
13
+ * @returns {Promise<void>}
14
+ */
15
+ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
16
+ /**
17
+ * Verify an execution with a single function and a single transition. Executions with multiple
18
+ * transitions or functions will fail to verify. Also, this does not verify that the state root of
19
+ * the execution is included in the Aleo Network ledger.
20
+ *
21
+ * @param {Execution} execution The function execution to verify
22
+ * @param {VerifyingKey} verifying_key The verifying key for the function
23
+ * @param {Program} program The program that the function execution belongs to
24
+ * @param {String} function_id The name of the function that was executed
25
+ * @returns {boolean} True if the execution is valid, false otherwise
26
+ * @param {Execution} execution
27
+ * @param {VerifyingKey} verifying_key
28
+ * @param {Program} program
29
+ * @param {string} function_id
30
+ * @returns {boolean}
31
+ */
32
+ export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string): boolean;
33
+ /**
34
+ * Public address of an Aleo account
35
+ */
36
+ export class Address {
37
+ free(): void;
38
+ /**
39
+ * Derive an Aleo address from a private key
40
+ *
41
+ * @param {PrivateKey} private_key The private key to derive the address from
42
+ * @returns {Address} Address corresponding to the private key
43
+ * @param {PrivateKey} private_key
44
+ * @returns {Address}
45
+ */
46
+ static from_private_key(private_key: PrivateKey): Address;
47
+ /**
48
+ * Derive an Aleo address from a view key
49
+ *
50
+ * @param {ViewKey} view_key The view key to derive the address from
51
+ * @returns {Address} Address corresponding to the view key
52
+ * @param {ViewKey} view_key
53
+ * @returns {Address}
54
+ */
55
+ static from_view_key(view_key: ViewKey): Address;
56
+ /**
57
+ * Create an aleo address object from a string representation of an address
58
+ *
59
+ * @param {string} address String representation of an addressm
60
+ * @returns {Address} Address
61
+ * @param {string} address
62
+ * @returns {Address}
63
+ */
64
+ static from_string(address: string): Address;
65
+ /**
66
+ * Get a string representation of an Aleo address object
67
+ *
68
+ * @param {Address} Address
69
+ * @returns {string} String representation of the address
70
+ * @returns {string}
71
+ */
72
+ to_string(): string;
73
+ /**
74
+ * Verify a signature for a message signed by the address
75
+ *
76
+ * @param {Uint8Array} Byte array representing a message signed by the address
77
+ * @returns {boolean} Boolean representing whether or not the signature is valid
78
+ * @param {Uint8Array} message
79
+ * @param {Signature} signature
80
+ * @returns {boolean}
81
+ */
82
+ verify(message: Uint8Array, signature: Signature): boolean;
83
+ }
84
+ /**
85
+ */
86
+ export class AuthorizationResponse {
87
+ free(): void;
88
+ /**
89
+ */
90
+ readonly authorization: string;
91
+ /**
92
+ */
93
+ readonly fee_authorization: string;
94
+ }
95
+ /**
96
+ * Execution of an Aleo program.
97
+ */
98
+ export class Execution {
99
+ free(): void;
100
+ /**
101
+ * Returns the string representation of the execution.
102
+ * @returns {string}
103
+ */
104
+ toString(): string;
105
+ /**
106
+ * Creates an execution object from a string representation of an execution.
107
+ * @param {string} execution
108
+ * @returns {Execution}
109
+ */
110
+ static fromString(execution: string): Execution;
111
+ }
112
+ /**
113
+ * Webassembly Representation of an Aleo function execution response
114
+ *
115
+ * This object is returned by the execution of an Aleo function off-chain. It provides methods for
116
+ * retrieving the outputs of the function execution.
117
+ */
118
+ export class ExecutionResponse {
119
+ free(): void;
120
+ /**
121
+ * Get the outputs of the executed function
122
+ *
123
+ * @returns {Array} Array of strings representing the outputs of the function
124
+ * @returns {Array<any>}
125
+ */
126
+ getOutputs(): Array<any>;
127
+ /**
128
+ * Returns the execution object if present, null if otherwise.
129
+ *
130
+ * @returns {Execution | undefined} The execution object if present, null if otherwise
131
+ * @returns {Execution | undefined}
132
+ */
133
+ getExecution(): Execution | undefined;
134
+ /**
135
+ * Returns the program keys if present
136
+ * @returns {KeyPair}
137
+ */
138
+ getKeys(): KeyPair;
139
+ /**
140
+ * Returns the proving_key if the proving key was cached in the Execution response.
141
+ * Note the proving key is removed from the response object after the first call to this
142
+ * function. Subsequent calls will return null.
143
+ *
144
+ * @returns {ProvingKey | undefined} The proving key
145
+ * @returns {ProvingKey | undefined}
146
+ */
147
+ getProvingKey(): ProvingKey | undefined;
148
+ /**
149
+ * Returns the verifying_key associated with the program
150
+ *
151
+ * @returns {VerifyingKey} The verifying key
152
+ * @returns {VerifyingKey}
153
+ */
154
+ getVerifyingKey(): VerifyingKey;
155
+ /**
156
+ * Returns the function identifier
157
+ * @returns {string}
158
+ */
159
+ getFunctionId(): string;
160
+ /**
161
+ * Returns the program
162
+ * @returns {Program}
163
+ */
164
+ getProgram(): Program;
165
+ }
166
+ /**
167
+ */
168
+ export class Field {
169
+ free(): void;
170
+ /**
171
+ * @returns {string}
172
+ */
173
+ toString(): string;
174
+ /**
175
+ * @param {string} field
176
+ * @returns {Field}
177
+ */
178
+ static fromString(field: string): Field;
179
+ }
180
+ /**
181
+ */
182
+ export class JsField {
183
+ free(): void;
184
+ /**
185
+ * @param {PrivateKey} private_key
186
+ * @param {Uint8Array} message
187
+ * @param {Uint8Array} seed
188
+ * @returns {string}
189
+ */
190
+ static generate_message_leo(private_key: PrivateKey, message: Uint8Array, seed: Uint8Array): string;
191
+ /**
192
+ * @param {PrivateKey} private_key
193
+ * @param {Uint8Array} message
194
+ * @param {Uint8Array} seed
195
+ * @returns {string}
196
+ */
197
+ static generate_message_clients(private_key: PrivateKey, message: Uint8Array, seed: Uint8Array): string;
198
+ }
199
+ /**
200
+ * Key pair object containing both the function proving and verifying keys
201
+ */
202
+ export class KeyPair {
203
+ free(): void;
204
+ /**
205
+ * Create new key pair from proving and verifying keys
206
+ *
207
+ * @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
208
+ * @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
209
+ * @returns {KeyPair} Key pair object containing both the function proving and verifying keys
210
+ * @param {ProvingKey} proving_key
211
+ * @param {VerifyingKey} verifying_key
212
+ */
213
+ constructor(proving_key: ProvingKey, verifying_key: VerifyingKey);
214
+ /**
215
+ * Get the proving key. This method will remove the proving key from the key pair
216
+ *
217
+ * @returns {ProvingKey | Error}
218
+ * @returns {ProvingKey}
219
+ */
220
+ provingKey(): ProvingKey;
221
+ /**
222
+ * Get the verifying key. This method will remove the verifying key from the key pair
223
+ *
224
+ * @returns {VerifyingKey | Error}
225
+ * @returns {VerifyingKey}
226
+ */
227
+ verifyingKey(): VerifyingKey;
228
+ }
229
+ /**
230
+ */
231
+ export class Metadata {
232
+ free(): void;
233
+ /**
234
+ * @returns {string}
235
+ */
236
+ static baseUrl(): string;
237
+ /**
238
+ * @returns {Metadata}
239
+ */
240
+ static bond_public(): Metadata;
241
+ /**
242
+ * @returns {Metadata}
243
+ */
244
+ static bond_validator(): Metadata;
245
+ /**
246
+ * @returns {Metadata}
247
+ */
248
+ static claim_unbond_public(): Metadata;
249
+ /**
250
+ * @returns {Metadata}
251
+ */
252
+ static fee_private(): Metadata;
253
+ /**
254
+ * @returns {Metadata}
255
+ */
256
+ static fee_public(): Metadata;
257
+ /**
258
+ * @returns {Metadata}
259
+ */
260
+ static inclusion(): Metadata;
261
+ /**
262
+ * @returns {Metadata}
263
+ */
264
+ static join(): Metadata;
265
+ /**
266
+ * @returns {Metadata}
267
+ */
268
+ static set_validator_state(): Metadata;
269
+ /**
270
+ * @returns {Metadata}
271
+ */
272
+ static split(): Metadata;
273
+ /**
274
+ * @returns {Metadata}
275
+ */
276
+ static transfer_private(): Metadata;
277
+ /**
278
+ * @returns {Metadata}
279
+ */
280
+ static transfer_private_to_public(): Metadata;
281
+ /**
282
+ * @returns {Metadata}
283
+ */
284
+ static transfer_public(): Metadata;
285
+ /**
286
+ * @returns {Metadata}
287
+ */
288
+ static transfer_public_as_signer(): Metadata;
289
+ /**
290
+ * @returns {Metadata}
291
+ */
292
+ static transfer_public_to_private(): Metadata;
293
+ /**
294
+ * @returns {Metadata}
295
+ */
296
+ static unbond_public(): Metadata;
297
+ /**
298
+ */
299
+ locator: string;
300
+ /**
301
+ */
302
+ prover: string;
303
+ /**
304
+ */
305
+ verifier: string;
306
+ /**
307
+ */
308
+ verifyingKey: string;
309
+ }
310
+ /**
311
+ * An offline query object used to insert the global state root and state paths needed to create
312
+ * a valid inclusion proof offline.
313
+ */
314
+ export class OfflineQuery {
315
+ free(): void;
316
+ /**
317
+ * Creates a new offline query object. The state root is required to be passed in as a string
318
+ * @param {string} state_root
319
+ */
320
+ constructor(state_root: string);
321
+ /**
322
+ * Add a new state path to the offline query object.
323
+ *
324
+ * @param {string} commitment: The commitment corresponding to a record inpout
325
+ * @param {string} state_path: The state path corresponding to the commitment
326
+ * @param {string} commitment
327
+ * @param {string} state_path
328
+ */
329
+ addStatePath(commitment: string, state_path: string): void;
330
+ /**
331
+ * Get a json string representation of the offline query object
332
+ * @returns {string}
333
+ */
334
+ toString(): string;
335
+ /**
336
+ * Create an offline query object from a json string representation
337
+ * @param {string} s
338
+ * @returns {OfflineQuery}
339
+ */
340
+ static fromString(s: string): OfflineQuery;
341
+ }
342
+ /**
343
+ * Private key of an Aleo account
344
+ */
345
+ export class PrivateKey {
346
+ free(): void;
347
+ /**
348
+ * Generate a new private key using a cryptographically secure random number generator
349
+ *
350
+ * @returns {PrivateKey}
351
+ */
352
+ constructor();
353
+ /**
354
+ * Get a private key from a series of unchecked bytes
355
+ *
356
+ * @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
357
+ * @returns {PrivateKey}
358
+ * @param {Uint8Array} seed
359
+ * @returns {PrivateKey}
360
+ */
361
+ static from_seed_unchecked(seed: Uint8Array): PrivateKey;
362
+ /**
363
+ * Get a private key from a string representation of a private key
364
+ *
365
+ * @param {string} seed String representation of a private key
366
+ * @returns {PrivateKey}
367
+ * @param {string} private_key
368
+ * @returns {PrivateKey}
369
+ */
370
+ static from_string(private_key: string): PrivateKey;
371
+ /**
372
+ * Get a string representation of the private key. This function should be used very carefully
373
+ * as it exposes the private key plaintext
374
+ *
375
+ * @returns {string} String representation of a private key
376
+ * @returns {string}
377
+ */
378
+ to_string(): string;
379
+ /**
380
+ * Get a string representation of the seed. This function should be used very carefully
381
+ * as it exposes the private key seed
382
+ *
383
+ * @returns {string} String representation of a private key seed
384
+ * @returns {string}
385
+ */
386
+ to_seed(): string;
387
+ /**
388
+ * Get the view key corresponding to the private key
389
+ *
390
+ * @returns {ViewKey}
391
+ * @returns {ViewKey}
392
+ */
393
+ to_view_key(): ViewKey;
394
+ /**
395
+ * Get the address corresponding to the private key
396
+ *
397
+ * @returns {Address}
398
+ * @returns {Address}
399
+ */
400
+ to_address(): Address;
401
+ /**
402
+ * Sign a message with the private key
403
+ *
404
+ * @param {Uint8Array} Byte array representing a message signed by the address
405
+ * @returns {Signature} Signature generated by signing the message with the address
406
+ * @param {Uint8Array} message
407
+ * @returns {Signature}
408
+ */
409
+ sign(message: Uint8Array): Signature;
410
+ /**
411
+ * Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
412
+ * and will be needed to decrypt the private key later, so it should be stored securely
413
+ *
414
+ * @param {string} secret Secret used to encrypt the private key
415
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
416
+ * @param {string} secret
417
+ * @returns {PrivateKeyCiphertext}
418
+ */
419
+ static newEncrypted(secret: string): PrivateKeyCiphertext;
420
+ /**
421
+ * Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
422
+ * decrypt the private key later, so it should be stored securely
423
+ *
424
+ * @param {string} secret Secret used to encrypt the private key
425
+ * @returns {PrivateKeyCiphertext | Error} Ciphertext representation of the private key
426
+ * @param {string} secret
427
+ * @returns {PrivateKeyCiphertext}
428
+ */
429
+ toCiphertext(secret: string): PrivateKeyCiphertext;
430
+ /**
431
+ * Get private key from a private key ciphertext and secret originally used to encrypt it
432
+ *
433
+ * @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
434
+ * @param {string} secret Secret originally used to encrypt the private key
435
+ * @returns {PrivateKey | Error} Private key
436
+ * @param {PrivateKeyCiphertext} ciphertext
437
+ * @param {string} secret
438
+ * @returns {PrivateKey}
439
+ */
440
+ static fromPrivateKeyCiphertext(ciphertext: PrivateKeyCiphertext, secret: string): PrivateKey;
441
+ }
442
+ /**
443
+ * Private Key in ciphertext form
444
+ */
445
+ export class PrivateKeyCiphertext {
446
+ free(): void;
447
+ /**
448
+ * Encrypt a private key using a secret string. The secret is sensitive and will be needed to
449
+ * decrypt the private key later, so it should be stored securely
450
+ *
451
+ * @param {PrivateKey} private_key Private key to encrypt
452
+ * @param {string} secret Secret to encrypt the private key with
453
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
454
+ * @param {PrivateKey} private_key
455
+ * @param {string} secret
456
+ * @returns {PrivateKeyCiphertext}
457
+ */
458
+ static encryptPrivateKey(private_key: PrivateKey, secret: string): PrivateKeyCiphertext;
459
+ /**
460
+ * Decrypts a private ciphertext using a secret string. This must be the same secret used to
461
+ * encrypt the private key
462
+ *
463
+ * @param {string} secret Secret used to encrypt the private key
464
+ * @returns {PrivateKey | Error} Private key
465
+ * @param {string} secret
466
+ * @returns {PrivateKey}
467
+ */
468
+ decryptToPrivateKey(secret: string): PrivateKey;
469
+ /**
470
+ * Returns the ciphertext string
471
+ *
472
+ * @returns {string} Ciphertext string
473
+ * @returns {string}
474
+ */
475
+ toString(): string;
476
+ /**
477
+ * Creates a PrivateKeyCiphertext from a string
478
+ *
479
+ * @param {string} ciphertext Ciphertext string
480
+ * @returns {PrivateKeyCiphertext | Error} Private key ciphertext
481
+ * @param {string} ciphertext
482
+ * @returns {PrivateKeyCiphertext}
483
+ */
484
+ static fromString(ciphertext: string): PrivateKeyCiphertext;
485
+ }
486
+ /**
487
+ * Webassembly Representation of an Aleo program
488
+ */
489
+ export class Program {
490
+ free(): void;
491
+ /**
492
+ * Create a program from a program string
493
+ *
494
+ * @param {string} program Aleo program source code
495
+ * @returns {Program | Error} Program object
496
+ * @param {string} program
497
+ * @returns {Program}
498
+ */
499
+ static fromString(program: string): Program;
500
+ /**
501
+ * Get a string representation of the program
502
+ *
503
+ * @returns {string} String containing the program source code
504
+ * @returns {string}
505
+ */
506
+ toString(): string;
507
+ /**
508
+ * Determine if a function is present in the program
509
+ *
510
+ * @param {string} functionName Name of the function to check for
511
+ * @returns {boolean} True if the program is valid, false otherwise
512
+ * @param {string} function_name
513
+ * @returns {boolean}
514
+ */
515
+ hasFunction(function_name: string): boolean;
516
+ /**
517
+ * Get javascript array of functions names in the program
518
+ *
519
+ * @returns {Array} Array of all function names present in the program
520
+ *
521
+ * @example
522
+ * const expected_functions = [
523
+ * "mint",
524
+ * "transfer_private",
525
+ * "transfer_private_to_public",
526
+ * "transfer_public",
527
+ * "transfer_public_to_private",
528
+ * "join",
529
+ * "split",
530
+ * "fee"
531
+ * ]
532
+ *
533
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
534
+ * const credits_functions = credits_program.getFunctions();
535
+ * console.log(credits_functions === expected_functions); // Output should be "true"
536
+ * @returns {Array<any>}
537
+ */
538
+ getFunctions(): Array<any>;
539
+ /**
540
+ * Get a javascript object representation of the function inputs and types. This can be used
541
+ * to generate a web form to capture user inputs for an execution of a function.
542
+ *
543
+ * @param {string} function_name Name of the function to get inputs for
544
+ * @returns {Array | Error} Array of function inputs
545
+ *
546
+ * @example
547
+ * const expected_inputs = [
548
+ * {
549
+ * type:"record",
550
+ * visibility:"private",
551
+ * record:"credits",
552
+ * members:[
553
+ * {
554
+ * name:"microcredits",
555
+ * type:"u64",
556
+ * visibility:"private"
557
+ * }
558
+ * ],
559
+ * register:"r0"
560
+ * },
561
+ * {
562
+ * type:"address",
563
+ * visibility:"private",
564
+ * register:"r1"
565
+ * },
566
+ * {
567
+ * type:"u64",
568
+ * visibility:"private",
569
+ * register:"r2"
570
+ * }
571
+ * ];
572
+ *
573
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
574
+ * const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
575
+ * console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
576
+ * @param {string} function_name
577
+ * @returns {Array<any>}
578
+ */
579
+ getFunctionInputs(function_name: string): Array<any>;
580
+ /**
581
+ * Get a the list of a program's mappings and the names/types of their keys and values.
582
+ *
583
+ * @returns {Array | Error} - An array of objects representing the mappings in the program
584
+ * @example
585
+ * const expected_mappings = [
586
+ * {
587
+ * name: "account",
588
+ * key_name: "owner",
589
+ * key_type: "address",
590
+ * value_name: "microcredits",
591
+ * value_type: "u64"
592
+ * }
593
+ * ]
594
+ *
595
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
596
+ * const credits_mappings = credits_program.getMappings();
597
+ * console.log(credits_mappings === expected_mappings); // Output should be "true"
598
+ * @returns {Array<any>}
599
+ */
600
+ getMappings(): Array<any>;
601
+ /**
602
+ * Get a javascript object representation of a program record and its types
603
+ *
604
+ * @param {string} record_name Name of the record to get members for
605
+ * @returns {Object | Error} Object containing the record name, type, and members
606
+ *
607
+ * @example
608
+ *
609
+ * const expected_record = {
610
+ * type: "record",
611
+ * record: "Credits",
612
+ * members: [
613
+ * {
614
+ * name: "owner",
615
+ * type: "address",
616
+ * visibility: "private"
617
+ * },
618
+ * {
619
+ * name: "microcredits",
620
+ * type: "u64",
621
+ * visibility: "private"
622
+ * }
623
+ * ];
624
+ * };
625
+ *
626
+ * const credits_program = aleo_wasm.Program.getCreditsProgram();
627
+ * const credits_record = credits_program.getRecordMembers("Credits");
628
+ * console.log(credits_record === expected_record); // Output should be "true"
629
+ * @param {string} record_name
630
+ * @returns {object}
631
+ */
632
+ getRecordMembers(record_name: string): object;
633
+ /**
634
+ * Get a javascript object representation of a program struct and its types
635
+ *
636
+ * @param {string} struct_name Name of the struct to get members for
637
+ * @returns {Array | Error} Array containing the struct members
638
+ *
639
+ * @example
640
+ *
641
+ * const STRUCT_PROGRAM = "program token_issue.aleo;
642
+ *
643
+ * struct token_metadata:
644
+ * network as u32;
645
+ * version as u32;
646
+ *
647
+ * struct token:
648
+ * token_id as u32;
649
+ * metadata as token_metadata;
650
+ *
651
+ * function no_op:
652
+ * input r0 as u64;
653
+ * output r0 as u64;"
654
+ *
655
+ * const expected_struct_members = [
656
+ * {
657
+ * name: "token_id",
658
+ * type: "u32",
659
+ * },
660
+ * {
661
+ * name: "metadata",
662
+ * type: "struct",
663
+ * struct_id: "token_metadata",
664
+ * members: [
665
+ * {
666
+ * name: "network",
667
+ * type: "u32",
668
+ * }
669
+ * {
670
+ * name: "version",
671
+ * type: "u32",
672
+ * }
673
+ * ]
674
+ * }
675
+ * ];
676
+ *
677
+ * const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
678
+ * const struct_members = program.getStructMembers("token");
679
+ * console.log(struct_members === expected_struct_members); // Output should be "true"
680
+ * @param {string} struct_name
681
+ * @returns {Array<any>}
682
+ */
683
+ getStructMembers(struct_name: string): Array<any>;
684
+ /**
685
+ * Get the credits.aleo program
686
+ *
687
+ * @returns {Program} The credits.aleo program
688
+ * @returns {Program}
689
+ */
690
+ static getCreditsProgram(): Program;
691
+ /**
692
+ * Get the id of the program
693
+ *
694
+ * @returns {string} The id of the program
695
+ * @returns {string}
696
+ */
697
+ id(): string;
698
+ /**
699
+ * Get a unique address of the program
700
+ *
701
+ * @returns {Address} The address of the program
702
+ * @returns {Address}
703
+ */
704
+ address(): Address;
705
+ /**
706
+ * Determine equality with another program
707
+ *
708
+ * @param {Program} other The other program to compare
709
+ * @returns {boolean} True if the programs are equal, false otherwise
710
+ * @param {Program} other
711
+ * @returns {boolean}
712
+ */
713
+ isEqual(other: Program): boolean;
714
+ /**
715
+ * Get program_imports
716
+ *
717
+ * @returns {Array} The program imports
718
+ *
719
+ * @example
720
+ *
721
+ * const DOUBLE_TEST = "import multiply_test.aleo;
722
+ *
723
+ * program double_test.aleo;
724
+ *
725
+ * function double_it:
726
+ * input r0 as u32.private;
727
+ * call multiply_test.aleo/multiply 2u32 r0 into r1;
728
+ * output r1 as u32.private;";
729
+ *
730
+ * const expected_imports = [
731
+ * "multiply_test.aleo"
732
+ * ];
733
+ *
734
+ * const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
735
+ * const imports = program.getImports();
736
+ * console.log(imports === expected_imports); // Output should be "true"
737
+ * @returns {Array<any>}
738
+ */
739
+ getImports(): Array<any>;
740
+ }
741
+ /**
742
+ */
743
+ export class ProgramManager {
744
+ free(): void;
745
+ /**
746
+ * Synthesize proving and verifying keys for a program
747
+ *
748
+ * @param program {string} The program source code of the program to synthesize keys for
749
+ * @param function_id {string} The function to synthesize keys for
750
+ * @param inputs {Array} The inputs to the function
751
+ * @param imports {Object | undefined} The imports for the program
752
+ * @param {PrivateKey} private_key
753
+ * @param {string} program
754
+ * @param {string} function_id
755
+ * @param {Array<any>} inputs
756
+ * @param {object | undefined} [imports]
757
+ * @returns {Promise<KeyPair>}
758
+ */
759
+ static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object): Promise<KeyPair>;
760
+ /**
761
+ * Send credits from one Aleo account to another
762
+ *
763
+ * @param private_key The private key of the sender
764
+ * @param amount_credits The amount of credits to send
765
+ * @param recipient The recipient of the transaction
766
+ * @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
767
+ * @param amount_record The record to fund the amount from
768
+ * @param fee_credits The amount of credits to pay as a fee
769
+ * @param fee_record The record to spend the fee from
770
+ * @param url The url of the Aleo network node to send the transaction to
771
+ * @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
772
+ * function
773
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
774
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
775
+ * @returns {Transaction | Error}
776
+ * @param {PrivateKey} private_key
777
+ * @param {number} amount_credits
778
+ * @param {string} recipient
779
+ * @param {string} transfer_type
780
+ * @param {string | undefined} caller
781
+ * @param {RecordPlaintext | undefined} amount_record
782
+ * @param {number} fee_credits
783
+ * @param {RecordPlaintext | undefined} [fee_record]
784
+ * @param {string | undefined} [url]
785
+ * @param {ProvingKey | undefined} [transfer_proving_key]
786
+ * @param {VerifyingKey | undefined} [transfer_verifying_key]
787
+ * @param {ProvingKey | undefined} [fee_proving_key]
788
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
789
+ * @param {OfflineQuery | undefined} [offline_query]
790
+ * @returns {Promise<Transaction>}
791
+ */
792
+ static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, caller: string | undefined, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record?: RecordPlaintext, url?: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
793
+ /**
794
+ * Join two records together to create a new record with an amount of credits equal to the sum
795
+ * of the credits of the two original records
796
+ *
797
+ * @param private_key The private key of the sender
798
+ * @param record_1 The first record to combine
799
+ * @param record_2 The second record to combine
800
+ * @param fee_credits The amount of credits to pay as a fee
801
+ * @param fee_record The record to spend the fee from
802
+ * @param url The url of the Aleo network node to send the transaction to
803
+ * @param join_proving_key (optional) Provide a proving key to use for the join function
804
+ * @param join_verifying_key (optional) Provide a verifying key to use for the join function
805
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
806
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
807
+ * @returns {Transaction | Error} Transaction object
808
+ * @param {PrivateKey} private_key
809
+ * @param {RecordPlaintext} record_1
810
+ * @param {RecordPlaintext} record_2
811
+ * @param {number} fee_credits
812
+ * @param {RecordPlaintext | undefined} [fee_record]
813
+ * @param {string | undefined} [url]
814
+ * @param {ProvingKey | undefined} [join_proving_key]
815
+ * @param {VerifyingKey | undefined} [join_verifying_key]
816
+ * @param {ProvingKey | undefined} [fee_proving_key]
817
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
818
+ * @param {OfflineQuery | undefined} [offline_query]
819
+ * @returns {Promise<Transaction>}
820
+ */
821
+ 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>;
822
+ /**
823
+ * Split an Aleo credits record into two separate records. This function does not require a fee.
824
+ *
825
+ * @param private_key The private key of the sender
826
+ * @param split_amount The amount of the credit split. This amount will be subtracted from the
827
+ * value of the record and two new records will be created with the split amount and the remainder
828
+ * @param amount_record The record to split
829
+ * @param url The url of the Aleo network node to send the transaction to
830
+ * @param split_proving_key (optional) Provide a proving key to use for the split function
831
+ * @param split_verifying_key (optional) Provide a verifying key to use for the split function
832
+ * @returns {Transaction | Error} Transaction object
833
+ * @param {PrivateKey} private_key
834
+ * @param {number} split_amount
835
+ * @param {RecordPlaintext} amount_record
836
+ * @param {string | undefined} [url]
837
+ * @param {ProvingKey | undefined} [split_proving_key]
838
+ * @param {VerifyingKey | undefined} [split_verifying_key]
839
+ * @param {OfflineQuery | undefined} [offline_query]
840
+ * @returns {Promise<Transaction>}
841
+ */
842
+ static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string, split_proving_key?: ProvingKey, split_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
843
+ /**
844
+ * Deploy an Aleo program
845
+ *
846
+ * @param private_key The private key of the sender
847
+ * @param program The source code of the program being deployed
848
+ * @param imports A javascript object holding the source code of any imported programs in the
849
+ * form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
850
+ * Note that all imported programs must be deployed on chain before the main program in order
851
+ * for the deployment to succeed
852
+ * @param fee_credits The amount of credits to pay as a fee
853
+ * @param fee_record The record to spend the fee from
854
+ * @param url The url of the Aleo network node to send the transaction to
855
+ * @param imports (optional) Provide a list of imports to use for the program deployment in the
856
+ * form of a javascript object where the keys are a string of the program name and the values
857
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
858
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
859
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
860
+ * @returns {Transaction | Error}
861
+ * @param {PrivateKey} private_key
862
+ * @param {string} program
863
+ * @param {number} fee_credits
864
+ * @param {RecordPlaintext | undefined} [fee_record]
865
+ * @param {string | undefined} [url]
866
+ * @param {object | undefined} [imports]
867
+ * @param {ProvingKey | undefined} [fee_proving_key]
868
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
869
+ * @param {OfflineQuery | undefined} [offline_query]
870
+ * @returns {Promise<Transaction>}
871
+ */
872
+ 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>;
873
+ /**
874
+ * Estimate the fee for a program deployment
875
+ *
876
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
877
+ *
878
+ * @param program The source code of the program being deployed
879
+ * @param imports (optional) Provide a list of imports to use for the deployment fee estimation
880
+ * in the form of a javascript object where the keys are a string of the program name and the values
881
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
882
+ * @returns {u64 | Error}
883
+ * @param {string} program
884
+ * @param {object | undefined} [imports]
885
+ * @returns {Promise<bigint>}
886
+ */
887
+ static estimateDeploymentFee(program: string, imports?: object): Promise<bigint>;
888
+ /**
889
+ * Estimate the component of the deployment cost which comes from the fee for the program name.
890
+ * Note that this cost does not represent the entire cost of deployment. It is additional to
891
+ * the cost of the size (in bytes) of the deployment.
892
+ *
893
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
894
+ *
895
+ * @param name The name of the program to be deployed
896
+ * @returns {u64 | Error}
897
+ * @param {string} name
898
+ * @returns {bigint}
899
+ */
900
+ static estimateProgramNameCost(name: string): bigint;
901
+ /**
902
+ * @param {string} program
903
+ * @param {string} function_id
904
+ * @param {Array<any>} inputs_str
905
+ * @param {string} private_key
906
+ * @param {object | undefined} imports
907
+ * @param {bigint} fee_microcredits
908
+ * @param {string | undefined} [fee_record]
909
+ * @returns {Promise<AuthorizationResponse>}
910
+ */
911
+ static authExecute(program: string, function_id: string, inputs_str: Array<any>, private_key: string, imports: object | undefined, fee_microcredits: bigint, fee_record?: string): Promise<AuthorizationResponse>;
912
+ /**
913
+ * Execute an arbitrary function locally
914
+ *
915
+ * @param {PrivateKey} private_key The private key of the sender
916
+ * @param {string} program The source code of the program being executed
917
+ * @param {string} function The name of the function to execute
918
+ * @param {Array} inputs A javascript array of inputs to the function
919
+ * @param {boolean} prove_execution If true, the execution will be proven and an execution object
920
+ * containing the proof and the encrypted inputs and outputs needed to verify the proof offline
921
+ * will be returned.
922
+ * @param {boolean} cache Cache the proving and verifying keys in the Execution response.
923
+ * If this is set to 'true' the keys synthesized will be stored in the Execution Response
924
+ * and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
925
+ * method.
926
+ * @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
927
+ * form of a javascript object where the keys are a string of the program name and the values
928
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
929
+ * @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
930
+ * @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
931
+ * @param {PrivateKey} private_key
932
+ * @param {string} program
933
+ * @param {string} _function
934
+ * @param {Array<any>} inputs
935
+ * @param {boolean} prove_execution
936
+ * @param {boolean} cache
937
+ * @param {object | undefined} [imports]
938
+ * @param {ProvingKey | undefined} [proving_key]
939
+ * @param {VerifyingKey | undefined} [verifying_key]
940
+ * @param {string | undefined} [url]
941
+ * @param {OfflineQuery | undefined} [offline_query]
942
+ * @returns {Promise<ExecutionResponse>}
943
+ */
944
+ 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>;
945
+ /**
946
+ * Execute Aleo function and create an Aleo execution transaction
947
+ *
948
+ * @param private_key The private key of the sender
949
+ * @param program The source code of the program being executed
950
+ * @param function The name of the function to execute
951
+ * @param inputs A javascript array of inputs to the function
952
+ * @param fee_credits The amount of credits to pay as a fee
953
+ * @param fee_record The record to spend the fee from
954
+ * @param url The url of the Aleo network node to send the transaction to
955
+ * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
956
+ * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
957
+ * and used for subsequent transactions. If this is set to 'false' the proving and verifying
958
+ * keys will be deallocated from memory after the transaction is executed.
959
+ * @param imports (optional) Provide a list of imports to use for the function execution in the
960
+ * form of a javascript object where the keys are a string of the program name and the values
961
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
962
+ * @param proving_key (optional) Provide a verifying key to use for the function execution
963
+ * @param verifying_key (optional) Provide a verifying key to use for the function execution
964
+ * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
965
+ * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
966
+ * @returns {Transaction | Error}
967
+ * @param {PrivateKey} private_key
968
+ * @param {string} program
969
+ * @param {string} _function
970
+ * @param {Array<any>} inputs
971
+ * @param {number} fee_credits
972
+ * @param {RecordPlaintext | undefined} [fee_record]
973
+ * @param {string | undefined} [url]
974
+ * @param {object | undefined} [imports]
975
+ * @param {ProvingKey | undefined} [proving_key]
976
+ * @param {VerifyingKey | undefined} [verifying_key]
977
+ * @param {ProvingKey | undefined} [fee_proving_key]
978
+ * @param {VerifyingKey | undefined} [fee_verifying_key]
979
+ * @param {OfflineQuery | undefined} [offline_query]
980
+ * @returns {Promise<Transaction>}
981
+ */
982
+ 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>;
983
+ /**
984
+ * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
985
+ * verifying keys will be stored in the ProgramManager's memory and used for subsequent
986
+ * program executions.
987
+ *
988
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
989
+ *
990
+ * @param private_key The private key of the sender
991
+ * @param program The source code of the program to estimate the execution fee for
992
+ * @param function The name of the function to execute
993
+ * @param inputs A javascript array of inputs to the function
994
+ * @param url The url of the Aleo network node to send the transaction to
995
+ * @param imports (optional) Provide a list of imports to use for the fee estimation in the
996
+ * form of a javascript object where the keys are a string of the program name and the values
997
+ * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
998
+ * @param proving_key (optional) Provide a verifying key to use for the fee estimation
999
+ * @param verifying_key (optional) Provide a verifying key to use for the fee estimation
1000
+ * @returns {u64 | Error} Fee in microcredits
1001
+ * @param {PrivateKey} private_key
1002
+ * @param {string} program
1003
+ * @param {string} _function
1004
+ * @param {Array<any>} inputs
1005
+ * @param {string | undefined} [url]
1006
+ * @param {object | undefined} [imports]
1007
+ * @param {ProvingKey | undefined} [proving_key]
1008
+ * @param {VerifyingKey | undefined} [verifying_key]
1009
+ * @param {OfflineQuery | undefined} [offline_query]
1010
+ * @returns {Promise<bigint>}
1011
+ */
1012
+ 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>;
1013
+ /**
1014
+ * Estimate the finalize fee component for executing a function. This fee is additional to the
1015
+ * size of the execution of the program in bytes. If the function does not have a finalize
1016
+ * step, then the finalize fee is 0.
1017
+ *
1018
+ * Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
1019
+ *
1020
+ * @param program The program containing the function to estimate the finalize fee for
1021
+ * @param function The function to estimate the finalize fee for
1022
+ * @returns {u64 | Error} Fee in microcredits
1023
+ * @param {string} program
1024
+ * @param {string} _function
1025
+ * @returns {bigint}
1026
+ */
1027
+ static estimateFinalizeFee(program: string, _function: string): bigint;
1028
+ }
1029
+ /**
1030
+ * Proving key for a function within an Aleo program
1031
+ */
1032
+ export class ProvingKey {
1033
+ free(): void;
1034
+ /**
1035
+ * Verify if the proving key is for the bond_public function
1036
+ *
1037
+ * @example
1038
+ * const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
1039
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1040
+ *
1041
+ * @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
1042
+ * @returns {boolean}
1043
+ */
1044
+ isBondPublicProver(): boolean;
1045
+ /**
1046
+ * Verify if the proving key is for the bond_validator function
1047
+ *
1048
+ * @example
1049
+ * const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
1050
+ * provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1051
+ *
1052
+ * @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
1053
+ * @returns {boolean}
1054
+ */
1055
+ isBondValidatorProver(): boolean;
1056
+ /**
1057
+ * Verify if the proving key is for the claim_unbond function
1058
+ *
1059
+ * @example
1060
+ * const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
1061
+ * provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
1062
+ *
1063
+ * @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
1064
+ * @returns {boolean}
1065
+ */
1066
+ isClaimUnbondPublicProver(): boolean;
1067
+ /**
1068
+ * Verify if the proving key is for the fee_private function
1069
+ *
1070
+ * @example
1071
+ * const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
1072
+ * provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1073
+ *
1074
+ * @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
1075
+ * @returns {boolean}
1076
+ */
1077
+ isFeePrivateProver(): boolean;
1078
+ /**
1079
+ * Verify if the proving key is for the fee_public function
1080
+ *
1081
+ * @example
1082
+ * const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
1083
+ * provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1084
+ *
1085
+ * @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
1086
+ * @returns {boolean}
1087
+ */
1088
+ isFeePublicProver(): boolean;
1089
+ /**
1090
+ * Verify if the proving key is for the inclusion function
1091
+ *
1092
+ * @example
1093
+ * const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
1094
+ * provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
1095
+ *
1096
+ * @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
1097
+ * @returns {boolean}
1098
+ */
1099
+ isInclusionProver(): boolean;
1100
+ /**
1101
+ * Verify if the proving key is for the join function
1102
+ *
1103
+ * @example
1104
+ * const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
1105
+ * provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
1106
+ *
1107
+ * @returns {boolean} returns true if the proving key is for the join function, false if otherwise
1108
+ * @returns {boolean}
1109
+ */
1110
+ isJoinProver(): boolean;
1111
+ /**
1112
+ * Verify if the proving key is for the set_validator_state function
1113
+ *
1114
+ * @example
1115
+ * const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
1116
+ * provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1117
+ *
1118
+ * @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
1119
+ * @returns {boolean}
1120
+ */
1121
+ isSetValidatorStateProver(): boolean;
1122
+ /**
1123
+ * Verify if the proving key is for the split function
1124
+ *
1125
+ * @example
1126
+ * const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
1127
+ * provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
1128
+ *
1129
+ * @returns {boolean} returns true if the proving key is for the split function, false if otherwise
1130
+ * @returns {boolean}
1131
+ */
1132
+ isSplitProver(): boolean;
1133
+ /**
1134
+ * Verify if the proving key is for the transfer_private function
1135
+ *
1136
+ * @example
1137
+ * const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
1138
+ * provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1139
+ *
1140
+ * @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
1141
+ * @returns {boolean}
1142
+ */
1143
+ isTransferPrivateProver(): boolean;
1144
+ /**
1145
+ * Verify if the proving key is for the transfer_private_to_public function
1146
+ *
1147
+ * @example
1148
+ * const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
1149
+ * provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1150
+ *
1151
+ * @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
1152
+ * @returns {boolean}
1153
+ */
1154
+ isTransferPrivateToPublicProver(): boolean;
1155
+ /**
1156
+ * Verify if the proving key is for the transfer_public function
1157
+ *
1158
+ * @example
1159
+ * const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
1160
+ * provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1161
+ *
1162
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
1163
+ * @returns {boolean}
1164
+ */
1165
+ isTransferPublicProver(): boolean;
1166
+ /**
1167
+ * Verify if the proving key is for the transfer_public_as_signer function
1168
+ *
1169
+ * @example
1170
+ * const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
1171
+ * provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
1172
+ *
1173
+ * @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
1174
+ * @returns {boolean}
1175
+ */
1176
+ isTransferPublicAsSignerProver(): boolean;
1177
+ /**
1178
+ * Verify if the proving key is for the transfer_public_to_private function
1179
+ *
1180
+ * @example
1181
+ * const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
1182
+ * provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
1183
+ *
1184
+ * @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
1185
+ * @returns {boolean}
1186
+ */
1187
+ isTransferPublicToPrivateProver(): boolean;
1188
+ /**
1189
+ * Verify if the proving key is for the unbond_public function
1190
+ *
1191
+ * @example
1192
+ * const provingKey = ProvingKey.fromBytes("unbond_public.bin");
1193
+ * provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
1194
+ *
1195
+ * @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
1196
+ * @returns {boolean}
1197
+ */
1198
+ isUnbondPublicProver(): boolean;
1199
+ /**
1200
+ * Return the checksum of the proving key
1201
+ *
1202
+ * @returns {string} Checksum of the proving key
1203
+ * @returns {string}
1204
+ */
1205
+ checksum(): string;
1206
+ /**
1207
+ * Create a copy of the proving key
1208
+ *
1209
+ * @returns {ProvingKey} A copy of the proving key
1210
+ * @returns {ProvingKey}
1211
+ */
1212
+ copy(): ProvingKey;
1213
+ /**
1214
+ * Construct a new proving key from a byte array
1215
+ *
1216
+ * @param {Uint8Array} bytes Byte array representation of a proving key
1217
+ * @returns {ProvingKey | Error}
1218
+ * @param {Uint8Array} bytes
1219
+ * @returns {ProvingKey}
1220
+ */
1221
+ static fromBytes(bytes: Uint8Array): ProvingKey;
1222
+ /**
1223
+ * Create a proving key from string
1224
+ *
1225
+ * @param {string | Error} String representation of the proving key
1226
+ * @param {string} string
1227
+ * @returns {ProvingKey}
1228
+ */
1229
+ static fromString(string: string): ProvingKey;
1230
+ /**
1231
+ * Return the byte representation of a proving key
1232
+ *
1233
+ * @returns {Uint8Array | Error} Byte array representation of a proving key
1234
+ * @returns {Uint8Array}
1235
+ */
1236
+ toBytes(): Uint8Array;
1237
+ /**
1238
+ * Get a string representation of the proving key
1239
+ *
1240
+ * @returns {string} String representation of the proving key
1241
+ * @returns {string}
1242
+ */
1243
+ toString(): string;
1244
+ }
1245
+ /**
1246
+ * Encrypted Aleo record
1247
+ */
1248
+ export class RecordCiphertext {
1249
+ free(): void;
1250
+ /**
1251
+ * Create a record ciphertext from a string
1252
+ *
1253
+ * @param {string} record String representation of a record ciphertext
1254
+ * @returns {RecordCiphertext | Error} Record ciphertext
1255
+ * @param {string} record
1256
+ * @returns {RecordCiphertext}
1257
+ */
1258
+ static fromString(record: string): RecordCiphertext;
1259
+ /**
1260
+ * Return the string reprensentation of the record ciphertext
1261
+ *
1262
+ * @returns {string} String representation of the record ciphertext
1263
+ * @returns {string}
1264
+ */
1265
+ toString(): string;
1266
+ /**
1267
+ * Decrypt the record ciphertext into plaintext using the view key. The record will only
1268
+ * decrypt if the record was encrypted by the account corresponding to the view key
1269
+ *
1270
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
1271
+ * @returns {RecordPlaintext | Error} Record plaintext object
1272
+ * @param {ViewKey} view_key
1273
+ * @returns {RecordPlaintext}
1274
+ */
1275
+ decrypt(view_key: ViewKey): RecordPlaintext;
1276
+ /**
1277
+ * Determines if the account corresponding to the view key is the owner of the record
1278
+ *
1279
+ * @param {ViewKey} view_key View key used to decrypt the ciphertext
1280
+ * @returns {boolean}
1281
+ * @param {ViewKey} view_key
1282
+ * @returns {boolean}
1283
+ */
1284
+ isOwner(view_key: ViewKey): boolean;
1285
+ }
1286
+ /**
1287
+ * Plaintext representation of an Aleo record
1288
+ */
1289
+ export class RecordPlaintext {
1290
+ free(): void;
1291
+ /**
1292
+ * @param {string} program_id
1293
+ * @param {string} record_name
1294
+ * @returns {Field}
1295
+ */
1296
+ commitment(program_id: string, record_name: string): Field;
1297
+ /**
1298
+ * Return a record plaintext from a string.
1299
+ *
1300
+ * @param {string} record String representation of a plaintext representation of an Aleo record
1301
+ * @returns {RecordPlaintext | Error} Record plaintext
1302
+ * @param {string} record
1303
+ * @returns {RecordPlaintext}
1304
+ */
1305
+ static fromString(record: string): RecordPlaintext;
1306
+ /**
1307
+ * Returns the record plaintext string
1308
+ *
1309
+ * @returns {string} String representation of the record plaintext
1310
+ * @returns {string}
1311
+ */
1312
+ toString(): string;
1313
+ /**
1314
+ * Returns the amount of microcredits in the record
1315
+ *
1316
+ * @returns {u64} Amount of microcredits in the record
1317
+ * @returns {bigint}
1318
+ */
1319
+ microcredits(): bigint;
1320
+ /**
1321
+ * Returns the nonce of the record. This can be used to uniquely identify a record.
1322
+ *
1323
+ * @returns {string} Nonce of the record
1324
+ * @returns {string}
1325
+ */
1326
+ nonce(): string;
1327
+ /**
1328
+ * Attempt to get the serial number of a record to determine whether or not is has been spent
1329
+ *
1330
+ * @param {PrivateKey} private_key Private key of the account that owns the record
1331
+ * @param {string} program_id Program ID of the program that the record is associated with
1332
+ * @param {string} record_name Name of the record
1333
+ * @returns {string | Error} Serial number of the record
1334
+ * @param {PrivateKey} private_key
1335
+ * @param {string} program_id
1336
+ * @param {string} record_name
1337
+ * @returns {string}
1338
+ */
1339
+ serialNumberString(private_key: PrivateKey, program_id: string, record_name: string): string;
1340
+ }
1341
+ /**
1342
+ * Cryptographic signature of a message signed by an Aleo account
1343
+ */
1344
+ export class Signature {
1345
+ free(): void;
1346
+ /**
1347
+ * Sign a message with a private key
1348
+ *
1349
+ * @param {PrivateKey} private_key The private key to sign the message with
1350
+ * @param {Uint8Array} message Byte representation of the message to sign
1351
+ * @returns {Signature} Signature of the message
1352
+ * @param {PrivateKey} private_key
1353
+ * @param {Uint8Array} message
1354
+ * @returns {Signature}
1355
+ */
1356
+ static sign(private_key: PrivateKey, message: Uint8Array): Signature;
1357
+ /**
1358
+ * @param {PrivateKey} private_key
1359
+ * @param {Uint8Array} message
1360
+ * @param {Uint8Array} seed
1361
+ * @returns {Signature}
1362
+ */
1363
+ static sign_message(private_key: PrivateKey, message: Uint8Array, seed: Uint8Array): Signature;
1364
+ /**
1365
+ * Ignore the mess below -- me testing things
1366
+ * Turn a message into bits
1367
+ *
1368
+ * @param {Uint8Array} message Byte representation of the message to sign
1369
+ * @returns {Vec<bool>} Vec of bool of the message
1370
+ * Verify a signature of a message with an address
1371
+ *
1372
+ * @param {Address} address The address to verify the signature with
1373
+ * @param {Uint8Array} message Byte representation of the message to verify
1374
+ * @returns {boolean} True if the signature is valid, false otherwise
1375
+ * @param {Address} address
1376
+ * @param {Uint8Array} message
1377
+ * @returns {boolean}
1378
+ */
1379
+ verify(address: Address, message: Uint8Array): boolean;
1380
+ /**
1381
+ * Get a signature from a string representation of a signature
1382
+ *
1383
+ * @param {string} signature String representation of a signature
1384
+ * @returns {Signature} Signature
1385
+ * @param {string} signature
1386
+ * @returns {Signature}
1387
+ */
1388
+ static from_string(signature: string): Signature;
1389
+ /**
1390
+ * Get a string representation of a signature
1391
+ *
1392
+ * @returns {string} String representation of a signature
1393
+ * @returns {string}
1394
+ */
1395
+ to_string(): string;
1396
+ }
1397
+ /**
1398
+ * Webassembly Representation of an Aleo transaction
1399
+ *
1400
+ * This object is created when generating an on-chain function deployment or execution and is the
1401
+ * object that should be submitted to the Aleo Network in order to deploy or execute a function.
1402
+ */
1403
+ export class Transaction {
1404
+ free(): void;
1405
+ /**
1406
+ * Create a transaction from a string
1407
+ *
1408
+ * @param {string} transaction String representation of a transaction
1409
+ * @returns {Transaction | Error}
1410
+ * @param {string} transaction
1411
+ * @returns {Transaction}
1412
+ */
1413
+ static fromString(transaction: string): Transaction;
1414
+ /**
1415
+ * Get the transaction as a string. If you want to submit this transaction to the Aleo Network
1416
+ * this function will create the string that should be submitted in the `POST` data.
1417
+ *
1418
+ * @returns {string} String representation of the transaction
1419
+ * @returns {string}
1420
+ */
1421
+ toString(): string;
1422
+ /**
1423
+ * Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
1424
+ *
1425
+ * This value can be used to query the status of the transaction on the Aleo Network to see
1426
+ * if it was successful. If successful, the transaction will be included in a block and this
1427
+ * value can be used to lookup the transaction data on-chain.
1428
+ *
1429
+ * @returns {string} Transaction id
1430
+ * @returns {string}
1431
+ */
1432
+ transactionId(): string;
1433
+ /**
1434
+ * Get the type of the transaction (will return "deploy" or "execute")
1435
+ *
1436
+ * @returns {string} Transaction type
1437
+ * @returns {string}
1438
+ */
1439
+ transactionType(): string;
1440
+ }
1441
+ /**
1442
+ * Verifying key for a function within an Aleo program
1443
+ */
1444
+ export class VerifyingKey {
1445
+ free(): void;
1446
+ /**
1447
+ * Get the checksum of the verifying key
1448
+ *
1449
+ * @returns {string} Checksum of the verifying key
1450
+ * @returns {string}
1451
+ */
1452
+ checksum(): string;
1453
+ /**
1454
+ * Create a copy of the verifying key
1455
+ *
1456
+ * @returns {VerifyingKey} A copy of the verifying key
1457
+ * @returns {VerifyingKey}
1458
+ */
1459
+ copy(): VerifyingKey;
1460
+ /**
1461
+ * Construct a new verifying key from a byte array
1462
+ *
1463
+ * @param {Uint8Array} bytes Byte representation of a verifying key
1464
+ * @returns {VerifyingKey | Error}
1465
+ * @param {Uint8Array} bytes
1466
+ * @returns {VerifyingKey}
1467
+ */
1468
+ static fromBytes(bytes: Uint8Array): VerifyingKey;
1469
+ /**
1470
+ * Create a verifying key from string
1471
+ *
1472
+ * @param {String} string String representation of a verifying key
1473
+ * @returns {VerifyingKey | Error}
1474
+ * @param {string} string
1475
+ * @returns {VerifyingKey}
1476
+ */
1477
+ static fromString(string: string): VerifyingKey;
1478
+ /**
1479
+ * Create a byte array from a verifying key
1480
+ *
1481
+ * @returns {Uint8Array | Error} Byte representation of a verifying key
1482
+ * @returns {Uint8Array}
1483
+ */
1484
+ toBytes(): Uint8Array;
1485
+ /**
1486
+ * Get a string representation of the verifying key
1487
+ *
1488
+ * @returns {String} String representation of the verifying key
1489
+ * @returns {string}
1490
+ */
1491
+ toString(): string;
1492
+ /**
1493
+ * Returns the verifying key for the bond_public function
1494
+ *
1495
+ * @returns {VerifyingKey} Verifying key for the bond_public function
1496
+ * @returns {VerifyingKey}
1497
+ */
1498
+ static bondPublicVerifier(): VerifyingKey;
1499
+ /**
1500
+ * Returns the verifying key for the bond_validator function
1501
+ *
1502
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
1503
+ * @returns {VerifyingKey}
1504
+ */
1505
+ static bondValidatorVerifier(): VerifyingKey;
1506
+ /**
1507
+ * Returns the verifying key for the claim_delegator function
1508
+ *
1509
+ * @returns {VerifyingKey} Verifying key for the claim_unbond_public function
1510
+ * @returns {VerifyingKey}
1511
+ */
1512
+ static claimUnbondPublicVerifier(): VerifyingKey;
1513
+ /**
1514
+ * Returns the verifying key for the fee_private function
1515
+ *
1516
+ * @returns {VerifyingKey} Verifying key for the fee_private function
1517
+ * @returns {VerifyingKey}
1518
+ */
1519
+ static feePrivateVerifier(): VerifyingKey;
1520
+ /**
1521
+ * Returns the verifying key for the fee_public function
1522
+ *
1523
+ * @returns {VerifyingKey} Verifying key for the fee_public function
1524
+ * @returns {VerifyingKey}
1525
+ */
1526
+ static feePublicVerifier(): VerifyingKey;
1527
+ /**
1528
+ * Returns the verifying key for the inclusion function
1529
+ *
1530
+ * @returns {VerifyingKey} Verifying key for the inclusion function
1531
+ * @returns {VerifyingKey}
1532
+ */
1533
+ static inclusionVerifier(): VerifyingKey;
1534
+ /**
1535
+ * Returns the verifying key for the join function
1536
+ *
1537
+ * @returns {VerifyingKey} Verifying key for the join function
1538
+ * @returns {VerifyingKey}
1539
+ */
1540
+ static joinVerifier(): VerifyingKey;
1541
+ /**
1542
+ * Returns the verifying key for the set_validator_state function
1543
+ *
1544
+ * @returns {VerifyingKey} Verifying key for the set_validator_state function
1545
+ * @returns {VerifyingKey}
1546
+ */
1547
+ static setValidatorStateVerifier(): VerifyingKey;
1548
+ /**
1549
+ * Returns the verifying key for the split function
1550
+ *
1551
+ * @returns {VerifyingKey} Verifying key for the split function
1552
+ * @returns {VerifyingKey}
1553
+ */
1554
+ static splitVerifier(): VerifyingKey;
1555
+ /**
1556
+ * Returns the verifying key for the transfer_private function
1557
+ *
1558
+ * @returns {VerifyingKey} Verifying key for the transfer_private function
1559
+ * @returns {VerifyingKey}
1560
+ */
1561
+ static transferPrivateVerifier(): VerifyingKey;
1562
+ /**
1563
+ * Returns the verifying key for the transfer_private_to_public function
1564
+ *
1565
+ * @returns {VerifyingKey} Verifying key for the transfer_private_to_public function
1566
+ * @returns {VerifyingKey}
1567
+ */
1568
+ static transferPrivateToPublicVerifier(): VerifyingKey;
1569
+ /**
1570
+ * Returns the verifying key for the transfer_public function
1571
+ *
1572
+ * @returns {VerifyingKey} Verifying key for the transfer_public function
1573
+ * @returns {VerifyingKey}
1574
+ */
1575
+ static transferPublicVerifier(): VerifyingKey;
1576
+ /**
1577
+ * Returns the verifying key for the transfer_public_as_signer function
1578
+ *
1579
+ * @returns {VerifyingKey} Verifying key for the transfer_public_as_signer function
1580
+ * @returns {VerifyingKey}
1581
+ */
1582
+ static transferPublicAsSignerVerifier(): VerifyingKey;
1583
+ /**
1584
+ * Returns the verifying key for the transfer_public_to_private function
1585
+ *
1586
+ * @returns {VerifyingKey} Verifying key for the transfer_public_to_private function
1587
+ * @returns {VerifyingKey}
1588
+ */
1589
+ static transferPublicToPrivateVerifier(): VerifyingKey;
1590
+ /**
1591
+ * Returns the verifying key for the unbond_public function
1592
+ *
1593
+ * @returns {VerifyingKey} Verifying key for the unbond_public function
1594
+ * @returns {VerifyingKey}
1595
+ */
1596
+ static unbondPublicVerifier(): VerifyingKey;
1597
+ /**
1598
+ * Returns the verifying key for the bond_public function
1599
+ *
1600
+ * @returns {VerifyingKey} Verifying key for the bond_public function
1601
+ * @returns {boolean}
1602
+ */
1603
+ isBondPublicVerifier(): boolean;
1604
+ /**
1605
+ * Returns the verifying key for the bond_validator function
1606
+ *
1607
+ * @returns {VerifyingKey} Verifying key for the bond_validator function
1608
+ * @returns {boolean}
1609
+ */
1610
+ isBondValidatorVerifier(): boolean;
1611
+ /**
1612
+ * Verifies the verifying key is for the claim_delegator function
1613
+ *
1614
+ * @returns {bool}
1615
+ * @returns {boolean}
1616
+ */
1617
+ isClaimUnbondPublicVerifier(): boolean;
1618
+ /**
1619
+ * Verifies the verifying key is for the fee_private function
1620
+ *
1621
+ * @returns {bool}
1622
+ * @returns {boolean}
1623
+ */
1624
+ isFeePrivateVerifier(): boolean;
1625
+ /**
1626
+ * Verifies the verifying key is for the fee_public function
1627
+ *
1628
+ * @returns {bool}
1629
+ * @returns {boolean}
1630
+ */
1631
+ isFeePublicVerifier(): boolean;
1632
+ /**
1633
+ * Verifies the verifying key is for the inclusion function
1634
+ *
1635
+ * @returns {bool}
1636
+ * @returns {boolean}
1637
+ */
1638
+ isInclusionVerifier(): boolean;
1639
+ /**
1640
+ * Verifies the verifying key is for the join function
1641
+ *
1642
+ * @returns {bool}
1643
+ * @returns {boolean}
1644
+ */
1645
+ isJoinVerifier(): boolean;
1646
+ /**
1647
+ * Verifies the verifying key is for the set_validator_state function
1648
+ *
1649
+ * @returns {bool}
1650
+ * @returns {boolean}
1651
+ */
1652
+ isSetValidatorStateVerifier(): boolean;
1653
+ /**
1654
+ * Verifies the verifying key is for the split function
1655
+ *
1656
+ * @returns {bool}
1657
+ * @returns {boolean}
1658
+ */
1659
+ isSplitVerifier(): boolean;
1660
+ /**
1661
+ * Verifies the verifying key is for the transfer_private function
1662
+ *
1663
+ * @returns {bool}
1664
+ * @returns {boolean}
1665
+ */
1666
+ isTransferPrivateVerifier(): boolean;
1667
+ /**
1668
+ * Verifies the verifying key is for the transfer_private_to_public function
1669
+ *
1670
+ * @returns {bool}
1671
+ * @returns {boolean}
1672
+ */
1673
+ isTransferPrivateToPublicVerifier(): boolean;
1674
+ /**
1675
+ * Verifies the verifying key is for the transfer_public function
1676
+ *
1677
+ * @returns {bool}
1678
+ * @returns {boolean}
1679
+ */
1680
+ isTransferPublicVerifier(): boolean;
1681
+ /**
1682
+ * Verifies the verifying key is for the transfer_public_as_signer function
1683
+ *
1684
+ * @returns {bool}
1685
+ * @returns {boolean}
1686
+ */
1687
+ isTransferPublicAsSignerVerifier(): boolean;
1688
+ /**
1689
+ * Verifies the verifying key is for the transfer_public_to_private function
1690
+ *
1691
+ * @returns {bool}
1692
+ * @returns {boolean}
1693
+ */
1694
+ isTransferPublicToPrivateVerifier(): boolean;
1695
+ /**
1696
+ * Verifies the verifying key is for the unbond_public function
1697
+ *
1698
+ * @returns {bool}
1699
+ * @returns {boolean}
1700
+ */
1701
+ isUnbondPublicVerifier(): boolean;
1702
+ }
1703
+ /**
1704
+ */
1705
+ export class ViewKey {
1706
+ free(): void;
1707
+ /**
1708
+ * Create a new view key from a private key
1709
+ *
1710
+ * @param {PrivateKey} private_key Private key
1711
+ * @returns {ViewKey} View key
1712
+ * @param {PrivateKey} private_key
1713
+ * @returns {ViewKey}
1714
+ */
1715
+ static from_private_key(private_key: PrivateKey): ViewKey;
1716
+ /**
1717
+ * Create a new view key from a string representation of a view key
1718
+ *
1719
+ * @param {string} view_key String representation of a view key
1720
+ * @returns {ViewKey} View key
1721
+ * @param {string} view_key
1722
+ * @returns {ViewKey}
1723
+ */
1724
+ static from_string(view_key: string): ViewKey;
1725
+ /**
1726
+ * Get a string representation of a view key
1727
+ *
1728
+ * @returns {string} String representation of a view key
1729
+ * @returns {string}
1730
+ */
1731
+ to_string(): string;
1732
+ /**
1733
+ * Get the address corresponding to a view key
1734
+ *
1735
+ * @returns {Address} Address
1736
+ * @returns {Address}
1737
+ */
1738
+ to_address(): Address;
1739
+ /**
1740
+ * Decrypt a record ciphertext with a view key
1741
+ *
1742
+ * @param {string} ciphertext String representation of a record ciphertext
1743
+ * @returns {string} String representation of a record plaintext
1744
+ * @param {string} ciphertext
1745
+ * @returns {string}
1746
+ */
1747
+ decrypt(ciphertext: string): string;
1748
+ /**
1749
+ * @param {string} ciphertext
1750
+ * @param {string} tpk
1751
+ * @param {string} program_name
1752
+ * @param {string} function_name
1753
+ * @param {number} index
1754
+ * @returns {string}
1755
+ */
1756
+ decrypt_ciphertext(ciphertext: string, tpk: string, program_name: string, function_name: string, index: number): string;
1757
+ }
1758
+
1759
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1760
+
1761
+ export interface InitOutput {
1762
+ readonly memory: WebAssembly.Memory;
1763
+ readonly __wbg_privatekey_free: (a: number) => void;
1764
+ readonly privatekey_new: () => number;
1765
+ readonly privatekey_from_seed_unchecked: (a: number, b: number) => number;
1766
+ readonly privatekey_from_string: (a: number, b: number, c: number) => void;
1767
+ readonly privatekey_to_string: (a: number, b: number) => void;
1768
+ readonly privatekey_to_seed: (a: number, b: number) => void;
1769
+ readonly privatekey_to_view_key: (a: number) => number;
1770
+ readonly privatekey_to_address: (a: number) => number;
1771
+ readonly privatekey_sign: (a: number, b: number, c: number) => number;
1772
+ readonly privatekey_newEncrypted: (a: number, b: number, c: number) => void;
1773
+ readonly privatekey_toCiphertext: (a: number, b: number, c: number, d: number) => void;
1774
+ readonly privatekey_fromPrivateKeyCiphertext: (a: number, b: number, c: number, d: number) => void;
1775
+ readonly __wbg_viewkey_free: (a: number) => void;
1776
+ readonly viewkey_from_private_key: (a: number) => number;
1777
+ readonly viewkey_from_string: (a: number, b: number) => number;
1778
+ readonly viewkey_to_string: (a: number, b: number) => void;
1779
+ readonly viewkey_to_address: (a: number) => number;
1780
+ readonly viewkey_decrypt: (a: number, b: number, c: number, d: number) => void;
1781
+ readonly viewkey_decrypt_ciphertext: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
1782
+ readonly __wbg_metadata_free: (a: number) => void;
1783
+ readonly __wbg_get_metadata_locator: (a: number, b: number) => void;
1784
+ readonly __wbg_set_metadata_locator: (a: number, b: number, c: number) => void;
1785
+ readonly __wbg_get_metadata_prover: (a: number, b: number) => void;
1786
+ readonly __wbg_set_metadata_prover: (a: number, b: number, c: number) => void;
1787
+ readonly __wbg_get_metadata_verifier: (a: number, b: number) => void;
1788
+ readonly __wbg_set_metadata_verifier: (a: number, b: number, c: number) => void;
1789
+ readonly __wbg_get_metadata_verifyingKey: (a: number, b: number) => void;
1790
+ readonly __wbg_set_metadata_verifyingKey: (a: number, b: number, c: number) => void;
1791
+ readonly metadata_baseUrl: (a: number) => void;
1792
+ readonly metadata_bond_public: () => number;
1793
+ readonly metadata_bond_validator: () => number;
1794
+ readonly metadata_claim_unbond_public: () => number;
1795
+ readonly metadata_fee_private: () => number;
1796
+ readonly metadata_fee_public: () => number;
1797
+ readonly metadata_inclusion: () => number;
1798
+ readonly metadata_join: () => number;
1799
+ readonly metadata_set_validator_state: () => number;
1800
+ readonly metadata_split: () => number;
1801
+ readonly metadata_transfer_private: () => number;
1802
+ readonly metadata_transfer_private_to_public: () => number;
1803
+ readonly metadata_transfer_public: () => number;
1804
+ readonly metadata_transfer_public_as_signer: () => number;
1805
+ readonly metadata_transfer_public_to_private: () => number;
1806
+ readonly metadata_unbond_public: () => number;
1807
+ readonly __wbg_field_free: (a: number) => void;
1808
+ readonly field_toString: (a: number, b: number) => void;
1809
+ readonly field_fromString: (a: number, b: number, c: number) => void;
1810
+ readonly programmanager_synthesizeKeyPair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
1811
+ readonly __wbg_executionresponse_free: (a: number) => void;
1812
+ readonly executionresponse_getOutputs: (a: number) => number;
1813
+ readonly executionresponse_getExecution: (a: number) => number;
1814
+ readonly executionresponse_getKeys: (a: number, b: number) => void;
1815
+ readonly executionresponse_getProvingKey: (a: number) => number;
1816
+ readonly executionresponse_getVerifyingKey: (a: number) => number;
1817
+ readonly executionresponse_getFunctionId: (a: number, b: number) => void;
1818
+ readonly executionresponse_getProgram: (a: number) => number;
1819
+ readonly __wbg_recordplaintext_free: (a: number) => void;
1820
+ readonly recordplaintext_commitment: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1821
+ readonly recordplaintext_fromString: (a: number, b: number, c: number) => void;
1822
+ readonly recordplaintext_toString: (a: number, b: number) => void;
1823
+ readonly recordplaintext_microcredits: (a: number) => number;
1824
+ readonly recordplaintext_nonce: (a: number, b: number) => void;
1825
+ readonly recordplaintext_serialNumberString: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1826
+ readonly __wbg_programmanager_free: (a: number) => void;
1827
+ readonly runRayonThread: (a: number) => void;
1828
+ readonly initThreadPool: (a: number, b: number) => number;
1829
+ readonly init_panic_hook: () => void;
1830
+ readonly __wbg_address_free: (a: number) => void;
1831
+ readonly address_from_private_key: (a: number) => number;
1832
+ readonly address_from_view_key: (a: number) => number;
1833
+ readonly address_from_string: (a: number, b: number) => number;
1834
+ readonly address_to_string: (a: number, b: number) => void;
1835
+ readonly address_verify: (a: number, b: number, c: number, d: number) => number;
1836
+ readonly __wbg_privatekeyciphertext_free: (a: number) => void;
1837
+ readonly privatekeyciphertext_encryptPrivateKey: (a: number, b: number, c: number, d: number) => void;
1838
+ readonly privatekeyciphertext_decryptToPrivateKey: (a: number, b: number, c: number, d: number) => void;
1839
+ readonly privatekeyciphertext_toString: (a: number, b: number) => void;
1840
+ readonly privatekeyciphertext_fromString: (a: number, b: number, c: number) => void;
1841
+ readonly __wbg_verifyingkey_free: (a: number) => void;
1842
+ readonly verifyingkey_checksum: (a: number, b: number) => void;
1843
+ readonly verifyingkey_copy: (a: number) => number;
1844
+ readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
1845
+ readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
1846
+ readonly verifyingkey_toBytes: (a: number, b: number) => void;
1847
+ readonly verifyingkey_toString: (a: number, b: number) => void;
1848
+ readonly __wbg_jsfield_free: (a: number) => void;
1849
+ readonly jsfield_generate_message_leo: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1850
+ readonly jsfield_generate_message_clients: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1851
+ readonly __wbg_signature_free: (a: number) => void;
1852
+ readonly signature_sign: (a: number, b: number, c: number) => number;
1853
+ readonly signature_sign_message: (a: number, b: number, c: number, d: number, e: number) => number;
1854
+ readonly signature_verify: (a: number, b: number, c: number, d: number) => number;
1855
+ readonly signature_from_string: (a: number, b: number) => number;
1856
+ readonly signature_to_string: (a: number, b: number) => void;
1857
+ readonly programmanager_buildTransferTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number) => number;
1858
+ readonly provingkey_isBondPublicProver: (a: number) => number;
1859
+ readonly provingkey_isBondValidatorProver: (a: number) => number;
1860
+ readonly provingkey_isClaimUnbondPublicProver: (a: number) => number;
1861
+ readonly provingkey_isFeePrivateProver: (a: number) => number;
1862
+ readonly provingkey_isFeePublicProver: (a: number) => number;
1863
+ readonly provingkey_isInclusionProver: (a: number) => number;
1864
+ readonly provingkey_isJoinProver: (a: number) => number;
1865
+ readonly provingkey_isSetValidatorStateProver: (a: number) => number;
1866
+ readonly provingkey_isSplitProver: (a: number) => number;
1867
+ readonly provingkey_isTransferPrivateProver: (a: number) => number;
1868
+ readonly provingkey_isTransferPrivateToPublicProver: (a: number) => number;
1869
+ readonly provingkey_isTransferPublicProver: (a: number) => number;
1870
+ readonly provingkey_isTransferPublicAsSignerProver: (a: number) => number;
1871
+ readonly provingkey_isTransferPublicToPrivateProver: (a: number) => number;
1872
+ readonly provingkey_isUnbondPublicProver: (a: number) => number;
1873
+ readonly __wbg_execution_free: (a: number) => void;
1874
+ readonly execution_toString: (a: number, b: number) => void;
1875
+ readonly execution_fromString: (a: number, b: number, c: number) => void;
1876
+ readonly verifyFunctionExecution: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1877
+ readonly __wbg_offlinequery_free: (a: number) => void;
1878
+ readonly offlinequery_new: (a: number, b: number, c: number) => void;
1879
+ readonly offlinequery_addStatePath: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1880
+ readonly offlinequery_toString: (a: number, b: number) => void;
1881
+ readonly offlinequery_fromString: (a: number, b: number, c: number) => void;
1882
+ readonly __wbg_program_free: (a: number) => void;
1883
+ readonly program_fromString: (a: number, b: number, c: number) => void;
1884
+ readonly program_toString: (a: number, b: number) => void;
1885
+ readonly program_hasFunction: (a: number, b: number, c: number) => number;
1886
+ readonly program_getFunctions: (a: number) => number;
1887
+ readonly program_getFunctionInputs: (a: number, b: number, c: number, d: number) => void;
1888
+ readonly program_getMappings: (a: number, b: number) => void;
1889
+ readonly program_getRecordMembers: (a: number, b: number, c: number, d: number) => void;
1890
+ readonly program_getStructMembers: (a: number, b: number, c: number, d: number) => void;
1891
+ readonly program_getCreditsProgram: () => number;
1892
+ readonly program_id: (a: number, b: number) => void;
1893
+ readonly program_address: (a: number, b: number) => void;
1894
+ readonly program_isEqual: (a: number, b: number) => number;
1895
+ readonly program_getImports: (a: number) => number;
1896
+ readonly verifyingkey_bondPublicVerifier: () => number;
1897
+ readonly verifyingkey_bondValidatorVerifier: () => number;
1898
+ readonly verifyingkey_claimUnbondPublicVerifier: () => number;
1899
+ readonly verifyingkey_feePrivateVerifier: () => number;
1900
+ readonly verifyingkey_feePublicVerifier: () => number;
1901
+ readonly verifyingkey_inclusionVerifier: () => number;
1902
+ readonly verifyingkey_joinVerifier: () => number;
1903
+ readonly verifyingkey_setValidatorStateVerifier: () => number;
1904
+ readonly verifyingkey_splitVerifier: () => number;
1905
+ readonly verifyingkey_transferPrivateVerifier: () => number;
1906
+ readonly verifyingkey_transferPrivateToPublicVerifier: () => number;
1907
+ readonly verifyingkey_transferPublicVerifier: () => number;
1908
+ readonly verifyingkey_transferPublicAsSignerVerifier: () => number;
1909
+ readonly verifyingkey_transferPublicToPrivateVerifier: () => number;
1910
+ readonly verifyingkey_unbondPublicVerifier: () => number;
1911
+ readonly verifyingkey_isBondPublicVerifier: (a: number) => number;
1912
+ readonly verifyingkey_isBondValidatorVerifier: (a: number) => number;
1913
+ readonly verifyingkey_isClaimUnbondPublicVerifier: (a: number) => number;
1914
+ readonly verifyingkey_isFeePrivateVerifier: (a: number) => number;
1915
+ readonly verifyingkey_isFeePublicVerifier: (a: number) => number;
1916
+ readonly verifyingkey_isInclusionVerifier: (a: number) => number;
1917
+ readonly verifyingkey_isJoinVerifier: (a: number) => number;
1918
+ readonly verifyingkey_isSetValidatorStateVerifier: (a: number) => number;
1919
+ readonly verifyingkey_isSplitVerifier: (a: number) => number;
1920
+ readonly verifyingkey_isTransferPrivateVerifier: (a: number) => number;
1921
+ readonly verifyingkey_isTransferPrivateToPublicVerifier: (a: number) => number;
1922
+ readonly verifyingkey_isTransferPublicVerifier: (a: number) => number;
1923
+ readonly verifyingkey_isTransferPublicAsSignerVerifier: (a: number) => number;
1924
+ readonly verifyingkey_isTransferPublicToPrivateVerifier: (a: number) => number;
1925
+ readonly verifyingkey_isUnbondPublicVerifier: (a: number) => number;
1926
+ readonly programmanager_buildJoinTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => number;
1927
+ readonly programmanager_buildSplitTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
1928
+ readonly __wbg_keypair_free: (a: number) => void;
1929
+ readonly keypair_new: (a: number, b: number) => number;
1930
+ readonly keypair_provingKey: (a: number, b: number) => void;
1931
+ readonly keypair_verifyingKey: (a: number, b: number) => void;
1932
+ readonly programmanager_buildDeploymentTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
1933
+ readonly programmanager_estimateDeploymentFee: (a: number, b: number, c: number) => number;
1934
+ readonly programmanager_estimateProgramNameCost: (a: number, b: number, c: number) => void;
1935
+ readonly __wbg_authorizationresponse_free: (a: number) => void;
1936
+ readonly authorizationresponse_authorization: (a: number, b: number) => void;
1937
+ readonly authorizationresponse_fee_authorization: (a: number, b: number) => void;
1938
+ readonly programmanager_authExecute: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
1939
+ readonly programmanager_executeFunctionOffline: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => number;
1940
+ readonly programmanager_buildExecutionTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => number;
1941
+ readonly programmanager_estimateExecutionFee: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => number;
1942
+ readonly programmanager_estimateFinalizeFee: (a: number, b: number, c: number, d: number, e: number) => void;
1943
+ readonly __wbg_provingkey_free: (a: number) => void;
1944
+ readonly provingkey_checksum: (a: number, b: number) => void;
1945
+ readonly provingkey_copy: (a: number) => number;
1946
+ readonly provingkey_fromBytes: (a: number, b: number, c: number) => void;
1947
+ readonly provingkey_fromString: (a: number, b: number, c: number) => void;
1948
+ readonly provingkey_toBytes: (a: number, b: number) => void;
1949
+ readonly provingkey_toString: (a: number, b: number) => void;
1950
+ readonly __wbg_transaction_free: (a: number) => void;
1951
+ readonly transaction_fromString: (a: number, b: number, c: number) => void;
1952
+ readonly transaction_toString: (a: number, b: number) => void;
1953
+ readonly transaction_transactionId: (a: number, b: number) => void;
1954
+ readonly transaction_transactionType: (a: number, b: number) => void;
1955
+ readonly __wbg_recordciphertext_free: (a: number) => void;
1956
+ readonly recordciphertext_fromString: (a: number, b: number, c: number) => void;
1957
+ readonly recordciphertext_toString: (a: number, b: number) => void;
1958
+ readonly recordciphertext_decrypt: (a: number, b: number, c: number) => void;
1959
+ readonly recordciphertext_isOwner: (a: number, b: number) => number;
1960
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
1961
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1962
+ readonly __wbindgen_export_2: WebAssembly.Table;
1963
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdf1d9b89567002b9: (a: number, b: number, c: number) => void;
1964
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
1965
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1966
+ readonly __wbindgen_exn_store: (a: number) => void;
1967
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h69b3d6b389ddc7fb: (a: number, b: number, c: number, d: number) => void;
1968
+ }
1969
+
1970
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
1971
+ /**
1972
+ * Instantiates the given `module`, which can either be bytes or
1973
+ * a precompiled `WebAssembly.Module`.
1974
+ *
1975
+ * @param {SyncInitInput} module
1976
+ *
1977
+ * @returns {InitOutput}
1978
+ */
1979
+ export function initSync(module: SyncInitInput): InitOutput;
1980
+
1981
+ /**
1982
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1983
+ * for everything else, calls `WebAssembly.instantiate` directly.
1984
+ *
1985
+ * @param {InitInput | Promise<InitInput>} module_or_path
1986
+ *
1987
+ * @returns {Promise<InitOutput>}
1988
+ */
1989
+ export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;