Convert address to checksum address before testing for eip55

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Andrea Maria Piana 2019-02-25 13:47:16 +01:00 committed by Igor Mandrigin
parent 1c972a4ad5
commit 25118052df
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
2 changed files with 7 additions and 1 deletions

View File

@ -82,7 +82,9 @@
:ens-name recipient
:cb #(re-frame/dispatch [:wallet.send/set-recipient %])}}
(if (ethereum/address? recipient)
(if (eip55/valid-address-checksum? recipient)
(if (-> recipient
ethereum/address->checksum
eip55/valid-address-checksum?)
{:db (assoc-in db [:wallet :send-transaction :to] recipient)
:dispatch [:navigate-back]}
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})})

View File

@ -48,6 +48,10 @@
(when s
(.isAddress dependencies/Web3.prototype s)))
(defn address->checksum [s]
(when s
(.toChecksumAddress dependencies/Web3.prototype s)))
(defn network->chain-id [network]
(get-in network [:config :NetworkId]))