diff --git a/app/ionic.config.json b/app/ionic.config.json index 6f01a59..9ffab3a 100644 --- a/app/ionic.config.json +++ b/app/ionic.config.json @@ -7,6 +7,6 @@ }, "proxies": [{ "path": "/api", - "proxyUrl": "http://localhost:3000/api" + "proxyUrl": "https://bch-insight.bitpay.com/api" }] } diff --git a/app/package.json b/app/package.json index 00d8da9..c7c22d2 100644 --- a/app/package.json +++ b/app/package.json @@ -41,7 +41,7 @@ "@types/jasmine": "2.5.41", "@types/node": "7.0.4", "codecov": "2.2.0", - "ionic": "3.9.2", + "ionic": "3.19.1", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "3.2.0", "karma": "1.4.1", diff --git a/app/src/app/app.scss b/app/src/app/app.scss index e254df4..28da551 100644 --- a/app/src/app/app.scss +++ b/app/src/app/app.scss @@ -8,6 +8,10 @@ // Additionally, this file can be also used as an entry point // to import other Sass files to be included in the output CSS. +body { + user-select: text; +} + .ellipsis { display: block; overflow: hidden; @@ -15,19 +19,47 @@ white-space: nowrap; } -.summary ion-label { - color: #333; - font-weight: bold; +.list--summary { + ion-label { + color: #333; + font-weight: bold; + } + + ion-item { + color: #999; + font-size: 1.125rem; + } + + ion-note { + color: #999; + max-width: 50%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } -.summary ion-item { - color: #999; - font-size: 1.4rem; +.grid--table { + margin: 10px 0 20px; + + ion-row { + border-top: 1px solid #ccc; + + &:first-child { + background-color: white; + border-top: none; + } + + &:nth-child(even) { + background-color: #f4f4f4; + } + + &:last-child { + background-color: white; + } + } } -body { - user-select: text; -} // Shared Sass variables, which can be used to adjust Ionic's // default Sass variables, belong in "theme/variables.scss". diff --git a/app/src/components/denomination/denomination.html b/app/src/components/denomination/denomination.html new file mode 100644 index 0000000..65c736b --- /dev/null +++ b/app/src/components/denomination/denomination.html @@ -0,0 +1,10 @@ + + + Units + + + + {{ unit }} + + + diff --git a/app/src/components/denomination/denomination.module.ts b/app/src/components/denomination/denomination.module.ts new file mode 100644 index 0000000..1c9e478 --- /dev/null +++ b/app/src/components/denomination/denomination.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { IonicModule } from 'ionic-angular'; +import { DenominationComponent } from './denomination'; + +@NgModule({ + declarations: [ + DenominationComponent + ], + imports: [ + IonicModule + ], + exports: [ + DenominationComponent + ], + entryComponents: [ + DenominationComponent + ] +}) +export class DenominationComponentModule {} diff --git a/app/src/components/denomination/denomination.scss b/app/src/components/denomination/denomination.scss new file mode 100644 index 0000000..742e908 --- /dev/null +++ b/app/src/components/denomination/denomination.scss @@ -0,0 +1,3 @@ +denomination { + +} diff --git a/app/src/components/denomination/denomination.ts b/app/src/components/denomination/denomination.ts new file mode 100644 index 0000000..b484472 --- /dev/null +++ b/app/src/components/denomination/denomination.ts @@ -0,0 +1,31 @@ +import { Component } from '@angular/core'; +import { CurrencyProvider } from '../../providers/currency/currency'; +import { ViewController } from 'ionic-angular'; + +@Component({ + selector: 'denomination', + templateUrl: 'denomination.html' +}) +export class DenominationComponent { + + public text: string; + public units: any = []; + + constructor( + public currency: CurrencyProvider, + public viewCtrl: ViewController + ) { + this.text = 'Hello World'; + this.units = [ + 'USD', + this.currency.defaultCurrency, + 'm' + this.currency.defaultCurrency, + 'bits' + ]; + } + + public close(): void { + this.viewCtrl.dismiss(); + } + +} diff --git a/app/src/components/head-nav/head-nav.html b/app/src/components/head-nav/head-nav.html index 1d5ff08..c439265 100644 --- a/app/src/components/head-nav/head-nav.html +++ b/app/src/components/head-nav/head-nav.html @@ -4,7 +4,7 @@ {{title}} - - + +
+ +
diff --git a/app/src/components/head-nav/head-nav.module.ts b/app/src/components/head-nav/head-nav.module.ts index 96140da..587a67d 100644 --- a/app/src/components/head-nav/head-nav.module.ts +++ b/app/src/components/head-nav/head-nav.module.ts @@ -1,13 +1,15 @@ import { NgModule } from '@angular/core'; import { IonicModule } from 'ionic-angular'; import { HeadNavComponent } from './head-nav'; +import { DenominationComponentModule } from '../denomination/denomination.module'; @NgModule({ declarations: [ HeadNavComponent ], imports: [ - IonicModule + IonicModule, + DenominationComponentModule ], exports: [ HeadNavComponent diff --git a/app/src/components/head-nav/head-nav.ts b/app/src/components/head-nav/head-nav.ts index 664e77e..1ccf83d 100644 --- a/app/src/components/head-nav/head-nav.ts +++ b/app/src/components/head-nav/head-nav.ts @@ -5,6 +5,8 @@ import { Http } from '@angular/http'; import { ApiProvider } from '../../providers/api/api'; import { CurrencyProvider } from '../../providers/currency/currency'; import { ActionSheetController } from 'ionic-angular'; +import { PopoverController } from 'ionic-angular'; +import { DenominationComponent } from '../denomination/denomination'; /** * Generated class for the HeadNavComponent component. @@ -24,7 +26,14 @@ export class HeadNavComponent { public q: string; public badQuery: boolean = false; - constructor(private navCtrl: NavController, private http: Http, private api: ApiProvider, public currency: CurrencyProvider, public actionSheetCtrl: ActionSheetController) { + constructor( + private navCtrl: NavController, + private http: Http, + private api: ApiProvider, + public currency: CurrencyProvider, + public actionSheetCtrl: ActionSheetController, + public popoverCtrl: PopoverController + ) { } public search(): void { @@ -102,7 +111,8 @@ export class HeadNavComponent { } /* tslint:enable:no-unused-variable */ - public changeCurrency(): void { + public changeCurrency(myEvent: any): void { + /* let actionSheet: any = this.actionSheetCtrl.create({ title: 'Change Denomination', buttons: [ @@ -113,15 +123,15 @@ export class HeadNavComponent { } }, { - text: 'BTC', + text: this.currency.defaultCurrency, handler: () => { - this.currency.setCurrency('BTC'); + this.currency.setCurrency(this.currency.defaultCurrency); } }, { - text: 'mBTC', + text: 'm' + this.currency.defaultCurrency, handler: () => { - this.currency.setCurrency('mBTC'); + this.currency.setCurrency('m' + this.currency.defaultCurrency); } }, { @@ -137,6 +147,12 @@ export class HeadNavComponent { ] }); actionSheet.present(); + */ + + let popover: any = this.popoverCtrl.create(DenominationComponent); + popover.present({ + ev: myEvent + }); } public toggleSearch(): void { diff --git a/app/src/components/latest-blocks/latest-blocks.html b/app/src/components/latest-blocks/latest-blocks.html index 8268be4..30b2c4b 100644 --- a/app/src/components/latest-blocks/latest-blocks.html +++ b/app/src/components/latest-blocks/latest-blocks.html @@ -5,7 +5,7 @@
- + Height @@ -15,6 +15,7 @@ Mined By Size + {{block.height}} @@ -35,6 +36,7 @@ {{ block.size }} + diff --git a/app/src/components/latest-blocks/latest-blocks.scss b/app/src/components/latest-blocks/latest-blocks.scss index 0ae897d..e03ff64 100644 --- a/app/src/components/latest-blocks/latest-blocks.scss +++ b/app/src/components/latest-blocks/latest-blocks.scss @@ -1,23 +1,2 @@ latest-blocks { - ion-grid { - // border: 2px solid green; - margin: 10px 0 20px; - - ion-row { - border-top: 1px solid #ccc; - } - - ion-row:nth-child(even) { - background-color: #f4f4f4; - } - - ion-row:first-child { - background-color: white; - border-top: none; - } - - ion-row:last-child { - background-color: white; - } - } } diff --git a/app/src/components/latest-transactions/latest-transactions.html b/app/src/components/latest-transactions/latest-transactions.html index 55e5084..63f7aea 100644 --- a/app/src/components/latest-transactions/latest-transactions.html +++ b/app/src/components/latest-transactions/latest-transactions.html @@ -4,7 +4,7 @@
- + Hash diff --git a/app/src/components/latest-transactions/latest-transactions.scss b/app/src/components/latest-transactions/latest-transactions.scss index 1b68322..4b8b617 100644 --- a/app/src/components/latest-transactions/latest-transactions.scss +++ b/app/src/components/latest-transactions/latest-transactions.scss @@ -1,23 +1,2 @@ latest-transactions { - ion-grid { - // border: 2px solid green; - margin: 10px 0 20px; - - ion-row { - border-top: 1px solid #ccc; - } - - ion-row:nth-child(even) { - background-color: #f4f4f4; - } - - ion-row:first-child { - background-color: white; - border-top: none; - } - - ion-row:last-child { - background-color: white; - } - } } diff --git a/app/src/components/transaction/transaction.html b/app/src/components/transaction/transaction.html index 78b2ea6..cc3528f 100644 --- a/app/src/components/transaction/transaction.html +++ b/app/src/components/transaction/transaction.html @@ -1,19 +1,19 @@ - + - -
+ + first seen at -
-
+ + mined - -
+ +
@@ -48,7 +48,7 @@
- {{ currency.getConversion(vin.value) }} + {{ currency.getConvertedNumber(vin.value) | number:'1.0-8' }} {{ currency.currencySymbol }}
@@ -76,7 +76,7 @@
- {{ currency.getConversion(vout.value) }} + {{ currency.getConvertedNumber(vout.value) | number:'1.0-8' }} {{ currency.currencySymbol }} (S) (U)
@@ -85,15 +85,15 @@ - - - Fee {{ currency.getConversion(tx.fees) }} + + +
+ Fee {{ currency.getConvertedNumber(tx.fees) | number:'1.0-8' }} {{ currency.currencySymbol }} +
- - {{ tx.confirmations }} Confirmations - - - {{ currency.getConversion(tx.valueOut) }} + + {{ tx.confirmations }} Confirmations + {{ currency.getConvertedNumber(tx.valueOut) | number:'1.0-8' }} {{ currency.currencySymbol }}
diff --git a/app/src/components/transaction/transaction.scss b/app/src/components/transaction/transaction.scss index 40a22fb..631a436 100644 --- a/app/src/components/transaction/transaction.scss +++ b/app/src/components/transaction/transaction.scss @@ -9,6 +9,24 @@ transaction { ion-row { border: 1px solid #eee; + + &.small { + font-size: 1.1rem; + } + + ion-col { + ion-note { + font-size: 1.2rem; + } + } } } + + .item, .item p { + font-size: 1.4rem; + } + + .list { + margin-bottom: 5px + } } diff --git a/app/src/pages/address/address.html b/app/src/pages/address/address.html index 4dfc4d7..071c08e 100644 --- a/app/src/pages/address/address.html +++ b/app/src/pages/address/address.html @@ -10,34 +10,34 @@

Address

Address {{ address.addrStr }}

-

{{ currency.getConversion(address.balance) }}

+

{{ currency.getConvertedNumber(address.balance) | number:'1.0-8' }} {{ currency.currencySymbol }}

Summary

- + Total Received - - {{ currency.getConversion(address.totalReceived) }} - + + {{ currency.getConvertedNumber(address.totalReceived) | number:'1.0-8' }} {{ currency.currencySymbol }} + Total Sent - - {{ currency.getConversion(address.totalSent) }} - + + {{ currency.getConvertedNumber(address.totalSent) | number:'1.0-8' }} {{ currency.currencySymbol }} + Final Balance - - {{ currency.getConversion(address.balance) }} - + + {{ currency.getConvertedNumber(address.balance) | number:'1.0-8' }} {{ currency.currencySymbol }} + No. Transactions - + {{ address.txApperances }} - + diff --git a/app/src/pages/block-detail/block-detail.html b/app/src/pages/block-detail/block-detail.html index aaebe36..4cc446d 100644 --- a/app/src/pages/block-detail/block-detail.html +++ b/app/src/pages/block-detail/block-detail.html @@ -13,84 +13,84 @@

Summary

- + Number of Transactions - + {{ block.tx.length }} - + Height - + {{ block.height }} (Mainchain) - + Block Reward - - {{ currency.getConversion(block.reward) }} - + + {{ currency.getConvertedNumber(block.reward) | number:'1.0-8' }} {{ currency.currencySymbol }} + Timestamp - + {{ block.time * 1000 | date:'medium' }} - + Mined by - + {{ block.poolInfo.poolName }} - + Merkle Root - + {{ block.merkleroot }} - + Previous Block - + {{ block.height - 1 }} - + Difficulty - + {{ block.difficulty }} - + Bits - + {{ block.bits }} - + Size (bytes) - + {{ block.size }} - + Version - + {{ block.version }} - + Nonce - + {{ block.nonce }} - + Next Block - + {{ block.height + 1 }} - + diff --git a/app/src/pages/home/home.html b/app/src/pages/home/home.html index 2449c40..029561b 100644 --- a/app/src/pages/home/home.html +++ b/app/src/pages/home/home.html @@ -16,16 +16,18 @@
+

About

insight is an open-source Bitcoin blockchain explorer with complete REST and websocket APIs that can be used for writing web wallets and other apps that need more advanced blockchain queries than provided by bitcoind RPC. Check out the source code.

-

insight is still in development, so be sure to report any bugs and provide feedback for improvement at our github issue tracker.

+

insight is still in development, so be sure to report any bugs and provide feedback for improvement at our github issue tracker.

Powered by diff --git a/app/src/pages/transaction/transaction.html b/app/src/pages/transaction/transaction.html index 7f904dc..9b922cc 100644 --- a/app/src/pages/transaction/transaction.html +++ b/app/src/pages/transaction/transaction.html @@ -13,30 +13,30 @@

Summary

- + Size - + {{ tx.size }} (bytes) - + Received Time - + {{ tx.time * 1000 | date:'medium' }} - + Mined Time - + {{ tx.blocktime * 1000 | date:'medium' }} - + Included in Block - + {{ tx.blockhash }} - + diff --git a/app/src/providers/currency/currency.ts b/app/src/providers/currency/currency.ts index b3f571b..19062a2 100644 --- a/app/src/providers/currency/currency.ts +++ b/app/src/providers/currency/currency.ts @@ -16,10 +16,11 @@ export class CurrencyProvider { public currencySymbol: string; public factor: number = 1; private bitstamp: number; + private kraken: number; private loading: boolean; constructor(public http: Http, private api: ApiProvider) { - this.defaultCurrency = 'BTC'; + this.defaultCurrency = 'BCH'; this.currencySymbol = this.defaultCurrency; } @@ -27,6 +28,30 @@ export class CurrencyProvider { return Math.round(aFloat * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces); } + public getConvertedNumber(value: number): number { + if (value === 0.00000000) return 0; + + let response: number; + + if (this.currencySymbol === 'USD') { + response = this.roundFloat((value * this.factor), 2); + } else if (this.currencySymbol === 'm' + this.defaultCurrency) { + this.factor = 1000; + response = this.roundFloat((value * this.factor), 5); + } else if (this.currencySymbol === 'bits') { + this.factor = 1000000; + response = this.roundFloat((value * this.factor), 2); + } else { + this.factor = 1; + response = this.roundFloat((value * this.factor), 8); + } + + return response; + } + + /** + * @deprecated use getConvertedNumber + */ public getConversion(value: number): string { if (value === 0.00000000) return '0 ' + this.currencySymbol; // fix value to show @@ -34,13 +59,13 @@ export class CurrencyProvider { if (this.currencySymbol === 'USD') { response = this.roundFloat((value * this.factor), 2); - } else if (this.currencySymbol === 'mBTC') { + } else if (this.currencySymbol === 'm' + this.defaultCurrency) { this.factor = 1000; response = this.roundFloat((value * this.factor), 5); } else if (this.currencySymbol === 'bits') { this.factor = 1000000; response = this.roundFloat((value * this.factor), 2); - } else { // assumes currencySymbol is BTC + } else { this.factor = 1; response = this.roundFloat((value * this.factor), 8); } @@ -56,7 +81,11 @@ export class CurrencyProvider { this.http.get(this.api.apiPrefix + 'currency').subscribe( (data) => { let currencyParsed: any = JSON.parse(data['_body']); - this.factor = this.bitstamp = currencyParsed.data.bitstamp; + if (currencyParsed.data.bitstamp) { + this.factor = this.bitstamp = currencyParsed.data.bitstamp; + } else if (currencyParsed.data.kraken) { + this.factor = this.kraken = currencyParsed.data.kraken; + } this.loading = false; }, (err) => { @@ -64,7 +93,7 @@ export class CurrencyProvider { this.loading = false; } ); - } else if (currency === 'mBTC') { + } else if (currency === 'm' + this.defaultCurrency) { this.factor = 1000; } else if (currency === 'bits') { this.factor = 1000000;