From 2f3ec951e0265930f05b9124f2b5c8767c894042 Mon Sep 17 00:00:00 2001 From: David Adegoke <64401859+Blazebrain@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:16:57 +0100 Subject: [PATCH] Filter out spam transactions for Polygon (#2543) * fix: Polygon transactions not coming up in transactions history page * fix: Filter out polygon spam transactions --- cw_polygon/lib/polygon_client.dart | 8 +++- .../dashboard/pages/transactions_page.dart | 45 ++++++++++--------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/cw_polygon/lib/polygon_client.dart b/cw_polygon/lib/polygon_client.dart index 62dcec50e..1e3d547a7 100644 --- a/cw_polygon/lib/polygon_client.dart +++ b/cw_polygon/lib/polygon_client.dart @@ -24,7 +24,7 @@ class PolygonClient extends EVMChainClient { // If we have EIP-1559 parameters but no legacy gasPrice, then use maxFeePerGas as gasPrice finalGasPrice = maxFeePerGas; } - + return Transaction( from: from, to: to, @@ -59,7 +59,11 @@ class PolygonClient extends EVMChainClient { final jsonResponse = json.decode(response.body) as Map; if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) { - return (jsonResponse['result'] as List) + final res = (jsonResponse['result'] as List); + + res.removeWhere((e) => e['value'] == '0'); + + return res .map( (e) => EVMChainTransactionModel.fromJson(e as Map, 'MATIC'), ) diff --git a/lib/src/screens/dashboard/pages/transactions_page.dart b/lib/src/screens/dashboard/pages/transactions_page.dart index 98edb4d16..46bd00a38 100644 --- a/lib/src/screens/dashboard/pages/transactions_page.dart +++ b/lib/src/screens/dashboard/pages/transactions_page.dart @@ -90,6 +90,8 @@ class TransactionsPage extends StatelessWidget { return Container(); } + if (item.transaction.amount == 0.0) return Container(); + final transaction = item.transaction; final transactionType = dashboardViewModel.getTransactionType(transaction); @@ -193,30 +195,31 @@ class TransactionsPage extends StatelessWidget { final order = item.order; return Observer( builder: (_) { - // TODO: Refactor Amount Hiding Logic it is not working properly for Orders and Trades - final hide = dashboardViewModel.balanceViewModel.displayMode == - BalanceDisplayMode.hiddenBalance; + final hide = dashboardViewModel.balanceViewModel.displayMode == + BalanceDisplayMode.hiddenBalance; - final formattedAmount = hide ? '---' : order.amountFormatted(); - final formattedReceiveAmount = hide ? '---' : order.receiveAmount; + final formattedAmount = hide ? '---' : order.amountFormatted(); + final formattedReceiveAmount = hide ? '---' : order.receiveAmount; - return OrderRow( - key: item.key, - onTap: () => Navigator.of(context) - .pushNamed(Routes.orderDetails, arguments: order), - providerTitle: order.providerTitle, - providerIconPath: order.providerIcon, - from: order.from ?? '', - to: order.to ?? '', - createdAtFormattedDate: DateFormat('HH:mm').format(order.createdAt), - formattedAmount: formattedAmount, - formattedReceiveAmount: dashboardViewModel.balanceViewModel.isFiatDisabled && - order.source == OrderSourceDescription.order - ? '' - : formattedReceiveAmount, - ); - } + return OrderRow( + key: item.key, + onTap: () => Navigator.of(context) + .pushNamed(Routes.orderDetails, arguments: order), + providerTitle: order.providerTitle, + providerIconPath: order.providerIcon, + from: order.from ?? '', + to: order.to ?? '', + createdAtFormattedDate: + DateFormat('HH:mm').format(order.createdAt), + formattedAmount: formattedAmount, + formattedReceiveAmount: + dashboardViewModel.balanceViewModel.isFiatDisabled && + order.source == OrderSourceDescription.order + ? '' + : formattedReceiveAmount, + ); + }, ); } return Container(color: Colors.transparent, height: 1);