chore(wallet): refactor keypairs data in app-db (#20469)

This commit refactors the keypairs data in app-db to save them by indexed by key-uid which will help to fetch, update, and delete easily instead of using filter and some methods every time we need to perform those operations.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-06-21 20:47:26 +05:30 committed by GitHub
parent f509d132f3
commit fb84f105db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 207 additions and 204 deletions

View File

@ -1,24 +1,5 @@
(ns status-im.contexts.settings.wallet.data-store)
(defn extract-keypair-name
[db key-uids-set]
(when (= (count key-uids-set) 1)
(let [key-uid (first key-uids-set)
keypairs (get-in db [:wallet :keypairs])]
(->> (filter #(= (:key-uid %) key-uid) keypairs)
first
:name))))
(defn update-keypair
[keypairs key-uid update-fn]
(mapcat (fn [keypair]
(if (= (keypair :key-uid) key-uid)
(if-let [updated (update-fn keypair)]
[updated]
[])
[keypair]))
keypairs))
(defn make-accounts-fully-operable
"Updates accounts to be fully operable based on specified key-uids and an optional operable condition.
@ -32,10 +13,10 @@
- A new map with accounts updated to be fully operable where the conditions are met."
[{:keys [accounts key-uids-set operable-condition]}]
(reduce-kv
(fn [acc k account]
(if (and (contains? key-uids-set (:key-uid account))
(fn [acc k {:keys [key-uid] :as account}]
(if (and (contains? key-uids-set key-uid)
(or (nil? operable-condition)
(= (keyword (:operable account)) operable-condition)))
(= (:operable account) operable-condition)))
(assoc acc k (assoc account :operable :fully))
(assoc acc k account)))
{}
@ -44,7 +25,7 @@
(defn- make-keypairs-accounts-fully-operable
[accounts operable-condition]
(map (fn [account]
(if (or (nil? operable-condition) (= (keyword (:operable account)) operable-condition))
(if (or (nil? operable-condition) (= (:operable account) operable-condition))
(assoc account :operable :fully)
account))
accounts))
@ -53,27 +34,30 @@
"Updates keypairs' accounts to be fully operable based on specified key-uids and an optional operable condition.
Parameters:
- :keypairs (seq): A sequence of keypair maps.
- :keypairs (map): A map of keypair key-uid to keypair details.
- :key-uids-set (set): A set of key-uids that need to be checked and updated.
- :operable-condition (keyword, optional): The condition that the keypair's accounts' operability must meet to be updated.
If nil or not provided, the function will update all keypairs' accounts.
Returns:
- A new sequence with keypairs updated to be fully operable where the conditions are met."
- A new map with keypairs updated to be fully operable where the conditions are met."
[{:keys [keypairs key-uids-set operable-condition]}]
(map (fn [keypair]
(if (contains? key-uids-set (:key-uid keypair))
(-> keypair
(update :accounts #(make-keypairs-accounts-fully-operable % operable-condition))
(assoc :lowest-operability :fully))
keypair))
keypairs))
(reduce-kv (fn [acc k keypair]
(if (contains? key-uids-set k)
(assoc acc
k
(-> keypair
(update :accounts make-keypairs-accounts-fully-operable operable-condition)
(assoc :lowest-operability :fully)))
(assoc acc k keypair)))
{}
keypairs))
(defn map-addresses-to-key-uids
(defn get-keypair-key-uids-set-from-addresses
[db addresses]
(reduce (fn [key-uid-set address]
(if-let [account (get-in db [:wallet :accounts address])]
(conj key-uid-set (:key-uid account))
(if-let [account-key-uid (get-in db [:wallet :accounts address :key-uid])]
(conj key-uid-set account-key-uid)
key-uid-set))
#{}
addresses))

View File

@ -10,9 +10,7 @@
(rf/reg-event-fx
:wallet/rename-keypair-success
(fn [{:keys [db]} [key-uid name]]
{:db (update-in db
[:wallet :keypairs]
#(data-store/update-keypair % key-uid (fn [keypair] (assoc keypair :name name))))
{:db (update-in db [:wallet :keypairs key-uid] assoc :name name)
:fx [[:dispatch [:navigate-back]]
[:dispatch
[:toasts/upsert
@ -49,9 +47,7 @@
(rf/reg-event-fx :wallet/remove-keypair-success
(fn [{:keys [db]} [key-uid]]
{:db (update-in db
[:wallet :keypairs]
#(data-store/update-keypair % key-uid (fn [_] nil)))
{:db (update-in db [:wallet :keypairs] dissoc key-uid)
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch
[:toasts/upsert
@ -71,8 +67,11 @@
(defn make-keypairs-accounts-fully-operable
[{:keys [db]} [key-uids-to-update]]
(let [key-uids-set (set key-uids-to-update)
keypair-name (data-store/extract-keypair-name db key-uids-set)]
(let [key-uids-set (set key-uids-to-update)
single-keypair-to-update? (= (count key-uids-to-update) 1)
keypair-name (when single-keypair-to-update?
(let [key-uid (first key-uids-set)]
(get-in db [:wallet :keypairs key-uid :name])))]
{:db (->
db
(update-in [:wallet :accounts]
@ -85,7 +84,7 @@
[:toasts/upsert
{:type :positive
:theme :dark
:text (if (= (count key-uids-to-update) 1)
:text (if single-keypair-to-update?
(i18n/label :t/key-pair-imported-successfully {:name keypair-name})
(i18n/label :t/key-pairs-successfully-imported
{:count (count key-uids-to-update)}))}]]]}))
@ -231,7 +230,7 @@
(defn make-partially-operable-accounts-fully-operable-success
[{:keys [db]} [addresses]]
(let [key-uids-to-update (data-store/map-addresses-to-key-uids db addresses)]
(let [key-uids-to-update (data-store/get-keypair-key-uids-set-from-addresses db addresses)]
{:db (-> db
(update-in [:wallet :accounts]
#(data-store/make-accounts-fully-operable {:accounts %

View File

@ -1,104 +1,100 @@
(ns status-im.contexts.settings.wallet.events-test
(:require
[cljs.test :refer-macros [deftest is testing]]
[cljs.test :refer-macros [deftest is]]
matcher-combinators.test
[native-module.core :as native-module]
[status-im.contexts.settings.wallet.events :as sut]
[utils.security.core :as security]))
(def mock-key-uid "key-1")
(defn mock-db
[keypairs accounts]
{:wallet {:keypairs keypairs
:accounts accounts}
:profile/profile {:key-uid "test-key-uid"}})
(def test-profile {:key-uid "test-key-uid"})
(def test-keypair-key-uid "key-1")
(deftest rename-keypair-test
(let [new-keypair-name "key pair new"
cofx {:db {}}]
(testing "rename-keypair"
(let [expected {:fx [[:json-rpc/call
[{:method "accounts_updateKeypairName"
:params [mock-key-uid new-keypair-name]
:on-success [:wallet/rename-keypair-success mock-key-uid
new-keypair-name]
:on-error fn?}]]]}]
(is (match? expected
(sut/rename-keypair cofx
[{:key-uid mock-key-uid
:keypair-name new-keypair-name}])))))))
cofx {:db {}}
expected {:fx [[:json-rpc/call
[{:method "accounts_updateKeypairName"
:params [test-keypair-key-uid new-keypair-name]
:on-success [:wallet/rename-keypair-success test-keypair-key-uid
new-keypair-name]
:on-error fn?}]]]}]
(is (match? expected
(sut/rename-keypair cofx
[{:key-uid test-keypair-key-uid
:keypair-name new-keypair-name}])))))
(deftest get-keypair-export-connection-test
(let [cofx {:db (mock-db [] {})}
(let [cofx {:db {:profile/profile test-profile}}
sha3-pwd "test-password"
user-key-uid "test-key-uid"
callback (fn [connect-string] (println "callback" connect-string))]
(testing "get-keypair-export-connection"
(let [expected {:fx [[:effects.syncing/export-keypairs-keystores
callback (fn [connect-string] (println "callback" connect-string))
expected {:fx [[:effects.syncing/export-keypairs-keystores
{:key-uid user-key-uid
:sha3-pwd sha3-pwd
:keypair-key-uid mock-key-uid
:keypair-key-uid test-keypair-key-uid
:on-success fn?
:on-fail fn?}]]}]
(is (match? expected
(sut/get-keypair-export-connection
cofx
[{:sha3-pwd sha3-pwd :keypair-key-uid mock-key-uid :callback callback}])))))))
(is (match?
expected
(sut/get-keypair-export-connection
cofx
[{:sha3-pwd sha3-pwd :keypair-key-uid test-keypair-key-uid :callback callback}])))))
(deftest remove-keypair-test
(let [cofx {:db {}}]
(testing "remove-keypair"
(let [expected {:fx [[:json-rpc/call
[{:method "accounts_deleteKeypair"
:params [mock-key-uid]
:on-success [:wallet/remove-keypair-success mock-key-uid]
:on-error fn?}]]]}]
(is (match? expected
(sut/remove-keypair cofx [mock-key-uid])))))))
(let [cofx {:db {}}
expected {:fx [[:json-rpc/call
[{:method "accounts_deleteKeypair"
:params [test-keypair-key-uid]
:on-success [:wallet/remove-keypair-success test-keypair-key-uid]
:on-error fn?}]]]}]
(is (match? expected
(sut/remove-keypair cofx [test-keypair-key-uid])))))
(deftest make-keypairs-accounts-fully-operable-test
(let [db (mock-db [{:key-uid mock-key-uid
:lowest-operability :no
:accounts [{:key-uid mock-key-uid :operable "no"}]}]
{"0x1" {:key-uid mock-key-uid :operable "no"}})
key-uids-to-update [mock-key-uid]]
(testing "make-keypairs-accounts-fully-operable"
(let [effects (sut/make-keypairs-accounts-fully-operable {:db db} [key-uids-to-update])
result-db (:db effects)
updated-keypair (some #(when (= (:key-uid %) mock-key-uid) %)
(get-in result-db [:wallet :keypairs]))
updated-account (get-in result-db [:wallet :accounts "0x1"])]
(is (= (keyword (-> updated-keypair :accounts first :operable)) :fully))
(is (= (keyword (:operable updated-account)) :fully))
(is (= (:lowest-operability updated-keypair) :fully))))))
(let [db {:wallet {:keypairs {test-keypair-key-uid {:key-uid
test-keypair-key-uid
:lowest-operability :no
:accounts
[{:key-uid
test-keypair-key-uid
:operable :no}]}}
:accounts {"0x1" {:key-uid test-keypair-key-uid
:operable :no}}}
:profile/profile test-profile}
key-uids-to-update [test-keypair-key-uid]
effects (sut/make-keypairs-accounts-fully-operable {:db db} [key-uids-to-update])
result-db (:db effects)
updated-keypair (get-in result-db [:wallet :keypairs test-keypair-key-uid])
updated-account (get-in result-db [:wallet :accounts "0x1"])]
(is (= (-> updated-keypair :accounts first :operable) :fully))
(is (= (:operable updated-account) :fully))
(is (= (:lowest-operability updated-keypair) :fully))))
(deftest connection-string-for-import-keypair-test
(let [cofx {:db (mock-db [] {})}
(let [cofx {:db {:profile/profile test-profile}}
sha3-pwd "test-password"
user-key-uid "test-key-uid"
connection-string "test-connection-string"]
(testing "connection-string-for-import-keypair"
(let [expected {:fx [[:effects.syncing/import-keypairs-keystores
{:key-uid user-key-uid
:sha3-pwd sha3-pwd
:keypairs-key-uids [mock-key-uid]
:connection-string connection-string
:on-success fn?
:on-fail fn?}]]}]
(is (match? expected
(sut/connection-string-for-import-keypair cofx
[{:sha3-pwd sha3-pwd
:keypairs-key-uids [mock-key-uid]
:connection-string
connection-string}])))))))
connection-string "test-connection-string"
expected {:fx [[:effects.syncing/import-keypairs-keystores
{:key-uid user-key-uid
:sha3-pwd sha3-pwd
:keypairs-key-uids [test-keypair-key-uid]
:connection-string connection-string
:on-success fn?
:on-fail fn?}]]}]
(is (match? expected
(sut/connection-string-for-import-keypair cofx
[{:sha3-pwd sha3-pwd
:keypairs-key-uids [test-keypair-key-uid]
:connection-string
connection-string}])))))
(deftest success-keypair-qr-scan-test
(let [connection-string "valid-connection-string"
keypairs-key-uids ["keypair-uid"]]
(testing "success-keypair-qr-scan"
(let [effects (sut/success-keypair-qr-scan nil [connection-string keypairs-key-uids])
fx (:fx effects)]
(is (some? fx))))))
keypairs-key-uids [test-keypair-key-uid]
effects (sut/success-keypair-qr-scan nil [connection-string keypairs-key-uids])
fx (:fx effects)]
(is (some? fx))))
(deftest wallet-validate-seed-phrase-test
(let [cofx {:db {}}

View File

@ -70,7 +70,15 @@
{:keys [address path watch-only?]} (rf/sub [:wallet/current-viewing-account])
{keypair-name :name
keypair-type :type} (rf/sub [:wallet/current-viewing-account-keypair])
networks (rf/sub [:wallet/network-preference-details])]
networks (rf/sub [:wallet/network-preference-details])
origin-type (case keypair-type
:seed
:recovery-phrase
:key
:private-key
:default-keypair)]
[rn/scroll-view
{:style style/about-tab
:content-container-style {:padding-bottom (+ constants/floating-shell-button-height 8)}}
@ -89,7 +97,7 @@
:on-press #(rf/dispatch [:show-bottom-sheet {:content about-options}])}]
(when (not watch-only?)
[quo/account-origin
{:type (if (= keypair-type "seed") :recovery-phrase :default-keypair)
{:type origin-type
:stored :on-device
:profile-picture (profile.utils/photo profile)
:customization-color customization-color

View File

@ -5,6 +5,7 @@
[status-im.contexts.wallet.add-account.create-account.utils :as create-account.utils]
[status-im.contexts.wallet.data-store :as data-store]
[taoensso.timbre :as log]
[utils.collection]
[utils.re-frame :as rf]
[utils.security.core :as security]
[utils.transforms :as transforms]))
@ -12,9 +13,11 @@
(defn get-keypairs-success
[{:keys [db]} [keypairs]]
(let [parsed-keypairs (data-store/rpc->keypairs keypairs)
default-key-uid (:key-uid (some #(when (= (:type %) :profile) %) parsed-keypairs))]
default-key-uid (->> parsed-keypairs
(some #(when (= (:type %) :profile) %))
:key-uid)]
{:db (-> db
(assoc-in [:wallet :keypairs] parsed-keypairs)
(assoc-in [:wallet :keypairs] (utils.collection/index-by :key-uid parsed-keypairs))
(assoc-in [:wallet :ui :create-account :selected-keypair-uid] default-key-uid))}))
(rf/reg-event-fx :wallet/get-keypairs-success get-keypairs-success)
@ -41,10 +44,10 @@
(defn seed-phrase-validated
[{:keys [db]} [seed-phrase key-uid on-error]]
(let [keypair-already-added? (->> db
:wallet
:keypairs
(some #(= key-uid (:key-uid %))))]
(let [keypair-already-added? (-> db
:wallet
:keypairs
(contains? key-uid))]
(if keypair-already-added?
(do
(on-error)

View File

@ -73,7 +73,7 @@
[]
(let [compressed-key (rf/sub [:profile/compressed-key])
customization-color (rf/sub [:profile/customization-color])
keypairs (rf/sub [:wallet/keypairs])
keypairs (rf/sub [:wallet/keypairs-list])
selected-keypair (rf/sub [:wallet/selected-keypair-uid])
profile-picture (rf/sub [:profile/image])
[selected-key-uid set-selected-key-uid] (rn/use-state selected-keypair)]

View File

@ -529,10 +529,9 @@
:wallet/process-keypair-from-backup
(fn [{:keys [db]} [{:keys [backedUpKeypair]}]]
(let [{:keys [key-uid accounts]} backedUpKeypair
keypairs-db (get-in db [:wallet :keypairs])
updated-keypairs (-> (filter #(not= (:key-uid %) key-uid) keypairs-db)
(conj backedUpKeypair)
data-store/rpc->keypairs)
updated-keypairs (assoc-in db
[:wallet :keypairs key-uid]
(data-store/rpc->keypair backedUpKeypair))
accounts-fx (mapv (fn [{:keys [chat] :as account}]
;; We exclude the chat account from the profile keypair
;; for fetching the assets

View File

@ -199,6 +199,12 @@
:<- [:wallet]
:-> :keypairs)
(rf/reg-sub
:wallet/keypairs-list
:<- [:wallet]
(fn [{:keys [keypairs]}]
(vals keypairs)))
(rf/reg-sub
:wallet/selected-keypair-uid
:<- [:wallet/create-account]
@ -209,19 +215,15 @@
:<- [:wallet/keypairs]
:<- [:wallet/selected-keypair-uid]
(fn [[keypairs selected-keypair-uid]]
(some #(when (= (:key-uid %) selected-keypair-uid)
%)
keypairs)))
(get keypairs selected-keypair-uid)))
(rf/reg-sub
:wallet/selected-primary-keypair?
:<- [:wallet/keypairs]
:<- [:wallet/selected-keypair-uid]
(fn [[keypairs selected-keypair-uid]]
(let [primary-keypair-uid (->> keypairs
(some #(when (= (:type %) "profile") %))
(:key-uid))]
(= selected-keypair-uid primary-keypair-uid))))
(= (get-in keypairs [selected-keypair-uid :type])
:profile)))
(rf/reg-sub
:wallet/selected-networks->chain-ids
@ -264,29 +266,29 @@
(rf/reg-sub
:wallet/settings-keypairs-accounts
:<- [:wallet/keypairs]
:<- [:wallet/keypairs-list]
(fn [keypairs [_ format-options]]
(let [grouped-keypairs (group-by :lowest-operability keypairs)
operable-keypair-ids (->> (concat (:fully grouped-keypairs)
(:partially grouped-keypairs))
(map :key-uid)
(into #{}))
missing-keypair-ids (->> (map :key-uid (:no grouped-keypairs))
(into #{}))]
{:operable (->> keypairs
(filter #(contains? operable-keypair-ids (:key-uid %)))
(map (fn [{:keys [accounts name type key-uid]}]
{:type (keyword type)
:name name
:key-uid key-uid
:accounts (format-settings-keypair-accounts accounts format-options)})))
:missing (->> keypairs
(filter #(contains? missing-keypair-ids (:key-uid %)))
(map (fn [{:keys [accounts name type key-uid]}]
{:type (keyword type)
:name name
:key-uid key-uid
:accounts (format-settings-missing-keypair-accounts accounts)})))})))
(reduce
(fn [acc {:keys [accounts name type key-uid lowest-operability]}]
(if (= lowest-operability :no)
(update acc
:missing
conj
{:type type
:name name
:key-uid key-uid
:accounts (format-settings-missing-keypair-accounts accounts)})
(update acc
:operable
conj
{:type type
:name name
:key-uid key-uid
:accounts (format-settings-keypair-accounts accounts format-options)})))
{:missing []
:operable []}
keypairs)))
(rf/reg-sub
:wallet/derivation-path-state
:<- [:wallet/create-account]
@ -343,7 +345,7 @@
(= operable :no) :missing-keypair
watch-only? :watch-only
:else :empty)
keypair (first (filter #(= key-uid (:key-uid %)) keypairs))]
keypair (get keypairs key-uid)]
(assoc account
:customization-color color
:type (cond
@ -387,7 +389,7 @@
:<- [:wallet/current-viewing-account]
:<- [:wallet/keypairs]
(fn [[{:keys [key-uid]} keypairs]]
(first (filter #(= key-uid (:key-uid %)) keypairs))))
(get keypairs key-uid)))
(rf/reg-sub
:wallet/current-viewing-account-tokens-in-selected-networks

View File

@ -600,18 +600,6 @@
(assoc :network-preferences-names #{}))]
(rf/sub [sub-name])))))
(def keypairs
[{:key-uid "abc"}])
(h/deftest-sub :wallet/keypairs
[sub-name]
(testing "returns all keypairs"
(swap! rf-db/app-db
#(assoc-in % [:wallet :keypairs] keypairs))
(is
(= keypairs
(rf/sub [sub-name])))))
(def chat-account
{:path "m/43'/60'/1581'/0'/0"
:emoji ""
@ -654,20 +642,40 @@
:operable :no
:removed false})
(def default-keypair-accounts
{:key-uid "abc"
(def profile-key-pair-key-uid "abc")
(def seed-phrase-key-pair-key-uid "def")
(def profile-keypair
{:key-uid profile-key-pair-key-uid
:name "My Profile"
:type "profile"
:type :profile
:lowest-operability :fully
:accounts []})
(def seed-phrase-keypair-accounts
{:key-uid "def"
(def seed-phrase-keypair
{:key-uid seed-phrase-key-pair-key-uid
:name "My Key Pair"
:type "seed"
:type :seed
:lowest-operability :no
:accounts []})
(h/deftest-sub :wallet/keypairs
[sub-name]
(testing "returns keypairs map"
(swap! rf-db/app-db assoc-in [:wallet :keypairs] {profile-key-pair-key-uid profile-keypair})
(is (match? {profile-key-pair-key-uid profile-keypair} (rf/sub [sub-name])))))
(h/deftest-sub :wallet/keypairs-list
[sub-name]
(swap! rf-db/app-db assoc-in
[:wallet :keypairs]
{profile-key-pair-key-uid profile-keypair
seed-phrase-key-pair-key-uid seed-phrase-keypair})
(let [result (rf/sub [sub-name])
expected (list profile-keypair seed-phrase-keypair)]
(is (= 2 (count result)))
(is (match? expected result))))
(h/deftest-sub :wallet/settings-keypairs-accounts
[sub-name]
(testing "returns formatted key-pairs and accounts"
@ -676,12 +684,14 @@
(-> db
(assoc-in
[:wallet :keypairs]
[(assoc default-keypair-accounts
:accounts
[operable-wallet-account])
(assoc seed-phrase-keypair-accounts
:accounts
[inoperable-wallet-account])])
{profile-key-pair-key-uid (update profile-keypair
:accounts
conj
operable-wallet-account)
seed-phrase-key-pair-key-uid (update seed-phrase-keypair
:accounts
conj
inoperable-wallet-account)})
(assoc-in
[:wallet :accounts]
{(:address operable-wallet-account) operable-wallet-account
@ -689,15 +699,15 @@
(is
(match?
{:missing [{:name (:name seed-phrase-keypair-accounts)
:key-uid (:key-uid seed-phrase-keypair-accounts)
:type (keyword (:type seed-phrase-keypair-accounts))
{:missing [{:name (:name seed-phrase-keypair)
:key-uid (:key-uid seed-phrase-keypair)
:type (:type seed-phrase-keypair)
:accounts [{:customization-color (:color inoperable-wallet-account)
:emoji (:emoji inoperable-wallet-account)
:type :default}]}]
:operable [{:name (:name default-keypair-accounts)
:key-uid (:key-uid default-keypair-accounts)
:type (keyword (:type default-keypair-accounts))
:operable [{:name (:name profile-keypair)
:key-uid (:key-uid profile-keypair)
:type (:type profile-keypair)
:accounts [{:account-props {:customization-color (:color operable-wallet-account)
:size 32
:emoji (:emoji operable-wallet-account)
@ -715,9 +725,10 @@
(-> db
(assoc-in
[:wallet :keypairs]
[(assoc default-keypair-accounts
:accounts
[operable-wallet-account])])
{profile-key-pair-key-uid (update profile-keypair
:accounts
conj
operable-wallet-account)})
(assoc-in
[:wallet :accounts]
{(:address operable-wallet-account) operable-wallet-account}))))
@ -732,9 +743,9 @@
size-option 20]
(is
(match? {:missing []
:operable [{:name (:name default-keypair-accounts)
:key-uid (:key-uid default-keypair-accounts)
:type (keyword (:type default-keypair-accounts))
:operable [{:name (:name profile-keypair)
:key-uid (:key-uid profile-keypair)
:type (:type profile-keypair)
:accounts [{:account-props {:customization-color color
:size size-option
:emoji emoji
@ -754,10 +765,11 @@
(-> db
(assoc-in
[:wallet :keypairs]
[(assoc default-keypair-accounts
:accounts
[operable-wallet-account
chat-account])])
{profile-key-pair-key-uid (update profile-keypair
:accounts
conj
operable-wallet-account
chat-account)})
(assoc-in
[:wallet :accounts]
{(:address operable-wallet-account) operable-wallet-account
@ -765,9 +777,9 @@
(is
(match?
{:missing []
:operable [{:name (:name default-keypair-accounts)
:key-uid (:key-uid default-keypair-accounts)
:type (keyword (:type default-keypair-accounts))
:operable [{:name (:name profile-keypair)
:key-uid (:key-uid profile-keypair)
:type (:type profile-keypair)
:accounts [{:account-props {:customization-color (:color operable-wallet-account)
:size 32
:emoji (:emoji operable-wallet-account)