-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: metamask * fix: chainId is mismatched
- Loading branch information
Showing
2 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/node_modules/@web3-react/metamask/dist/index.js b/node_modules/@web3-react/metamask/dist/index.js | ||
index c8476dd..a613ed1 100644 | ||
--- a/node_modules/@web3-react/metamask/dist/index.js | ||
+++ b/node_modules/@web3-react/metamask/dist/index.js | ||
@@ -64,7 +64,14 @@ class MetaMask extends types_1.Connector { | ||
this.provider = (_b = this.provider.providers.find((p) => p.isMetaMask)) !== null && _b !== void 0 ? _b : this.provider.providers[0]; | ||
} | ||
this.provider.on('connect', ({ chainId }) => { | ||
- this.actions.update({ chainId: parseChainId(chainId) }); | ||
+ this.provider | ||
+ .request({ method: 'eth_chainId' }) | ||
+ .then(chainId => { | ||
+ this.actions.update({ chainId: parseChainId(chainId) }) | ||
+ }) | ||
+ .catch(() => { | ||
+ this.actions.update({ chainId: parseChainId(chainId) }) | ||
+ }) | ||
}); | ||
this.provider.on('disconnect', (error) => { | ||
var _a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters