Upgrade status-go to bugfix-no-messaging-rinkeby-gd04e667-12 (geth 1.7 rebase) (#2067)

* Upgrade status-go to bugfix-no-messaging-rinkeby-gd04e667-12 (geth 1.7 rebase)

* [bug] fix #2089 and #2098 with geth update

with geth 1.7 addresses are passed with 0x prefix and mix of lower/upper cases
update the normalize hex function so that addresses are always without prefix
and entirely lower-cased.
This commit is contained in:
Oskar Thorén 2017-10-16 11:49:25 +02:00 committed by Roman Volosovskyi
parent 4a669ba331
commit de161c4412
4 changed files with 19 additions and 14 deletions

View File

@ -16,5 +16,5 @@ dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.instabug.library:instabug:3+'
compile 'status-im:function:0.0.1'
compile(group: 'status-im', name: 'status-go', version: 'develop-ge61c39b', ext: 'aar')
compile(group: 'status-im', name: 'status-go', version: 'bugfix-no-messaging-rinkeby-gd04e667-12', ext: 'aar')
}

View File

@ -25,7 +25,7 @@
<artifactItem>
<groupId>status-im</groupId>
<artifactId>status-go-ios-simulator</artifactId>
<version>develop-ge61c39b</version>
<version>bugfix-no-messaging-rinkeby-gd04e667-12</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>./</outputDirectory>

View File

@ -16,7 +16,8 @@
[status-im.utils.handlers :as handlers]
[status-im.ui.screens.accounts.statuses :as statuses]
[status-im.utils.signing-phrase.core :as signing-phrase]
[status-im.utils.gfycat.core :refer [generate-gfy]]))
[status-im.utils.gfycat.core :refer [generate-gfy]]
[status-im.utils.hex :as utils.hex]))
;;;; Helper fns
@ -108,13 +109,16 @@
(fn [{{:keys [network]
:networks/keys [networks]
:as db} :db} [_ {:keys [address] :as account} password]]
(let [account' (assoc account :network network
:networks networks)]
(let [address (utils.hex/normalize-hex address)
account' (assoc account
:network network
:networks networks
:address address)]
(merge
{:db (assoc-in db [:accounts/accounts address] account')
::save-account account'}
(when password
{:dispatch-later [{:ms 400 :dispatch [:login-account address password true]}]})))))
{:db (assoc-in db [:accounts/accounts address] account')
::save-account account'}
(when password
{:dispatch-later [{:ms 400 :dispatch [:login-account address password true]}]})))))
(handlers/register-handler-fx
:create-new-account-handler

View File

@ -1,12 +1,13 @@
(ns status-im.utils.hex
(:require [clojure.string :as s]))
(:require [clojure.string :as string]))
(defn normalize-hex [hex]
(if (and hex (s/starts-with? hex "0x"))
(subs hex 2)
hex))
(when hex
(string/lower-case (if (string/starts-with? hex "0x")
(subs hex 2)
hex))))
(defn valid-hex? [hex]
(let [hex (normalize-hex hex)]
(and (re-matches #"^[0-9a-fA-F]+$" hex)
(not= (js/parseInt hex 16) 0))))
(not= (js/parseInt hex 16) 0))))