Confirmed address transactions fix. QR Code fix.

This commit is contained in:
softsimon 2020-02-26 21:11:43 +07:00
parent f9c03f2a98
commit 37166e230d
No known key found for this signature in database
GPG key ID: 488D7DCFB5A430D7
4 changed files with 13 additions and 8 deletions

View file

@ -61,6 +61,10 @@ export class AddressComponent implements OnInit, OnDestroy {
this.stateService.mempoolTransactions$
.subscribe((transaction) => {
if (this.transactions.some((t) => t.txid === transaction.txid)) {
return;
}
this.transactions.unshift(transaction);
this.transactions = this.transactions.slice();
this.txCount++;

View file

@ -6,7 +6,7 @@ import * as QRCode from 'qrcode/build/qrcode.js';
templateUrl: './qrcode.component.html',
styleUrls: ['./qrcode.component.scss']
})
export class QrcodeComponent implements AfterViewInit, OnDestroy {
export class QrcodeComponent implements AfterViewInit {
@Input() data: string;
@ViewChild('canvas') canvas: ElementRef;
@ -30,14 +30,15 @@ export class QrcodeComponent implements AfterViewInit, OnDestroy {
return;
}
QRCode.toCanvas(this.canvas.nativeElement, this.data.toUpperCase(), opts, (error: any) => {
const address = this.data;
if (this.data.indexOf('bc1') === 0 || this.data.indexOf('tb1') === 0) {
address.toUpperCase();
}
QRCode.toCanvas(this.canvas.nativeElement, address, opts, (error: any) => {
if (error) {
console.error(error);
}
});
}
ngOnDestroy() {
}
}

View file

@ -71,7 +71,7 @@
<tr>
<td class="text-right" colspan="4">
<span *ngIf="showConfirmations && latestBlock$ | async as latestBlock">
<button *ngIf="tx.status.confirmed; else unconfirmedButton" type="button" class="btn btn-sm btn-success mt-3">{{ latestBlock.height - tx.status.block_height + 1 }} confirmations</button>
<button *ngIf="tx.status.confirmed; else unconfirmedButton" type="button" class="btn btn-sm btn-success mt-3">{{ latestBlock.height - tx.status.block_height + 1 }} confirmation<ng-container *ngIf="latestBlock.height - tx.status.block_height + 1 > 1">s</ng-container></button>
<ng-template #unconfirmedButton>
<button type="button" class="btn btn-sm btn-danger mt-3">Unconfirmed</button>
</ng-template>

View file

@ -63,6 +63,6 @@ export class TransactionsListComponent implements OnInit, OnChanges {
}
trackByFn(index: number, tx: Transaction) {
return tx.txid;
return tx.txid + tx.status.confirmed;
}
}