add clj-kondo to linting phase

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2020-05-05 16:18:23 +02:00
parent 8b81c9a63b
commit 1bf68094e3
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
172 changed files with 1104 additions and 1402 deletions

View File

@ -3,7 +3,8 @@
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
quo.previews.preview/list-comp clojure.core/for
status-im.utils.styles/def clojure.core/def
status-im.utils.styles/defn clojure.core/defn}
status-im.utils.styles/defn clojure.core/defn
taoensso.tufte/defnp clojure.core/defn}
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]}
;;TODO remove number when this is fixed
;;https://github.com/borkdude/clj-kondo/issues/867

View File

@ -275,6 +275,7 @@ endif
lint: export TARGET := clojure
lint: ##@test Run code style checks
yarn clj-kondo --confg .clj-kondo/config.edn --lint src && \
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
-m cljfmt.main check src \
--indents indentation.edn
@ -391,4 +392,4 @@ repl-ios: ##@repl-ios start repl for ios project
repl-android: export TARGET := clojure
repl-android: ##@repl-android start repl for android project
yarn shadow-cljs cljs-repl android
yarn shadow-cljs cljs-repl android

View File

@ -14,7 +14,7 @@
"@react-native-community/masked-view": "^0.1.6",
"@react-native-community/netinfo": "^4.4.0",
"@react-navigation/bottom-tabs": "^5.1.1",
"@react-navigation/native": "^5.0.9",
"@react-navigation/native": "^5.2.3",
"@react-navigation/stack": "^5.1.1",
"bignumber.js": "git+https://github.com/status-im/bignumber.js.git#v4.0.2-status",
"buffer": "^5.4.2",

View File

@ -1327,29 +1327,29 @@
color "^3.1.2"
react-native-iphone-x-helper "^1.2.1"
"@react-navigation/core@^5.3.4":
version "5.3.4"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.3.4.tgz#272eb48381c4db251f4dc5cd044db1606a551551"
integrity sha512-ul8J7oHC1/k/qWORr7uI710nKofbcD2clYI0bK0Bix+xgAoiFPgrwRDrQcjWw4YQViYlR8CGF/DhnKK+BFA+Yw==
"@react-navigation/core@^5.4.0":
version "5.4.0"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.4.0.tgz#6b4973d48396d28ed3efee582b28807682a5865d"
integrity sha512-tDmfw7nzbJg186cXHUPl/VYEGSepzBXNiHRv4GTxLQ+S9cnZgPyrGv56kiSvHhxCzyNGN0nHscCY9IUv08KL6Q==
dependencies:
"@react-navigation/routers" "^5.4.0"
"@react-navigation/routers" "^5.4.2"
escape-string-regexp "^2.0.0"
nanoid "^3.0.2"
query-string "^6.12.0"
react-is "^16.13.0"
use-subscription "^1.4.0"
"@react-navigation/native@^5.0.9":
version "5.1.6"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.1.6.tgz#932ff1b5b8b9f051d8e5cd3b016d05badaa01898"
integrity sha512-DLLSnh29AndrGjPrHJoAgObeO9TiyrGtrASl+SA3B4ksmz4dUV2t6vaRwHogn1kejvRd+1T8VD923d3K1rjy7w==
"@react-navigation/native@^5.2.3":
version "5.2.3"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.2.3.tgz#2e2ec88396d2be96d11f9430b4af6dcea34029b0"
integrity sha512-fQfW506n9eTwBGiUbuxSvI7DTBXwR3IqAlooBCUHRJC0WiuSUm3aGg6eESJc8nW1A64hu33i/ITf10mn3Ec6Tg==
dependencies:
"@react-navigation/core" "^5.3.4"
"@react-navigation/core" "^5.4.0"
"@react-navigation/routers@^5.4.0":
version "5.4.0"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.4.0.tgz#2fce2a3880e84a110d4eaea317bb7dadee27d57c"
integrity sha512-Z5mQF/oQH9CRLilNm1H7h0wjY3dKomWOhuuDehW8UKuLiFp2mWJI1P5N9qwaSraxhcoiVfb9QXwKZru/wBzWMQ==
"@react-navigation/routers@^5.4.2":
version "5.4.2"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.4.2.tgz#10c1f32b0ddde935d1fc9123fb1683472bf31815"
integrity sha512-YjGv4H0LXD2YnDjSBAJzIKzlZehFRqWfR2IJtZor/mfLkOi6qDl8yJeqZKbLEeQsu6o6493QdxM81tqX293kyQ==
dependencies:
nanoid "^3.0.2"

View File

@ -4,7 +4,6 @@
[quo.components.text :as text]
[quo.design-system.colors :as colors]
[quo.design-system.spacing :as spacing]
[quo.react :as react]
[quo.react-native :as rn]
[reagent.core :as reagent]
[status-im.ui.components.icons.vector-icons :as icons]))

View File

@ -2,7 +2,6 @@
(:require [reagent.core :as reagent]
[oops.core :refer [oget]]
[quo.animated :as animated]
[quo.react :as react]
[quo.react-native :as rn]
[quo.design-system.colors :as colors]
[quo.design-system.spacing :as spacing]

View File

@ -1,5 +1,4 @@
(ns quo.design-system.typography
(:require [quo.platform :as platform]))
(ns quo.design-system.typography)
(def tiny {:font-size 10
:line-height 14})

View File

@ -4,7 +4,8 @@
[reagent.core :as reagent]
["react-native-gesture-handler"
:refer (TapGestureHandler PanGestureHandler LongPressGestureHandler
PureNativeButton TouchableWithoutFeedback createNativeWrapper State)]))
PureNativeButton TouchableWithoutFeedback
createNativeWrapper State)]))
(def tap-gesture-handler
(reagent/adapt-react-class TapGestureHandler))
@ -19,8 +20,6 @@
(def touchable-without-feedback-class TouchableWithoutFeedback)
(def createNativeWrapper createNativeWrapper)
(def touchable-without-feedback
(reagent/adapt-react-class touchable-without-feedback-class))

View File

