fix: label swap methods as "Swap" in tx lists, remove unused variable
Some checks failed
check / check (push) Failing after 13s
Some checks failed
check / check (push) Failing after 13s
- Map known DEX methods (execute, swap, multicall, etc.) to "Swap" label instead of raw method name like "Execute" - Remove unused displayData variable in transactionDetail.js Addresses review feedback on PR #10.
This commit is contained in:
@@ -188,10 +188,6 @@ async function loadCalldata(txHash, toAddress) {
|
|||||||
const method = txData.method || "Unknown method";
|
const method = txData.method || "Unknown method";
|
||||||
let html = `<div class="font-bold mb-1">Unknown contract call</div>`;
|
let html = `<div class="font-bold mb-1">Unknown contract call</div>`;
|
||||||
html += `<div class="text-muted mb-1">${escapeHtml(method)}</div>`;
|
html += `<div class="text-muted mb-1">${escapeHtml(method)}</div>`;
|
||||||
const displayData =
|
|
||||||
inputData.length > 202
|
|
||||||
? inputData.slice(0, 202) + "…"
|
|
||||||
: inputData;
|
|
||||||
html += `<div class="break-all font-mono text-xs">${copyableHtml(inputData, "break-all")}</div>`;
|
html += `<div class="break-all font-mono text-xs">${copyableHtml(inputData, "break-all")}</div>`;
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,16 @@ function parseTx(tx, addrLower) {
|
|||||||
if (token) {
|
if (token) {
|
||||||
symbol = token.symbol;
|
symbol = token.symbol;
|
||||||
}
|
}
|
||||||
const label = method.charAt(0).toUpperCase() + method.slice(1);
|
// Map known DEX methods to "Swap" for cleaner display
|
||||||
|
const SWAP_METHODS = new Set([
|
||||||
|
"execute", "swap", "swapExactTokensForTokens",
|
||||||
|
"swapTokensForExactTokens", "swapExactETHForTokens",
|
||||||
|
"swapTokensForExactETH", "swapExactTokensForETH",
|
||||||
|
"swapETHForExactTokens", "multicall",
|
||||||
|
]);
|
||||||
|
const label = SWAP_METHODS.has(method)
|
||||||
|
? "Swap"
|
||||||
|
: method.charAt(0).toUpperCase() + method.slice(1);
|
||||||
direction = "contract";
|
direction = "contract";
|
||||||
directionLabel = label;
|
directionLabel = label;
|
||||||
value = "";
|
value = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user