[#11333] personal_sign method does not work in status

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2020-11-04 11:34:06 +01:00
parent 9e466976dc
commit f1d070ed82
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
2 changed files with 11 additions and 9 deletions

View File

@ -314,6 +314,13 @@
:id (int id)
:result result}}})
(defn normalize-message
"NOTE (andrey) there is no spec for this, so this implementation just to be compatible with MM"
[message]
(if (ethereum/hex-to-utf8 message)
message
(ethereum/utf8-to-hex message)))
(defn normalize-sign-message-params
"NOTE (andrey) we need this function, because params may be mixed up"
[params]
@ -321,9 +328,9 @@
(when (and (string? first-param) (string? second-param))
(cond
(ethereum/address? first-param)
[first-param second-param]
[first-param (normalize-message second-param)]
(ethereum/address? second-param)
[second-param first-param]))))
[second-param (normalize-message first-param)]))))
(fx/defn send-to-bridge
[cofx message]

View File

@ -137,12 +137,7 @@
(when normalized-key
(subs (sha3 normalized-key) 26))))
(def bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles)
(defn hex->text
"Converts a hexstring to UTF8 text. If the data received is 32 bytes long,
return the value unconverted"
"Converts a hexstring to UTF8 text."
[data]
(if (= bytes32-length (count (normalized-hex data)))
data ; Assume it's a bytes32
(hex-to-utf8 data)))
(hex-to-utf8 data))