diff --git a/app/src/components/transactions/transactions.html b/app/src/components/transactions/transactions.html
index 2eb99b8..4263992 100644
--- a/app/src/components/transactions/transactions.html
+++ b/app/src/components/transactions/transactions.html
@@ -1,3 +1,48 @@
- Put Transactions here
+
+
{{ tx.txid }}
+
+ first seen at
+
+
+
+ mined
+
+
+
+
+
+
+ No Inputs (Newly Generated Coins)
+
+
+
+
+ >
+
+
+
+
+
{{ getAddress(vout) }} {{ vout.value + ' BTC' }} (S)(U)
+
+
+
+
+
+
+
{{ vin.addr }}
+
{{ vin.value + ' BTC' }}
+
+
+
+ >
+
+
+
+
+
{{ getAddress(vout) }} {{ vout.value + ' BTC' }} (S)(U)
+
+
+
+
diff --git a/app/src/components/transactions/transactions.ts b/app/src/components/transactions/transactions.ts
index b04dd4c..4c594c2 100644
--- a/app/src/components/transactions/transactions.ts
+++ b/app/src/components/transactions/transactions.ts
@@ -15,24 +15,36 @@ import { Http } from '@angular/http';
export class TransactionsComponent {
public loading: boolean = true;
- @Input() private blockHash: string;
+ @Input() public blockHash: string;
public transactions: any = [];
constructor(private http: Http) {
+ }
+
+ private ngOnInit(): void {
let apiPrefix: string = 'http://localhost:3001/insight-api/';
- this.http.get(apiPrefix + 'txs/' + this.blockHash).subscribe(
+ this.http.get(apiPrefix + 'txs?block=' + this.blockHash).subscribe(
(data) => {
- console.log('hey, got data');
this.transactions = JSON.parse(data['_body']);
+ this.loading = false;
+
+ this.transactions.txs.forEach((tx) => {
+ console.log('tx is', tx);
+ });
},
(err) => {
console.log('err is', err);
- },
- () => {
this.loading = false;
}
);
}
+ public getAddress(vout: any): string {
+ if (vout.scriptPubKey && vout.scriptPubKey.addresses) {
+ return vout.scriptPubKey.addresses[0];
+ } else {
+ return 'Unparsed address';
+ }
+ }
}
diff --git a/app/src/pages/block-detail/block-detail.html b/app/src/pages/block-detail/block-detail.html
index a5410e1..428a119 100644
--- a/app/src/pages/block-detail/block-detail.html
+++ b/app/src/pages/block-detail/block-detail.html
@@ -33,7 +33,7 @@
Next Block {{ block.height + 1 }}
Transactions
-
+
Loading...
diff --git a/app/src/pages/block-detail/block-detail.ts b/app/src/pages/block-detail/block-detail.ts
index 9138645..bcd5983 100644
--- a/app/src/pages/block-detail/block-detail.ts
+++ b/app/src/pages/block-detail/block-detail.ts
@@ -32,11 +32,10 @@ export class BlockDetailPage {
this.http.get(apiPrefix + 'block/' + this.blockHash).subscribe(
(data) => {
this.block = JSON.parse(data['_body']);
+ this.loading = false;
},
(err) => {
console.log('err is', err);
- },
- () => {
this.loading = false;
}
);