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:
parent
88c50edad3
commit
aaec480e32
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user