From 3ae3df6722508385be6da68d6886ecbffb734448 Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 6 Jul 2021 19:55:01 +0300 Subject: [PATCH] Revert "Parse TXID, hash or address strings from search bar and allow searching for TXID:OUTPUT. (#578)" (#610) This reverts commit 2e2e6aa01f691ca28d2763faf827fda01e428cda. --- .../search-form/search-form.component.ts | 27 ++++++++----------- .../transaction/transaction.component.html | 2 +- .../transaction/transaction.component.ts | 8 ++---- .../transactions-list.component.html | 2 +- .../transactions-list.component.ts | 1 - 5 files changed, 15 insertions(+), 25 deletions(-) diff --git a/frontend/src/app/components/search-form/search-form.component.ts b/frontend/src/app/components/search-form/search-form.component.ts index d5edc8f7e..dd0acb874 100644 --- a/frontend/src/app/components/search-form/search-form.component.ts +++ b/frontend/src/app/components/search-form/search-form.component.ts @@ -23,9 +23,9 @@ export class SearchFormComponent implements OnInit { searchForm: FormGroup; @Output() searchTriggered = new EventEmitter(); - regexAddress = /([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[bB]?[a-z]{2,5}1[ac-hj-np-z02-9]{8,87})/; - regexBlockhash = /[0]{8}[a-fA-F0-9]{56}/; - regexTransaction = /([a-fA-F0-9]{64}):?(\d+)?/; + regexAddress = /^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[bB]?[a-z]{2,5}1[ac-hj-np-z02-9]{8,87})$/; + regexBlockhash = /^[0]{8}[a-fA-F0-9]{56}$/; + regexTransaction = /^[a-fA-F0-9]{64}$/; regexBlockheight = /^[0-9]+$/; @ViewChild('instance', {static: true}) instance: NgbTypeahead; @@ -96,26 +96,21 @@ export class SearchFormComponent implements OnInit { if (searchText) { this.isSearching = true; if (this.regexAddress.test(searchText)) { - const matches = this.regexAddress.exec(searchText); - this.navigate('/address/', matches[0]); - } else if (this.regexBlockhash.test(searchText)) { - const matches = this.regexBlockhash.exec(searchText); - this.navigate('/block/', matches[0]); - } else if (this.regexBlockheight.test(searchText)) { + this.navigate('/address/', searchText); + } else if (this.regexBlockhash.test(searchText) || this.regexBlockheight.test(searchText)) { this.navigate('/block/', searchText); } else if (this.regexTransaction.test(searchText)) { - const matches = this.regexTransaction.exec(searchText); if (this.network === 'liquid') { - if (this.assets[matches[0]]) { - this.navigate('/asset/', matches[0]); + if (this.assets[searchText]) { + this.navigate('/asset/', searchText); } - this.electrsApiService.getAsset$(matches[0]) + this.electrsApiService.getAsset$(searchText) .subscribe( - () => { this.navigate('/asset/', matches[0]); }, - () => { this.navigate('/tx/', matches[0]); } + () => { this.navigate('/asset/', searchText); }, + () => { this.navigate('/tx/', searchText); } ); } else { - this.navigate('/tx/', matches[0]); + this.navigate('/tx/', searchText); } } else { this.isSearching = false; diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index a3b2b9db2..ed35889e8 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -198,7 +198,7 @@
- +

Details

diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 520fc2069..74d181a50 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -20,7 +20,6 @@ export class TransactionComponent implements OnInit, OnDestroy { network = ''; tx: Transaction; txId: string; - outputIndex: number; txInBlockIndex: number; isLoadingTx = true; error: any = undefined; @@ -76,11 +75,9 @@ export class TransactionComponent implements OnInit, OnDestroy { this.subscription = this.route.paramMap.pipe( switchMap((params: ParamMap) => { - this.resetTransaction(); - const urlMatch = (params.get('id') || '').split(':'); - this.txId = urlMatch[0]; - this.outputIndex = urlMatch[1] === undefined ? null : parseInt(urlMatch[1], 10); + this.txId = params.get('id') || ''; this.seoService.setTitle($localize`:@@bisq.transaction.browser-title:Transaction: ${this.txId}:INTERPOLATION:`); + this.resetTransaction(); return merge( of(true), this.stateService.connectionState$.pipe( @@ -205,7 +202,6 @@ export class TransactionComponent implements OnInit, OnDestroy { resetTransaction() { this.error = undefined; this.tx = null; - this.outputIndex = null; this.waitingForTransaction = false; this.isLoadingTx = true; this.rbfTransaction = undefined; 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 25ab12b62..03ab90afd 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.html +++ b/frontend/src/app/components/transactions-list/transactions-list.component.html @@ -117,7 +117,7 @@ - +
{{ vout.scriptpubkey_address | shortenString : 16 }} 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 2e5eb96a0..dd7350954 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -19,7 +19,6 @@ export class TransactionsListComponent implements OnInit, OnChanges { displayDetails = false; @Input() transactions: Transaction[]; - @Input() outputIndex: number; @Input() showConfirmations = false; @Input() transactionPage = false;