1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix misuse of getCurrentNetwork (#10504)

This commit is contained in:
Brad Decker 2021-02-23 12:33:33 -06:00 committed by GitHub
parent 88c50edad3
commit aaec480e32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -22,7 +22,7 @@ async function addEthereumChainHandler(
end, end,
{ {
addCustomRpc, addCustomRpc,
getCurrentNetwork, getCurrentChainId,
findCustomRpcBy, findCustomRpcBy,
updateRpcTarget, updateRpcTarget,
requestUserApproval, requestUserApproval,
@ -122,8 +122,8 @@ async function addEthereumChainHandler(
const existingNetwork = findCustomRpcBy({ chainId: _chainId }); const existingNetwork = findCustomRpcBy({ chainId: _chainId });
if (existingNetwork !== null) { if (existingNetwork !== null) {
const currentNetwork = getCurrentNetwork(); const currentChainId = getCurrentChainId();
if (currentNetwork.chainId === _chainId) { if (currentChainId === _chainId) {
res.result = null; res.result = null;
return end(); return end();
} }

View File

@ -2111,7 +2111,9 @@ export default class MetamaskController extends EventEmitter {
this.alertController, this.alertController,
), ),
findCustomRpcBy: this.findCustomRpcBy.bind(this), findCustomRpcBy: this.findCustomRpcBy.bind(this),
getCurrentNetwork: this.getCurrentNetwork.bind(this), getCurrentChainId: this.networkController.getCurrentChainId.bind(
this.networkController,
),
requestUserApproval: this.approvalController.addAndShowApprovalRequest.bind( requestUserApproval: this.approvalController.addAndShowApprovalRequest.bind(
this.approvalController, this.approvalController,
), ),