diff --git a/src/chain/blockchain.ts b/src/chain/blockchain.ts index 903057d..dc88216 100644 --- a/src/chain/blockchain.ts +++ b/src/chain/blockchain.ts @@ -6,6 +6,7 @@ import { IChainData, } from "../configs/config_chain"; import { + ACCOUNT_CHANGE, EventBus, NEED_CHANGE_CHAIN, NEED_LOGIN, @@ -330,6 +331,12 @@ export class Blockchain { if (UserModule.accountId !== accounts[0]) { this.clearCachedProvider(); await UserModule.LogOut(); + EventBus.$emit(ACCOUNT_CHANGE, accounts[0]); + let event = new Event("account_change", { + bubbles: true, + cancelable: false, + }); + window.dispatchEvent(event); setTimeout(() => { location.reload(); }, 1000); diff --git a/src/index.ts b/src/index.ts index 081a38a..93fd29f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,3 +36,5 @@ export class JCChain { } export * from "./utils/event-bus"; +export * from "./utils/chain.util"; +export * from "./utils/browser";