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 f11cf68..c0f0df7 100644 --- a/src/popup/views/confirmTx.js +++ b/src/popup/views/confirmTx.js @@ -38,6 +38,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}`; } @@ -217,6 +224,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); @@ -347,4 +355,4 @@ function init(ctx) { }); } -module.exports = { init, show }; +module.exports = { init, show, restore };