@puzzlehq/aleo-wasm-web 0.6.14 → 0.6.16

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