Skip to content

Commit

Permalink
tidy: extract function from subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed May 9, 2024
1 parent b31d6ff commit b77ea8a
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/status_im/subs/wallet/wallet.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -159,30 +159,33 @@
:goerli-enabled? goerli-enabled?})
selected-networks))))

(defn- format-settings-keypair-accounts
[accounts
{:keys [networks size]
:or {networks []
size 32}}]
(->> accounts
(keep (fn [{:keys [path customization-color emoji name address]}]
(when-not (string/starts-with? path constants/path-eip1581)
{: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/settings-keypairs-accounts
:<- [:wallet/keypairs]
(fn [keypairs
[_
{:keys [networks size]
:or {networks []
size 32}}]]
(fn [keypairs [_ format-options]]
(->> keypairs
(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))
{:account-props {:customization-color customization-color
:size size
:emoji emoji
:type :default
:name name
:address address}
:networks networks
:state :default
:action :none}))))})))))
:accounts (format-settings-keypair-accounts accounts format-options)})))))

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

0 comments on commit b77ea8a

Please sign in to comment.