diff --git a/src/AeSdkWallet.ts b/src/AeSdkWallet.ts index 879a2fd916..a4ac0ec0c6 100644 --- a/src/AeSdkWallet.ts +++ b/src/AeSdkWallet.ts @@ -109,9 +109,10 @@ export default class AeSdkWallet extends AeSdk { _pushAccountsToApps(): void { if (this._clients == null) return; Array.from(this._clients.keys()) - .filter((clientId) => this._isRpcClientSubscribed(clientId)) - .map((clientId) => this._getClient(clientId).rpc) - .forEach((client) => client.notify(METHODS.updateAddress, this.getAccounts())); + .filter((clientId) => this._isRpcClientConnected(clientId)) + .map((clientId) => this._getClient(clientId)) + .filter((client) => client.addressSubscription.size !== 0) + .forEach((client) => client.rpc.notify(METHODS.updateAddress, this.getAccounts())); } override selectAccount(address: Encoded.AccountAddress): void { @@ -149,11 +150,6 @@ export default class AeSdkWallet extends AeSdk { return client; } - _isRpcClientSubscribed(clientId: string): boolean { - return this._isRpcClientConnected(clientId) - && this._getClient(clientId).addressSubscription.size !== 0; - } - _isRpcClientConnected(clientId: string): boolean { return RPC_STATUS.CONNECTED === this._getClient(clientId).status && this._getClient(clientId).rpc.connection.isConnected(); @@ -238,7 +234,7 @@ export default class AeSdkWallet extends AeSdk { }; }, [METHODS.address]: async (params, origin) => { - if (!this._isRpcClientSubscribed(id)) throw new RpcNotAuthorizeError(); + if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError(); await this.onAskAccounts(id, params, origin); return this.addresses(); },