persist confirm-tx view across popup close/reopen (closes #77) #79

Merged
sneak merged 1 commits from fix/issue-77-confirm-tx-persist into main 2026-02-28 22:26:39 +01:00
2 changed files with 17 additions and 1 deletions

View File

@@ -74,6 +74,7 @@ const RESTORABLE_VIEWS = new Set([
"receive",
"settings",
"settings-addtoken",
"confirm-tx",
"transaction",
"success-tx",
"error-tx",
@@ -127,6 +128,13 @@ function restoreView() {
case "settings-addtoken":
settingsAddToken.show();
break;
case "confirm-tx":
if (state.viewData && state.viewData.pendingTx) {
confirmTx.restore();
} else {
fallbackView();
}
break;
case "transaction":
if (state.viewData && state.viewData.tx) {
transactionDetail.render();

View File

@@ -39,6 +39,13 @@ const EXT_ICON =
let pendingTx = null;
function restore() {
const d = state.viewData;
if (d && d.pendingTx) {
show(d.pendingTx);
}
}
function etherscanTokenLink(address) {
return `https://etherscan.io/token/${address}`;
}
@@ -229,6 +236,7 @@ function show(txInfo) {
// Gas estimate — show placeholder then fetch async
$("confirm-fee").classList.remove("hidden");
$("confirm-fee-amount").textContent = "Estimating...";
state.viewData = { pendingTx: txInfo };
showView("confirm-tx");
estimateGas(txInfo);
@@ -359,4 +367,4 @@ function init(ctx) {
});
}
module.exports = { init, show };
module.exports = { init, show, restore };