Skip to content

Commit

Permalink
fix: 🐛 Swap list - display swap tx address instead of fee tx address
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Jan 12, 2025
1 parent 116ff6c commit 5601715
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
13 changes: 9 additions & 4 deletions lib/application/pool/dex_pool_tx_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Future<List<DexPoolTx>> _getPoolTxList(
DexToken? token1;
DexToken? token2;
DexActionType? typeTx;
String? addressAccount;
switch (transactionAction.data!.actionRecipients[0].action) {
case 'swap':
for (final transactionMovement in transactionAction
Expand Down Expand Up @@ -113,6 +114,7 @@ Future<List<DexPoolTx>> _getPoolTxList(
transactionMovement.amount,
).toDouble();
token2 = pool.pair.token1;
addressAccount = transactionMovement.to;
}

if ((transactionMovement.tokenAddress != null &&
Expand All @@ -124,6 +126,7 @@ Future<List<DexPoolTx>> _getPoolTxList(
transactionMovement.amount,
).toDouble();
token2 = pool.pair.token2;
addressAccount = transactionMovement.to;
}
}
}
Expand Down Expand Up @@ -157,7 +160,8 @@ Future<List<DexPoolTx>> _getPoolTxList(
token2 = pool.pair.token2;
}
}

addressAccount = transaction
.validationStamp!.ledgerOperations!.transactionMovements[0].to;
typeTx = DexActionType.removeLiquidity;
break;
case 'add_liquidity':
Expand Down Expand Up @@ -188,7 +192,8 @@ Future<List<DexPoolTx>> _getPoolTxList(
token2 = pool.pair.token2;
}
}

addressAccount = transaction
.validationStamp!.ledgerOperations!.transactionMovements[0].to;
typeTx = DexActionType.addLiquidity;
break;
default:
Expand All @@ -198,15 +203,15 @@ Future<List<DexPoolTx>> _getPoolTxList(
if (totalValueToken1 != null) {
swapValue = totalValueToken1;
}

dexPoolTxList.add(
DexPoolTx(
addressTx: transaction.address!.address,
typeTx: typeTx,
time: DateTime.fromMillisecondsSinceEpoch(
transaction.validationStamp!.timestamp! * 1000,
),
addressAccount: transaction.validationStamp!.ledgerOperations!
.transactionMovements[0].to,
addressAccount: addressAccount,
token1Amount: token1Amount,
token2Amount: token2Amount,
token1: token1,
Expand Down
14 changes: 11 additions & 3 deletions lib/ui/views/pool_tx_list/layouts/components/pool_tx_single.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;

class PoolListSingle extends ConsumerWidget {
Expand Down Expand Up @@ -75,9 +76,16 @@ class PoolListSingle extends ConsumerWidget {
: '${dexPoolTx.typeTx!.getLabel(context)} ',
style: style,
),
SelectableText(
timeago.format(dexPoolTx.time!),
style: style,
Tooltip(
message: DateFormat(
'yyyy-MM-dd HH:mm:ss',
).format(
dexPoolTx.time!,
),
child: SelectableText(
timeago.format(dexPoolTx.time!),
style: style,
),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: aedex
description: Enable direct peer-to-peer trading of digital assets on the Archethic blockchain, eliminating the need for centralized intermediaries.
publish_to: "none"

version: 2.3.2+94
version: 2.3.3+95

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit 5601715

Please sign in to comment.