Enhance confirm transaction page with full verification details
All checks were successful
check / check (push) Successful in 17s

The confirmation page now shows:
- Transaction type (Native ETH transfer vs ERC-20 token transfer)
- Full ERC-20 token contract address with etherscan link
- Token symbol throughout (not raw contract address)
- Current balance of the token being sent, with USD value
- Estimated network fee in ETH and USD (fetched async)
- USD value for ERC-20 token amounts (not just ETH)
- Insufficient balance errors for ERC-20 tokens

Also implements actual ERC-20 token transfers via the token contract's
transfer() function, rather than only supporting native ETH sends.
This commit is contained in:
2026-02-27 11:42:42 +07:00
parent 01201d54b2
commit b85eac1e75
3 changed files with 212 additions and 25 deletions

View File

@@ -92,6 +92,16 @@ function init(_ctx) {
const token = state.selectedToken || $("send-token").value;
const addr = currentAddress();
let tokenSymbol = null;
let tokenBalance = null;
if (token !== "ETH") {
const tb = (addr.tokenBalances || []).find(
(t) => t.address.toLowerCase() === token.toLowerCase(),
);
tokenSymbol = tb ? tb.symbol : "?";
tokenBalance = tb ? tb.balance || "0" : "0";
}
ctx.showConfirmTx({
from: addr.address,
to: resolvedTo,
@@ -99,6 +109,8 @@ function init(_ctx) {
amount: amount,
token: token,
balance: addr.balance,
tokenSymbol: tokenSymbol,
tokenBalance: tokenBalance,
});
});