Skip to content

Commit

Permalink
fix ethers switch chain issue
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp committed Feb 7, 2024
1 parent d276b54 commit 6726075
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .changeset/mean-dryers-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
'@web3modal/ethers5': patch
'@web3modal/ethers': patch
'@apps/gallery': patch
'@apps/laboratory': patch
'@examples/html-ethers5': patch
'@examples/html-wagmi': patch
'@examples/next-wagmi': patch
'@examples/react-ethers5': patch
'@examples/react-wagmi': patch
'@examples/vue-ethers5': patch
'@examples/vue-wagmi': patch
'@web3modal/common': patch
'@web3modal/core': patch
'@web3modal/polyfills': patch
'@web3modal/scaffold': patch
'@web3modal/scaffold-react': patch
'@web3modal/scaffold-utils': patch
'@web3modal/scaffold-vue': patch
'@web3modal/siwe': patch
'@web3modal/ui': patch
'@web3modal/wagmi': patch
'@web3modal/wallet': patch
---

Fix various issues on ethers/ethers5 package
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class Web3Modal extends Web3ModalScaffold {
await this.switchNetwork(chainId)
} catch (error) {
EthersStoreUtil.setError(error)
throw new Error('networkControllerClient:switchCaipNetwork - unable to switch chain')
}
}
},
Expand Down Expand Up @@ -908,6 +909,7 @@ export class Web3Modal extends Web3ModalScaffold {
params: [{ chainId: EthersHelpersUtil.numberToHexString(chain.chainId) }]
})
EthersStoreUtil.setChainId(chain.chainId)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (switchError: any) {
if (
Expand All @@ -932,6 +934,7 @@ export class Web3Modal extends Web3ModalScaffold {
params: [{ chainId: EthersHelpersUtil.numberToHexString(chain.chainId) }]
})
EthersStoreUtil.setChainId(chain.chainId)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (switchError: any) {
if (
Expand Down
1 change: 1 addition & 0 deletions packages/ethers5/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class Web3Modal extends Web3ModalScaffold {
await this.switchNetwork(chainId)
} catch (error) {
EthersStoreUtil.setError(error)
throw new Error('networkControllerClient:switchCaipNetwork - unable to switch chain')
}
}
},
Expand Down

0 comments on commit 6726075

Please sign in to comment.