[#6802] Expose a query allowing to access supported ERC20 tokens
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
3c04982616
commit
ac7c20ac45
|
@ -16,7 +16,9 @@
|
||||||
[status-im.ui.screens.navigation :as navigation]
|
[status-im.ui.screens.navigation :as navigation]
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
status-im.extensions.ethereum))
|
status-im.extensions.ethereum
|
||||||
|
[status-im.utils.ethereum.tokens :as tokens]
|
||||||
|
[status-im.utils.ethereum.core :as ethereum]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::alert
|
::alert
|
||||||
|
@ -41,6 +43,16 @@
|
||||||
(fn [_ [_ _ {:keys [value]}]]
|
(fn [_ [_ _ {:keys [value]}]]
|
||||||
value))
|
value))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:extensions.wallet/tokens
|
||||||
|
:<- [:wallet/all-tokens]
|
||||||
|
:<- [:network]
|
||||||
|
(fn [[all-tokens network] [_ _ {filter-vector :filter}]]
|
||||||
|
(let [tokens (tokens/sorted-tokens-for all-tokens (ethereum/network->chain-keyword network))]
|
||||||
|
(if (= :all (first filter-vector))
|
||||||
|
tokens
|
||||||
|
(filter #((set filter-vector) (:symbol %)) tokens)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:store/get
|
:store/get
|
||||||
(fn [db [_ {id :id} {:keys [key]}]]
|
(fn [db [_ {id :id} {:keys [key]}]]
|
||||||
|
@ -225,7 +237,8 @@
|
||||||
'transaction-status {:value transactions/transaction-status :properties {:outgoing :string :tx-hash :string}}}
|
'transaction-status {:value transactions/transaction-status :properties {:outgoing :string :tx-hash :string}}}
|
||||||
:queries {'identity {:value :extensions/identity :arguments {:value :map}}
|
:queries {'identity {:value :extensions/identity :arguments {:value :map}}
|
||||||
'store/get {:value :store/get :arguments {:key :string}}
|
'store/get {:value :store/get :arguments {:key :string}}
|
||||||
'wallet/collectibles {:value :get-collectible-token :arguments {:token :string :symbol :string}}}
|
'wallet/collectibles {:value :get-collectible-token :arguments {:token :string :symbol :string}}
|
||||||
|
'wallet/tokens {:value :extensions.wallet/tokens :arguments {:filter :vector}}}
|
||||||
:events {'alert
|
:events {'alert
|
||||||
{:permissions [:read]
|
{:permissions [:read]
|
||||||
:value :alert
|
:value :alert
|
||||||
|
|
Loading…
Reference in New Issue