diff --git a/app/governance/proposal/page.tsx b/app/governance/proposal/page.tsx index d978e95b..9b04bbd9 100644 --- a/app/governance/proposal/page.tsx +++ b/app/governance/proposal/page.tsx @@ -28,6 +28,8 @@ import useStaking from "@/hooks/staking/useStaking"; import { VoteBarGraph } from "../components/votingChart/voteGraph"; import useScreenSize from "@/hooks/helpers/useScreenSize"; import Container from "@/components/container/container"; +import useUserStaking from "@/hooks/staking/userStaking"; +import { formatBalance } from "@/utils/formatting"; const VOTE_OPTION_COLORS = { [VoteOption.YES]: [ @@ -56,10 +58,21 @@ export default function Page() { chainId: chainId, }); - const { userStaking } = useStaking({ + // const { userStaking } = useStaking({ + // chainId: chainId, + // userEthAddress: signer?.account.address, + // }); + const userData = useUserStaking({ chainId: chainId, userEthAddress: signer?.account.address, }); + const totalStakedAmount = + userData.userStaking && userData?.userStaking.length > 0 + ? userData?.userStaking.reduce((totalStaked: number, entry) => { + const balanceAsInt: number = Number(formatBalance(entry.balance, 18)); + return totalStaked + balanceAsInt; + }, 0) + : 0; const { isMobile } = useScreenSize(); // transaction function castVote(proposalId: number, voteOption: VoteOption | null) { @@ -261,7 +274,11 @@ export default function Page() {