import {ChangeDetectionStrategy, Component, Input, OnInit} from '@angular/core'; import {Router} from '@angular/router'; import {TransactionService} from '@app/_services'; @Component({ selector: 'app-transaction-details', templateUrl: './transaction-details.component.html', styleUrls: ['./transaction-details.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class TransactionDetailsComponent implements OnInit { @Input() transaction; senderBloxbergLink: string; recipientBloxbergLink: string; constructor( private router: Router, private transactionService: TransactionService ) { } ngOnInit(): void { this.senderBloxbergLink = 'https://blockexplorer.bloxberg.org/address/' + this.transaction?.from + '/transactions'; this.recipientBloxbergLink = 'https://blockexplorer.bloxberg.org/address/' + this.transaction?.to + '/transactions'; } async viewSender(): Promise { await this.router.navigateByUrl(`/accounts/${this.transaction.from}`); } async viewRecipient(): Promise { await this.router.navigateByUrl(`/accounts/${this.transaction.to}`); } async reverseTransaction(): Promise { await this.transactionService.transferRequest( this.transaction.token.address, this.transaction.to, this.transaction.from, this.transaction.value ); } }