move status native module (#15749)

This commit is contained in:
flexsurfer 2023-04-26 18:14:14 +02:00 committed by GitHub
parent 6eb2029c51
commit efbf93f6e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 202 additions and 327 deletions

View File

@ -12,11 +12,11 @@ status-im.chat.models.message-content/actions
status-im.chat.models.message-content/blank-string status-im.chat.models.message-content/blank-string
status-im.chat.models.message-content/sorted-ranges status-im.chat.models.message-content/sorted-ranges
status-im.ethereum.mnemonic/words->passphrase status-im.ethereum.mnemonic/words->passphrase
status-im.native-module.core/listener native-module.core/listener
status-im.native-module.core/multiaccount-reset native-module.core/multiaccount-reset
status-im.native-module.core/extract-group-membership-signatures native-module.core/extract-group-membership-signatures
status-im.native-module.core/sign-group-membership native-module.core/sign-group-membership
status-im.native-module.core/update-mailservers native-module.core/update-mailservers
status-im.ethereum.abi-spec/bytes-to-hex status-im.ethereum.abi-spec/bytes-to-hex
status-im.android.core/init status-im.android.core/init
status-im.chat.models.message/transport-keys status-im.chat.models.message/transport-keys

View File

@ -1,19 +1,19 @@
(ns status-im.native-module.core (ns native-module.core
(:require ["react-native" :as react-native] (:require ["react-native" :as react-native]
[re-frame.core :as re-frame] [utils.validators :as validators]
[status-im2.utils.validators :as validators]
[status-im.utils.platform :as platform]
[status-im.utils.react-native :as react-native-utils]
[status-im.utils.types :as types]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[status-im2.constants :as constants])) [react-native.platform :as platform]
[react-native.core :as rn]
[utils.transforms :as types]))
(defn status (defn status
[] []
(when (exists? (.-NativeModules react-native)) (when (exists? (.-NativeModules react-native))
(.-Status ^js (.-NativeModules react-native)))) (.-Status ^js (.-NativeModules react-native))))
(def adjust-resize 16) (defn init
[handler]
(.addListener ^js rn/device-event-emitter "gethEvent" #(handler (.-jsonEvent ^js %))))
(defn clear-web-data (defn clear-web-data
[] []
@ -72,15 +72,6 @@
accounts-data accounts-data
chat-key))) chat-key)))
(defn login
"NOTE: beware, the password has to be sha3 hashed"
[key-uid account-data hashed-password]
(log/debug "[native-module] login")
(clear-web-data)
(init-keystore
key-uid
#(.login ^js (status) account-data hashed-password)))
(defn login-with-config (defn login-with-config
"NOTE: beware, the password has to be sha3 hashed" "NOTE: beware, the password has to be sha3 hashed"
[key-uid account-data hashed-password config] [key-uid account-data hashed-password config]
@ -123,11 +114,6 @@
(clear-web-data) (clear-web-data)
(.logout ^js (status))) (.logout ^js (status)))
(defonce listener
(.addListener ^js react-native-utils/device-event-emitter
"gethEvent"
#(re-frame/dispatch [:signals/signal-received (.-jsonEvent ^js %)])))
(defn multiaccount-load-account (defn multiaccount-load-account
"NOTE: beware, the password has to be sha3 hashed "NOTE: beware, the password has to be sha3 hashed
@ -141,14 +127,6 @@
:password hashed-password}) :password hashed-password})
callback)) callback))
(defn multiaccount-reset
"TODO: this function is not used anywhere
if usage isn't planned, remove"
[callback]
(log/debug "[native-module] multiaccount-reset")
(.multiAccountReset ^js (status)
callback))
(defn multiaccount-derive-addresses (defn multiaccount-derive-addresses
"NOTE: this should be named derive-accounts "NOTE: this should be named derive-accounts
this only derive addresses, they still need to be stored this only derive addresses, they still need to be stored
@ -298,43 +276,13 @@
:key key}) :key key})
(.deserializeAndCompressKey ^js (status) key callback)) (.deserializeAndCompressKey ^js (status) key callback))
(defn public-key->compressed-key
"Provides public key to status-go and gets back a compressed key via serialization"
[public-key callback]
(let [serialization-key constants/serialization-key
multi-code-prefix constants/multi-code-prefix
multi-code-key (str multi-code-prefix (subs public-key 2))]
(log/info "[native-module] Serializing public key"
{:fn :public-key->compressed-key
:public-key public-key
:multi-code-key multi-code-key})
(.multiformatSerializePublicKey ^js (status) multi-code-key serialization-key callback)))
(defn compressed-key->public-key (defn compressed-key->public-key
"Provides compressed key to status-go and gets back the uncompressed public key via deserialization" "Provides compressed key to status-go and gets back the uncompressed public key via deserialization"
[public-key callback] [public-key deserialization-key callback]
(let [deserialization-key constants/deserialization-key] (log/info "[native-module] Deserializing compressed key"
(log/info "[native-module] Deserializing compressed key" {:fn :compressed-key->public-key
{:fn :compressed-key->public-key
:public-key public-key})
(.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback)))
(defn decompress-public-key
"Provides compressed key to status-go and gets back the uncompressed public key"
[public-key callback]
(log/info "[native-module] Decompressing public key"
{:fn :decompress-public-key
:public-key public-key}) :public-key public-key})
(.decompressPublicKey ^js (status) public-key callback)) (.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback))
(defn compress-public-key
"Provides a public key to status-go and gets back a 33bit compressed key back"
[public-key callback]
(log/info "[native-module] Compressing public key"
{:fn :compress-public-key
:public-key public-key})
(.compressPublicKey ^js (status) public-key callback))
(defn hash-typed-data (defn hash-typed-data
"used for keycard" "used for keycard"
@ -388,11 +336,6 @@
(log/debug "[native-module] send-logs") (log/debug "[native-module] send-logs")
(.sendLogs ^js (status) dbJson js-logs callback)) (.sendLogs ^js (status) dbJson js-logs callback))
(defn add-peer
[enode on-result]
(log/debug "[native-module] add-peer")
(.addPeer ^js (status) enode on-result))
(defn close-application (defn close-application
[] []
(log/debug "[native-module] close-application") (log/debug "[native-module] close-application")
@ -408,11 +351,6 @@
(log/debug "[native-module] app-state-change") (log/debug "[native-module] app-state-change")
(.appStateChange ^js (status) state)) (.appStateChange ^js (status) state))
(defn stop-local-notifications
[]
(log/debug "[native-module] stop-local-notifications")
(.stopLocalNotifications ^js (status)))
(defn start-local-notifications (defn start-local-notifications
[] []
(log/debug "[native-module] start-local-notifications") (log/debug "[native-module] start-local-notifications")
@ -433,26 +371,11 @@
:build-id (.-buildId status) :build-id (.-buildId status)
:device-id (.-deviceId status)})) :device-id (.-deviceId status)}))
(defn extract-group-membership-signatures
[signature-pairs callback]
(log/debug "[native-module] extract-group-membership-signatures")
(.extractGroupMembershipSignatures ^js (status) signature-pairs callback))
(defn sign-group-membership
[content callback]
(log/debug "[native-module] sign-group-membership")
(.signGroupMembership ^js (status) content callback))
(defn get-node-config (defn get-node-config
[callback] [callback]
(log/debug "[native-module] get-node-config") (log/debug "[native-module] get-node-config")
(.getNodeConfig ^js (status) callback)) (.getNodeConfig ^js (status) callback))
(defn update-mailservers
[enodes on-result]
(log/debug "[native-module] update-mailservers")
(.updateMailservers ^js (status) enodes on-result))
(defn toggle-webview-debug (defn toggle-webview-debug
[on] [on]
(log/debug "[native-module] toggle-webview-debug" on) (log/debug "[native-module] toggle-webview-debug" on)
@ -483,12 +406,6 @@
(when (validators/valid-public-key? public-key) (when (validators/valid-public-key? public-key)
(.generateAlias ^js (status) public-key))) (.generateAlias ^js (status) public-key)))
(defn generate-gfycat-async
"Generate a 3 words random name based on the user public-key, asynchronously"
[public-key callback]
(when (validators/valid-public-key? public-key)
(.generateAliasAsync ^js (status) public-key callback)))
(defn identicon (defn identicon
"Generate a icon based on a string, synchronously" "Generate a icon based on a string, synchronously"
[seed] [seed]
@ -500,11 +417,6 @@
(log/debug "[native-module] encode-transfer") (log/debug "[native-module] encode-transfer")
(.encodeTransfer ^js (status) to-norm amount-hex)) (.encodeTransfer ^js (status) to-norm amount-hex))
(defn encode-function-call
[method params]
(log/debug "[native-module] encode-function-call")
(.encodeFunctionCall ^js (status) method (types/clj->json params)))
(defn decode-parameters (defn decode-parameters
[bytes-string types] [bytes-string types]
(log/debug "[native-module] decode-parameters") (log/debug "[native-module] decode-parameters")
@ -555,11 +467,6 @@
(log/debug "[native-module] to-checksum-address") (log/debug "[native-module] to-checksum-address")
(.toChecksumAddress ^js (status) address)) (.toChecksumAddress ^js (status) address))
(defn identicon-async
"Generate a icon based on a string, asynchronously"
[seed callback]
(.identiconAsync ^js (status) seed callback))
(defn gfycat-identicon-async (defn gfycat-identicon-async
"Generate an icon based on a string and 3 words random name asynchronously" "Generate an icon based on a string and 3 words random name asynchronously"
[seed callback] [seed callback]
@ -585,16 +492,6 @@
(log/debug "[native-module] delete-imported-key") (log/debug "[native-module] delete-imported-key")
(.deleteImportedKey ^js (status) key-uid address hashed-password callback)) (.deleteImportedKey ^js (status) key-uid address hashed-password callback))
(defn activate-keep-awake
[]
(log/debug "[native-module] activateKeepAwake")
(.activateKeepAwake ^js (status)))
(defn deactivate-keep-awake
[]
(log/debug "[native-module] deactivateKeepAwake")
(.deactivateKeepAwake ^js (status)))
(defn reset-keyboard-input (defn reset-keyboard-input
[input selection] [input selection]
(log/debug "[native-module] resetKeyboardInput") (log/debug "[native-module] resetKeyboardInput")

View File

@ -1,10 +1,10 @@
(ns status-im.native-module.core-test (ns native-module.core-test
(:require [cljs.test :refer [deftest is testing]] (:require [cljs.test :refer [deftest is testing]]
[status-im.native-module.core :as status])) [native-module.core :as native-module]))
(deftest identicon-test (deftest identicon-test
(testing "check if identicon test works" (testing "check if identicon test works"
(is (is
(= (=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAjklEQVR4nOzXsQmAMBQGYRV3cUAdQwd0Gm2sJIWSBI6f+0oR8XjwSKYhhCE0htAYQmMITUzI/PXF49yv0vN12cYWP1L7/ZiJGEJjCE31xvm7bXptv5iJGEJjCE31WasVz1oPQ2gMoWlyuyvpfaN8i5mIITSG0BhCYwiNIeokZiKG0BhCYwiNITR3AAAA//+A3RtWaKqXgQAAAABJRU5ErkJggg==" "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAjklEQVR4nOzXsQmAMBQGYRV3cUAdQwd0Gm2sJIWSBI6f+0oR8XjwSKYhhCE0htAYQmMITUzI/PXF49yv0vN12cYWP1L7/ZiJGEJjCE31xvm7bXptv5iJGEJjCE31WasVz1oPQ2gMoWlyuyvpfaN8i5mIITSG0BhCYwiNIeokZiKG0BhCYwiNITR3AAAA//+A3RtWaKqXgQAAAABJRU5ErkJggg=="
(status/identicon "a"))))) (native-module/identicon "a")))))

View File

@ -37,6 +37,8 @@
(def dismiss-keyboard! #(.dismiss keyboard)) (def dismiss-keyboard! #(.dismiss keyboard))
(def device-event-emitter (.-DeviceEventEmitter ^js react-native))
(defn hide-splash-screen (defn hide-splash-screen
[] []
(.hide ^js (-> react-native .-NativeModules .-SplashScreen))) (.hide ^js (-> react-native .-NativeModules .-SplashScreen)))

View File

@ -1,7 +1,7 @@
(ns status-im.add-new.db (ns status-im.add-new.db
(:require [cljs.spec.alpha :as spec] (:require [cljs.spec.alpha :as spec]
[status-im.ethereum.ens :as ens] [status-im.ethereum.ens :as ens]
[status-im2.utils.validators :as validators])) [utils.validators :as validators]))
(defn own-public-key? (defn own-public-key?
[{:keys [multiaccount]} public-key] [{:keys [multiaccount]} public-key]

View File

@ -13,7 +13,7 @@
[status-im.ethereum.ens :as ens] [status-im.ethereum.ens :as ens]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.signing.core :as signing] [status-im.signing.core :as signing]
[status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -537,7 +537,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:browser/call-rpc :browser/call-rpc
(fn [[payload callback]] (fn [[payload callback]]
(status/call-rpc (native-module/call-rpc
(types/clj->json payload) (types/clj->json payload)
(fn [response] (fn [response]
(if (= "" response) (if (= "" response)
@ -559,7 +559,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:browser/clear-web-data :browser/clear-web-data
(fn [] (fn []
(status/clear-web-data))) (native-module/clear-web-data)))
(defn share-link (defn share-link
[url] [url]

View File

@ -6,7 +6,7 @@
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[status-im.native-module.core :as status])) [native-module.core :as native-module]))
(defn- transfer-input-segments (defn- transfer-input-segments
[segments] [segments]
@ -56,8 +56,8 @@
:ensVerified :ens-verified :ensVerified :ens-verified
:added :added? :added :added?
:displayName :display-name :displayName :display-name
:searchedText :searched-text :searchedText :searched-text})))
})))
{} {}
mentionable-users)) mentionable-users))
(defn- transfer-mention-result (defn- transfer-mention-result
@ -237,7 +237,7 @@
::reset-text-input-cursor ::reset-text-input-cursor
(fn [[ref cursor]] (fn [[ref cursor]]
(when ref (when ref
(status/reset-keyboard-input (native-module/reset-keyboard-input
(rn/find-node-handle (react/current-ref ref)) (rn/find-node-handle (react/current-ref ref))
cursor)))) cursor))))

