@ -89,14 +89,21 @@ module.exports = class NetworkController extends EventEmitter {
type : 'rpc' ,
type : 'rpc' ,
rpcTarget ,
rpcTarget ,
}
}
this . providerStore . updateState ( providerConfig )
this . providerConfig = providerConfig
this . _switchNetwork ( providerConfig )
}
}
async setProviderType ( type ) {
async setProviderType ( type ) {
assert . notEqual ( type , 'rpc' , ` NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget" ` )
assert . notEqual ( type , 'rpc' , ` NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget" ` )
assert ( INFURA _PROVIDER _TYPES . includes ( type ) || type === LOCALHOST , ` NetworkController - Unknown rpc type " ${ type } " ` )
assert ( INFURA _PROVIDER _TYPES . includes ( type ) || type === LOCALHOST , ` NetworkController - Unknown rpc type " ${ type } " ` )
const providerConfig = { type }
const providerConfig = { type }
this . providerConfig = providerConfig
}
resetConnection ( ) {
this . providerConfig = this . getProviderConfig ( )
}
set providerConfig ( providerConfig ) {
this . providerStore . updateState ( providerConfig )
this . providerStore . updateState ( providerConfig )
this . _switchNetwork ( providerConfig )
this . _switchNetwork ( providerConfig )
}
}