-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure clean-up state after send transaction confirmation #21282
base: develop
Are you sure you want to change the base?
Changes from all commits
242e067
5fac457
6000edd
52ea505
27cbe39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,13 @@ | |
(:require | ||
[quo.theme] | ||
[status-im.contexts.wallet.send.input-amount.view :as input-amount] | ||
[status-im.setup.hot-reload :as hot-reload] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn view | ||
[] | ||
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/stop-get-suggested-routes])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we're configuring the wallet send screen to dispatch the |
||
[input-amount/view | ||
{:current-screen-id :screen/wallet.send-input-amount | ||
:button-one-label (i18n/label :t/review-send) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
[status-im.common.standard-authentication.core :as standard-auth] | ||
[status-im.contexts.wallet.common.utils :as utils] | ||
[status-im.contexts.wallet.send.transaction-confirmation.style :as style] | ||
[status-im.contexts.wallet.send.utils :as send-utils] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf] | ||
[utils.security.core :as security])) | ||
|
@@ -142,7 +143,7 @@ | |
[quo/summary-info | ||
{:type summary-info-type | ||
:networks? true | ||
:values network-values | ||
:values (send-utils/network-values-for-ui network-values) | ||
Comment on lines
-145
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's one place we were using the UI strings inside network-values, because summary-info will use the string "<0.01" to determine if some UI should be shown. Not sure what the original intent of that code would be, but perhaps that code could be changed too. |
||
:account-props (cond-> account-props | ||
(and account-to? (not bridge-tx?)) | ||
(assoc | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,25 +42,35 @@ | |
[x] | ||
(instance? BigNumber x)) | ||
|
||
(defn ->bignumber | ||
[n] | ||
(if (bignumber? n) n (bignumber n))) | ||
|
||
(defn ->bignumbers | ||
[& nums] | ||
(let [bignums (map ->bignumber nums)] | ||
(when (every? bignumber? bignums) | ||
bignums))) | ||
|
||
(defn greater-than-or-equals | ||
[^js bn1 ^js bn2] | ||
(when (bignumber? bn1) | ||
[^js n1 ^js n2] | ||
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)] | ||
(.greaterThanOrEqualTo bn1 bn2))) | ||
|
||
(defn greater-than | ||
[bn1 bn2] | ||
(when (bignumber? bn1) | ||
[n1 n2] | ||
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)] | ||
(.greaterThan ^js bn1 bn2))) | ||
|
||
(defn less-than | ||
[bn1 bn2] | ||
(when (bignumber? bn1) | ||
[n1 n2] | ||
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)] | ||
(.lessThan ^js bn1 bn2))) | ||
|
||
(defn equal-to | ||
[n1 n2] | ||
(when-let [^js bn1 (bignumber n1)] | ||
(.eq ^js bn1 n2))) | ||
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)] | ||
(.eq ^js bn1 bn2))) | ||
Comment on lines
+45
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we're adding some additional checks for big number instances when using our big number utility functions. Let me what you think 🙏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I love this approach! |
||
|
||
(extend-type BigNumber | ||
IEquiv | ||
|
@@ -79,8 +89,9 @@ | |
:else 0))) | ||
|
||
(defn sub | ||
[bn1 bn2] | ||
(.sub ^js bn1 bn2)) | ||
[n1 n2] | ||
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)] | ||
(.sub ^js bn1 bn2))) | ||
|
||
(defn valid? | ||
[^js bn] | ||
|
@@ -125,7 +136,7 @@ | |
|
||
(defn to-number | ||
[^js bn] | ||
(when bn | ||
(when (bignumber? bn) | ||
(.toNumber bn))) | ||
|
||
(defn to-string | ||
|
@@ -158,7 +169,7 @@ | |
|
||
(defn ether->wei | ||
[^js bn] | ||
(when bn | ||
(when (bignumber? bn) | ||
(.times bn ^js (bignumber 1e18)))) | ||
|
||
(defn token->unit | ||
|
@@ -228,7 +239,7 @@ | |
(defn sufficient-funds? | ||
[^js amount ^js balance] | ||
(when (and amount balance) | ||
(.greaterThanOrEqualTo balance amount))) | ||
(greater-than-or-equals balance amount))) | ||
|
||
(defn fiat-amount-value | ||
[amount-str from to prices] | ||
|
@@ -275,7 +286,7 @@ | |
|
||
(defn absolute-value | ||
[bn] | ||
(when bn | ||
(when (bignumber? bn) | ||
(.absoluteValue ^js bn))) | ||
|
||
(defn format-amount | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's where we were storing the UI strings inside the re-frame state. Now we'll store the original data and do the conversions inside the UI components.