Exclude contract calls from dust transaction filter
All checks were successful
check / check (push) Successful in 18s

The dust filter was hiding contract interactions (approve, transfer,
etc.) because they have 0 ETH value, which falls below the dust
threshold. Contract calls with 0 ETH are normal — only plain ETH
transfers should be checked against the dust threshold.

Also captures is_contract and method from Blockscout's transaction
response for future use in transaction display.
This commit is contained in:
2026-02-27 12:52:06 +07:00
parent 54e6f6c180
commit 55786d1350

View File

@@ -21,6 +21,7 @@ function parseTx(tx, addrLower) {
const from = tx.from?.hash || ""; const from = tx.from?.hash || "";
const to = tx.to?.hash || ""; const to = tx.to?.hash || "";
const rawWei = tx.value || "0"; const rawWei = tx.value || "0";
const toIsContract = tx.to?.is_contract || false;
return { return {
hash: tx.hash, hash: tx.hash,
blockNumber: tx.block_number, blockNumber: tx.block_number,
@@ -34,6 +35,8 @@ function parseTx(tx, addrLower) {
isError: tx.status !== "ok", isError: tx.status !== "ok",
contractAddress: null, contractAddress: null,
holders: null, holders: null,
isContractCall: toIsContract,
method: tx.method || null,
}; };
} }
@@ -166,9 +169,12 @@ function filterTransactions(txs, filters = {}) {
continue; continue;
} }
// Filter dust transactions (below gwei threshold) if setting is on // Filter dust transactions (below gwei threshold) if setting is on.
// Contract calls (approve, transfer, etc.) often have 0 ETH value
// and should never be filtered as dust.
if ( if (
filters.hideDustTransactions && filters.hideDustTransactions &&
!tx.isContractCall &&
tx.valueGwei !== null && tx.valueGwei !== null &&
tx.valueGwei < (filters.dustThresholdGwei || 100000) tx.valueGwei < (filters.dustThresholdGwei || 100000)
) { ) {