diff --git a/docs/compodoc/classes/AccountIndex.html b/docs/compodoc/classes/AccountIndex.html
index d40c91b..9808103 100644
--- a/docs/compodoc/classes/AccountIndex.html
+++ b/docs/compodoc/classes/AccountIndex.html
@@ -156,7 +156,7 @@ Allows querying of accounts that have been registered as valid accounts in the n
-
+
|
@@ -246,7 +246,7 @@ Allows querying of accounts that have been registered as valid accounts in the n
-
+
|
@@ -279,7 +279,7 @@ Allows querying of accounts that have been registered as valid accounts in the n
-
+
|
@@ -312,7 +312,7 @@ Allows querying of accounts that have been registered as valid accounts in the n
-
+
|
@@ -357,8 +357,8 @@ Allows querying of accounts that have been registered as valid accounts in the n
-
+
|
@@ -450,8 +450,8 @@ Requires availability of the signer address.
-
+
|
@@ -543,8 +543,8 @@ Returns "true" for available and "false" otherwise.
-
+
|
@@ -635,8 +635,8 @@ Returns "true" for available and "false" otherwise.
-
+
|
@@ -682,12 +682,13 @@ Returns "true" for available and "false" otherwise.
import Web3 from 'web3';
// Application imports
+import { Web3Service } from '@app/_services/web3.service';
import { environment } from '@src/environments/environment';
/** Fetch the account registry contract's ABI. */
const abi: Array<any> = require('@src/assets/js/block-sync/data/AccountsIndex.json');
/** Establish a connection to the blockchain network. */
-const web3: Web3 = new Web3(environment.web3Provider);
+const web3: Web3 = Web3Service.getInstance();
/**
* Provides an instance of the accounts registry contract.
@@ -779,7 +780,7 @@ export class AccountIndex {
lowest = 0;
}
const accounts: Array<string> = [];
- for (let i = count; i > lowest; i--) {
+ for (let i = count - 1; i >= lowest; i--) {
const account: string = await this.contract.methods.entry(i).call();
accounts.push(account);
}
diff --git a/docs/compodoc/classes/HttpError.html b/docs/compodoc/classes/HttpError.html
index 3b24712..5625ef7 100644
--- a/docs/compodoc/classes/HttpError.html
+++ b/docs/compodoc/classes/HttpError.html
@@ -374,6 +374,13 @@ export class GlobalErrorHandler extends ErrorHandler {
}
}
}
+
+export function rejectBody(error): { status: any; statusText: any } {
+ return {
+ status: error.status,
+ statusText: error.statusText,
+ };
+}
diff --git a/docs/compodoc/classes/TokenRegistry.html b/docs/compodoc/classes/TokenRegistry.html
index a7ec242..d7e7696 100644
--- a/docs/compodoc/classes/TokenRegistry.html
+++ b/docs/compodoc/classes/TokenRegistry.html
@@ -151,7 +151,7 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -241,7 +241,7 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -274,7 +274,7 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -307,7 +307,7 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -352,8 +352,8 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -444,8 +444,8 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -536,8 +536,8 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
-
+
|
@@ -584,11 +584,12 @@ Allows querying of tokens that have been registered as valid tokens in the netwo
// Application imports
import { environment } from '@src/environments/environment';
+import { Web3Service } from '@app/_services/web3.service';
/** Fetch the token registry contract's ABI. */
const abi: Array<any> = require('@src/assets/js/block-sync/data/TokenUniqueSymbolIndex.json');
/** Establish a connection to the blockchain network. */
-const web3: Web3 = new Web3(environment.web3Provider);
+const web3: Web3 = Web3Service.getInstance();
/**
* Provides an instance of the token registry contract.
diff --git a/docs/compodoc/components/AccountDetailsComponent.html b/docs/compodoc/components/AccountDetailsComponent.html
index e1a63a6..8357abb 100644
--- a/docs/compodoc/components/AccountDetailsComponent.html
+++ b/docs/compodoc/components/AccountDetailsComponent.html
@@ -175,6 +175,9 @@
submitted
+
+ tokenSymbol
+
transaction
@@ -254,6 +257,7 @@
filterTransactions
+ Async
ngOnInit
@@ -306,7 +310,7 @@
-
+
|
@@ -495,8 +499,8 @@
-
+
|
@@ -534,8 +538,8 @@
-
+
|
@@ -604,8 +608,8 @@
-
+
|
@@ -674,8 +678,8 @@
-
+
|
@@ -756,8 +760,8 @@
-
+
|
@@ -795,8 +799,8 @@
-
+
|
@@ -819,6 +823,7 @@
+ Async
ngOnInit
@@ -827,15 +832,16 @@
-ngOnInit()
+
+ ngOnInit()
|
-
+
|
@@ -844,7 +850,7 @@
- Returns : void
+ Returns : Promise<void>
|
@@ -873,8 +879,8 @@
-
+
|
@@ -914,8 +920,8 @@
-
+
|
@@ -953,8 +959,8 @@
-
+
|
@@ -1019,8 +1025,8 @@
-
+
|
@@ -1465,6 +1471,33 @@
+
+
+
+
+
+
+
+
+
+ tokenSymbol
+
+
+ |
+
+
+
+ Type : string
+
+ |
+
+
+
+
+ |
+
+
+
@@ -1992,7 +2025,7 @@
-
+
|
@@ -2069,6 +2102,7 @@ export class AccountDetailsComponent implements OnInit {
matcher: CustomErrorStateMatcher = new CustomErrorStateMatcher();
submitted: boolean = false;
bloxbergLink: string;
+ tokenSymbol: string;
constructor(
private formBuilder: FormBuilder,
@@ -2083,8 +2117,17 @@ export class AccountDetailsComponent implements OnInit {
private cdr: ChangeDetectorRef,
private snackBar: MatSnackBar
) {
+ this.route.paramMap.subscribe((params: Params) => {
+ this.accountAddress = add0x(params.get('id'));
+ this.bloxbergLink =
+ 'https://blockexplorer.bloxberg.org/address/' + this.accountAddress + '/transactions';
+ });
+ }
+
+ async ngOnInit(): Promise<void> {
this.accountInfoForm = this.formBuilder.group({
- name: ['', Validators.required],
+ firstName: ['', Validators.required],
+ lastName: ['', Validators.required],
phoneNumber: ['', Validators.required],
age: ['', Validators.required],
type: ['', Validators.required],
@@ -2095,36 +2138,71 @@ export class AccountDetailsComponent implements OnInit {
location: ['', Validators.required],
locationType: ['', Validators.required],
});
- this.route.paramMap.subscribe(async (params: Params) => {
- this.accountAddress = add0x(params.get('id'));
- this.bloxbergLink =
- 'https://blockexplorer.bloxberg.org/address/' + this.accountAddress + '/transactions';
- (await this.userService.getAccountByAddress(this.accountAddress, 100)).subscribe(
- async (res) => {
- if (res !== undefined) {
- this.account = res;
- this.cdr.detectChanges();
- this.loggingService.sendInfoLevelMessage(this.account);
- // this.userService.getAccountStatus(this.account.vcard?.tel[0].value).pipe(first())
- // .subscribe(response => this.accountStatus = response);
- this.accountInfoForm.patchValue({
- name: this.account.vcard?.fn[0].value,
- phoneNumber: this.account.vcard?.tel[0].value,
- age: this.account.age,
- type: this.account.type,
- bio: this.account.products,
- gender: this.account.gender,
- businessCategory: this.account.category,
- userLocation: this.account.location.area_name,
- location: this.account.location.area,
- locationType: this.account.location.area_type,
- });
- } else {
- alert('Account not found!');
- }
+ await this.blockSyncService.init();
+ await this.tokenService.init();
+ await this.transactionService.init();
+ await this.userService.init();
+ await this.blockSyncService.blockSync(this.accountAddress);
+ this.userService.resetAccountsList();
+ (await this.userService.getAccountByAddress(this.accountAddress, 100)).subscribe(
+ async (res) => {
+ if (res !== undefined) {
+ this.account = res;
+ this.cdr.detectChanges();
+ this.loggingService.sendInfoLevelMessage(this.account);
+ const fullName = this.account.vcard?.fn[0].value.split(' ');
+ this.accountInfoForm.patchValue({
+ firstName: fullName[0].split(',')[0],
+ lastName: fullName.slice(1).join(' '),
+ phoneNumber: this.account.vcard?.tel[0].value,
+ age: this.account.age,
+ type: this.account.type,
+ bio: this.account.products,
+ gender: this.account.gender,
+ businessCategory:
+ this.account.category ||
+ this.userService.getCategoryByProduct(this.account.products[0]),
+ userLocation: this.account.location.area_name,
+ location:
+ this.account.location.area ||
+ this.locationService
+ .getAreaNameByLocation(this.account.location.area_name)
+ .pipe(first())
+ .subscribe((response) => {
+ return response;
+ }),
+ locationType:
+ this.account.location.area_type ||
+ this.locationService
+ .getAreaTypeByArea(this.accountInfoFormStub.location.value)
+ .pipe(first())
+ .subscribe((response) => {
+ return response;
+ }),
+ });
+ this.userService
+ .getAccountStatus(this.account.vcard?.tel[0].value)
+ .pipe(first())
+ .subscribe((response) => (this.accountStatus = response.status));
+ } else {
+ alert('Account not found!');
}
- );
- this.blockSyncService.blockSync(this.accountAddress);
+ }
+ );
+ this.userService.accountsSubject.subscribe((accounts) => {
+ this.userDataSource = new MatTableDataSource<any>(accounts);
+ this.userDataSource.paginator = this.userTablePaginator;
+ this.userDataSource.sort = this.userTableSort;
+ this.accounts = accounts;
+ this.cdr.detectChanges();
+ });
+
+ this.transactionService.transactionsSubject.subscribe((transactions) => {
+ this.transactionsDataSource = new MatTableDataSource<any>(transactions);
+ this.transactionsDataSource.paginator = this.transactionTablePaginator;
+ this.transactionsDataSource.sort = this.transactionTableSort;
+ this.transactions = transactions;
+ this.cdr.detectChanges();
});
this.userService
.getCategories()
@@ -2150,21 +2228,10 @@ export class AccountDetailsComponent implements OnInit {
.getGenders()
.pipe(first())
.subscribe((res) => (this.genders = res));
- }
-
- ngOnInit(): void {
- this.userService.accountsSubject.subscribe((accounts) => {
- this.userDataSource = new MatTableDataSource<any>(accounts);
- this.userDataSource.paginator = this.userTablePaginator;
- this.userDataSource.sort = this.userTableSort;
- this.accounts = accounts;
- });
-
- this.transactionService.transactionsSubject.subscribe((transactions) => {
- this.transactionsDataSource = new MatTableDataSource<any>(transactions);
- this.transactionsDataSource.paginator = this.transactionTablePaginator;
- this.transactionsDataSource.sort = this.transactionTableSort;
- this.transactions = transactions;
+ this.tokenService.load.subscribe(async (status: boolean) => {
+ if (status) {
+ this.tokenSymbol = await this.tokenService.getTokenSymbol();
+ }
});
}
@@ -2197,7 +2264,7 @@ export class AccountDetailsComponent implements OnInit {
}
const accountKey = await this.userService.changeAccountInfo(
this.accountAddress,
- this.accountInfoFormStub.name.value,
+ this.accountInfoFormStub.firstName.value + ', ' + this.accountInfoFormStub.lastName.value,
this.accountInfoFormStub.phoneNumber.value,
this.accountInfoFormStub.age.value,
this.accountInfoFormStub.type.value,
@@ -2300,8 +2367,8 @@ export class AccountDetailsComponent implements OnInit {
<h3>
<strong> {{account?.vcard?.fn[0].value}} </strong>
</h3>
- <span class="ml-auto"><strong>Balance:</strong> {{account?.balance | tokenRatio}} SRF</span>
- <span class="ml-2"><strong>Created:</strong> {{account?.date_registered | date}}</span>
+ <span class="ml-auto"><strong>Balance:</strong> {{account?.balance | tokenRatio}} {{ tokenSymbol | uppercase }}</span>
+ <span class="ml-2"><strong>Created:</strong> {{account?.date_registered | unixDate}}</span>
<span class="ml-2"><strong>Address:</strong>
<a href="{{bloxbergLink}}" target="_blank"> {{accountAddress}} </a>
<img src="assets/images/checklist.svg" class="ml-2" height="20rem" (click)="copyAddress()" alt="Copy">
@@ -2315,10 +2382,19 @@ export class AccountDetailsComponent implements OnInit {
<div class="col-md-6 col-lg-4">
<mat-form-field appearance="outline">
- <mat-label>Name(s): *</mat-label>
- <input matInput type="text" id="givenNames" placeholder="{{account?.vcard?.fn[0].value}}"
- value="{{account?.vcard?.fn[0].value}}" formControlName="name" [errorStateMatcher]="matcher">
- <mat-error *ngIf="submitted && accountInfoFormStub.name.errors">Name is required.</mat-error>
+ <mat-label>First Name: *</mat-label>
+ <input matInput type="text" id="firstName" placeholder="{{account?.vcard?.fn[0].value.split(' ')[0]}}"
+ value="{{account?.vcard?.fn[0].value.split(' ')[0]}}" formControlName="firstName" [errorStateMatcher]="matcher">
+ <mat-error *ngIf="submitted && accountInfoFormStub.firstName.errors">First Name is required.</mat-error>
+ </mat-form-field>
+ </div>
+
+ <div class="col-md-6 col-lg-4">
+ <mat-form-field appearance="outline">
+ <mat-label>Last Name(s): *</mat-label>
+ <input matInput type="text" id="lastName" placeholder="{{account?.vcard?.fn[0].value.split(' ').slice(1).join(' ')}}"
+ value="{{account?.vcard?.fn[0].value.split(' ').slice(1).join(' ')}}" formControlName="lastName" [errorStateMatcher]="matcher">
+ <mat-error *ngIf="submitted && accountInfoFormStub.lastName.errors">Last Name is required.</mat-error>
</mat-form-field>
</div>
@@ -2476,13 +2552,10 @@ export class AccountDetailsComponent implements OnInit {
<tbody>
<tr>
<td>{{account?.vcard?.fn[0].value}}</td>
- <td>{{account?.balance | tokenRatio}}</td>
- <td>{{account?.date_registered | date}}</td>
+ <td>{{account?.balance | tokenRatio}} {{ tokenSymbol | uppercase }}</td>
+ <td>{{account?.date_registered | unixDate}}</td>
<td>
- <span *ngIf="accountStatus === 'active'" class="badge badge-success badge-pill">
- {{accountStatus}}
- </span>
- <span *ngIf="accountStatus === 'blocked'" class="badge badge-danger badge-pill">
+ <span class="badge badge-success badge-pill">
{{accountStatus}}
</span>
</td>
@@ -2495,7 +2568,7 @@ export class AccountDetailsComponent implements OnInit {
<mat-tab-group *ngIf="account" dynamicHeight mat-align-tabs="start">
<mat-tab label="Transactions">
- <app-transaction-details [transaction]="transaction"></app-transaction-details>
+ <app-transaction-details [transaction]="transaction" (closeWindow)="transaction = $event"></app-transaction-details>
<div class="card mt-1">
<div class="card-header">
<div class="row">
@@ -2519,30 +2592,30 @@ export class AccountDetailsComponent implements OnInit {
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
- <mat-table class="mat-elevation-z10" [dataSource]="transactionsDataSource" matSort matSortActive="created"
+ <table mat-table class="mat-elevation-z10" [dataSource]="transactionsDataSource" matSort matSortActive="created"
#TransactionTableSort="matSort" matSortDirection="asc" matSortDisableClear>
<ng-container matColumnDef="sender">
<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 matColumnDef="recipient">
<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 matColumnDef="value">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Value </th>
<td mat-cell *matCellDef="let transaction">
- <span *ngIf="transaction.type == 'transaction'">{{transaction?.value | tokenRatio}}</span>
- <span *ngIf="transaction.type == 'conversion'">{{transaction?.toValue | tokenRatio}}</span>
+ <span *ngIf="transaction.type == 'transaction'">{{transaction?.value | tokenRatio}} {{ tokenSymbol | uppercase }}</span>
+ <span *ngIf="transaction.type == 'conversion'">{{transaction?.toValue | tokenRatio}} {{ tokenSymbol | uppercase }}</span>
</td>
</ng-container>
<ng-container matColumnDef="created">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Created </th>
- <td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | date}} </td>
+ <td mat-cell *matCellDef="let transaction"> {{transaction?.tx.timestamp | unixDate}} </td>
</ng-container>
<ng-container matColumnDef="type">
@@ -2552,10 +2625,10 @@ export class AccountDetailsComponent implements OnInit {
</td>
</ng-container>
- <mat-header-row *matHeaderRowDef="transactionsDisplayedColumns"></mat-header-row>
- <mat-row *matRowDef="let transaction; columns: transactionsDisplayedColumns" matRipple
- (click)="viewTransaction(transaction)"></mat-row>
- </mat-table>
+ <tr mat-header-row *matHeaderRowDef="transactionsDisplayedColumns"></tr>
+ <tr mat-row *matRowDef="let transaction; columns: transactionsDisplayedColumns" matRipple
+ (click)="viewTransaction(transaction)"></tr>
+ </table>
<mat-paginator #TransactionTablePaginator="matPaginator" [pageSize]="transactionsDefaultPageSize"
[pageSizeOptions]="transactionsPageSizeOptions" showFirstLastButtons></mat-paginator>
@@ -2604,12 +2677,12 @@ export class AccountDetailsComponent implements OnInit {
<ng-container matColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header> CREATED </mat-header-cell>
- <mat-cell *matCellDef="let user"> {{user?.date_registered | date}} </mat-cell>
+ <mat-cell *matCellDef="let user"> {{user?.date_registered | unixDate}} </mat-cell>
</ng-container>
<ng-container matColumnDef="balance">
<mat-header-cell *matHeaderCellDef mat-sort-header> BALANCE </mat-header-cell>
- <mat-cell *matCellDef="let user"> {{user?.balance}} </mat-cell>
+ <mat-cell *matCellDef="let user"> {{user?.balance | tokenRatio}} {{tokenSymbol | uppercase}} </mat-cell>
</ng-container>
<ng-container matColumnDef="location">
@@ -2670,7 +2743,7 @@ export class AccountDetailsComponent implements OnInit {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+