Remove forceful parsing to JSON format.
This commit is contained in:
parent
3831694d3e
commit
9363532284
@ -136,7 +136,7 @@ export class TransactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAccountInfo(account: string, cacheSize: number = 100): any {
|
getAccountInfo(account: string, cacheSize: number = 100): any {
|
||||||
const accountInfo = JSON.parse(Envelope.fromJSON(JSON.stringify(account)).unwrap().m.data);
|
const accountInfo = Envelope.fromJSON(JSON.stringify(account)).unwrap().m.data;
|
||||||
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
|
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
|
||||||
this.userService.addAccount(accountInfo, cacheSize);
|
this.userService.addAccount(accountInfo, cacheSize);
|
||||||
return accountInfo;
|
return accountInfo;
|
||||||
|
@ -104,7 +104,6 @@ export class UserService {
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
async (res) => {
|
async (res) => {
|
||||||
const syncableAccount: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
const syncableAccount: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
||||||
syncableAccount.m.data = JSON.parse(syncableAccount.m.data);
|
|
||||||
const update: Array<ArgPair> = [];
|
const update: Array<ArgPair> = [];
|
||||||
for (const prop of Object.keys(accountInfo)) {
|
for (const prop of Object.keys(accountInfo)) {
|
||||||
update.push(new ArgPair(prop, accountInfo[prop]));
|
update.push(new ArgPair(prop, accountInfo[prop]));
|
||||||
@ -180,17 +179,15 @@ export class UserService {
|
|||||||
|
|
||||||
async loadAccounts(limit: number = 100, offset: number = 0): Promise<void> {
|
async loadAccounts(limit: number = 100, offset: number = 0): Promise<void> {
|
||||||
this.resetAccountsList();
|
this.resetAccountsList();
|
||||||
this.registry.onload = async (addressReturned: string): Promise<void> => {
|
const accountIndexAddress: string = await this.registry.getContractAddressByName(
|
||||||
const accountIndexAddress: string = await this.registry.getContractAddressByName(
|
'AccountRegistry'
|
||||||
'AccountRegistry'
|
);
|
||||||
);
|
const accountIndexQuery = new AccountIndex(accountIndexAddress);
|
||||||
const accountIndexQuery = new AccountIndex(accountIndexAddress);
|
const accountAddresses: Array<string> = await accountIndexQuery.last(limit);
|
||||||
const accountAddresses: Array<string> = await accountIndexQuery.last(limit);
|
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
||||||
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
||||||
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
await this.getAccountByAddress(accountAddress, limit);
|
||||||
await this.getAccountByAddress(accountAddress, limit);
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAccountByAddress(
|
async getAccountByAddress(
|
||||||
@ -202,7 +199,7 @@ export class UserService {
|
|||||||
.pipe(first())
|
.pipe(first())
|
||||||
.subscribe(async (res) => {
|
.subscribe(async (res) => {
|
||||||
const account: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
const account: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
||||||
const accountInfo = JSON.parse(account.m.data);
|
const accountInfo = account.m.data;
|
||||||
await personValidation(accountInfo);
|
await personValidation(accountInfo);
|
||||||
this.tokenService.onload = async (status: boolean): Promise<void> => {
|
this.tokenService.onload = async (status: boolean): Promise<void> => {
|
||||||
accountInfo.balance = await this.tokenService.getTokenBalance(
|
accountInfo.balance = await this.tokenService.getTokenBalance(
|
||||||
|
@ -104,6 +104,7 @@ export class AccountDetailsComponent implements OnInit {
|
|||||||
await this.transactionService.init();
|
await this.transactionService.init();
|
||||||
await this.userService.init();
|
await this.userService.init();
|
||||||
await this.blockSyncService.blockSync(this.accountAddress);
|
await this.blockSyncService.blockSync(this.accountAddress);
|
||||||
|
this.userService.resetAccountsList();
|
||||||
(await this.userService.getAccountByAddress(this.accountAddress, 100)).subscribe(
|
(await this.userService.getAccountByAddress(this.accountAddress, 100)).subscribe(
|
||||||
async (res) => {
|
async (res) => {
|
||||||
if (res !== undefined) {
|
if (res !== undefined) {
|
||||||
@ -154,6 +155,7 @@ export class AccountDetailsComponent implements OnInit {
|
|||||||
this.userDataSource.paginator = this.userTablePaginator;
|
this.userDataSource.paginator = this.userTablePaginator;
|
||||||
this.userDataSource.sort = this.userTableSort;
|
this.userDataSource.sort = this.userTableSort;
|
||||||
this.accounts = accounts;
|
this.accounts = accounts;
|
||||||
|
this.cdr.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.transactionService.transactionsSubject.subscribe((transactions) => {
|
this.transactionService.transactionsSubject.subscribe((transactions) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user