File tree Expand file tree Collapse file tree 3 files changed +13
-17
lines changed
packages/insight-previous/src Expand file tree Collapse file tree 3 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,9 @@ export class TransactionComponent implements OnInit {
59
59
}
60
60
61
61
public getConfirmations ( ) {
62
- this . blocksProvider . getCurrentHeight ( ) . subscribe ( height => {
63
- this . confirmations =
64
- this . tx . blockheight > 0
65
- ? height - this . tx . blockheight + 1
66
- : this . tx . blockheight ;
67
- } ) ;
62
+ this . txProvider
63
+ . getConfirmations ( this . tx . blockheight )
64
+ . subscribe ( confirmations => ( this . confirmations = confirmations ) ) ;
68
65
}
69
66
70
67
public goToTx ( txId : string , vout ?: number , fromVout ?: boolean ) : void {
Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ export class TransactionPage {
60
60
data => {
61
61
this . tx = data . tx ;
62
62
this . loading = false ;
63
- this . getConfirmations ( ) ;
63
+ this . txProvider
64
+ . getConfirmations ( this . tx . blockheight )
65
+ . subscribe ( confirmations => ( this . confirmations = confirmations ) ) ;
64
66
// Be aware that the tx component is loading data into the tx object
65
67
} ,
66
68
err => {
@@ -70,15 +72,6 @@ export class TransactionPage {
70
72
) ;
71
73
}
72
74
73
- public getConfirmations ( ) {
74
- this . blocksProvider . getCurrentHeight ( ) . subscribe ( height => {
75
- this . confirmations =
76
- this . tx . blockheight > 0
77
- ? height - this . tx . blockheight + 1
78
- : this . tx . blockheight ;
79
- } ) ;
80
- }
81
-
82
75
public goToBlock ( blockHash : string ) : void {
83
76
this . redirProvider . redir ( 'block-detail' , {
84
77
blockHash,
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class TxsProvider {
116
116
public http : Http ,
117
117
private api : ApiProvider ,
118
118
public currency : CurrencyProvider ,
119
- public blocks : BlocksProvider
119
+ public blocksProvider : BlocksProvider
120
120
) { }
121
121
122
122
public getFee ( tx : AppTx ) : number {
@@ -187,4 +187,10 @@ export class TxsProvider {
187
187
return data . json ( ) as CoinsApiResponse ;
188
188
} ) ;
189
189
}
190
+
191
+ public getConfirmations ( blockheight : number ) : Observable < number > {
192
+ return this . blocksProvider . getCurrentHeight ( ) . map ( height => {
193
+ return blockheight > 0 ? height - blockheight + 1 : blockheight ;
194
+ } ) ;
195
+ }
190
196
}
You can’t perform that action at this time.
0 commit comments