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 dd0acb874..d5edc8f7e 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}$/; + 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+)?/; regexBlockheight = /^[0-9]+$/; @ViewChild('instance', {static: true}) instance: NgbTypeahead; @@ -96,21 +96,26 @@ export class SearchFormComponent implements OnInit { if (searchText) { this.isSearching = true; if (this.regexAddress.test(searchText)) { - this.navigate('/address/', searchText); - } else if (this.regexBlockhash.test(searchText) || this.regexBlockheight.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('/block/', searchText); } else if (this.regexTransaction.test(searchText)) { + const matches = this.regexTransaction.exec(searchText); if (this.network === 'liquid') { - if (this.assets[searchText]) { - this.navigate('/asset/', searchText); + if (this.assets[matches[0]]) { + this.navigate('/asset/', matches[0]); } - this.electrsApiService.getAsset$(searchText) + this.electrsApiService.getAsset$(matches[0]) .subscribe( - () => { this.navigate('/asset/', searchText); }, - () => { this.navigate('/tx/', searchText); } + () => { this.navigate('/asset/', matches[0]); }, + () => { this.navigate('/tx/', matches[0]); } ); } else { - this.navigate('/tx/', searchText); + this.navigate('/tx/', matches[0]); } } 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 ed35889e8..a3b2b9db2 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 74d181a50..520fc2069 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -20,6 +20,7 @@ export class TransactionComponent implements OnInit, OnDestroy { network = ''; tx: Transaction; txId: string; + outputIndex: number; txInBlockIndex: number; isLoadingTx = true; error: any = undefined; @@ -75,9 +76,11 @@ export class TransactionComponent implements OnInit, OnDestroy { this.subscription = this.route.paramMap.pipe( switchMap((params: ParamMap) => { - this.txId = params.get('id') || ''; - this.seoService.setTitle($localize`:@@bisq.transaction.browser-title:Transaction: ${this.txId}:INTERPOLATION:`); this.resetTransaction(); + const urlMatch = (params.get('id') || '').split(':'); + this.txId = urlMatch[0]; + this.outputIndex = urlMatch[1] === undefined ? null : parseInt(urlMatch[1], 10); + this.seoService.setTitle($localize`:@@bisq.transaction.browser-title:Transaction: ${this.txId}:INTERPOLATION:`); return merge( of(true), this.stateService.connectionState$.pipe( @@ -202,6 +205,7 @@ 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 03ab90afd..25ab12b62 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 dd7350954..2e5eb96a0 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -19,6 +19,7 @@ export class TransactionsListComponent implements OnInit, OnChanges { displayDetails = false; @Input() transactions: Transaction[]; + @Input() outputIndex: number; @Input() showConfirmations = false; @Input() transactionPage = false;