Skip to content

Commit 5cd5832

Browse files
committed
[#11333] personal_sign method does not work in status
1 parent d380186 commit 5cd5832

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/status_im/browser/core.cljs

+9-2
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,23 @@
314314
:id (int id)
315315
:result result}}})
316316

317+
(defn normalize-message
318+
"NOTE (andrey) there is no spec for this, so this implementation just to be compatible with MM"
319+
[message]
320+
(if (ethereum/hex-to-utf8 message)
321+
message
322+
(ethereum/utf8-to-hex message)))
323+
317324
(defn normalize-sign-message-params
318325
"NOTE (andrey) we need this function, because params may be mixed up"
319326
[params]
320327
(let [[first-param second-param] params]
321328
(when (and (string? first-param) (string? second-param))
322329
(cond
323330
(ethereum/address? first-param)
324-
[first-param second-param]
331+
[first-param (normalize-message second-param)]
325332
(ethereum/address? second-param)
326-
[second-param first-param]))))
333+
[second-param (normalize-message first-param)]))))
327334

328335
(fx/defn send-to-bridge
329336
[cofx message]

src/status_im/ethereum/core.cljs

+2-7
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,7 @@
137137
(when normalized-key
138138
(subs (sha3 normalized-key) 26))))
139139

140-
(def bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles)
141-
142140
(defn hex->text
143-
"Converts a hexstring to UTF8 text. If the data received is 32 bytes long,
144-
return the value unconverted"
141+
"Converts a hexstring to UTF8 text."
145142
[data]
146-
(if (= bytes32-length (count (normalized-hex data)))
147-
data ; Assume it's a bytes32
148-
(hex-to-utf8 data)))
143+
(hex-to-utf8 data))

0 commit comments

Comments
 (0)