Fixing tx tracking issues.

This commit is contained in:
Simon Lindh 2019-07-25 14:20:02 +03:00
parent 9898996d6c
commit 2b6426a126
4 changed files with 10 additions and 7 deletions

View File

@ -127,6 +127,9 @@ class MempoolSpace {
})); }));
} else { } else {
console.log('TX NOT FOUND, NOT TRACKING'); console.log('TX NOT FOUND, NOT TRACKING');
client['trackingTx'] = false;
client['blockHeight'] = 0;
client['tx'] = null;
client.send(JSON.stringify({ client.send(JSON.stringify({
'track-tx': { 'track-tx': {
tracking: false, tracking: false,

View File

@ -4,7 +4,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
import { IMempoolDefaultResponse, IMempoolStats, IBlockTransaction, IBlock } from '../blockchain/interfaces'; import { IMempoolDefaultResponse, IMempoolStats, IBlockTransaction, IBlock } from '../blockchain/interfaces';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { MemPoolService } from './mem-pool.service'; import { MemPoolService } from './mem-pool.service';
import { tap, retryWhen } from 'rxjs/operators'; import { tap, retryWhen, delay } from 'rxjs/operators';
const WEB_SOCKET_URL = 'ws://' + document.location.hostname + ':8999'; const WEB_SOCKET_URL = 'ws://' + document.location.hostname + ':8999';
const API_BASE_URL = '/api/v1'; const API_BASE_URL = '/api/v1';
@ -27,7 +27,8 @@ export class ApiService {
.pipe( .pipe(
retryWhen((errors: any) => errors retryWhen((errors: any) => errors
.pipe( .pipe(
tap(() => this.memPoolService.isOffline$.next(true)) tap(() => this.memPoolService.isOffline$.next(true)),
delay(5000),
) )
), ),
) )

View File

@ -1,5 +1,5 @@
<div class="txBubble" [ngStyle]="txBubbleStyle" *ngIf="txTrackingEnabled && tx"> <div class="txBubble" [ngStyle]="txBubbleStyle" *ngIf="txTrackingEnabled && tx">
<span class="txBubbleText" ngClass="arrow-{{ arrowPosition }}"> <span class="txBubbleText" ngClass="arrow-{{ txBubbleArrowPosition }}">
<table style="width: 100%;"> <table style="width: 100%;">
<tr> <tr>
<td class="text-left"><b>Transaction hash</b></td> <td class="text-left"><b>Transaction hash</b></td>

View File

@ -12,7 +12,7 @@ export class TxBubbleComponent implements OnInit, OnDestroy {
tx: ITransaction | null = null; tx: ITransaction | null = null;
txTrackingBlockHeight = 0; txTrackingBlockHeight = 0;
latestBlockHeight = 0; latestBlockHeight = 0;
arrowPosition: 'top' | 'right' | 'bottom' | 'top-right' | 'top-left' = 'top'; txBubbleArrowPosition: 'top' | 'right' | 'bottom' | 'top-right' | 'top-left' = 'top';
txTrackingSubscription: Subscription; txTrackingSubscription: Subscription;
projectedBlocksSubscription: Subscription; projectedBlocksSubscription: Subscription;
@ -35,8 +35,6 @@ export class TxBubbleComponent implements OnInit, OnDestroy {
txTrackingTx: ITransaction | null = null; txTrackingTx: ITransaction | null = null;
txShowTxNotFound = false; txShowTxNotFound = false;
txBubbleArrowPosition = 'top';
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(event: Event) { onResize(event: Event) {
this.moveTxBubbleToPosition(); this.moveTxBubbleToPosition();
@ -77,6 +75,7 @@ export class TxBubbleComponent implements OnInit, OnDestroy {
if (this.txTrackingBlockHeight) { if (this.txTrackingBlockHeight) {
this.confirmations = (this.latestBlockHeight - this.txTrackingBlockHeight) + 1; this.confirmations = (this.latestBlockHeight - this.txTrackingBlockHeight) + 1;
} }
setTimeout(() => this.moveTxBubbleToPosition(), 1000);
}); });
this.memPoolService.conversions$ this.memPoolService.conversions$
@ -117,7 +116,7 @@ export class TxBubbleComponent implements OnInit, OnDestroy {
} else { } else {
this.txBubbleStyle['left'] = window.innerWidth - 220 + 'px'; this.txBubbleStyle['left'] = window.innerWidth - 220 + 'px';
this.txBubbleArrowPosition = 'right'; this.txBubbleArrowPosition = 'right';
this.txBubbleStyle['top'] = '425px'; this.txBubbleStyle['top'] = '460px';
} }
} else { } else {
this.txBubbleArrowPosition = 'top'; this.txBubbleArrowPosition = 'top';