Refactor transactions table to show address before loading account meta.

This commit is contained in:
Spencer Ofwiti 2021-05-26 11:30:38 +03:00
parent 9782c919d5
commit 16af939af7
8 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import Web3 from 'web3'; import Web3 from 'web3';
import {Web3Service} from '@app/_services/web3.service'; import { Web3Service } from '@app/_services/web3.service';
const abi: Array<any> = require('@src/assets/js/block-sync/data/AccountsIndex.json'); const abi: Array<any> = require('@src/assets/js/block-sync/data/AccountsIndex.json');
const web3: Web3 = Web3Service.getInstance(); const web3: Web3 = Web3Service.getInstance();

View File

@ -1,5 +1,5 @@
import Web3 from 'web3'; import Web3 from 'web3';
import {Web3Service} from '@app/_services/web3.service'; import { Web3Service } from '@app/_services/web3.service';
const abi: Array<any> = require('@src/assets/js/block-sync/data/TokenUniqueSymbolIndex.json'); const abi: Array<any> = require('@src/assets/js/block-sync/data/TokenUniqueSymbolIndex.json');
const web3: Web3 = Web3Service.getInstance(); const web3: Web3 = Web3Service.getInstance();

View File

@ -6,7 +6,7 @@ import { TransactionService } from '@app/_services/transaction.service';
import { environment } from '@src/environments/environment'; import { environment } from '@src/environments/environment';
import { LoggingService } from '@app/_services/logging.service'; import { LoggingService } from '@app/_services/logging.service';
import { RegistryService } from '@app/_services/registry.service'; import { RegistryService } from '@app/_services/registry.service';
import {Web3Service} from '@app/_services/web3.service'; import { Web3Service } from '@app/_services/web3.service';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { environment } from '@src/environments/environment'; import { environment } from '@src/environments/environment';
import { CICRegistry, FileGetter } from 'cic-client'; import { CICRegistry, FileGetter } from 'cic-client';
import { HttpGetter } from '@app/_helpers'; import { HttpGetter } from '@app/_helpers';
import {Web3Service} from '@app/_services/web3.service'; import { Web3Service } from '@app/_services/web3.service';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',

View File

@ -17,7 +17,7 @@ import { HttpClient } from '@angular/common/http';
import { CICRegistry } from 'cic-client'; import { CICRegistry } from 'cic-client';
import { RegistryService } from '@app/_services/registry.service'; import { RegistryService } from '@app/_services/registry.service';
import Web3 from 'web3'; import Web3 from 'web3';
import {Web3Service} from '@app/_services/web3.service'; import { Web3Service } from '@app/_services/web3.service';
const vCard = require('vcard-parser'); const vCard = require('vcard-parser');
@Injectable({ @Injectable({

View File

@ -1,14 +1,14 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import Web3 from 'web3'; import Web3 from 'web3';
import {environment} from '@src/environments/environment'; import { environment } from '@src/environments/environment';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root',
}) })
export class Web3Service { export class Web3Service {
private static web3: Web3; private static web3: Web3;
constructor() { } constructor() {}
public static getInstance(): Web3 { public static getInstance(): Web3 {
if (!Web3Service.web3) { if (!Web3Service.web3) {

View File

@ -121,8 +121,10 @@ export class AccountDetailsComponent implements OnInit {
location: this.account.location.area, location: this.account.location.area,
locationType: this.account.location.area_type, locationType: this.account.location.area_type,
}); });
this.userService.getAccountStatus(this.account.vcard?.tel[0].value).pipe(first()) this.userService
.subscribe(response => this.accountStatus = response.status); .getAccountStatus(this.account.vcard?.tel[0].value)
.pipe(first())
.subscribe((response) => (this.accountStatus = response.status));
} else { } else {
alert('Account not found!'); alert('Account not found!');
} }

View File

@ -48,12 +48,12 @@
<ng-container matColumnDef="sender"> <ng-container matColumnDef="sender">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Sender </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Sender </th>
<td mat-cell *matCellDef="let transaction"> {{transaction?.sender?.vcard.fn[0].value}} </td> <td mat-cell *matCellDef="let transaction"> {{transaction?.sender?.vcard.fn[0].value || transaction.from}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="recipient"> <ng-container matColumnDef="recipient">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Recipient </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Recipient </th>
<td mat-cell *matCellDef="let transaction"> {{transaction?.recipient?.vcard.fn[0].value}} </td> <td mat-cell *matCellDef="let transaction"> {{transaction?.recipient?.vcard.fn[0].value || transaction.to }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="value"> <ng-container matColumnDef="value">