Skip to content

Commit

Permalink
Merge pull request #33 from gnosischain/dev
Browse files Browse the repository at this point in the history
fix: parse unit for claim balance and support blockscout on chiado chain
  • Loading branch information
giacomognosis committed May 16, 2024
2 parents 80c7dc1 + cfafe83 commit 2fdc559
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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;

0 comments on commit 2fdc559

Please sign in to comment.