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"
:unsigned-transactions "Unsigned transactions"
:no-unsigned-transactions "No unsigned transactions"
:unsigned-transaction-expired "Unsigned transaction expired"
:enter-password-transactions {:one "Confirm transaction by entering your password"
:other "Confirm transactions by entering your password"}
:status "Status"
@ -420,7 +421,7 @@
;network settings
;; network settings
:new-network "New network"
:add-network "Add network"
:add-new-network "Add new network"

View File

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

View File

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