Reveal coinbase scriptsig and op_return scriptpubkey ascii on hover.
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user