diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index d5f747d342..6e72f39b2c 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -49,7 +49,7 @@ export class Blockchain extends Plugin { this.txRunner = new TxRunner(web3Runner, { runAsync: true }) this.networkcallid = 0 - this.networkStatus = { name: ' - ', id: ' - ' } + this.networkStatus = { network: { name: ' - ', id: ' - ' } } this.setupEvents() this.setupProviders() } @@ -76,6 +76,10 @@ export class Blockchain extends Plugin { this.executionContext.event.register('contextChanged', async (context) => { await this.resetEnvironment() this._triggerEvent('contextChanged', [context]) + this.detectNetwork((error, network) => { + this.networkStatus = { network, error } + this._triggerEvent('networkStatus', [this.networkStatus]) + }) }) this.executionContext.event.register('addProvider', (network) => {