[#21686] User can not sign transactions after Login/Sign up flows using Keycard (#21699)

This commit is contained in:
flexsurfer 2024-12-02 14:57:03 +01:00 committed by GitHub
parent 52a8f8fc22
commit f08ac94596
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 4 deletions

View File

@ -15,11 +15,26 @@
(let [parsed-keypairs (data-store/rpc->keypairs keypairs)
default-key-uid (->> parsed-keypairs
(some #(when (= (:type %) :profile) %))
:key-uid)]
:key-uid)
keycard? (get-in db [:profile/profile :keycard-pairing])
keypair (first parsed-keypairs)
keycard (when (and keycard? (= (count parsed-keypairs) 1) (empty? (:keycards keypair)))
{:keycard-uid (get-in db [:profile/profile :keycard-instance-uid])
:key-uid default-key-uid
:keycard-name ""
:accounts-addresses [(some #(when (:wallet %) (:address %))
(:accounts keypair))]})]
{:db (-> db
(assoc-in [:wallet :keypairs] (utils.collection/index-by :key-uid parsed-keypairs))
(assoc-in [:wallet :ui :create-account :selected-keypair-uid] default-key-uid))}))
(assoc-in [:wallet :keypairs]
(cond-> (utils.collection/index-by :key-uid parsed-keypairs)
keycard
(assoc-in [default-key-uid :keycards] [keycard])))
(assoc-in [:wallet :ui :create-account :selected-keypair-uid] default-key-uid))
;; this is a temporary solution, should be done properly in statu-go instead
:fx [(when keycard
[:json-rpc/call
[{:method "accounts_saveOrUpdateKeycard"
:params [keycard true]}]])]}))
(rf/reg-event-fx :wallet/get-keypairs-success get-keypairs-success)
(defn confirm-account-origin