Asset tracking.

Asset caching.
refs #37
This commit is contained in:
softsimon
2020-05-05 15:26:23 +07:00
parent d662292afb
commit 20c7ee98e7
14 changed files with 127 additions and 53 deletions

View File

@@ -15,7 +15,7 @@
<div class="row">
<div class="col">
<table class="table table-borderless table-striped">
<tbody>
<tbody *ngIf="network !== 'liquid'">
<tr>
<td>Total received</td>
<td>{{ receieved / 100000000 | number: '1.8-8' }} <ng-template [ngIf]="network === 'liquid'">L-</ng-template>BTC</td>
@@ -29,6 +29,20 @@
<td>{{ (receieved - sent) / 100000000 | number: '1.8-8' }} <ng-template [ngIf]="network === 'liquid'">L-</ng-template>BTC (<app-fiat [value]="receieved - sent"></app-fiat>)</td>
</tr>
</tbody>
<tbody *ngIf="network === 'liquid'">
<tr>
<td>Total received</td>
<td>Confidential</td>
</tr>
<tr>
<td>Total sent</td>
<td>Confidential</td>
</tr>
<tr>
<td>Balance</td>
<td>Confidential</td>
</tr>
</tbody>
</table>
</div>
<div class="col qrcode-col">

View File

@@ -84,7 +84,7 @@ export class AssetComponent implements OnInit, OnDestroy {
console.log(err);
return of(null);
})
), this.assetsService.assetsMinimal$])
), this.assetsService.getAssetsMinimalJson$])
.pipe(
take(1)
);
@@ -141,7 +141,7 @@ export class AssetComponent implements OnInit, OnDestroy {
this.isLoadingAsset = false;
});
this.stateService.mempoolTransactions$
this.stateService.assetTransactions$
.subscribe((transaction) => {
if (this.transactions.some((t) => t.txid === transaction.txid)) {
return;
@@ -151,22 +151,7 @@ export class AssetComponent implements OnInit, OnDestroy {
this.transactions = this.transactions.slice();
this.txCount++;
// if (transaction.vout.some((vout) => vout.scriptpubkey_asset === this.asset.asset)) {
// this.audioService.playSound('cha-ching');
// } else {
// this.audioService.playSound('chime');
// }
// transaction.vin.forEach((vin) => {
// if (vin.prevout.scriptpubkey_asset === this.asset.asset) {
// this.sent += vin.prevout.value;
// }
// });
// transaction.vout.forEach((vout) => {
// if (vout.scriptpubkey_asset === this.asset.asset) {
// this.receieved += vout.value;
// }
// });
this.audioService.playSound('chime');
});
this.stateService.blockTransactions$

View File

@@ -1,5 +1,5 @@
<span #buttonWrapper [attr.data-tlite]="'Copied!'" style="position: relative;">
<button #btn class="btn btn-sm btn-link pt-0" style="line-height: 1;" [attr.data-clipboard-text]="text">
<button #btn class="btn btn-sm btn-link pt-0" style="line-height: 0.9;" [attr.data-clipboard-text]="text">
<img src="./resources/clippy.svg" width="13">
</button>
</span>

View File

@@ -31,10 +31,12 @@ export class SearchFormComponent implements OnInit {
this.searchForm = this.formBuilder.group({
searchText: ['', Validators.required],
});
this.assetsService.assetsMinimal$
.subscribe((assets) => {
this.assets = assets;
});
if (this.network === 'liquid') {
this.assetsService.getAssetsMinimalJson$
.subscribe((assets) => {
this.assets = assets;
});
}
}
search() {

View File

@@ -29,7 +29,7 @@
</td>
<td>
<div [ngSwitch]="true">
<ng-container *ngSwitchCase="vin.is_coinbase">Coinbase (Newly Generated Coins)</ng-container>
<ng-container *ngSwitchCase="vin.is_coinbase">Coinbase<ng-template [ngIf]="network !== 'liquid'"> (Newly Generated Coins)</ng-template></ng-container>
<ng-container *ngSwitchCase="vin.is_pegin">PEG IN</ng-container>
<ng-container *ngSwitchDefault>
<a [routerLink]="['/address/', vin.prevout.scriptpubkey_address]" title="{{ vin.prevout.scriptpubkey_address }}">

View File

@@ -35,9 +35,11 @@ export class TransactionsListComponent implements OnInit, OnChanges {
ngOnInit() {
this.latestBlock$ = this.stateService.blocks$;
this.assetsService.assetsMinimal$.subscribe((assets) => {
this.assetsMinimal = assets;
});
if (this.network === 'liquid') {
this.assetsService.getAssetsMinimalJson$.subscribe((assets) => {
this.assetsMinimal = assets;
});
}
}
ngOnChanges() {