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).
const RPC_URLS_WITHOUT_FALLBACKS = Object.entries(RPC_URLS).reduce(
(map, [chainId, urls]) => ({
...map,
[chainId]: urls[0],
}),
{}
)
return new WalletConnect({
actions, actions,
options: { options: {
rpc: RPC_URLS, rpc: RPC_URLS_WITHOUT_FALLBACKS,
qrcode: true, qrcode: true,
}, },
onError, 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