You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Destructure the options object to access the parameters.
790
+
const{
791
+
programName,
792
+
functionName,
793
+
baseFee,
794
+
priorityFee,
795
+
privateFee,
796
+
inputs,
797
+
recordSearchParams,
798
+
broadcast =false,
799
+
}=options;
800
+
801
+
constprivateKey=options.privateKey;
802
+
letprogram=options.programSource;
803
+
letfeeRecord=options.feeRecord;
804
+
letimports=options.programImports;
805
+
806
+
// Ensure the function exists on the network.
807
+
if(program===undefined){
808
+
try{
809
+
program=<string>(
810
+
awaitthis.networkClient.getProgram(programName)
811
+
);
812
+
}catch(e: any){
813
+
logAndThrow(
814
+
`Error finding ${programName}. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`,
815
+
);
816
+
}
817
+
}elseif(programinstanceofProgram){
818
+
program=program.toString();
819
+
}
820
+
821
+
// Get the private key from the account if it is not provided in the parameters.
822
+
letexecutionPrivateKey=privateKey;
823
+
if(
824
+
typeofprivateKey==="undefined"&&
825
+
typeofthis.account!=="undefined"
826
+
){
827
+
executionPrivateKey=this.account.privateKey();
828
+
}
829
+
830
+
if(typeofexecutionPrivateKey==="undefined"){
831
+
throw"No private key provided and no private key set in the ProgramManager";
832
+
}
833
+
834
+
// Get the fee record from the account if it is not provided in the parameters.
835
+
try{
836
+
feeRecord=privateFee
837
+
? <RecordPlaintext>(
838
+
awaitthis.getCreditsRecord(
839
+
priorityFee,
840
+
[],
841
+
feeRecord,
842
+
recordSearchParams,
843
+
)
844
+
)
845
+
: undefined;
846
+
}catch(e: any){
847
+
logAndThrow(
848
+
`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`,
`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`,
* Builds a SnarkVM fee `Authorization` for `credits.aleo/fee_private` or `credits.aleo/fee_public`. If a record is provided `fee_private` will be executed, otherwise `fee_public` will be executed.
701
882
*
@@ -2283,4 +2464,4 @@ function validateTransferType(transferType: string): string {
0 commit comments