Skip to content

Commit

Permalink
tidy: use transducers
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed Jun 26, 2024
1 parent d34715c commit c18c731
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/status_im/contexts/wallet/data_store.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,18 @@
:or {updated-keypairs []
removed-keypairs []}} (group-by (comp keypair-label :removed) received-keypairs)
updated-keypairs-by-id (utils.collection/index-by :key-uid updated-keypairs)
updated-accounts-by-address (->> updated-keypairs
(mapcat :accounts)
(filter (comp not :chat))
(utils.collection/index-by :address))
updated-accounts-by-address (transduce (comp (mapcat :accounts)
(filter (comp not :chat))
(map #(vector (:address %) %)))
conj
{}
updated-keypairs)
removed-keypairs-ids (set (map :key-uid removed-keypairs))
removed-account-addresses (->> removed-keypairs
(mapcat :accounts)
(map :address)
(set))]
removed-account-addresses (transduce (comp (mapcat :accounts)
(map :address))
conj
#{}
removed-keypairs)]
{:removed-keypair-ids removed-keypairs-ids
:removed-account-addresses removed-account-addresses
:updated-keypairs-by-id updated-keypairs-by-id
Expand Down

0 comments on commit c18c731

Please sign in to comment.