diff --git a/backend/src/index.ts b/backend/src/index.ts index 85ddbb19e..97c1bf92b 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -268,6 +268,7 @@ class MempoolSpace { this.app .get(config.API_ENDPOINT + 'explorer/blocks', routes.getBlocks) .get(config.API_ENDPOINT + 'explorer/blocks/:height', routes.getBlocks) + .get(config.API_ENDPOINT + 'explorer/tx/:id', routes.getRawTransaction) ; } diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 7229b659b..adf3e0daf 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -90,6 +90,15 @@ class Routes { res.status(500).send(e.message); } } + + public async getRawTransaction(req, res) { + try { + const result = await bitcoinApi.getRawTransaction(req.params.id); + res.send(result); + } catch (e) { + res.status(500).send(e.message); + } + } } export default new Routes(); diff --git a/frontend/angular.json b/frontend/angular.json index 8742ea254..378711229 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -48,6 +48,23 @@ "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true + }, + "esplora": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment-esplora.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true } } }, diff --git a/frontend/package.json b/frontend/package.json index 1dd256eb6..59b35dc0a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,7 +5,8 @@ "scripts": { "ng": "ng", "start": "ng serve --aot --proxy-config proxy.conf.json", - "build": "ng build --prod --vendorChunk=false --build-optimizer=true", + "build": "ng build --prod", + "build-esplora": "ng build --prod --configuration=esplora", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" diff --git a/frontend/src/app/blockchain-blocks/block-modal/block-modal.component.scss b/frontend/src/app/blockchain-blocks/block-modal/block-modal.component.scss index 75d226682..8b1378917 100644 --- a/frontend/src/app/blockchain-blocks/block-modal/block-modal.component.scss +++ b/frontend/src/app/blockchain-blocks/block-modal/block-modal.component.scss @@ -1,7 +1 @@ -.yellow-color { - color: #ffd800; -} -.green-color { - color: #3bcc49; -} diff --git a/frontend/src/app/blockchain-blocks/blockchain-blocks.component.html b/frontend/src/app/blockchain-blocks/blockchain-blocks.component.html index d62f8c838..7a7aedd65 100644 --- a/frontend/src/app/blockchain-blocks/blockchain-blocks.component.html +++ b/frontend/src/app/blockchain-blocks/blockchain-blocks.component.html @@ -2,7 +2,8 @@
address works!
diff --git a/frontend/src/app/explorer/address/address.component.scss b/frontend/src/app/explorer/address/address.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/app/explorer/address/address.component.ts b/frontend/src/app/explorer/address/address.component.ts new file mode 100644 index 000000000..563eb98e3 --- /dev/null +++ b/frontend/src/app/explorer/address/address.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-address', + templateUrl: './address.component.html', + styleUrls: ['./address.component.scss'] +}) +export class AddressComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/frontend/src/app/explorer/explorer.module.ts b/frontend/src/app/explorer/explorer.module.ts index b3952d03b..9e020d437 100644 --- a/frontend/src/app/explorer/explorer.module.ts +++ b/frontend/src/app/explorer/explorer.module.ts @@ -5,6 +5,7 @@ import { TransactionComponent } from './transaction/transaction.component'; import { RouterModule, Routes } from '@angular/router'; import { SharedModule } from '../shared/shared.module'; import { BlockComponent } from './block/block.component'; +import { AddressComponent } from './address/address.component'; const routes: Routes = [ { @@ -19,10 +20,14 @@ const routes: Routes = [ path: 'tx/:id', component: TransactionComponent, }, + { + path: 'address/:id', + component: AddressComponent, + }, ]; @NgModule({ - declarations: [ExplorerComponent, TransactionComponent, BlockComponent], + declarations: [ExplorerComponent, TransactionComponent, BlockComponent, AddressComponent], imports: [ SharedModule, CommonModule, diff --git a/frontend/src/app/explorer/transaction/transaction.component.html b/frontend/src/app/explorer/transaction/transaction.component.html index 4873937bc..dbc258801 100644 --- a/frontend/src/app/explorer/transaction/transaction.component.html +++ b/frontend/src/app/explorer/transaction/transaction.component.html @@ -1 +1,143 @@ -transaction works!
++ {{ tx.txid }} + | +
---|
+
+
+ |
+
+
+
+ |
+
+
+ {{ vout.scriptpubkey_address }}
+
+ |
+
+
+
+ |
+ ||
+
+ |
+
Size | +{{ tx.size | bytes }} | +
Weight | +{{ tx.weight }} WU | +
Included in block | +#{{ tx.status.block_height }} | +
Fees | +{{ tx.fee }} ({{ conversions.USD * tx.fee | currency:'USD':'symbol':'1.2-2' }}) | +
Fees per vByte | +{{ (tx.fee * 100000000) / tx.vsize | number : '1.2-2' }} sat/vB | +
Transaction hash | -{{ txIdShort }} | ++ {{ txIdShort }} + {{ txIdShort }} + |
Fee: | diff --git a/frontend/src/app/tx-bubble/tx-bubble.component.scss b/frontend/src/app/tx-bubble/tx-bubble.component.scss index 105c30991..4c759c4c1 100644 --- a/frontend/src/app/tx-bubble/tx-bubble.component.scss +++ b/frontend/src/app/tx-bubble/tx-bubble.component.scss @@ -63,7 +63,3 @@ .txBubble .arrow-top-left.txBubbleText::after { left: 20%; } - -.green-color { - color: #3bcc49; -} diff --git a/frontend/src/app/tx-bubble/tx-bubble.component.ts b/frontend/src/app/tx-bubble/tx-bubble.component.ts index 048bc44b8..91e9fffe4 100644 --- a/frontend/src/app/tx-bubble/tx-bubble.component.ts +++ b/frontend/src/app/tx-bubble/tx-bubble.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit, OnDestroy, HostListener } from '@angular/core'; import { ITransaction, IProjectedBlock } from '../blockchain/interfaces'; import { Subscription } from 'rxjs'; import { ITxTracking, MemPoolService } from '../services/mem-pool.service'; +import { environment } from '../../environments/environment'; @Component({ selector: 'app-tx-bubble', @@ -35,6 +36,8 @@ export class TxBubbleComponent implements OnInit, OnDestroy { txTrackingTx: ITransaction | null = null; txShowTxNotFound = false; + isEsploraEnabled = !!environment.esplora; + @HostListener('window:resize', ['$event']) onResize(event: Event) { this.moveTxBubbleToPosition(); diff --git a/frontend/src/environments/environment-esplora.prod.ts b/frontend/src/environments/environment-esplora.prod.ts new file mode 100644 index 000000000..b8e4d4ff2 --- /dev/null +++ b/frontend/src/environments/environment-esplora.prod.ts @@ -0,0 +1,4 @@ +export const environment = { + production: true, + esplora: true, +}; diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index 3612073bc..6fa4a9286 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + esplora: false, }; diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index 012182efa..f9e18f42f 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + esplora: true, }; /* diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index deec4d859..e170e22b4 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -132,4 +132,28 @@ html, body { hr { border-top: 1px solid rgba(255, 255, 255, 0.1); -} \ No newline at end of file +} + +.green-color { + color: #3bcc49; +} + +.yellow-color { + color: #ffd800; +} + +.table-striped tbody tr:nth-of-type(odd) { + background-color: #181b2d !important; +} + +.header-bg { + background-color: #653b9c; +} + +.bordertop { + border-top: 1px solid #4c4c4c; +} + +.smaller-text { + font-size: 14px; +}