diff --git a/app/src/components/transactions/transactions.ts b/app/src/components/transactions/transactions.ts
index fda0295..f2bb011 100644
--- a/app/src/components/transactions/transactions.ts
+++ b/app/src/components/transactions/transactions.ts
@@ -17,6 +17,7 @@ export class TransactionsComponent {
public loading: boolean = true;
@Input() public blockHash: string;
+ @Input() public address: string;
public transactions: any = [];
constructor(private navCtrl: NavController, private http: Http) {
@@ -24,8 +25,21 @@ export class TransactionsComponent {
private ngOnInit(): void {
let apiPrefix: string = 'http://localhost:3001/insight-api/';
+ let lookupType: string, lookupValue: string;
- this.http.get(apiPrefix + 'txs?block=' + this.blockHash).subscribe(
+ if (this.blockHash) {
+ lookupType = 'blocks';
+ lookupValue = this.blockHash;
+ }
+ if (this.address) {
+ lookupType = 'address';
+ lookupValue = this.address;
+ }
+
+ console.log('blockHash', this.blockHash);
+ console.log('address', this.address);
+
+ this.http.get(apiPrefix + 'txs?' + lookupType + '=' + lookupValue).subscribe(
(data) => {
this.transactions = JSON.parse(data['_body']);
this.loading = false;
diff --git a/app/src/pages/address/address.html b/app/src/pages/address/address.html
index 86fee88..11ab88f 100644
--- a/app/src/pages/address/address.html
+++ b/app/src/pages/address/address.html
@@ -19,7 +19,7 @@
Address
0 BTC
- address
+ {{ address }}
@@ -48,4 +48,6 @@
Transactions
+
+
diff --git a/app/src/pages/address/address.module.ts b/app/src/pages/address/address.module.ts
index 485b9e5..c02f6cf 100644
--- a/app/src/pages/address/address.module.ts
+++ b/app/src/pages/address/address.module.ts
@@ -1,10 +1,12 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { AddressPage } from './address';
+import { TransactionsComponent } from '../../components/transactions/transactions';
@NgModule({
declarations: [
- AddressPage
+ AddressPage,
+ TransactionsComponent
],
imports: [
IonicPageModule.forChild(AddressPage)
diff --git a/app/src/pages/address/address.ts b/app/src/pages/address/address.ts
index 00d8939..03131e3 100644
--- a/app/src/pages/address/address.ts
+++ b/app/src/pages/address/address.ts
@@ -17,7 +17,11 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
})
export class AddressPage {
+ public loading: boolean = true;
+ private address: string;
+
constructor(public navCtrl: NavController, public navParams: NavParams) {
+ this.address = navParams.get('address');
}
public ionViewDidLoad(): void {