add toast if injected provider locked

pull/2584/head
yann300 3 years ago
parent f155b64a98
commit 9326fde4ef
  1. 1
      apps/remix-ide/src/app/tabs/injected-provider.tsx
  2. 1
      apps/remix-ide/src/blockchain/execution-context.js

@ -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 })

@ -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)

Loading…
Cancel
Save