Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3490068
D6374.id21287.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6374.id21287.diff
View Options
diff --git a/web/account/siwe.react.js b/web/account/siwe.react.js
--- a/web/account/siwe.react.js
+++ b/web/account/siwe.react.js
@@ -5,7 +5,6 @@
import {
ConnectButton,
darkTheme,
- getDefaultWallets,
RainbowKitProvider,
useConnectModal,
} from '@rainbow-me/rainbowkit';
@@ -13,7 +12,7 @@
import _merge from 'lodash/fp/merge';
import * as React from 'react';
import { FaEthereum } from 'react-icons/fa';
-import { useAccount, useSigner, WagmiConfig } from 'wagmi';
+import { useAccount, useSigner } from 'wagmi';
import {
getSIWENonce,
@@ -32,18 +31,14 @@
siweMessageSigningExplanationStatements,
siweStatementWithoutPublicKey,
} from 'lib/utils/siwe-utils.js';
-import { configureWagmiChains, createWagmiClient } from 'lib/utils/wagmi-utils';
import Button from '../components/button.react';
import LoadingIndicator from '../loading-indicator.react';
import { useSelector } from '../redux/redux-utils';
import { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';
+import { wagmiChains } from '../utils/wagmi-utils';
import css from './siwe.css';
-const { chains, provider } = configureWagmiChains(process.env.COMM_ALCHEMY_KEY);
-const { connectors } = getDefaultWallets({ appName: 'comm', chains });
-const wagmiClient = createWagmiClient({ connectors, provider });
-
const getSIWENonceLoadingStatusSelector = createLoadingStatusSelector(
getSIWENonceActionTypes,
);
@@ -191,11 +186,9 @@
});
}, []);
return (
- <WagmiConfig client={wagmiClient}>
- <RainbowKitProvider chains={chains} theme={theme} modalSize="compact">
- <SIWE />
- </RainbowKitProvider>
- </WagmiConfig>
+ <RainbowKitProvider chains={wagmiChains} theme={theme} modalSize="compact">
+ <SIWE />
+ </RainbowKitProvider>
);
}
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -9,6 +9,7 @@
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { useDispatch } from 'react-redux';
+import { WagmiConfig } from 'wagmi';
import {
fetchEntriesActionTypes,
@@ -55,6 +56,7 @@
import getTitle from './title/getTitle';
import { type NavInfo } from './types/nav-types';
import { canonicalURLFromReduxState, navInfoFromURL } from './url-utils';
+import { WagmiENSCacheProvider, wagmiClient } from './utils/wagmi-utils';
// We want Webpack's css-loader and style-loader to handle the Fontawesome CSS,
// so we disable the autoAddCss logic and import the CSS file. Otherwise every
@@ -153,12 +155,16 @@
<DndProvider backend={HTML5Backend}>
<TooltipProvider>
<MenuProvider>
- <FocusHandler />
- <VisibilityHandler />
- <DeviceIDUpdater />
- <PolicyAcknowledgmentHandler />
- {content}
- {this.props.modals}
+ <WagmiConfig client={wagmiClient}>
+ <WagmiENSCacheProvider>
+ <FocusHandler />
+ <VisibilityHandler />
+ <DeviceIDUpdater />
+ <PolicyAcknowledgmentHandler />
+ {content}
+ {this.props.modals}
+ </WagmiENSCacheProvider>
+ </WagmiConfig>
</MenuProvider>
</TooltipProvider>
</DndProvider>
diff --git a/web/utils/wagmi-utils.js b/web/utils/wagmi-utils.js
new file mode 100644
--- /dev/null
+++ b/web/utils/wagmi-utils.js
@@ -0,0 +1,26 @@
+// @flow
+
+import { getDefaultWallets } from '@rainbow-me/rainbowkit';
+import * as React from 'react';
+import { useProvider } from 'wagmi';
+
+import { ENSCacheProvider } from 'lib/components/ens-cache-provider.react';
+import { configureWagmiChains, createWagmiClient } from 'lib/utils/wagmi-utils';
+
+const { chains, provider } = configureWagmiChains(process.env.COMM_ALCHEMY_KEY);
+const { connectors } = getDefaultWallets({ appName: 'comm', chains });
+const wagmiClient: mixed = createWagmiClient({ connectors, provider });
+const wagmiChains: mixed = chains;
+
+type Props = {
+ +children: React.Node,
+};
+function WagmiENSCacheProvider(props: Props): React.Node {
+ const { children } = props;
+ const wagmiProvider = useProvider();
+ return (
+ <ENSCacheProvider provider={wagmiProvider}>{children}</ENSCacheProvider>
+ );
+}
+
+export { wagmiClient, wagmiChains, WagmiENSCacheProvider };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 2:46 PM (20 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677322
Default Alt Text
D6374.id21287.diff (4 KB)
Attached To
Mode
D6374: [web] Configure ENSCacheProvider
Attached
Detach File
Event Timeline
Log In to Comment