From 999163d7ad0942e13daa7031877dc317ed82a3a1 Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 3 Feb 2021 12:51:30 +0700 Subject: [PATCH] Type fix for contract parsing. refs #324 --- .../address-labels/address-labels.component.html | 11 +++++------ .../address-labels/address-labels.component.ts | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/components/address-labels/address-labels.component.html b/frontend/src/app/components/address-labels/address-labels.component.html index 3ef9e092a..9abfe32da 100644 --- a/frontend/src/app/components/address-labels/address-labels.component.html +++ b/frontend/src/app/components/address-labels/address-labels.component.html @@ -2,17 +2,16 @@ *ngIf="multisig" class="badge badge-pill badge-warning" i18n="address-labels.multisig" - >multisig {{ multisigM }} of {{ multisigN }} +>multisig {{ multisigM }} of {{ multisigN }} + Lightning {{ lightning }} +>Lightning {{ lightning }} + Liquid {{ liquid }} +>Liquid {{ liquid }} diff --git a/frontend/src/app/components/address-labels/address-labels.component.ts b/frontend/src/app/components/address-labels/address-labels.component.ts index ba9413ea8..4f4cbf7fa 100644 --- a/frontend/src/app/components/address-labels/address-labels.component.ts +++ b/frontend/src/app/components/address-labels/address-labels.component.ts @@ -46,12 +46,11 @@ export class AddressLabelsComponent implements OnInit { } [ - [/^OP_DUP OP_HASH160/, 'HTLC'], - [/^OP_IF OP_PUSHBYTES_33 \w{33} OP_ELSE OP_PUSHBYTES_2 \w{2} OP_CSV OP_DROP/, 'Force Close'] - ].forEach( - ([re, label]) => { - if (re.test(this.vin.inner_witnessscript_asm)) { - this.lightning = label; + {regexp: /^OP_DUP OP_HASH160/, label: 'HTLC'}, + {regexp: /^OP_IF OP_PUSHBYTES_33 \w{33} OP_ELSE OP_PUSHBYTES_2 \w{2} OP_CSV OP_DROP/, label: 'Force Close'} + ].forEach((item) => { + if (item.regexp.test(this.vin.inner_witnessscript_asm)) { + this.lightning = item.label; return; } }