Add token balance after response from worker.

This commit is contained in:
Spencer Ofwiti 2021-07-13 19:13:48 +03:00
parent b6e81bcbe1
commit ab4cb59975

View File

@ -211,6 +211,13 @@ export class UserService {
if (typeof Worker !== 'undefined') {
const worker = new Worker('@app/_workers/fetch-accounts.worker', { type: 'module' });
worker.onmessage = ({ data }) => {
this.tokenService.load.subscribe(async (status: boolean) => {
if (status) {
data.balance = await this.tokenService.getTokenBalance(
data.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
);
}
});
this.addAccount(data, limit);
};
worker.postMessage({