diff --git a/src/popup/index.js b/src/popup/index.js index 5a12180..e0e42aa 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -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(); diff --git a/src/popup/views/confirmTx.js b/src/popup/views/confirmTx.js index 787de0b..0f42266 100644 --- a/src/popup/views/confirmTx.js +++ b/src/popup/views/confirmTx.js @@ -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 };