View File

@ -1,23 +1,23 @@
(ns status-im.ethereum.core (ns status-im.ethereum.core
(:require [clojure.string :as string] (:require [clojure.string :as string]
[status-im.ethereum.eip55 :as eip55] [status-im.ethereum.eip55 :as eip55]
[status-im.native-module.core :as status])) [native-module.core :as native-module]))
(defn sha3 (defn sha3
[s] [s]
(when s (when s
(status/sha3 (str s)))) (native-module/sha3 (str s))))
(defn utf8-to-hex (defn utf8-to-hex
[s] [s]
(let [hex (status/utf8-to-hex (str s))] (let [hex (native-module/utf8-to-hex (str s))]
(if (empty? hex) (if (empty? hex)
nil nil
hex))) hex)))
(defn hex-to-utf8 (defn hex-to-utf8
[s] [s]
(let [utf8 (status/hex-to-utf8 s)] (let [utf8 (native-module/hex-to-utf8 s)]
(if (empty? utf8) (if (empty? utf8)
nil nil
utf8))) utf8)))
@ -118,7 +118,7 @@
(defn address? (defn address?
[s] [s]
(when s (when s
(status/address? s))) (native-module/address? s)))
(defn network->chain-id (defn network->chain-id
[network] [network]

View File

@ -5,7 +5,7 @@
e.g. 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed" e.g. 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
(:require [clojure.string :as string] (:require [clojure.string :as string]
[status-im.native-module.core :as status])) [native-module.core :as native-module]))
(def hex-prefix "0x") (def hex-prefix "0x")
@ -13,7 +13,7 @@
"Converts an arbitrary case address to one with correct checksum case." "Converts an arbitrary case address to one with correct checksum case."
[address] [address]
(when address (when address
(status/to-checksum-address (native-module/to-checksum-address
(if (string/starts-with? address hex-prefix) (if (string/starts-with? address hex-prefix)
address address
(str hex-prefix address))))) (str hex-prefix address)))))
@ -21,4 +21,4 @@
(defn valid-address-checksum? (defn valid-address-checksum?
"Checks address checksum validity." "Checks address checksum validity."
[address] [address]
(status/check-address-checksum address)) (native-module/check-address-checksum address))

View File

@ -1,6 +1,6 @@
(ns status-im.ethereum.encode (ns status-im.ethereum.encode
(:require [status-im.native-module.core :as status])) (:require [native-module.core :as native-module]))
(defn uint (defn uint
[x] [x]
(str "0x" (status/number-to-hex x))) (str "0x" (native-module/number-to-hex x)))

View File

