mirror of
https://github.com/mempool/mempool.git
synced 2025-03-03 17:47:01 +01:00
Reveal coinbase scriptsig and op_return scriptpubkey ascii on hover.
This commit is contained in:
parent
58942ec88a
commit
565aa499e5
5 changed files with 35 additions and 2 deletions
|
@ -50,6 +50,7 @@ import { ScriptpubkeyTypePipe } from './pipes/scriptpubkey-type-pipe/scriptpubke
|
|||
import { AssetsComponent } from './assets/assets.component';
|
||||
import { RelativeUrlPipe } from './pipes/relative-url/relative-url.pipe';
|
||||
import { MinerComponent } from './pipes/miner/miner.component';
|
||||
import { Hex2asciiPipe } from './pipes/hex2ascii/hex2ascii.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -90,6 +91,7 @@ import { MinerComponent } from './pipes/miner/miner.component';
|
|||
AssetsComponent,
|
||||
RelativeUrlPipe,
|
||||
MinerComponent,
|
||||
Hex2asciiPipe,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<div [ngSwitch]="true">
|
||||
<ng-container *ngSwitchCase="vin.is_coinbase">Coinbase<ng-template [ngIf]="network !== 'liquid'"> (Newly Generated Coins)</ng-template></ng-container>
|
||||
<ng-container *ngSwitchCase="vin.is_coinbase"><a placement="bottom" [ngbTooltip]="vin.scriptsig | hex2ascii">Coinbase<ng-template [ngIf]="network !== 'liquid'"> (Newly Generated Coins)</ng-template></a></ng-container>
|
||||
<ng-container *ngSwitchCase="vin.is_pegin">
|
||||
Peg-in
|
||||
</ng-container>
|
||||
|
@ -79,7 +79,7 @@
|
|||
</a>
|
||||
</ng-template>
|
||||
<ng-template #defaultscriptpubkey_type>
|
||||
{{ vout.scriptpubkey_type | scriptpubkeyType }}
|
||||
<a placement="bottom" [ngbTooltip]="vout.scriptpubkey | hex2ascii">{{ vout.scriptpubkey_type | scriptpubkeyType }}</a>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
</td>
|
||||
|
|
8
frontend/src/app/pipes/hex2ascii/hex2ascii.pipe.spec.ts
Normal file
8
frontend/src/app/pipes/hex2ascii/hex2ascii.pipe.spec.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { Hex2asciiPipe } from './hex2ascii.pipe';
|
||||
|
||||
describe('Hex2asciiPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new Hex2asciiPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
19
frontend/src/app/pipes/hex2ascii/hex2ascii.pipe.ts
Normal file
19
frontend/src/app/pipes/hex2ascii/hex2ascii.pipe.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'hex2ascii'
|
||||
})
|
||||
export class Hex2asciiPipe implements PipeTransform {
|
||||
|
||||
transform(hex: string): string {
|
||||
if (!hex) {
|
||||
return '';
|
||||
}
|
||||
let str = '';
|
||||
for (let i = 0; i < hex.length; i += 2) {
|
||||
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
|
@ -388,3 +388,7 @@ h1, h2, h3 {
|
|||
.mt-2-5, .my-2-5 {
|
||||
margin-top: 0.75rem !important;
|
||||
}
|
||||
|
||||
.tooltip-inner {
|
||||
max-width: inherit;
|
||||
}
|
Loading…
Add table
Reference in a new issue