Skip to content

Commit 285a59c

Browse files
committed
Corrections to show vin address
1 parent 3600b93 commit 285a59c

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

packages/insight-previous/src/components/transaction/transaction.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<div>
3939
<div class="ellipsis">
4040
<p>
41-
<a (click)="goToAddress(vin.addr)">{{ vin.addr }}</a>
41+
<a (click)="goToAddress(vin.address)">{{ vin.address }}</a>
4242
</p>
4343
</div>
4444
<div [hidden]="!expanded">
@@ -128,4 +128,4 @@
128128
</ion-chip>
129129
</ion-col>
130130
</ion-row>
131-
</ion-grid>
131+
</ion-grid>

packages/insight-previous/src/components/transaction/transaction.ts

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
22
import { Input } from '@angular/core';
33
import { NavController } from 'ionic-angular';
4-
import { CurrencyProvider } from '../../providers/currency/currency';
5-
import { TxsProvider, ApiCoin } from '../../providers/transactions/transactions';
64
import { ApiProvider } from '../../providers/api/api';
5+
import { CurrencyProvider } from '../../providers/currency/currency';
6+
import { ApiCoin, TxsProvider } from '../../providers/transactions/transactions';
77

88
/**
99
* Generated class for the TransactionComponent component.
@@ -15,19 +15,19 @@ import { ApiProvider } from '../../providers/api/api';
1515
selector: 'transaction',
1616
templateUrl: 'transaction.html'
1717
})
18-
export class TransactionComponent {
19-
private COIN: number = 100000000;
18+
export class TransactionComponent implements OnInit {
19+
private COIN = 100000000;
2020

21-
public expanded: boolean = false;
21+
public expanded = false;
2222
@Input() public tx: any = {};
23-
@Input() public showCoins?: boolean = false;
23+
@Input() public showCoins = false;
2424

2525
constructor(
2626
private navCtrl: NavController,
2727
public currency: CurrencyProvider,
2828
public apiProvider: ApiProvider,
2929
public txProvider: TxsProvider
30-
) {}
30+
) { }
3131

3232
public ngOnInit(): void {
3333
if (this.showCoins) {
@@ -56,36 +56,36 @@ export class TransactionComponent {
5656
this.navCtrl.push('transaction', {
5757
chain: this.apiProvider.networkSettings.value.selectedNetwork.chain,
5858
network: this.apiProvider.networkSettings.value.selectedNetwork.network,
59-
txId: txId
59+
txId
6060
});
6161
}
6262

6363
public goToAddress(addrStr: string): void {
6464
this.navCtrl.push('address', {
6565
chain: this.apiProvider.networkSettings.value.selectedNetwork.chain,
6666
network: this.apiProvider.networkSettings.value.selectedNetwork.network,
67-
addrStr: addrStr
67+
addrStr
6868
});
6969
}
7070

7171
public toggleExpanded(): void {
7272
this.expanded = !this.expanded;
7373
}
7474

75-
public aggregateItems(items: Array<any>): Array<any> {
76-
if (!items) return [];
75+
public aggregateItems(items: any[]): any[] {
76+
if (!items) { return []; }
7777

78-
let l: number = items.length;
78+
const l: number = items.length;
7979

80-
let ret: Array<any> = [];
81-
let tmp: any = {};
82-
let u: number = 0;
80+
const ret: any[] = [];
81+
const tmp: any = {};
82+
let u = 0;
8383

84-
for (let i: number = 0; i < l; i++) {
85-
let notAddr: boolean = false;
84+
for (let i = 0; i < l; i++) {
85+
let notAddr = false;
8686
// non standard input
87-
if (items[i].scriptSig && !items[i].addr) {
88-
items[i].addr = 'Unparsed address [' + u++ + ']';
87+
if (items[i].scriptSig && !items[i].address) {
88+
items[i].address = 'Unparsed address [' + u++ + ']';
8989
items[i].notAddr = true;
9090
notAddr = true;
9191
}
@@ -99,36 +99,36 @@ export class TransactionComponent {
9999

100100
// multiple addr at output
101101
if (items[i].scriptPubKey && items[i].scriptPubKey.addresses.length > 1) {
102-
items[i].addr = items[i].scriptPubKey.addresses.join(',');
102+
items[i].address = items[i].scriptPubKey.addresses.join(',');
103103
ret.push(items[i]);
104104
continue;
105105
}
106106

107-
let addr: string = items[i].addr || (items[i].scriptPubKey && items[i].scriptPubKey.addresses[0]);
107+
const address: string = items[i].address || (items[i].scriptPubKey && items[i].scriptPubKey.addresses[0]);
108108

109-
if (!tmp[addr]) {
110-
tmp[addr] = {};
111-
tmp[addr].valueSat = 0;
112-
tmp[addr].count = 0;
113-
tmp[addr].addr = addr;
114-
tmp[addr].items = [];
109+
if (!tmp[address]) {
110+
tmp[address] = {};
111+
tmp[address].valueSat = 0;
112+
tmp[address].count = 0;
113+
tmp[address].address = address;
114+
tmp[address].items = [];
115115
}
116-
tmp[addr].isSpent = items[i].spentTxId;
116+
tmp[address].isSpent = items[i].spentTxId;
117117

118-
tmp[addr].doubleSpentTxID = tmp[addr].doubleSpentTxID || items[i].doubleSpentTxID;
119-
tmp[addr].doubleSpentIndex = tmp[addr].doubleSpentIndex || items[i].doubleSpentIndex;
120-
tmp[addr].dbError = tmp[addr].dbError || items[i].dbError;
121-
tmp[addr].valueSat += Math.round(items[i].value * this.COIN);
122-
tmp[addr].items.push(items[i]);
123-
tmp[addr].notAddr = notAddr;
118+
tmp[address].doubleSpentTxID = tmp[address].doubleSpentTxID || items[i].doubleSpentTxID;
119+
tmp[address].doubleSpentIndex = tmp[address].doubleSpentIndex || items[i].doubleSpentIndex;
120+
tmp[address].dbError = tmp[address].dbError || items[i].dbError;
121+
tmp[address].valueSat += Math.round(items[i].value * this.COIN);
122+
tmp[address].items.push(items[i]);
123+
tmp[address].notAddr = notAddr;
124124

125-
if (items[i].unconfirmedInput) tmp[addr].unconfirmedInput = true;
125+
if (items[i].unconfirmedInput) { tmp[address].unconfirmedInput = true; }
126126

127-
tmp[addr].count++;
127+
tmp[address].count++;
128128
}
129129

130-
for (let v in tmp) {
131-
let obj: any = tmp[v];
130+
for (const v in tmp) {
131+
const obj: any = tmp[v];
132132
obj.value = obj.value || parseInt(obj.valueSat) / this.COIN;
133133
ret.push(obj);
134134
}

0 commit comments

Comments
 (0)