Skip to content

Commit 82843bd

Browse files
1.33.0-0.0.1: [fix] Fixes walletconnect hanging on network check (#653)
- Fixes walletconnect hanging on network check
2 parents bb9f6dd + 31ce88c commit 82843bd

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.33.0",
3+
"version": "1.33.0-0.0.1",
44
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
55
"keywords": [
66
"ethereum",

src/modules/check/network.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkName } from '../../utilities'
1+
import { getProviderName, networkName } from '../../utilities'
22
import {
33
WalletCheckModal,
44
StateAndHelpers,
@@ -41,14 +41,18 @@ function network(
4141
})
4242
}
4343
}
44-
try {
45-
await wallet?.provider?.request({
46-
method: 'wallet_switchEthereumChain',
47-
params: [{ chainId: '0x' + appNetworkId?.toString(16) }]
48-
})
49-
} catch (e) {
50-
// Could not switch networks so proceed as normal through the checks
44+
// Adds a check for WalletConnect since it hangs for unsupported rpc methods
45+
if (getProviderName(wallet?.provider) !== 'WalletConnect') {
46+
try {
47+
await wallet?.provider?.request({
48+
method: 'wallet_switchEthereumChain',
49+
params: [{ chainId: '0x' + appNetworkId?.toString(16) }]
50+
})
51+
} catch (e) {
52+
// Could not switch networks so proceed as normal through the checks
53+
}
5154
}
55+
5256
if (stateStore.network.get() != appNetworkId) {
5357
return {
5458
heading: heading || 'You Must Change Networks',

0 commit comments

Comments
 (0)