From cead3754e0dff7f2deff000cfd06b16cc107a0e5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 7 Mar 2023 11:53:15 +0100 Subject: [PATCH] fix networkStatus --- apps/remix-ide/src/blockchain/blockchain.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) => {