label & comment

pull/1344/head
yann300 3 years ago committed by joseph izang
parent 2adab6474d
commit 5299f5a828
  1. 6
      apps/remix-ide/src/app/tabs/hardhat-provider.js

@ -43,7 +43,7 @@ export default class HardhatProvider extends Plugin {
sendAsync (data) { sendAsync (data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.blocked) return reject(new Error('provider temporarily blocked')) if (this.blocked) return reject(new Error('provider unable to connect'))
// If provider is not set, allow to open modal only when provider is trying to connect // If provider is not set, allow to open modal only when provider is trying to connect
if (!this.provider) { if (!this.provider) {
modalDialogCustom.prompt('Hardhat node request', this.hardhatProviderDialogBody(), 'http://127.0.0.1:8545', (target) => { modalDialogCustom.prompt('Hardhat node request', this.hardhatProviderDialogBody(), 'http://127.0.0.1:8545', (target) => {
@ -66,10 +66,10 @@ export default class HardhatProvider extends Plugin {
this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](data, async (error, message) => { this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](data, async (error, message) => {
if (error) { if (error) {
this.blocked = true this.blocked = true
modalDialogCustom.alert('Hardhat', `Error while connecting to the hardhat provider: ${error.message}`) modalDialogCustom.alert('Hardhat Provider', `Error while connecting to the hardhat provider: ${error.message}`)
await this.call('udapp', 'setEnvironmentMode', 'vm') await this.call('udapp', 'setEnvironmentMode', 'vm')
this.provider = null this.provider = null
setTimeout(_ => { this.blocked = false }, 1000) setTimeout(_ => { this.blocked = false }, 1000) // we wait 1 second for letting remix to switch to vm
return reject(error) return reject(error)
} }
resolve(message) resolve(message)

Loading…
Cancel
Save