Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parse unit for claim balance and support blockscout on chiado chain #33

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Address>("0x0");
Expand Down Expand Up @@ -104,7 +104,7 @@ export default function Deposit() {
<div className="w-full flex flex-col items-center">
<div className="flex items-center">
<CheckIcon className="h-5 w-5" /> Your transaction is completed ! View it
<Link href={"https://gnosis.blockscout.com/tx/" + tx} target="_blank" className="text-[#DD7143] underline ml-1">
<Link href={chainId === 100 ? "https://gnosis.blockscout.com/tx/" + tx : "https://gnosis-chiado.blockscout.com/tx/" + tx} target="_blank" className="text-[#DD7143] underline ml-1">
here
</Link>
.
Expand Down
8 changes: 4 additions & 4 deletions components/withdrawal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -113,7 +113,7 @@ export default function Withdrawal() {
<div className="w-full flex text-sm items-center justify-between">
<div className="w-full flex gap-x-2">
Claimable balance:
<div className="flex font-bold items-center">{claimBalance?.toString()} GNOS</div>
<div className="flex font-bold items-center">{Math.round(Number(formatEther(claimBalance || BigInt(0))))} GNOS</div>
<button className="text-[#DD7143] underline hover:text-[#E07F55]" onClick={onClaim}>
Manual claim
</button>
Expand All @@ -129,7 +129,7 @@ export default function Withdrawal() {
<div className="w-full flex flex-col items-center">
<div className="flex items-center">
<CheckIcon className="h-5 w-5" /> Your transaction is completed ! View it
<Link href={"https://gnosis.blockscout.com/tx/" + tx} target="_blank" className="text-[#DD7143] underline ml-1">
<Link href={chainId === 100 ? "https://gnosis.blockscout.com/tx/" + tx : "https://gnosis-chiado.blockscout.com/tx/" + tx} target="_blank" className="text-[#DD7143] underline ml-1">
here
</Link>
.
Expand Down
2 changes: 1 addition & 1 deletion hooks/use-autoclaim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion hooks/use-deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading