From e298a0061f5b63cd6e1a15c95d7b5d6cab78df68 Mon Sep 17 00:00:00 2001 From: Nazar Usov Date: Fri, 10 May 2024 15:01:42 +0300 Subject: [PATCH 1/2] Update history --- .../wallet/tabs/history/history.component.ts | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/html_source/src/app/pages/wallet/tabs/history/history.component.ts b/html_source/src/app/pages/wallet/tabs/history/history.component.ts index e30916c0..65abdab8 100644 --- a/html_source/src/app/pages/wallet/tabs/history/history.component.ts +++ b/html_source/src/app/pages/wallet/tabs/history/history.component.ts @@ -187,18 +187,20 @@ import { zanoAssetInfo } from '@parts/data/assets';
- - {{ subtransfer.amount.minus(transaction.fee ?? 0).negated() | intToMoney }} - {{ subtransfer.amount.negated() | intToMoney }} - + + {{ subtransfer.amount.minus(transaction.fee ?? 0).negated() | intToMoney }} + {{ subtransfer.amount.negated() | intToMoney }} + - {{ subtransfer.amount | intToMoney }} - + {{ subtransfer.amount | intToMoney }} + {{ (subtransfer.asset_id | getAssetInfo)?.ticker || '???' }}
@@ -483,6 +485,16 @@ export class HistoryComponent implements OnInit, OnDestroy { return !this.isInitiator(transaction); } + isSelfTransaction(transaction: Transaction): boolean { + const { remote_addresses, employed_entries: { receive, spent }, subtransfers, fee } = transaction; + + const condition1 = remote_addresses?.includes(this.variablesService.currentWallet?.address); + const condition2 = [...receive, ...spent].map(({ asset_id }) => asset_id === zanoAssetInfo.asset_id).every(Boolean); + const condition3 = subtransfers.length === 1 && subtransfers[0].asset_id === zanoAssetInfo.asset_id && subtransfers[0].amount.eq(fee); + + return condition1 && condition2 && condition3; + } + init(): void { let restore = false; if (hasOwnProperty(this.variablesService.after_sync_request, String(this.variablesService.currentWallet.wallet_id))) { From 9695b51d94690caf65c42a7def82eee583eda683 Mon Sep 17 00:00:00 2001 From: Nazar Usov Date: Fri, 10 May 2024 17:15:46 +0300 Subject: [PATCH 2/2] Update history --- .../wallet/tabs/history/history.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/html_source/src/app/pages/wallet/tabs/history/history.component.ts b/html_source/src/app/pages/wallet/tabs/history/history.component.ts index 65abdab8..88d7e1eb 100644 --- a/html_source/src/app/pages/wallet/tabs/history/history.component.ts +++ b/html_source/src/app/pages/wallet/tabs/history/history.component.ts @@ -40,11 +40,12 @@ import { zanoAssetInfo } from '@parts/data/assets';
- + + @@ -187,7 +188,7 @@ import { zanoAssetInfo } from '@parts/data/assets'; @@ -470,6 +471,10 @@ export class HistoryComponent implements OnInit, OnDestroy { return true; } + if (asset_id === zanoAssetInfo.asset_id && this.isSwapTransaction(transaction) && this.isFinalizator(transaction)) { + return true; + } + return !(asset_id === zanoAssetInfo.asset_id && is_income === false && amount.eq(fee)); } @@ -481,6 +486,14 @@ export class HistoryComponent implements OnInit, OnDestroy { })); } + isSwapTransaction(transaction: Transaction): boolean { + const { subtransfers } = transaction; + const arr = subtransfers.map(({ is_income }) => is_income); + const condition1 = arr.some((value) => value); + const condition2 = arr.some((value) => !value); + return condition1 && condition2; + } + isFinalizator(transaction: Transaction): boolean { return !this.isInitiator(transaction); }