use new API for ens name registration (#17127)

* use new API for ens name registration

4cc53630...223d215e

* update status-go-version.json

* update status-go-version.json

* fix Error:Field validation for 'KeycardPairingDataFile' failed on the 'required' tag

* update status-go-version.json

* fix lint issue
This commit is contained in:
frank 2023-09-16 11:37:06 +08:00 committed by GitHub
parent b73ea572ee
commit 442600bc28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 229 additions and 212 deletions

1
.env
View File

@ -32,3 +32,4 @@ TWO_MINUTES_SYNCING=1
SWAP_ENABLED=1 SWAP_ENABLED=1
STICKERS_TEST_ENABLED=1 STICKERS_TEST_ENABLED=1
LOCAL_PAIRING_ENABLED=1 LOCAL_PAIRING_ENABLED=1
TEST_STATEOFUS=1

View File

@ -1,6 +1,8 @@
(ns status-im.ens.core (ns status-im.ens.core
(:refer-clojure :exclude [name]) (:refer-clojure :exclude [name])
(:require [clojure.string :as string] (:require
[clojure.set :as set]
[clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.bottom-sheet.events :as bottom-sheet] [status-im.bottom-sheet.events :as bottom-sheet]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
@ -11,7 +13,9 @@
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[status-im.utils.random :as random] [status-im.utils.random :as random]
[status-im2.navigation.events :as navigation])) [status-im2.navigation.events :as navigation]
[status-im2.constants :as constants]
[taoensso.timbre :as log]))
(defn fullname (defn fullname
[custom-domain? username] [custom-domain? username]
@ -40,7 +44,7 @@
(ens/expire-at chain-id name cb))) (ens/expire-at chain-id name cb)))
(rf/defn update-ens-tx-state (rf/defn update-ens-tx-state
{:events [:update-ens-tx-state]} {:events [:ens/update-ens-tx-state]}
[{:keys [db]} new-state username custom-domain? tx-hash] [{:keys [db]} new-state username custom-domain? tx-hash]
{:db (assoc-in db {:db (assoc-in db
[:ens/registrations tx-hash] [:ens/registrations tx-hash]
@ -53,20 +57,19 @@
[cofx] [cofx]
;; we reset navigation so that navigate back doesn't return ;; we reset navigation so that navigate back doesn't return
;; into the registration flow ;; into the registration flow
(navigation/set-stack-root cofx (rf/merge cofx
:profile-stack (navigation/navigate-back-to :my-profile)
[:my-profile (navigation/navigate-to :ens-confirmation {})))
:ens-confirmation]))
(rf/defn update-ens-tx-state-and-redirect (rf/defn update-ens-tx-state-and-redirect
{:events [:update-ens-tx-state-and-redirect]} {:events [:update-ens-tx-state-and-redirect]}
[cofx new-state username custom-domain? tx-hash] [{:keys [db] :as cofx} new-state username custom-domain? tx-hash]
(rf/merge cofx (rf/merge cofx
(update-ens-tx-state new-state username custom-domain? tx-hash) (update-ens-tx-state new-state username custom-domain? tx-hash)
(redirect-to-ens-summary))) (redirect-to-ens-summary)))
(rf/defn clear-ens-registration (rf/defn clear-ens-registration
{:events [:clear-ens-registration]} {:events [:ens/clear-registration]}
[{:keys [db]} tx-hash] [{:keys [db]} tx-hash]
{:db (update db :ens/registrations dissoc tx-hash)}) {:db (update db :ens/registrations dissoc tx-hash)})
@ -79,20 +82,40 @@
(assoc-in [:ens/registration :state] state) (assoc-in [:ens/registration :state] state)
(assoc-in [:ens/registration :address] address))})) (assoc-in [:ens/registration :address] address))}))
(rf/defn update-usernames
{:events [:ens/update-usernames]}
[{:keys [db]} name-details]
(let [name-details (map #(set/rename-keys %
{:chainId :chain-id
:removed :removed?})
name-details)]
{:db (reduce (fn [db {:keys [username removed?] :as name-detail}]
(if removed?
(update-in db [:ens/names] dissoc username)
(let [old (get-in db [:ens/names username])]
(assoc-in db [:ens/names username] (merge old name-detail)))))
db
name-details)}))
(rf/defn save-username (rf/defn save-username
{:events [::save-username]} {:events [:ens/save-username]}
[{:keys [db] :as cofx} custom-domain? username redirectToSummary] [{:keys [db] :as cofx} custom-domain? username redirect-to-summary? connected?]
(let [name (fullname custom-domain? username) (let [name (fullname custom-domain? username)
names (get-in db [:profile/profile :usernames] []) names (get-in db [:ens/names] [])
new-names (conj names name)] chain-id (ethereum/chain-id db)]
(rf/merge cofx (rf/merge cofx
(cond-> {:dispatch-n [[:ens/update-usernames [{:username name :chain-id chain-id}]]]}
connected? (assoc :json-rpc/call
[{:method "ens_add"
:params [chain-id name]
:on-success #()
:on-error #(log/error
"Failed to add ens name"
{:chain-id chain-id :name name :error %})}])
redirect-to-summary? (update-in [:dispatch-n] #(conj % [::redirect-to-ens-summary])))
#(when (empty? names)
(multiaccounts.update/multiaccount-update (multiaccounts.update/multiaccount-update
:usernames cofx
new-names
(when redirectToSummary
{:on-success #(re-frame/dispatch [::redirect-to-ens-summary])}))
(when (empty? names)
(multiaccounts.update/multiaccount-update
:preferred-name :preferred-name
name name
{}))))) {})))))
@ -105,15 +128,14 @@
{:keys [public-key]} (:profile/profile db) {:keys [public-key]} (:profile/profile db)
chain-id (ethereum/chain-id db) chain-id (ethereum/chain-id db)
username (fullname custom-domain? username)] username (fullname custom-domain? username)]
(ens/set-pub-key-prepare-tx {:db (assoc-in db [:ens/registration :action] constants/ens-action-type-set-pub-key)
chain-id :json-rpc/call [{:method "ens_setPubKeyPrepareTx"
address :params [chain-id {:from address} username public-key]
username :on-success #(re-frame/dispatch [:signing.ui/sign
public-key
#(re-frame/dispatch [:signing.ui/sign
{:tx-obj % {:tx-obj %
:on-result [::save-username custom-domain? username true] :on-result [:ens/save-username custom-domain?
:on-error [::on-registration-failure]}])))) username true]
:on-error [::on-registration-failure]}])}]}))
(rf/defn on-input-submitted (rf/defn on-input-submitted
{:events [::input-submitted]} {:events [::input-submitted]}
@ -125,7 +147,7 @@
:connected-with-different-key :connected-with-different-key
(re-frame/dispatch [::set-pub-key]) (re-frame/dispatch [::set-pub-key])
:connected :connected
(save-username cofx custom-domain? username true) (save-username cofx custom-domain? username true true)
;; for other states, we do nothing ;; for other states, we do nothing
nil))) nil)))
@ -171,15 +193,14 @@
(:ens/registration db) (:ens/registration db)
{:keys [public-key]} (:profile/profile db) {:keys [public-key]} (:profile/profile db)
chain-id (ethereum/chain-id db)] chain-id (ethereum/chain-id db)]
(ens/register-prepare-tx {:db (assoc-in db [:ens/registration :action] constants/ens-action-type-register)
chain-id :json-rpc/call [{:method "ens_registerPrepareTx"
address :params [chain-id {:from address} username public-key]
username :on-success #(re-frame/dispatch [:signing.ui/sign
public-key
#(re-frame/dispatch [:signing.ui/sign
{:tx-obj % {:tx-obj %
:on-result [:update-ens-tx-state-and-redirect :submitted username false] :on-result [:update-ens-tx-state-and-redirect
:on-error [::on-registration-failure]}])))) :submitted username false]
:on-error [::on-registration-failure]}])}]}))
(defn- valid-custom-domain? (defn- valid-custom-domain?
[username] [username]
@ -211,7 +232,7 @@
{:events [::set-username-candidate]} {:events [::set-username-candidate]}
[{:keys [db]} username] [{:keys [db]} username]
(let [{:keys [custom-domain?]} (:ens/registration db) (let [{:keys [custom-domain?]} (:ens/registration db)
usernames (into #{} (get-in db [:profile/profile :usernames])) usernames (into #{} (keys (get-in db [:ens/names])))
state (state custom-domain? username usernames)] state (state custom-domain? username usernames)]
(reset! resolve-last-id (random/id)) (reset! resolve-last-id (random/id))
(merge (merge
@ -244,9 +265,9 @@
{:db (dissoc db :ens/registration)} {:db (dissoc db :ens/registration)}
;; we reset navigation so that navigate back doesn't return ;; we reset navigation so that navigate back doesn't return
;; into the registration flow ;; into the registration flow
(navigation/set-stack-root :profile-stack (navigation/navigate-back-to :my-profile)
[:my-profile (navigation/navigate-to :ens-main {})
:ens-main]))) ))
(rf/defn switch-domain-type (rf/defn switch-domain-type
{:events [::switch-domain-type]} {:events [::switch-domain-type]}
@ -323,14 +344,18 @@
(rf/defn remove-username (rf/defn remove-username
{:events [::remove-username]} {:events [::remove-username]}
[{:keys [db] :as cofx} name] [{:keys [db] :as cofx} name]
(let [names (get-in db [:profile/profile :usernames] []) (let [names (get-in db [:ens/names] [])
preferred-name (get-in db [:profile/profile :preferred-name]) preferred-name (get-in db [:profile/profile :preferred-name])
new-names (remove #(= name %) names)] new-names (remove #(= name %) (keys names))
{:keys [chain-id username]} (get-in names [name])]
(rf/merge cofx (rf/merge cofx
(multiaccounts.update/multiaccount-update {:json-rpc/call [{:method "ens_remove"
:usernames :params [chain-id username]
new-names :on-success #()
{}) :on-error #(log/error "Failed to remove ENS name"
{:name name :error %})}]
:dispatch [:ens/update-usernames
[{:username username :chain-id chain-id :removed? true}]]}
(when (= name preferred-name) (when (= name preferred-name)
(multiaccounts.update/multiaccount-update (multiaccounts.update/multiaccount-update
:preferred-name :preferred-name

View File

@ -67,15 +67,3 @@
:on-success :on-success
;;NOTE: returns a timestamp in s and we want ms ;;NOTE: returns a timestamp in s and we want ms
#(cb (* (js/Number (native-module/hex-to-number %)) 1000))})) #(cb (* (js/Number (native-module/hex-to-number %)) 1000))}))
(defn register-prepare-tx
[chain-id from ens-name public-key cb]
(json-rpc/call {:method "ens_registerPrepareTx"
:params [chain-id {:from from} ens-name public-key]
:on-success cb}))
(defn set-pub-key-prepare-tx
[chain-id from ens-name public-key cb]
(json-rpc/call {:method "ens_setPubKeyPrepareTx"
:params [chain-id {:from from} ens-name public-key]
:on-success cb}))

View File

@ -1,7 +1,6 @@
(ns status-im.ethereum.transactions.core (ns status-im.ethereum.transactions.core
(:require [cljs.spec.alpha :as spec] (:require [cljs.spec.alpha :as spec]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.ens.core :as ens]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.ethereum.decode :as decode] [status-im.ethereum.decode :as decode]
[status-im.ethereum.eip55 :as eip55] [status-im.ethereum.eip55 :as eip55]
@ -111,6 +110,7 @@
`trigger-fn` is a function that returns true if the watch has been triggered `trigger-fn` is a function that returns true if the watch has been triggered
`on-trigger` is a function that returns the effects to apply when the `on-trigger` is a function that returns the effects to apply when the
transaction has been triggered" transaction has been triggered"
{:events [:transactions/watch-transaction]}
[{:keys [db]} transaction-id {:keys [trigger-fn on-trigger] :as watch-params}] [{:keys [db]} transaction-id {:keys [trigger-fn on-trigger] :as watch-params}]
(when (and (fn? trigger-fn) (when (and (fn? trigger-fn)
(fn? on-trigger)) (fn? on-trigger))
@ -246,19 +246,6 @@
:all :all
:all-preloaded))})) :all-preloaded))}))
(rf/defn delete-pending-transactions
[{:keys [db]} address transactions]
(let [all-transactions
(get-in db [:wallet :accounts (eip55/address->checksum address) :transactions])
pending-tx-hashes (keep (fn [{:keys [hash]}]
(let [{:keys [type] :as old-tx}
(get all-transactions hash)]
(when (and (get all-transactions hash)
(= type :pending))
hash)))
transactions)]
{:wallet/delete-pending-transactions pending-tx-hashes}))
(rf/defn handle-new-transfer (rf/defn handle-new-transfer
[{:keys [db] :as cofx} transfers {:keys [address limit]}] [{:keys [db] :as cofx} transfers {:keys [address limit]}]
(log/debug "[transfers] new-transfers" (log/debug "[transfers] new-transfers"
@ -273,7 +260,7 @@
(seq transfers) (seq transfers)
(concat (concat
[(delete-pending-transactions address transfers)] []
(mapv add-transfer transfers)) (mapv add-transfer transfers))
(and max-known-block (and max-known-block
@ -290,44 +277,12 @@
(conj (tx-history-end-reached checksum)))] (conj (tx-history-end-reached checksum)))]
(apply rf/merge cofx (tx-fetching-ended [checksum]) effects))) (apply rf/merge cofx (tx-fetching-ended [checksum]) effects)))
(rf/defn check-ens-transactions
[{:keys [db] :as cofx} transfers]
(let [set-of-transactions-hash (reduce (fn [acc {:keys [hash]}] (conj acc hash)) #{} transfers)
registrations (filter
(fn [[hash {:keys [state]}]]
(and
(or (= state :dismissed) (= state :submitted))
(contains? set-of-transactions-hash hash)))
(get db :ens/registrations))
fxs (map
(fn [[hash {:keys [username custom-domain?]}]]
(let [transfer (first (filter (fn [transfer]
(let [transfer-hash
(get transfer
:hash)]
(= transfer-hash hash)))
transfers))
type (get transfer :type)
transaction-success (get transfer :transfer)]
(cond
(= transaction-success true)
(rf/merge cofx
(ens/clear-ens-registration hash)
(ens/save-username custom-domain? username false))
(= type :failed)
(ens/update-ens-tx-state :failure username custom-domain? hash)
:else
nil)))
registrations)]
(apply rf/merge cofx fxs)))
(rf/defn new-transfers (rf/defn new-transfers
{:events [::new-transfers]} {:events [::new-transfers]}
[cofx transfers params] [cofx transfers params]
(rf/merge cofx (rf/merge cofx
(handle-new-transfer transfers params) (handle-new-transfer transfers params)
(wallet/stop-fetching-on-empty-tx-history transfers) (wallet/stop-fetching-on-empty-tx-history transfers)))
(check-ens-transactions transfers)))
(rf/defn tx-fetching-failed (rf/defn tx-fetching-failed
{:events [::tx-fetching-failed]} {:events [::tx-fetching-failed]}

View File

@ -160,6 +160,7 @@
:always :always
(assoc :LocalNotificationsConfig {:Enabled true} (assoc :LocalNotificationsConfig {:Enabled true}
:KeycardPairingDataFile "/ethereum/mainnet_rpc/keycard/pairings.json"
:BrowsersConfig {:Enabled true} :BrowsersConfig {:Enabled true}
:PermissionsConfig {:Enabled true} :PermissionsConfig {:Enabled true}
:MailserversConfig {:Enabled true} :MailserversConfig {:Enabled true}

View File

@ -1,5 +1,6 @@
(ns status-im.signing.core (ns status-im.signing.core
(:require [clojure.set :as set] (:require
[clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im2.constants :as constants] [status-im2.constants :as constants]
@ -100,11 +101,14 @@
(rf/defn send-transaction (rf/defn send-transaction
{:events [:signing.ui/sign-is-pressed]} {:events [:signing.ui/sign-is-pressed]}
[{{:signing/keys [sign tx] :as db} :db :as cofx}] [{{:signing/keys [sign tx] :ens/keys [registration] :as db} :db :as cofx}]
(let [{:keys [in-progress? password]} sign (let [{:keys [in-progress? password]} sign
{:keys [tx-obj gas gasPrice maxPriorityFeePerGas {:keys [tx-obj gas gasPrice maxPriorityFeePerGas
maxFeePerGas message nonce]} tx maxFeePerGas message nonce]} tx
hashed-password (ethereum/sha3 (security/safe-unmask-data password))] hashed-password (ethereum/sha3 (security/safe-unmask-data password))
{:keys [action username custom-domain?]} registration
{:keys [public-key]} (:profile/profile db)
chain-id (ethereum/chain-id db)]
(if message (if message
(sign-message cofx) (sign-message cofx)
(let [tx-obj-to-send (merge tx-obj (let [tx-obj-to-send (merge tx-obj
@ -121,14 +125,57 @@
(when maxFeePerGas (when maxFeePerGas
{:maxFeePerGas (str "0x" {:maxFeePerGas (str "0x"
(native-module/number-to-hex (native-module/number-to-hex
(js/parseInt maxFeePerGas)))}))] (js/parseInt maxFeePerGas)))}))
(when-not in-progress? cb #(re-frame/dispatch
{:db (update db :signing/sign assoc :error nil :in-progress? true)
:signing/send-transaction-fx {:tx-obj tx-obj-to-send
:hashed-password hashed-password
:cb #(re-frame/dispatch
[:signing/transaction-completed % [:signing/transaction-completed %
tx-obj-to-send hashed-password])}}))))) tx-obj-to-send hashed-password])
watch-ens-tx-fn #(re-frame/dispatch
[:transactions/watch-transaction
%
{:trigger-fn
(fn [_ {:keys [hash type]}]
(and (= hash %)
(contains? #{:outbound :failed} type)))
:on-trigger
(fn [{:keys [type]}]
(case type
:outbound (do (rf/dispatch [:ens/clear-registration %])
(rf/dispatch [:ens/save-username custom-domain?
username false]))
:failed (rf/dispatch [:ens/update-ens-tx-state :failure username
custom-domain? %])
nil))}])]
(when-not in-progress?
(cond-> {:db (update db :signing/sign assoc :error nil :in-progress? true)}
(nil? action) (assoc :signing/send-transaction-fx
{:tx-obj tx-obj-to-send
:hashed-password hashed-password
:cb cb})
(= action constants/ens-action-type-register) (assoc :json-rpc/call
[{:method "ens_register"
:params [chain-id tx-obj-to-send
hashed-password username
public-key]
:on-success
#(do
(cb (types/clj->json
{:result %}))
(watch-ens-tx-fn %))
:on-error #(cb (types/clj->json
{:error %}))}])
(= action
constants/ens-action-type-set-pub-key) (assoc :json-rpc/call
[{:method "ens_setPubKey"
:params [chain-id tx-obj-to-send
hashed-password username
public-key]
:on-success #(do (cb (types/clj->json
{:result %}))
(watch-ens-tx-fn %))
:on-error #(cb (types/clj->json
{:error
%}))}])))))))
(rf/defn prepare-unconfirmed-transaction (rf/defn prepare-unconfirmed-transaction
[{:keys [db now]} new-tx-hash [{:keys [db now]} new-tx-hash
@ -158,16 +205,7 @@
{:db (-> db {:db (-> db
;;remove old transaction, because we replace it with the new one ;;remove old transaction, because we replace it with the new one
(update-in [:wallet :accounts from :transactions] dissoc old-tx-hash) (update-in [:wallet :accounts from :transactions] dissoc old-tx-hash)
(assoc-in [:wallet :accounts from :transactions new-tx-hash] tx)) (assoc-in [:wallet :accounts from :transactions new-tx-hash] tx))}))
:json-rpc/call [{:method "wallet_storePendingTransaction"
:params [(-> tx
(dissoc :gas-price :gas-limit)
(assoc :gasPrice
(money/to-fixed (money/bignumber gasPrice))
:gasLimit (money/to-fixed (money/bignumber gas)))
clj->js)]
:on-success #(log/info "pending transfer is saved")
:on-error #(log/info "pending transfer was not saved" %)}]}))
(defn get-method-type (defn get-method-type
[data] [data]
@ -431,6 +469,7 @@
{:events [:signing/transaction-completed] {:events [:signing/transaction-completed]
:interceptors [(re-frame/inject-cofx :random-id-generator)]} :interceptors [(re-frame/inject-cofx :random-id-generator)]}
[cofx response tx-obj hashed-password] [cofx response tx-obj hashed-password]
(log/info "transaction-completed" "tx-obj" tx-obj "response" response)
(let [cofx-in-progress-false (assoc-in cofx [:db :signing/sign :in-progress?] false) (let [cofx-in-progress-false (assoc-in cofx [:db :signing/sign :in-progress?] false)
{:keys [result error]} (types/json->clj response)] {:keys [result error]} (types/json->clj response)]
(if error (if error

View File

@ -51,6 +51,7 @@
^js cleared-histories (.-clearedHistories response-js) ^js cleared-histories (.-clearedHistories response-js)
^js identity-images (.-identityImages response-js) ^js identity-images (.-identityImages response-js)
^js accounts (.-accounts response-js) ^js accounts (.-accounts response-js)
^js ens-username-details-js (.-ensUsernameDetails response-js)
sync-handler (when-not process-async process-response)] sync-handler (when-not process-async process-response)]
(cond (cond
@ -193,7 +194,14 @@
(rf/merge cofx (rf/merge cofx
(process-next response-js sync-handler) (process-next response-js sync-handler)
(models.visibility-status-updates/sync-visibility-status-update (models.visibility-status-updates/sync-visibility-status-update
current-visibility-status-clj)))))) current-visibility-status-clj)))
(seq ens-username-details-js)
(let [ens-username-details-clj (types/js->clj ens-username-details-js)]
(js-delete response-js "ensUsernameDetails")
(rf/merge cofx
(process-next response-js sync-handler)
(rf/dispatch [:ens/update-usernames ens-username-details-clj]))))))
(defn group-by-and-update-unviewed-counts (defn group-by-and-update-unviewed-counts
"group messages by current chat, profile updates, transactions and update unviewed counters in db for not curent chats" "group messages by current chat, profile updates, transactions and update unviewed counters in db for not curent chats"

View File

@ -702,7 +702,7 @@
[name-item [name-item
{:name username {:name username
:action (when-not (= state :submitted) :action (when-not (= state :submitted)
#(re-frame/dispatch [:clear-ens-registration tx-hash])) #(re-frame/dispatch [:ens/clear-registration tx-hash]))
:subtitle (case state :subtitle (case state
:submitted (i18n/label :t/ens-registration-in-progress) :submitted (i18n/label :t/ens-registration-in-progress)
:failure (i18n/label :t/ens-registration-failure) :failure (i18n/label :t/ens-registration-failure)

View File

@ -803,21 +803,18 @@
::start-watching ::start-watching
(fn [hashes] (fn [hashes]
(log/info "[wallet] watch transactions" hashes) (log/info "[wallet] watch transactions" hashes)
(doseq [[address tx-hash] hashes] (doseq [[address tx-hash chain-id] hashes]
(json-rpc/call (json-rpc/call
{:method "wallet_watchTransaction" {:method "wallet_watchTransactionByChainID"
:params [tx-hash] :params [chain-id tx-hash]
:on-success #(re-frame.core/dispatch [::transaction-included address tx-hash]) :on-success #(re-frame.core/dispatch [::transaction-included address tx-hash])
:on-error #(log/info "[wallet] watch transaction error" % "hash" tx-hash)})))) :on-error #(log/info "[wallet] watch transaction error" % "hash" tx-hash)}))))
(rf/defn watch-tx (rf/defn watch-tx
{:events [:watch-tx]} {:events [:watch-tx]}
[{:keys [db] :as cofx} address tx-id] [{:keys [db] :as cofx} address tx-id]
{::start-watching [[address tx-id]]}) (let [chain-id (ethereum/chain-id db)]
{::start-watching [[address tx-id chain-id]]}))
(rf/defn watch-transsactions
[_ hashes]
{::start-watching hashes})
(rf/defn clear-timeouts (rf/defn clear-timeouts
[{:keys [db]}] [{:keys [db]}]
@ -1013,7 +1010,7 @@
db))) db)))
db db
(map (partial normalize-transaction db) raw-transactions)) (map (partial normalize-transaction db) raw-transactions))
::start-watching (map (juxt :from :hash) raw-transactions)}) ::start-watching (map (juxt :from :hash :network_id) raw-transactions)})
(re-frame/reg-fx (re-frame/reg-fx
:wallet/delete-pending-transactions :wallet/delete-pending-transactions

View File

@ -354,3 +354,6 @@
{:ios "Inter-Medium.otf" {:ios "Inter-Medium.otf"
:android "Inter-Medium.ttf" :android "Inter-Medium.ttf"
:uppercase-ratio 0.603861228044709}) :uppercase-ratio 0.603861228044709})
(def ^:const ens-action-type-register 1)
(def ^:const ens-action-type-set-pub-key 2)

View File

@ -130,7 +130,7 @@
(rf/defn login-node-signal (rf/defn login-node-signal
[{{:onboarding-2/keys [recovered-account? new-account?] :as db} :db :as cofx} [{{:onboarding-2/keys [recovered-account? new-account?] :as db} :db :as cofx}
{:keys [settings account error]}] {:keys [settings account ensUsernames error]}]
(log/debug "[signals] node.login" "error" error) (log/debug "[signals] node.login" "error" error)
(if error (if error
{:db (update db :profile/login #(-> % (dissoc :processing) (assoc :error error)))} {:db (update db :profile/login #(-> % (dissoc :processing) (assoc :error error)))}
@ -138,7 +138,8 @@
{:db (dissoc db :profile/login) {:db (dissoc db :profile/login)
:dispatch-n [[:logging/initialize-web3-client-version] :dispatch-n [[:logging/initialize-web3-client-version]
(when (and new-account? (not recovered-account?)) (when (and new-account? (not recovered-account?))
[:wallet/set-initial-blocks-range])]} [:wallet/set-initial-blocks-range])
[:ens/update-usernames ensUsernames]]}
(login-existing-profile settings account)))) (login-existing-profile settings account))))
(rf/defn login-with-biometric-if-available (rf/defn login-with-biometric-if-available

View File

@ -5,12 +5,6 @@
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[utils.money :as money])) [utils.money :as money]))
(re-frame/reg-sub
:multiaccount/usernames
:<- [:profile/profile]
(fn [multiaccount]
(:usernames multiaccount)))
(re-frame/reg-sub (re-frame/reg-sub
:ens/preferred-name :ens/preferred-name
:<- [:profile/profile] :<- [:profile/profile]
@ -83,12 +77,17 @@
(re-frame/reg-sub (re-frame/reg-sub
:ens.main/screen :ens.main/screen
:<- [:multiaccount/usernames] :<- [:ens/names]
:<- [:profile/profile] :<- [:profile/profile]
:<- [:ens/preferred-name] :<- [:ens/preferred-name]
:<- [:ens/registrations] :<- [:ens/registrations]
(fn [[names multiaccount preferred-name registrations]] (fn [[names multiaccount preferred-name registrations]]
{:names names (let [not-in-progress-names (reduce (fn [acc {:keys [username custom-domain?]}]
(let [full-name (ens/fullname custom-domain? username)]
(remove #(= % full-name) acc)))
(keys names)
(vals registrations))]
{:names not-in-progress-names
:profile/profile multiaccount :profile/profile multiaccount
:preferred-name preferred-name :preferred-name preferred-name
:registrations registrations})) :registrations registrations})))

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.166.9", "version": "v0.166.11",
"commit-sha1": "e72a033930872c909cb7cc61aadefb34341e9bd7", "commit-sha1": "6bcf5f1289f9160168574290cbd6f90dede3f8f6",
"src-sha256": "0ldji1pk9a45lpwcdzrkmnfhvz311v92nfkwk16gv65cv54705fv" "src-sha256": "0g56pawjpxgjp93slvpbkajz73ajrjfi0n0js3hvqh8x4ciwa43p"
} }