Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3529022
D6653.id22236.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
D6653.id22236.diff
View Options
diff --git a/lib/utils/wagmi-utils.js b/lib/utils/wagmi-utils.js
--- a/lib/utils/wagmi-utils.js
+++ b/lib/utils/wagmi-utils.js
@@ -1,9 +1,13 @@
// @flow
-import { chain, configureChains, createClient } from 'wagmi';
+import { connectorsForWallets, wallet } from '@rainbow-me/rainbowkit';
+import * as React from 'react';
+import { chain, configureChains, createClient, useProvider } from 'wagmi';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { publicProvider } from 'wagmi/providers/public';
+import { ENSCacheProvider } from '../components/ens-cache-provider.react';
+
// details can be found https://0.6.x.wagmi.sh/docs/providers/configuring-chains
type WagmiChainConfiguration = {
@@ -34,4 +38,36 @@
});
}
-export { configureWagmiChains, createWagmiClient };
+const { chains, provider } = configureWagmiChains(process.env.COMM_ALCHEMY_KEY);
+const connectors = connectorsForWallets([
+ {
+ groupName: 'Recommended',
+ wallets: [
+ wallet.injected({ chains }),
+ wallet.rainbow({ chains }),
+ wallet.metaMask({ chains }),
+ wallet.walletConnect({ 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,
+ configureWagmiChains,
+ createWagmiClient,
+};
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -28,6 +28,7 @@
import type { LoadingStatus } from 'lib/types/loading-types';
import type { Dispatch } from 'lib/types/redux-types';
import { registerConfig } from 'lib/utils/config';
+import { WagmiENSCacheProvider, wagmiClient } from 'lib/utils/wagmi-utils';
import AppsDirectory from './apps/apps-directory.react';
import Calendar from './calendar/calendar.react';
@@ -57,7 +58,6 @@
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
diff --git a/web/splash/splash.react.js b/web/splash/splash.react.js
--- a/web/splash/splash.react.js
+++ b/web/splash/splash.react.js
@@ -4,8 +4,9 @@
import _merge from 'lodash/fp/merge';
import * as React from 'react';
+import { wagmiChains } from 'lib/utils/wagmi-utils.js';
+
import LoginForm from '../account/log-in-form.react';
-import { wagmiChains } from '../utils/wagmi-utils.js';
import css from './splash.css';
function Splash(): React.Node {
diff --git a/web/utils/wagmi-utils.js b/web/utils/wagmi-utils.js
deleted file mode 100644
--- a/web/utils/wagmi-utils.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// @flow
-
-import { connectorsForWallets, wallet } 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 = connectorsForWallets([
- {
- groupName: 'Recommended',
- wallets: [
- wallet.injected({ chains }),
- wallet.rainbow({ chains }),
- wallet.metaMask({ chains }),
- wallet.walletConnect({ 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
Wed, Dec 25, 12:02 PM (11 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2702628
Default Alt Text
D6653.id22236.diff (4 KB)
Attached To
Mode
D6653: [lib] Move `web:wagmi-utils` into `lib:wagmi-utils`
Attached
Detach File
Event Timeline
Log In to Comment