wallet(account): disable send and bridge options for assets with a 0 balance (#21033)
This commit is contained in:
parent
d53bef385a
commit
9a52339ea7
|
@ -5,6 +5,7 @@
|
|||
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
|
||||
[status-im.feature-flags :as ff]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.money :as money]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- action-buy
|
||||
|
@ -21,6 +22,7 @@
|
|||
{:icon :i/send
|
||||
:accessibility-label :send
|
||||
:label (i18n/label :t/send)
|
||||
:disabled? (:disabled? send-params)
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(rf/dispatch [:wallet/clean-send-data])
|
||||
|
@ -72,11 +74,14 @@
|
|||
(let [token-symbol (:token token)
|
||||
token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered
|
||||
token-symbol]))
|
||||
fiat-unformatted-value (get-in token [:values :fiat-unformatted-value])
|
||||
has-balance? (money/greater-than fiat-unformatted-value (money/bignumber "0"))
|
||||
selected-account? (rf/sub [:wallet/current-viewing-account-address])
|
||||
token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol])
|
||||
send-params (if selected-account?
|
||||
{:token token-data
|
||||
:stack-id :screen/wallet.accounts
|
||||
:disabled? (not has-balance?)
|
||||
:start-flow? true
|
||||
:owners token-owners}
|
||||
{:token-symbol token-symbol
|
||||
|
@ -85,7 +90,8 @@
|
|||
:owners token-owners})
|
||||
bridge-params (if selected-account?
|
||||
{:token token-data
|
||||
:bridge-disabled? (send-utils/bridge-disabled? token-symbol)
|
||||
:bridge-disabled? (or (not has-balance?)
|
||||
(send-utils/bridge-disabled? token-symbol))
|
||||
:stack-id :screen/wallet.accounts
|
||||
:start-flow? true
|
||||
:owners token-owners}
|
||||
|
|
Loading…
Reference in New Issue