Commit 8a5045f6 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: do not test rpc urls before walletconnecting (#5008)

parent c1607bbd
...@@ -52,17 +52,25 @@ export const gnosisSafeConnection: Connection = { ...@@ -52,17 +52,25 @@ export const gnosisSafeConnection: Connection = {
type: ConnectionType.GNOSIS_SAFE, type: ConnectionType.GNOSIS_SAFE,
} }
const [web3WalletConnect, web3WalletConnectHooks] = initializeConnector<WalletConnect>( const [web3WalletConnect, web3WalletConnectHooks] = initializeConnector<WalletConnect>((actions) => {
(actions) => // Avoid testing for the best URL by only passing a single URL per chain.
new WalletConnect({ // Otherwise, WC will not initialize until all URLs have been tested (see getBestUrl in web3-react).
actions, const RPC_URLS_WITHOUT_FALLBACKS = Object.entries(RPC_URLS).reduce(
options: { (map, [chainId, urls]) => ({
rpc: RPC_URLS, ...map,
qrcode: true, [chainId]: urls[0],
}, }),
onError, {}
}) )
) return new WalletConnect({
actions,
options: {
rpc: RPC_URLS_WITHOUT_FALLBACKS,
qrcode: true,
},
onError,
})
})
export const walletConnectConnection: Connection = { export const walletConnectConnection: Connection = {
connector: web3WalletConnect, connector: web3WalletConnect,
hooks: web3WalletConnectHooks, hooks: web3WalletConnectHooks,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment