Code style fix for transaction-related external contribution

This commit is contained in:
Aleksandr Pantiukhov 2018-05-09 11:43:35 +02:00
parent d9755f546d
commit 0347a32d03
No known key found for this signature in database
GPG Key ID: 153E4F21734042F5
2 changed files with 41 additions and 41 deletions

View File

@ -3,12 +3,12 @@
[status-im.utils.platform :as platform])) [status-im.utils.platform :as platform]))
(defn- selectable-text [{:keys [value style]}] (defn- selectable-text [{:keys [value style]}]
(if platform/ios? (if platform/ios?
[react/text-input {:value value [react/text-input {:value value
:editable false :editable false
:multiline true :multiline true
:style style}] :style style}]
[react/text {:style style [react/text {:style style
:accessibility-label :address-text :accessibility-label :address-text
:selectable true} :selectable true}
value])) value]))

View File

@ -64,19 +64,19 @@
:on-error #(re-frame/dispatch [error-event %])}))))) :on-error #(re-frame/dispatch [error-event %])})))))
(reg-fx (reg-fx
:get-transactions :get-transactions
(fn [{:keys [web3 network account-id token-addresses success-event error-event]}] (fn [{:keys [web3 network account-id token-addresses success-event error-event]}]
(transactions/get-transactions network (transactions/get-transactions network
account-id
#(re-frame/dispatch [success-event %])
#(re-frame/dispatch [error-event %]))
(doseq [direction [:inbound :outbound]]
(erc20/get-token-transactions web3
network
token-addresses
direction
account-id account-id
#(re-frame/dispatch [success-event %]) #(re-frame/dispatch [success-event %])))))
#(re-frame/dispatch [error-event %]))
(doseq [direction [:inbound :outbound]]
(erc20/get-token-transactions web3
network
token-addresses
direction
account-id
#(re-frame/dispatch [success-event %])))))
;; TODO(oskarth): At some point we want to get list of relevant assets to get prices for ;; TODO(oskarth): At some point we want to get list of relevant assets to get prices for
(reg-fx (reg-fx
@ -127,21 +127,21 @@
(assoc :prices-loading? true))})))) (assoc :prices-loading? true))}))))
(handlers/register-handler-fx (handlers/register-handler-fx
:update-transactions :update-transactions
(fn [{{:keys [network network-status web3] :as db} :db} _] (fn [{{:keys [network network-status web3] :as db} :db} _]
(when (not= network-status :offline) (when (not= network-status :offline)
(let [chain (ethereum/network->chain-keyword network) (let [chain (ethereum/network->chain-keyword network)
all-tokens (tokens/tokens-for chain) all-tokens (tokens/tokens-for chain)
token-addresses (map :address all-tokens)] token-addresses (map :address all-tokens)]
{:get-transactions {:account-id (get-in db [:account/account :address]) {:get-transactions {:account-id (get-in db [:account/account :address])
:token-addresses token-addresses :token-addresses token-addresses
:network network :network network
:web3 web3 :web3 web3
:success-event :update-transactions-success :success-event :update-transactions-success
:error-event :update-transactions-fail} :error-event :update-transactions-fail}
:db (-> db :db (-> db
(clear-error-message :transactions-update) (clear-error-message :transactions-update)
(assoc-in [:wallet :transactions-loading?] true))})))) (assoc-in [:wallet :transactions-loading?] true))}))))
(defn combine-entries [transaction token-transfer] (defn combine-entries [transaction token-transfer]
(merge transaction (select-keys token-transfer (merge transaction (select-keys token-transfer
@ -160,11 +160,11 @@
:else tx2)) :else tx2))
(handlers/register-handler-db (handlers/register-handler-db
:update-transactions-success :update-transactions-success
(fn [db [_ transactions]] (fn [db [_ transactions]]
(-> db (-> db
(update-in [:wallet :transactions] #(merge-with dedupe-transactions % transactions)) (update-in [:wallet :transactions] #(merge-with dedupe-transactions % transactions))
(assoc-in [:wallet :transactions-loading?] false)))) (assoc-in [:wallet :transactions-loading?] false))))
(handlers/register-handler-db (handlers/register-handler-db
:update-transactions-fail :update-transactions-fail