mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Filter out spam transactions for Polygon (#2543)
* fix: Polygon transactions not coming up in transactions history page * fix: Filter out polygon spam transactions
This commit is contained in:
@@ -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<String, dynamic>;
|
||||
|
||||
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<String, dynamic>, 'MATIC'),
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user