From 71834deadc05dbc21961011418af2a8a4d94342b Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Fri, 19 Mar 2021 17:40:45 +0300 Subject: [PATCH] Add transfer request to transaction reversal. - Inverts sender and recipient addresses creating a request for transfer from recipient to sender. --- .../transaction-details.component.html | 2 +- .../transaction-details.component.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/pages/transactions/transaction-details/transaction-details.component.html b/src/app/pages/transactions/transaction-details/transaction-details.component.html index 8a63cd3..038b837 100644 --- a/src/app/pages/transactions/transaction-details/transaction-details.component.html +++ b/src/app/pages/transactions/transaction-details/transaction-details.component.html @@ -117,7 +117,7 @@
- +
diff --git a/src/app/pages/transactions/transaction-details/transaction-details.component.ts b/src/app/pages/transactions/transaction-details/transaction-details.component.ts index 36f647a..40389d3 100644 --- a/src/app/pages/transactions/transaction-details/transaction-details.component.ts +++ b/src/app/pages/transactions/transaction-details/transaction-details.component.ts @@ -1,5 +1,6 @@ import {ChangeDetectionStrategy, Component, Input, OnInit} from '@angular/core'; import {Router} from '@angular/router'; +import {TransactionService} from '@app/_services'; @Component({ selector: 'app-transaction-details', @@ -12,7 +13,10 @@ export class TransactionDetailsComponent implements OnInit { senderBloxbergLink: string; recipientBloxbergLink: string; - constructor(private router: Router) { } + constructor( + private router: Router, + private transactionService: TransactionService + ) { } ngOnInit(): void { this.senderBloxbergLink = 'https://blockexplorer.bloxberg.org/address/' + this.transaction?.from + '/transactions'; @@ -26,4 +30,13 @@ export class TransactionDetailsComponent implements OnInit { 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 + ); + } }