Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3345777
D11490.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11490.diff
View Options
diff --git a/landing/siwe.react.js b/landing/siwe.react.js
--- a/landing/siwe.react.js
+++ b/landing/siwe.react.js
@@ -20,7 +20,10 @@
siweMessageSigningExplanationStatements,
createSIWEMessage,
} from 'lib/utils/siwe-utils.js';
-import { AlchemyENSCacheProvider, wagmiConfig } from 'lib/utils/wagmi-utils.js';
+import {
+ AlchemyENSCacheProvider,
+ getWagmiConfig,
+} from 'lib/utils/wagmi-utils.js';
import { SIWEContext } from './siwe-context.js';
import css from './siwe.css';
@@ -33,6 +36,8 @@
window.ReactNativeWebView?.postMessage?.(JSON.stringify(message));
}
+const wagmiConfig = getWagmiConfig();
+
type Signer = {
+signMessage: ({ +message: string, ... }) => Promise<string>,
...
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
@@ -17,31 +17,40 @@
import { ENSCacheProvider } from '../components/ens-cache-provider.react.js';
-const wallets = [injectedWallet];
const projectId = process.env.COMM_WALLETCONNECT_KEY;
-if (projectId) {
- wallets.push(rainbowWallet, metaMaskWallet, walletConnectWallet);
-}
-
-const connectors = connectorsForWallets(
- [{ groupName: 'Recommended', wallets }],
- {
- appName: 'Comm',
- projectId,
- },
-);
-
const alchemyKey = process.env.COMM_ALCHEMY_KEY;
const transport = alchemyKey
? http(`https://eth-mainnet.g.alchemy.com/v2/${alchemyKey}`)
: http();
-const wagmiConfig: mixed = createConfig({
- connectors,
- chains: [mainnet],
- transports: {
- [mainnet.id]: transport,
- },
-});
+
+type GetWagmiConfigParams = {
+ +includeInjectedWallet?: ?boolean,
+};
+function getWagmiConfig(params?: ?GetWagmiConfigParams): mixed {
+ const wallets = [];
+ if (params?.includeInjectedWallet) {
+ wallets.push(injectedWallet);
+ }
+ if (projectId) {
+ wallets.push(rainbowWallet, metaMaskWallet, walletConnectWallet);
+ }
+
+ const connectors = connectorsForWallets(
+ [{ groupName: 'Recommended', wallets }],
+ {
+ appName: 'Comm',
+ projectId,
+ },
+ );
+
+ return createConfig({
+ connectors,
+ chains: [mainnet],
+ transports: {
+ [mainnet.id]: transport,
+ },
+ });
+}
const ethersAlchemyProvider = new AlchemyProvider('mainnet', alchemyKey);
@@ -57,4 +66,4 @@
);
}
-export { wagmiConfig, AlchemyENSCacheProvider };
+export { getWagmiConfig, AlchemyENSCacheProvider };
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -38,7 +38,10 @@
import { getConfig, registerConfig } from 'lib/utils/config.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import { infoFromURL } from 'lib/utils/url-utils.js';
-import { AlchemyENSCacheProvider, wagmiConfig } from 'lib/utils/wagmi-utils.js';
+import {
+ AlchemyENSCacheProvider,
+ getWagmiConfig,
+} from 'lib/utils/wagmi-utils.js';
import QrCodeLogin from './account/qr-code-login.react.js';
import AppThemeWrapper from './app-theme-wrapper.react.js';
@@ -122,6 +125,8 @@
const queryClient = new QueryClient();
+const wagmiConfig = getWagmiConfig({ includeInjectedWallet: true });
+
type BaseProps = {
+location: {
+pathname: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 6:57 AM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569535
Default Alt Text
D11490.diff (3 KB)
Attached To
Mode
D11490: [lib][web][landing] Don't include injectedWallet in mobile experience
Attached
Detach File
Event Timeline
Log In to Comment