Show contract calls as "Approve USDT" instead of "0.0000 ETH"
All checks were successful
check / check (push) Successful in 17s
All checks were successful
check / check (push) Successful in 17s
Contract interactions (approve, swap, etc.) now display the method name and token symbol instead of the meaningless 0 ETH value. Blockscout provides the method name and whether the target is a contract — parseTx uses these plus TOKEN_BY_ADDRESS to produce labels like "Approve USDT" or "Swap LINK". Added directionLabel field to parsed transactions so renderers don't need to know about the sent/received/contract distinction. Also: clicking a transaction on the home screen now opens the transaction detail view instead of navigating to the address detail view.
This commit is contained in:
@@ -134,8 +134,10 @@ function renderHomeTxList(ctx) {
|
||||
let i = 0;
|
||||
for (const tx of homeTxs) {
|
||||
const counterparty = tx.direction === "sent" ? tx.to : tx.from;
|
||||
const dirLabel = tx.direction === "sent" ? "Sent" : "Received";
|
||||
const amountStr = escapeHtml(tx.value + " " + tx.symbol);
|
||||
const dirLabel = tx.directionLabel;
|
||||
const amountStr = tx.value
|
||||
? escapeHtml(tx.value + " " + tx.symbol)
|
||||
: escapeHtml(tx.symbol);
|
||||
const maxAddr = Math.max(10, 36 - Math.max(0, amountStr.length - 10));
|
||||
const displayAddr = truncateMiddle(counterparty, maxAddr);
|
||||
const addrStr = escapeHtml(displayAddr);
|
||||
@@ -155,7 +157,7 @@ function renderHomeTxList(ctx) {
|
||||
row.addEventListener("click", () => {
|
||||
const idx = parseInt(row.dataset.tx, 10);
|
||||
const tx = homeTxs[idx];
|
||||
// Find which wallet/address this tx belongs to and navigate
|
||||
// Set selectedWallet/selectedAddress so back navigation works
|
||||
for (let wi = 0; wi < state.wallets.length; wi++) {
|
||||
for (
|
||||
let ai = 0;
|
||||
@@ -169,7 +171,8 @@ function renderHomeTxList(ctx) {
|
||||
) {
|
||||
state.selectedWallet = wi;
|
||||
state.selectedAddress = ai;
|
||||
ctx.showAddressDetail();
|
||||
state.selectedToken = null;
|
||||
ctx.showTransactionDetail(tx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user