Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defaults to current network if chain id not specified in QR codes #3929

Merged
merged 8 commits into from
Apr 28, 2022
11 changes: 9 additions & 2 deletions app/core/DeeplinkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ class DeeplinkManager {
_handleNetworkSwitch = (switchToChainId) => {
const { NetworkController, CurrencyRateController } = Engine.context;

// If not specified, use the current network
if (!switchToChainId) {
return;
}

// If current network is the same as the one we want to switch to, do nothing
if (NetworkController?.state?.provider?.chainId === switchToChainId) {
if (NetworkController?.state?.provider?.chainId === String(switchToChainId)) {
return;
}

Expand Down Expand Up @@ -117,7 +122,9 @@ class DeeplinkManager {
const txMeta = { ...ethUrl, source: url };

try {
// Validate and switch network before performing any other action
/**
* Validate and switch network before performing any other action
*/
this._handleNetworkSwitch(ethUrl.chain_id);

switch (ethUrl.function_name) {
Expand Down