Exclude contract calls from dust transaction filter
All checks were successful
check / check (push) Successful in 18s
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:
@@ -21,6 +21,7 @@ function parseTx(tx, addrLower) {
|
||||
const from = tx.from?.hash || "";
|
||||
const to = tx.to?.hash || "";
|
||||
const rawWei = tx.value || "0";
|
||||
const toIsContract = tx.to?.is_contract || false;
|
||||
return {
|
||||
hash: tx.hash,
|
||||
blockNumber: tx.block_number,
|
||||
@@ -34,6 +35,8 @@ function parseTx(tx, addrLower) {
|
||||
isError: tx.status !== "ok",
|
||||
contractAddress: null,
|
||||
holders: null,
|
||||
isContractCall: toIsContract,
|
||||
method: tx.method || null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -166,9 +169,12 @@ function filterTransactions(txs, filters = {}) {
|
||||
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 (
|
||||
filters.hideDustTransactions &&
|
||||
!tx.isContractCall &&
|
||||
tx.valueGwei !== null &&
|
||||
tx.valueGwei < (filters.dustThresholdGwei || 100000)
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user