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.contexts.wallet.sheets.buy-token.view :as buy-token]
|
||||||
[status-im.feature-flags :as ff]
|
[status-im.feature-flags :as ff]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
|
[utils.money :as money]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- action-buy
|
(defn- action-buy
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
{:icon :i/send
|
{:icon :i/send
|
||||||
:accessibility-label :send
|
:accessibility-label :send
|
||||||
:label (i18n/label :t/send)
|
:label (i18n/label :t/send)
|
||||||
|
:disabled? (:disabled? send-params)
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:hide-bottom-sheet])
|
(rf/dispatch [:hide-bottom-sheet])
|
||||||
(rf/dispatch [:wallet/clean-send-data])
|
(rf/dispatch [:wallet/clean-send-data])
|
||||||
|
@ -69,31 +71,35 @@
|
||||||
|
|
||||||
(defn token-value-drawer
|
(defn token-value-drawer
|
||||||
[token watch-only? entry-point]
|
[token watch-only? entry-point]
|
||||||
(let [token-symbol (:token token)
|
(let [token-symbol (:token token)
|
||||||
token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered
|
token-data (first (rf/sub [:wallet/current-viewing-account-tokens-filtered
|
||||||
token-symbol]))
|
token-symbol]))
|
||||||
selected-account? (rf/sub [:wallet/current-viewing-account-address])
|
fiat-unformatted-value (get-in token [:values :fiat-unformatted-value])
|
||||||
token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol])
|
has-balance? (money/greater-than fiat-unformatted-value (money/bignumber "0"))
|
||||||
send-params (if selected-account?
|
selected-account? (rf/sub [:wallet/current-viewing-account-address])
|
||||||
{:token token-data
|
token-owners (rf/sub [:wallet/operable-addresses-with-token-symbol token-symbol])
|
||||||
:stack-id :screen/wallet.accounts
|
send-params (if selected-account?
|
||||||
:start-flow? true
|
{:token token-data
|
||||||
:owners token-owners}
|
:stack-id :screen/wallet.accounts
|
||||||
{:token-symbol token-symbol
|
:disabled? (not has-balance?)
|
||||||
:stack-id :wallet-stack
|
:start-flow? true
|
||||||
:start-flow? true
|
:owners token-owners}
|
||||||
:owners token-owners})
|
{:token-symbol token-symbol
|
||||||
bridge-params (if selected-account?
|
:stack-id :wallet-stack
|
||||||
{:token token-data
|
:start-flow? true
|
||||||
:bridge-disabled? (send-utils/bridge-disabled? token-symbol)
|
:owners token-owners})
|
||||||
:stack-id :screen/wallet.accounts
|
bridge-params (if selected-account?
|
||||||
:start-flow? true
|
{:token token-data
|
||||||
:owners token-owners}
|
:bridge-disabled? (or (not has-balance?)
|
||||||
{:token-symbol token-symbol
|
(send-utils/bridge-disabled? token-symbol))
|
||||||
:bridge-disabled? (send-utils/bridge-disabled? token-symbol)
|
:stack-id :screen/wallet.accounts
|
||||||
:stack-id :wallet-stack
|
:start-flow? true
|
||||||
:start-flow? true
|
:owners token-owners}
|
||||||
:owners token-owners})]
|
{:token-symbol token-symbol
|
||||||
|
:bridge-disabled? (send-utils/bridge-disabled? token-symbol)
|
||||||
|
:stack-id :wallet-stack
|
||||||
|
:start-flow? true
|
||||||
|
:owners token-owners})]
|
||||||
[quo/action-drawer
|
[quo/action-drawer
|
||||||
[(cond->> [(when (ff/enabled? ::ff/wallet.assets-modal-manage-tokens)
|
[(cond->> [(when (ff/enabled? ::ff/wallet.assets-modal-manage-tokens)
|
||||||
(action-manage-tokens watch-only?))
|
(action-manage-tokens watch-only?))
|
||||||
|
|
Loading…
Reference in New Issue