@puzzlehq/aleo-wasm-web 0.6.1 → 0.6.3
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 +185 -228
- package/aleo_wasm.js +414 -464
- package/aleo_wasm_bg.wasm +0 -0
- package/package.json +3 -4
- package/snippets/aleo-wasm-a66b35edae11a8af/inline0.js +0 -27
package/aleo_wasm.d.ts
CHANGED
|
@@ -122,6 +122,13 @@ export class ExecutionResponse {
|
|
|
122
122
|
* @returns {Execution | undefined}
|
|
123
123
|
*/
|
|
124
124
|
getExecution(): Execution | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the program keys if present
|
|
127
|
+
* @param {string} program_id
|
|
128
|
+
* @param {string} function_name
|
|
129
|
+
* @returns {KeyPair}
|
|
130
|
+
*/
|
|
131
|
+
getKeys(program_id: string, function_name: string): KeyPair;
|
|
125
132
|
}
|
|
126
133
|
/**
|
|
127
134
|
*/
|
|
@@ -209,6 +216,14 @@ export class PrivateKey {
|
|
|
209
216
|
*/
|
|
210
217
|
to_string(): string;
|
|
211
218
|
/**
|
|
219
|
+
* Get a string representation of the seed. This function should be used very carefully
|
|
220
|
+
* as it exposes the private key seed
|
|
221
|
+
*
|
|
222
|
+
* @returns {string} String representation of a private key seed
|
|
223
|
+
* @returns {string}
|
|
224
|
+
*/
|
|
225
|
+
to_seed(): string;
|
|
226
|
+
/**
|
|
212
227
|
* Get the view key corresponding to the private key
|
|
213
228
|
*
|
|
214
229
|
* @returns {ViewKey}
|
|
@@ -564,100 +579,6 @@ export class Program {
|
|
|
564
579
|
export class ProgramManager {
|
|
565
580
|
free(): void;
|
|
566
581
|
/**
|
|
567
|
-
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
568
|
-
* of the credits of the two original records
|
|
569
|
-
*
|
|
570
|
-
* @param private_key The private key of the sender
|
|
571
|
-
* @param record_1 The first record to combine
|
|
572
|
-
* @param record_2 The second record to combine
|
|
573
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
574
|
-
* @param fee_record The record to spend the fee from
|
|
575
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
576
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
577
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
578
|
-
* `join_proving_key` and `join_verifying_key` arguments) will be stored in the
|
|
579
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
580
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
581
|
-
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
582
|
-
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
583
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
584
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
585
|
-
* @returns {Transaction | Error} Transaction object
|
|
586
|
-
* @param {PrivateKey} private_key
|
|
587
|
-
* @param {RecordPlaintext} record_1
|
|
588
|
-
* @param {RecordPlaintext} record_2
|
|
589
|
-
* @param {number} fee_credits
|
|
590
|
-
* @param {RecordPlaintext | undefined} fee_record
|
|
591
|
-
* @param {string} url
|
|
592
|
-
* @param {boolean} cache
|
|
593
|
-
* @param {ProvingKey | undefined} join_proving_key
|
|
594
|
-
* @param {VerifyingKey | undefined} join_verifying_key
|
|
595
|
-
* @param {ProvingKey | undefined} fee_proving_key
|
|
596
|
-
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
597
|
-
* @returns {Promise<Transaction>}
|
|
598
|
-
*/
|
|
599
|
-
buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, cache: boolean, join_proving_key?: ProvingKey, join_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
600
|
-
/**
|
|
601
|
-
*/
|
|
602
|
-
constructor();
|
|
603
|
-
/**
|
|
604
|
-
* Cache the proving and verifying keys for a program function in WASM memory. This method
|
|
605
|
-
* will take a verifying and proving key and store them in the program manager's internal
|
|
606
|
-
* in-memory cache. This memory is allocated in WebAssembly, so it is important to be mindful
|
|
607
|
-
* of the amount of memory being used. This method will return an error if the keys are already
|
|
608
|
-
* cached in memory.
|
|
609
|
-
*
|
|
610
|
-
* @param program_id The name of the program containing the desired function
|
|
611
|
-
* @param function The name of the function to store the keys for
|
|
612
|
-
* @param proving_key The proving key of the function
|
|
613
|
-
* @param verifying_key The verifying key of the function
|
|
614
|
-
* @param {string} program
|
|
615
|
-
* @param {string} _function
|
|
616
|
-
* @param {ProvingKey} proving_key
|
|
617
|
-
* @param {VerifyingKey} verifying_key
|
|
618
|
-
*/
|
|
619
|
-
cacheKeypairInWasmMemory(program: string, _function: string, proving_key: ProvingKey, verifying_key: VerifyingKey): void;
|
|
620
|
-
/**
|
|
621
|
-
* Get the proving & verifying keys cached in WASM memory for a specific function
|
|
622
|
-
*
|
|
623
|
-
* @param program_id The name of the program containing the desired function
|
|
624
|
-
* @param function_id The name of the function to retrieve the keys for
|
|
625
|
-
* @param {string} program_id
|
|
626
|
-
* @param {string} _function
|
|
627
|
-
* @returns {KeyPair}
|
|
628
|
-
*/
|
|
629
|
-
getCachedKeypair(program_id: string, _function: string): KeyPair;
|
|
630
|
-
/**
|
|
631
|
-
* Synthesize a proving and verifying key for a program function. This method should be used
|
|
632
|
-
* when there is a need to pre-synthesize keys (i.e. for caching purposes, etc.)
|
|
633
|
-
*
|
|
634
|
-
* @param program The source code of the program containing the desired function
|
|
635
|
-
* @param function The name of the function to synthesize the key for
|
|
636
|
-
* @param {string} program
|
|
637
|
-
* @param {string} _function
|
|
638
|
-
* @returns {KeyPair}
|
|
639
|
-
*/
|
|
640
|
-
synthesizeKeypair(program: string, _function: string): KeyPair;
|
|
641
|
-
/**
|
|
642
|
-
* Clear key cache in wasm memory.
|
|
643
|
-
*
|
|
644
|
-
* This method will clear the key cache in wasm memory. It is important to note that this will
|
|
645
|
-
* not DE-allocate the memory assigned to wasm as wasm memory cannot be shrunk. The total
|
|
646
|
-
* memory allocated to wasm will remain constant but will be available for other usage after
|
|
647
|
-
* calling this method.
|
|
648
|
-
*/
|
|
649
|
-
clearKeyCache(): void;
|
|
650
|
-
/**
|
|
651
|
-
* Check if the cache contains a keypair for a specific function
|
|
652
|
-
*
|
|
653
|
-
* @param program_id The name of the program containing the desired function
|
|
654
|
-
* @param function_id The name of the function to retrieve the keys for
|
|
655
|
-
* @param {string} program_id
|
|
656
|
-
* @param {string} function_id
|
|
657
|
-
* @returns {boolean}
|
|
658
|
-
*/
|
|
659
|
-
keyExists(program_id: string, function_id: string): boolean;
|
|
660
|
-
/**
|
|
661
582
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
662
583
|
*
|
|
663
584
|
* @param private_key The private key of the sender
|
|
@@ -665,11 +586,6 @@ export class ProgramManager {
|
|
|
665
586
|
* value of the record and two new records will be created with the split amount and the remainder
|
|
666
587
|
* @param amount_record The record to split
|
|
667
588
|
* @param url The url of the Aleo network node to send the transaction to
|
|
668
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
669
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
670
|
-
* `split_proving_key` and `split_verifying_key` arguments) will be stored in the
|
|
671
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
672
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
673
589
|
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
674
590
|
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
675
591
|
* @returns {Transaction | Error} Transaction object
|
|
@@ -677,73 +593,19 @@ export class ProgramManager {
|
|
|
677
593
|
* @param {number} split_amount
|
|
678
594
|
* @param {RecordPlaintext} amount_record
|
|
679
595
|
* @param {string} url
|
|
680
|
-
* @param {boolean} cache
|
|
681
596
|
* @param {ProvingKey | undefined} split_proving_key
|
|
682
597
|
* @param {VerifyingKey | undefined} split_verifying_key
|
|
683
598
|
* @returns {Promise<Transaction>}
|
|
684
599
|
*/
|
|
685
|
-
buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url: string,
|
|
600
|
+
static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url: string, split_proving_key?: ProvingKey, split_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
686
601
|
/**
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
* @param
|
|
690
|
-
* @param program The source code of the program being deployed
|
|
691
|
-
* @param imports A javascript object holding the source code of any imported programs in the
|
|
692
|
-
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
693
|
-
* Note that all imported programs must be deployed on chain before the main program in order
|
|
694
|
-
* for the deployment to succeed
|
|
695
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
696
|
-
* @param fee_record The record to spend the fee from
|
|
697
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
698
|
-
* @param cache Cache the synthesized keys for future use
|
|
699
|
-
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
700
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
701
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
702
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
703
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
704
|
-
* @returns {Transaction | Error}
|
|
602
|
+
* @param {string} program_id
|
|
603
|
+
* @param {string} function_id
|
|
604
|
+
* @param {Array<any>} inputs_str
|
|
705
605
|
* @param {PrivateKey} private_key
|
|
706
|
-
* @
|
|
707
|
-
* @param {number} fee_credits
|
|
708
|
-
* @param {RecordPlaintext | undefined} fee_record
|
|
709
|
-
* @param {string} url
|
|
710
|
-
* @param {boolean} cache
|
|
711
|
-
* @param {object | undefined} imports
|
|
712
|
-
* @param {ProvingKey | undefined} fee_proving_key
|
|
713
|
-
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
714
|
-
* @returns {Promise<Transaction>}
|
|
715
|
-
*/
|
|
716
|
-
buildDeploymentTransaction(private_key: PrivateKey, program: string, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, cache: boolean, imports?: object, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
717
|
-
/**
|
|
718
|
-
* Estimate the fee for a program deployment
|
|
719
|
-
*
|
|
720
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
721
|
-
*
|
|
722
|
-
* @param program The source code of the program being deployed
|
|
723
|
-
* @param cache Cache the synthesized keys for future use
|
|
724
|
-
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
725
|
-
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
726
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
727
|
-
* @returns {u64 | Error}
|
|
728
|
-
* @param {string} program
|
|
729
|
-
* @param {boolean} cache
|
|
730
|
-
* @param {object | undefined} imports
|
|
731
|
-
* @returns {Promise<bigint>}
|
|
732
|
-
*/
|
|
733
|
-
estimateDeploymentFee(program: string, cache: boolean, imports?: object): Promise<bigint>;
|
|
734
|
-
/**
|
|
735
|
-
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
736
|
-
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
737
|
-
* the cost of the size (in bytes) of the deployment.
|
|
738
|
-
*
|
|
739
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
740
|
-
*
|
|
741
|
-
* @param name The name of the program to be deployed
|
|
742
|
-
* @returns {u64 | Error}
|
|
743
|
-
* @param {string} name
|
|
744
|
-
* @returns {bigint}
|
|
606
|
+
* @returns {Promise<string>}
|
|
745
607
|
*/
|
|
746
|
-
|
|
608
|
+
authExecute(program_id: string, function_id: string, inputs_str: Array<any>, private_key: PrivateKey): Promise<string>;
|
|
747
609
|
/**
|
|
748
610
|
* Execute an arbitrary function locally
|
|
749
611
|
*
|
|
@@ -754,11 +616,10 @@ export class ProgramManager {
|
|
|
754
616
|
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
755
617
|
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
756
618
|
* will be returned.
|
|
757
|
-
* @param {boolean} cache Cache the proving and verifying keys in the
|
|
758
|
-
* If this is set to 'true' the keys synthesized
|
|
759
|
-
* `
|
|
760
|
-
*
|
|
761
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
619
|
+
* @param {boolean} cache Cache the proving and verifying keys in the Execution response.
|
|
620
|
+
* If this is set to 'true' the keys synthesized will be stored in the Execution Response
|
|
621
|
+
* and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
|
|
622
|
+
* method.
|
|
762
623
|
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
763
624
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
764
625
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
@@ -775,7 +636,7 @@ export class ProgramManager {
|
|
|
775
636
|
* @param {VerifyingKey | undefined} verifying_key
|
|
776
637
|
* @returns {Promise<ExecutionResponse>}
|
|
777
638
|
*/
|
|
778
|
-
executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey): Promise<ExecutionResponse>;
|
|
639
|
+
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): Promise<ExecutionResponse>;
|
|
779
640
|
/**
|
|
780
641
|
* Execute Aleo function and create an Aleo execution transaction
|
|
781
642
|
*
|
|
@@ -786,7 +647,6 @@ export class ProgramManager {
|
|
|
786
647
|
* @param fee_credits The amount of credits to pay as a fee
|
|
787
648
|
* @param fee_record The record to spend the fee from
|
|
788
649
|
* @param url The url of the Aleo network node to send the transaction to
|
|
789
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager's memory.
|
|
790
650
|
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
791
651
|
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
792
652
|
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
@@ -806,7 +666,6 @@ export class ProgramManager {
|
|
|
806
666
|
* @param {number} fee_credits
|
|
807
667
|
* @param {RecordPlaintext | undefined} fee_record
|
|
808
668
|
* @param {string} url
|
|
809
|
-
* @param {boolean} cache
|
|
810
669
|
* @param {object | undefined} imports
|
|
811
670
|
* @param {ProvingKey | undefined} proving_key
|
|
812
671
|
* @param {VerifyingKey | undefined} verifying_key
|
|
@@ -814,7 +673,7 @@ export class ProgramManager {
|
|
|
814
673
|
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
815
674
|
* @returns {Promise<Transaction>}
|
|
816
675
|
*/
|
|
817
|
-
buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string,
|
|
676
|
+
static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
818
677
|
/**
|
|
819
678
|
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
820
679
|
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
@@ -827,7 +686,6 @@ export class ProgramManager {
|
|
|
827
686
|
* @param function The name of the function to execute
|
|
828
687
|
* @param inputs A javascript array of inputs to the function
|
|
829
688
|
* @param url The url of the Aleo network node to send the transaction to
|
|
830
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager's memory.
|
|
831
689
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
832
690
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
833
691
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
@@ -839,13 +697,12 @@ export class ProgramManager {
|
|
|
839
697
|
* @param {string} _function
|
|
840
698
|
* @param {Array<any>} inputs
|
|
841
699
|
* @param {string} url
|
|
842
|
-
* @param {boolean} cache
|
|
843
700
|
* @param {object | undefined} imports
|
|
844
701
|
* @param {ProvingKey | undefined} proving_key
|
|
845
702
|
* @param {VerifyingKey | undefined} verifying_key
|
|
846
703
|
* @returns {Promise<bigint>}
|
|
847
704
|
*/
|
|
848
|
-
estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url: string,
|
|
705
|
+
static estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url: string, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey): Promise<bigint>;
|
|
849
706
|
/**
|
|
850
707
|
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
851
708
|
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
@@ -860,7 +717,64 @@ export class ProgramManager {
|
|
|
860
717
|
* @param {string} _function
|
|
861
718
|
* @returns {bigint}
|
|
862
719
|
*/
|
|
863
|
-
estimateFinalizeFee(program: string, _function: string): bigint;
|
|
720
|
+
static estimateFinalizeFee(program: string, _function: string): bigint;
|
|
721
|
+
/**
|
|
722
|
+
* Deploy an Aleo program
|
|
723
|
+
*
|
|
724
|
+
* @param private_key The private key of the sender
|
|
725
|
+
* @param program The source code of the program being deployed
|
|
726
|
+
* @param imports A javascript object holding the source code of any imported programs in the
|
|
727
|
+
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
728
|
+
* Note that all imported programs must be deployed on chain before the main program in order
|
|
729
|
+
* for the deployment to succeed
|
|
730
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
731
|
+
* @param fee_record The record to spend the fee from
|
|
732
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
733
|
+
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
734
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
735
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
736
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
737
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
738
|
+
* @returns {Transaction | Error}
|
|
739
|
+
* @param {PrivateKey} private_key
|
|
740
|
+
* @param {string} program
|
|
741
|
+
* @param {number} fee_credits
|
|
742
|
+
* @param {RecordPlaintext | undefined} fee_record
|
|
743
|
+
* @param {string} url
|
|
744
|
+
* @param {object | undefined} imports
|
|
745
|
+
* @param {ProvingKey | undefined} fee_proving_key
|
|
746
|
+
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
747
|
+
* @returns {Promise<Transaction>}
|
|
748
|
+
*/
|
|
749
|
+
static buildDeploymentTransaction(private_key: PrivateKey, program: string, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, imports?: object, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
750
|
+
/**
|
|
751
|
+
* Estimate the fee for a program deployment
|
|
752
|
+
*
|
|
753
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
754
|
+
*
|
|
755
|
+
* @param program The source code of the program being deployed
|
|
756
|
+
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
757
|
+
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
758
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
759
|
+
* @returns {u64 | Error}
|
|
760
|
+
* @param {string} program
|
|
761
|
+
* @param {object | undefined} imports
|
|
762
|
+
* @returns {Promise<bigint>}
|
|
763
|
+
*/
|
|
764
|
+
static estimateDeploymentFee(program: string, imports?: object): Promise<bigint>;
|
|
765
|
+
/**
|
|
766
|
+
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
767
|
+
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
768
|
+
* the cost of the size (in bytes) of the deployment.
|
|
769
|
+
*
|
|
770
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
771
|
+
*
|
|
772
|
+
* @param name The name of the program to be deployed
|
|
773
|
+
* @returns {u64 | Error}
|
|
774
|
+
* @param {string} name
|
|
775
|
+
* @returns {bigint}
|
|
776
|
+
*/
|
|
777
|
+
static estimateProgramNameCost(name: string): bigint;
|
|
864
778
|
/**
|
|
865
779
|
* Send credits from one Aleo account to another
|
|
866
780
|
*
|
|
@@ -872,13 +786,6 @@ export class ProgramManager {
|
|
|
872
786
|
* @param fee_credits The amount of credits to pay as a fee
|
|
873
787
|
* @param fee_record The record to spend the fee from
|
|
874
788
|
* @param url The url of the Aleo network node to send the transaction to
|
|
875
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
876
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
877
|
-
* `transfer_proving_key` and `transfer_verifying_key` arguments) will be stored in the
|
|
878
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
879
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
880
|
-
* @param transfer_proving_key (optional) Provide a proving key to use for the transfer
|
|
881
|
-
* function
|
|
882
789
|
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
883
790
|
* function
|
|
884
791
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
@@ -892,14 +799,56 @@ export class ProgramManager {
|
|
|
892
799
|
* @param {number} fee_credits
|
|
893
800
|
* @param {RecordPlaintext | undefined} fee_record
|
|
894
801
|
* @param {string} url
|
|
895
|
-
* @param {boolean} cache
|
|
896
802
|
* @param {ProvingKey | undefined} transfer_proving_key
|
|
897
803
|
* @param {VerifyingKey | undefined} transfer_verifying_key
|
|
898
804
|
* @param {ProvingKey | undefined} fee_proving_key
|
|
899
805
|
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
900
806
|
* @returns {Promise<Transaction>}
|
|
901
807
|
*/
|
|
902
|
-
buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string,
|
|
808
|
+
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
809
|
+
/**
|
|
810
|
+
* Synthesize proving and verifying keys for a program
|
|
811
|
+
*
|
|
812
|
+
* @param program {string} The program source code of the program to synthesize keys for
|
|
813
|
+
* @param function_id {string} The function to synthesize keys for
|
|
814
|
+
* @param inputs {Array} The inputs to the function
|
|
815
|
+
* @param imports {Object | undefined} The imports for the program
|
|
816
|
+
* @param {PrivateKey} private_key
|
|
817
|
+
* @param {string} program
|
|
818
|
+
* @param {string} function_id
|
|
819
|
+
* @param {Array<any>} inputs
|
|
820
|
+
* @param {object | undefined} imports
|
|
821
|
+
* @returns {Promise<KeyPair>}
|
|
822
|
+
*/
|
|
823
|
+
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object): Promise<KeyPair>;
|
|
824
|
+
/**
|
|
825
|
+
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
826
|
+
* of the credits of the two original records
|
|
827
|
+
*
|
|
828
|
+
* @param private_key The private key of the sender
|
|
829
|
+
* @param record_1 The first record to combine
|
|
830
|
+
* @param record_2 The second record to combine
|
|
831
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
832
|
+
* @param fee_record The record to spend the fee from
|
|
833
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
834
|
+
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
835
|
+
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
836
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
837
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
838
|
+
* @returns {Transaction | Error} Transaction object
|
|
839
|
+
* @param {PrivateKey} private_key
|
|
840
|
+
* @param {RecordPlaintext} record_1
|
|
841
|
+
* @param {RecordPlaintext} record_2
|
|
842
|
+
* @param {number} fee_credits
|
|
843
|
+
* @param {RecordPlaintext | undefined} fee_record
|
|
844
|
+
* @param {string} url
|
|
845
|
+
* @param {ProvingKey | undefined} join_proving_key
|
|
846
|
+
* @param {VerifyingKey | undefined} join_verifying_key
|
|
847
|
+
* @param {ProvingKey | undefined} fee_proving_key
|
|
848
|
+
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
849
|
+
* @returns {Promise<Transaction>}
|
|
850
|
+
*/
|
|
851
|
+
static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, fee_credits: number, fee_record: RecordPlaintext | undefined, url: string, join_proving_key?: ProvingKey, join_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey): Promise<Transaction>;
|
|
903
852
|
}
|
|
904
853
|
/**
|
|
905
854
|
* Proving key for a function within an Aleo program
|
|
@@ -1210,43 +1159,45 @@ export class ViewKey {
|
|
|
1210
1159
|
* @returns {string}
|
|
1211
1160
|
*/
|
|
1212
1161
|
decrypt(ciphertext: string): string;
|
|
1162
|
+
/**
|
|
1163
|
+
* @param {string} ciphertext
|
|
1164
|
+
* @param {string} tpk
|
|
1165
|
+
* @param {string} program_name
|
|
1166
|
+
* @param {string} function_name
|
|
1167
|
+
* @param {number} index
|
|
1168
|
+
* @returns {string}
|
|
1169
|
+
*/
|
|
1170
|
+
decrypt_ciphertext(ciphertext: string, tpk: string, program_name: string, function_name: string, index: number): string;
|
|
1213
1171
|
}
|
|
1214
1172
|
|
|
1215
1173
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
1216
1174
|
|
|
1217
1175
|
export interface InitOutput {
|
|
1218
1176
|
readonly memory: WebAssembly.Memory;
|
|
1219
|
-
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, m: number) => number;
|
|
1220
|
-
readonly __wbg_programmanager_free: (a: number) => void;
|
|
1221
|
-
readonly programmanager_new: () => number;
|
|
1222
|
-
readonly programmanager_cacheKeypairInWasmMemory: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1223
|
-
readonly programmanager_getCachedKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1224
|
-
readonly programmanager_synthesizeKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1225
|
-
readonly programmanager_clearKeyCache: (a: number) => void;
|
|
1226
|
-
readonly programmanager_keyExists: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1227
1177
|
readonly __wbg_recordciphertext_free: (a: number) => void;
|
|
1228
1178
|
readonly recordciphertext_fromString: (a: number, b: number, c: number) => void;
|
|
1229
1179
|
readonly recordciphertext_toString: (a: number, b: number) => void;
|
|
1230
1180
|
readonly recordciphertext_decrypt: (a: number, b: number, c: number) => void;
|
|
1231
1181
|
readonly recordciphertext_isOwner: (a: number, b: number) => number;
|
|
1232
|
-
readonly initThreadPool: (a: number, b: number) => number;
|
|
1233
|
-
readonly init_panic_hook: () => void;
|
|
1234
1182
|
readonly __wbg_keypair_free: (a: number) => void;
|
|
1235
1183
|
readonly keypair_new: (a: number, b: number) => number;
|
|
1236
1184
|
readonly keypair_provingKey: (a: number, b: number) => void;
|
|
1237
1185
|
readonly keypair_verifyingKey: (a: number, b: number) => void;
|
|
1186
|
+
readonly initThreadPool: (a: number, b: number) => number;
|
|
1187
|
+
readonly init_panic_hook: () => void;
|
|
1238
1188
|
readonly __wbg_jsfield_free: (a: number) => void;
|
|
1239
1189
|
readonly jsfield_generate_message_leo: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1240
1190
|
readonly jsfield_generate_message_clients: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1241
|
-
readonly programmanager_buildSplitTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number
|
|
1191
|
+
readonly programmanager_buildSplitTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
1242
1192
|
readonly __wbg_provingkey_free: (a: number) => void;
|
|
1243
1193
|
readonly provingkey_fromBytes: (a: number, b: number, c: number) => void;
|
|
1244
1194
|
readonly provingkey_toBytes: (a: number, b: number) => void;
|
|
1245
1195
|
readonly provingkey_copy: (a: number) => number;
|
|
1246
|
-
readonly
|
|
1247
|
-
readonly
|
|
1248
|
-
readonly
|
|
1249
|
-
readonly
|
|
1196
|
+
readonly programmanager_authExecute: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
1197
|
+
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) => number;
|
|
1198
|
+
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) => number;
|
|
1199
|
+
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) => number;
|
|
1200
|
+
readonly programmanager_estimateFinalizeFee: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
1250
1201
|
readonly __wbg_program_free: (a: number) => void;
|
|
1251
1202
|
readonly program_fromString: (a: number, b: number, c: number) => void;
|
|
1252
1203
|
readonly program_toString: (a: number, b: number) => void;
|
|
@@ -1266,63 +1217,69 @@ export interface InitOutput {
|
|
|
1266
1217
|
readonly recordplaintext_microcredits: (a: number) => number;
|
|
1267
1218
|
readonly recordplaintext_nonce: (a: number, b: number) => void;
|
|
1268
1219
|
readonly recordplaintext_serialNumberString: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1220
|
+
readonly runRayonThread: (a: number) => void;
|
|
1269
1221
|
readonly __wbg_privatekeyciphertext_free: (a: number) => void;
|
|
1270
1222
|
readonly privatekeyciphertext_encryptPrivateKey: (a: number, b: number, c: number, d: number) => void;
|
|
1271
1223
|
readonly privatekeyciphertext_decryptToPrivateKey: (a: number, b: number, c: number, d: number) => void;
|
|
1272
1224
|
readonly privatekeyciphertext_toString: (a: number, b: number) => void;
|
|
1273
1225
|
readonly privatekeyciphertext_fromString: (a: number, b: number, c: number) => void;
|
|
1274
|
-
readonly programmanager_buildDeploymentTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number
|
|
1275
|
-
readonly programmanager_estimateDeploymentFee: (a: number, b: number, c: number
|
|
1276
|
-
readonly programmanager_estimateProgramNameCost: (a: number, b: number, c: number
|
|
1226
|
+
readonly programmanager_buildDeploymentTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
1227
|
+
readonly programmanager_estimateDeploymentFee: (a: number, b: number, c: number) => number;
|
|
1228
|
+
readonly programmanager_estimateProgramNameCost: (a: number, b: number, c: number) => void;
|
|
1277
1229
|
readonly __wbg_execution_free: (a: number) => void;
|
|
1278
1230
|
readonly execution_toString: (a: number, b: number) => void;
|
|
1279
1231
|
readonly execution_fromString: (a: number, b: number, c: number) => void;
|
|
1280
1232
|
readonly verifyFunctionExecution: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1281
|
-
readonly
|
|
1282
|
-
readonly
|
|
1283
|
-
readonly
|
|
1284
|
-
readonly
|
|
1285
|
-
readonly
|
|
1286
|
-
readonly
|
|
1287
|
-
readonly __wbg_viewkey_free: (a: number) => void;
|
|
1288
|
-
readonly viewkey_from_private_key: (a: number) => number;
|
|
1289
|
-
readonly viewkey_from_string: (a: number, b: number) => number;
|
|
1290
|
-
readonly viewkey_to_string: (a: number, b: number) => void;
|
|
1291
|
-
readonly viewkey_to_address: (a: number) => number;
|
|
1292
|
-
readonly viewkey_decrypt: (a: number, b: number, c: number, d: number) => void;
|
|
1233
|
+
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) => number;
|
|
1234
|
+
readonly programmanager_synthesizeKeyPair: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
1235
|
+
readonly __wbg_executionresponse_free: (a: number) => void;
|
|
1236
|
+
readonly executionresponse_getOutputs: (a: number) => number;
|
|
1237
|
+
readonly executionresponse_getExecution: (a: number) => number;
|
|
1238
|
+
readonly executionresponse_getKeys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1293
1239
|
readonly __wbg_transaction_free: (a: number) => void;
|
|
1294
1240
|
readonly transaction_fromString: (a: number, b: number, c: number) => void;
|
|
1295
1241
|
readonly transaction_toString: (a: number, b: number) => void;
|
|
1296
1242
|
readonly transaction_transactionId: (a: number, b: number) => void;
|
|
1297
1243
|
readonly transaction_transactionType: (a: number, b: number) => void;
|
|
1298
|
-
readonly
|
|
1299
|
-
readonly address_from_private_key: (a: number) => number;
|
|
1300
|
-
readonly address_from_view_key: (a: number) => number;
|
|
1301
|
-
readonly address_from_string: (a: number, b: number) => number;
|
|
1302
|
-
readonly address_to_string: (a: number, b: number) => void;
|
|
1303
|
-
readonly address_verify: (a: number, b: number, c: number, d: number) => number;
|
|
1304
|
-
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) => number;
|
|
1305
|
-
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, q: number) => number;
|
|
1306
|
-
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, m: number) => number;
|
|
1307
|
-
readonly programmanager_estimateFinalizeFee: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1308
|
-
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) => number;
|
|
1309
|
-
readonly __wbg_verifyingkey_free: (a: number) => void;
|
|
1310
|
-
readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
|
|
1311
|
-
readonly verifyingkey_toBytes: (a: number, b: number) => void;
|
|
1312
|
-
readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
|
|
1313
|
-
readonly verifyingkey_toString: (a: number, b: number) => void;
|
|
1314
|
-
readonly verifyingkey_copy: (a: number) => number;
|
|
1244
|
+
readonly __wbg_programmanager_free: (a: number) => void;
|
|
1315
1245
|
readonly __wbg_privatekey_free: (a: number) => void;
|
|
1316
1246
|
readonly privatekey_new: () => number;
|
|
1317
1247
|
readonly privatekey_from_seed_unchecked: (a: number, b: number) => number;
|
|
1318
1248
|
readonly privatekey_from_string: (a: number, b: number, c: number) => void;
|
|
1319
1249
|
readonly privatekey_to_string: (a: number, b: number) => void;
|
|
1250
|
+
readonly privatekey_to_seed: (a: number, b: number) => void;
|
|
1320
1251
|
readonly privatekey_to_view_key: (a: number) => number;
|
|
1321
1252
|
readonly privatekey_to_address: (a: number) => number;
|
|
1322
1253
|
readonly privatekey_sign: (a: number, b: number, c: number) => number;
|
|
1323
1254
|
readonly privatekey_newEncrypted: (a: number, b: number, c: number) => void;
|
|
1324
1255
|
readonly privatekey_toCiphertext: (a: number, b: number, c: number, d: number) => void;
|
|
1325
1256
|
readonly privatekey_fromPrivateKeyCiphertext: (a: number, b: number, c: number, d: number) => void;
|
|
1257
|
+
readonly __wbg_signature_free: (a: number) => void;
|
|
1258
|
+
readonly signature_sign_message: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
1259
|
+
readonly signature_verify: (a: number, b: number, c: number, d: number) => number;
|
|
1260
|
+
readonly signature_from_string: (a: number, b: number) => number;
|
|
1261
|
+
readonly signature_to_string: (a: number, b: number) => void;
|
|
1262
|
+
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) => number;
|
|
1263
|
+
readonly __wbg_verifyingkey_free: (a: number) => void;
|
|
1264
|
+
readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
|
|
1265
|
+
readonly verifyingkey_toBytes: (a: number, b: number) => void;
|
|
1266
|
+
readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
|
|
1267
|
+
readonly verifyingkey_toString: (a: number, b: number) => void;
|
|
1268
|
+
readonly verifyingkey_copy: (a: number) => number;
|
|
1269
|
+
readonly signature_sign: (a: number, b: number, c: number) => number;
|
|
1270
|
+
readonly __wbg_address_free: (a: number) => void;
|
|
1271
|
+
readonly address_from_private_key: (a: number) => number;
|
|
1272
|
+
readonly address_from_view_key: (a: number) => number;
|
|
1273
|
+
readonly address_from_string: (a: number, b: number) => number;
|
|
1274
|
+
readonly address_to_string: (a: number, b: number) => void;
|
|
1275
|
+
readonly address_verify: (a: number, b: number, c: number, d: number) => number;
|
|
1276
|
+
readonly __wbg_viewkey_free: (a: number) => void;
|
|
1277
|
+
readonly viewkey_from_private_key: (a: number) => number;
|
|
1278
|
+
readonly viewkey_from_string: (a: number, b: number) => number;
|
|
1279
|
+
readonly viewkey_to_string: (a: number, b: number) => void;
|
|
1280
|
+
readonly viewkey_decrypt: (a: number, b: number, c: number, d: number) => void;
|
|
1281
|
+
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;
|
|
1282
|
+
readonly viewkey_to_address: (a: number) => number;
|
|
1326
1283
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1327
1284
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1328
1285
|
readonly __wbindgen_export_2: WebAssembly.Table;
|