diff --git a/packages/grant-explorer/src/features/round/DonateToGitcoinContext.tsx b/packages/grant-explorer/src/features/round/DonateToGitcoinContext.tsx index 795b59cdf..ca3c58520 100644 --- a/packages/grant-explorer/src/features/round/DonateToGitcoinContext.tsx +++ b/packages/grant-explorer/src/features/round/DonateToGitcoinContext.tsx @@ -98,8 +98,8 @@ export function DonateToGitcoinProvider({ }: { children: React.ReactNode; }) { - const [isEnabled, setIsEnabled] = useState(true); const [selectedChainId, setSelectedChainId] = useState(null); + const [isEnabled, setIsEnabled] = useState(false); const [selectedToken, setSelectedToken] = useState(""); const [amount, setAmount] = useState("0.00"); const [directAllocationPoolId, setDirectAllocationPoolId] = useState< @@ -197,6 +197,17 @@ export function DonateToGitcoinProvider({ fetchBalances(); }, [address, tokenFilters]); + useEffect(() => { + if (tokenFilters) { + const hasGitcoinSupportedChain = tokenFilters.some((filter) => + Object.keys(GITCOIN_RECIPIENT_CONFIG).includes( + filter.chainId.toString() + ) + ); + setIsEnabled(hasGitcoinSupportedChain); + } + }, [tokenFilters]); + useEffect(() => { if (!isEnabled) { setSelectedChainId(null);