From 7f88b141b5f43b4753f19ae661688f1c9d0587d0 Mon Sep 17 00:00:00 2001 From: 0xKurt Date: Wed, 2 Apr 2025 17:05:38 +0200 Subject: [PATCH] donate to gitcoin fix --- .../src/features/round/DonateToGitcoinContext.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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);