Skip to content

Commit

Permalink
batch details in header
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanjohan committed Sep 11, 2024
1 parent ff978cb commit 78f6dab
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Address } from "viem";
import { useScaffoldReadContract } from "~~/hooks/scaffold-eth";

type BatchProps = {
address: Address;
};

const zeroAddress = "0x0000000000000000000000000000000000000000";

export const BatchDetails = ({ address }: BatchProps) => {
console.log(address);

const { data: allowListed, isLoading: allowListLoading } = useScaffoldReadContract({
contractName: "BatchRegistry",
functionName: "allowList",
args: [address],
});

const { data: checkedIn, isLoading: checkedInLoading } = useScaffoldReadContract({
contractName: "BatchRegistry",
functionName: "yourContractAddress",
args: [address],
});
console.log(allowListed, checkedIn);

return (
<>
{!allowListLoading && !checkedInLoading && (
<div>
<span className="text-xs">{allowListed ? <p>✅ Allow Listed</p> : <p>❌ Not Allow Listed</p>}</span>
<span className="text-xs">{checkedIn != zeroAddress ? <p>✅ Checked in</p> : <p>❌ Not checked in</p>}</span>
</div>
)}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Balance } from "../Balance";
import { AddressInfoDropdown } from "./AddressInfoDropdown";
import { AddressQRCodeModal } from "./AddressQRCodeModal";
import { BatchDetails } from "./BatchDetails";
import { WrongNetworkDropdown } from "./WrongNetworkDropdown";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { Address } from "viem";
Expand Down Expand Up @@ -43,6 +44,9 @@ export const RainbowKitCustomConnectButton = () => {

return (
<>
<div className="flex flex-col items-center mr-1">
<BatchDetails address={account.address as Address} />
</div>
<div className="flex flex-col items-center mr-1">
<Balance address={account.address as Address} className="min-h-0 h-auto" />
<span className="text-xs" style={{ color: networkColor }}>
Expand Down

0 comments on commit 78f6dab

Please sign in to comment.