@ -1,6 +1,5 @@
(ns quo.previews.main
(:require [oops.core :refer [ocall]]
[quo.previews.header :as header]
(:require [quo.previews.header :as header]
[quo.previews.text :as text]
[quo.previews.text-input :as text-input]
[quo.previews.tooltip :as tooltip]

View File

@ -1,11 +1,9 @@
(ns shadow.cljs.devtools.client.react-native
(:require
[clojure.string :as str]
[cljs.reader :as reader]
[goog.object :as gobj]
[goog.net.XhrIo :as xhr]
[shadow.cljs.devtools.client.env :as env]
[status-im.reloader :as reloader]))
(:require [cljs.reader :as reader]
[clojure.string :as str]
[goog.net.XhrIo :as xhr]
[shadow.cljs.devtools.client.env :as env]
[status-im.reloader :as reloader]))
(defonce repl-ns-ref (atom nil))
@ -51,7 +49,7 @@
(callback [])
(xhr/send
(env/files-url)
(fn [res]
(fn [_]
(this-as ^goog req
(let [content
(-> req
@ -64,10 +62,10 @@
:sources (into [] (map :resource-id) sources)})
#js {"content-type" "application/edn; charset=utf-8"})))
(defn noop [& args])
(defn noop [& _])
(defn handle-build-complete [{:keys [info reload-info] :as msg}]
(let [{:keys [sources compiled]}
(let [{:keys [sources]}
info
warnings
@ -97,7 +95,7 @@
(assoc :id id)
(ws-msg))))
(defn repl-require [{:keys [id sources reload-namespaces js-requires] :as msg} done]
(defn repl-require [{:keys [id sources reload-namespaces]} done]
(let [sources-to-load
(->> sources
(remove (fn [{:keys [provides] :as src}]
@ -188,7 +186,7 @@
(env/process-ws-msg (. e -data) handle-message)))
(set! (.-onopen socket)
(fn [e]
(fn [_]
;; :module-format :js already patches provide
(when (= "goog" env/module-format)
;; patch away the already declared exception
@ -199,7 +197,7 @@
(devtools-msg "WebSocket connected!")))
(set! (.-onclose socket)
(fn [e]
(fn [_]
;; not a big fan of reconnecting automatically since a disconnect
;; may signal a change of config, safer to just reload the page
(devtools-msg "WebSocket disconnected!")
@ -216,7 +214,7 @@
;; pretty much only for me while working on this file
(when-let [s @socket-ref]
(devtools-msg "connection reset!")
(set! (.-onclose s) (fn [e]))
(set! (.-onclose s) (fn [_]))
(.close s)
(vreset! socket-ref nil))

View File

@ -1,9 +1,8 @@
(ns status-im.bootnodes.core
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]))
@ -46,7 +45,8 @@
(set-input :name (str name)))]
(assoc fxs :dispatch [:navigate-to :edit-bootnode])))
(defn custom-bootnodes-in-use? [{:keys [db] :as cofx}]
(defn custom-bootnodes-in-use?
[{:keys [db]}]
(let [network (:networks/current-network db)]
(get-in db [:multiaccount :custom-bootnodes-enabled? network])))

View File

@ -2,10 +2,9 @@
(:require [status-im.constants :as constants]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.i18n :as i18n]
[status-im.qr-scanner.core :as qr-scanner]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.browser.webview-ref :as webview-ref]))
[status-im.qr-scanner.core :as qr-scanner]
[status-im.utils.fx :as fx]))
(declare process-next-permission)
(declare send-response-to-bridge)

View File

@ -1,9 +1,10 @@
(ns status-im.chat.db
(:require [clojure.set :as clojure.set]
[status-im.multiaccounts.core :as multiaccounts]
[clojure.string :as clojure.string]
[status-im.contact.db :as contact.db]
[status-im.group-chats.db :as group-chats.db]
[status-im.mailserver.constants :as mailserver.constants]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.utils.gfycat.core :as gfycat]))
(defn group-chat-name
@ -11,7 +12,7 @@
(str (when public? "#") name))
(defn enrich-active-chat
[contacts {:keys [chat-id public? group-chat name] :as chat} current-public-key]
[contacts {:keys [chat-id group-chat] :as chat} current-public-key]
(if group-chat
(let [pending-invite-inviter-name
(group-chats.db/get-pending-invite-inviter-name contacts

View File

@ -29,7 +29,7 @@
message-3
message-2
message-1]
[m1 d1 m2 m3 m4 d2 :as ms] (db/add-datemarks ordered-messages)]
[m1 d1 m2 m3 m4 d2] (db/add-datemarks ordered-messages)]
(is (= "Jan 1, 2000"
(:datemark m1)))
(is (= {:type :datemark

View File

@ -288,9 +288,10 @@
(i18n/label :cooldown/warning-message)
#())))
(defn set-dock-badge-label [label]
(defn set-dock-badge-label
"Sets dock badge label (OSX only for now).
Label must be a string. Pass nil or empty string to clear the label."
[label]
(.setDockBadgeLabel ^js react/desktop-notification label))
(re-frame/reg-fx

View File

@ -4,8 +4,8 @@
[re-frame.core :as re-frame]
[status-im.chat.constants :as chat.constants]
[status-im.chat.models :as chat]
[status-im.chat.models.message-content :as message-content]
[status-im.chat.models.message :as chat.message]
[status-im.chat.models.message-content :as message-content]
[status-im.constants :as constants]
[status-im.utils.datetime :as datetime]
[status-im.utils.fx :as fx]
@ -140,7 +140,7 @@
(fn [^js ref]
(try
(.focus ref)
(catch :default e
(catch :default _
(log/debug "Cannot focus the reference")))))
(re-frame/reg-fx
@ -148,5 +148,5 @@
(fn [ref]
(try
(.clear ref)
(catch :default e
(catch :default _
(log/debug "Cannot clear the reference")))))

View File

@ -1,9 +1,8 @@
(ns status-im.chat.models.input-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.chat.constants :as constants]
[status-im.utils.config :as config]
[status-im.utils.datetime :as datetime]
[status-im.chat.models.input :as input]))
[status-im.chat.models.input :as input]
[status-im.utils.datetime :as datetime]))
(deftest text->emoji
(is (nil? (input/text->emoji nil)))

View File

@ -1,24 +1,21 @@
(ns status-im.chat.models.message
(:require [re-frame.core :as re-frame]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.chat.db :as chat.db]
[status-im.waku.core :as waku]
[status-im.chat.models :as chat-model]
[status-im.chat.models.loading :as chat-loading]
[status-im.chat.models.message-list :as message-list]
[status-im.chat.models.message-content :as message-content]
[status-im.chat.models.message-list :as message-list]
[status-im.constants :as constants]
[status-im.contact.db :as contact.db]
[status-im.data-store.messages :as data-store.messages]
[status-im.ui.screens.chat.state :as view.state]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.transport.message.protocol :as protocol]
[status-im.utils.datetime :as time]
[status-im.ui.screens.chat.state :as view.state]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn- prepare-message
[{:keys [content content-type] :as message} chat-id current-chat?]
[{:keys [content content-type] :as message} current-chat?]
(cond-> message
current-chat?
(assoc :seen true)
@ -56,7 +53,7 @@
(let [current-public-key (multiaccounts.model/current-public-key cofx)
message-to-be-removed (when replace
(get-in db [:chats chat-id :messages replace]))
prepared-message (prepare-message message chat-id seen-by-user?)]
prepared-message (prepare-message message seen-by-user?)]
(fx/merge cofx
(when message-to-be-removed
(hide-message chat-id message-to-be-removed))
@ -100,13 +97,14 @@
(get-in db [:chats chat-id :messages message-id]))
(defn- earlier-than-deleted-at?
[{:keys [db]} {:keys [chat-id clock-value message-id from]}]
[{:keys [db]} {:keys [chat-id clock-value]}]
(let [{:keys [deleted-at-clock-value]}
(get-in db [:chats chat-id])]
(>= deleted-at-clock-value clock-value)))
(defn extract-chat-id [cofx {:keys [chat-id from message-type]}]
(defn extract-chat-id
"Validate and return a valid chat-id"
[cofx {:keys [chat-id from message-type]}]
(cond
(and (= constants/message-type-private-group message-type)
(and (get-in cofx [:db :chats chat-id :contacts from])
@ -200,9 +198,6 @@
(chat-model/join-time-messages-checked-for-chats (keys grouped-messages)))))))
;;;; Send message
(def ^:private transport-keys [:content :content-type :message-type :clock-value :timestamp :name])
(fx/defn update-message-status
[{:keys [db] :as cofx} chat-id message-id status]
(fx/merge cofx

View File

@ -1,34 +1,14 @@
(ns status-im.chat.models.message-content
(:require [clojure.string :as string]
[status-im.utils.platform :as platform]
[status-im.constants :as constants]))
(:require [status-im.constants :as constants]))
(def stylings [[:bold constants/regx-bold]
[:italic constants/regx-italic]
[:backquote constants/regx-backquote]])
(def ^:private actions [[:link constants/regx-url]
[:tag constants/regx-tag]
[:mention constants/regx-mention]])
(def blank " ")
(defn- blank-string [size]
(.repeat ^js blank size))
(defn should-collapse? [text line-count]
(or (<= constants/chars-collapse-threshold (count text))
(<= constants/lines-collapse-threshold (inc line-count))))
(defn- sorted-ranges [{:keys [metadata text]} metadata-keys]
(->> (if metadata-keys
(select-keys metadata metadata-keys)
metadata)
(reduce-kv (fn [acc type ranges]
(reduce #(assoc %1 %2 type) acc ranges))
{})
(sort-by ffirst)))
(defn emoji-only-content?
"Determines if text is just an emoji"
[{:keys [text response-to]}]

View File

@ -1,11 +1,7 @@
(ns status-im.chat.models.message-list
(:require
["functional-red-black-tree" :as rb-tree]
[taoensso.timbre :as log]
[status-im.constants :as constants]
[status-im.utils.fx :as fx]
[status-im.chat.db :as chat.db]
[status-im.utils.datetime :as time]))
(:require [status-im.constants :as constants]
[status-im.utils.datetime :as time]
["functional-red-black-tree" :as rb-tree]))
(defn- add-datemark [{:keys [whisper-timestamp] :as msg}]
(assoc msg :datemark (time/day-relative whisper-timestamp)))
@ -46,8 +42,7 @@
(defn display-photo?
"We display photos for other users, and not in 1-to-1 chats"
[{:keys [system-message? one-to-one?
outgoing message-type]}]
[{:keys [system-message? one-to-one? outgoing]}]
(or system-message?
(and
(not outgoing)

View File

@ -1,10 +1,7 @@
(ns status-im.chat.models.message-list-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.constants :as const]
[taoensso.tufte :as tufte :refer-macros (defnp p profiled profile)]
[status-im.chat.models.loading :as l]
[status-im.chat.models.message-list :as s]))
[status-im.chat.models.message-list :as s]
[taoensso.tufte :as tufte :refer-macros [defnp profile]]))
(deftest message-stream-tests
(testing "building the list"

View File

@ -1,15 +1,13 @@
(ns status-im.chat.models.message-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im.constants :as constants]
[status-im.chat.models.loading :as chat-loading]
[status-im.utils.datetime :as time]
[status-im.transport.message.protocol :as protocol]
[status-im.chat.models.message-list :as models.message-list]
[status-im.ui.screens.chat.state :as view.state]
[status-im.chat.models.message :as message]
[status-im.utils.datetime :as time]))
[status-im.chat.models.message-list :as models.message-list]
[status-im.constants :as constants]
[status-im.ui.screens.chat.state :as view.state]
[status-im.utils.datetime :as time]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]))
(deftest add-received-message-test
(with-redefs [message/add-message (constantly :added)]
@ -90,36 +88,36 @@
(deftest message-loaded?
(testing "it returns false when it's not in loaded message"
(is (not (message/message-loaded? {:db {:chats {"a" {}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"}))))
(is (not (#'status-im.chat.models.message/message-loaded? {:db {:chats {"a" {}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"}))))
(testing "it returns true when it's already in the loaded message"
(is (message/message-loaded? {:db {:chats {"a" {:messages {"message-id" {}}}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"}))))
(is (#'status-im.chat.models.message/message-loaded? {:db {:chats {"a" {:messages {"message-id" {}}}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"}))))
(deftest earlier-than-deleted-at?
(testing "it returns true when the clock-value is the same as the deleted-clock-value in chat"
(is (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"})))
(is (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 1
:chat-id "a"})))
(testing "it returns false when the clock-value is greater than the deleted-clock-value in chat"
(is (not (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 2
:chat-id "a"}))))
(is (not (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 2
:chat-id "a"}))))
(testing "it returns true when the clock-value is less than the deleted-clock-value in chat"
(is (message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 0
:chat-id "a"}))))
(is (#'status-im.chat.models.message/earlier-than-deleted-at? {:db {:chats {"a" {:deleted-at-clock-value 1}}}}
{:message-id "message-id"
:from "a"
:clock-value 0
:chat-id "a"}))))
(deftest add-own-received-message
(let [db {:multiaccount {:public-key "me"}

View File

@ -1,11 +1,9 @@
(ns status-im.commands.core
(:require
[re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.waku.core :as waku]
[status-im.utils.config :as config]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]))
(:require [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]))
(fx/defn handle-prepare-accept-request-address-for-transaction
{:events [::prepare-accept-request-address-for-transaction]}

View File

@ -7,25 +7,25 @@
(def ms-in-bg-for-require-bioauth 5000)
(def ^:const content-type-text 1)
(def ^:const content-type-sticker 2)
(def ^:const content-type-status 3)
(def ^:const content-type-emoji 4)
(def ^:const content-type-command 5)
(def ^:const content-type-system-text 6)
(def content-type-text 1)
(def content-type-sticker 2)
(def content-type-status 3)
(def content-type-emoji 4)
(def content-type-command 5)
(def content-type-system-text 6)
(def ^:const message-type-one-to-one 1)
(def ^:const message-type-public-group 2)
(def ^:const message-type-private-group 3)
(def ^:const message-type-private-group-system-message 4)
(def message-type-one-to-one 1)
(def message-type-public-group 2)
(def message-type-private-group 3)
(def message-type-private-group-system-message 4)
(def ^:const command-state-request-address-for-transaction 1)
(def ^:const command-state-request-address-for-transaction-declined 2)
(def ^:const command-state-request-address-for-transaction-accepted 3)
(def ^:const command-state-request-transaction 4)
(def ^:const command-state-request-transaction-declined 5)
(def ^:const command-state-transaction-pending 6)
(def ^:const command-state-transaction-sent 7)
(def command-state-request-address-for-transaction 1)
(def command-state-request-address-for-transaction-declined 2)
(def command-state-request-address-for-transaction-accepted 3)
(def command-state-request-transaction 4)
(def command-state-request-transaction-declined 5)
(def command-state-transaction-pending 6)
(def command-state-transaction-sent 7)
(def desktop-content-types
#{content-type-text content-type-emoji content-type-status})
@ -196,64 +196,64 @@
;; Used to generate topic for contact discoveries
(def contact-discovery "contact-discovery")
(def ^:const send-transaction-failed-parse-response 1)
(def ^:const send-transaction-failed-parse-params 2)
(def ^:const send-transaction-no-account-selected 3)
(def ^:const send-transaction-invalid-tx-sender 4)
(def ^:const send-transaction-err-decrypt 5)
(def send-transaction-failed-parse-response 1)
(def send-transaction-failed-parse-params 2)
(def send-transaction-no-account-selected 3)
(def send-transaction-invalid-tx-sender 4)
(def send-transaction-err-decrypt 5)
(def ^:const web3-send-transaction "eth_sendTransaction")
(def ^:const web3-personal-sign "personal_sign")
(def ^:const web3-sign-typed-data "eth_signTypedData")
(def ^:const web3-sign-typed-data-v3 "eth_signTypedData_v3")
(def web3-send-transaction "eth_sendTransaction")
(def web3-personal-sign "personal_sign")
(def web3-sign-typed-data "eth_signTypedData")
(def web3-sign-typed-data-v3 "eth_signTypedData_v3")
(def ^:const web3-get-logs "eth_getLogs")
(def ^:const web3-transaction-receipt "eth_getTransactionReceipt")
(def ^:const web3-new-filter "eth_newFilter")
(def ^:const web3-new-pending-transaction-filter "eth_newPendingTransactionFilter")
(def ^:const web3-new-block-filter "eth_newBlockFilter")
(def ^:const web3-uninstall-filter "eth_uninstallFilter")
(def ^:const web3-get-filter-changes "eth_getFilterChanges")
(def web3-get-logs "eth_getLogs")
(def web3-transaction-receipt "eth_getTransactionReceipt")
(def web3-new-filter "eth_newFilter")
(def web3-new-pending-transaction-filter "eth_newPendingTransactionFilter")
(def web3-new-block-filter "eth_newBlockFilter")
(def web3-uninstall-filter "eth_uninstallFilter")
(def web3-get-filter-changes "eth_getFilterChanges")
(def ^:const web3-shh-post "shh_post")
(def ^:const web3-shh-new-identity "shh_newIdentity")
(def ^:const web3-shh-has-identity "shh_hasIdentity")
(def ^:const web3-shh-new-group "shh_newGroup")
(def ^:const web3-shh-add-to-group "shh_addToGroup")
(def ^:const web3-shh-new-filter "shh_newFilter")
(def ^:const web3-shh-uninstall-filter "shh_uninstallFilter")
(def ^:const web3-shh-get-filter-changes "shh_getFilterChanges")
(def ^:const web3-shh-get-messages "shh_getMessages")
(def web3-shh-post "shh_post")
(def web3-shh-new-identity "shh_newIdentity")
(def web3-shh-has-identity "shh_hasIdentity")
(def web3-shh-new-group "shh_newGroup")
(def web3-shh-add-to-group "shh_addToGroup")
(def web3-shh-new-filter "shh_newFilter")
(def web3-shh-uninstall-filter "shh_uninstallFilter")
(def web3-shh-get-filter-changes "shh_getFilterChanges")
(def web3-shh-get-messages "shh_getMessages")
;; Keycard ns
(def ^:const web3-keycard-sign-typed-data "keycard_signTypedData")
(def web3-keycard-sign-typed-data "keycard_signTypedData")
(defn web3-sign-message? [method]
(#{web3-sign-typed-data web3-sign-typed-data-v3 web3-personal-sign web3-keycard-sign-typed-data} method))
(def ^:const status-create-address "status_createaddress")
(def status-create-address "status_createaddress")
; BIP44 Wallet Root Key, the extended key from which any wallet can be derived
(def ^:const path-wallet-root "m/44'/60'/0'/0")
(def path-wallet-root "m/44'/60'/0'/0")
; EIP1581 Root Key, the extended key from which any whisper key/encryption key can be derived
(def ^:const path-eip1581 "m/43'/60'/1581'")
(def path-eip1581 "m/43'/60'/1581'")
; BIP44-0 Wallet key, the default wallet key
(def ^:const path-default-wallet (str path-wallet-root "/0"))
(def path-default-wallet (str path-wallet-root "/0"))
; EIP1581 Chat Key 0, the default whisper key
(def ^:const path-whisper (str path-eip1581 "/0'/0"))
(def path-whisper (str path-eip1581 "/0'/0"))
(def ^:const path-default-wallet-keyword (keyword path-default-wallet))
(def ^:const path-whisper-keyword (keyword path-whisper))
(def ^:const path-wallet-root-keyword (keyword path-wallet-root))
(def ^:const path-eip1581-keyword (keyword path-eip1581))
(def path-default-wallet-keyword (keyword path-default-wallet))
(def path-whisper-keyword (keyword path-whisper))
(def path-wallet-root-keyword (keyword path-wallet-root))
(def path-eip1581-keyword (keyword path-eip1581))
;; (ethereum/sha3 "Transfer(address,address,uint256)")
(def ^:const event-transfer-hash "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")
(def event-transfer-hash "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")
(def ^:const method-id-transfer "0xa9059cbb")
(def ^:const method-id-approve "0x095ea7b3")
(def ^:const method-id-approve-and-call "0xcae9ca51")
(def method-id-transfer "0xa9059cbb")
(def method-id-approve "0x095ea7b3")
(def method-id-approve-and-call "0xcae9ca51")
(def regx-emoji #"^((?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F|[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])+$")
(def regx-rtl-characters #"[^\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]*?[\u0591-\u06EF\u06FA-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]")
@ -266,21 +266,21 @@
(def regx-universal-link #"((^https?://join.status.im/)|(^status-im://))[\x00-\x7F]+$")
(def regx-deep-link #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))")
(def ^:const lines-collapse-threshold 20)
(def ^:const chars-collapse-threshold 600)
(def ^:const desktop-msg-chars-hard-limit 10000)
(def lines-collapse-threshold 20)
(def chars-collapse-threshold 600)
(def desktop-msg-chars-hard-limit 10000)
(def ^:const dapp-permission-contact-code "contact-code")
(def ^:const dapp-permission-web3 "web3")
(def ^:const dapp-permission-qr-code "qr-code")
(def ^:const api-response "api-response")
(def ^:const api-request "api-request")
(def ^:const history-state-changed "history-state-changed")
(def ^:const debug-metrics "debug_metrics")
(def ^:const web3-send-async-read-only "web3-send-async-read-only")
(def ^:const web3-send-async-callback "web3-send-async-callback")
(def ^:const scan-qr-code "scan-qr-code")
(def dapp-permission-contact-code "contact-code")
(def dapp-permission-web3 "web3")
(def dapp-permission-qr-code "qr-code")
(def api-response "api-response")
(def api-request "api-request")
(def history-state-changed "history-state-changed")
(def debug-metrics "debug_metrics")
(def web3-send-async-read-only "web3-send-async-read-only")
(def web3-send-async-callback "web3-send-async-callback")
(def scan-qr-code "scan-qr-code")
;;ipfs
(def ^:const ipfs-proto-code "e3")
(def ^:const swarm-proto-code "e4")
(def ipfs-proto-code "e3")
(def swarm-proto-code "e4")

View File

@ -1,14 +1,9 @@
(ns status-im.contact.block
(:require [re-frame.core :as re-frame]
[status-im.chat.models :as chat.models]
[status-im.chat.models.loading :as chat.models.loading]
[status-im.chat.models.message-list :as message-list]
[status-im.chat.models.message :as chat.models.message]
[status-im.contact.db :as contact.db]
[status-im.data-store.chats :as chats-store]
[status-im.data-store.contacts :as contacts-store]
[status-im.i18n :as i18n]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]))

View File

@ -1,23 +1,18 @@
(ns status-im.contact.core
(:require
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.waku.core :as waku]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.transport.filters.core :as transport.filters]
[status-im.contact.db :as contact.db]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.data-store.contacts :as contacts-store]
[status-im.mailserver.core :as mailserver]
[status-im.transport.message.protocol :as protocol]
[status-im.tribute-to-talk.db :as tribute-to-talk]
[status-im.tribute-to-talk.whitelist :as whitelist]
[status-im.navigation :as navigation]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.datetime :as time]))
(:require [re-frame.core :as re-frame]
[status-im.contact.db :as contact.db]
[status-im.data-store.contacts :as contacts-store]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.transport.filters.core :as transport.filters]
[status-im.tribute-to-talk.db :as tribute-to-talk]
[status-im.tribute-to-talk.whitelist :as whitelist]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(fx/defn load-contacts
{:events [::contacts-loaded]}
@ -41,7 +36,7 @@
(transport.filters/load-filters))))
(defn build-contact
[{{:keys [chats multiaccount]
[{{:keys [multiaccount]
:contacts/keys [contacts]} :db} public-key]
(cond-> (contact.db/public-key->contact contacts public-key)
(= public-key (:public-key multiaccount))

View File

@ -1,9 +1,7 @@
(ns status-im.contact.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im.contact.core :as model]))
[status-im.contact.core :as model]
[status-im.ethereum.json-rpc :as json-rpc]))
(def public-key "0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917")
@ -57,8 +55,7 @@
public-key
1
{:name "new-name"
:profile-image "new-image"})
contact (get-in actual [:db :contacts/contacts public-key])]
:profile-image "new-image"})]
(testing "it does nothing"
(is (nil? actual)))))
(testing "timestamp is less than last-updated"
@ -72,8 +69,7 @@
public-key
0
{:name "new-name"
:profile-image "new-image"})
contact (get-in actual [:db :contacts/contacts public-key])]
:profile-image "new-image"})]
(testing "it does nothing"
(is (nil? actual))))))
(testing "backward compatibility"

View File

@ -1,9 +1,9 @@
(ns status-im.contact.db
(:require [clojure.set :as cset]
(:require [clojure.set :as clojure.set]
[clojure.string :as clojure.string]
[status-im.ethereum.core :as ethereum]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
status-im.utils.db))
[status-im.utils.identicon :as identicon]))
(defn public-key->new-contact [public-key]
(let [alias (gfycat/generate-gfy public-key)]
@ -53,8 +53,8 @@
[members admins contacts {:keys [public-key] :as current-account}]
(let [current-contact (-> current-account
(select-keys [:name :preferred-name :public-key :photo-path])
(cset/rename-keys {:name :alias
:preferred-name :name}))
(clojure.set/rename-keys {:name :alias
:preferred-name :name}))
all-contacts (assoc contacts public-key current-contact)]
(->> members
(map #(or (get all-contacts %)

View File

@ -1,23 +1,22 @@
(ns status-im.core
(:require [re-frame.core :as re-frame]
[status-im.utils.error-handler :as error-handler]
[status-im.utils.platform :as platform]
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[reagent.core :as reagent]
status-im.utils.db
status-im.db
(:require status-im.utils.db
status-im.subs
status-im.events
["react-native-languages" :default react-native-languages]
["react-native-shake" :as react-native-shake]
["react-native-screens" :refer (enableScreens)]
[status-im.utils.logging.core :as utils.logs]
["react-native" :as rn]
[status-im.utils.snoopy :as snoopy]
[status-im.i18n :as i18n]
[re-frame.core :as re-frame]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
[reagent.core :as reagent]
[reagent.impl.batching :as batching]
[status-im.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.screens.views :as views]
[status-im.utils.error-handler :as error-handler]
[status-im.utils.logging.core :as utils.logs]
[status-im.utils.platform :as platform]
[status-im.utils.snoopy :as snoopy]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
@ -46,7 +45,7 @@
(defn app-state-change-handler [state]
(re-frame/dispatch [:app-state-change state]))
(defn root [props]
(defn root [_]
(reagent/create-class
{:component-did-mount
(fn [this]

View File

@ -1,30 +1,15 @@
(ns status-im.data-store.chats
(:require [goog.object :as object]
[re-frame.core :as re-frame]
(:require [clojure.set :as clojure.set]
[status-im.data-store.messages :as messages]
[status-im.waku.core :as waku]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.core :as ethereum]
[taoensso.timbre :as log]
[status-im.utils.clocks :as utils.clocks]
[status-im.utils.core :as utils]))
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(def one-to-one-chat-type 1)
(def public-chat-type 2)
(def private-group-chat-type 3)
(defn- event->string
"Transform an event in an a vector with keys in alphabetical order, to compute
a predictable id"
[event]
(js/JSON.stringify
(clj->js
(mapv
#(vector % (get event %))
(sort (keys event))))))
(defn type->rpc [{:keys [public? group-chat] :as chat}]
(assoc chat :chatType (cond
public? public-chat-type

View File

@ -1,6 +1,5 @@
(ns status-im.data-store.chats-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.utils.random :as utils.random]
[status-im.data-store.chats :as chats]))
(deftest ->to-rpc
@ -46,7 +45,7 @@
:active true
:timestamp 2}]
(testing "marshaling chat"
(is (= expected-chat (-> (chats/->rpc chat)
(is (= expected-chat (-> (#'status-im.data-store.chats/->rpc chat)
(update :members #(into #{} %))))))))
(deftest normalize-chat-test

View File

@ -1,12 +1,10 @@
(ns status-im.data-store.contacts
(:require [re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[status-im.utils.config :as config]
[status-im.waku.core :as waku]
[status-im.data-store.chats :as data-store.chats]
(:require [clojure.set :as clojure.set]
[status-im.ethereum.json-rpc :as json-rpc]
[taoensso.timbre :as log]
[status-im.utils.types :as types]))
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn deserialize-tribute-to-talk [t]
(if (seq t)

View File

@ -1,6 +1,5 @@
(ns status-im.data-store.mailservers
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
(:require [status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))

View File

@ -1,16 +1,9 @@
(ns status-im.data-store.messages
(:require [clojure.set :as clojure.set]
[re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[clojure.string :as string]
[taoensso.timbre :as log]
[re-frame.core :as re-frame]
[status-im.waku.core :as waku]
[status-im.utils.types :as utils.types]
[status-im.utils.config :as config]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.constants :as constants]
[status-im.utils.core :as utils]))
[status-im.utils.fx :as fx]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn ->rpc [{:keys [content] :as message}]
(cond-> message

View File

@ -6,7 +6,6 @@
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[status-im.core :as core]
[status-im.utils.snoopy :as snoopy]
[status-im.ui.screens.desktop.views :as desktop-views]
[status-im.desktop.deep-links :as deep-links]
[status-im.utils.config :as config]))
@ -14,7 +13,7 @@
(defn app-state-change-handler [state]
(re-frame/dispatch [:app-state-change state]))
(defn app-root [props]
(defn app-root [_]
(if config/mobile-ui-for-desktop?
(reagent/create-class
{:component-did-mount
@ -31,8 +30,8 @@
(re-frame/dispatch [:set-initial-props (reagent/props this)])
;(shortcuts/register-default-shortcuts)
(deep-links/add-event-listener))
:reagent-render (fn [props]
:reagent-render (fn [_]
desktop-views/main)})))
(defn init []
(core/init))
(core/init app-root))

View File

@ -1,8 +1,7 @@
(ns status-im.ens.core
(:refer-clojure :exclude [name])
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.utils.datetime :as datetime]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.ethereum.abi-spec :as abi-spec]
[status-im.ethereum.contracts :as contracts]
[status-im.ethereum.core :as ethereum]
@ -10,13 +9,13 @@
[status-im.ethereum.ens :as ens]
[status-im.ethereum.resolver :as resolver]
[status-im.ethereum.stateofus :as stateofus]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.signing.core :as signing]
[status-im.navigation :as navigation]
[status-im.utils.datetime :as datetime]
[status-im.utils.fx :as fx]
[status-im.utils.money :as money]
[status-im.signing.core :as signing]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.utils.random :as random])
(:refer-clojure :exclude [name]))
[status-im.utils.random :as random]))
(defn fullname [custom-domain? username]
(if custom-domain?

View File

@ -47,7 +47,7 @@
(let [hex-x (str "0x" x)]
(try
(.hexToNumber utils hex-x)
(catch :default err
(catch :default _
(.hexToNumberString utils hex-x))))))
(defn is-hex? [value]
@ -90,8 +90,7 @@
;; bytes<M>: enc(X) is the sequence of bytes in X padded with trailing
;; zero-bytes to a length of 32 bytes.
(defmethod enc :bytes
[{:keys [value size dynamic?]
:or {size 256}}]
[{:keys [value dynamic?]}]
;; in the examples of the abi specifications strings are passed for
;; bytes parameters, in our ens resolver we pass encoded bytes directly
;; for namehash, this handles both cases by checking if the value is already
@ -114,17 +113,15 @@
;; fixed<M>x<N>: enc(X) is enc(X * 10**N) where X * 10**N is
;; interpreted as a int256.
(defmethod enc :fixed
[{:keys [value size power]
:or {size 128
power 18}}]
[{:keys [value power]
:or {power 18}}]
(enc {:type :int
:value (* value (Math/pow 10 power))}))
;; ufixed: as in the ufixed128x18 case
(defmethod enc :ufixed
[{:keys [value size power]
:or {size 128
power 18}}]
[{:keys [value power]
:or {power 18}}]
(enc {:type :uint
:value (* value (Math/pow 10 power))}))
@ -137,7 +134,7 @@
;; i.e. it is encoded as if it were an array of static size k,
;; prefixed with the number of elements.
(defmethod enc :array
[{:keys [value dynamic? array-of] :as x}]
[{:keys [value dynamic? array-of]}]
(str (when dynamic?
(enc {:type :int
:value (count value)}))
@ -174,7 +171,7 @@
(conj acc (assoc x :head enc-x))])))
[0 []]
value)
[_ heads tails] (reduce (fn [[len heads tails] {:keys [head tail] :as x}]
[_ heads tails] (reduce (fn [[len heads tails] {:keys [head tail]}]
(if tail
[(+ len (/ (count tail) 2))
(conj heads (enc {:type :int :value len}))
@ -228,7 +225,7 @@
[(count m) m]))
(defn tokenise [code]
(if (seq code)
(when (seq code)
(if-let [[len token] (or (string code)
(single-char code)
(number code))]
@ -273,12 +270,12 @@
(apply str (take 10 (ethereum/sha3 signature))))
(defn encode [method params]
(let [method-id (signature->method-id method)]
(let [params (map #(assoc %1 :value %2)
(parse-params method)
params)]
(str method-id (enc {:type :tuple
:value params})))))
(let [method-id (signature->method-id method)
params (map #(assoc %1 :value %2)
(parse-params method)
params)]
(str method-id (enc {:type :tuple
:value params}))))
;; ======= decode

View File

@ -11,12 +11,12 @@
(defn utf8-to-hex [s]
(try
(.utf8ToHex utils (str s))
(catch :default err nil)))
(catch :default _ nil)))
(defn hex-to-utf8 [s]
(try
(.hexToUtf8 utils s)
(catch :default err nil)))
(catch :default _ nil)))
;; IDs standardized in https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md#list-of-chain-ids
@ -75,7 +75,7 @@
(when s
(string/replace s hex-prefix "")))
(def ^:const public-key-length 128)
(def public-key-length 128)
(defn coordinates [public-key]
(when-let [hex (naked-address public-key)]
@ -137,10 +137,10 @@
(when normalized-key
(subs (sha3 normalized-key) 26))))
(def ^:const bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles)
(def bytes32-length 66) ; length of '0x' + 64 hex values. (a 32bytes value has 64 nibbles)
(defn hex->text
"Converts a hexstring to UTF8 text. If the data received is 32 bytes long,
"Converts a hexstring to UTF8 text. If the data received is 32 bytes long,
return the value unconverted"
[data]
(if (= bytes32-length (count (normalized-hex data)))

View File

@ -5,7 +5,6 @@
e.g. ethereum:0x1234@1/transfer?to=0x5678&value=1e18&gas=5000"
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ens]
[status-im.ethereum.tokens :as tokens]
@ -57,7 +56,7 @@
(when authority-path
(let [[_ raw-address chain-id function-name] (re-find authority-path-pattern authority-path)]
(when (or (ethereum/address? raw-address)
(if (string/starts-with? raw-address "pay-")
(when (string/starts-with? raw-address "pay-")
(let [pay-address (string/replace-first raw-address "pay-" "")]
(or (ens/is-valid-eth-name? pay-address)
(ethereum/address? pay-address)))))
@ -74,16 +73,18 @@
(ethereum/chain-keyword->chain-id :mainnet))}
arguments))))))))))))
(defn parse-eth-value [s]
(defn parse-eth-value
"Takes a map as returned by `parse-uri` and returns value as BigNumber"
[s]
(when (string? s)
(let [eth? (string/ends-with? s "ETH")
^js n (money/bignumber (string/replace s "ETH" ""))]
(if eth? (.times n 1e18) n))))
(defn extract-request-details [{:keys [value address function-name function-arguments] :as details} all-tokens]
(defn extract-request-details
"Return a map encapsulating request details (with keys `value`, `address` and `symbol`) from a parsed URI.
Supports ethereum and erc20 token."
[{:keys [value address function-name function-arguments] :as details} all-tokens]
(when address
(merge details
(case function-name

View File

@ -1,5 +1,5 @@
(ns status-im.ethereum.eip681-test
(:require [cljs.test :refer-macros [deftest is testing]]
(:require [cljs.test :refer-macros [deftest is]]
[status-im.ethereum.eip681 :as eip681]
[status-im.utils.money :as money]))

View File

@ -1,5 +1,5 @@
(ns status-im.ethereum.ens-test
(:require [cljs.test :refer-macros [deftest is testing]]
(:require [cljs.test :refer-macros [deftest is]]
[status-im.ethereum.ens :as ens]))
(deftest namehash

View File

@ -2,13 +2,12 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ethereum.abi-spec :as abi-spec]
[status-im.utils.config :as config]
[status-im.ethereum.decode :as decode]
[status-im.native-module.core :as status]
[status-im.utils.money :as money]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
[status-im.utils.utils :as utils]))
[status-im.utils.utils :as utils]
[taoensso.timbre :as log]))
(def json-rpc-api
{"eth_call" {}
@ -197,10 +196,10 @@
(defn call
[{:keys [method params on-success] :as arg}]
(if-let [method-options (json-rpc-api method)]
(let [{:keys [id on-result subscription?]
(let [params (or params [])
{:keys [id on-result subscription?]
:or {on-result identity
id 1
params []}} method-options
id 1}} method-options
on-error (or (on-error-retry call arg)
#(log/warn :json-rpc/error method :error % :params params))]
(if (nil? method)

View File

@ -1,7 +1,7 @@
(ns status-im.ethereum.mnemonic-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.ethereum.mnemonic :as mnemonic]
[clojure.string :as string]))
(:require [cljs.test :refer-macros [deftest is]]
[clojure.string :as string]
[status-im.ethereum.mnemonic :as mnemonic]))
(deftest valid-length?
(is (not (mnemonic/valid-length? "rate rate")))

View File

@ -1,5 +1,5 @@
(ns status-im.ethereum.stateofus-test
(:require [cljs.test :refer-macros [deftest is testing]]
(:require [cljs.test :refer-macros [deftest is]]
[status-im.ethereum.stateofus :as stateofus]))
(deftest valid-username?

View File

@ -1,16 +1,13 @@
(ns status-im.ethereum.transactions.core
(:require [re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.ethereum.decode :as decode]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.encode :as encode]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.tokens :as tokens]
[status-im.utils.fx :as fx]
[status-im.utils.money :as money]
[status-im.wallet.core :as wallet]
[taoensso.timbre :as log]))
[taoensso.timbre :as log]
[cljs.spec.alpha :as spec]))
(def confirmations-count-threshold 12)
@ -38,8 +35,8 @@
(defn- parse-token-transfer
[chain-tokens contract]
(let [{:keys [nft? symbol] :as token} (get chain-tokens contract
default-erc20-token)]
(let [{:keys [symbol] :as token} (get chain-tokens contract
default-erc20-token)]
{:symbol symbol
:token token
;; NOTE(goranjovic) - just a flag we need when we merge this entry
@ -50,8 +47,8 @@
(defn enrich-transfer
[chain-tokens
{:keys [address blockNumber timestamp type transaction receipt from txStatus
txHash gasPrice gasUsed contract value gasLimit input nonce to type id] :as transfer}]
{:keys [address blockNumber timestamp from txStatus txHash gasPrice
gasUsed contract value gasLimit input nonce to type id]}]
(let [erc20? (= type "erc20")
failed? (= txStatus "0x0")]
(merge {:address (eip55/address->checksum address)
@ -251,8 +248,8 @@
limit-per-address]
:as params
:or {limit default-transfers-limit}}]
{:pre [(cljs.spec.alpha/valid?
(cljs.spec.alpha/coll-of string?)
{:pre [(spec/valid?
(spec/coll-of string?)
addresses)]}
(log/debug "[transactions] get-transfers"
"addresses" addresses

View File

@ -1,52 +1,39 @@
(ns status-im.events
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.data-store.messages :as data-store.messages]
[status-im.data-store.chats :as data-store.chats]
[status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.bootnodes.core :as bootnodes]
[status-im.browser.core :as browser]
[status-im.browser.permissions :as browser.permissions]
[status-im.chat.db :as chat.db]
[status-im.chat.models :as chat]
[status-im.chat.models.input :as chat.input]
[status-im.chat.models.loading :as chat.loading]
[status-im.chat.models.message :as chat.message]
[status-im.chat.models.message-seen :as message-seen]
[status-im.contact.block :as contact.block]
[status-im.contact.core :as contact]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.messages :as data-store.messages]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.ens :as ethereum.ens]
[status-im.ethereum.subscriptions :as ethereum.subscriptions]
[status-im.ethereum.transactions.core :as ethereum.transactions]
[status-im.fleet.core :as fleet]
[status-im.group-chats.core :as group-chats]
[status-im.signing.keycard :as signing.keycard]
[status-im.i18n :as i18n]
[status-im.init.core :as init]
[status-im.log-level.core :as log-level]
status-im.waku.core
[status-im.utils.universal-links.core :as universal-links]
[status-im.mailserver.core :as mailserver]
[status-im.mailserver.constants :as mailserver.constants]
[status-im.mailserver.core :as mailserver]
[status-im.mailserver.topics :as mailserver.topics]
[status-im.node.core :as node]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.pairing.core :as pairing]
[status-im.privacy-policy.core :as privacy-policy]
[status-im.protocol.core :as protocol]
[status-im.qr-scanner.core :as qr-scanner]
[status-im.search.core :as search]
[status-im.signals.core :as signals]
[status-im.stickers.core :as stickers]
[status-im.transport.core :as transport]
[status-im.transport.message.core :as transport.message]
status-im.wallet.choose-recipient.core
status-im.wallet.collectibles.core
status-im.wallet.accounts.core
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
[status-im.ui.components.react :as react]
[status-im.ui.screens.add-new.new-chat.db :as new-chat.db]
@ -54,18 +41,19 @@
:as
currency-settings.models]
[status-im.navigation :as navigation]
[status-im.utils.build :as build]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.utils.logging.core :as logging]
[status-im.utils.utils :as utils]
[status-im.utils.universal-links.core :as universal-links]
[status-im.wallet.core :as wallet]
[status-im.wallet.custom-tokens.core :as custom-tokens]
[status-im.wallet.db :as wallet.db]
[taoensso.timbre :as log]
[status-im.utils.money :as money]
[status-im.chat.models.message-seen :as message-seen]
status-im.waku.core
status-im.wallet.choose-recipient.core
status-im.wallet.collectibles.core
status-im.wallet.accounts.core
status-im.multiaccounts.biometric.core
status-im.hardwallet.core
status-im.popover.core
[status-im.hardwallet.core :as hardwallet]
@ -75,6 +63,7 @@
[status-im.native-module.core :as status]
[status-im.ui.components.permissions :as permissions]
[status-im.utils.http :as http]
[status-im.utils.utils :as utils]
status-im.ui.screens.add-new.new-chat.events
status-im.ui.screens.group.chat-settings.events
status-im.ui.screens.group.events
@ -245,7 +234,7 @@
(handlers/register-handler-fx
:mailserver.ui/retry-request-pressed
(fn [cofx [_ args]]
(fn [cofx [_ _]]
(mailserver/retry-next-messages-request cofx)))
(handlers/register-handler-fx
@ -357,7 +346,7 @@
(handlers/register-handler-fx
:log-level.ui/logging-enabled-confirmed
(fn [cofx [_ enabled]]
(fn [_ [_ _]]
;;FIXME desktop only
#_(log-level/save-logging-enabled cofx enabled)))
@ -797,7 +786,7 @@
(handlers/register-handler-fx
:group-chats.ui/leave-chat-pressed
(fn [_ [_ chat-id group?]]
(fn [_ [_ chat-id _]]
{:ui/show-confirmation {:title (i18n/label :t/leave-confirmation)
:content (i18n/label :t/leave-chat-confirmation)
:confirm-button-text (i18n/label :t/leave)
@ -811,7 +800,7 @@
(handlers/register-handler-fx
:transport/send-status-message-error
(fn [{:keys [db] :as cofx} [_ err]]
(fn [_ [_ err]]
(log/error :send-status-message-error err)))
(fx/defn handle-update [cofx {:keys [chats messages] :as response}]
@ -885,7 +874,7 @@
(handlers/register-handler-fx
:contact.ui/start-group-chat-pressed
(fn [{:keys [db] :as cofx} _]
(fn [cofx _]
(contact/open-contact-toggle-list cofx)))
(handlers/register-handler-fx
@ -1147,17 +1136,16 @@
(handlers/register-handler-fx
:wallet-send-request
(fn [{:keys [db] :as cofx} [_ public-key amount symbol decimals]]
(fn [cofx [_ public-key _ _ _]]
(assert public-key)
(let [request-command (get-in db [:id->command ["request" #{:personal-chats}]])]
(fx/merge cofx
(navigation/navigate-back)
(chat/start-chat public-key nil)
;; TODO send
#_(commands.sending/send public-key
request-command
{:asset (name symbol)
:amount (str (money/internal->formatted amount symbol decimals))})))))
(fx/merge cofx
(navigation/navigate-back)
(chat/start-chat public-key nil)
;; TODO send
#_(commands.sending/send public-key
request-command
{:asset (name symbol)
:amount (str (money/internal->formatted amount symbol decimals))}))))
(handlers/register-handler-fx
:identicon-generated
@ -1349,7 +1337,7 @@
;; NOTE: Will be removed with the keycard PR
(handlers/register-handler-fx
:screens/on-will-focus
(fn [{:keys [db] :as cofx} [_ view-id]]
(fn [cofx [_ view-id]]
(fx/merge cofx
#(case view-id
:keycard-settings (hardwallet/settings-screen-did-load %)

View File

@ -1,11 +1,10 @@
(ns status-im.fleet.core
(:require [re-frame.core :as re-frame]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.constants :as constants]
[status-im.i18n :as i18n]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.node.core :as node]
[status-im.utils.config :as config]
[status-im.utils.types :as types]
[status-im.utils.fx :as fx]))
(defn current-fleet-sub

View File

@ -1,8 +1,7 @@
(ns status-im.fleet.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.constants :as constants]
[status-im.fleet.core :as fleet]
[status-im.node.core :as node]))
[status-im.fleet.core :as fleet]))
#_(deftest fleets-test
(testing "not passing any extra fleet"

View File

@ -1,33 +1,18 @@
(ns status-im.group-chats.core
(:refer-clojure :exclude [remove])
(:require [clojure.set :as clojure.set]
[clojure.spec.alpha :as spec]
[clojure.string :as string]
[status-im.ethereum.json-rpc :as json-rpc]
(:require [clojure.spec.alpha :as spec]
[re-frame.core :as re-frame]
[status-im.utils.config :as config]
[status-im.constants :as constants]
[status-im.chat.models.message-content :as message-content]
[status-im.navigation :as navigation]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.messages :as data-store.messages]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.utils.pairing :as pairing.utils]
[status-im.waku.core :as waku]
[status-im.chat.models :as models.chat]
[status-im.chat.models.message :as models.message]
[status-im.contact.core :as models.contact]
[status-im.transport.filters.core :as transport.filters]
[status-im.data-store.chats :as data-store.chats]
[status-im.data-store.messages :as data-store.messages]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.group-chats.db :as group-chats.db]
[status-im.i18n :as i18n]
[status-im.native-module.core :as native-module]
[status-im.transport.message.protocol :as protocol]
[status-im.utils.clocks :as utils.clocks]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.transport.filters.core :as transport.filters]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.mailserver.core :as mailserver]
[status-im.mailserver.topics :as mailserver.topics]
[taoensso.timbre :as log]))
[status-im.waku.core :as waku]))
(fx/defn remove-member
"Format group update message and sign membership"
@ -119,4 +104,3 @@
::json-rpc/call [{:method (json-rpc/call-ext-method (waku/enabled? cofx) "changeGroupChatName")
:params [nil chat-id new-name]
:on-success #(re-frame/dispatch [::chat-updated %])}]}))

View File

@ -4,7 +4,7 @@
(def members-added-type 3)
(defn joined?
[public-key {:keys [members-joined] :as chat}]
[public-key {:keys [members-joined]}]
(contains? members-joined public-key))
(defn invited?

View File

@ -1,14 +1,12 @@
(ns status-im.hardwallet.card
(:require
[status-im.hardwallet.keycard :as keycard]
[status-im.hardwallet.real-keycard :as real-keycard]
[status-im.hardwallet.simulated-keycard :as simulated-keycard]
[status-im.hardwallet.ios-keycard :as ios-keycard]
[taoensso.timbre :as log]
[re-frame.core :as re-frame]
[status-im.utils.config :as config]
[status-im.utils.platform :as platform]
["react-native" :as react-native]))
(:require [re-frame.core :as re-frame]
[status-im.hardwallet.ios-keycard :as ios-keycard]
[status-im.hardwallet.keycard :as keycard]
[status-im.hardwallet.real-keycard :as real-keycard]
[status-im.hardwallet.simulated-keycard :as simulated-keycard]
[status-im.utils.config :as config]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]))
(defonce card (if config/keycard-test-menu-enabled?
(simulated-keycard/SimulatedKeycard.)
@ -392,7 +390,7 @@
(error-object->map response)]))}))
(defn sign-typed-data
[{:keys [hash] :as args}]
[{:keys [hash]}]
(log/info "[keycard] sign-typed-data")
(keycard/sign-typed-data
card

View File

@ -1,18 +1,16 @@
(ns status-im.hardwallet.common
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet]
[status-im.ethereum.core :as ethereum]
[status-im.hardwallet.nfc :as nfc]
[status-im.i18n :as i18n]
[status-im.navigation :as navigation]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
[status-im.ui.components.bottom-sheet.events :as bottom-sheet]
[status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet]
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
[status-im.hardwallet.nfc :as nfc]))
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(def default-pin "000000")

View File

@ -1,24 +1,19 @@
(ns status-im.hardwallet.core
(:require [status-im.multiaccounts.create.core :as multiaccounts.create]
(:require [status-im.hardwallet.change-pin :as change-pin]
[status-im.hardwallet.common :as common]
[status-im.hardwallet.login :as login]
[status-im.hardwallet.mnemonic :as mnemonic]
[status-im.hardwallet.onboarding :as onboarding]
[status-im.hardwallet.recovery :as recovery]
[status-im.hardwallet.sign :as sign]
[status-im.hardwallet.wallet :as wallet]
[status-im.i18n :as i18n]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.navigation :as navigation]
[status-im.utils.datetime :as utils.datetime]
[status-im.utils.fx :as fx]
[status-im.hardwallet.login :as login]
[status-im.hardwallet.sign :as sign]
[status-im.hardwallet.change-pin :as change-pin]
[status-im.hardwallet.mnemonic :as mnemonic]
[status-im.hardwallet.recovery :as recovery]
[status-im.hardwallet.onboarding :as onboarding]
[status-im.hardwallet.common :as common]
status-im.hardwallet.unpair
status-im.hardwallet.export-key
status-im.hardwallet.delete-key
[status-im.hardwallet.wallet :as wallet]
[taoensso.timbre :as log]
status-im.hardwallet.fx
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]))
[taoensso.timbre :as log]))
(fx/defn show-keycard-has-multiaccount-alert
[{:keys [db] :as cofx}]

View File

@ -1,6 +1,4 @@
(ns status-im.hardwallet.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.hardwallet.core :as hardwallet]))
(ns status-im.hardwallet.core-test)
;;TODO re-enable after fixing hardwallet flow
#_(deftest process-pin-input

View File

@ -1,12 +1,11 @@
(ns status-im.hardwallet.simulated-keycard
(:require [status-im.hardwallet.keycard :as keycard]
[status-im.utils.utils :as utils]
(:require [re-frame.db :as re-frame.db]
[status-im.constants :as constants]
[taoensso.timbre :as log]
[status-im.ethereum.core :as ethereum]
[status-im.hardwallet.keycard :as keycard]
[status-im.native-module.core :as status]
[status-im.utils.types :as types]
[re-frame.db :as re-frame.db]))
[status-im.utils.utils :as utils]))
(def initial-state
{:card-connected? false

View File

@ -18,4 +18,4 @@
(into {})))
;; API compatibility
(defn load-language [lang])
(defn load-language [_])

View File

@ -1035,7 +1035,7 @@
(defn locale->checkpoint [locale]
(let [locale-labels (locale->labels locale)
checkpoint (->> checkpoints-def
(filter (fn [[checkpoint checkpoint-labels]]
(filter (fn [[_ checkpoint-labels]]
(set/subset? checkpoint-labels locale-labels)))
ffirst)]
checkpoint))

View File

@ -8,13 +8,14 @@
[status-im.ui.components.colors :as colors]
[status-im.db :refer [app-db]]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as platform]
[status-im.utils.theme :as theme]))
(fx/defn initialize-app-db
"Initialize db to initial state"
[{{:keys [hardwallet initial-props desktop/desktop
supported-biometric-auth network/type app-active-since]} :db now :now}]
[{{:keys [hardwallet initial-props supported-biometric-auth app-active-since]
:desktop/keys [desktop]
:network/keys [type]} :db
now :now}]
{:db (assoc app-db
:initial-props initial-props
:desktop/desktop (merge desktop (:desktop/desktop app-db))

View File

@ -6,9 +6,9 @@
(def xs-height 896)
(defn iphone-x-dimensions? []
(let [{:keys [width height]} (-> Dimensions
(.get "window")
(js->clj :keywordize-keys true))]
(let [{:keys [height]} (-> Dimensions
(.get "window")
(js->clj :keywordize-keys true))]
(or (= height x-height) (= height xs-height))))
(def platform-specific

View File

@ -4,8 +4,8 @@
;; we currently use an ipfs gateway but this detail is not relevant
;; outside of this namespace
(def ^:const ipfs-add-url "https://ipfs.infura.io:5001/api/v0/add?cid-version=1")
(def ^:const ipfs-cat-url "https://ipfs.infura.io/ipfs/")
(def ipfs-add-url "https://ipfs.infura.io:5001/api/v0/add?cid-version=1")
(def ipfs-cat-url "https://ipfs.infura.io/ipfs/")
(fx/defn cat
[cofx {:keys [hash on-success on-failure]}]

View File

@ -1,17 +1,17 @@
(ns ^{:doc "Mailserver events and API"}
status-im.mailserver.core
(:require [clojure.string :as string]
[clojure.set :as clojure.set]
[re-frame.core :as re-frame]
[status-im.data-store.mailservers :as data-store.mailservers]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.waku.core :as waku]
[status-im.node.core :as node]
[status-im.i18n :as i18n]
[status-im.mailserver.constants :as constants]
[status-im.mailserver.topics :as mailserver.topics]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.transport.utils :as transport.utils]
[status-im.ui.screens.mobile-network-settings.utils
:as
@ -23,6 +23,7 @@
[status-im.utils.platform :as platform]
[status-im.utils.random :as rand]
[status-im.utils.utils :as utils]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
;; How do mailserver work ?
@ -73,9 +74,7 @@
(defn get-selected-mailserver
"Use the preferred mailserver if set & exists"
[db]
(let [current-fleet (node/current-fleet-key db)
current-id (:mailserver/current-id db)
preference (preferred-mailserver-id db)]
(let [preference (preferred-mailserver-id db)]
(when (and preference
(fetch db preference))
preference)))
@ -320,7 +319,7 @@
adjusted-from))
(defn chats->never-synced-public-chats [chats]
(into {} (filter (fn [[k v]] (:might-have-join-time-messages? v)) chats)))
(into {} (filter (fn [[_ v]] (:might-have-join-time-messages? v)) chats)))
(fx/defn handle-request-success [{{:keys [chats] :as db} :db}
{:keys [request-id topics]}]
@ -396,7 +395,7 @@
(defn get-mailserver-when-ready
"return the mailserver if the mailserver is ready"
[{:keys [db] :as cofx}]
[{:keys [db]}]
(let [{:keys [sym-key-id] :as mailserver} (fetch-current db)
mailserver-state (:mailserver/state db)]
(when (and (= :connected mailserver-state)
@ -686,7 +685,7 @@
#(log/error "failed to save chat request range" %)})
(vals updated-ranges))})))
(defn prepare-new-gaps [new-gaps ranges {:keys [from to] :as req} chat-ids]
(defn prepare-new-gaps [new-gaps ranges {:keys [from to]} chat-ids]
(into
{}
(comp

View File

@ -2,9 +2,9 @@
(:require [cljs.test :refer-macros [deftest is testing]]
[clojure.string :as string]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.transport.utils :as utils]
[status-im.mailserver.core :as mailserver]
[status-im.mailserver.constants :as constants]
[status-im.mailserver.core :as mailserver]
[status-im.transport.utils :as utils]
[status-im.utils.random :as rand]))
(def enode "enode://08d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404")
@ -101,12 +101,12 @@
(is (= {:address "enode://some-id@206.189.56.154:30504"
:password "the-password"
:user-defined true}
(mailserver/address->mailserver address)))))
(#'status-im.mailserver.core/address->mailserver address)))))
(testing "without password"
(let [address "enode://some-id@206.189.56.154:30504"]
(is (= {:address "enode://some-id@206.189.56.154:30504"
:user-defined true}
(mailserver/address->mailserver address))))))
(#'status-im.mailserver.core/address->mailserver address))))))
(deftest set-input
(testing "it validates names"
@ -638,181 +638,180 @@
first)))))))
(deftest check-existing-gaps
(let []
(testing "no gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
nil
{:from 1
:to 2}))))
(testing "request before gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 1
:to 2}))))
(testing "request between gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 22
:to 28}))))
(testing "request between gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 22
:to 28}))))
(testing "request after gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 70
:to 80}))))
(testing "request covers all gaps"
(is (= {:deleted-gaps [:g3 :g2 :g1]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 10
:to 60}))))
(testing "request splits gap in two"
(is (= {:deleted-gaps [:g1]
:new-gaps [{:chat-id :chat-id :from 10 :to 12}
{:chat-id :chat-id :from 18 :to 20}]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 12
:to 18}))))
(testing "request partially covers one gap #1"
(is (= {:updated-gaps {:g1 {:from 15
:to 20
:id :g1}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 8
:to 15}))))
(testing "request partially covers one gap #2"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 25}))))
(testing "request partially covers two gaps #2"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}
:g2 {:from 35
:to 40
:id :g2}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 35}))))
(testing "request covers one gap and two other partially"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}
:g3 {:from 55
:to 60
:id :g3}}
:deleted-gaps [:g2]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 55}))))))
(testing "no gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
nil
{:from 1
:to 2}))))
(testing "request before gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 1
:to 2}))))
(testing "request between gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 22
:to 28}))))
(testing "request between gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 22
:to 28}))))
(testing "request after gaps"
(is (= {}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 70
:to 80}))))
(testing "request covers all gaps"
(is (= {:deleted-gaps [:g3 :g2 :g1]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 10
:to 60}))))
(testing "request splits gap in two"
(is (= {:deleted-gaps [:g1]
:new-gaps [{:chat-id :chat-id :from 10 :to 12}
{:chat-id :chat-id :from 18 :to 20}]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 12
:to 18}))))
(testing "request partially covers one gap #1"
(is (= {:updated-gaps {:g1 {:from 15
:to 20
:id :g1}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 8
:to 15}))))
(testing "request partially covers one gap #2"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 25}))))
(testing "request partially covers two gaps #2"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}
:g2 {:from 35
:to 40
:id :g2}}}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 35}))))
(testing "request covers one gap and two other partially"
(is (= {:updated-gaps {:g1 {:from 10
:to 15
:id :g1}
:g3 {:from 55
:to 60
:id :g3}}
:deleted-gaps [:g2]}
(mailserver/check-existing-gaps
:chat-id
{:g1 {:from 10
:to 20
:id :g1}
:g2 {:from 30
:to 40
:id :g2}
:g3 {:from 50
:to 60
:id :g3}}
{:from 15
:to 55})))))
(defn rand-guid []
(let [gap-id (atom 0)]

View File

@ -1,6 +1,7 @@
(ns ^{:doc "Mailserver events and API"}
status-im.mailserver.topics
(:require [status-im.ethereum.json-rpc :as json-rpc]
(:require [clojure.set :as clojure.set]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.mailserver.constants :as constants]
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))
@ -130,7 +131,7 @@
Returns those topic that had chat-id but the member is not there anymore"
[topics chat-id members]
(reduce
(fn [acc {:keys [discovery? chat-ids] :as topic}]
(fn [acc {:keys [chat-ids] :as topic}]
(cond (some chat-ids members)
(update acc :modified conj
(assoc topic

View File

@ -1,9 +1,7 @@
(ns status-im.mailserver.topics-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.transport.utils :as utils]
[status-im.mailserver.constants :as c]
[status-im.mailserver.topics :as t]
[status-im.utils.random :as rand]))
[status-im.mailserver.topics :as t]))
(def now-s 100000)

View File

@ -1,18 +1,14 @@
(ns status-im.multiaccounts.biometric.core
(:require
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[clojure.string :as string]
[status-im.popover.core :as popover]
[status-im.native-module.core :as status]
[status-im.utils.platform :as platform]
[status-im.ui.components.colors :as colors]
[status-im.i18n :as i18n]
[re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.keychain.core :as keychain]
[taoensso.timbre :as log]
["react-native-touch-id" :default touchid]))
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.native-module.core :as status]
[status-im.popover.core :as popover]
[status-im.ui.components.colors :as colors]
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
["react-native-touch-id" :default touchid]))
;; currently, for android, react-native-touch-id
;; is not returning supported biometric type

View File

@ -8,7 +8,6 @@
[status-im.ui.components.colors :as colors]
[status-im.utils.fx :as fx]
[status-im.utils.gfycat.core :as gfycat]
status-im.utils.handlers
[status-im.utils.identicon :as identicon]
[status-im.utils.theme :as theme]))
@ -40,11 +39,6 @@
(fn [flag]
(native-module/set-blank-preview-flag flag)))
(defn- chat-send? [transaction]
(and (seq transaction)
(not (:in-progress? transaction))
(:from-chat? transaction)))
(fx/defn confirm-wallet-set-up
[cofx]
(multiaccounts.update/multiaccount-update cofx

View File

@ -5,24 +5,21 @@
[status-im.data-store.settings :as data-store.settings]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[taoensso.timbre :as log]
[status-im.i18n :as i18n]
[status-im.hardwallet.nfc :as nfc]
[status-im.i18n :as i18n]
[status-im.multiaccounts.db :as db]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
[status-im.ui.components.colors :as colors]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.signing-phrase.core :as signing-phrase]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.utils.platform :as platform]
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
[status-im.constants :as const]))
[taoensso.timbre :as log]))
(def step-kw-to-num
{:generate-key 1

View File

@ -1,14 +1,20 @@
(ns status-im.multiaccounts.login.core
(:require [re-frame.core :as re-frame]
[status-im.chat.models.loading :as chat.loading]
[status-im.chat.models.message-seen :as message-seen]
[status-im.contact.core :as contact]
[status-im.data-store.settings :as data-store.settings]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.fleet.core :as fleet]
[status-im.i18n :as i18n]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.notifications.core :as notifications]
[status-im.popover.core :as popover]
[status-im.protocol.core :as protocol]
[status-im.stickers.core :as stickers]
[status-im.ui.screens.mobile-network-settings.events :as mobile-network]
@ -16,27 +22,21 @@
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.utils.identicon :as identicon]
[status-im.utils.keychain.core :as keychain]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[status-im.wallet.core :as wallet]
[taoensso.timbre :as log]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.utils.identicon :as identicon]
[status-im.ethereum.eip55 :as eip55]
[status-im.popover.core :as popover]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.data-store.settings :as data-store.settings]
[status-im.wallet.prices :as prices]
[status-im.chat.models.message-seen :as message-seen]))
[taoensso.timbre :as log]))
(def rpc-endpoint "https://goerli.infura.io/v3/f315575765b14720b32382a61a89341a")
(def contract-address "0xfbf4c8e2B41fAfF8c616a0E49Fb4365a5355Ffaf")
(def contract-fleet? #{:eth.contract})
(defn fetch-nodes [current-fleet resolve reject]
(defn fetch-nodes [current-fleet resolve _]
(let [default-nodes (-> (node/fleets {})
(get-in [:eth.staging :mail])
vals)]
@ -47,7 +47,7 @@
rpc-endpoint
contract-address
(handlers/response-handler resolve
(fn [error]
(fn [_]
(log/warn "could not fetch nodes from contract defaulting to eth.staging")
(resolve default-nodes)))))
(resolve default-nodes))))
@ -171,7 +171,7 @@
(.then (fn [[accounts custom-tokens]]
(callback accounts
(mapv #(update % :symbol keyword) custom-tokens))))
(.catch (fn [error]
(.catch (fn [_]
(log/error "Failed to initialize wallet"))))))
(fx/defn initialize-appearance [cofx]
@ -180,8 +180,9 @@
(fx/defn get-settings-callback
{:events [::get-settings-callback]}
[{:keys [db] :as cofx} settings]
(let [{:keys [address notifications-enabled?
networks/current-network networks/networks] :as settings}
(let [{:keys [address notifications-enabled?]
:networks/keys [current-network networks]
:as settings}
(data-store.settings/rpc->settings settings)
multiaccount (dissoc settings :networks/current-network :networks/networks)
network-id (str (get-in networks [current-network :config :NetworkId]))]

View File

@ -5,8 +5,8 @@
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.multiaccounts.login.core :as login.core]
[status-im.multiaccount.login.data-test :as data]))
[status-im.multiaccount.login.data-test :as data]
[status-im.multiaccounts.login.core :as login.core]))
(deftest on-password-input-submitted
(testing
@ -28,9 +28,7 @@
:password "password"}
:multiaccount data/multiaccount}
cofx {:db db}
login-result "{\"error\":\"\"}"
efx (login.core/multiaccount-login-success cofx)
new-db (:db efx)
json-rpc (into #{} (map :method (::json-rpc/call efx)))]
;; TODO: Account is now cleared only after all sign in fx are executed.
;; (testing ":accounts/login cleared."

View File

@ -6,7 +6,6 @@
[status-im.native-module.core :as status]
[status-im.transport.core :as transport]
[status-im.utils.fx :as fx]
[status-im.navigation :as navigation]
[status-im.utils.keychain.core :as keychain]))
(fx/defn logout-method

View File

@ -1,10 +1,6 @@
(ns status-im.multiaccounts.update.core
(:require [status-im.contact.db :as contact.db]
[status-im.utils.config :as config]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.transport.message.protocol :as protocol]
(:require [status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(fx/defn send-multiaccount-update [{:keys [db] :as cofx}]

View File

@ -1,20 +1,14 @@
(ns status-im.multiaccounts.update.publisher
(:require [taoensso.timbre :as log]
[re-frame.core :as re-frame]
[status-im.waku.core :as waku]
[status-im.utils.config :as config]
[status-im.constants :as constants]
[status-im.multiaccounts.update.core :as multiaccounts]
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.pairing.core :as pairing]
[status-im.transport.shh :as shh]))
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
;; Publish updates every 48 hours
(def publish-updates-interval (* 48 60 60 1000))
(defn publish-update! [{:keys [db now] :as cofx}]
(let [my-public-key (get-in db [:multiaccount :public-key])
peers-count (:peers-count db)
(let [peers-count (:peers-count db)
last-updated (get-in
db
[:multiaccount :last-updated])]
@ -23,7 +17,7 @@
(< publish-updates-interval
(- now last-updated)))
(let [multiaccount (:multiaccount db)
{:keys [name preferred-name photo-path address]} multiaccount]
{:keys [name preferred-name photo-path]} multiaccount]
(log/debug "sending contact updates")
(json-rpc/call {:method (json-rpc/call-ext-method (waku/enabled? cofx) "sendContactUpdates")

View File

@ -1,6 +1,5 @@
(ns status-im.native-module.core
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
(:require [re-frame.core :as re-frame]
[status-im.utils.db :as utils.db]
[status-im.ui.components.react :as react]
[status-im.utils.platform :as platform]

View File

@ -1,8 +1,7 @@
(ns status-im.network.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.network.core :as network.core]
[reagent.core :as reagent]))
[status-im.network.core :as network.core]))
(deftest valid-rpc-url-test
(testing "nil?"

View File

@ -1,12 +1,8 @@
(ns status-im.network.net-info
(:require [taoensso.timbre :as log]
[status-im.utils.platform :as platform]
[re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[status-im.mailserver.core :as mailserver]
[status-im.chaos-mode.core :as chaos-mode]
(:require [re-frame.core :as re-frame]
[status-im.native-module.core :as status]
[status-im.ui.screens.mobile-network-settings.events :as mobile-network]
[status-im.utils.fx :as fx]
[status-im.wallet.core :as wallet]
["@react-native-community/netinfo" :default net-info]))

View File

@ -1,18 +1,16 @@
(ns status-im.network.ui.edit-network.views
(:require-macros [status-im.utils.views :as views])
(:require
[re-frame.core :as re-frame]
[status-im.ui.components.react :as react]
[status-im.i18n :as i18n]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.common.common :as components.common]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.text-input.view :as text-input]
[status-im.network.core :as network]
[status-im.network.ui.edit-network.styles :as styles]
[clojure.string :as string]
[status-im.ui.components.topbar :as topbar]))
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.network.core :as network]
[status-im.network.ui.edit-network.styles :as styles]
[status-im.ui.components.common.common :as components.common]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.text-input.view :as text-input]
[status-im.ui.components.topbar :as topbar])
(:require-macros [status-im.utils.views :as views]))
(defn- render-network-type [manage-network type]
(let [name (case type

View File

@ -1,15 +1,14 @@
(ns status-im.network.ui.network-details.views
(:require-macros [status-im.utils.views :as views])
(:require [re-frame.core :as re-frame]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.components.react :as react]
[status-im.i18n :as i18n]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.common.common :as components.common]
[status-im.network.ui.styles :as st]
[status-im.network.core :as network]
[status-im.network.ui.styles :as st]
[status-im.network.ui.views :as network-settings]
[status-im.ui.components.topbar :as topbar]))
[status-im.ui.components.common.common :as components.common]
[status-im.ui.components.react :as react]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.topbar :as topbar])
(:require-macros [status-im.utils.views :as views]))
(views/defview network-details []
(views/letsubs [{:keys [networks/selected-network]} [:get-screen-params]

View File

@ -1,14 +1,13 @@
(ns status-im.node.core
(:require [re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.ethereum.ens :as ens]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.native-module.core :as status]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as utils.platform]
[status-im.utils.types :as types]
[taoensso.timbre :as log]
[status-im.ethereum.ens :as ens]))
[status-im.utils.types :as types]))
(defn- add-custom-bootnodes [config network all-bootnodes]
(let [bootnodes (as-> all-bootnodes $
@ -101,7 +100,7 @@
current-fleet
(assoc :NoDiscovery false
:Rendezvous (not (empty? rendezvous-nodes))
:Rendezvous (seq rendezvous-nodes)
:ClusterConfig {:Enabled true
:Fleet (name current-fleet-key)
:BootNodes

View File

@ -1,22 +1,13 @@
(ns status-im.pairing.core (:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.chat.models :as models.chat]
[status-im.waku.core :as waku]
[status-im.contact.core :as contact]
[status-im.contact.db :as contact.db]
[taoensso.timbre :as log]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.i18n :as i18n]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.transport.message.protocol :as protocol]
[status-im.navigation :as navigation]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.identicon :as identicon]
[status-im.utils.pairing :as pairing.utils]
[status-im.utils.platform :as utils.platform]
[status-im.utils.types :as types]))
(ns status-im.pairing.core
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.i18n :as i18n]
[status-im.navigation :as navigation]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as utils.platform]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn enable-installation-rpc [waku-enabled? installation-id on-success on-failure]
(json-rpc/call {:method (json-rpc/call-ext-method waku-enabled? "enableInstallation")

View File

@ -3,7 +3,7 @@
[status-im.ui.components.react :as react]
[status-im.utils.fx :as fx]))
(def ^:const privacy-policy-link "https://www.iubenda.com/privacy-policy/45710059")
(def privacy-policy-link "https://www.iubenda.com/privacy-policy/45710059")
(defn open-privacy-policy-link! []
(.openURL ^js react/linking privacy-policy-link))

View File

@ -21,7 +21,7 @@
[db mailserver-topics]
(assoc db
:mailserver/topics
(reduce (fn [acc {:keys [topic chat-ids]
(reduce (fn [acc {:keys [topic]
:as mailserver-topic}]
(assoc acc topic
(update mailserver-topic :chat-ids

View File

@ -31,7 +31,7 @@
(reset! label "building")
(reset! visible true))
(defn reload-view [cnt]
(defn reload-view [_]
(fn [cnt]
(when @timeout (js/clearTimeout @timeout))
(when (not= @cnt-prev cnt)

View File

@ -2,14 +2,11 @@
(:require [status-im.ethereum.subscriptions :as ethereum.subscriptions]
[status-im.i18n :as i18n]
[status-im.mailserver.core :as mailserver]
[clojure.string :as string]
[status-im.multiaccounts.login.core :as login]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.pairing.core :as pairing]
[status-im.transport.filters.core :as transport.filters]
[status-im.transport.message.core :as transport.message]
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(fx/defn status-node-started

View File

@ -2,28 +2,24 @@
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.utils.config :as config]
[status-im.waku.core :as waku]
[status-im.ethereum.abi-spec :as abi-spec]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.tokens :as tokens]
[status-im.i18n :as i18n]
[status-im.signing.keycard :as signing.keycard]
[status-im.native-module.core :as status]
[status-im.utils.fx :as fx]
[status-im.hardwallet.common :as hardwallet.common]
[status-im.hardwallet.sign :as hardwallet.sign]
[status-im.i18n :as i18n]
[status-im.native-module.core :as status]
[status-im.signing.keycard :as signing.keycard]
[status-im.utils.fx :as fx]
[status-im.utils.hex :as utils.hex]
[status-im.utils.money :as money]
[status-im.utils.security :as security]
[status-im.utils.types :as types]
[status-im.utils.utils :as utils]
[taoensso.timbre :as log]
[re-frame.core :as re-frame.core]
[status-im.wallet.prices :as prices]))
[status-im.waku.core :as waku]
[status-im.wallet.prices :as prices]
[taoensso.timbre :as log]))
(re-frame/reg-fx
:signing/send-transaction-fx
@ -269,7 +265,7 @@
{:data data
:on-completed
(fn [hash]
(re-frame.core/dispatch
(re-frame/dispatch
[:hardwallet/sign-message
{:tx-hash transaction-hash
:message-id message-id

View File

@ -1,10 +1,10 @@
(ns status-im.signing.gas
(:require [status-im.utils.money :as money]
[status-im.utils.fx :as fx]
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.i18n :as i18n]
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
[re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]))
[status-im.utils.fx :as fx]
[status-im.utils.money :as money]))
(def min-gas-price-wei ^js (money/bignumber 1))
@ -40,10 +40,11 @@
gas (get-in edit [:gas :value-number])]
(assoc edit :max-fee (calculate-max-fee gas gasPrice))))
(defn build-edit [edit-value key value]
(defn build-edit
"Takes the previous edit, either :gas or :gas-price and a value as string.
Wei for gas, and gwei for gas price.
Validates them and sets max fee"
[edit-value key value]
(let [^js bn-value (money/bignumber value)
error-label-key (get-error-label-key key bn-value)
data (if error-label-key

View File

@ -1,10 +1,9 @@
(ns status-im.signing.keycard
(:require [re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[status-im.native-module.core :as status]
[status-im.utils.types :as types]
[status-im.ethereum.abi-spec :as abi-spec]
[status-im.ethereum.core :as ethereum]
[status-im.native-module.core :as status]
[status-im.utils.fx :as fx]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(re-frame/reg-fx

View File

@ -1,22 +1,22 @@
(ns status-im.stickers.core
(:require [cljs.reader :as edn]
[clojure.set :as clojure.set]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.ethereum.abi-spec :as abi-spec]
[status-im.ethereum.contracts :as contracts]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.utils.utils :as utils]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.signing.core :as signing]
[status-im.utils.contenthash :as contenthash]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[clojure.string :as string]))
[status-im.utils.fx :as fx]
[status-im.utils.utils :as utils]))
(defn pack-data-callback
[id]
(fn [[category owner mintable timestamp price contenthash]]
(fn [[_ _ _ _ price contenthash]]
(when-let [url (contenthash/url contenthash)]
(re-frame/dispatch [:stickers/load-pack url id price]))))
@ -202,4 +202,4 @@
{})))))
(fx/defn pack-owned [{db :db} id]
{:db (update db :stickers/packs-owned conj id)})
{:db (update db :stickers/packs-owned conj id)})

View File

@ -1,15 +1,14 @@
(ns status-im.subs
(:require [cljs.spec.alpha :as spec]
[clojure.string :as string]
[taoensso.timbre :as log]
[re-frame.core :as re-frame]
[status-im.browser.core :as browser]
[status-im.chat.constants :as chat.constants]
[status-im.chat.db :as chat.db]
[status-im.chat.models :as chat.models]
[status-im.chat.models.message-list :as models.message-list]
[status-im.constants :as constants]
[status-im.contact.db :as contact.db]
[status-im.ens.core :as ens]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.stateofus :as stateofus]
[status-im.ethereum.tokens :as tokens]
@ -17,41 +16,34 @@
[status-im.fleet.core :as fleet]
[status-im.group-chats.db :as group-chats.db]
[status-im.i18n :as i18n]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.multiaccounts.db :as multiaccounts.db]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.recover.core :as recover]
[status-im.pairing.core :as pairing]
[status-im.tribute-to-talk.core :as tribute-to-talk]
[status-im.signing.gas :as signing.gas]
#_[status-im.tribute-to-talk.core :as tribute-to-talk]
[status-im.tribute-to-talk.db :as tribute-to-talk.db]
[status-im.tribute-to-talk.whitelist :as whitelist]
[status-im.ui.components.tabbar.styles :as tabs.styles]
[status-im.ui.components.colors :as colors]
[status-im.ui.components.toolbar.styles :as toolbar.styles]
[status-im.ui.components.tabbar.styles :as tabs.styles]
[status-im.ui.screens.add-new.new-public-chat.db :as db]
[status-im.ui.screens.chat.stickers.styles :as stickers.styles]
[status-im.ui.screens.mobile-network-settings.utils
:as
mobile-network-utils]
[status-im.wallet.utils :as wallet.utils]
[status-im.utils.build :as build]
[status-im.utils.config :as config]
[status-im.utils.datetime :as datetime]
[status-im.utils.hex :as utils.hex]
[status-im.utils.identicon :as identicon]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.money :as money]
[status-im.utils.platform :as platform]
[status-im.utils.security :as security]
[status-im.utils.universal-links.core :as links]
[status-im.wallet.core :as wallet]
[status-im.wallet.db :as wallet.db]
[status-im.signing.gas :as signing.gas]
[status-im.utils.gfycat.core :as gfycat]
[status-im.wallet.utils :as wallet.utils]
status-im.ui.screens.keycard.subs
status-im.ui.screens.hardwallet.settings.subs
status-im.ui.screens.hardwallet.pin.subs
status-im.ui.screens.hardwallet.setup.subs
[status-im.ens.core :as ens]))
status-im.ui.screens.hardwallet.setup.subs))
;; TOP LEVEL ===========================================================================================================
@ -210,9 +202,7 @@
:intro-wizard
:<- [:intro-wizard-state]
:<- [:dimensions/window]
(fn [[wizard-state
{:keys [width height] :as dimensions}
view-id]]
(fn [[wizard-state {:keys [width height]}]]
(assoc wizard-state
:view-height height :view-width width)))
@ -404,7 +394,7 @@
(re-frame/reg-sub
:get-app-short-version
(fn [db] app-short-version))
(fn [_] app-short-version))
(re-frame/reg-sub
:get-app-node-version
@ -1434,12 +1424,12 @@
(re-frame/reg-sub
:wallet.transactions.details/current-transaction
(fn [[_ hash address] _]
(fn [[_ _ address] _]
[(re-frame/subscribe [:wallet.transactions/transactions address])
(re-frame/subscribe [:ethereum/native-currency])
(re-frame/subscribe [:ethereum/chain-keyword])])
(fn [[transactions native-currency chain-keyword] [_ hash _]]
(let [{:keys [gas-used gas-price hash timestamp type token value]
(let [{:keys [gas-used gas-price hash timestamp type]
:as transaction}
(get transactions hash)
native-currency-text (name (or (:symbol-display native-currency)
@ -1696,7 +1686,7 @@
(fn [[_ chat-id] _]
[(re-frame/subscribe [:chats/chat chat-id])
(re-frame/subscribe [:contacts/contacts-by-chat filter chat-id])])
(fn [[chat contacts] [_ chat-id]]
(fn [[chat contacts] [_ _]]
(when (and chat (not (:group-chat chat)))
(if (pos? (count contacts))
(multiaccounts/displayed-photo (first contacts))
@ -1929,8 +1919,8 @@
:as settings}
{:keys [step editing? state error]
:or {step :intro}
screen-snt-amount :snt-amount
screen-message :message} prices currency]]
screen-snt-amount :snt-amount}
prices currency]]
(let [fiat-value (if snt-amount
(money/fiat-amount-value
snt-amount
@ -2012,7 +2002,7 @@
(re-frame/reg-sub
:ens/confirmation-screen
:<- [:ens/registration]
(fn [{:keys [username state] :as ens}]
(fn [{:keys [username state]}]
{:state state
:username username}))
@ -2080,7 +2070,7 @@
(not (.eq bn (.round bn decimals)))))
(defn get-amount-error [amount decimals]
(when (and (not (empty? amount)) decimals)
(when (and (seq amount) decimals)
(let [normalized-amount (money/normalize amount)
value (money/bignumber normalized-amount)]
(cond

View File

@ -1,10 +1,6 @@
(ns status-im.subs-test
(:require [cljs.test :refer [deftest is testing]]
reagent.core
[day8.re-frame.test :refer [run-test-sync]]
status-im.db
status-im.subs
[status-im.subs :as subs]))
status-im.subs))
(def transactions [{:timestamp "1505912551000"}
{:timestamp "1505764322000"}
@ -21,6 +17,6 @@
{:timestamp "1505750000000"})}))
(deftest group-transactions-by-date
"Check if transactions are sorted by date"
(is (= (subs/group-transactions-by-date transactions)
grouped-transactions)))
(testing "Check if transactions are sorted by date"
(is (= (#'status-im.subs/group-transactions-by-date transactions)
grouped-transactions))))

View File

@ -1,20 +1,17 @@
(ns ^{:doc "API to init and stop whisper messaging"}
status-im.transport.core
(:require
[re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.waku.core :as waku]
[status-im.native-module.core :as status]
[status-im.mailserver.core :as mailserver]
[status-im.transport.message.core :as message]
[status-im.transport.filters.core :as transport.filters]
[status-im.pairing.core :as pairing]
[status-im.utils.publisher :as publisher]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[taoensso.timbre :as log]
status-im.transport.shh
[status-im.utils.config :as config]))
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.mailserver.core :as mailserver]
[status-im.native-module.core :as status]
[status-im.pairing.core :as pairing]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.utils.publisher :as publisher]
status-im.transport.shh
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn set-node-info [{:keys [db]} node-info]
{:db (assoc db :node-info node-info)})

View File

@ -1,9 +1,8 @@
(ns status-im.transport.core-test
(:require [cljs.test :refer-macros [deftest is testing]]
[status-im.utils.fx :as fx]
[status-im.protocol.core :as protocol]
[status-im.transport.core :as transport]
[status-im.transport.message.core :as message]))
[status-im.transport.message.core :as message]
[status-im.utils.fx :as fx]))
(deftest init-whisper
(let [cofx {:db {:multiaccount {:public-key "1"}}}]

View File

@ -1,19 +1,16 @@
(ns status-im.transport.filters.core
"This namespace is used to handle filters loading and unloading from statusgo"
(:require
[taoensso.timbre :as log]
[re-frame.core :as re-frame]
[clojure.string :as string]
[status-im.contact.db :as contact.db]
[status-im.waku.core :as waku]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.fx :as fx]
[status-im.utils.config :as config]
[status-im.utils.handlers :as handlers]
[status-im.mailserver.topics :as mailserver.topics]
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.transport.utils :as utils]))
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.contact.db :as contact.db]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.mailserver.core :as mailserver]
[status-im.mailserver.topics :as mailserver.topics]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.utils.fx :as fx]
[status-im.utils.handlers :as handlers]
[status-im.waku.core :as waku]
[taoensso.timbre :as log]))
(defn is-public-key? [k]
(string/starts-with? k "0x"))
@ -88,7 +85,7 @@
(defn loaded?
"Given a filter, check if we already loaded it"
[db {:keys [filter-id] :as f}]
[db {:keys [filter-id]}]
(get-in db [:filter/filters filter-id]))
(def not-loaded?
@ -143,8 +140,7 @@
"Returns all the non-negotiated filters matching chat-id"
[db chat-id]
(filter
(fn [{:keys [negotiated?
filter-id] :as f}]
(fn [{:keys [negotiated?] :as f}]
(and (= chat-id
(:chat-id f))
(not negotiated?)))
@ -152,7 +148,8 @@
;; Filter requests
(defn- ->remove-filter-request [{:keys [id filter-id filter]}]
(defn- ->remove-filter-request
[{:keys [id filter-id]}]
{:chatId id
:filterId filter-id})
@ -184,8 +181,8 @@
(mapcat ->filter-request)))
(defn- contacts->filter-requests
[contacts]
"Convert added contacts to filter requests"
[contacts]
(->> contacts
(filter contact.db/added?)
(map #(hash-map :chat-id (:public-key %)))
@ -329,13 +326,13 @@
(handlers/register-handler-fx
:filters.callback/filters-added
(fn [{:keys [db] :as cofx} [_ filters]]
(fn [cofx [_ filters]]
(log/debug "PERF" :filters.callback/filters-added)
(handle-filters-added cofx filters)))
(handlers/register-handler-fx
:filters.callback/filters-removed
(fn [{:keys [db] :as cofx} [_ filters]]
(fn [cofx [_ filters]]
(handle-filters-removed cofx filters)))
(re-frame/reg-fx

View File

@ -59,21 +59,21 @@
(is (= [{:ChatID "0xchat-id"
:OneToOne true
:Identity "chat-id"}]
(transport.filters/chats->filter-requests [{:is-active true
:group-chat false
:chat-id "0xchat-id"}]))))
(#'status-im.transport.filters.core/chats->filter-requests [{:is-active true
:group-chat false
:chat-id "0xchat-id"}]))))
(testing "a malformed one to one chat"
(is (= []
(transport.filters/chats->filter-requests [{:is-active true
:group-chat false
:chat-id "malformed"}]))))
(#'status-im.transport.filters.core/chats->filter-requests [{:is-active true
:group-chat false
:chat-id "malformed"}]))))
(testing "a single public chat"
(is (= [{:ChatID "chat-id"
:OneToOne false}]
(transport.filters/chats->filter-requests [{:is-active true
:group-chat true
:public? true
:chat-id "chat-id"}]))))
(#'status-im.transport.filters.core/chats->filter-requests [{:is-active true
:group-chat true
:public? true
:chat-id "chat-id"}]))))
(testing "a single group chat"
(is (= [{:ChatID "0xchat-id-2"
:OneToOne true
@ -81,20 +81,20 @@
{:ChatID "0xchat-id-1"
:OneToOne true
:Identity "chat-id-1"}]
(transport.filters/chats->filter-requests [{:is-active true
:group-chat true
:members-joined #{"0xchat-id-1" "0xchat-id-2"}
:chat-id "chat-id"}])))))
(#'status-im.transport.filters.core/chats->filter-requests [{:is-active true
:group-chat true
:members-joined #{"0xchat-id-1" "0xchat-id-2"}
:chat-id "chat-id"}])))))
(deftest contacts->filters
(testing "converting contacts to filters"
(is (= [{:ChatID "0xchat-id-2"
:OneToOne true
:Identity "chat-id-2"}]
(transport.filters/contacts->filter-requests [{:system-tags #{}
:public-key "0xchat-id-1"}
{:system-tags #{:contact/added}
:public-key "0xchat-id-2"}])))))
(#'status-im.transport.filters.core/contacts->filter-requests [{:system-tags #{}
:public-key "0xchat-id-1"}
{:system-tags #{:contact/added}
:public-key "0xchat-id-2"}])))))
(deftest load-member
(testing "it returns fx for a member"

View File

@ -2,7 +2,6 @@
status-im.transport.message.protocol
(:require [re-frame.core :as re-frame]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))

View File

@ -1,11 +1,8 @@
(ns ^{:doc "Whisper API and events for managing keys and posting messages"}
status-im.transport.shh
(:require [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum]
[status-im.transport.utils :as transport.utils]
[status-im.utils.config :as config]
[taoensso.timbre :as log]
[status-im.ethereum.json-rpc :as json-rpc]))
[status-im.ethereum.json-rpc :as json-rpc]
[taoensso.timbre :as log]))
(defn generate-sym-key-from-password
[waku-enabled? {:keys [password on-success on-error]}]

View File

@ -2,19 +2,18 @@
(:refer-clojure :exclude [remove])
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.contact.core :as contact]
[status-im.ethereum.contracts :as contracts]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.transactions.core :as transactions]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.signing.core :as signing]
[status-im.tribute-to-talk.db :as tribute-to-talk.db]
[status-im.tribute-to-talk.whitelist :as whitelist]
[status-im.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.utils.money :as money]
[taoensso.timbre :as log]
[status-im.signing.core :as signing]))
[taoensso.timbre :as log]))
(defn add-transaction-hash
[message db]

View File

@ -21,7 +21,7 @@
(.fromWei utils s)))
(defn tribute-status
[{:keys [system-tags tribute-to-talk] :as contact}]
[{:keys [system-tags tribute-to-talk]}]
(let [{:keys [snt-amount transaction-hash]} tribute-to-talk]
(cond (contains? system-tags :tribute-to-talk/paid) :paid
(not (nil? transaction-hash)) :pending
@ -44,7 +44,7 @@
(and (= (to-wei converted-snt-amount)
snt-amount)
(< 0 (js/parseFloat converted-snt-amount) max-snt-amount)))
(catch :default err nil))))
(catch :default _ nil))))
(defn get-settings
[db]

View File

@ -1,10 +1,10 @@
(ns status-im.ui.components.bottom-panel.views
(:require-macros [status-im.utils.views :as views])
(:require [status-im.ui.components.react :as react]
[status-im.ui.components.animation :as anim]
(:require ["react-native" :refer [BackHandler]]
[reagent.core :as reagent]
[status-im.ui.components.animation :as anim]
[status-im.ui.components.colors :as colors]
["react-native" :refer (BackHandler)]))
[status-im.ui.components.react :as react])
(:require-macros [status-im.utils.views :as views]))
(def back-listener (atom nil))
@ -42,7 +42,7 @@
:duration 500
:useNativeDriver true})])))
(defn bottom-panel [obj render window-height]
(defn bottom-panel [_ render window-height]
(let [bottom-anim-value (anim/create-value window-height)
alpha-value (anim/create-value 0)
clear-timeout (atom nil)

View File

@ -1,5 +1,5 @@
(ns status-im.ui.components.button.haptic
(:require [oops.core :refer [oget ocall]]
(:require [oops.core :refer [ocall]]
[react-native-haptic-feedback :default react-native-haptic-feedback]))
(def haptic-methods

View File

@ -6,8 +6,7 @@
[status-im.ui.components.colors :as colors]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.photos :as photos]
[status-im.utils.platform :as platform])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
[status-im.utils.platform :as platform]))
;;TODO REWORK THIS NAMESPACE
@ -151,4 +150,4 @@
(multiaccounts/displayed-name multiaccount)
color
edit?
size {}]))
size {}]))

Some files were not shown because too many files have changed in this diff Show More