@ -1,6 +1,6 @@
(ns status-im.ethereum.ens (ns status-im.ethereum.ens
(:require [clojure.string :as string] (:require [clojure.string :as string]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im2.common.json-rpc.events :as json-rpc])) [status-im2.common.json-rpc.events :as json-rpc]))
;; this is the addresses of ens registries for the different networks ;; this is the addresses of ens registries for the different networks
@ -66,7 +66,7 @@
:params [chain-id ens-name] :params [chain-id ens-name]
:on-success :on-success
;;NOTE: returns a timestamp in s and we want ms ;;NOTE: returns a timestamp in s and we want ms
#(cb (* (js/Number (status/hex-to-number %)) 1000))})) #(cb (* (js/Number (native-module/hex-to-number %)) 1000))}))
(defn register-prepare-tx (defn register-prepare-tx
[chain-id from ens-name pubkey cb] [chain-id from ens-name pubkey cb]

View File

@ -30,7 +30,7 @@
status-im.multiaccounts.logout.core status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model] [status-im.multiaccounts.model :as multiaccounts.model]
status-im.multiaccounts.update.core status-im.multiaccounts.update.core
[status-im.native-module.core :as status] [native-module.core :as native-module]
status-im.network.net-info status-im.network.net-info
status-im.pairing.core status-im.pairing.core
status-im.profile.core status-im.profile.core
@ -88,7 +88,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:ui/close-application :ui/close-application
(fn [_] (fn [_]
(status/close-application))) (native-module/close-application)))
(re-frame/reg-fx (re-frame/reg-fx
::app-state-change-fx ::app-state-change-fx
@ -97,7 +97,7 @@
;; Change the app theme if the ios device theme was updated when the app was in the background ;; Change the app theme if the ios device theme was updated when the app was in the background
;; https://github.com/status-im/status-mobile/issues/15708 ;; https://github.com/status-im/status-mobile/issues/15708
(theme/change-device-theme (rn/get-color-scheme))) (theme/change-device-theme (rn/get-color-scheme)))
(status/app-state-change state))) (native-module/app-state-change state)))
(re-frame/reg-fx (re-frame/reg-fx
:ui/listen-to-window-dimensions-change :ui/listen-to-window-dimensions-change

View File

@ -3,7 +3,7 @@
["react-native" :refer (BackHandler)] ["react-native" :refer (BackHandler)]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.keycard.card :as card] [status-im.keycard.card :as card]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -202,7 +202,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:keycard/generate-name-and-photo :keycard/generate-name-and-photo
(fn [{:keys [public-key on-success]}] (fn [{:keys [public-key on-success]}]
(status/gfycat-identicon-async (native-module/gfycat-identicon-async
public-key public-key
(fn [whisper-name photo-path] (fn [whisper-name photo-path]
(re-frame/dispatch (re-frame/dispatch

View File

@ -4,7 +4,7 @@
[clojure.string :as string] [clojure.string :as string]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.keycard.keycard :as keycard] [status-im.keycard.keycard :as keycard]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -296,7 +296,7 @@
(defn save-multiaccount-and-login (defn save-multiaccount-and-login
[{:keys [key-uid multiaccount-data password settings node-config accounts-data chat-key]}] [{:keys [key-uid multiaccount-data password settings node-config accounts-data chat-key]}]
(status/save-multiaccount-and-login-with-keycard (native-module/save-multiaccount-and-login-with-keycard
key-uid key-uid
(types/clj->json multiaccount-data) (types/clj->json multiaccount-data)
password password
@ -307,15 +307,15 @@
(defn login (defn login
[args] [args]
(status/login-with-keycard args)) (native-module/login-with-keycard args))
(defn send-transaction-with-signature (defn send-transaction-with-signature
[{:keys [transaction signature on-completed]}] [{:keys [transaction signature on-completed]}]
(status/send-transaction-with-signature transaction signature on-completed)) (native-module/send-transaction-with-signature transaction signature on-completed))
(defn delete-multiaccount-before-migration (defn delete-multiaccount-before-migration
[{:keys [key-uid on-success on-error]}] [{:keys [key-uid on-success on-error]}]
(status/delete-multiaccount (native-module/delete-multiaccount
key-uid key-uid
(fn [result] (fn [result]
(let [{:keys [error]} (types/json->clj result)] (let [{:keys [error]} (types/json->clj result)]

View File

@ -10,7 +10,7 @@
status-im.keycard.fx status-im.keycard.fx
[status-im.multiaccounts.create.core :as multiaccounts.create] [status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.multiaccounts.model :as multiaccounts.model] [status-im.multiaccounts.model :as multiaccounts.model]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.datetime :as datetime] [utils.datetime :as datetime]
@ -250,14 +250,14 @@
(re-frame/reg-fx (re-frame/reg-fx
::finish-migration ::finish-migration
(fn [[account settings password encryption-pass login-params]] (fn [[account settings password encryption-pass login-params]]
(status/convert-to-keycard-account (native-module/convert-to-keycard-account
account account
settings settings
password password
encryption-pass encryption-pass
#(let [{:keys [error]} (types/json->clj %)] #(let [{:keys [error]} (types/json->clj %)]
(if (string/blank? error) (if (string/blank? error)
(status/login-with-keycard login-params) (native-module/login-with-keycard login-params)
(throw (throw
(js/Error. (js/Error.
"Please shake the phone to report this error and restart the app. Migration failed unexpectedly."))))))) "Please shake the phone to report this error and restart the app. Migration failed unexpectedly.")))))))

View File

@ -7,7 +7,7 @@
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.keycard.keycard :as keycard] [status-im.keycard.keycard :as keycard]
[status-im.multiaccounts.create.core :as multiaccounts.create] [status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.node.core :as node] [status-im.node.core :as node]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.utils.utils :as utils] [status-im.utils.utils :as utils]
@ -249,14 +249,14 @@
[{:keys [password on-success]}] [{:keys [password on-success]}]
(when (and (not @initialization) (when (and (not @initialization)
(not @derived-acc)) (not @derived-acc))
(status/multiaccount-import-mnemonic (native-module/multiaccount-import-mnemonic
"night fortune spider version version armed amused winner matter tonight cave flag" "night fortune spider version version armed amused winner matter tonight cave flag"
nil nil
(fn [result] (fn [result]
(let [{:keys [id] :as root-data} (let [{:keys [id] :as root-data}
(multiaccounts.create/normalize-multiaccount-data-keys (multiaccounts.create/normalize-multiaccount-data-keys
(types/json->clj result))] (types/json->clj result))]
(status-im.native-module.core/multiaccount-derive-addresses (native-module.core/multiaccount-derive-addresses
id id
[constants/path-wallet-root [constants/path-wallet-root
constants/path-eip1581 constants/path-eip1581
@ -266,7 +266,7 @@
(let [derived-data (multiaccounts.create/normalize-derived-data-keys (let [derived-data (multiaccounts.create/normalize-derived-data-keys
(types/json->clj result)) (types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])] public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async (native-module/gfycat-identicon-async
public-key public-key
(fn [name photo-path] (fn [name photo-path]
(let [derived-data-extended (let [derived-data-extended
@ -294,7 +294,7 @@
(if delete-multiaccount? (if delete-multiaccount?
(fn [on-deletion-success] (fn [on-deletion-success]
(js/alert "OH SHEET") (js/alert "OH SHEET")
(status/delete-multiaccount (native-module/delete-multiaccount
key-uid key-uid
(fn [result] (fn [result]
(let [{:keys [error]} (types/json->clj result)] (let [{:keys [error]} (types/json->clj result)]
@ -304,7 +304,7 @@
(fn [cb] (cb)))] (fn [cb] (cb)))]
(deletion-wrapper (deletion-wrapper
(fn [] (fn []
(status/multiaccount-store-derived (native-module/multiaccount-store-derived
id id
(:key-uid response) (:key-uid response)
[constants/path-wallet-root [constants/path-wallet-root
@ -398,14 +398,14 @@
path-num (inc (get-in @re-frame.db/app-db path-num (inc (get-in @re-frame.db/app-db
[:multiaccount :latest-derived-path])) [:multiaccount :latest-derived-path]))
path (str "m/" path-num)] path (str "m/" path-num)]
(status/multiaccount-load-account (native-module/multiaccount-load-account
wallet-root-address wallet-root-address
hashed-password hashed-password
(fn [value] (fn [value]
(let [{:keys [id error]} (types/json->clj value)] (let [{:keys [id error]} (types/json->clj value)]
(if error (if error
(re-frame/dispatch [::new-account-error :password-error error]) (re-frame/dispatch [::new-account-error :password-error error])
(status/multiaccount-derive-addresses (native-module/multiaccount-derive-addresses
id id
[path] [path]
(fn [derived] (fn [derived]
@ -413,7 +413,7 @@
(if (some (fn [a] (= derived-address (get a :address))) accounts) (if (some (fn [a] (= derived-address (get a :address))) accounts)
(re-frame/dispatch [::new-account-error :account-error (re-frame/dispatch [::new-account-error :account-error
(i18n/label :t/account-exists-title)]) (i18n/label :t/account-exists-title)])
(status/multiaccount-store-derived (native-module/multiaccount-store-derived
id id
key-uid key-uid
[path] [path]
@ -436,7 +436,7 @@
(swap! state assoc-in (swap! state assoc-in
[:application-info :key-uid] [:application-info :key-uid]
(:key-uid keys)) (:key-uid keys))
(status/multiaccount-store-derived (native-module/multiaccount-store-derived
id id
(:key-uid keys) (:key-uid keys)
[constants/path-wallet-root [constants/path-wallet-root
@ -473,7 +473,7 @@
{:account address {:account address
:password password :password password
:data (or data (str "0x" hash))})] :data (or data (str "0x" hash))})]
(status/sign-message (native-module/sign-message
params params
(fn [res] (fn [res]
(let [signature (-> res (let [signature (-> res
@ -481,7 +481,7 @@
:result :result
ethereum/normalized-hex)] ethereum/normalized-hex)]
(on-success signature))))) (on-success signature)))))
(status/sign-typed-data (native-module/sign-typed-data
data data
address address
password password
@ -498,7 +498,7 @@
(defn save-multiaccount-and-login (defn save-multiaccount-and-login
[{:keys [key-uid multiaccount-data password settings node-config accounts-data]}] [{:keys [key-uid multiaccount-data password settings node-config accounts-data]}]
(status/save-account-and-login (native-module/save-account-and-login
key-uid key-uid
(types/clj->json multiaccount-data) (types/clj->json multiaccount-data)
password password
@ -508,11 +508,11 @@
(defn login (defn login
[{:keys [key-uid multiaccount-data password]}] [{:keys [key-uid multiaccount-data password]}]
(status/login-with-config key-uid multiaccount-data password node/login-node-config)) (native-module/login-with-config key-uid multiaccount-data password node/login-node-config))
(defn send-transaction-with-signature (defn send-transaction-with-signature
[{:keys [transaction on-completed]}] [{:keys [transaction on-completed]}]
(status/send-transaction transaction account-password on-completed)) (native-module/send-transaction transaction account-password on-completed))
(defn delete-multiaccount-before-migration (defn delete-multiaccount-before-migration
[{:keys [on-success]}] [{:keys [on-success]}]

View File

@ -3,7 +3,7 @@
[quo.design-system.colors :as colors] [quo.design-system.colors :as colors]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
@ -17,7 +17,7 @@
;;; android blacklist based on device info: ;;; android blacklist based on device info:
(def deviceinfo (status/get-device-model-info)) (def deviceinfo (native-module/get-device-model-info))
;; {:model ? ;; {:model ?
;; :brand "Xiaomi" ;; :brand "Xiaomi"

View File

@ -4,7 +4,7 @@
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.bottom-sheet.events :as bottom-sheet] [status-im.bottom-sheet.events :as bottom-sheet]
[status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as native-module] [native-module.core :as native-module]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[quo2.foundations.colors :as colors] [quo2.foundations.colors :as colors]
[status-im2.constants :as constants] [status-im2.constants :as constants]

View File

@ -6,7 +6,7 @@
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55] [status-im.ethereum.eip55 :as eip55]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.node.core :as node] [status-im.node.core :as node]
[status-im2.config :as config] [status-im2.config :as config]
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -44,7 +44,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::store-multiaccount ::store-multiaccount
(fn [[id key-uid hashed-password callback]] (fn [[id key-uid hashed-password callback]]
(status/multiaccount-store-derived (native-module/multiaccount-store-derived
id id
key-uid key-uid
[constants/path-wallet-root [constants/path-wallet-root
@ -69,7 +69,7 @@
(fn [result] (fn [result]
(let [derived-data (normalize-derived-data-keys (types/json->clj result)) (let [derived-data (normalize-derived-data-keys (types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])] public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async (native-module/gfycat-identicon-async
public-key public-key
(fn [name identicon] (fn [name identicon]
(let [derived-whisper (derived-data constants/path-whisper-keyword) (let [derived-whisper (derived-data constants/path-whisper-keyword)
@ -81,7 +81,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:multiaccount-generate-and-derive-addresses :multiaccount-generate-and-derive-addresses
(fn [] (fn []
(status/multiaccount-generate-and-derive-addresses (native-module/multiaccount-generate-and-derive-addresses
5 5
12 12
[constants/path-whisper [constants/path-whisper
@ -127,7 +127,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::save-account-and-login ::save-account-and-login
(fn [[key-uid multiaccount-data hashed-password settings config accounts-data]] (fn [[key-uid multiaccount-data hashed-password settings config accounts-data]]
(status/save-account-and-login (native-module/save-account-and-login
key-uid key-uid
multiaccount-data multiaccount-data
hashed-password hashed-password

View File

@ -11,7 +11,7 @@
[status-im.multiaccounts.logout.core :as multiaccounts.logout] [status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.model :as multiaccounts.model] [status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.recover.core :as multiaccounts.recover] [status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.native-module.core :as native-module] [native-module.core :as native-module]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.types :as types] [status-im.utils.types :as types]

View File

@ -20,7 +20,7 @@
[status-im.mobile-sync-settings.core :as mobile-network] [status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric] [status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts] [status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.node.core :as node] [status-im.node.core :as node]
[status-im.notifications.core :as notifications] [status-im.notifications.core :as notifications]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
@ -58,22 +58,22 @@
(re-frame/reg-fx (re-frame/reg-fx
::login ::login
(fn [[key-uid account-data hashed-password]] (fn [[key-uid account-data hashed-password]]
(status/login-with-config key-uid account-data hashed-password node/login-node-config))) (native-module/login-with-config key-uid account-data hashed-password node/login-node-config)))
(re-frame/reg-fx (re-frame/reg-fx
::export-db ::export-db
(fn [[key-uid account-data hashed-password callback]] (fn [[key-uid account-data hashed-password callback]]
(status/export-db key-uid account-data hashed-password callback))) (native-module/export-db key-uid account-data hashed-password callback)))
(re-frame/reg-fx (re-frame/reg-fx
::import-db ::import-db
(fn [[key-uid account-data hashed-password]] (fn [[key-uid account-data hashed-password]]
(status/import-db key-uid account-data hashed-password))) (native-module/import-db key-uid account-data hashed-password)))
(re-frame/reg-fx (re-frame/reg-fx
::enable-local-notifications ::enable-local-notifications
(fn [] (fn []
(status/start-local-notifications))) (native-module/start-local-notifications)))
(re-frame/reg-fx (re-frame/reg-fx
::initialize-wallet-connect ::initialize-wallet-connect
@ -363,7 +363,7 @@
(rf/defn get-node-config (rf/defn get-node-config
[_] [_]
(status/get-node-config #(re-frame/dispatch [::get-node-config-callback %]))) (native-module/get-node-config #(re-frame/dispatch [::get-node-config-callback %])))
(rf/defn redirect-to-root (rf/defn redirect-to-root
"Decides which root should be initialised depending on user and app state" "Decides which root should be initialised depending on user and app state"

View File

@ -2,7 +2,7 @@
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.multiaccounts.core :as multiaccounts] [status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.notifications.core :as notifications] [status-im.notifications.core :as notifications]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
@ -62,4 +62,4 @@
(re-frame/reg-fx (re-frame/reg-fx
::logout ::logout
(fn [] (fn []
(status/logout))) (native-module/logout)))

View File

@ -9,7 +9,7 @@
[status-im.keycard.nfc :as nfc] [status-im.keycard.nfc :as nfc]
[status-im.multiaccounts.core :as multiaccounts] [status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.create.core :as multiaccounts.create] [status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.types :as types] [status-im.utils.types :as types]
@ -89,14 +89,14 @@
::import-multiaccount ::import-multiaccount
(fn [{:keys [passphrase password success-event]}] (fn [{:keys [passphrase password success-event]}]
(log/debug "[recover] ::import-multiaccount") (log/debug "[recover] ::import-multiaccount")
(status/multiaccount-import-mnemonic (native-module/multiaccount-import-mnemonic
passphrase passphrase
password password
(fn [result] (fn [result]
(let [{:keys [id] :as root-data} (let [{:keys [id] :as root-data}
(multiaccounts.create/normalize-multiaccount-data-keys (multiaccounts.create/normalize-multiaccount-data-keys
(types/json->clj result))] (types/json->clj result))]
(status-im.native-module.core/multiaccount-derive-addresses (native-module.core/multiaccount-derive-addresses
id id
[constants/path-wallet-root [constants/path-wallet-root
constants/path-eip1581 constants/path-eip1581
@ -106,7 +106,7 @@
(let [derived-data (multiaccounts.create/normalize-derived-data-keys (let [derived-data (multiaccounts.create/normalize-derived-data-keys
(types/json->clj result)) (types/json->clj result))
public-key (get-in derived-data [constants/path-whisper-keyword :public-key])] public-key (get-in derived-data [constants/path-whisper-keyword :public-key])]
(status/gfycat-identicon-async (native-module/gfycat-identicon-async
public-key public-key
(fn [name identicon] (fn [name identicon]
(let [derived-data-extended (let [derived-data-extended

View File

@ -2,7 +2,7 @@
(:require [clojure.string :as string] (:require [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.popover.core :as popover] [status-im.popover.core :as popover]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
@ -59,7 +59,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::change-db-password ::change-db-password
(fn [[key-uid {:keys [current-password new-password]}]] (fn [[key-uid {:keys [current-password new-password]}]]
(status/reset-password (native-module/reset-password
key-uid key-uid
(ethereum/sha3 (security/safe-unmask-data current-password)) (ethereum/sha3 (security/safe-unmask-data current-password))
(ethereum/sha3 (security/safe-unmask-data new-password)) (ethereum/sha3 (security/safe-unmask-data new-password))
@ -88,9 +88,9 @@
::validate-current-password-and-reset ::validate-current-password-and-reset
(fn [{:keys [address current-password] :as form-vals}] (fn [{:keys [address current-password] :as form-vals}]
(let [hashed-pass (ethereum/sha3 (security/safe-unmask-data current-password))] (let [hashed-pass (ethereum/sha3 (security/safe-unmask-data current-password))]
(status/verify address (native-module/verify address
hashed-pass hashed-pass
(partial handle-verification form-vals))))) (partial handle-verification form-vals)))))
(rf/defn reset (rf/defn reset
{:events [::reset]} {:events [::reset]}

View File

@ -2,7 +2,7 @@
(:require ["@react-native-community/netinfo" :default net-info] (:require ["@react-native-community/netinfo" :default net-info]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.mobile-sync-settings.core :as mobile-network] [status-im.mobile-sync-settings.core :as mobile-network]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.wallet.core :as wallet] [status-im.wallet.core :as wallet]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -59,4 +59,4 @@
(re-frame/reg-fx (re-frame/reg-fx
:network/notify-status-go :network/notify-status-go
(fn [[network-type expensive?]] (fn [[network-type expensive?]]
(status/connection-change network-type expensive?))) (native-module/connection-change network-type expensive?)))

View File

@ -1,6 +1,6 @@
(ns status-im.node.core (ns status-im.node.core
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im2.config :as config] [status-im2.config :as config]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as utils.platform] [status-im.utils.platform :as utils.platform]
@ -221,4 +221,4 @@ app-db"
(re-frame/reg-fx (re-frame/reg-fx
::prepare-new-config ::prepare-new-config
(fn [[key-uid config callback]] (fn [[key-uid config callback]]
(status/prepare-dir-and-update-config key-uid config callback))) (native-module/prepare-dir-and-update-config key-uid config callback)))

View File

@ -11,9 +11,9 @@
[status-im.notifications.android :as pn-android] [status-im.notifications.android :as pn-android]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.money :as money] [status-im.utils.money :as money]
[status-im.utils.react-native :as react-native-utils]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.utils.utils :as utils])) [status-im.utils.utils :as utils]
[react-native.core :as rn]))
(def default-erc20-token (def default-erc20-token
{:symbol :ERC20 {:symbol :ERC20
@ -56,7 +56,7 @@
(fn [notification] (fn [notification]
(handle-notification-press {:userInfo (bean/bean (.getData ^js (handle-notification-press {:userInfo (bean/bean (.getData ^js
notification))}))) notification))})))
(.addListener ^js react-native-utils/device-event-emitter (.addListener ^js rn/device-event-emitter
notification-event-android notification-event-android
(fn [^js data] (fn [^js data]
(when (and data (.-dataJSON data)) (when (and data (.-dataJSON data))

View File

@ -9,9 +9,9 @@
[status-im.ethereum.eip681 :as eip681] [status-im.ethereum.eip681 :as eip681]
[status-im.ethereum.ens :as ens] [status-im.ethereum.ens :as ens]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.ethereum.stateofus :as stateofus] [status-im.ethereum.stateofus :as stateofus]
[status-im2.utils.validators :as validators] [utils.validators :as validators]
[status-im.utils.http :as http] [status-im.utils.http :as http]
[status-im.utils.wallet-connect :as wallet-connect] [status-im.utils.wallet-connect :as wallet-connect]
[taoensso.timbre :as log] [taoensso.timbre :as log]
@ -83,8 +83,9 @@
:ens-name ens-name}) :ens-name ens-name})
valid-compressed-key? valid-compressed-key?
(status/compressed-key->public-key (native-module/compressed-key->public-key
user-id user-id
constants/deserialization-key
(fn [response] (fn [response]
(let [{:keys [error]} (types/json->clj response)] (let [{:keys [error]} (types/json->clj response)]
(when-not error (when-not error

View File

@ -9,7 +9,7 @@
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.keycard.card :as keycard.card] [status-im.keycard.card :as keycard.card]
[status-im.keycard.common :as keycard.common] [status-im.keycard.common :as keycard.common]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.signing.eip1559 :as eip1559] [status-im.signing.eip1559 :as eip1559]
[status-im.signing.keycard :as signing.keycard] [status-im.signing.keycard :as signing.keycard]
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -26,9 +26,9 @@
(re-frame/reg-fx (re-frame/reg-fx
:signing/send-transaction-fx :signing/send-transaction-fx
(fn [{:keys [tx-obj hashed-password cb]}] (fn [{:keys [tx-obj hashed-password cb]}]
(status/send-transaction (types/clj->json tx-obj) (native-module/send-transaction (types/clj->json tx-obj)
hashed-password hashed-password
cb))) cb)))
(re-frame/reg-fx (re-frame/reg-fx
:signing/show-transaction-error :signing/show-transaction-error
@ -43,21 +43,21 @@
(re-frame/reg-fx (re-frame/reg-fx
:signing.fx/sign-message :signing.fx/sign-message
(fn [{:keys [params on-completed]}] (fn [{:keys [params on-completed]}]
(status/sign-message (types/clj->json params) (native-module/sign-message (types/clj->json params)
on-completed))) on-completed)))
(re-frame/reg-fx (re-frame/reg-fx
:signing.fx/recover-message :signing.fx/recover-message
(fn [{:keys [params on-completed]}] (fn [{:keys [params on-completed]}]
(status/recover-message (types/clj->json params) (native-module/recover-message (types/clj->json params)
on-completed))) on-completed)))
(re-frame/reg-fx (re-frame/reg-fx
:signing.fx/sign-typed-data :signing.fx/sign-typed-data
(fn [{:keys [v4 data account on-completed hashed-password]}] (fn [{:keys [v4 data account on-completed hashed-password]}]
(if v4 (if v4
(status/sign-typed-data-v4 data account hashed-password on-completed) (native-module/sign-typed-data-v4 data account hashed-password on-completed)
(status/sign-typed-data data account hashed-password on-completed)))) (native-module/sign-typed-data data account hashed-password on-completed))))
(defn get-contact (defn get-contact
[db to] [db to]
@ -109,18 +109,18 @@
(sign-message cofx) (sign-message cofx)
(let [tx-obj-to-send (merge tx-obj (let [tx-obj-to-send (merge tx-obj
(when gas (when gas
{:gas (str "0x" (status/number-to-hex gas))}) {:gas (str "0x" (native-module/number-to-hex gas))})
(when gasPrice (when gasPrice
{:gasPrice (str "0x" (status/number-to-hex gasPrice))}) {:gasPrice (str "0x" (native-module/number-to-hex gasPrice))})
(when nonce (when nonce
{:nonce (str "0x" (status/number-to-hex nonce))}) {:nonce (str "0x" (native-module/number-to-hex nonce))})
(when maxPriorityFeePerGas (when maxPriorityFeePerGas
{:maxPriorityFeePerGas (str "0x" {:maxPriorityFeePerGas (str "0x"
(status/number-to-hex (native-module/number-to-hex
(js/parseInt maxPriorityFeePerGas)))}) (js/parseInt maxPriorityFeePerGas)))})
(when maxFeePerGas (when maxFeePerGas
{:maxFeePerGas (str "0x" {:maxFeePerGas (str "0x"
(status/number-to-hex (native-module/number-to-hex
(js/parseInt maxFeePerGas)))}))] (js/parseInt maxFeePerGas)))}))]
(when-not in-progress? (when-not in-progress?
{:db (update db :signing/sign assoc :error nil :in-progress? true) {:db (update db :signing/sign assoc :error nil :in-progress? true)
@ -184,7 +184,7 @@
(let [{:keys [symbol decimals] :as token} (tokens/address->token (:wallet/all-tokens db) to)] (let [{:keys [symbol decimals] :as token} (tokens/address->token (:wallet/all-tokens db) to)]
(when (and token data (string? data)) (when (and token data (string? data))
(when-let [type (get-method-type data)] (when-let [type (get-method-type data)]
(let [[address value _] (status/decode-parameters (let [[address value _] (native-module/decode-parameters
(str "0x" (subs data 10)) (str "0x" (subs data 10))
(if (= type :approve-and-call) (if (= type :approve-and-call)
["address" "uint256" "bytes"] ["address" "uint256" "bytes"]
@ -476,7 +476,7 @@
{:events [:wallet.ui/sign-transaction-button-clicked-from-chat]} {:events [:wallet.ui/sign-transaction-button-clicked-from-chat]}
[{:keys [db] :as cofx} {:keys [to amount from token]}] [{:keys [db] :as cofx} {:keys [to amount from token]}]
(let [{:keys [symbol address]} token (let [{:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount)) amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to))) to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from) from-address (:address from)
identity (:current-chat-id db) identity (:current-chat-id db)
@ -495,7 +495,7 @@
:from from-address :from from-address
:chat-id identity :chat-id identity
:command? true :command? true
:data (status/encode-transfer to-norm amount-hex)})})) :data (native-module/encode-transfer to-norm amount-hex)})}))
{:db db {:db db
:json-rpc/call :json-rpc/call
[{:method "wakuext_requestAddressForTransaction" [{:method "wakuext_requestAddressForTransaction"
@ -512,7 +512,7 @@
[{:keys [db] :as cofx} {:keys [amount from token]}] [{:keys [db] :as cofx} {:keys [amount from token]}]
(let [{:keys [request-parameters chat-id]} (:wallet/prepare-transaction db) (let [{:keys [request-parameters chat-id]} (:wallet/prepare-transaction db)
{:keys [symbol address]} token {:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount)) amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (:address request-parameters) to-norm (:address request-parameters)
from-address (:address from)] from-address (:address from)]
(rf/merge cofx (rf/merge cofx
@ -532,13 +532,13 @@
:command? true :command? true
:message-id (:id request-parameters) :message-id (:id request-parameters)
:chat-id chat-id :chat-id chat-id
:data (status/encode-transfer to-norm amount-hex)})}))))) :data (native-module/encode-transfer to-norm amount-hex)})})))))
(rf/defn sign-transaction-button-clicked (rf/defn sign-transaction-button-clicked
{:events [:wallet.ui/sign-transaction-button-clicked]} {:events [:wallet.ui/sign-transaction-button-clicked]}
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice maxFeePerGas maxPriorityFeePerGas]}] [{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice maxFeePerGas maxPriorityFeePerGas]}]
(let [{:keys [symbol address]} token (let [{:keys [symbol address]} token
amount-hex (str "0x" (status/number-to-hex amount)) amount-hex (str "0x" (native-module/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to))) to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from)] from-address (:address from)]
(rf/merge cofx (rf/merge cofx
@ -558,7 +558,7 @@
{:to to-norm {:to to-norm
:value amount-hex} :value amount-hex}
{:to (ethereum/normalized-hex address) {:to (ethereum/normalized-hex address)
:data (status/encode-transfer to-norm amount-hex)}))})))) :data (native-module/encode-transfer to-norm amount-hex)}))}))))
(re-frame/reg-fx (re-frame/reg-fx
:signing/get-transaction-by-hash-fx :signing/get-transaction-by-hash-fx

View File

@ -1,15 +1,15 @@
(ns status-im.signing.core-test (ns status-im.signing.core-test
(:require [cljs.test :refer-macros [deftest is testing]] (:require [cljs.test :refer-macros [deftest is testing]]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.signing.core :as signing])) [status-im.signing.core :as signing]))
(deftest signing-test (deftest signing-test
(testing "showing sheet" (testing "showing sheet"
(let [to "0x2f88d65f3cb52605a54a833ae118fb1363acccd2" (let [to "0x2f88d65f3cb52605a54a833ae118fb1363acccd2"
contract "0xc55cf4b03948d7ebc8b9e8bad92643703811d162" contract "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
amount1-hex (str "0x" (status/number-to-hex "10000000000000000000")) amount1-hex (str "0x" (native-module/number-to-hex "10000000000000000000"))
amount2-hex (str "0x" (status/number-to-hex "100000000000000000000")) amount2-hex (str "0x" (native-module/number-to-hex "100000000000000000000"))
data (status/encode-transfer to amount2-hex) data (native-module/encode-transfer to amount2-hex)
first-tx {:tx-obj {:to to first-tx {:tx-obj {:to to
:from nil :from nil
:value amount1-hex}} :value amount1-hex}}

View File

@ -1,7 +1,7 @@
(ns status-im.signing.keycard (ns status-im.signing.keycard
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -9,19 +9,19 @@
(re-frame/reg-fx (re-frame/reg-fx
::hash-transaction ::hash-transaction
(fn [{:keys [transaction on-completed]}] (fn [{:keys [transaction on-completed]}]
(status/hash-transaction (types/clj->json transaction) on-completed))) (native-module/hash-transaction (types/clj->json transaction) on-completed)))
(re-frame/reg-fx (re-frame/reg-fx
::hash-message ::hash-message
(fn [{:keys [message on-completed]}] (fn [{:keys [message on-completed]}]
(status/hash-message message on-completed))) (native-module/hash-message message on-completed)))
(re-frame/reg-fx (re-frame/reg-fx
::hash-typed-data ::hash-typed-data
(fn [{:keys [v4 data on-completed]}] (fn [{:keys [v4 data on-completed]}]
(if v4 (if v4
(status/hash-typed-data-v4 data on-completed) (native-module/hash-typed-data-v4 data on-completed)
(status/hash-typed-data data on-completed)))) (native-module/hash-typed-data data on-completed))))
(defn prepare-transaction (defn prepare-transaction
[{:keys [gas gasPrice data nonce tx-obj] :as params}] [{:keys [gas gasPrice data nonce tx-obj] :as params}]
@ -37,17 +37,17 @@
maxPriorityFeePerGas maxPriorityFeePerGas
(assoc :maxPriorityFeePerGas (assoc :maxPriorityFeePerGas
(str "0x" (str "0x"
(status/number-to-hex (native-module/number-to-hex
(js/parseInt maxPriorityFeePerGas)))) (js/parseInt maxPriorityFeePerGas))))
maxFeePerGas maxFeePerGas
(assoc :maxFeePerGas (assoc :maxFeePerGas
(str "0x" (str "0x"
(status/number-to-hex (native-module/number-to-hex
(js/parseInt maxFeePerGas)))) (js/parseInt maxFeePerGas))))
gas gas
(assoc :gas (str "0x" (status/number-to-hex gas))) (assoc :gas (str "0x" (native-module/number-to-hex gas)))
gasPrice gasPrice
(assoc :gasPrice (str "0x" (status/number-to-hex gasPrice))) (assoc :gasPrice (str "0x" (native-module/number-to-hex gasPrice)))
data data
(assoc :data data) (assoc :data data)
nonce nonce

View File

@ -20,7 +20,7 @@
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.ui.components.topbar :as topbar] [status-im.ui.components.topbar :as topbar]
[status-im.ui.screens.chat.photos :as photos] [status-im.ui.screens.chat.photos :as photos]
[status-im2.utils.validators :as validators] [utils.validators :as validators]
[status-im.utils.gfycat.core :as gfycat] [status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon] [status-im.utils.identicon :as identicon]
[status-im.utils.utils :as utils] [status-im.utils.utils :as utils]

View File

@ -2,7 +2,7 @@
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im.ethereum.decode :as decode] [status-im.ethereum.decode :as decode]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im2.common.json-rpc.events :as json-rpc] [status-im2.common.json-rpc.events :as json-rpc]
[utils.datetime :as datetime])) [utils.datetime :as datetime]))
@ -36,7 +36,7 @@
(reset! latest-block res) (reset! latest-block res)
(get-block (get-block
(str "0x" (str "0x"
(status/number-to-hex (native-module/number-to-hex
(last-loaded-block-number))) (last-loaded-block-number)))
(fn [res] (fn [res]
(reset! last-loaded-block res))))))] (reset! last-loaded-block res))))))]

View File

@ -3,7 +3,7 @@
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[taoensso.timbre :as log] [taoensso.timbre :as log]
@ -21,7 +21,7 @@
(-> masked-password (-> masked-password
security/safe-unmask-data security/safe-unmask-data
ethereum/sha3)] ethereum/sha3)]
(status/verify (native-module/verify
address address
hashed-password hashed-password
(fn [result] (fn [result]
@ -29,7 +29,7 @@
(log/info "[delete-profile] verify-password" result error) (log/info "[delete-profile] verify-password" result error)
(if-not (safe-blank? error) (if-not (safe-blank? error)
(callback :wrong-password nil) (callback :wrong-password nil)
(status/delete-multiaccount (native-module/delete-multiaccount
key-uid key-uid
(fn [result] (fn [result]
(let [{:keys [error]} (types/json->clj result)] (let [{:keys [error]} (types/json->clj result)]

View File

@ -1,6 +1,5 @@
(ns status-im.utils.gfycat.core (ns status-im.utils.gfycat.core
(:require [re-frame.core :as re-frame] (:require [native-module.core :as native-module]))
[status-im.native-module.core :as native-module]))
(def unknown-gfy "Unknown") (def unknown-gfy "Unknown")
@ -12,13 +11,3 @@
(native-module/generate-gfycat public-key))) (native-module/generate-gfycat public-key)))
(def generate-gfy (memoize build-gfy)) (def generate-gfy (memoize build-gfy))
(re-frame/reg-fx
:insert-gfycats
(fn [key-path-seq]
(for [key-path key-path-seq]
(let [public-key (first key-path)
path-for-gfycat (second key-path)]
(native-module/generate-gfycat-async public-key
#(re-frame/dispatch [:gfycat-generated path-for-gfycat
%]))))))

View File

@ -1,15 +1,4 @@
(ns status-im.utils.identicon (ns status-im.utils.identicon
(:require [re-frame.core :as re-frame] (:require [native-module.core :as native-module]))
[status-im.native-module.core :as native-module]))
(def identicon (memoize native-module/identicon)) (def identicon (memoize native-module/identicon))
(def identicon-async native-module/identicon-async)
(re-frame/reg-fx
:insert-identicons
(fn [key-path-seq]
(for [key-path key-path-seq]
(let [public-key (first key-path)
path-for-identicon (second key-path)]
(identicon-async public-key #(re-frame/dispatch [:identicon-generated path-for-identicon %]))))))

View File

@ -2,7 +2,7 @@
(:require ["react-native-keychain" :as react-native-keychain] (:require ["react-native-keychain" :as react-native-keychain]
[clojure.string :as string] [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[taoensso.timbre :as log] [taoensso.timbre :as log]
@ -63,7 +63,7 @@
;; Android only ;; Android only
(defn- device-not-rooted? (defn- device-not-rooted?
[callback] [callback]
(status/rooted-device? (fn [rooted?] (callback (not rooted?))))) (native-module/rooted-device? (fn [rooted?] (callback (not rooted?)))))
;; Android only ;; Android only
(defn- secure-hardware-available? (defn- secure-hardware-available?

View File

@ -5,7 +5,7 @@
[react-native.mail :as react-native-mail] [react-native.mail :as react-native-mail]
[status-im.bottom-sheet.events :as bottom-sheet] [status-im.bottom-sheet.events :as bottom-sheet]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.transport.utils :as transport.utils] [status-im.transport.utils :as transport.utils]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.utils.build :as build] [status-im.utils.build :as build]
@ -20,7 +20,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:logs/archive-logs :logs/archive-logs
(fn [[db-json callback-handler]] (fn [[db-json callback-handler]]
(status/send-logs (native-module/send-logs
db-json db-json
(string/join "\n" (log/get-logs-queue)) (string/join "\n" (log/get-logs-queue))
#(re-frame/dispatch [callback-handler %])))) #(re-frame/dispatch [callback-handler %]))))

View File

@ -1,8 +0,0 @@
(ns status-im.utils.react-native
(:require ["react-native" :as react-native]))
; Moved from status-im.ui.components.react(let's short for R), so status-im.native-module.core(short for
; N) don't need to have a dependency to R.
; We should keep N's dependencies as simple as possible, otherwise we may see issue like:
; Circular dependency detected: N -> R -> status-im.utils.utils -> status-im.ethereum.eip55 -> N
(def device-event-emitter (.-DeviceEventEmitter react-native))

View File

@ -15,7 +15,7 @@
[status-im.wallet.choose-recipient.core :as choose-recipient] [status-im.wallet.choose-recipient.core :as choose-recipient]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[status-im.native-module.core :as status])) [native-module.core :as native-module]))
;; TODO(yenda) investigate why `handle-universal-link` event is ;; TODO(yenda) investigate why `handle-universal-link` event is
;; dispatched 7 times for the same link ;; dispatched 7 times for the same link
@ -88,7 +88,7 @@
(rf/defn handle-desktop-community (rf/defn handle-desktop-community
[cofx {:keys [community-id]}] [cofx {:keys [community-id]}]
(status/deserialize-and-compress-key (native-module/deserialize-and-compress-key
community-id community-id
(fn [deserialized-key] (fn [deserialized-key]
(rf/dispatch [:handle-navigation-to-desktop-community-from-mobile cofx (str deserialized-key)])))) (rf/dispatch [:handle-navigation-to-desktop-community-from-mobile cofx (str deserialized-key)]))))

View File

@ -14,7 +14,7 @@
[status-im.multiaccounts.core :as multiaccounts] [status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.key-storage.core :as key-storage] [status-im.multiaccounts.key-storage.core :as key-storage]
[status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.ui.components.list-selection :as list-selection] [status-im.ui.components.list-selection :as list-selection]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im.utils.hex :as hex] [status-im.utils.hex :as hex]
@ -74,7 +74,7 @@
(let [{:keys [id error]} (types/json->clj value)] (let [{:keys [id error]} (types/json->clj value)]
(if error (if error
(re-frame/dispatch [::new-account-error :password-error error]) (re-frame/dispatch [::new-account-error :password-error error])
(status/multiaccount-derive-addresses (native-module/multiaccount-derive-addresses
id id
[path] [path]
(fn [derived] (fn [derived]
@ -82,7 +82,7 @@
(if (some #(= derived-address (get % :address)) accounts) (if (some #(= derived-address (get % :address)) accounts)
(re-frame/dispatch [::new-account-error :account-error (re-frame/dispatch [::new-account-error :account-error
(i18n/label :t/account-exists-title)]) (i18n/label :t/account-exists-title)])
(status/multiaccount-store-derived (native-module/multiaccount-store-derived
id id
key-uid key-uid
[path] [path]
@ -110,7 +110,7 @@
(re-frame/dispatch [::new-account-error (re-frame/dispatch [::new-account-error
(if (= error pass-error) :password-error :account-error) (if (= error pass-error) :password-error :account-error)
error]) error])
(status/multiaccount-store-account (native-module/multiaccount-store-account
id id
key-uid key-uid
hashed-password hashed-password
@ -119,7 +119,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::verify-password ::verify-password
(fn [{:keys [address hashed-password]}] (fn [{:keys [address hashed-password]}]
(status/verify (native-module/verify
address address
hashed-password hashed-password
#(re-frame/dispatch [:wallet.accounts/add-new-account-password-verifyied % hashed-password])))) #(re-frame/dispatch [:wallet.accounts/add-new-account-password-verifyied % hashed-password]))))
@ -128,7 +128,7 @@
::generate-account ::generate-account
(fn [{:keys [derivation-info hashed-password accounts key-uid]}] (fn [{:keys [derivation-info hashed-password accounts key-uid]}]
(let [{:keys [address path]} derivation-info] (let [{:keys [address path]} derivation-info]
(status/multiaccount-load-account (native-module/multiaccount-load-account
address address
hashed-password hashed-password
(derive-and-store-account key-uid path hashed-password :generated accounts))))) (derive-and-store-account key-uid path hashed-password :generated accounts)))))
@ -136,7 +136,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::import-account-seed ::import-account-seed
(fn [{:keys [passphrase hashed-password accounts key-uid]}] (fn [{:keys [passphrase hashed-password accounts key-uid]}]
(status/multiaccount-import-mnemonic (native-module/multiaccount-import-mnemonic
(mnemonic/sanitize-passphrase (security/unmask passphrase)) (mnemonic/sanitize-passphrase (security/unmask passphrase))
"" ""
(derive-and-store-account key-uid constants/path-default-wallet hashed-password :seed accounts)))) (derive-and-store-account key-uid constants/path-default-wallet hashed-password :seed accounts))))
@ -144,7 +144,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::import-account-private-key ::import-account-private-key
(fn [{:keys [private-key hashed-password key-uid]}] (fn [{:keys [private-key hashed-password key-uid]}]
(status/multiaccount-import-private-key (native-module/multiaccount-import-private-key
(string/trim (security/unmask private-key)) (string/trim (security/unmask private-key))
(store-account key-uid constants/path-default-wallet hashed-password :key)))) (store-account key-uid constants/path-default-wallet hashed-password :key))))

View File

@ -2,7 +2,7 @@
(:require [clojure.string :as string] (:require [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[react-native.background-timer :as background-timer] [react-native.background-timer :as background-timer]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.transforms :as transforms])) [utils.transforms :as transforms]))
@ -29,7 +29,7 @@
on-error (or on-error on-error (or on-error
(on-error-retry call arg) (on-error-retry call arg)
#(log/warn :json-rpc/error method :error % :params params))] #(log/warn :json-rpc/error method :error % :params params))]
(status/call-private-rpc (native-module/call-private-rpc
(transforms/clj->json {:jsonrpc "2.0" (transforms/clj->json {:jsonrpc "2.0"
:id 1 :id 1
:method method :method method

View File

@ -6,11 +6,12 @@
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens] [status-im.ethereum.ens :as ens]
[status-im.ethereum.stateofus :as stateofus] [status-im.ethereum.stateofus :as stateofus]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[status-im2.utils.validators :as validators] [utils.validators :as validators]
[status-im2.contexts.contacts.events :as data-store.contacts] [status-im2.contexts.contacts.events :as data-store.contacts]
[status-im.utils.utils :as utils])) [status-im.utils.utils :as utils]
[status-im2.constants :as constants]))
(defn init-contact (defn init-contact
"Create a new contact (persisted to app-db as [:contacts/new-identity]). "Create a new contact (persisted to app-db as [:contacts/new-identity]).
@ -124,8 +125,9 @@
(re-frame/reg-fx (re-frame/reg-fx
:contacts/decompress-public-key :contacts/decompress-public-key
(fn [{:keys [compressed-key on-success on-error]}] (fn [{:keys [compressed-key on-success on-error]}]
(status/compressed-key->public-key (native-module/compressed-key->public-key
compressed-key compressed-key
constants/deserialization-key
(fn [resp] (fn [resp]
(let [{:keys [error]} (types/json->clj resp)] (let [{:keys [error]} (types/json->clj resp)]
(if error (if error

View File

@ -2,7 +2,7 @@
(:require [quo2.core :as quo] (:require [quo2.core :as quo]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[status-im2.utils.message-resolver :as resolver])) [status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
(defn banner (defn banner
[chat-id] [chat-id]

View File

@ -1,4 +1,4 @@
(ns status-im2.utils.message-resolver (ns status-im2.contexts.chat.messages.resolver.message-resolver
(:require [utils.re-frame :as rf])) (:require [utils.re-frame :as rf]))
(defn resolve-message (defn resolve-message

View File

@ -1,5 +1,5 @@
(ns status-im2.utils.message-resolver-test (ns status-im2.contexts.chat.messages.resolver.message-resolver-test
(:require [status-im2.utils.message-resolver :as resolver] (:require [status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]
[cljs.test :as t] [cljs.test :as t]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))

View File

@ -8,7 +8,7 @@
[clojure.string :as string] [clojure.string :as string]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.security.core :as security] [utils.security.core :as security]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im2.constants :as constants] [status-im2.constants :as constants]
[status-im2.contexts.onboarding.profiles.view :as profiles.view])) [status-im2.contexts.onboarding.profiles.view :as profiles.view]))
@ -16,12 +16,12 @@
(re-frame/reg-fx (re-frame/reg-fx
:multiaccount/create-account-and-login :multiaccount/create-account-and-login
(fn [request] (fn [request]
(status/create-account-and-login request))) (native-module/create-account-and-login request)))
(re-frame/reg-fx (re-frame/reg-fx
:multiaccount/validate-mnemonic :multiaccount/validate-mnemonic
(fn [[mnemonic on-success on-error]] (fn [[mnemonic on-success on-error]]
(status/validate-mnemonic (native-module/validate-mnemonic
(security/safe-unmask-data mnemonic) (security/safe-unmask-data mnemonic)
(fn [result] (fn [result]
(let [{:keys [error keyUID]} (types/json->clj result)] (let [{:keys [error keyUID]} (types/json->clj result)]
@ -32,7 +32,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:multiaccount/restore-account-and-login :multiaccount/restore-account-and-login
(fn [request] (fn [request]
(status/restore-account-and-login request))) (native-module/restore-account-and-login request)))
(rf/defn profile-data-set (rf/defn profile-data-set
{:events [:onboarding-2/profile-data-set]} {:events [:onboarding-2/profile-data-set]}
@ -86,14 +86,14 @@
(security/safe-unmask-data seed-phrase)) (security/safe-unmask-data seed-phrase))
:imagePath (strip-file-prefix image-path) :imagePath (strip-file-prefix image-path)
:customizationColor color :customizationColor color
:backupDisabledDataDir (status/backup-disabled-data-dir) :backupDisabledDataDir (native-module/backup-disabled-data-dir)
:rootKeystoreDir (status/keystore-dir) :rootKeystoreDir (native-module/keystore-dir)
;; Temporary fix until https://github.com/status-im/status-go/issues/3024 is ;; Temporary fix until https://github.com/status-im/status-go/issues/3024 is
;; resolved ;; resolved
:wakuV2Nameserver "1.1.1.1" :wakuV2Nameserver "1.1.1.1"
:logLevel (when log-enabled? config/log-level) :logLevel (when log-enabled? config/log-level)
:logEnabled log-enabled? :logEnabled log-enabled?
:logFilePath (status/log-file-directory) :logFilePath (native-module/log-file-directory)
:openseaAPIKey config/opensea-api-key :openseaAPIKey config/opensea-api-key
:verifyTransactionURL config/verify-transaction-url :verifyTransactionURL config/verify-transaction-url
:verifyENSURL config/verify-ens-url :verifyENSURL config/verify-ens-url

View File

@ -7,7 +7,7 @@
[react-native.core :as rn] [react-native.core :as rn]
[utils.transforms :as types] [utils.transforms :as types]
[utils.security.core :as security] [utils.security.core :as security]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im2.contexts.onboarding.profiles.style :as style] [status-im2.contexts.onboarding.profiles.style :as style]
[status-im2.common.confirmation-drawer.view :as confirmation-drawer] [status-im2.common.confirmation-drawer.view :as confirmation-drawer]
[status-im2.contexts.onboarding.common.background.view :as background])) [status-im2.contexts.onboarding.common.background.view :as background]))
@ -45,7 +45,7 @@
:close-button-text (i18n/label :t/cancel) :close-button-text (i18n/label :t/cancel)
:on-press #(do :on-press #(do
(rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:hide-bottom-sheet])
(status/delete-multiaccount (native-module/delete-multiaccount
key-uid key-uid
(fn [result] (fn [result]
(let [{:keys [error]} (types/json->clj result)] (let [{:keys [error]} (types/json->clj result)]

View File

@ -8,7 +8,7 @@
[status-im2.constants :as constants] [status-im2.constants :as constants]
[status-im2.contexts.shell.cards.style :as style] [status-im2.contexts.shell.cards.style :as style]
[status-im2.contexts.shell.constants :as shell.constants] [status-im2.contexts.shell.constants :as shell.constants]
[status-im2.utils.message-resolver :as resolver])) [status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
(defn content-container (defn content-container
[type [type

View File

@ -1,5 +1,5 @@
(ns status-im2.contexts.syncing.events (ns status-im2.contexts.syncing.events
(:require [status-im.native-module.core :as status] (:require [native-module.core :as native-module]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.security.core :as security] [utils.security.core :as security]
@ -51,13 +51,13 @@
:settingCurrentNetwork config/default-network :settingCurrentNetwork config/default-network
:deviceType utils.platform/os}}))] :deviceType utils.platform/os}}))]
(rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver]) (rf/dispatch [:syncing/update-role constants/local-pairing-role-receiver])
(status/input-connection-string-for-bootstrapping (native-module/input-connection-string-for-bootstrapping
connection-string connection-string
config-map config-map
#(log/info "Initiated local pairing" #(log/info "Initiated local pairing"
{:response % {:response %
:event :syncing/input-connection-string-for-bootstrapping}))))] :event :syncing/input-connection-string-for-bootstrapping}))))]
(status/prepare-dir-and-update-config "" default-node-config-string callback))) (native-module/prepare-dir-and-update-config "" default-node-config-string callback)))
(rf/defn preparations-for-connection-string (rf/defn preparations-for-connection-string
{:events [:syncing/get-connection-string-for-bootstrapping-another-device]} {:events [:syncing/get-connection-string-for-bootstrapping-another-device]}
@ -68,7 +68,7 @@
(rf/dispatch [:syncing/update-role constants/local-pairing-role-sender]) (rf/dispatch [:syncing/update-role constants/local-pairing-role-sender])
(rf/dispatch [:bottom-sheet/hide]))] (rf/dispatch [:bottom-sheet/hide]))]
(if valid-password? (if valid-password?
(let [sha3-pwd (status/sha3 (str (security/safe-unmask-data entered-password))) (let [sha3-pwd (native-module/sha3 (str (security/safe-unmask-data entered-password)))
key-uid (get-in db [:multiaccount :key-uid]) key-uid (get-in db [:multiaccount :key-uid])
config-map (.stringify js/JSON config-map (.stringify js/JSON
(clj->js {:senderConfig {:keyUID key-uid (clj->js {:senderConfig {:keyUID key-uid
@ -76,7 +76,7 @@
:password sha3-pwd :password sha3-pwd
:deviceType utils.platform/os} :deviceType utils.platform/os}
:serverConfig {:timeout 0}}))] :serverConfig {:timeout 0}}))]
(status/get-connection-string-for-bootstrapping-another-device (native-module/get-connection-string-for-bootstrapping-another-device
config-map config-map
#(show-sheet %))) #(show-sheet %)))
(show-sheet "")))) (show-sheet ""))))

View File

@ -15,7 +15,7 @@
[status-im2.setup.global-error :as global-error] [status-im2.setup.global-error :as global-error]
[status-im2.common.log :as log] [status-im2.common.log :as log]
[status-im.async-storage.core :as async-storage] [status-im.async-storage.core :as async-storage]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.notifications.local :as notifications] [status-im.notifications.local :as notifications]
[status-im.utils.universal-links.core :as utils.universal-links] [status-im.utils.universal-links.core :as utils.universal-links]
status-im.events status-im.events
@ -27,12 +27,15 @@
(set! interop/next-tick js/setTimeout) (set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0)) (set! batching/fake-raf #(js/setTimeout % 0))
(def adjust-resize 16)
(defn init (defn init
[] []
(native-module/init #(re-frame/dispatch [:signals/signal-received %]))
(when platform/android?
(native-module/set-soft-input-mode adjust-resize))
(log/setup config/log-level) (log/setup config/log-level)
(global-error/register-handler) (global-error/register-handler)
(when platform/android?
(status/set-soft-input-mode status/adjust-resize))
(notifications/listen-notifications) (notifications/listen-notifications)
(.addEventListener rn/app-state "change" #(re-frame/dispatch [:app-state-change %])) (.addEventListener rn/app-state "change" #(re-frame/dispatch [:app-state-change %]))
(react-native-languages/add-change-listener #(fn [lang] (react-native-languages/add-change-listener #(fn [lang]

View File

@ -2,7 +2,7 @@
(:require [clojure.string :as string] (:require [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.multiaccounts.login.core :as multiaccounts.login] [status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status] [native-module.core :as native-module]
[status-im.utils.keychain.core :as keychain] [status-im.utils.keychain.core :as keychain]
[status-im2.common.json-rpc.events] [status-im2.common.json-rpc.events]
[status-im2.common.theme.core :as theme] [status-im2.common.theme.core :as theme]
@ -25,7 +25,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:setup/open-multiaccounts :setup/open-multiaccounts
(fn [callback] (fn [callback]
(status/open-accounts callback))) (native-module/open-accounts callback)))
(re-frame/reg-fx (re-frame/reg-fx
:setup/init-theme :setup/init-theme

View File

@ -1,4 +1,4 @@
(ns status-im2.utils.validators) (ns utils.validators)
(defn valid-public-key? (defn valid-public-key?
[s] [s]

View File

@ -1,6 +1,6 @@
(ns status-im2.utils.validators-test (ns utils.validators-test
(:require [cljs.test :refer-macros [deftest testing is]] (:require [cljs.test :refer-macros [deftest testing is]]
[status-im2.utils.validators :refer [valid-compressed-key?]])) [utils.validators :refer [valid-compressed-key?]]))
(deftest test-valid-compressed-key (deftest test-valid-compressed-key
(testing "valid" (testing "valid"