diff --git a/src/popup/index.js b/src/popup/index.js index 5a12180..76ad298 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -75,6 +75,7 @@ const RESTORABLE_VIEWS = new Set([ "settings", "settings-addtoken", "transaction", + "confirm-tx", "success-tx", "error-tx", ]); @@ -134,6 +135,13 @@ function restoreView() { fallbackView(); } break; + case "confirm-tx": + if (state.viewData && state.viewData.pendingTx) { + confirmTx.show(state.viewData.pendingTx); + } else { + fallbackView(); + } + break; case "success-tx": if (state.viewData && state.viewData.hash) { txStatus.renderSuccess(); diff --git a/src/popup/views/confirmTx.js b/src/popup/views/confirmTx.js index f11cf68..daf6bf1 100644 --- a/src/popup/views/confirmTx.js +++ b/src/popup/views/confirmTx.js @@ -18,7 +18,7 @@ const { addressDotHtml, escapeHtml, } = require("./helpers"); -const { state } = require("../../shared/state"); +const { state, saveState } = require("../../shared/state"); const { getSignerForAddress } = require("../../shared/wallet"); const { decryptWithPassword } = require("../../shared/vault"); const { formatUsd, getPrice } = require("../../shared/prices"); @@ -219,6 +219,10 @@ function show(txInfo) { $("confirm-fee-amount").textContent = "Estimating..."; showView("confirm-tx"); + // Persist txInfo so the view survives popup close/reopen + state.viewData = { pendingTx: txInfo }; + saveState(); + estimateGas(txInfo); }