Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesmac committed May 21, 2024
1 parent 1f634c6 commit 649a2e2
Show file tree
Hide file tree
Showing 4 changed files with 326 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
(rf/reg-event-fx :wallet/get-derived-addresses get-derived-addresses)

(rf/reg-event-fx
:wallet/new-derivation-path
:wallet/next-derivation-path
(fn [_ [{:keys [on-success keypair-uid]}]]
{:fx [[:json-rpc/call
[{:method "accounts_resolveSuggestedPathForKeypair"
Expand All @@ -104,7 +104,7 @@
:on-error (fn [error]
(log/error
"Failed to resolve next path derivation path"
{:event :wallet/new-derivation-path
{:event :wallet/next-derivation-path
:method "accounts_resolveSuggestedPathForKeypair"
:error error
:params keypair-uid}))}]]]}))
Expand Down
39 changes: 11 additions & 28 deletions src/status_im/contexts/wallet/add_account/create_account/utils.cljs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(ns status-im.contexts.wallet.add-account.create-account.utils
(:require [clojure.string :as string]))
(ns status-im.contexts.wallet.add-account.create-account.utils)

(defn first-derived-account [account-data]
(-> account-data :derived first val))

(defn prepare-new-account
[{keypair-name :keypair-name
{:keys [keyUid derived address]} :account-data
{:keys [account-name account-color emoji]} :account-preferences}]
(let [account-to-create (val (first derived))]
[{keypair-name :keypair-name
{:keys [keyUid address] :as account} :account-data
{:keys [account-name color emoji]} :account-preferences}]
(let [account-to-create (first-derived-account account)]
{:key-uid keyUid
:name keypair-name
:type :seed
Expand All @@ -20,28 +22,9 @@
:public-key (:publicKey account-to-create)
:name account-name
:emoji emoji
:colorID account-color
:hidden false}]})

:colorID color
:hidden false}]}))

#_(assoc new-keypair
:name (:keypair-name new-keypair)
:key-uid (:keyUid new-keypair)
:derived-from address
:type :seed
:accounts [{:keypair-name (:keypair-name new-keypair)
:key-uid (:keyUid new-keypair)
:seed-phrase (:mnemonic new-keypair)
:public-key (:publicKey new-keypair)
:type :seed
:name account-name
:emoji emoji
:colorID account-color
:path "m/44'/60'/0'/0/0"
:address (:address new-keypair)}]))

(defn first-derived-account [account-data]
(-> account-data :derived first val))

{"privateKey" "0x61c4d1b891ebee9af38e5e40ef589871b7d18b1bf844f497948045b8479490b3",
"publicKey" "0x044cd08b14ac81e4ad3b1f5ac95c8c68ade831f8a33c9026e5564f572b837a73c85ae5c953f336a3904cfcfd73ae2eb906a1906bd51199168d1269bb195a8a5c35"
Expand All @@ -66,7 +49,7 @@
"mnemonic" "album sense skull captain fall easily tell cup image mass blade before"
"derived" {}}

;;

["0x759e6bc12c2ff1afff2a65ac74b9bc0d92a641d4d6ef4bae1713d4a365eda3de",
{"key-uid" "0xef578a90bc6cfb827712864a8314e1ad60fbf566de5cb861ccc8f4eec4060f53"
"name" "KPTEST"
Expand Down

0 comments on commit 649a2e2

Please sign in to comment.