From fc415372bf31e9680c0763eb2d1bd44f88812e96 Mon Sep 17 00:00:00 2001 From: natsoni Date: Mon, 5 Feb 2024 11:22:14 +0100 Subject: [PATCH 1/2] Fix P2SH / P2PKH detection on Liquid address page --- frontend/src/app/components/address/address.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/components/address/address.component.ts b/frontend/src/app/components/address/address.component.ts index 0e10b207f..060ec6772 100644 --- a/frontend/src/app/components/address/address.component.ts +++ b/frontend/src/app/components/address/address.component.ts @@ -105,7 +105,7 @@ export class AddressComponent implements OnInit, OnDestroy { .pipe( filter((address) => !!address), tap((address: Address) => { - if ((this.stateService.network === 'liquid' || this.stateService.network === 'liquidtestnet') && /^([m-zA-HJ-NP-Z1-9]{26,35}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,100}|[a-km-zA-HJ-NP-Z1-9]{80})$/.test(address.address)) { + if ((this.stateService.network === 'liquid' || this.stateService.network === 'liquidtestnet') && /^([a-zA-HJ-NP-Z1-9]{26,35}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,100}|[a-km-zA-HJ-NP-Z1-9]{80})$/.test(address.address)) { this.apiService.validateAddress$(address.address) .subscribe((addressInfo) => { this.addressInfo = addressInfo; From c58115a96c2cbcc89c8de4c9482d0d28e0e23645 Mon Sep 17 00:00:00 2001 From: natsoni Date: Mon, 5 Feb 2024 11:53:05 +0100 Subject: [PATCH 2/2] Add confidential addresses in liquid address regex --- frontend/src/app/shared/regex.utils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/shared/regex.utils.ts b/frontend/src/app/shared/regex.utils.ts index 128f7566e..93f4b9275 100644 --- a/frontend/src/app/shared/regex.utils.ts +++ b/frontend/src/app/shared/regex.utils.ts @@ -77,11 +77,15 @@ const ADDRESS_CHARS: { + `)`, }, liquid: { - base58: `[GHPQ]` // G|H is P2PKH, P|Q is P2SH - + BASE58_CHARS - + `{33}`, // All min-max lengths are 34 + base58: `[GHPQ]` // PQ is P2PKH, GH is P2SH + + BASE58_CHARS + + `{33}` // All min-max lengths are 34 + + `|` + + `[V][TJ]` // Confidential P2PKH or P2SH starts with VT or VJ + + BASE58_CHARS + + `{78}`, bech32: `(?:` - + `(?:` // bech32 liquid starts with ex1 or lq1 + + `(?:` // bech32 liquid starts with ex1 (unconfidential) or lq1 (confidential) + `ex1` + `|` + `lq1`