diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.html b/frontend/src/app/components/transactions-list/transactions-list.component.html index 70f19f357..9925d5bd8 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -327,7 +327,7 @@ @if (vout.isRunestone) { } @else { - {{ vout.scriptpubkey_asm | hex2ascii }} + {{ vout.scriptpubkey_asm | slice:0:200 | hex2ascii }} } {{ vout.scriptpubkey_type | scriptpubkeyType }} @@ -384,15 +384,50 @@ ScriptPubKey (ASM) - + + +
+ ... + +
+ ScriptPubKey (HEX) - {{ vout.scriptpubkey }} + + @if (!showFullScriptPubkeyHex[vindex]) { + {{ vout.scriptpubkey | slice:0:1000 }} + } @else { + {{ vout.scriptpubkey }} + } +
+ ... + +
+ OP_RETURN data - {{ vout.scriptpubkey_asm | hex2ascii }} + + @if (!showFullOpReturnData[vindex]) { + {{ (vout.scriptpubkey_asm | hex2ascii | slice:0:1000) }} + } @else { + {{ vout.scriptpubkey_asm | hex2ascii }} + } +
+ ... + +
+ Type diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index 480f45372..b7d6eb5aa 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -62,6 +62,9 @@ export class TransactionsListComponent implements OnInit, OnChanges, OnDestroy { outputRowLimit: number = 12; showFullScript: { [vinIndex: number]: boolean } = {}; showFullWitness: { [vinIndex: number]: { [witnessIndex: number]: boolean } } = {}; + showFullScriptPubkeyAsm: { [voutIndex: number]: boolean } = {}; + showFullScriptPubkeyHex: { [voutIndex: number]: boolean } = {}; + showFullOpReturnData: { [voutIndex: number]: boolean } = {}; showOrdData: { [key: string]: { show: boolean; inscriptions?: Inscription[]; runestone?: Runestone, runeInfo?: { [id: string]: { etching: Etching; txid: string; } }; } } = {}; similarityMatches: Map> = new Map(); @@ -516,6 +519,18 @@ export class TransactionsListComponent implements OnInit, OnChanges, OnDestroy { this.showFullWitness[vinIndex][witnessIndex] = !this.showFullWitness[vinIndex][witnessIndex]; } + toggleShowFullScriptPubkeyAsm(voutIndex: number): void { + this.showFullScriptPubkeyAsm[voutIndex] = !this.showFullScriptPubkeyAsm[voutIndex]; + } + + toggleShowFullScriptPubkeyHex(voutIndex: number): void { + this.showFullScriptPubkeyHex[voutIndex] = !this.showFullScriptPubkeyHex[voutIndex]; + } + + toggleShowFullOpReturnData(voutIndex: number): void { + this.showFullOpReturnData[voutIndex] = !this.showFullOpReturnData[voutIndex]; + } + toggleOrdData(txid: string, type: 'vin' | 'vout', index: number) { const tx = this.transactions.find((tx) => tx.txid === txid); if (!tx) { diff --git a/frontend/src/app/shared/components/asm/asm.component.ts b/frontend/src/app/shared/components/asm/asm.component.ts index 66ae5df4b..9fcb5859e 100644 --- a/frontend/src/app/shared/components/asm/asm.component.ts +++ b/frontend/src/app/shared/components/asm/asm.component.ts @@ -28,7 +28,7 @@ export class AsmComponent { } ngOnChanges(changes: SimpleChanges): void { - if (changes['asm']) { + if (changes['asm'] || changes['crop']) { this.parseASM(); } } @@ -36,14 +36,35 @@ export class AsmComponent { parseASM(): void { let instructions = this.asm.split('OP_'); // trim instructions to a whole number of instructions with at most `crop` characters total - if (this.crop) { + if (this.crop && this.asm.length > this.crop) { let chars = 0; for (let i = 0; i < instructions.length; i++) { - chars += instructions[i].length + 3; - if (chars > this.crop) { + if (chars + instructions[i].length + 3 > this.crop) { + let croppedInstruction = instructions[i]; instructions = instructions.slice(0, i); + // add cropped instruction + let remainingChars = this.crop - chars; + let parts = croppedInstruction.split(' '); + // only render this instruction if there is space for the instruction name and a few args + if (remainingChars > parts[0].length + 10) { + remainingChars -= parts[0].length + 1; + for (let j = 1; j < parts.length; j++) { + const arg = parts[j]; + if (remainingChars >= arg.length) { + remainingChars -= arg.length + 1; + } else { + // crop this argument + parts[j] = arg.slice(0, remainingChars); + // and remove all following arguments + parts = parts.slice(0, j + 1); + break; + } + } + instructions.push(`${parts.join(' ')}`); + } break; } + chars += instructions[i].length + 3; } } this.instructions = instructions.filter(instruction => instruction.trim() !== '').map(instruction => { @@ -82,6 +103,7 @@ export class AsmComponent { ['ELSE', 'control'], ['ENDIF', 'control'], ['VERIFY', 'control'], + ['RETURN', 'control'], ...Array.from({length: 70}, (_, i) => [`RETURN_${i + 186}`, 'control']), // Stack