update provider on cancel

pull/1222/head
aniket-engg 4 years ago committed by Aniket
parent 8f90b540fb
commit bbd645decb
  1. 2
      apps/remix-ide/src/app.js
  2. 9
      apps/remix-ide/src/app/tabs/hardhat-provider.js
  3. 2
      apps/remix-ide/src/app/tabs/runTab/settings.js

@ -275,6 +275,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const networkModule = new NetworkModule(blockchain) const networkModule = new NetworkModule(blockchain)
// ----------------- represent the current selected web3 provider ---- // ----------------- represent the current selected web3 provider ----
const web3Provider = new Web3ProviderModule(blockchain) const web3Provider = new Web3ProviderModule(blockchain)
const hardhatProvider = new HardhatProvider(blockchain)
// ----------------- convert offset to line/column service ----------- // ----------------- convert offset to line/column service -----------
const offsetToLineColumnConverter = new OffsetToLineColumnConverter() const offsetToLineColumnConverter = new OffsetToLineColumnConverter()
registry.put({ api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter' }) registry.put({ api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter' })
@ -297,7 +298,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl)) makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl))
const contextualListener = new ContextualListener({ editor }) const contextualListener = new ContextualListener({ editor })
const hardhatProvider = new HardhatProvider()
engine.register([ engine.register([
contentImport, contentImport,

@ -11,15 +11,16 @@ const profile = {
} }
export default class HardhatProvider extends Plugin { export default class HardhatProvider extends Plugin {
constructor () { constructor (blockchain) {
super(profile) super(profile)
this.provider = null this.blockchain = blockchain
} }
sendAsync (data) { sendAsync (data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.provider) { const provider = this.blockchain.web3().currentProvider
this.provider[this.provider.sendAsync ? 'sendAsync' : 'send'](data, (error, message) => { if (provider) {
provider[provider.sendAsync ? 'sendAsync' : 'send'](data, (error, message) => {
if (error) return reject(error) if (error) return reject(error)
resolve(message) resolve(message)
}) })

@ -294,7 +294,7 @@ class SettingsUI {
hardhatProviderDialogBody () { hardhatProviderDialogBody () {
return yo` return yo`
<div class=""> <div class="">
Hardhat Provider Endpoint Hardhat JSON-RPC Endpoint
</div> </div>
` `
} }

Loading…
Cancel
Save