fix unsigned transaction expiring while user checks details

previously one would get a red screen in develop and probably a white screen
in the app
now it shows a label indicating that the transaction has expired
This commit is contained in:
Eric Dvorsak 2017-10-10 19:38:38 +02:00 committed by Roman Volosovskyi
parent 0e63b09dcd
commit 748f1c6772
3 changed files with 25 additions and 21 deletions

View File

@ -325,6 +325,7 @@
:transaction "Transaction" :transaction "Transaction"
:unsigned-transactions "Unsigned transactions" :unsigned-transactions "Unsigned transactions"
:no-unsigned-transactions "No unsigned transactions" :no-unsigned-transactions "No unsigned transactions"
:unsigned-transaction-expired "Unsigned transaction expired"
:enter-password-transactions {:one "Confirm transaction by entering your password" :enter-password-transactions {:one "Confirm transaction by entering your password"
:other "Confirm transactions by entering your password"} :other "Confirm transactions by entering your password"}
:status "Status" :status "Status"
@ -420,7 +421,7 @@
;network settings ;; network settings
:new-network "New network" :new-network "New network"
:add-network "Add network" :add-network "Add network"
:add-new-network "Add new network" :add-new-network "Add new network"

View File

@ -132,6 +132,7 @@
(fn [[unsigned-transactions transactions current-transaction network]] (fn [[unsigned-transactions transactions current-transaction network]]
(let [transactions (merge transactions unsigned-transactions) (let [transactions (merge transactions unsigned-transactions)
{:keys [gas-used gas-price hash timestamp type] :as transaction} (get transactions current-transaction)] {:keys [gas-used gas-price hash timestamp type] :as transaction} (get transactions current-transaction)]
(when transaction
(merge transaction (merge transaction
{:gas-price-eth (money/wei->str :eth gas-price) {:gas-price-eth (money/wei->str :eth gas-price)
:gas-price-gwei (money/wei->str :gwei gas-price) :gas-price-gwei (money/wei->str :gwei gas-price)
@ -144,7 +145,7 @@
:nonce (i18n/label :not-applicable) :nonce (i18n/label :not-applicable)
:hash (i18n/label :not-applicable)} :hash (i18n/label :not-applicable)}
{:cost (money/wei->str :eth (money/fee-value gas-used gas-price)) {:cost (money/wei->str :eth (money/fee-value gas-used gas-price))
:url (transactions/get-transaction-details-url network hash)}))))) :url (transactions/get-transaction-details-url network hash)}))))))
(reg-sub :wallet.transactions.details/confirmations (reg-sub :wallet.transactions.details/confirmations
:<- [:wallet.transactions/transaction-details] :<- [:wallet.transactions/transaction-details]

View File

@ -250,7 +250,7 @@
{:text (i18n/label :t/open-on-etherscan) :value #(.openURL react/linking url)}])]) {:text (i18n/label :t/open-on-etherscan) :value #(.openURL react/linking url)}])])
(defview transaction-details [] (defview transaction-details []
(letsubs [{:keys [hash url type] :as transactions} [:wallet.transactions/transaction-details] (letsubs [{:keys [hash url type] :as transaction} [:wallet.transactions/transaction-details]
confirmations [:wallet.transactions.details/confirmations] confirmations [:wallet.transactions.details/confirmations]
confirmations-progress [:wallet.transactions.details/confirmations-progress]] confirmations-progress [:wallet.transactions.details/confirmations-progress]]
[react/view {:style styles/flex} [react/view {:style styles/flex}
@ -258,9 +258,11 @@
[toolbar/toolbar2 {} [toolbar/toolbar2 {}
toolbar/default-nav-back toolbar/default-nav-back
[toolbar/content-title (i18n/label :t/transaction-details)] [toolbar/content-title (i18n/label :t/transaction-details)]
[toolbar/actions (details-action hash url)]] (when transaction [toolbar/actions (details-action hash url)])]
(if transaction
[react/scroll-view {:style styles/main-container} [react/scroll-view {:style styles/main-container}
[details-header transactions] [details-header transaction]
[details-confirmations confirmations confirmations-progress] [details-confirmations confirmations confirmations-progress]
[react/view {:style transactions.styles/details-separator}] [react/view {:style transactions.styles/details-separator}]
[details-list transactions]]])) [details-list transaction]]
[empty-text (i18n/label :t/unsigned-transaction-expired)])]))