Skip to content

Commit 3b9a961

Browse files
authored
donate to gitcoin fix (#3815)
1 parent d11511d commit 3b9a961

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/grant-explorer/src/features/round/DonateToGitcoinContext.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export function DonateToGitcoinProvider({
9898
}: {
9999
children: React.ReactNode;
100100
}) {
101-
const [isEnabled, setIsEnabled] = useState(true);
102101
const [selectedChainId, setSelectedChainId] = useState<number | null>(null);
102+
const [isEnabled, setIsEnabled] = useState(false);
103103
const [selectedToken, setSelectedToken] = useState("");
104104
const [amount, setAmount] = useState("0.00");
105105
const [directAllocationPoolId, setDirectAllocationPoolId] = useState<
@@ -197,6 +197,17 @@ export function DonateToGitcoinProvider({
197197
fetchBalances();
198198
}, [address, tokenFilters]);
199199

200+
useEffect(() => {
201+
if (tokenFilters) {
202+
const hasGitcoinSupportedChain = tokenFilters.some((filter) =>
203+
Object.keys(GITCOIN_RECIPIENT_CONFIG).includes(
204+
filter.chainId.toString()
205+
)
206+
);
207+
setIsEnabled(hasGitcoinSupportedChain);
208+
}
209+
}, [tokenFilters]);
210+
200211
useEffect(() => {
201212
if (!isEnabled) {
202213
setSelectedChainId(null);

0 commit comments

Comments
 (0)