Skip to content

Commit

Permalink
Update history
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazar Usov authored and Nazar Usov committed May 10, 2024
1 parent e298a00 commit 9695b51
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions html_source/src/app/pages/wallet/tabs/history/history.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ import { zanoAssetInfo } from '@parts/data/assets';
<div class="row-divider"></div>
</thead>
<tbody>
<ng-container *ngFor="let transaction of variablesService.currentWallet.history">
<ng-container *ngFor="let transaction of variablesService.currentWallet.history; let i = index">
<tr
(click)="openDetails(transaction.tx_hash)"
[class.locked-transaction]="!transaction.is_mining && transaction.unlock_time > 0"
>
<!--<td>{{ 21 - i }}</td>-->
<!-- Status -->
<td>
<ng-container *ngIf="transaction.subtransfers; else noSubtransfersStatusTemplate">
Expand Down Expand Up @@ -187,7 +188,7 @@ import { zanoAssetInfo } from '@parts/data/assets';
<ng-container
*ngIf="
!subtransfer.is_income
? !subtransfer.amount.eq(transaction.fee ?? 0) || isSelfTransaction(transaction)
? !subtransfer.amount.eq(transaction.fee ?? 0) || isSelfTransaction(transaction) || (isSwapTransaction(transaction) && isFinalizator(transaction))
: subtransfer.amount.toNumber() !== 0
"
>
Expand Down Expand Up @@ -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));

}
Expand All @@ -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);
}
Expand Down

0 comments on commit 9695b51

Please sign in to comment.