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/sorted-ranges
status-im.ethereum.mnemonic/words->passphrase
status-im.native-module.core/listener
status-im.native-module.core/multiaccount-reset
status-im.native-module.core/extract-group-membership-signatures
status-im.native-module.core/sign-group-membership
status-im.native-module.core/update-mailservers
native-module.core/listener
native-module.core/multiaccount-reset
native-module.core/extract-group-membership-signatures
native-module.core/sign-group-membership
native-module.core/update-mailservers
status-im.ethereum.abi-spec/bytes-to-hex
status-im.android.core/init
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]
[re-frame.core :as re-frame]
[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]
[utils.validators :as validators]
[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
[]
(when (exists? (.-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
[]
@ -72,15 +72,6 @@
accounts-data
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
"NOTE: beware, the password has to be sha3 hashed"
[key-uid account-data hashed-password config]
@ -123,11 +114,6 @@
(clear-web-data)
(.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
"NOTE: beware, the password has to be sha3 hashed
@ -141,14 +127,6 @@
:password hashed-password})
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
"NOTE: this should be named derive-accounts
this only derive addresses, they still need to be stored
@ -298,43 +276,13 @@
:key key})
(.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
"Provides compressed key to status-go and gets back the uncompressed public key via deserialization"
[public-key callback]
(let [deserialization-key constants/deserialization-key]
(log/info "[native-module] Deserializing compressed 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 deserialization-key callback]
(log/info "[native-module] Deserializing compressed key"
{:fn :compressed-key->public-key
:public-key public-key})
(.decompressPublicKey ^js (status) public-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))
(.multiformatDeserializePublicKey ^js (status) public-key deserialization-key callback))
(defn hash-typed-data
"used for keycard"
@ -388,11 +336,6 @@
(log/debug "[native-module] send-logs")
(.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
[]
(log/debug "[native-module] close-application")
@ -408,11 +351,6 @@
(log/debug "[native-module] app-state-change")
(.appStateChange ^js (status) state))
(defn stop-local-notifications
[]
(log/debug "[native-module] stop-local-notifications")
(.stopLocalNotifications ^js (status)))
(defn start-local-notifications
[]
(log/debug "[native-module] start-local-notifications")
@ -433,26 +371,11 @@
:build-id (.-buildId 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
[callback]
(log/debug "[native-module] get-node-config")
(.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
[on]
(log/debug "[native-module] toggle-webview-debug" on)
@ -483,12 +406,6 @@
(when (validators/valid-public-key? 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
"Generate a icon based on a string, synchronously"
[seed]
@ -500,11 +417,6 @@
(log/debug "[native-module] encode-transfer")
(.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
[bytes-string types]
(log/debug "[native-module] decode-parameters")
@ -555,11 +467,6 @@
(log/debug "[native-module] to-checksum-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
"Generate an icon based on a string and 3 words random name asynchronously"
[seed callback]
@ -585,16 +492,6 @@
(log/debug "[native-module] delete-imported-key")
(.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
[input selection]
(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]]
[status-im.native-module.core :as status]))
[native-module.core :as native-module]))
(deftest identicon-test
(testing "check if identicon test works"
(is
(=
"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 device-event-emitter (.-DeviceEventEmitter ^js react-native))
(defn hide-splash-screen
[]
(.hide ^js (-> react-native .-NativeModules .-SplashScreen)))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
(ns status-im.ethereum.encode
(:require [status-im.native-module.core :as status]))
(:require [native-module.core :as native-module]))
(defn uint
[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
(: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]))
;; this is the addresses of ens registries for the different networks
@ -66,7 +66,7 @@
:params [chain-id ens-name]
:on-success
;;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
[chain-id from ens-name pubkey cb]

View File

@ -30,7 +30,7 @@
status-im.multiaccounts.logout.core
[status-im.multiaccounts.model :as multiaccounts.model]
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.pairing.core
status-im.profile.core
@ -88,7 +88,7 @@
(re-frame/reg-fx
:ui/close-application
(fn [_]
(status/close-application)))
(native-module/close-application)))
(re-frame/reg-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
;; https://github.com/status-im/status-mobile/issues/15708
(theme/change-device-theme (rn/get-color-scheme)))
(status/app-state-change state)))
(native-module/app-state-change state)))
(re-frame/reg-fx
:ui/listen-to-window-dimensions-change

View File

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

View File

@ -4,7 +4,7 @@
[clojure.string :as string]
[status-im.ethereum.core :as ethereum]
[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.types :as types]
[taoensso.timbre :as log]))
@ -296,7 +296,7 @@
(defn save-multiaccount-and-login
[{: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
(types/clj->json multiaccount-data)
password
@ -307,15 +307,15 @@
(defn login
[args]
(status/login-with-keycard args))
(native-module/login-with-keycard args))
(defn send-transaction-with-signature
[{: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
[{:keys [key-uid on-success on-error]}]
(status/delete-multiaccount
(native-module/delete-multiaccount
key-uid
(fn [result]
(let [{:keys [error]} (types/json->clj result)]

View File

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

View File

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

View File

@ -4,7 +4,7 @@
[re-frame.core :as re-frame]
[status-im.bottom-sheet.events :as bottom-sheet]
[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]
[quo2.foundations.colors :as colors]
[status-im2.constants :as constants]

View File

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

View File

@ -11,7 +11,7 @@
[status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.model :as multiaccounts.model]
[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]
[utils.re-frame :as rf]
[status-im.utils.types :as types]

View File

@ -20,7 +20,7 @@
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.multiaccounts.biometric.core :as biometric]
[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.notifications.core :as notifications]
[status-im.popover.core :as popover]
@ -58,22 +58,22 @@
(re-frame/reg-fx
::login
(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
::export-db
(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
::import-db
(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
::enable-local-notifications
(fn []
(status/start-local-notifications)))
(native-module/start-local-notifications)))
(re-frame/reg-fx
::initialize-wallet-connect
@ -363,7 +363,7 @@
(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
"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]
[utils.i18n :as i18n]
[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]
[utils.re-frame :as rf]
[status-im.utils.keychain.core :as keychain]
@ -62,4 +62,4 @@
(re-frame/reg-fx
::logout
(fn []
(status/logout)))
(native-module/logout)))

View File

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

View File

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

View File

@ -2,7 +2,7 @@
(:require ["@react-native-community/netinfo" :default net-info]
[re-frame.core :as re-frame]
[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]
[status-im.wallet.core :as wallet]
[taoensso.timbre :as log]))
@ -59,4 +59,4 @@
(re-frame/reg-fx
:network/notify-status-go
(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
(: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]
[utils.re-frame :as rf]
[status-im.utils.platform :as utils.platform]
@ -221,4 +221,4 @@ app-db"
(re-frame/reg-fx
::prepare-new-config
(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]
[utils.re-frame :as rf]
[status-im.utils.money :as money]
[status-im.utils.react-native :as react-native-utils]
[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
{:symbol :ERC20
@ -56,7 +56,7 @@
(fn [notification]
(handle-notification-press {:userInfo (bean/bean (.getData ^js
notification))})))
(.addListener ^js react-native-utils/device-event-emitter
(.addListener ^js rn/device-event-emitter
notification-event-android
(fn [^js data]
(when (and data (.-dataJSON data))

View File

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

View File

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

View File

@ -1,15 +1,15 @@
(ns status-im.signing.core-test
(: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]))
(deftest signing-test
(testing "showing sheet"
(let [to "0x2f88d65f3cb52605a54a833ae118fb1363acccd2"
contract "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
amount1-hex (str "0x" (status/number-to-hex "10000000000000000000"))
amount2-hex (str "0x" (status/number-to-hex "100000000000000000000"))
data (status/encode-transfer to amount2-hex)
amount1-hex (str "0x" (native-module/number-to-hex "10000000000000000000"))
amount2-hex (str "0x" (native-module/number-to-hex "100000000000000000000"))
data (native-module/encode-transfer to amount2-hex)
first-tx {:tx-obj {:to to
:from nil
:value amount1-hex}}

View File

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

View File

@ -20,7 +20,7 @@
[status-im.ui.components.react :as react]
[status-im.ui.components.topbar :as topbar]
[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.identicon :as identicon]
[status-im.utils.utils :as utils]

View File

@ -2,7 +2,7 @@
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[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-im2.common.json-rpc.events :as json-rpc]
[utils.datetime :as datetime]))
@ -36,7 +36,7 @@
(reset! latest-block res)
(get-block
(str "0x"
(status/number-to-hex
(native-module/number-to-hex
(last-loaded-block-number)))
(fn [res]
(reset! last-loaded-block res))))))]

View File

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

View File

@ -1,6 +1,5 @@
(ns status-im.utils.gfycat.core
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as native-module]))
(:require [native-module.core :as native-module]))
(def unknown-gfy "Unknown")
@ -12,13 +11,3 @@
(native-module/generate-gfycat public-key)))
(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
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as native-module]))
(:require [native-module.core :as native-module]))
(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]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.native-module.core :as status]
[native-module.core :as native-module]
[utils.re-frame :as rf]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
@ -63,7 +63,7 @@
;; Android only
(defn- device-not-rooted?
[callback]
(status/rooted-device? (fn [rooted?] (callback (not rooted?)))))
(native-module/rooted-device? (fn [rooted?] (callback (not rooted?)))))
;; Android only
(defn- secure-hardware-available?

View File

@ -5,7 +5,7 @@
[react-native.mail :as react-native-mail]
[status-im.bottom-sheet.events :as bottom-sheet]
[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.ui.components.react :as react]
[status-im.utils.build :as build]
@ -20,7 +20,7 @@
(re-frame/reg-fx
:logs/archive-logs
(fn [[db-json callback-handler]]
(status/send-logs
(native-module/send-logs
db-json
(string/join "\n" (log/get-logs-queue))
#(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-im2.navigation.events :as navigation]
[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
;; dispatched 7 times for the same link
@ -88,7 +88,7 @@
(rf/defn handle-desktop-community
[cofx {:keys [community-id]}]
(status/deserialize-and-compress-key
(native-module/deserialize-and-compress-key
community-id
(fn [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.key-storage.core :as key-storage]
[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]
[utils.re-frame :as rf]
[status-im.utils.hex :as hex]
@ -74,7 +74,7 @@
(let [{:keys [id error]} (types/json->clj value)]
(if error
(re-frame/dispatch [::new-account-error :password-error error])
(status/multiaccount-derive-addresses
(native-module/multiaccount-derive-addresses
id
[path]
(fn [derived]
@ -82,7 +82,7 @@
(if (some #(= derived-address (get % :address)) accounts)
(re-frame/dispatch [::new-account-error :account-error
(i18n/label :t/account-exists-title)])
(status/multiaccount-store-derived
(native-module/multiaccount-store-derived
id
key-uid
[path]
@ -110,7 +110,7 @@
(re-frame/dispatch [::new-account-error
(if (= error pass-error) :password-error :account-error)
error])
(status/multiaccount-store-account
(native-module/multiaccount-store-account
id
key-uid
hashed-password
@ -119,7 +119,7 @@
(re-frame/reg-fx
::verify-password
(fn [{:keys [address hashed-password]}]
(status/verify
(native-module/verify
address
hashed-password
#(re-frame/dispatch [:wallet.accounts/add-new-account-password-verifyied % hashed-password]))))
@ -128,7 +128,7 @@
::generate-account
(fn [{:keys [derivation-info hashed-password accounts key-uid]}]
(let [{:keys [address path]} derivation-info]
(status/multiaccount-load-account
(native-module/multiaccount-load-account
address
hashed-password
(derive-and-store-account key-uid path hashed-password :generated accounts)))))
@ -136,7 +136,7 @@
(re-frame/reg-fx
::import-account-seed
(fn [{:keys [passphrase hashed-password accounts key-uid]}]
(status/multiaccount-import-mnemonic
(native-module/multiaccount-import-mnemonic
(mnemonic/sanitize-passphrase (security/unmask passphrase))
""
(derive-and-store-account key-uid constants/path-default-wallet hashed-password :seed accounts))))
@ -144,7 +144,7 @@
(re-frame/reg-fx
::import-account-private-key
(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))
(store-account key-uid constants/path-default-wallet hashed-password :key))))

View File

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

View File

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

View File

@ -2,7 +2,7 @@
(:require [quo2.core :as quo]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[status-im2.utils.message-resolver :as resolver]))
[status-im2.contexts.chat.messages.resolver.message-resolver :as resolver]))
(defn banner
[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]))
(defn resolve-message

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
[status-im2.constants :as constants]
[status-im2.contexts.shell.cards.style :as style]
[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
[type

View File

@ -1,5 +1,5 @@
(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]
[utils.re-frame :as rf]
[utils.security.core :as security]
@ -51,13 +51,13 @@
:settingCurrentNetwork config/default-network
:deviceType utils.platform/os}}))]
(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
config-map
#(log/info "Initiated local pairing"
{:response %
: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
{: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 [:bottom-sheet/hide]))]
(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])
config-map (.stringify js/JSON
(clj->js {:senderConfig {:keyUID key-uid
@ -76,7 +76,7 @@
:password sha3-pwd
:deviceType utils.platform/os}
:serverConfig {:timeout 0}}))]
(status/get-connection-string-for-bootstrapping-another-device
(native-module/get-connection-string-for-bootstrapping-another-device
config-map
#(show-sheet %)))
(show-sheet ""))))

View File

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

View File

@ -2,7 +2,7 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[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-im2.common.json-rpc.events]
[status-im2.common.theme.core :as theme]
@ -25,7 +25,7 @@
(re-frame/reg-fx
:setup/open-multiaccounts
(fn [callback]
(status/open-accounts callback)))
(native-module/open-accounts callback)))
(re-frame/reg-fx
:setup/init-theme

View File

@ -1,4 +1,4 @@
(ns status-im2.utils.validators)
(ns utils.validators)
(defn valid-public-key?
[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]]
[status-im2.utils.validators :refer [valid-compressed-key?]]))
[utils.validators :refer [valid-compressed-key?]]))
(deftest test-valid-compressed-key
(testing "valid"