diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index b0fd85afcc3..6fa4b5707cf 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -25,7 +25,6 @@ const profile = { displayName: 'Blockchain', description: 'Blockchain - Logic', methods: ['dumpState', 'getCode', 'getTransactionReceipt', 'addProvider', 'removeProvider', 'getCurrentFork', 'isSmartAccount', 'getAccounts', 'web3VM', 'web3', 'getProvider', 'getCurrentProvider', 'getCurrentNetworkStatus', 'getCurrentNetworkCurrency', 'getAllProviders', 'getPinnedProviders', 'changeExecutionContext', 'getProviderObject', 'runTx', 'getBalanceInEther', 'getCurrentProvider', 'deployContractAndLibraries', 'runOrCallContractMethod'], - version: packageJson.version } @@ -123,6 +122,7 @@ export class Blockchain extends Plugin { this.registeredPluginEvents.push(plugin.name) this.on(plugin.name, 'chainChanged', () => { if (plugin.name === this.executionContext.executionContext) { + this.changeExecutionContext({ context: plugin.name }, null, null, null) this.detectNetwork((error, network) => { this.networkStatus = { network, error } if (network.networkNativeCurrency) this.networkNativeCurrency = network.networkNativeCurrency diff --git a/apps/remix-ide/src/blockchain/execution-context.js b/apps/remix-ide/src/blockchain/execution-context.js index b79511bbf96..0cf11d173f4 100644 --- a/apps/remix-ide/src/blockchain/execution-context.js +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -20,7 +20,7 @@ function track(event) { } if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') { var injectedProvider = window.ethereum - provider = new ethers.BrowserProvider(injectedProvider) + provider = new ethers.BrowserProvider(injectedProvider, 'any') } else { provider = new ethers.JsonRpcProvider('http://localhost:8545') } @@ -180,7 +180,7 @@ export class ExecutionContext { await network.init() this.currentFork = network.config.fork // injected - provider = new ethers.BrowserProvider(network.provider) + provider = new ethers.BrowserProvider(network.provider, 'any') this.executionContext = context this.isConnected = await this._updateChainContext() this.event.trigger('contextChanged', [context])