Amount
diff --git a/src/popup/views/approval.js b/src/popup/views/approval.js
index 8641960..1b05110 100644
--- a/src/popup/views/approval.js
+++ b/src/popup/views/approval.js
@@ -184,6 +184,15 @@ function showTxApproval(details) {
}
}
+ // Carry decoded calldata info through to success/error views
+ if (decoded) {
+ pendingTxDetails.decoded = {
+ name: decoded.name,
+ description: decoded.description,
+ details: decoded.details,
+ };
+ }
+
$("approve-tx-hostname").textContent = details.hostname;
$("approve-tx-from").innerHTML = approvalAddressHtml(state.activeAddress);
diff --git a/src/popup/views/txStatus.js b/src/popup/views/txStatus.js
index a755b84..b8e408a 100644
--- a/src/popup/views/txStatus.js
+++ b/src/popup/views/txStatus.js
@@ -8,6 +8,7 @@ const {
addressTitle,
escapeHtml,
} = require("./helpers");
+const { TOKEN_BY_ADDRESS } = require("../../shared/tokenList");
const { state, saveState } = require("../../shared/state");
const { getProvider } = require("../../shared/balances");
const { log } = require("../../shared/log");
@@ -121,11 +122,51 @@ function showSuccess(txInfo, txHash, blockNumber) {
to: txInfo.to,
hash: txHash,
blockNumber: blockNumber,
+ decoded: txInfo.decoded || null,
};
renderSuccess();
ctx.doRefreshAndRender();
}
+function tokenLabel(address) {
+ const t = TOKEN_BY_ADDRESS.get(address.toLowerCase());
+ return t ? t.symbol : null;
+}
+
+function etherscanTokenLink(address) {
+ return `https://etherscan.io/token/${address}`;
+}
+
+function decodedDetailsHtml(decoded) {
+ if (!decoded || !decoded.details) return "";
+ let html = "";
+ if (decoded.name) {
+ html += `
Action
`;
+ html += `
${escapeHtml(decoded.name)}
`;
+ }
+ if (decoded.description) {
+ html += `
Description
`;
+ html += `
${escapeHtml(decoded.description)}
`;
+ }
+ for (const d of decoded.details) {
+ html += `
`;
+ html += `
${escapeHtml(d.label)}
`;
+ if (d.address) {
+ if (d.isToken) {
+ const sym = tokenLabel(d.address) || "Unknown token";
+ html += `
${escapeHtml(sym)}
`;
+ html += toAddressHtml(d.address);
+ } else {
+ html += toAddressHtml(d.address);
+ }
+ } else {
+ html += `
${escapeHtml(d.value)}
`;
+ }
+ html += `
`;
+ }
+ return html;
+}
+
function renderSuccess() {
const d = state.viewData;
if (!d || !d.hash) return;
@@ -133,6 +174,16 @@ function renderSuccess() {
$("success-tx-to").innerHTML = toAddressHtml(d.to);
$("success-tx-block").textContent = String(d.blockNumber);
$("success-tx-hash").innerHTML = txHashHtml(d.hash);
+
+ // Show decoded calldata details if present
+ const decodedEl = $("success-tx-decoded");
+ if (decodedEl && d.decoded) {
+ decodedEl.innerHTML = decodedDetailsHtml(d.decoded);
+ decodedEl.classList.remove("hidden");
+ } else if (decodedEl) {
+ decodedEl.classList.add("hidden");
+ }
+
attachCopyHandlers("view-success-tx");
showView("success-tx");
}