[#10115] Trim address/name on adding 1-1 chat
This commit is contained in:
parent
d64ba1b540
commit
c9486dc634
|
@ -7,7 +7,8 @@
|
|||
[status-im.ui.screens.add-new.new-chat.db :as db]
|
||||
[status-im.utils.handlers :as handlers]
|
||||
[status-im.ethereum.stateofus :as stateofus]
|
||||
[status-im.utils.random :as random]))
|
||||
[status-im.utils.random :as random]
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(defn- ens-name-parse [contact-identity]
|
||||
(when (string? contact-identity)
|
||||
|
@ -28,9 +29,10 @@
|
|||
|
||||
(handlers/register-handler-fx
|
||||
:new-chat/set-new-identity
|
||||
(fn [{db :db} [_ new-identity new-ens-name id]]
|
||||
(fn [{db :db} [_ new-identity-raw new-ens-name id]]
|
||||
(when (or (not id) (= id @resolve-last-id))
|
||||
(let [is-public-key? (and (string? new-identity)
|
||||
(let [new-identity (utils/safe-trim new-identity-raw)
|
||||
is-public-key? (and (string? new-identity)
|
||||
(string/starts-with? new-identity "0x"))
|
||||
is-ens? (and (not is-public-key?)
|
||||
(ens/valid-eth-name-prefix? new-identity))
|
||||
|
|
|
@ -135,3 +135,7 @@
|
|||
(if (> (count decimal-part) places)
|
||||
(gstring/format (str "%." places "f") amount)
|
||||
(or (str amount) 0))))
|
||||
|
||||
(defn safe-trim [s]
|
||||
(when (string? s)
|
||||
(string/trim s)))
|
||||
|
|
Loading…
Reference in New Issue