From 4d2eb6e094490086457dec08907a409e8ed49341 Mon Sep 17 00:00:00 2001 From: Pedro Rezende Date: Wed, 26 Jun 2024 03:42:59 -0300 Subject: [PATCH 1/3] feat(namadillo): updating transaction fees components --- .../namadillo/src/App/Common/TransactionFees.tsx | 16 +++++++++++----- apps/namadillo/src/App/Governance/SubmitVote.tsx | 1 + .../src/App/Staking/IncrementBonding.tsx | 13 +++++++++---- .../src/App/Staking/ReDelegateAssignStake.tsx | 1 + apps/namadillo/src/App/Staking/Unstake.tsx | 1 + 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/apps/namadillo/src/App/Common/TransactionFees.tsx b/apps/namadillo/src/App/Common/TransactionFees.tsx index 6369d27bf..56b461c92 100644 --- a/apps/namadillo/src/App/Common/TransactionFees.tsx +++ b/apps/namadillo/src/App/Common/TransactionFees.tsx @@ -1,27 +1,33 @@ import clsx from "clsx"; -import { useGasEstimate } from "hooks/useGasEstimate"; +import { useAtomValue } from "jotai"; +import { TxKind, gasLimitsAtom, minimumGasPriceAtom } from "slices/fees"; import { NamCurrency } from "./NamCurrency"; import { TextLink } from "./TextLink"; + type TransactionFeesProps = { + txKind: TxKind; numberOfTransactions: number; className?: string; }; export const TransactionFees = ({ + txKind, numberOfTransactions, className, }: TransactionFeesProps): JSX.Element => { - const { calculateMinGasRequired } = useGasEstimate(); - const minimumGas = calculateMinGasRequired(numberOfTransactions); + const gasLimits = useAtomValue(gasLimitsAtom); + const gasPrice = useAtomValue(minimumGasPriceAtom); - if (!minimumGas || minimumGas.eq(0)) return <>; + if (!gasLimits.isSuccess || !gasPrice.isSuccess) return <>; return (
Transaction fee:{" "}
); 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 }> = ({