Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: enable ens fetching only if mainnet is configured (#1814)
- Loading branch information
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rainbow-me/rainbowkit": patch | ||
--- | ||
|
||
Fixed a bug where wagmi would throw `ChainNotConfiguredError` if `mainnet` is not configured as a chain. This is happening when fetching ens name and ens avatar. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { mainnet } from 'wagmi/chains'; | ||
import { useRainbowKitChains } from '../components/RainbowKitProvider/RainbowKitChainContext'; | ||
|
||
export function useIsMainnetConfigured() { | ||
const rainbowKitChains = useRainbowKitChains(); | ||
|
||
const chainId = mainnet.id; | ||
|
||
const configured = rainbowKitChains.some( | ||
(rainbowKitChain) => rainbowKitChain.id === chainId, | ||
); | ||
|
||
return configured; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters