Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yenda committed Apr 24, 2020
1 parent 52ccbaf commit 0dbd764
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/status_im/utils/slurp.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(def resources-dir "status-modules/resources/")

(defn check-resources-dir []
(let [^js resources (File. resources-dir)]
(let [resources (File. resources-dir)]
(when-not (.exists resources)
(.mkdir resources))))

Expand Down
2 changes: 1 addition & 1 deletion src/status_im/utils/views.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[form `(deref ~sym)]))
pairs))]))

(defmacro letsubs [args & body])
(defmacro letsubs [_ & _])

(defmacro defview
[n params & rest-body]
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/wallet/accounts/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
(let [{:keys [error]} (types/json->clj result)]
(if (not (string/blank? error))
(new-account-error cofx :password-error error)
(let [{:keys [type step seed private-key]} (:add-account db)]
(let [{:keys [type seed private-key]} (:add-account db)]
(case type
:seed
(import-new-account-seed cofx seed hashed-password)
Expand Down Expand Up @@ -243,7 +243,7 @@

(fx/defn save-account
{:events [:wallet.accounts/save-account]}
[{:keys [db] :as cofx} account {:keys [name color]}]
[{:keys [db]} account {:keys [name color]}]
(let [accounts (:multiaccount/accounts db)
new-account (cond-> account
name (assoc :name name)
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/wallet/choose_recipient/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(-> (js/Promise.all
(clj->js (mapv (fn [ens-name]
(js/Promise.
(fn [resolve reject]
(fn [resolve _]
(ens/get-addr registry ens-name resolve))))
ens-names)))
(.then callback)
Expand Down Expand Up @@ -148,7 +148,7 @@

(fx/defn qr-scanner-result
{:events [:wallet.send/qr-scanner-result]}
[{db :db :as cofx} data opts]
[cofx data _]
(fx/merge cofx
(navigation/navigate-back)
(parse-eip681-uri-and-resolve-ens data)
Expand Down
1 change: 0 additions & 1 deletion src/status_im/wallet/collectibles/core.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns status-im.wallet.collectibles.core
(:require [re-frame.core :as re-frame]
[status-im.browser.core :as browser]
[status-im.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.erc721 :as erc721]
[status-im.ethereum.tokens :as tokens]
Expand Down
18 changes: 8 additions & 10 deletions src/status_im/wallet/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.wallet.core
(:require [clojure.set :as set]
[re-frame.core :as re-frame]
(:require [re-frame.core :as re-frame]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.constants :as constants]
[status-im.waku.core :as waku]
Expand Down Expand Up @@ -62,7 +61,7 @@
(assoc-error-message :balance-update :error-unable-to-get-token-balance))})

(fx/defn open-transaction-details
[{:keys [db] :as cofx} hash address]
[cofx hash address]
(navigation/navigate-to-cofx cofx :wallet-transaction-details {:hash hash :address address}))

(defn- validate-token-name!
Expand All @@ -73,7 +72,7 @@
:outputs ["string"]
:on-success
(fn [[contract-name]]
(when (and (not (empty? contract-name))
(when (and (seq contract-name)
(not= name contract-name))
(let [message (i18n/label :t/token-auto-validate-name-error
{:symbol symbol
Expand All @@ -92,7 +91,7 @@
:on-success
(fn [[contract-symbol]]
;;NOTE(goranjovic): skipping check if field not set in contract
(when (and (not (empty? contract-symbol))
(when (and (seq contract-symbol)
(not= (clojure.core/name symbol) contract-symbol))
(let [message (i18n/label :t/token-auto-validate-symbol-error
{:symbol symbol
Expand Down Expand Up @@ -289,13 +288,13 @@
(prices/update-prices))))

(fx/defn add-custom-token
[{:keys [db] :as cofx} {:keys [symbol]}]
[cofx {:keys [symbol]}]
(fx/merge cofx
(update-toggle-in-settings symbol true)
(update-balances nil)))

(fx/defn remove-custom-token
[{:keys [db] :as cofx} {:keys [symbol]}]
[cofx {:keys [symbol]}]
(update-toggle-in-settings cofx symbol false))

(fx/defn set-and-validate-amount
Expand All @@ -310,7 +309,7 @@

(fx/defn sign-transaction-button-clicked-from-chat
{:events [:wallet.ui/sign-transaction-button-clicked-from-chat]}
[{:keys [db] :as cofx} {:keys [to amount from token request? from-chat? gas gasPrice]}]
[{:keys [db] :as cofx} {:keys [to amount from token]}]
(let [{:keys [symbol address]} token
amount-hex (str "0x" (abi-spec/number-to-hex amount))
to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
Expand Down Expand Up @@ -348,9 +347,8 @@

(fx/defn request-transaction-button-clicked-from-chat
{:events [:wallet.ui/request-transaction-button-clicked]}
[{:keys [db] :as cofx} {:keys [to amount from token from-chat? gas gasPrice]}]
[{:keys [db] :as cofx} {:keys [to amount from token]}]
(let [{:keys [symbol address]} token
to-norm (ethereum/normalized-hex (if (string? to) to (:address to)))
from-address (:address from)
identity (:current-chat-id db)]
(fx/merge cofx
Expand Down
19 changes: 8 additions & 11 deletions src/status_im/wallet/custom_tokens/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
[status-im.utils.money :as money]
[status-im.wallet.core :as wallet]
[status-im.ui.screens.navigation :as navigation]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.wallet.prices :as prices]))

(re-frame/reg-fx
Expand Down Expand Up @@ -167,7 +166,6 @@
{:events [:wallet.custom-token.ui/add-pressed]}
[{:keys [db] :as cofx}]
(let [{:keys [contract name symbol decimals]} (get db :wallet/custom-token-screen)
chain-key (ethereum/chain-keyword db)
symbol (keyword symbol)
new-token {:address contract
:name name
Expand All @@ -187,15 +185,14 @@
(fx/defn remove-custom-token
{:events [:wallet.custom-token.ui/remove-pressed]}
[{:keys [db] :as cofx} {:keys [address] :as token} navigate-back?]
(let [chain-key (ethereum/chain-keyword db)]
(fx/merge cofx
{:db (update db :wallet/all-tokens dissoc address)
::json-rpc/call [{:method "wallet_deleteCustomToken"
:params [address]
:on-success #()}]}
(wallet/remove-custom-token token)
(when navigate-back?
(navigation/navigate-back)))))
(fx/merge cofx
{:db (update db :wallet/all-tokens dissoc address)
::json-rpc/call [{:method "wallet_deleteCustomToken"
:params [address]
:on-success #()}]}
(wallet/remove-custom-token token)
(when navigate-back?
(navigation/navigate-back))))

(fx/defn field-is-edited
[{:keys [db] :as cofx} field-key value]
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/wallet/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@

(defn remove-transactions-since-block
[accounts block]
(reduce-kv (fn [acc account-address {:keys [transactions] :as account}]
(reduce-kv (fn [acc account-address account]
(assoc acc account-address
(update account
:transactions
(fn [transactions]
(into empty-transaction-map
(drop-while (fn [[k v]]
(drop-while (fn [[_ v]]
(>= (int (:block v)) block))
transactions))))))
{}
Expand Down

0 comments on commit 0dbd764

Please sign in to comment.