diff --git a/garage/src/components/ProposalStatusBadge.tsx b/garage/src/components/ProposalStatusBadge.tsx index 787601eb..fa8781d9 100644 --- a/garage/src/components/ProposalStatusBadge.tsx +++ b/garage/src/components/ProposalStatusBadge.tsx @@ -2,6 +2,7 @@ import React from "react"; import { useBlockNumber } from "wagmi"; import { Badge } from "@chakra-ui/react"; import { Proposal, ProposalStatus } from "~/types"; +import { secondaryChain } from "~/env"; export const proposalStatus = ( blockNumber: bigint | undefined, @@ -17,7 +18,7 @@ export const proposalStatus = ( }; export const ProposalStatusBadge = ({ proposal }: { proposal: Proposal }) => { - const { data: blockNumber } = useBlockNumber(); + const { data: blockNumber } = useBlockNumber({ chainId: secondaryChain.id }); const status = proposalStatus(blockNumber, proposal); return ( diff --git a/garage/src/pages/Dashboard/modules/RigsInventory.tsx b/garage/src/pages/Dashboard/modules/RigsInventory.tsx index 38aa72f7..3b8bf4b2 100644 --- a/garage/src/pages/Dashboard/modules/RigsInventory.tsx +++ b/garage/src/pages/Dashboard/modules/RigsInventory.tsx @@ -143,7 +143,7 @@ const isSelectable = (rig: Rig, selectable: Selectable): boolean => { export const RigsInventory = (props: React.ComponentProps) => { const { actingAsAddress } = useAccount(); const { rigs, refresh } = useOwnedRigs(actingAsAddress); - const { data: currentBlockNumber } = useBlockNumber(); + const { data: currentBlockNumber } = useBlockNumber({ chainId: mainChain.id }); const pilots = useMemo(() => { if (!rigs) return; diff --git a/garage/src/pages/PilotDetails/index.tsx b/garage/src/pages/PilotDetails/index.tsx index 3d40dd7e..148dd69e 100644 --- a/garage/src/pages/PilotDetails/index.tsx +++ b/garage/src/pages/PilotDetails/index.tsx @@ -229,7 +229,7 @@ export const PilotDetails = () => { return !!address && address.toLowerCase() === owner?.toLowerCase(); }, [address, owner]); - const { data: currentBlockNumber } = useBlockNumber(); + const { data: currentBlockNumber } = useBlockNumber({ chainId: mainChain.id }); return ( ({}); const isEligible = (votingPower ?? 0) > 0; @@ -470,7 +470,7 @@ const Votes = ({ }; const Results = ({ proposal, results, refresh, ...props }: ModuleProps) => { - const { data: blockNumber } = useBlockNumber(); + const { data: blockNumber } = useBlockNumber({ chainId: secondaryChain.id }); const totalResults = results.reduce((acc, { result }) => acc + result, 0); @@ -574,8 +574,7 @@ const Header = ({ proposal, results, refresh, ...props }: ModuleProps) => { export const Proposal = () => { const { id } = useParams(); - - const { data: blockNumber } = useBlockNumber(); + const { data: blockNumber } = useBlockNumber({ chainId: secondaryChain.id }); const { data: { proposal, votes, results }, refresh, diff --git a/garage/src/pages/Proposals/index.tsx b/garage/src/pages/Proposals/index.tsx index 144317c9..365b4ac8 100644 --- a/garage/src/pages/Proposals/index.tsx +++ b/garage/src/pages/Proposals/index.tsx @@ -19,6 +19,7 @@ import { proposalStatus, ProposalStatusBadge, } from "~/components/ProposalStatusBadge"; +import { secondaryChain } from "~/env"; const GRID_GAP = 4; @@ -34,12 +35,12 @@ type ModuleProps = React.ComponentProps & { }; const Information = ({ proposal, ...props }: ModuleProps) => { - const { data: blockNumber } = useBlockNumber(); + const { data: blockNumber } = useBlockNumber({ chainId: secondaryChain.id }); - const status = useMemo(() => proposalStatus(blockNumber, proposal), [ - blockNumber, - proposal, - ]); + const status = useMemo( + () => proposalStatus(blockNumber, proposal), + [blockNumber, proposal] + ); const startsIn = proposal.startBlock - Number(blockNumber ?? 0); const endsIn = proposal.endBlock - Number(blockNumber ?? 0); @@ -110,9 +111,7 @@ export const Proposals = () => { {...MODULE_PROPS} /> ))} - {proposals?.length === 0 && ( - Coming soon. - )} + {proposals?.length === 0 && Coming soon.} ); diff --git a/garage/src/pages/RigDetails/index.tsx b/garage/src/pages/RigDetails/index.tsx index 530d71ab..c9b200a3 100644 --- a/garage/src/pages/RigDetails/index.tsx +++ b/garage/src/pages/RigDetails/index.tsx @@ -266,7 +266,9 @@ const FilecoinDealsModal = ({ export const RigDetails = () => { const { id } = useParams(); const { actingAsAddress } = useAccount(); - const { data: currentBlockNumber } = useBlockNumber(); + const { data: currentBlockNumber } = useBlockNumber({ + chainId: mainChain.id, + }); const { rig, refresh: refreshRig } = useRig(id || ""); const { data: contractData, refetch } = useContractReads({ diff --git a/garage/src/pages/RigDetails/modules/Pilots.tsx b/garage/src/pages/RigDetails/modules/Pilots.tsx index 93759e48..84211bc3 100644 --- a/garage/src/pages/RigDetails/modules/Pilots.tsx +++ b/garage/src/pages/RigDetails/modules/Pilots.tsx @@ -88,7 +88,7 @@ export const Pilots = ({ p, ...props }: PilotProps) => { - const { data: blockNumber, refetch } = useBlockNumber(); + const { data: blockNumber, refetch } = useBlockNumber({ chainId: mainChain.id }); useEffect(() => { refetch(); }, [rig, refetch]);