diff --git a/components/forms/DelegationForm.tsx b/components/forms/DelegationForm.tsx index c798eeb..3a025bb 100644 --- a/components/forms/DelegationForm.tsx +++ b/components/forms/DelegationForm.tsx @@ -27,7 +27,9 @@ const DelegationForm = (props: Props) => { const [_processing, setProcessing] = useState(false); const [addressError, setAddressError] = useState(""); - const createTransaction = (txValidatorAddress: string, txAmount: string, txGas: number) => { + const createTransaction = (txValidatorAddress: string, txAmount: string, gasLimit: number) => { + assert(Number.isSafeInteger(gasLimit) && gasLimit > 0, "gas limit must be a positive integer"); + const amountInAtomics = Decimal.fromUserInput( txAmount, Number(state.chain.displayDenomExponent), @@ -45,7 +47,7 @@ const DelegationForm = (props: Props) => { value: msgDelegate, }; assert(gasPrice, "gasPrice missing"); - const fee = calculateFee(Number(txGas), gasPrice); + const fee = calculateFee(gasLimit, gasPrice); const { accountOnChain } = props; assert(accountOnChain, "accountOnChain missing"); return { diff --git a/components/forms/TransactionForm.tsx b/components/forms/TransactionForm.tsx index ee28927..1531d0f 100644 --- a/components/forms/TransactionForm.tsx +++ b/components/forms/TransactionForm.tsx @@ -28,7 +28,9 @@ const TransactionForm = (props: Props) => { const [_processing, setProcessing] = useState(false); const [addressError, setAddressError] = useState(""); - const createTransaction = (txToAddress: string, txAmount: string, txGas: number) => { + const createTransaction = (txToAddress: string, txAmount: string, gasLimit: number) => { + assert(Number.isSafeInteger(gasLimit) && gasLimit > 0, "gas limit must be a positive integer"); + const amountInAtomics = Decimal.fromUserInput( txAmount, Number(state.chain.displayDenomExponent), @@ -48,7 +50,7 @@ const TransactionForm = (props: Props) => { value: msgSend, }; assert(gasPrice, "gasPrice missing"); - const fee = calculateFee(Number(txGas), gasPrice); + const fee = calculateFee(gasLimit, gasPrice); const { accountOnChain } = props; assert(accountOnChain, "accountOnChain missing"); return {