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 { try {
if ((window as any) && typeof (window as any).ethereum.enable === 'function') (window as any).ethereum.enable() 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) await addL2Network(this.chainName, this.chainId, this.rpcUrls)
const resultData = await this.provider.currentProvider.send(data.method, data.params) const resultData = await this.provider.currentProvider.send(data.method, data.params)
resolve({ jsonrpc: '2.0', result: resultData.result, id: data.id }) 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).') 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() return cb()
} else { } else {
if (!await injected._metamask.isUnlocked()) this.call('notification', 'toast', 'Please make sure the injected provider is unlocked (e.g Metamask).')
this.askPermission() this.askPermission()
this.executionContext = context this.executionContext = context
web3.setProvider(injectedProvider) web3.setProvider(injectedProvider)

Loading…
Cancel
Save