From cfafe83eccc3fc91dfab146e7425831e5e2bf1df Mon Sep 17 00:00:00 2001 From: Luka la d Date: Thu, 16 May 2024 12:59:10 +0200 Subject: [PATCH] fix: - parse unit for claim balance - blockscout chiado support --- components/deposit.tsx | 4 ++-- components/withdrawal.tsx | 8 ++++---- hooks/use-autoclaim.ts | 2 +- hooks/use-deposit.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/deposit.tsx b/components/deposit.tsx index 5360fd0..9f94a4d 100644 --- a/components/deposit.tsx +++ b/components/deposit.tsx @@ -11,7 +11,7 @@ import Link from "next/link"; import { Address } from "viem"; export default function Deposit() { - const { setDepositData, depositData, deposit, depositSuccess, depositHash } = useDeposit(); + const { setDepositData, depositData, deposit, depositSuccess, depositHash, chainId } = useDeposit(); const [errorMessage, setErrorMessage] = useState(""); const [loading, setLoading] = useState(false); const [tx, setTx] = useState
("0x0"); @@ -104,7 +104,7 @@ export default function Deposit() {
Your transaction is completed ! View it - + here . diff --git a/components/withdrawal.tsx b/components/withdrawal.tsx index 67b8f63..4c231cc 100644 --- a/components/withdrawal.tsx +++ b/components/withdrawal.tsx @@ -3,12 +3,12 @@ import useClaimBalance from "@/hooks/use-claim-balance"; import { ArrowUturnLeftIcon, CheckIcon } from "@heroicons/react/20/solid"; import { useCallback, useEffect, useState } from "react"; import Loader from "./loader"; -import { Address } from "viem"; +import { Address, formatEther } from "viem"; import Link from "next/link"; export default function Withdrawal() { const { claim, claimBalance, claimSuccess, claimHash } = useClaimBalance(); - const { register, updateConfig, unregister, isRegister, autoclaimSuccess, autoclaimHash } = useAutoclaim(); + const { register, updateConfig, unregister, isRegister, autoclaimSuccess, autoclaimHash, chainId } = useAutoclaim(); const [timeValue, setTimeValue] = useState(1); const [amountValue, setAmountValue] = useState(1); const [step, setStep] = useState("claim"); @@ -113,7 +113,7 @@ export default function Withdrawal() {
Claimable balance: -
{claimBalance?.toString()} GNOS
+
{Math.round(Number(formatEther(claimBalance || BigInt(0))))} GNOS
@@ -129,7 +129,7 @@ export default function Withdrawal() {
Your transaction is completed ! View it - + here . diff --git a/hooks/use-autoclaim.ts b/hooks/use-autoclaim.ts index a2ca44c..1721f70 100644 --- a/hooks/use-autoclaim.ts +++ b/hooks/use-autoclaim.ts @@ -69,7 +69,7 @@ function useAutoclaim() { } }, [account]); - return { register, updateConfig, unregister, isRegister, autoclaimSuccess, autoclaimHash }; + return { register, updateConfig, unregister, isRegister, autoclaimSuccess, autoclaimHash, chainId }; } export default useAutoclaim; diff --git a/hooks/use-deposit.ts b/hooks/use-deposit.ts index f809540..db97811 100644 --- a/hooks/use-deposit.ts +++ b/hooks/use-deposit.ts @@ -184,7 +184,7 @@ function useDeposit() { } }, [account, deposits, isBatch]); - return { deposit, depositSuccess, depositHash, depositData: { deposits, filename, hasDuplicates, isBatch }, setDepositData, balance, isWrongNetwork }; + return { deposit, depositSuccess, depositHash, depositData: { deposits, filename, hasDuplicates, isBatch }, setDepositData, balance, isWrongNetwork, chainId }; } export default useDeposit;