diff --git a/apps/namadillo/src/App/Common/FeeWarning.tsx b/apps/namadillo/src/App/Common/FeeWarning.tsx new file mode 100644 index 000000000..221159c17 --- /dev/null +++ b/apps/namadillo/src/App/Common/FeeWarning.tsx @@ -0,0 +1,12 @@ +import { IoWarningOutline } from "react-icons/io5"; + +export const FeeWarning = (): JSX.Element => { + return ( +
+ + + + Remember to keep a small amount of NAM for fees +
+ ); +}; diff --git a/apps/namadillo/src/App/Common/TransactionFees.tsx b/apps/namadillo/src/App/Common/TransactionFees.tsx index 6369d27bf..306107291 100644 --- a/apps/namadillo/src/App/Common/TransactionFees.tsx +++ b/apps/namadillo/src/App/Common/TransactionFees.tsx @@ -1,28 +1,42 @@ +import { gasLimitsAtom, minimumGasPriceAtom } from "atoms/fees"; import clsx from "clsx"; -import { useGasEstimate } from "hooks/useGasEstimate"; +import { useAtomValue } from "jotai"; +import { TxKind } from "types"; +import { FeeWarning } from "./FeeWarning"; import { NamCurrency } from "./NamCurrency"; -import { TextLink } from "./TextLink"; + type TransactionFeesProps = { + txKind: TxKind; numberOfTransactions: number; + displayWarning?: boolean; className?: string; }; export const TransactionFees = ({ + txKind, numberOfTransactions, + displayWarning, className, }: TransactionFeesProps): JSX.Element => { - const { calculateMinGasRequired } = useGasEstimate(); - const minimumGas = calculateMinGasRequired(numberOfTransactions); + const gasLimits = useAtomValue(gasLimitsAtom); + const gasPrice = useAtomValue(minimumGasPriceAtom); + + if (!gasLimits.isSuccess || !gasPrice.isSuccess || numberOfTransactions === 0) + return <>; - if (!minimumGas || minimumGas.eq(0)) return <>; return ( -
- Transaction fee:{" "} - +
+
+ Transaction fee:{" "} + +
+ {displayWarning && }
); }; diff --git a/apps/namadillo/src/App/Governance/SubmitVote.tsx b/apps/namadillo/src/App/Governance/SubmitVote.tsx index be7c1d668..5eca097f5 100644 --- a/apps/namadillo/src/App/Governance/SubmitVote.tsx +++ b/apps/namadillo/src/App/Governance/SubmitVote.tsx @@ -175,6 +175,7 @@ export const WithProposalId: React.FC<{ proposalId: bigint }> = ({
diff --git a/apps/namadillo/src/App/Staking/ReDelegateAssignStake.tsx b/apps/namadillo/src/App/Staking/ReDelegateAssignStake.tsx index 3fd6ce9ef..0f39399e5 100644 --- a/apps/namadillo/src/App/Staking/ReDelegateAssignStake.tsx +++ b/apps/namadillo/src/App/Staking/ReDelegateAssignStake.tsx @@ -135,7 +135,9 @@ export const ReDelegateAssignStake = ({ : "Re-Delegate"} diff --git a/apps/namadillo/src/App/Staking/Unstake.tsx b/apps/namadillo/src/App/Staking/Unstake.tsx index edee1d459..34e2f4e40 100644 --- a/apps/namadillo/src/App/Staking/Unstake.tsx +++ b/apps/namadillo/src/App/Staking/Unstake.tsx @@ -253,7 +253,9 @@ const Unstake = (): JSX.Element => { : validationMessage || "Unstake"} diff --git a/apps/namadillo/src/atoms/fees/services.ts b/apps/namadillo/src/atoms/fees/services.ts index 657dad217..06a827d32 100644 --- a/apps/namadillo/src/atoms/fees/services.ts +++ b/apps/namadillo/src/atoms/fees/services.ts @@ -30,7 +30,8 @@ export const fetchMinimumGasPrice = async ( ({ token }) => token === nativeToken ); invariant(!!nativeTokenCost, "Error querying minimum gas price"); - const asBigNumber = new BigNumber(nativeTokenCost.amount); + // TODO: this should be removed after indexer error is fixed! + const asBigNumber = new BigNumber(nativeTokenCost.amount).dividedBy(100000); invariant( !asBigNumber.isNaN(), "Error converting minimum gas price to BigNumber"