diff --git a/src/TransactionController.test.ts b/src/TransactionController.test.ts index 2641ad62e9..b2a66bf036 100644 --- a/src/TransactionController.test.ts +++ b/src/TransactionController.test.ts @@ -38,7 +38,8 @@ const MOCK_BLOCK_HISTORY = { const MOCK_PRFERENCES = { state: { selectedAddress: 'foo' } }; const PROVIDER = new HttpProvider('https://ropsten.infura.io'); const MOCK_NETWORK = { - state: { network: '3', provider: PROVIDER }, + provider: PROVIDER, + state: { network: '3' }, subscribe: () => { /* eslint-disable-line no-empty */ } diff --git a/src/TransactionController.ts b/src/TransactionController.ts index 0cf4a83ddf..9e43e5a097 100644 --- a/src/TransactionController.ts +++ b/src/TransactionController.ts @@ -346,10 +346,10 @@ export class TransactionController extends BaseController { - this.ethQuery = provider ? new EthQuery(provider) : /* istanbul ignore next */ null; + const onProviderUpdate = () => { + this.ethQuery = network.provider ? new EthQuery(network.provider) : /* istanbul ignore next */ null; }; - onProviderUpdate(network.state); + onProviderUpdate(); network.subscribe(onProviderUpdate); }