diff --git a/apps/remix-ide/src/app/tabs/injected-provider.tsx b/apps/remix-ide/src/app/tabs/injected-provider.tsx index 77f36f08f5..038919206c 100644 --- a/apps/remix-ide/src/app/tabs/injected-provider.tsx +++ b/apps/remix-ide/src/app/tabs/injected-provider.tsx @@ -31,6 +31,7 @@ export class InjectedProvider extends Plugin { } try { if ((window as any) && typeof (window as any).ethereum.enable === 'function') (window as any).ethereum.enable() + if (!await (window as any).ethereum._metamask.isUnlocked()) this.call('notification', 'toast', 'Please make sure the injected provider is unlocked (e.g Metamask).') await addL2Network(this.chainName, this.chainId, this.rpcUrls) const resultData = await this.provider.currentProvider.send(data.method, data.params) resolve({ jsonrpc: '2.0', result: resultData.result, id: data.id }) diff --git a/apps/remix-ide/src/blockchain/execution-context.js b/apps/remix-ide/src/blockchain/execution-context.js index b04e83d656..10d463d3de 100644 --- a/apps/remix-ide/src/blockchain/execution-context.js +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -155,6 +155,7 @@ export class ExecutionContext { infoCb('No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page).') return cb() } else { + if (!await injected._metamask.isUnlocked()) this.call('notification', 'toast', 'Please make sure the injected provider is unlocked (e.g Metamask).') this.askPermission() this.executionContext = context web3.setProvider(injectedProvider)