Skip to content

Commit

Permalink
merged eip55 change
Browse files Browse the repository at this point in the history
  • Loading branch information
goranjovic committed Feb 14, 2019
1 parent e7b6f04 commit a2f4b93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/status_im/ui/screens/wallet/send/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[status-im.ui.screens.wallet.db :as wallet.db]
[status-im.utils.ethereum.ens :as ens]
[status-im.utils.ethereum.eip681 :as eip681]
[status-im.utils.ethereum.eip55 :as eip55]
[status-im.utils.ethereum.core :as ethereum]
[status-im.utils.ethereum.erc20 :as erc20]
[status-im.utils.ethereum.tokens :as tokens]
Expand Down Expand Up @@ -123,15 +124,18 @@
(ens/get-addr web3
(get ens/ens-registries chain)
recipient
callback)
(callback recipient)))
#(callback % true))
(callback recipient false)))

(defn chosen-recipient [web3 chain recipient success-callback error-callback]
{:pre [(keyword? chain) (string? recipient)]}
(eth-name->address web3 chain recipient
#(if (ethereum/address? %)
(success-callback %)
(error-callback %))))
(fn [to ens?]
(if (ethereum/address? to)
(if (and (not ens?) (not (eip55/valid-address-checksum? recipient)))
(error-callback :t/wallet-invalid-address-checksum)
(success-callback to))
(error-callback :t/invalid-address)))))

(handlers/register-handler-fx
:wallet/transaction-to-success
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/wallet/send/views/recipient.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@
:underlay-color colors/black-transparent
:background-color (if disabled? colors/blue colors/white)
:on-press #(events/chosen-recipient web3 chain (:to @transaction) on-address
(fn on-error [_]
(reset! error-message (i18n/label :t/invalid-address))))}
(fn on-error [code]
(reset! error-message (i18n/label code))))}
[react/text {:style {:color (if disabled?
(colors/alpha colors/white 0.3)
colors/blue)
Expand Down
2 changes: 1 addition & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"camera-access-error": "To grant the required camera permission, please go to your system settings and make sure that Status > Camera is selected.",
"wallet-invalid-address": "Invalid address: \n {{data}}",
"invalid-address": "Invalid address",
"wallet-invalid-address-checksum": "Error in address: \n {{data}}",
"wallet-invalid-address-checksum": "Error in address",
"welcome-to-status": "Welcome to Status",
"cryptokitty-name": "CryptoKitty #{{id}}",
"address-explication": "Your public key is used to generate your address on Ethereum and is a series of numbers and letters. You can find it easily in your profile",
Expand Down

0 comments on commit a2f4b93

Please sign in to comment.