Skip to content

Commit

Permalink
tidy: use subscription to build the entire keypair-account
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom authored and mohsen-ghafouri committed May 10, 2024
1 parent e419978 commit d68d048
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/status_im/subs/wallet/wallet.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,29 @@
:accounts (format-settings-keypair-accounts accounts format-options)})))))

(rf/reg-sub
:wallet/quo-keypairs-accounts
:wallet/settings-keypairs-accounts
:<- [:wallet/keypairs]
(fn [keypairs]
(fn [keypairs
[_
{:keys [networks size]
:or {networks []
size 32}}]]
(->> keypairs
(map (fn [{:keys [accounts name]
:as keypair}]
{:name name
(map (fn [{:keys [accounts name type]}]
{:type (keyword type)
:name name
:accounts (->> accounts
(keep (fn [{:keys [path customization-color emoji name address]}]
(when (not (string/starts-with? path constants/path-eip1581))
{:customization-color customization-color
:size 32
:emoji emoji
:type :default
:name name
:address address}))))})))))
{:account-props {:customization-color customization-color
:size size
:emoji emoji
:type :default
:name name
:address address}
:networks networks
:state :default
:action :none}))))})))))

(rf/reg-sub
:wallet/derivation-path-state
Expand Down

0 comments on commit d68d048

Please sign in to comment.