@puzzlehq/aleo-wasm-web 0.6.2 → 0.6.4
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 +171 -223
- package/aleo_wasm.js +397 -472
- package/aleo_wasm_bg.wasm +0 -0
- package/package.json +3 -5
- package/snippets/aleo-wasm-a66b35edae11a8af/inline0.js +0 -27
- package/snippets/aleo-wasm-fc590ea6e3d88ce1/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
|
*/
|
|
@@ -572,100 +579,6 @@ export class Program {
|
|
|
572
579
|
export class ProgramManager {
|
|
573
580
|
free(): void;
|
|
574
581
|
/**
|
|
575
|
-
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
576
|
-
* of the credits of the two original records
|
|
577
|
-
*
|
|
578
|
-
* @param private_key The private key of the sender
|
|
579
|
-
* @param record_1 The first record to combine
|
|
580
|
-
* @param record_2 The second record to combine
|
|
581
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
582
|
-
* @param fee_record The record to spend the fee from
|
|
583
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
584
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
585
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
586
|
-
* `join_proving_key` and `join_verifying_key` arguments) will be stored in the
|
|
587
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
588
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
589
|
-
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
590
|
-
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
591
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
592
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
593
|
-
* @returns {Transaction | Error} Transaction object
|
|
594
|
-
* @param {PrivateKey} private_key
|
|
595
|
-
* @param {RecordPlaintext} record_1
|
|
596
|
-
* @param {RecordPlaintext} record_2
|
|
597
|
-
* @param {number} fee_credits
|
|
598
|
-
* @param {RecordPlaintext | undefined} fee_record
|
|
599
|
-
* @param {string} url
|
|
600
|
-
* @param {boolean} cache
|
|
601
|
-
* @param {ProvingKey | undefined} join_proving_key
|
|
602
|
-
* @param {VerifyingKey | undefined} join_verifying_key
|
|
603
|
-
* @param {ProvingKey | undefined} fee_proving_key
|
|
604
|
-
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
605
|
-
* @returns {Promise<Transaction>}
|
|
606
|
-
*/
|
|
607
|
-
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>;
|
|
608
|
-
/**
|
|
609
|
-
*/
|
|
610
|
-
constructor();
|
|
611
|
-
/**
|
|
612
|
-
* Cache the proving and verifying keys for a program function in WASM memory. This method
|
|
613
|
-
* will take a verifying and proving key and store them in the program manager's internal
|
|
614
|
-
* in-memory cache. This memory is allocated in WebAssembly, so it is important to be mindful
|
|
615
|
-
* of the amount of memory being used. This method will return an error if the keys are already
|
|
616
|
-
* cached in memory.
|
|
617
|
-
*
|
|
618
|
-
* @param program_id The name of the program containing the desired function
|
|
619
|
-
* @param function The name of the function to store the keys for
|
|
620
|
-
* @param proving_key The proving key of the function
|
|
621
|
-
* @param verifying_key The verifying key of the function
|
|
622
|
-
* @param {string} program
|
|
623
|
-
* @param {string} _function
|
|
624
|
-
* @param {ProvingKey} proving_key
|
|
625
|
-
* @param {VerifyingKey} verifying_key
|
|
626
|
-
*/
|
|
627
|
-
cacheKeypairInWasmMemory(program: string, _function: string, proving_key: ProvingKey, verifying_key: VerifyingKey): void;
|
|
628
|
-
/**
|
|
629
|
-
* Get the proving & verifying keys cached in WASM memory for a specific function
|
|
630
|
-
*
|
|
631
|
-
* @param program_id The name of the program containing the desired function
|
|
632
|
-
* @param function_id The name of the function to retrieve the keys for
|
|
633
|
-
* @param {string} program_id
|
|
634
|
-
* @param {string} _function
|
|
635
|
-
* @returns {KeyPair}
|
|
636
|
-
*/
|
|
637
|
-
getCachedKeypair(program_id: string, _function: string): KeyPair;
|
|
638
|
-
/**
|
|
639
|
-
* Synthesize a proving and verifying key for a program function. This method should be used
|
|
640
|
-
* when there is a need to pre-synthesize keys (i.e. for caching purposes, etc.)
|
|
641
|
-
*
|
|
642
|
-
* @param program The source code of the program containing the desired function
|
|
643
|
-
* @param function The name of the function to synthesize the key for
|
|
644
|
-
* @param {string} program
|
|
645
|
-
* @param {string} _function
|
|
646
|
-
* @returns {KeyPair}
|
|
647
|
-
*/
|
|
648
|
-
synthesizeKeypair(program: string, _function: string): KeyPair;
|
|
649
|
-
/**
|
|
650
|
-
* Clear key cache in wasm memory.
|
|
651
|
-
*
|
|
652
|
-
* This method will clear the key cache in wasm memory. It is important to note that this will
|
|
653
|
-
* not DE-allocate the memory assigned to wasm as wasm memory cannot be shrunk. The total
|
|
654
|
-
* memory allocated to wasm will remain constant but will be available for other usage after
|
|
655
|
-
* calling this method.
|
|
656
|
-
*/
|
|
657
|
-
clearKeyCache(): void;
|
|
658
|
-
/**
|
|
659
|
-
* Check if the cache contains a keypair for a specific function
|
|
660
|
-
*
|
|
661
|
-
* @param program_id The name of the program containing the desired function
|
|
662
|
-
* @param function_id The name of the function to retrieve the keys for
|
|
663
|
-
* @param {string} program_id
|
|
664
|
-
* @param {string} function_id
|
|
665
|
-
* @returns {boolean}
|
|
666
|
-
*/
|
|
667
|
-
keyExists(program_id: string, function_id: string): boolean;
|
|
668
|
-
/**
|
|
669
582
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
670
583
|
*
|
|
671
584
|
* @param private_key The private key of the sender
|
|
@@ -673,11 +586,6 @@ export class ProgramManager {
|
|
|
673
586
|
* value of the record and two new records will be created with the split amount and the remainder
|
|
674
587
|
* @param amount_record The record to split
|
|
675
588
|
* @param url The url of the Aleo network node to send the transaction to
|
|
676
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
677
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
678
|
-
* `split_proving_key` and `split_verifying_key` arguments) will be stored in the
|
|
679
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
680
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
681
589
|
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
682
590
|
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
683
591
|
* @returns {Transaction | Error} Transaction object
|
|
@@ -685,73 +593,19 @@ export class ProgramManager {
|
|
|
685
593
|
* @param {number} split_amount
|
|
686
594
|
* @param {RecordPlaintext} amount_record
|
|
687
595
|
* @param {string} url
|
|
688
|
-
* @param {boolean} cache
|
|
689
596
|
* @param {ProvingKey | undefined} split_proving_key
|
|
690
597
|
* @param {VerifyingKey | undefined} split_verifying_key
|
|
691
598
|
* @returns {Promise<Transaction>}
|
|
692
599
|
*/
|
|
693
|
-
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>;
|
|
694
601
|
/**
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* @param
|
|
698
|
-
* @param program The source code of the program being deployed
|
|
699
|
-
* @param imports A javascript object holding the source code of any imported programs in the
|
|
700
|
-
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
701
|
-
* Note that all imported programs must be deployed on chain before the main program in order
|
|
702
|
-
* for the deployment to succeed
|
|
703
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
704
|
-
* @param fee_record The record to spend the fee from
|
|
705
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
706
|
-
* @param cache Cache the synthesized keys for future use
|
|
707
|
-
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
708
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
709
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
710
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
711
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
712
|
-
* @returns {Transaction | Error}
|
|
602
|
+
* @param {string} program_id
|
|
603
|
+
* @param {string} function_id
|
|
604
|
+
* @param {Array<any>} inputs_str
|
|
713
605
|
* @param {PrivateKey} private_key
|
|
714
|
-
* @
|
|
715
|
-
* @param {number} fee_credits
|
|
716
|
-
* @param {RecordPlaintext | undefined} fee_record
|
|
717
|
-
* @param {string} url
|
|
718
|
-
* @param {boolean} cache
|
|
719
|
-
* @param {object | undefined} imports
|
|
720
|
-
* @param {ProvingKey | undefined} fee_proving_key
|
|
721
|
-
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
722
|
-
* @returns {Promise<Transaction>}
|
|
723
|
-
*/
|
|
724
|
-
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>;
|
|
725
|
-
/**
|
|
726
|
-
* Estimate the fee for a program deployment
|
|
727
|
-
*
|
|
728
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
729
|
-
*
|
|
730
|
-
* @param program The source code of the program being deployed
|
|
731
|
-
* @param cache Cache the synthesized keys for future use
|
|
732
|
-
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
733
|
-
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
734
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
735
|
-
* @returns {u64 | Error}
|
|
736
|
-
* @param {string} program
|
|
737
|
-
* @param {boolean} cache
|
|
738
|
-
* @param {object | undefined} imports
|
|
739
|
-
* @returns {Promise<bigint>}
|
|
740
|
-
*/
|
|
741
|
-
estimateDeploymentFee(program: string, cache: boolean, imports?: object): Promise<bigint>;
|
|
742
|
-
/**
|
|
743
|
-
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
744
|
-
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
745
|
-
* the cost of the size (in bytes) of the deployment.
|
|
746
|
-
*
|
|
747
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
748
|
-
*
|
|
749
|
-
* @param name The name of the program to be deployed
|
|
750
|
-
* @returns {u64 | Error}
|
|
751
|
-
* @param {string} name
|
|
752
|
-
* @returns {bigint}
|
|
606
|
+
* @returns {Promise<string>}
|
|
753
607
|
*/
|
|
754
|
-
|
|
608
|
+
authExecute(program_id: string, function_id: string, inputs_str: Array<any>, private_key: PrivateKey): Promise<string>;
|
|
755
609
|
/**
|
|
756
610
|
* Execute an arbitrary function locally
|
|
757
611
|
*
|
|
@@ -762,11 +616,10 @@ export class ProgramManager {
|
|
|
762
616
|
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
763
617
|
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
764
618
|
* will be returned.
|
|
765
|
-
* @param {boolean} cache Cache the proving and verifying keys in the
|
|
766
|
-
* If this is set to 'true' the keys synthesized
|
|
767
|
-
* `
|
|
768
|
-
*
|
|
769
|
-
* 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.
|
|
770
623
|
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
771
624
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
772
625
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
@@ -783,7 +636,7 @@ export class ProgramManager {
|
|
|
783
636
|
* @param {VerifyingKey | undefined} verifying_key
|
|
784
637
|
* @returns {Promise<ExecutionResponse>}
|
|
785
638
|
*/
|
|
786
|
-
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>;
|
|
787
640
|
/**
|
|
788
641
|
* Execute Aleo function and create an Aleo execution transaction
|
|
789
642
|
*
|
|
@@ -794,7 +647,6 @@ export class ProgramManager {
|
|
|
794
647
|
* @param fee_credits The amount of credits to pay as a fee
|
|
795
648
|
* @param fee_record The record to spend the fee from
|
|
796
649
|
* @param url The url of the Aleo network node to send the transaction to
|
|
797
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager's memory.
|
|
798
650
|
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
799
651
|
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
800
652
|
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
@@ -814,7 +666,6 @@ export class ProgramManager {
|
|
|
814
666
|
* @param {number} fee_credits
|
|
815
667
|
* @param {RecordPlaintext | undefined} fee_record
|
|
816
668
|
* @param {string} url
|
|
817
|
-
* @param {boolean} cache
|
|
818
669
|
* @param {object | undefined} imports
|
|
819
670
|
* @param {ProvingKey | undefined} proving_key
|
|
820
671
|
* @param {VerifyingKey | undefined} verifying_key
|
|
@@ -822,7 +673,7 @@ export class ProgramManager {
|
|
|
822
673
|
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
823
674
|
* @returns {Promise<Transaction>}
|
|
824
675
|
*/
|
|
825
|
-
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>;
|
|
826
677
|
/**
|
|
827
678
|
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
828
679
|
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
@@ -835,7 +686,6 @@ export class ProgramManager {
|
|
|
835
686
|
* @param function The name of the function to execute
|
|
836
687
|
* @param inputs A javascript array of inputs to the function
|
|
837
688
|
* @param url The url of the Aleo network node to send the transaction to
|
|
838
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager's memory.
|
|
839
689
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
840
690
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
841
691
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
@@ -847,13 +697,12 @@ export class ProgramManager {
|
|
|
847
697
|
* @param {string} _function
|
|
848
698
|
* @param {Array<any>} inputs
|
|
849
699
|
* @param {string} url
|
|
850
|
-
* @param {boolean} cache
|
|
851
700
|
* @param {object | undefined} imports
|
|
852
701
|
* @param {ProvingKey | undefined} proving_key
|
|
853
702
|
* @param {VerifyingKey | undefined} verifying_key
|
|
854
703
|
* @returns {Promise<bigint>}
|
|
855
704
|
*/
|
|
856
|
-
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>;
|
|
857
706
|
/**
|
|
858
707
|
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
859
708
|
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
@@ -868,7 +717,64 @@ export class ProgramManager {
|
|
|
868
717
|
* @param {string} _function
|
|
869
718
|
* @returns {bigint}
|
|
870
719
|
*/
|
|
871
|
-
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;
|
|
872
778
|
/**
|
|
873
779
|
* Send credits from one Aleo account to another
|
|
874
780
|
*
|
|
@@ -880,13 +786,6 @@ export class ProgramManager {
|
|
|
880
786
|
* @param fee_credits The amount of credits to pay as a fee
|
|
881
787
|
* @param fee_record The record to spend the fee from
|
|
882
788
|
* @param url The url of the Aleo network node to send the transaction to
|
|
883
|
-
* @param cache Cache the proving and verifying keys in the ProgramManager memory. If this is
|
|
884
|
-
* set to `true` the keys synthesized (or passed in as optional parameters via the
|
|
885
|
-
* `transfer_proving_key` and `transfer_verifying_key` arguments) will be stored in the
|
|
886
|
-
* ProgramManager's memory and used for subsequent transactions. If this is set to `false` the
|
|
887
|
-
* proving and verifying keys will be deallocated from memory after the transaction is executed
|
|
888
|
-
* @param transfer_proving_key (optional) Provide a proving key to use for the transfer
|
|
889
|
-
* function
|
|
890
789
|
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
891
790
|
* function
|
|
892
791
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
@@ -900,14 +799,56 @@ export class ProgramManager {
|
|
|
900
799
|
* @param {number} fee_credits
|
|
901
800
|
* @param {RecordPlaintext | undefined} fee_record
|
|
902
801
|
* @param {string} url
|
|
903
|
-
* @param {boolean} cache
|
|
904
802
|
* @param {ProvingKey | undefined} transfer_proving_key
|
|
905
803
|
* @param {VerifyingKey | undefined} transfer_verifying_key
|
|
906
804
|
* @param {ProvingKey | undefined} fee_proving_key
|
|
907
805
|
* @param {VerifyingKey | undefined} fee_verifying_key
|
|
908
806
|
* @returns {Promise<Transaction>}
|
|
909
807
|
*/
|
|
910
|
-
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>;
|
|
911
852
|
}
|
|
912
853
|
/**
|
|
913
854
|
* Proving key for a function within an Aleo program
|
|
@@ -1218,43 +1159,45 @@ export class ViewKey {
|
|
|
1218
1159
|
* @returns {string}
|
|
1219
1160
|
*/
|
|
1220
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;
|
|
1221
1171
|
}
|
|
1222
1172
|
|
|
1223
1173
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
1224
1174
|
|
|
1225
1175
|
export interface InitOutput {
|
|
1226
1176
|
readonly memory: WebAssembly.Memory;
|
|
1227
|
-
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;
|
|
1228
|
-
readonly __wbg_programmanager_free: (a: number) => void;
|
|
1229
|
-
readonly programmanager_new: () => number;
|
|
1230
|
-
readonly programmanager_cacheKeypairInWasmMemory: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
1231
|
-
readonly programmanager_getCachedKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1232
|
-
readonly programmanager_synthesizeKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1233
|
-
readonly programmanager_clearKeyCache: (a: number) => void;
|
|
1234
|
-
readonly programmanager_keyExists: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1235
1177
|
readonly __wbg_recordciphertext_free: (a: number) => void;
|
|
1236
1178
|
readonly recordciphertext_fromString: (a: number, b: number, c: number) => void;
|
|
1237
1179
|
readonly recordciphertext_toString: (a: number, b: number) => void;
|
|
1238
1180
|
readonly recordciphertext_decrypt: (a: number, b: number, c: number) => void;
|
|
1239
1181
|
readonly recordciphertext_isOwner: (a: number, b: number) => number;
|
|
1240
|
-
readonly initThreadPool: (a: number, b: number) => number;
|
|
1241
|
-
readonly init_panic_hook: () => void;
|
|
1242
1182
|
readonly __wbg_keypair_free: (a: number) => void;
|
|
1243
1183
|
readonly keypair_new: (a: number, b: number) => number;
|
|
1244
1184
|
readonly keypair_provingKey: (a: number, b: number) => void;
|
|
1245
1185
|
readonly keypair_verifyingKey: (a: number, b: number) => void;
|
|
1186
|
+
readonly initThreadPool: (a: number, b: number) => number;
|
|
1187
|
+
readonly init_panic_hook: () => void;
|
|
1246
1188
|
readonly __wbg_jsfield_free: (a: number) => void;
|
|
1247
1189
|
readonly jsfield_generate_message_leo: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1248
1190
|
readonly jsfield_generate_message_clients: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1249
|
-
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;
|
|
1250
1192
|
readonly __wbg_provingkey_free: (a: number) => void;
|
|
1251
1193
|
readonly provingkey_fromBytes: (a: number, b: number, c: number) => void;
|
|
1252
1194
|
readonly provingkey_toBytes: (a: number, b: number) => void;
|
|
1253
1195
|
readonly provingkey_copy: (a: number) => number;
|
|
1254
|
-
readonly
|
|
1255
|
-
readonly
|
|
1256
|
-
readonly
|
|
1257
|
-
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;
|
|
1258
1201
|
readonly __wbg_program_free: (a: number) => void;
|
|
1259
1202
|
readonly program_fromString: (a: number, b: number, c: number) => void;
|
|
1260
1203
|
readonly program_toString: (a: number, b: number) => void;
|
|
@@ -1274,41 +1217,31 @@ export interface InitOutput {
|
|
|
1274
1217
|
readonly recordplaintext_microcredits: (a: number) => number;
|
|
1275
1218
|
readonly recordplaintext_nonce: (a: number, b: number) => void;
|
|
1276
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;
|
|
1277
1221
|
readonly __wbg_privatekeyciphertext_free: (a: number) => void;
|
|
1278
1222
|
readonly privatekeyciphertext_encryptPrivateKey: (a: number, b: number, c: number, d: number) => void;
|
|
1279
1223
|
readonly privatekeyciphertext_decryptToPrivateKey: (a: number, b: number, c: number, d: number) => void;
|
|
1280
1224
|
readonly privatekeyciphertext_toString: (a: number, b: number) => void;
|
|
1281
1225
|
readonly privatekeyciphertext_fromString: (a: number, b: number, c: number) => void;
|
|
1282
|
-
readonly programmanager_buildDeploymentTransaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number
|
|
1283
|
-
readonly programmanager_estimateDeploymentFee: (a: number, b: number, c: number
|
|
1284
|
-
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;
|
|
1285
1229
|
readonly __wbg_execution_free: (a: number) => void;
|
|
1286
1230
|
readonly execution_toString: (a: number, b: number) => void;
|
|
1287
1231
|
readonly execution_fromString: (a: number, b: number, c: number) => void;
|
|
1288
1232
|
readonly verifyFunctionExecution: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1289
|
-
readonly
|
|
1290
|
-
readonly
|
|
1291
|
-
readonly
|
|
1292
|
-
readonly
|
|
1293
|
-
readonly
|
|
1294
|
-
readonly
|
|
1295
|
-
readonly __wbg_viewkey_free: (a: number) => void;
|
|
1296
|
-
readonly viewkey_from_private_key: (a: number) => number;
|
|
1297
|
-
readonly viewkey_from_string: (a: number, b: number) => number;
|
|
1298
|
-
readonly viewkey_to_string: (a: number, b: number) => void;
|
|
1299
|
-
readonly viewkey_to_address: (a: number) => number;
|
|
1300
|
-
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;
|
|
1301
1239
|
readonly __wbg_transaction_free: (a: number) => void;
|
|
1302
1240
|
readonly transaction_fromString: (a: number, b: number, c: number) => void;
|
|
1303
1241
|
readonly transaction_toString: (a: number, b: number) => void;
|
|
1304
1242
|
readonly transaction_transactionId: (a: number, b: number) => void;
|
|
1305
1243
|
readonly transaction_transactionType: (a: number, b: number) => void;
|
|
1306
|
-
readonly
|
|
1307
|
-
readonly address_from_private_key: (a: number) => number;
|
|
1308
|
-
readonly address_from_view_key: (a: number) => number;
|
|
1309
|
-
readonly address_from_string: (a: number, b: number) => number;
|
|
1310
|
-
readonly address_to_string: (a: number, b: number) => void;
|
|
1311
|
-
readonly address_verify: (a: number, b: number, c: number, d: number) => number;
|
|
1244
|
+
readonly __wbg_programmanager_free: (a: number) => void;
|
|
1312
1245
|
readonly __wbg_privatekey_free: (a: number) => void;
|
|
1313
1246
|
readonly privatekey_new: () => number;
|
|
1314
1247
|
readonly privatekey_from_seed_unchecked: (a: number, b: number) => number;
|
|
@@ -1316,22 +1249,37 @@ export interface InitOutput {
|
|
|
1316
1249
|
readonly privatekey_to_string: (a: number, b: number) => void;
|
|
1317
1250
|
readonly privatekey_to_seed: (a: number, b: number) => void;
|
|
1318
1251
|
readonly privatekey_to_view_key: (a: number) => number;
|
|
1252
|
+
readonly privatekey_to_address: (a: number) => number;
|
|
1319
1253
|
readonly privatekey_sign: (a: number, b: number, c: number) => number;
|
|
1320
1254
|
readonly privatekey_newEncrypted: (a: number, b: number, c: number) => void;
|
|
1321
1255
|
readonly privatekey_toCiphertext: (a: number, b: number, c: number, d: number) => void;
|
|
1322
1256
|
readonly privatekey_fromPrivateKeyCiphertext: (a: number, b: number, c: number, d: number) => void;
|
|
1323
|
-
readonly
|
|
1324
|
-
readonly
|
|
1325
|
-
readonly
|
|
1326
|
-
readonly
|
|
1327
|
-
readonly
|
|
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;
|
|
1328
1263
|
readonly __wbg_verifyingkey_free: (a: number) => void;
|
|
1329
1264
|
readonly verifyingkey_fromBytes: (a: number, b: number, c: number) => void;
|
|
1330
1265
|
readonly verifyingkey_toBytes: (a: number, b: number) => void;
|
|
1331
1266
|
readonly verifyingkey_fromString: (a: number, b: number, c: number) => void;
|
|
1332
1267
|
readonly verifyingkey_toString: (a: number, b: number) => void;
|
|
1333
1268
|
readonly verifyingkey_copy: (a: number) => number;
|
|
1334
|
-
readonly
|
|
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;
|
|
1335
1283
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1336
1284
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1337
1285
|
readonly __wbindgen_export_2: WebAssembly.Table;
|