diff --git a/packages/blocto-sdk/src/providers/ethereum.ts b/packages/blocto-sdk/src/providers/ethereum.ts index 0670ce1e..b3f8189a 100644 --- a/packages/blocto-sdk/src/providers/ethereum.ts +++ b/packages/blocto-sdk/src/providers/ethereum.ts @@ -756,11 +756,16 @@ export default class EthereumProvider this.networkVersion = `${newChainId}`; this.chainId = `0x${newChainId.toString(16)}`; this.rpc = switchableNetwork[newChainId].rpc_url; + this._blocto = { + ...this._blocto, + blockchainName: '', + networkType: '', + }; if (!oldAccount) { this.eventListeners?.chainChanged.forEach((listener) => listener(this.chainId) ); - this.#getBloctoProperties(); + await this.#getBloctoProperties(); return null; } // Go login flow when switching to a different blocto server @@ -784,6 +789,11 @@ export default class EthereumProvider this.networkVersion = `${oldChainId}`; this.chainId = `0x${oldChainId.toString(16)}`; this.rpc = switchableNetwork[oldChainId].rpc_url; + this._blocto = { + ...this._blocto, + blockchainName: '', + networkType: '', + }; this.#getBloctoProperties(); throw error; }); @@ -843,6 +853,12 @@ export default class EthereumProvider this.networkVersion = `${oldChainId}`; this.chainId = `0x${oldChainId.toString(16)}`; this.rpc = switchableNetwork[oldChainId].rpc_url; + this._blocto = { + ...this._blocto, + blockchainName: '', + networkType: '', + }; + this.#getBloctoProperties(); reject(ethErrors.provider.userRejectedRequest()); } }