From 69ed43b36e99bab55e92dc61373159d65aec3c96 Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Wed, 21 Dec 2022 17:55:30 +0800 Subject: [PATCH] chanage sth --- src/chain/blockchain.ts | 7 +++++++ src/index.ts | 2 ++ 2 files changed, 9 insertions(+) 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";