fix: multisig web3
This commit is contained in:
@@ -9,4 +9,5 @@ export const ENV = {
|
||||
dsn: windowOrDefault('NX_SENTRY_DSN'),
|
||||
flags: {},
|
||||
dataSources: {},
|
||||
WALLETCONNECT_PROJECT_ID: windowOrDefault('NX_WALLETCONNECT_PROJECT_ID'),
|
||||
};
|
||||
|
||||
@@ -5,23 +5,23 @@ import {
|
||||
initializeMetaMaskConnector,
|
||||
initializeWalletConnector,
|
||||
} from '@vegaprotocol/web3';
|
||||
import { ENV } from '../config/env';
|
||||
|
||||
export const createDefaultProvider = (providerUrl: string, chainId: number) => {
|
||||
return new ethers.providers.JsonRpcProvider(providerUrl, chainId);
|
||||
};
|
||||
|
||||
const [metamask, metamaskHooks] = initializeMetaMaskConnector();
|
||||
|
||||
export const createConnectors = (providerUrl: string, chainId: number) => {
|
||||
if (isNaN(chainId)) {
|
||||
throw new Error('Invalid Ethereum chain ID for environment');
|
||||
}
|
||||
const [walletconnect, walletconnectHooks] = initializeWalletConnector(
|
||||
chainId,
|
||||
providerUrl
|
||||
);
|
||||
|
||||
return [
|
||||
[metamask, metamaskHooks],
|
||||
[walletconnect, walletconnectHooks],
|
||||
] as [Connector, Web3ReactHooks][];
|
||||
initializeMetaMaskConnector(),
|
||||
initializeWalletConnector(
|
||||
ENV.WALLETCONNECT_PROJECT_ID,
|
||||
chainId,
|
||||
providerUrl
|
||||
),
|
||||
].filter(Boolean) as unknown as [Connector, Web3ReactHooks][];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user