diff --git a/frontend/src/app/components/block/block.component.html b/frontend/src/app/components/block/block.component.html index 8a072fe10..b79d6e1c7 100644 --- a/frontend/src/app/components/block/block.component.html +++ b/frontend/src/app/components/block/block.component.html @@ -80,6 +80,51 @@ +
+
+ +
+
+
+ + + + + + + + + + + + + + + +
Version{{ block.version | decimal2hex }} Taproot
Merkle root

{{ block.merkle_root }}

Bits{{ block.bits | decimal2hex }}
+
+
+ + + + + + + + + + + +
Difficulty{{ block.difficulty }}
Nonce{{ block.nonce | decimal2hex }}
+
+
+
+
+ +
+ +
+

diff --git a/frontend/src/app/components/block/block.component.scss b/frontend/src/app/components/block/block.component.scss index 38ddb2a6a..84089f14d 100644 --- a/frontend/src/app/components/block/block.component.scss +++ b/frontend/src/app/components/block/block.component.scss @@ -14,3 +14,9 @@ width: 140px; } } + + +.break-all { + white-space: normal; + word-break: break-all; +} \ No newline at end of file diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 188b19b08..b2b8cb342 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -32,6 +32,7 @@ export class BlockComponent implements OnInit, OnDestroy { page = 1; itemsPerPage: number; txsLoadingStatus$: Observable; + showDetails = false; constructor( private route: ActivatedRoute, @@ -144,6 +145,14 @@ export class BlockComponent implements OnInit, OnDestroy { this.stateService.networkChanged$ .subscribe((network) => this.network = network); + + this.route.queryParams.subscribe((params) => { + if (params.showDetails === 'true') { + this.showDetails = true; + } else { + this.showDetails = false; + } + }); } ngOnDestroy() { @@ -175,4 +184,26 @@ export class BlockComponent implements OnInit, OnDestroy { this.isLoadingTransactions = false; }); } + + toggleShowDetails() { + if (this.showDetails) { + this.showDetails = false; + this.router.navigate([], { + relativeTo: this.route, + queryParams: { showDetails: false }, + queryParamsHandling: 'merge', + }); + } else { + this.showDetails = true; + this.router.navigate([], { + relativeTo: this.route, + queryParams: { showDetails: true }, + queryParamsHandling: 'merge', + }); + } + } + + hasTaproot(version: number): boolean { + return (Number(version) & (1 << 2)) > 0; + } } diff --git a/frontend/src/app/interfaces/electrs.interface.ts b/frontend/src/app/interfaces/electrs.interface.ts index b09b3fd6d..dcf7508ae 100644 --- a/frontend/src/app/interfaces/electrs.interface.ts +++ b/frontend/src/app/interfaces/electrs.interface.ts @@ -98,7 +98,7 @@ export interface Block { version: number; timestamp: number; bits: number; - nounce: number; + nonce: number; difficulty: number; merkle_root: string; tx_count: number; diff --git a/frontend/src/app/shared/pipes/decimal2hex/decimal2hex.pipe.ts b/frontend/src/app/shared/pipes/decimal2hex/decimal2hex.pipe.ts new file mode 100644 index 000000000..3c99cec0d --- /dev/null +++ b/frontend/src/app/shared/pipes/decimal2hex/decimal2hex.pipe.ts @@ -0,0 +1,10 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'decimal2hex' +}) +export class Decimal2HexPipe implements PipeTransform { + transform(decimal: number): string { + return `0x` + decimal.toString(16); + } +} diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts index f9f0c4a4d..6180c8d24 100644 --- a/frontend/src/app/shared/shared.module.ts +++ b/frontend/src/app/shared/shared.module.ts @@ -4,6 +4,7 @@ import { VbytesPipe } from './pipes/bytes-pipe/vbytes.pipe'; import { ShortenStringPipe } from './pipes/shorten-string-pipe/shorten-string.pipe'; import { CeilPipe } from './pipes/math-ceil/math-ceil.pipe'; import { Hex2asciiPipe } from './pipes/hex2ascii/hex2ascii.pipe'; +import { Decimal2HexPipe } from './pipes/decimal2hex/decimal2hex.pipe'; import { AsmStylerPipe } from './pipes/asm-styler/asm-styler.pipe'; import { RelativeUrlPipe } from './pipes/relative-url/relative-url.pipe'; import { ScriptpubkeyTypePipe } from './pipes/scriptpubkey-type-pipe/scriptpubkey-type.pipe'; @@ -35,6 +36,7 @@ import { ReactiveFormsModule } from '@angular/forms'; WuBytesPipe, CeilPipe, ShortenStringPipe, + Decimal2HexPipe, ], imports: [ CommonModule, @@ -71,6 +73,7 @@ import { ReactiveFormsModule } from '@angular/forms'; WuBytesPipe, CeilPipe, ShortenStringPipe, + Decimal2HexPipe, ] }) export class SharedModule {}