Skip to content

Commit

Permalink
refactor: make a SupportedChainID type
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Nov 28, 2024
1 parent b746210 commit c46e396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/components/requirements/ChainIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Badge } from "@/components/ui/Badge";
import { CHAINS } from "@/config/chains";
import type { Register } from "wagmi";
import { CHAINS, type SupportedChainID } from "@/config/chains";

export const ChainIndicator = ({
chain,
}: { chain: Register["config"]["chains"][number]["id"] }) => (
export const ChainIndicator = ({ chain }: { chain: SupportedChainID }) => (
<Badge size="sm">
<img
src={CHAINS[chain].icon}
Expand Down
4 changes: 3 additions & 1 deletion src/config/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ export const CHAINS = {
icon: "/chainLogos/eth.svg",
},
} satisfies Record<
Register["config"]["chains"][number]["id"],
SupportedChainID,
{
name: string;
icon: string;
}
>;

export type SupportedChainID = Register["config"]["chains"][number]["id"];

0 comments on commit c46e396

Please sign in to comment.