Skip to content

Commit

Permalink
fix: Compatible with @ethersproject/experimental 5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
karllevine authored Mar 13, 2022
1 parent 7753f97 commit 8d3dc0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@ethersproject/experimental": "^5.5.0",
"@ethersproject/experimental": "^5.6.0",
"@ethersproject/providers": "^5.5.1",
"@web3-react/types": "^8.0.10-beta.0"
},
Expand Down
8 changes: 6 additions & 2 deletions packages/network/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { Connector } from '@web3-react/types'

type url = string | ConnectionInfo

function parseChainId(chainId: string) {
return Number.parseInt(chainId, 16)
}

export class Network extends Connector {
/** {@inheritdoc Connector.provider} */
public provider: Eip1193Bridge | undefined
Expand Down Expand Up @@ -73,8 +77,8 @@ export class Network extends Connector {

return this.provider
.request({ method: 'eth_chainId' })
.then((chainId: number) => {
this.actions.update({ chainId, accounts: [] })
.then((chainId) => {
this.actions.update({ chainId: parseChainId(chainId), accounts: [] })
})
.catch((error: Error) => {
this.actions.reportError(error)
Expand Down

0 comments on commit 8d3dc0d

Please sign in to comment.