rename to wallet-legacy (#17673)
This commit is contained in:
parent
e71c167e8a
commit
4a8a23a4c4
|
@ -9,7 +9,7 @@
|
||||||
(get-in db [:profile/profile :currency] :usd))
|
(get-in db [:profile/profile :currency] :usd))
|
||||||
|
|
||||||
(rf/defn set-currency
|
(rf/defn set-currency
|
||||||
{:events [:wallet.settings.ui/currency-selected]}
|
{:events [:wallet-legacy.settings.ui/currency-selected]}
|
||||||
[{:keys [db] :as cofx} currency]
|
[{:keys [db] :as cofx} currency]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(update :address eip55/address->checksum)
|
(update :address eip55/address->checksum)
|
||||||
(update :networks/networks rpc->networks)
|
(update :networks/networks rpc->networks)
|
||||||
(update :networks/current-network #(if (seq %) % config/default-network))
|
(update :networks/current-network #(if (seq %) % config/default-network))
|
||||||
(update :wallet/visible-tokens rpc->visible-tokens)
|
(update :wallet-legacy/visible-tokens rpc->visible-tokens)
|
||||||
(update :pinned-mailservers rpc->pinned-mailservers)
|
(update :pinned-mailservers rpc->pinned-mailservers)
|
||||||
(update :link-previews-enabled-sites set)
|
(update :link-previews-enabled-sites set)
|
||||||
(update :custom-bootnodes rpc->custom-bootnodes)
|
(update :custom-bootnodes rpc->custom-bootnodes)
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
(log/debug "[wallet-subs] recent-history-fetching-started"
|
(log/debug "[wallet-subs] recent-history-fetching-started"
|
||||||
"accounts"
|
"accounts"
|
||||||
accounts)
|
accounts)
|
||||||
(let [event (get db :wallet/on-recent-history-fetching)]
|
(let [event (get db :wallet-legacy/on-recent-history-fetching)]
|
||||||
(cond-> {:db (-> db
|
(cond-> {:db (-> db
|
||||||
(transactions/update-fetching-status accounts :recent? true)
|
(transactions/update-fetching-status accounts :recent? true)
|
||||||
(assoc :wallet/recent-history-fetching-started? true)
|
(assoc :wallet-legacy/recent-history-fetching-started? true)
|
||||||
(dissoc :wallet/on-recent-history-fetching))}
|
(dissoc :wallet-legacy/on-recent-history-fetching))}
|
||||||
event
|
event
|
||||||
(assoc :dispatch event))))
|
(assoc :dispatch event))))
|
||||||
|
|
||||||
|
@ -34,16 +34,16 @@
|
||||||
"block" blockNumber)
|
"block" blockNumber)
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc :ethereum/current-block blockNumber)
|
(assoc :ethereum/current-block blockNumber)
|
||||||
(update-in [:wallet :accounts]
|
(update-in [:wallet-legacy :accounts]
|
||||||
wallet/remove-transactions-since-block
|
wallet/remove-transactions-since-block
|
||||||
blockNumber)
|
blockNumber)
|
||||||
(transactions/update-fetching-status accounts :recent? false)
|
(transactions/update-fetching-status accounts :recent? false)
|
||||||
(dissoc :wallet/waiting-for-recent-history?
|
(dissoc :wallet-legacy/waiting-for-recent-history?
|
||||||
:wallet/refreshing-history?
|
:wallet-legacy/refreshing-history?
|
||||||
:wallet/fetching-error
|
:wallet-legacy/fetching-error
|
||||||
:wallet/recent-history-fetching-started?))
|
:wallet-legacy/recent-history-fetching-started?))
|
||||||
:transactions/get-transfers
|
:transactions/get-transfers
|
||||||
{:chain-tokens (:wallet/all-tokens db)
|
{:chain-tokens (:wallet-legacy/all-tokens db)
|
||||||
:addresses (reduce
|
:addresses (reduce
|
||||||
(fn [v address]
|
(fn [v address]
|
||||||
(let [normalized-address
|
(let [normalized-address
|
||||||
|
@ -60,12 +60,12 @@
|
||||||
[{:keys [db] :as cofx} {:keys [message]}]
|
[{:keys [db] :as cofx} {:keys [message]}]
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
{:db (assoc db :wallet/fetching-error message)}
|
{:db (assoc db :wallet-legacy/fetching-error message)}
|
||||||
(wallet.core/after-checking-history)))
|
(wallet.core/after-checking-history)))
|
||||||
|
|
||||||
(rf/defn non-archival-node-detected
|
(rf/defn non-archival-node-detected
|
||||||
[{:keys [db]} _]
|
[{:keys [db]} _]
|
||||||
{:db (assoc db :wallet/non-archival-node true)})
|
{:db (assoc db :wallet-legacy/non-archival-node true)})
|
||||||
|
|
||||||
(rf/defn new-wallet-event
|
(rf/defn new-wallet-event
|
||||||
[cofx {:keys [type blockNumber accounts] :as event}]
|
[cofx {:keys [type blockNumber accounts] :as event}]
|
||||||
|
|
|
@ -142,7 +142,7 @@
|
||||||
(select-keys transactions
|
(select-keys transactions
|
||||||
(keys (get db :ethereum/watched-transactions)))))
|
(keys (get db :ethereum/watched-transactions)))))
|
||||||
{}
|
{}
|
||||||
(get-in db [:wallet :accounts]))]
|
(get-in db [:wallet-legacy :accounts]))]
|
||||||
(apply rf/merge
|
(apply rf/merge
|
||||||
cofx
|
cofx
|
||||||
(map (fn [[_ transaction]]
|
(map (fn [[_ transaction]]
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
transaction can contain multiple transfers and they would overwrite each other
|
transaction can contain multiple transfers and they would overwrite each other
|
||||||
in the transfer map if identified by hash"
|
in the transfer map if identified by hash"
|
||||||
[{:keys [db] :as cofx} {:keys [hash id address] :as transfer}]
|
[{:keys [db] :as cofx} {:keys [hash id address] :as transfer}]
|
||||||
(let [transfer-by-hash (get-in db [:wallet :accounts address :transactions hash])]
|
(let [transfer-by-hash (get-in db [:wallet-legacy :accounts address :transactions hash])]
|
||||||
(when-let [unique-id (when-not (= transfer transfer-by-hash)
|
(when-let [unique-id (when-not (= transfer transfer-by-hash)
|
||||||
(if (and transfer-by-hash
|
(if (and transfer-by-hash
|
||||||
(not (= :pending
|
(not (= :pending
|
||||||
|
@ -163,22 +163,22 @@
|
||||||
hash))]
|
hash))]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet :accounts address :transactions unique-id]
|
[:wallet-legacy :accounts address :transactions unique-id]
|
||||||
(assoc transfer :hash unique-id))}
|
(assoc transfer :hash unique-id))}
|
||||||
(check-transaction transfer)))))
|
(check-transaction transfer)))))
|
||||||
|
|
||||||
(defn get-min-known-block
|
(defn get-min-known-block
|
||||||
[db address]
|
[db address]
|
||||||
(get-in db [:wallet :accounts (eip55/address->checksum address) :min-block]))
|
(get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :min-block]))
|
||||||
|
|
||||||
(defn get-max-block-with-transfers
|
(defn get-max-block-with-transfers
|
||||||
[db address]
|
[db address]
|
||||||
(get-in db [:wallet :accounts (eip55/address->checksum address) :max-block]))
|
(get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :max-block]))
|
||||||
|
|
||||||
(defn min-block-transfers-count
|
(defn min-block-transfers-count
|
||||||
[db address]
|
[db address]
|
||||||
(get-in db
|
(get-in db
|
||||||
[:wallet :accounts
|
[:wallet-legacy :accounts
|
||||||
(eip55/address->checksum address)
|
(eip55/address->checksum address)
|
||||||
:min-block-transfers-count]))
|
:min-block-transfers-count]))
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
:min-block-transfers-count 1}
|
:min-block-transfers-count 1}
|
||||||
|
|
||||||
(and (= min-block block)
|
(and (= min-block block)
|
||||||
(nil? (get-in db [:wallet :accounts checksum :transactions hash])))
|
(nil? (get-in db [:wallet-legacy :accounts checksum :transactions hash])))
|
||||||
(update acc :min-block-transfers-count inc)
|
(update acc :min-block-transfers-count inc)
|
||||||
|
|
||||||
:else acc))
|
:else acc))
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
"min-block" min-block
|
"min-block" min-block
|
||||||
"min-block-transfers-count" min-block-transfers-count)
|
"min-block-transfers-count" min-block-transfers-count)
|
||||||
{:db (update-in db
|
{:db (update-in db
|
||||||
[:wallet :accounts checksum]
|
[:wallet-legacy :accounts checksum]
|
||||||
assoc
|
assoc
|
||||||
:min-block min-block
|
:min-block min-block
|
||||||
:min-block-transfers-count min-block-transfers-count)}))
|
:min-block-transfers-count min-block-transfers-count)}))
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
[db addresses fetching-type state]
|
[db addresses fetching-type state]
|
||||||
(update-in
|
(update-in
|
||||||
db
|
db
|
||||||
[:wallet :fetching]
|
[:wallet-legacy :fetching]
|
||||||
(fn [accounts]
|
(fn [accounts]
|
||||||
(reduce
|
(reduce
|
||||||
(fn [accounts address]
|
(fn [accounts address]
|
||||||
|
@ -242,7 +242,7 @@
|
||||||
[{:keys [db] :as cofx} address]
|
[{:keys [db] :as cofx} address]
|
||||||
(let [syncing-allowed? (utils.mobile-sync/syncing-allowed? cofx)]
|
(let [syncing-allowed? (utils.mobile-sync/syncing-allowed? cofx)]
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet :fetching address :all-fetched?]
|
[:wallet-legacy :fetching address :all-fetched?]
|
||||||
(if syncing-allowed?
|
(if syncing-allowed?
|
||||||
:all
|
:all
|
||||||
:all-preloaded))}))
|
:all-preloaded))}))
|
||||||
|
@ -326,7 +326,7 @@
|
||||||
|
|
||||||
(defn some-transactions-loaded?
|
(defn some-transactions-loaded?
|
||||||
[db address]
|
[db address]
|
||||||
(not-empty (get-in db [:wallet :accounts address :transactions])))
|
(not-empty (get-in db [:wallet-legacy :accounts address :transactions])))
|
||||||
|
|
||||||
(rf/defn fetch-more-tx
|
(rf/defn fetch-more-tx
|
||||||
{:events [:transactions/fetch-more]}
|
{:events [:transactions/fetch-more]}
|
||||||
|
@ -337,7 +337,7 @@
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
{:transactions/get-transfers
|
{:transactions/get-transfers
|
||||||
{:chain-tokens (:wallet/all-tokens db)
|
{:chain-tokens (:wallet-legacy/all-tokens db)
|
||||||
:addresses [address]
|
:addresses [address]
|
||||||
:before-block min-known-block
|
:before-block min-known-block
|
||||||
:fetch-more? (utils.mobile-sync/syncing-allowed? cofx)
|
:fetch-more? (utils.mobile-sync/syncing-allowed? cofx)
|
||||||
|
@ -353,6 +353,6 @@
|
||||||
{:events [:transaction/get-fetched-transfers]}
|
{:events [:transaction/get-fetched-transfers]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:transactions/get-transfers
|
{:transactions/get-transfers
|
||||||
{:chain-tokens (:wallet/all-tokens db)
|
{:chain-tokens (:wallet-legacy/all-tokens db)
|
||||||
:addresses (map :address (get db :profile/wallet-accounts))
|
:addresses (map :address (get db :profile/wallet-accounts))
|
||||||
:fetch-more? false}})
|
:fetch-more? false}})
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
:add-new-account-pin (keycard/enter-pin-screen-did-load %)
|
:add-new-account-pin (keycard/enter-pin-screen-did-load %)
|
||||||
:keycard-authentication-method (keycard/authentication-method-screen-did-load %)
|
:keycard-authentication-method (keycard/authentication-method-screen-did-load %)
|
||||||
:multiaccounts (keycard/multiaccounts-screen-did-load %)
|
:multiaccounts (keycard/multiaccounts-screen-did-load %)
|
||||||
:wallet (wallet/wallet-will-focus %)
|
:wallet-legacy (wallet/wallet-will-focus %)
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
;;TODO :replace by named events
|
;;TODO :replace by named events
|
||||||
|
@ -252,5 +252,5 @@
|
||||||
|
|
||||||
(re-frame/reg-event-fx :buy-crypto.ui/open-screen
|
(re-frame/reg-event-fx :buy-crypto.ui/open-screen
|
||||||
(fn []
|
(fn []
|
||||||
{:fx [[:dispatch [:wallet/keep-watching]]
|
{:fx [[:dispatch [:wallet-legacy/keep-watching]]
|
||||||
[:dispatch [:open-modal :buy-crypto nil]]]}))
|
[:dispatch [:open-modal :buy-crypto nil]]]}))
|
||||||
|
|
|
@ -52,9 +52,9 @@
|
||||||
|
|
||||||
(defn create-new-account!
|
(defn create-new-account!
|
||||||
[]
|
[]
|
||||||
(rf/dispatch-sync [:wallet.accounts/start-adding-new-account {:type :generate}])
|
(rf/dispatch-sync [:wallet-legacy.accounts/start-adding-new-account {:type :generate}])
|
||||||
(rf/dispatch-sync [:set-in [:add-account :account :name] account-name])
|
(rf/dispatch-sync [:set-in [:add-account :account :name] account-name])
|
||||||
(rf/dispatch [:wallet.accounts/add-new-account (native-module/sha3 password)]))
|
(rf/dispatch [:wallet-legacy.accounts/add-new-account (native-module/sha3 password)]))
|
||||||
|
|
||||||
(defn assert-new-account-created
|
(defn assert-new-account-created
|
||||||
[]
|
[]
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
(assert-messenger-started)
|
(assert-messenger-started)
|
||||||
(create-new-account!) ; create a new account
|
(create-new-account!) ; create a new account
|
||||||
(rf-test/wait-for
|
(rf-test/wait-for
|
||||||
[:wallet.accounts/account-stored]
|
[:wallet-legacy.accounts/account-stored]
|
||||||
(assert-new-account-created) ; assert account was created
|
(assert-new-account-created) ; assert account was created
|
||||||
(logout!)
|
(logout!)
|
||||||
(rf-test/wait-for [::logout/logout-method]))))))
|
(rf-test/wait-for [::logout/logout-method]))))))
|
||||||
|
|
|
@ -227,7 +227,7 @@
|
||||||
;; now for simplicity do not hide bottom sheet when generating key
|
;; now for simplicity do not hide bottom sheet when generating key
|
||||||
;; and exporting key but should be refactored.
|
;; and exporting key but should be refactored.
|
||||||
(when-not (contains? #{:keycard/generate-and-load-key
|
(when-not (contains? #{:keycard/generate-and-load-key
|
||||||
:wallet.accounts/generate-new-keycard-account
|
:wallet-legacy.accounts/generate-new-keycard-account
|
||||||
:keycard/remove-key-with-unpair
|
:keycard/remove-key-with-unpair
|
||||||
:keycard/unpair-and-delete}
|
:keycard/unpair-and-delete}
|
||||||
on-verified)
|
on-verified)
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
:keycard/generate-and-load-key
|
:keycard/generate-and-load-key
|
||||||
:keycard/remove-key-with-unpair
|
:keycard/remove-key-with-unpair
|
||||||
:keycard/unpair-and-delete
|
:keycard/unpair-and-delete
|
||||||
:wallet.accounts/generate-new-keycard-account}
|
:wallet-legacy.accounts/generate-new-keycard-account}
|
||||||
on-verified)
|
on-verified)
|
||||||
(common/get-application-info nil))
|
(common/get-application-info nil))
|
||||||
(when on-verified
|
(when on-verified
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
tag-was-lost?
|
tag-was-lost?
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db [:keycard :pin :status] nil)}
|
{:db (assoc-in db [:keycard :pin :status] nil)}
|
||||||
(common/set-on-card-connected :wallet.accounts/generate-new-keycard-account))
|
(common/set-on-card-connected :wallet-legacy.accounts/generate-new-keycard-account))
|
||||||
|
|
||||||
(not (nil? pin-retries))
|
(not (nil? pin-retries))
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
{:utils/dispatch-later
|
{:utils/dispatch-later
|
||||||
;; We need to give previous sheet some time to be fully hidden
|
;; We need to give previous sheet some time to be fully hidden
|
||||||
[{:ms 200
|
[{:ms 200
|
||||||
:dispatch [:wallet.accounts/verify-pin]}]})
|
:dispatch [:wallet-legacy.accounts/verify-pin]}]})
|
||||||
|
|
||||||
(rf/defn hide-pin-sheet
|
(rf/defn hide-pin-sheet
|
||||||
{:events [:keycard/new-account-pin-sheet-hide]}
|
{:events [:keycard/new-account-pin-sheet-hide]}
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
(subs (native-module/sha3 normalized-key) 26))))
|
(subs (native-module/sha3 normalized-key) 26))))
|
||||||
|
|
||||||
(rf/defn generate-new-keycard-account
|
(rf/defn generate-new-keycard-account
|
||||||
{:events [:wallet.accounts/generate-new-keycard-account]}
|
{:events [:wallet-legacy.accounts/generate-new-keycard-account]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [path-num (inc (get-in db [:profile/profile :latest-derived-path]))
|
(let [path-num (inc (get-in db [:profile/profile :latest-derived-path]))
|
||||||
path (str constants/path-wallet-root "/" path-num)
|
path (str constants/path-wallet-root "/" path-num)
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
(assoc-in
|
(assoc-in
|
||||||
db
|
db
|
||||||
[:keycard :on-export-success]
|
[:keycard :on-export-success]
|
||||||
#(vector :wallet.accounts/account-stored
|
#(vector :wallet-legacy.accounts/account-stored
|
||||||
(let [public-key (utils.hex/normalize-hex %)]
|
(let [public-key (utils.hex/normalize-hex %)]
|
||||||
{;; Strip leading 04 prefix denoting uncompressed key format
|
{;; Strip leading 04 prefix denoting uncompressed key format
|
||||||
:address (eip55/address->checksum
|
:address (eip55/address->checksum
|
||||||
|
@ -66,11 +66,11 @@
|
||||||
:keycard/export-key {:pin pin :path path}}))
|
:keycard/export-key {:pin pin :path path}}))
|
||||||
|
|
||||||
(rf/defn verify-pin
|
(rf/defn verify-pin
|
||||||
{:events [:wallet.accounts/verify-pin]}
|
{:events [:wallet-legacy.accounts/verify-pin]}
|
||||||
[cofx]
|
[cofx]
|
||||||
(common/verify-pin
|
(common/verify-pin
|
||||||
cofx
|
cofx
|
||||||
{:pin-step :export-key
|
{:pin-step :export-key
|
||||||
:on-card-connected :wallet.accounts/verify-pin
|
:on-card-connected :wallet-legacy.accounts/verify-pin
|
||||||
:on-success :wallet.accounts/generate-new-keycard-account
|
:on-success :wallet-legacy.accounts/generate-new-keycard-account
|
||||||
:on-failure :keycard/new-account-pin-sheet}))
|
:on-failure :keycard/new-account-pin-sheet}))
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc db :network-status (if is-connected? :online :offline))}
|
{:db (assoc db :network-status (if is-connected? :online :offline))}
|
||||||
(when (and is-connected?
|
(when (and is-connected?
|
||||||
(or (not= (count (get-in db [:wallet :accounts]))
|
(or (not= (count (get-in db [:wallet-legacy :accounts]))
|
||||||
(count (get db :profile/wallet-accounts)))
|
(count (get db :profile/wallet-accounts)))
|
||||||
(wallet/has-empty-balances? db)))
|
(wallet/has-empty-balances? db)))
|
||||||
(wallet/update-balances nil nil))))
|
(wallet/update-balances nil nil))))
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
:as notification}]
|
:as notification}]
|
||||||
(let [token (if erc20
|
(let [token (if erc20
|
||||||
(get-in db
|
(get-in db
|
||||||
[:wallet/all-tokens (string/lower-case contract)]
|
[:wallet-legacy/all-tokens (string/lower-case contract)]
|
||||||
default-erc20-token)
|
default-erc20-token)
|
||||||
(tokens/native-currency network))
|
(tokens/native-currency network))
|
||||||
amount (money/wei->ether (decode/uint value))
|
amount (money/wei->ether (decode/uint value))
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
(rf/defn handle-eip681
|
(rf/defn handle-eip681
|
||||||
[cofx data]
|
[cofx data]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:dispatch [:wallet/parse-eip681-uri-and-resolve-ens data]}
|
{:dispatch [:wallet-legacy/parse-eip681-uri-and-resolve-ens data]}
|
||||||
(navigation/change-tab :wallet-stack)
|
(navigation/change-tab :wallet-stack)
|
||||||
(navigation/pop-to-root :shell-stack)))
|
(navigation/pop-to-root :shell-stack)))
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
{:db (assoc-in (:db cofx) [:ui/search :currency-filter] search-filter)})
|
{:db (assoc-in (:db cofx) [:ui/search :currency-filter] search-filter)})
|
||||||
|
|
||||||
(rf/defn token-filter-changed
|
(rf/defn token-filter-changed
|
||||||
{:events [:search/token-filter-changed]}
|
{:events [:wallet-legacy/search-token-filter-changed]}
|
||||||
[cofx search-filter]
|
[cofx search-filter]
|
||||||
{:db (assoc-in (:db cofx) [:ui/search :token-filter] search-filter)})
|
{:db (assoc-in (:db cofx) [:ui/search :token-filter] search-filter)})
|
||||||
|
|
||||||
(rf/defn recipient-filter-changed
|
(rf/defn recipient-filter-changed
|
||||||
{:events [:search/recipient-filter-changed]}
|
{:events [:wallet-legacy/search-recipient-filter-changed]}
|
||||||
[cofx search-filter]
|
[cofx search-filter]
|
||||||
{:db (assoc-in (:db cofx) [:ui/search :recipient-filter] search-filter)})
|
{:db (assoc-in (:db cofx) [:ui/search :recipient-filter] search-filter)})
|
||||||
|
|
|
@ -184,7 +184,7 @@
|
||||||
(rf/defn prepare-unconfirmed-transaction
|
(rf/defn prepare-unconfirmed-transaction
|
||||||
[{:keys [db now]} new-tx-hash
|
[{:keys [db now]} new-tx-hash
|
||||||
{:keys [value gasPrice maxFeePerGas maxPriorityFeePerGas gas data to from hash]} symbol amount]
|
{:keys [value gasPrice maxFeePerGas maxPriorityFeePerGas gas data to from hash]} symbol amount]
|
||||||
(let [token (tokens/symbol->token (:wallet/all-tokens db) symbol)
|
(let [token (tokens/symbol->token (:wallet-legacy/all-tokens db) symbol)
|
||||||
from (eip55/address->checksum from)
|
from (eip55/address->checksum from)
|
||||||
;;if there is a hash in the tx object that means we resending transaction
|
;;if there is a hash in the tx object that means we resending transaction
|
||||||
old-tx-hash hash
|
old-tx-hash hash
|
||||||
|
@ -208,8 +208,8 @@
|
||||||
(log/info "[signing] prepare-unconfirmed-transaction" tx)
|
(log/info "[signing] prepare-unconfirmed-transaction" tx)
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
;;remove old transaction, because we replace it with the new one
|
;;remove old transaction, because we replace it with the new one
|
||||||
(update-in [:wallet :accounts from :transactions] dissoc old-tx-hash)
|
(update-in [:wallet-legacy :accounts from :transactions] dissoc old-tx-hash)
|
||||||
(assoc-in [:wallet :accounts from :transactions new-tx-hash] tx))}))
|
(assoc-in [:wallet-legacy :accounts from :transactions new-tx-hash] tx))}))
|
||||||
|
|
||||||
(defn get-method-type
|
(defn get-method-type
|
||||||
[data]
|
[data]
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
|
|
||||||
(defn get-transfer-token
|
(defn get-transfer-token
|
||||||
[db to data]
|
[db to data]
|
||||||
(let [{:keys [decimals] :as token} (tokens/address->token (:wallet/all-tokens db) to)]
|
(let [{:keys [decimals] :as token} (tokens/address->token (:wallet-legacy/all-tokens db) to)]
|
||||||
(when (and token data (string? data))
|
(when (and token data (string? data))
|
||||||
(when-let [type (get-method-type data)]
|
(when-let [type (get-method-type data)]
|
||||||
(let [[address value _] (native-module/decode-parameters
|
(let [[address value _] (native-module/decode-parameters
|
||||||
|
@ -258,7 +258,7 @@
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
:value value
|
:value value
|
||||||
:amount (str eth-amount)
|
:amount (str eth-amount)
|
||||||
:token (tokens/asset-for (:wallet/all-tokens db)
|
:token (tokens/asset-for (:wallet-legacy/all-tokens db)
|
||||||
(chain/get-current-network db)
|
(chain/get-current-network db)
|
||||||
:ETH)}
|
:ETH)}
|
||||||
(not (nil? token))
|
(not (nil? token))
|
||||||
|
@ -352,7 +352,7 @@
|
||||||
{:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true)
|
{:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true)
|
||||||
:signing/update-gas-price
|
:signing/update-gas-price
|
||||||
{:success-callback #(re-frame/dispatch
|
{:success-callback #(re-frame/dispatch
|
||||||
[:wallet.send/update-gas-price-success :signing/tx % tx-obj])
|
[:wallet-legacy.send/update-gas-price-success :signing/tx % tx-obj])
|
||||||
:error-callback #(re-frame/dispatch [:signing/update-gas-price-error %])
|
:error-callback #(re-frame/dispatch [:signing/update-gas-price-error %])
|
||||||
:network-id (get-in (chain/current-network db)
|
:network-id (get-in (chain/current-network db)
|
||||||
[:config :NetworkId])}})))))
|
[:config :NetworkId])}})))))
|
||||||
|
@ -528,14 +528,14 @@
|
||||||
(check-queue)))
|
(check-queue)))
|
||||||
|
|
||||||
(rf/defn sign-transaction-button-clicked-from-chat
|
(rf/defn sign-transaction-button-clicked-from-chat
|
||||||
{:events [:wallet.ui/sign-transaction-button-clicked-from-chat]}
|
{:events [:wallet-legacy.ui/sign-transaction-button-clicked-from-chat]}
|
||||||
[{:keys [db] :as cofx} {:keys [to amount from token]}]
|
[{:keys [db] :as cofx} {:keys [to amount from token]}]
|
||||||
(let [{:keys [symbol address]} token
|
(let [{:keys [symbol address]} token
|
||||||
amount-hex (str "0x" (native-module/number-to-hex amount))
|
amount-hex (str "0x" (native-module/number-to-hex amount))
|
||||||
to-norm (address/normalized-hex (if (string? to) to (:address to)))
|
to-norm (address/normalized-hex (if (string? to) to (:address to)))
|
||||||
from-address (:address from)
|
from-address (:address from)
|
||||||
identity (:current-chat-id db)
|
identity (:current-chat-id db)
|
||||||
db (dissoc db :wallet/prepare-transaction :signing/edit-fee)]
|
db (dissoc db :wallet-legacy/prepare-transaction :signing/edit-fee)]
|
||||||
(if to-norm
|
(if to-norm
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
|
@ -563,15 +563,15 @@
|
||||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})))
|
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})))
|
||||||
|
|
||||||
(rf/defn sign-transaction-button-clicked-from-request
|
(rf/defn sign-transaction-button-clicked-from-request
|
||||||
{:events [:wallet.ui/sign-transaction-button-clicked-from-request]}
|
{:events [:wallet-legacy.ui/sign-transaction-button-clicked-from-request]}
|
||||||
[{:keys [db] :as cofx} {:keys [amount from token]}]
|
[{:keys [db] :as cofx} {:keys [amount from token]}]
|
||||||
(let [{:keys [request-parameters chat-id]} (:wallet/prepare-transaction db)
|
(let [{:keys [request-parameters chat-id]} (:wallet-legacy/prepare-transaction db)
|
||||||
{:keys [symbol address]} token
|
{:keys [symbol address]} token
|
||||||
amount-hex (str "0x" (native-module/number-to-hex amount))
|
amount-hex (str "0x" (native-module/number-to-hex amount))
|
||||||
to-norm (:address request-parameters)
|
to-norm (:address request-parameters)
|
||||||
from-address (:address from)]
|
from-address (:address from)]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (dissoc db :wallet/prepare-transaction :signing/edit-fee)}
|
{:db (dissoc db :wallet-legacy/prepare-transaction :signing/edit-fee)}
|
||||||
(fn [cofx]
|
(fn [cofx]
|
||||||
(sign
|
(sign
|
||||||
cofx
|
cofx
|
||||||
|
@ -590,14 +590,14 @@
|
||||||
:data (native-module/encode-transfer to-norm amount-hex)})})))))
|
:data (native-module/encode-transfer to-norm amount-hex)})})))))
|
||||||
|
|
||||||
(rf/defn sign-transaction-button-clicked
|
(rf/defn sign-transaction-button-clicked
|
||||||
{:events [:wallet.ui/sign-transaction-button-clicked]}
|
{:events [:wallet-legacy.ui/sign-transaction-button-clicked]}
|
||||||
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice maxFeePerGas maxPriorityFeePerGas]}]
|
[{:keys [db] :as cofx} {:keys [to amount from token gas gasPrice maxFeePerGas maxPriorityFeePerGas]}]
|
||||||
(let [{:keys [symbol address]} token
|
(let [{:keys [symbol address]} token
|
||||||
amount-hex (str "0x" (native-module/number-to-hex amount))
|
amount-hex (str "0x" (native-module/number-to-hex amount))
|
||||||
to-norm (address/normalized-hex (if (string? to) to (:address to)))
|
to-norm (address/normalized-hex (if (string? to) to (:address to)))
|
||||||
from-address (:address from)]
|
from-address (:address from)]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (dissoc db :wallet/prepare-transaction :signing/edit-fee)}
|
{:db (dissoc db :wallet-legacy/prepare-transaction :signing/edit-fee)}
|
||||||
(sign
|
(sign
|
||||||
{:tx-obj (merge (if (eip1559/sync-enabled?)
|
{:tx-obj (merge (if (eip1559/sync-enabled?)
|
||||||
{:from from-address
|
{:from from-address
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
(let [{:keys [maxFeePerGas maxPriorityFeePerGas]} (get db :signing/edit-fee)
|
(let [{:keys [maxFeePerGas maxPriorityFeePerGas]} (get db :signing/edit-fee)
|
||||||
latest-base-fee (money/wei->gwei
|
latest-base-fee (money/wei->gwei
|
||||||
(money/bignumber
|
(money/bignumber
|
||||||
(get db :wallet/current-base-fee)))
|
(get db :wallet-legacy/current-base-fee)))
|
||||||
fee-error (cond
|
fee-error (cond
|
||||||
(or (:error maxFeePerGas)
|
(or (:error maxFeePerGas)
|
||||||
(:error maxPriorityFeePerGas))
|
(:error maxPriorityFeePerGas))
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
(defn validate-max-priority-fee
|
(defn validate-max-priority-fee
|
||||||
[db]
|
[db]
|
||||||
(let [{:keys [maxPriorityFeePerGas]} (get db :signing/edit-fee)
|
(let [{:keys [maxPriorityFeePerGas]} (get db :signing/edit-fee)
|
||||||
latest-priority-fee (get db :wallet/current-priority-fee)
|
latest-priority-fee (get db :wallet-legacy/current-priority-fee)
|
||||||
fee-error (cond
|
fee-error (cond
|
||||||
(:error maxPriorityFeePerGas)
|
(:error maxPriorityFeePerGas)
|
||||||
nil
|
nil
|
||||||
|
@ -182,10 +182,10 @@
|
||||||
(rf/defn set-fee-option
|
(rf/defn set-fee-option
|
||||||
{:events [:signing.edit-fee.ui/set-option]}
|
{:events [:signing.edit-fee.ui/set-option]}
|
||||||
[{:keys [db] :as cofx} option]
|
[{:keys [db] :as cofx} option]
|
||||||
(let [tip (get db :wallet/current-priority-fee)
|
(let [tip (get db :wallet-legacy/current-priority-fee)
|
||||||
slow (get db :wallet/slow-base-fee)
|
slow (get db :wallet-legacy/slow-base-fee)
|
||||||
normal (get db :wallet/normal-base-fee)
|
normal (get db :wallet-legacy/normal-base-fee)
|
||||||
fast (get db :wallet/fast-base-fee)
|
fast (get db :wallet-legacy/fast-base-fee)
|
||||||
{:keys [fee tip]} (get (get-fee-options tip slow normal fast) option)]
|
{:keys [fee tip]} (get (get-fee-options tip slow normal fast) option)]
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:signing/edit-fee :selected-fee-option] option)
|
(assoc-in [:signing/edit-fee :selected-fee-option] option)
|
||||||
|
@ -201,7 +201,7 @@
|
||||||
[{:keys [db]} value]
|
[{:keys [db]} value]
|
||||||
(let [{:keys [maxFeePerGas maxPriorityFeePerGas]}
|
(let [{:keys [maxFeePerGas maxPriorityFeePerGas]}
|
||||||
(get db :signing/edit-fee)
|
(get db :signing/edit-fee)
|
||||||
latest-base-fee (get db :wallet/current-base-fee)
|
latest-base-fee (get db :wallet-legacy/current-base-fee)
|
||||||
max-fee-value (:value-number maxFeePerGas)
|
max-fee-value (:value-number maxFeePerGas)
|
||||||
max-priority-fee-value (:value-number maxPriorityFeePerGas)
|
max-priority-fee-value (:value-number maxPriorityFeePerGas)
|
||||||
new-value (money/bignumber value)
|
new-value (money/bignumber value)
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
:<- [:multiaccount/default-account]
|
:<- [:multiaccount/default-account]
|
||||||
:<- [:multiaccount/public-key]
|
:<- [:multiaccount/public-key]
|
||||||
:<- [:chain-id]
|
:<- [:chain-id]
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [[{:keys [custom-domain? username address]}
|
(fn [[{:keys [custom-domain? username address]}
|
||||||
chain default-account public-key chain-id wallet]]
|
chain default-account public-key chain-id wallet]]
|
||||||
(let [address (or address (address/normalized-hex (:address default-account)))
|
(let [address (or address (address/normalized-hex (:address default-account)))
|
||||||
|
|
|
@ -67,38 +67,40 @@
|
||||||
(reg-root-key-sub :contacts/search-query :contacts/search-query)
|
(reg-root-key-sub :contacts/search-query :contacts/search-query)
|
||||||
|
|
||||||
;;wallet
|
;;wallet
|
||||||
(reg-root-key-sub :wallet :wallet)
|
|
||||||
(reg-root-key-sub :prices :prices)
|
(reg-root-key-sub :prices :prices)
|
||||||
(reg-root-key-sub :prices-loading? :prices-loading?)
|
(reg-root-key-sub :prices-loading? :prices-loading?)
|
||||||
(reg-root-key-sub :wallet.transactions :wallet.transactions)
|
|
||||||
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
|
|
||||||
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
|
|
||||||
(reg-root-key-sub :wallet-service/manual-setting :wallet-service/manual-setting)
|
|
||||||
(reg-root-key-sub :wallet/recipient :wallet/recipient)
|
|
||||||
(reg-root-key-sub :wallet/favourites :wallet/favourites)
|
|
||||||
(reg-root-key-sub :wallet/refreshing-history? :wallet/refreshing-history?)
|
|
||||||
(reg-root-key-sub :wallet/fetching-error :wallet/fetching-error)
|
|
||||||
(reg-root-key-sub :wallet/non-archival-node :wallet/non-archival-node)
|
|
||||||
(reg-root-key-sub :wallet/current-base-fee :wallet/current-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/slow-base-fee :wallet/slow-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/normal-base-fee :wallet/normal-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/fast-base-fee :wallet/fast-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/current-priority-fee :wallet/current-priority-fee)
|
|
||||||
(reg-root-key-sub :wallet/transactions-management-enabled? :wallet/transactions-management-enabled?)
|
|
||||||
(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens)
|
|
||||||
(reg-root-key-sub :wallet/collectible-collections :wallet/collectible-collections)
|
|
||||||
(reg-root-key-sub :wallet/fetching-collection-assets :wallet/fetching-collection-assets)
|
|
||||||
(reg-root-key-sub :wallet/collectible-assets :wallet/collectible-assets)
|
|
||||||
(reg-root-key-sub :wallet/selected-collectible :wallet/selected-collectible)
|
|
||||||
(reg-root-key-sub :wallet/modal-selecting-source-token? :wallet/modal-selecting-source-token?)
|
|
||||||
(reg-root-key-sub :wallet/swap-from-token :wallet/swap-from-token)
|
|
||||||
(reg-root-key-sub :wallet/swap-to-token :wallet/swap-to-token)
|
|
||||||
(reg-root-key-sub :wallet/swap-from-token-amount :wallet/swap-from-token-amount)
|
|
||||||
(reg-root-key-sub :wallet/swap-to-token-amount :wallet/swap-to-token-amount)
|
|
||||||
(reg-root-key-sub :wallet/swap-advanced-mode? :wallet/swap-advanced-mode?)
|
|
||||||
(reg-root-key-sub :add-account :add-account)
|
(reg-root-key-sub :add-account :add-account)
|
||||||
(reg-root-key-sub :buy-crypto/on-ramps :buy-crypto/on-ramps)
|
(reg-root-key-sub :buy-crypto/on-ramps :buy-crypto/on-ramps)
|
||||||
|
|
||||||
|
(reg-root-key-sub :wallet-legacy :wallet-legacy)
|
||||||
|
(reg-root-key-sub :wallet-legacy.transactions :wallet-legacy.transactions)
|
||||||
|
(reg-root-key-sub :wallet-legacy/custom-token-screen :wallet-legacy/custom-token-screen)
|
||||||
|
(reg-root-key-sub :wallet-legacy/prepare-transaction :wallet-legacy/prepare-transaction)
|
||||||
|
(reg-root-key-sub :wallet-legacy/recipient :wallet-legacy/recipient)
|
||||||
|
(reg-root-key-sub :wallet-legacy/favourites :wallet-legacy/favourites)
|
||||||
|
(reg-root-key-sub :wallet-legacy/refreshing-history? :wallet-legacy/refreshing-history?)
|
||||||
|
(reg-root-key-sub :wallet-legacy/fetching-error :wallet-legacy/fetching-error)
|
||||||
|
(reg-root-key-sub :wallet-legacy/non-archival-node :wallet-legacy/non-archival-node)
|
||||||
|
(reg-root-key-sub :wallet-legacy/current-base-fee :wallet-legacy/current-base-fee)
|
||||||
|
(reg-root-key-sub :wallet-legacy/slow-base-fee :wallet-legacy/slow-base-fee)
|
||||||
|
(reg-root-key-sub :wallet-legacy/normal-base-fee :wallet-legacy/normal-base-fee)
|
||||||
|
(reg-root-key-sub :wallet-legacy/fast-base-fee :wallet-legacy/fast-base-fee)
|
||||||
|
(reg-root-key-sub :wallet-legacy/current-priority-fee :wallet-legacy/current-priority-fee)
|
||||||
|
(reg-root-key-sub :wallet-legacy/transactions-management-enabled?
|
||||||
|
:wallet-legacy/transactions-management-enabled?)
|
||||||
|
(reg-root-key-sub :wallet-legacy/all-tokens :wallet-legacy/all-tokens)
|
||||||
|
(reg-root-key-sub :wallet-legacy/collectible-collections :wallet-legacy/collectible-collections)
|
||||||
|
(reg-root-key-sub :wallet-legacy/fetching-collection-assets :wallet-legacy/fetching-collection-assets)
|
||||||
|
(reg-root-key-sub :wallet-legacy/collectible-assets :wallet-legacy/collectible-assets)
|
||||||
|
(reg-root-key-sub :wallet-legacy/selected-collectible :wallet-legacy/selected-collectible)
|
||||||
|
(reg-root-key-sub :wallet-legacy/modal-selecting-source-token?
|
||||||
|
:wallet-legacy/modal-selecting-source-token?)
|
||||||
|
(reg-root-key-sub :wallet-legacy/swap-from-token :wallet-legacy/swap-from-token)
|
||||||
|
(reg-root-key-sub :wallet-legacy/swap-to-token :wallet-legacy/swap-to-token)
|
||||||
|
(reg-root-key-sub :wallet-legacy/swap-from-token-amount :wallet-legacy/swap-from-token-amount)
|
||||||
|
(reg-root-key-sub :wallet-legacy/swap-to-token-amount :wallet-legacy/swap-to-token-amount)
|
||||||
|
(reg-root-key-sub :wallet-legacy/swap-advanced-mode? :wallet-legacy/swap-advanced-mode?)
|
||||||
|
|
||||||
;;; Link previews
|
;;; Link previews
|
||||||
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
|
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
|
||||||
(reg-root-key-sub :chat/link-previews :chat/link-previews)
|
(reg-root-key-sub :chat/link-previews :chat/link-previews)
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
[code display-name]))
|
[code display-name]))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:search/filtered-currencies
|
:wallet-legacy/search-filtered-currencies
|
||||||
:<- [:search/currency-filter]
|
:<- [:search/currency-filter]
|
||||||
(fn [search-currency-filter]
|
(fn [search-currency-filter]
|
||||||
{:search-filter search-currency-filter
|
{:search-filter search-currency-filter
|
||||||
|
@ -55,9 +55,15 @@
|
||||||
[(:symbol token) (:name token)])
|
[(:symbol token) (:name token)])
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/filtered-grouped-chain-tokens
|
:wallet-legacy/search-token-filter
|
||||||
:<- [:wallet/grouped-chain-tokens]
|
:<- [:ui/search]
|
||||||
:<- [:search/token-filter]
|
(fn [search]
|
||||||
|
(get search :token-filter)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
:wallet-legacy/filtered-grouped-chain-tokens
|
||||||
|
:<- [:wallet-legacy/grouped-chain-tokens]
|
||||||
|
:<- [:wallet-legacy/search-token-filter]
|
||||||
(fn [[{custom-tokens true default-tokens nil} search-token-filter]]
|
(fn [[{custom-tokens true default-tokens nil} search-token-filter]]
|
||||||
{:search-filter search-token-filter
|
{:search-filter search-token-filter
|
||||||
:tokens {true (apply-filter search-token-filter custom-tokens extract-token-attributes false)
|
:tokens {true (apply-filter search-token-filter custom-tokens extract-token-attributes false)
|
||||||
|
|
|
@ -11,35 +11,35 @@
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::send-transaction
|
::send-transaction
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet]
|
(fn [wallet]
|
||||||
(:send-transaction wallet)))
|
(:send-transaction wallet)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.send/symbol
|
:wallet-legacy.send/symbol
|
||||||
:<- [::send-transaction]
|
:<- [::send-transaction]
|
||||||
(fn [send-transaction]
|
(fn [send-transaction]
|
||||||
(:symbol send-transaction)))
|
(:symbol send-transaction)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.send/camera-flashlight
|
:wallet-legacy.send/camera-flashlight
|
||||||
:<- [::send-transaction]
|
:<- [::send-transaction]
|
||||||
(fn [send-transaction]
|
(fn [send-transaction]
|
||||||
(:camera-flashlight send-transaction)))
|
(:camera-flashlight send-transaction)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/settings
|
:wallet-legacy/settings
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [{:keys [settings]}]
|
(fn [{:keys [settings]}]
|
||||||
(reduce-kv #(conj %1 %3) [] settings)))
|
(reduce-kv #(conj %1 %3) [] settings)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.request/transaction
|
:wallet-legacy.request/transaction
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
:request-transaction)
|
:request-transaction)
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/binance-chain?
|
:wallet-legacy/binance-chain?
|
||||||
:<- [:current-network]
|
:<- [:current-network]
|
||||||
(fn [network]
|
(fn [network]
|
||||||
(chain/binance-chain-id? (get-in network [:config :NetworkId]))))
|
(chain/binance-chain-id? (get-in network [:config :NetworkId]))))
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:signing/currencies
|
:signing/currencies
|
||||||
:<- [:prices]
|
:<- [:prices]
|
||||||
:<- [:wallet/currency]
|
:<- [:wallet-legacy/currency]
|
||||||
:<- [:ethereum/native-currency]
|
:<- [:ethereum/native-currency]
|
||||||
(fn [[prices {:keys [code]} {sym :symbol}]]
|
(fn [[prices {:keys [code]} {sym :symbol}]]
|
||||||
[(name sym)
|
[(name sym)
|
||||||
|
@ -62,10 +62,10 @@
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:signing/priority-fee-suggestions-range
|
:signing/priority-fee-suggestions-range
|
||||||
:<- [:wallet/current-priority-fee]
|
:<- [:wallet-legacy/current-priority-fee]
|
||||||
:<- [:wallet/slow-base-fee]
|
:<- [:wallet-legacy/slow-base-fee]
|
||||||
:<- [:wallet/normal-base-fee]
|
:<- [:wallet-legacy/normal-base-fee]
|
||||||
:<- [:wallet/fast-base-fee]
|
:<- [:wallet-legacy/fast-base-fee]
|
||||||
(fn [[latest-tip slow normal fast]]
|
(fn [[latest-tip slow normal fast]]
|
||||||
(reduce
|
(reduce
|
||||||
(fn [acc [k fees]]
|
(fn [acc [k fees]]
|
||||||
|
@ -181,11 +181,11 @@
|
||||||
(get-sufficient-gas-error gas-error-message balance nil nil gas gas-price)))))
|
(get-sufficient-gas-error gas-error-message balance nil nil gas gas-price)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.send/prepare-transaction-with-balance
|
:wallet-legacy.send/prepare-transaction-with-balance
|
||||||
:<- [:wallet/prepare-transaction]
|
:<- [:wallet-legacy/prepare-transaction]
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
:<- [:offline?]
|
:<- [:offline?]
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet-legacy/all-tokens]
|
||||||
:<- [:current-network]
|
:<- [:current-network]
|
||||||
(fn [[{:keys [from to amount-text] :as transaction}
|
(fn [[{:keys [from to amount-text] :as transaction}
|
||||||
wallet offline? all-tokens current-network]]
|
wallet offline? all-tokens current-network]]
|
||||||
|
@ -209,11 +209,11 @@
|
||||||
(not offline?))))))
|
(not offline?))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.request/prepare-transaction-with-balance
|
:wallet-legacy.request/prepare-transaction-with-balance
|
||||||
:<- [:wallet/prepare-transaction]
|
:<- [:wallet-legacy/prepare-transaction]
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
:<- [:offline?]
|
:<- [:offline?]
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet-legacy/all-tokens]
|
||||||
:<- [:current-network]
|
:<- [:current-network]
|
||||||
(fn [[{:keys [from to amount-text] :as transaction}
|
(fn [[{:keys [from to amount-text] :as transaction}
|
||||||
wallet offline? all-tokens current-network]]
|
wallet offline? all-tokens current-network]]
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
[utils.money :as money]))
|
[utils.money :as money]))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/accounts
|
:wallet-legacy/accounts
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet]
|
(fn [wallet]
|
||||||
(get wallet :accounts)))
|
(get wallet :accounts)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/account-by-transaction-hash
|
:wallet-legacy/account-by-transaction-hash
|
||||||
:<- [:wallet/accounts]
|
:<- [:wallet-legacy/accounts]
|
||||||
(fn [accounts [_ tx-hash]]
|
(fn [accounts [_ tx-hash]]
|
||||||
(some (fn [[address account]]
|
(some (fn [[address account]]
|
||||||
(when-let [transaction (get-in account [:transactions tx-hash])]
|
(when-let [transaction (get-in account [:transactions tx-hash])]
|
||||||
|
@ -25,14 +25,14 @@
|
||||||
accounts)))
|
accounts)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/transactions
|
:wallet-legacy/transactions
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet [_ address]]
|
(fn [wallet [_ address]]
|
||||||
(get-in wallet [:accounts address :transactions])))
|
(get-in wallet [:accounts address :transactions])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/filters
|
:wallet-legacy/filters
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet]
|
(fn [wallet]
|
||||||
(get wallet :filters)))
|
(get wallet :filters)))
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@
|
||||||
:currency-text currency-text))))
|
:currency-text currency-text))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions/transactions
|
:wallet-legacy.transactions/transactions
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:wallet/transactions address])
|
[(re-frame/subscribe [:wallet-legacy/transactions address])
|
||||||
(re-frame/subscribe [:contacts/contacts-by-address])
|
(re-frame/subscribe [:contacts/contacts-by-address])
|
||||||
(re-frame/subscribe [:ethereum/native-currency])])
|
(re-frame/subscribe [:ethereum/native-currency])])
|
||||||
(fn [[transactions contacts native-currency]]
|
(fn [[transactions contacts native-currency]]
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
transactions)))
|
transactions)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions/all-filters?
|
:wallet-legacy.transactions/all-filters?
|
||||||
:<- [:wallet/filters]
|
:<- [:wallet-legacy/filters]
|
||||||
(fn [filters]
|
(fn [filters]
|
||||||
(= wallet.db/default-wallet-filters
|
(= wallet.db/default-wallet-filters
|
||||||
filters)))
|
filters)))
|
||||||
|
@ -89,8 +89,8 @@
|
||||||
:failed (i18n/label :t/failed)})
|
:failed (i18n/label :t/failed)})
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions/filters
|
:wallet-legacy.transactions/filters
|
||||||
:<- [:wallet/filters]
|
:<- [:wallet-legacy/filters]
|
||||||
(fn [filters]
|
(fn [filters]
|
||||||
(map (fn [id]
|
(map (fn [id]
|
||||||
(let [checked? (filters id)]
|
(let [checked? (filters id)]
|
||||||
|
@ -98,20 +98,20 @@
|
||||||
:label (filters-labels id)
|
:label (filters-labels id)
|
||||||
:checked? checked?
|
:checked? checked?
|
||||||
:on-touch #(if checked?
|
:on-touch #(if checked?
|
||||||
(re-frame/dispatch [:wallet.transactions/remove-filter id])
|
(re-frame/dispatch [:wallet-legacy.transactions/remove-filter id])
|
||||||
(re-frame/dispatch [:wallet.transactions/add-filter id]))}))
|
(re-frame/dispatch [:wallet-legacy.transactions/add-filter id]))}))
|
||||||
wallet.db/default-wallet-filters)))
|
wallet.db/default-wallet-filters)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions.filters/screen
|
:wallet-legacy.transactions.filters/screen
|
||||||
:<- [:wallet.transactions/filters]
|
:<- [:wallet-legacy.transactions/filters]
|
||||||
:<- [:wallet.transactions/all-filters?]
|
:<- [:wallet-legacy.transactions/all-filters?]
|
||||||
(fn [[filters all-filters?]]
|
(fn [[filters all-filters?]]
|
||||||
{:all-filters? all-filters?
|
{:all-filters? all-filters?
|
||||||
:filters filters
|
:filters filters
|
||||||
:on-touch-select-all (when-not all-filters?
|
:on-touch-select-all (when-not all-filters?
|
||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:wallet.transactions/add-all-filters]))}))
|
[:wallet-legacy.transactions/add-all-filters]))}))
|
||||||
|
|
||||||
(defn- enrich-transaction-for-list
|
(defn- enrich-transaction-for-list
|
||||||
[filters
|
[filters
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
:contact to-contact
|
:contact to-contact
|
||||||
:address to))
|
:address to))
|
||||||
:time-formatted (datetime/timestamp->time timestamp)
|
:time-formatted (datetime/timestamp->time timestamp)
|
||||||
:on-touch-fn #(re-frame/dispatch [:wallet.ui/show-transaction-details
|
:on-touch-fn #(re-frame/dispatch [:wallet-legacy.ui/show-transaction-details
|
||||||
(:hash transaction)
|
(:hash transaction)
|
||||||
address]))))
|
address]))))
|
||||||
|
|
||||||
|
@ -149,11 +149,11 @@
|
||||||
:data (sort-by :timestamp > transactions)}))))
|
:data (sort-by :timestamp > transactions)}))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions.history/screen
|
:wallet-legacy.transactions.history/screen
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:wallet.transactions/transactions address])
|
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])
|
||||||
(re-frame/subscribe [:wallet/filters])
|
(re-frame/subscribe [:wallet-legacy/filters])
|
||||||
(re-frame/subscribe [:wallet.transactions/all-filters?])])
|
(re-frame/subscribe [:wallet-legacy.transactions/all-filters?])])
|
||||||
(fn [[transactions filters all-filters?] [_ address]]
|
(fn [[transactions filters all-filters?] [_ address]]
|
||||||
{:all-filters? all-filters?
|
{:all-filters? all-filters?
|
||||||
:total (count transactions)
|
:total (count transactions)
|
||||||
|
@ -164,9 +164,9 @@
|
||||||
(group-transactions-by-date))}))
|
(group-transactions-by-date))}))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/recipient-recent-txs
|
:wallet-legacy/recipient-recent-txs
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:wallet.transactions/transactions address])])
|
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])])
|
||||||
(fn [[transactions] _]
|
(fn [[transactions] _]
|
||||||
(->> transactions
|
(->> transactions
|
||||||
vals
|
vals
|
||||||
|
@ -175,9 +175,9 @@
|
||||||
(take 3))))
|
(take 3))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions.details/current-transaction
|
:wallet-legacy.transactions.details/current-transaction
|
||||||
(fn [[_ _ address] _]
|
(fn [[_ _ address] _]
|
||||||
[(re-frame/subscribe [:wallet.transactions/transactions address])
|
[(re-frame/subscribe [:wallet-legacy.transactions/transactions address])
|
||||||
(re-frame/subscribe [:ethereum/native-currency])
|
(re-frame/subscribe [:ethereum/native-currency])
|
||||||
(re-frame/subscribe [:chain-id])])
|
(re-frame/subscribe [:chain-id])])
|
||||||
(fn [[transactions native-currency chain-id] [_ tx-hash _]]
|
(fn [[transactions native-currency chain-id] [_ tx-hash _]]
|
||||||
|
@ -222,9 +222,9 @@
|
||||||
(:hash transaction))}))))))
|
(:hash transaction))}))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.transactions.details/screen
|
:wallet-legacy.transactions.details/screen
|
||||||
(fn [[_ tx-hash address] _]
|
(fn [[_ tx-hash address] _]
|
||||||
[(re-frame/subscribe [:wallet.transactions.details/current-transaction tx-hash address])
|
[(re-frame/subscribe [:wallet-legacy.transactions.details/current-transaction tx-hash address])
|
||||||
(re-frame/subscribe [:ethereum/current-block])])
|
(re-frame/subscribe [:ethereum/current-block])])
|
||||||
(fn [[transaction current-block]]
|
(fn [[transaction current-block]]
|
||||||
(let [confirmations (wallet.db/get-confirmations transaction
|
(let [confirmations (wallet.db/get-confirmations transaction
|
||||||
|
|
|
@ -11,20 +11,20 @@
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:balance
|
:balance
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet [_ address]]
|
(fn [wallet [_ address]]
|
||||||
(get-in wallet [:accounts address :balance])))
|
(get-in wallet [:accounts address :balance])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:balance-default
|
:balance-default
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
:<- [:profile/wallet-accounts]
|
:<- [:profile/wallet-accounts]
|
||||||
(fn [[wallet accounts]]
|
(fn [[wallet accounts]]
|
||||||
(get-in wallet [:accounts (:address (wallet.utils/get-default-account accounts)) :balance])))
|
(get-in wallet [:accounts (:address (wallet.utils/get-default-account accounts)) :balance])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:balances
|
:balances
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
:<- [:multiaccount/visible-accounts]
|
:<- [:multiaccount/visible-accounts]
|
||||||
(fn [[wallet accounts]]
|
(fn [[wallet accounts]]
|
||||||
(let [accounts (map :address accounts)]
|
(let [accounts (map :address accounts)]
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
(get-in prices [fsym tsym :last-day])))
|
(get-in prices [fsym tsym :last-day])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet.settings/currency
|
:wallet-legacy/settings-currency
|
||||||
:<- [:profile/profile]
|
:<- [:profile/profile]
|
||||||
(fn [settings]
|
(fn [settings]
|
||||||
(or (get settings :currency) :usd)))
|
(or (get settings :currency) :usd)))
|
||||||
|
@ -74,8 +74,8 @@
|
||||||
balance))
|
balance))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/token->decimals
|
:wallet-legacy/token->decimals
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet-legacy/all-tokens]
|
||||||
(fn [all-tokens]
|
(fn [all-tokens]
|
||||||
(into {} (map #(vector (:symbol %) (:decimals %)) (vals all-tokens)))))
|
(into {} (map #(vector (:symbol %) (:decimals %)) (vals all-tokens)))))
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@
|
||||||
:portfolio-value
|
:portfolio-value
|
||||||
:<- [:balances]
|
:<- [:balances]
|
||||||
:<- [:prices]
|
:<- [:prices]
|
||||||
:<- [:wallet/currency]
|
:<- [:wallet-legacy/currency]
|
||||||
:<- [:wallet/token->decimals]
|
:<- [:wallet-legacy/token->decimals]
|
||||||
(fn [[balances prices currency token->decimals]]
|
(fn [[balances prices currency token->decimals]]
|
||||||
(if (and balances prices)
|
(if (and balances prices)
|
||||||
(let [currency-key (-> currency :code keyword)
|
(let [currency-key (-> currency :code keyword)
|
||||||
|
@ -105,8 +105,8 @@
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:balance address])
|
[(re-frame/subscribe [:balance address])
|
||||||
(re-frame/subscribe [:prices])
|
(re-frame/subscribe [:prices])
|
||||||
(re-frame/subscribe [:wallet/currency])
|
(re-frame/subscribe [:wallet-legacy/currency])
|
||||||
(re-frame/subscribe [:wallet/token->decimals])])
|
(re-frame/subscribe [:wallet-legacy/token->decimals])])
|
||||||
(fn [[balance prices currency token->decimals]]
|
(fn [[balance prices currency token->decimals]]
|
||||||
(if (and balance prices)
|
(if (and balance prices)
|
||||||
(let [currency-key (-> currency :code keyword)
|
(let [currency-key (-> currency :code keyword)
|
||||||
|
@ -120,40 +120,40 @@
|
||||||
"...")))
|
"...")))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/sorted-tokens
|
:wallet-legacy/sorted-tokens
|
||||||
:<- [:wallet/all-tokens]
|
:<- [:wallet-legacy/all-tokens]
|
||||||
(fn [all-tokens]
|
(fn [all-tokens]
|
||||||
(tokens/sorted-tokens-for all-tokens)))
|
(tokens/sorted-tokens-for all-tokens)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/grouped-chain-tokens
|
:wallet-legacy/grouped-chain-tokens
|
||||||
:<- [:wallet/sorted-tokens]
|
:<- [:wallet-legacy/sorted-tokens]
|
||||||
:<- [:wallet/visible-tokens-symbols]
|
:<- [:wallet-legacy/visible-tokens-symbols]
|
||||||
(fn [[all-tokens visible-tokens]]
|
(fn [[all-tokens visible-tokens]]
|
||||||
(let [vt-set (set visible-tokens)]
|
(let [vt-set (set visible-tokens)]
|
||||||
(group-by :custom?
|
(group-by :custom?
|
||||||
(map #(assoc % :checked? (boolean (get vt-set (keyword (:symbol %))))) all-tokens)))))
|
(map #(assoc % :checked? (boolean (get vt-set (keyword (:symbol %))))) all-tokens)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/fetching-tx-history?
|
:wallet-legacy/fetching-tx-history?
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet [_ address]]
|
(fn [wallet [_ address]]
|
||||||
(get-in wallet [:fetching address :history?])))
|
(get-in wallet [:fetching address :history?])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/fetching-recent-tx-history?
|
:wallet-legacy/fetching-recent-tx-history?
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet [_ address]]
|
(fn [wallet [_ address]]
|
||||||
(get-in wallet [:fetching address :recent?])))
|
(get-in wallet [:fetching address :recent?])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/tx-history-fetched?
|
:wallet-legacy/tx-history-fetched?
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet [_ address]]
|
(fn [wallet [_ address]]
|
||||||
(get-in wallet [:fetching address :all-fetched?])))
|
(get-in wallet [:fetching address :all-fetched?])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/chain-explorer-link
|
:wallet-legacy/chain-explorer-link
|
||||||
(fn [db [_ address]]
|
(fn [db [_ address]]
|
||||||
(let [network (:networks/current-network db)
|
(let [network (:networks/current-network db)
|
||||||
link (get-in config/default-networks-by-id
|
link (get-in config/default-networks-by-id
|
||||||
|
@ -162,33 +162,33 @@
|
||||||
(str link address)))))
|
(str link address)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/error-message
|
:wallet-legacy/error-message
|
||||||
:<- [:wallet]
|
:<- [:wallet-legacy]
|
||||||
(fn [wallet]
|
(fn [wallet]
|
||||||
(or (get-in wallet [:errors :balance-update])
|
(or (get-in wallet [:errors :balance-update])
|
||||||
(get-in wallet [:errors :prices-update]))))
|
(get-in wallet [:errors :prices-update]))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-tokens-symbols
|
:wallet-legacy/visible-tokens-symbols
|
||||||
:<- [:ethereum/chain-keyword]
|
:<- [:ethereum/chain-keyword]
|
||||||
:<- [:profile/profile]
|
:<- [:profile/profile]
|
||||||
(fn [[chain current-multiaccount]]
|
(fn [[chain current-multiaccount]]
|
||||||
(get-in current-multiaccount [:wallet/visible-tokens chain])))
|
(get-in current-multiaccount [:wallet-legacy/visible-tokens chain])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-assets
|
:wallet-legacy/visible-assets
|
||||||
:<- [:current-network]
|
:<- [:current-network]
|
||||||
:<- [:wallet/visible-tokens-symbols]
|
:<- [:wallet-legacy/visible-tokens-symbols]
|
||||||
:<- [:wallet/sorted-tokens]
|
:<- [:wallet-legacy/sorted-tokens]
|
||||||
(fn [[network visible-tokens-symbols all-tokens-sorted]]
|
(fn [[network visible-tokens-symbols all-tokens-sorted]]
|
||||||
(conj (filter #(contains? visible-tokens-symbols (:symbol %)) all-tokens-sorted)
|
(conj (filter #(contains? visible-tokens-symbols (:symbol %)) all-tokens-sorted)
|
||||||
(tokens/native-currency network))))
|
(tokens/native-currency network))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-assets-with-amount
|
:wallet-legacy/visible-assets-with-amount
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:balance address])
|
[(re-frame/subscribe [:balance address])
|
||||||
(re-frame/subscribe [:wallet/visible-assets])])
|
(re-frame/subscribe [:wallet-legacy/visible-assets])])
|
||||||
(fn [[balance visible-assets]]
|
(fn [[balance visible-assets]]
|
||||||
(map #(assoc % :amount (get balance (:symbol %))) visible-assets)))
|
(map #(assoc % :amount (get balance (:symbol %))) visible-assets)))
|
||||||
|
|
||||||
|
@ -208,11 +208,11 @@
|
||||||
(i18n/format-currency (:code currency))))))))
|
(i18n/format-currency (:code currency))))))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/visible-assets-with-values
|
:wallet-legacy/visible-assets-with-values
|
||||||
(fn [[_ address] _]
|
(fn [[_ address] _]
|
||||||
[(re-frame/subscribe [:wallet/visible-assets-with-amount address])
|
[(re-frame/subscribe [:wallet-legacy/visible-assets-with-amount address])
|
||||||
(re-frame/subscribe [:prices])
|
(re-frame/subscribe [:prices])
|
||||||
(re-frame/subscribe [:wallet/currency])])
|
(re-frame/subscribe [:wallet-legacy/currency])])
|
||||||
(fn [[assets prices currency]]
|
(fn [[assets prices currency]]
|
||||||
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
|
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
|
||||||
tokens-with-values (map (update-value prices currency) tokens)]
|
tokens-with-values (map (update-value prices currency) tokens)]
|
||||||
|
@ -228,17 +228,17 @@
|
||||||
balances))
|
balances))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/all-visible-assets-with-amount
|
:wallet-legacy/all-visible-assets-with-amount
|
||||||
:<- [:balances]
|
:<- [:balances]
|
||||||
:<- [:wallet/visible-assets]
|
:<- [:wallet-legacy/visible-assets]
|
||||||
(fn [[balances visible-assets]]
|
(fn [[balances visible-assets]]
|
||||||
(map #(assoc % :amount (get-asset-amount balances (:symbol %))) visible-assets)))
|
(map #(assoc % :amount (get-asset-amount balances (:symbol %))) visible-assets)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/all-visible-assets-with-values
|
:wallet-legacy/all-visible-assets-with-values
|
||||||
:<- [:wallet/all-visible-assets-with-amount]
|
:<- [:wallet-legacy/all-visible-assets-with-amount]
|
||||||
:<- [:prices]
|
:<- [:prices]
|
||||||
:<- [:wallet/currency]
|
:<- [:wallet-legacy/currency]
|
||||||
(fn [[assets prices currency]]
|
(fn [[assets prices currency]]
|
||||||
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
|
(let [{:keys [tokens nfts]} (group-by #(if (:nft? %) :nfts :tokens) assets)
|
||||||
tokens-with-values (map (update-value prices currency) tokens)]
|
tokens-with-values (map (update-value prices currency) tokens)]
|
||||||
|
@ -246,15 +246,15 @@
|
||||||
:nfts nfts})))
|
:nfts nfts})))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/transferrable-assets-with-amount
|
:wallet-legacy/transferrable-assets-with-amount
|
||||||
(fn [[_ address]]
|
(fn [[_ address]]
|
||||||
(re-frame/subscribe [:wallet/visible-assets-with-amount address]))
|
(re-frame/subscribe [:wallet-legacy/visible-assets-with-amount address]))
|
||||||
(fn [all-assets]
|
(fn [all-assets]
|
||||||
(filter #(not (:nft? %)) all-assets)))
|
(filter #(not (:nft? %)) all-assets)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/currency
|
:wallet-legacy/currency
|
||||||
:<- [:wallet.settings/currency]
|
:<- [:wallet-legacy/settings-currency]
|
||||||
(fn [currency-id]
|
(fn [currency-id]
|
||||||
(get currency/currencies currency-id (get currency/currencies :usd))))
|
(get currency/currencies currency-id (get currency/currencies :usd))))
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@
|
||||||
(string/includes? (string/lower-case (str name)) search-filter))
|
(string/includes? (string/lower-case (str name)) search-filter))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/favourites-filtered
|
:wallet-legacy/favourites-filtered
|
||||||
:<- [:wallet/favourites]
|
:<- [:wallet-legacy/favourites]
|
||||||
:<- [:search/recipient-filter]
|
:<- [:wallet-legacy/search-recipient-filter]
|
||||||
(fn [[favs search-filter]]
|
(fn [[favs search-filter]]
|
||||||
(let [favs (vals favs)]
|
(let [favs (vals favs)]
|
||||||
(if (string/blank? search-filter)
|
(if (string/blank? search-filter)
|
||||||
|
@ -275,21 +275,21 @@
|
||||||
favs)))))
|
favs)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/collectible-collection
|
:wallet-legacy/collectible-collection
|
||||||
:<- [:wallet/collectible-collections]
|
:<- [:wallet-legacy/collectible-collections]
|
||||||
(fn [all-collections [_ address]]
|
(fn [all-collections [_ address]]
|
||||||
(when address
|
(when address
|
||||||
(let [all-collections (get all-collections (string/lower-case address) [])]
|
(let [all-collections (get all-collections (string/lower-case address) [])]
|
||||||
(sort-by :name all-collections)))))
|
(sort-by :name all-collections)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/collectible-assets-by-collection-and-address
|
:wallet-legacy/collectible-assets-by-collection-and-address
|
||||||
:<- [:wallet/collectible-assets]
|
:<- [:wallet-legacy/collectible-assets]
|
||||||
(fn [all-assets [_ address collectible-slug]]
|
(fn [all-assets [_ address collectible-slug]]
|
||||||
(get-in all-assets [address collectible-slug] [])))
|
(get-in all-assets [address collectible-slug] [])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:wallet/fetching-assets-by-collectible-slug
|
:wallet-legacy/fetching-assets-by-collectible-slug
|
||||||
:<- [:wallet/fetching-collection-assets]
|
:<- [:wallet-legacy/fetching-collection-assets]
|
||||||
(fn [fetching-collection-assets [_ collectible-slug]]
|
(fn [fetching-collection-assets [_ collectible-slug]]
|
||||||
(get fetching-collection-assets collectible-slug false)))
|
(get fetching-collection-assets collectible-slug false)))
|
||||||
|
|
|
@ -55,16 +55,16 @@
|
||||||
[sub-name]
|
[sub-name]
|
||||||
(swap! rf-db/app-db assoc
|
(swap! rf-db/app-db assoc
|
||||||
:profile/wallet-accounts accounts
|
:profile/wallet-accounts accounts
|
||||||
:wallet wallet)
|
:wallet-legacy wallet)
|
||||||
(is (= [{:ETH money-eth
|
(is (= [{:ETH money-eth
|
||||||
:SNT money-snt}
|
:SNT money-snt}
|
||||||
{:ETH money-eth
|
{:ETH money-eth
|
||||||
:SNT money-snt}]
|
:SNT money-snt}]
|
||||||
(rf/sub [sub-name]))))
|
(rf/sub [sub-name]))))
|
||||||
|
|
||||||
(h/deftest-sub :wallet/token->decimals
|
(h/deftest-sub :wallet-legacy/token->decimals
|
||||||
[sub-name]
|
[sub-name]
|
||||||
(swap! rf-db/app-db assoc :wallet/all-tokens tokens)
|
(swap! rf-db/app-db assoc :wallet-legacy/all-tokens tokens)
|
||||||
(is (= {:SNT 18 :ETH 18}
|
(is (= {:SNT 18 :ETH 18}
|
||||||
(rf/sub [sub-name]))))
|
(rf/sub [sub-name]))))
|
||||||
|
|
||||||
|
@ -92,18 +92,18 @@
|
||||||
{:balance {:ETH money-zero
|
{:balance {:ETH money-zero
|
||||||
:SNT money-zero}}}}]
|
:SNT money-zero}}}}]
|
||||||
(swap! rf-db/app-db assoc
|
(swap! rf-db/app-db assoc
|
||||||
:profile/wallet-accounts accounts
|
:profile/wallet-accounts accounts
|
||||||
:prices prices
|
:prices prices
|
||||||
:wallet empty-wallet
|
:wallet-legacy empty-wallet
|
||||||
:wallet/all-tokens tokens)
|
:wallet-legacy/all-tokens tokens)
|
||||||
(is (= "0" (rf/sub [sub-name])))))
|
(is (= "0" (rf/sub [sub-name])))))
|
||||||
|
|
||||||
(testing "returns formatted value in the default USD currency"
|
(testing "returns formatted value in the default USD currency"
|
||||||
(swap! rf-db/app-db assoc
|
(swap! rf-db/app-db assoc
|
||||||
:profile/wallet-accounts accounts
|
:profile/wallet-accounts accounts
|
||||||
:prices prices
|
:prices prices
|
||||||
:wallet wallet
|
:wallet-legacy wallet
|
||||||
:wallet/all-tokens tokens)
|
:wallet-legacy/all-tokens tokens)
|
||||||
(is (= "20,550.76" (rf/sub [sub-name])))))
|
(is (= "20,550.76" (rf/sub [sub-name])))))
|
||||||
|
|
||||||
(h/deftest-sub :account-portfolio-value
|
(h/deftest-sub :account-portfolio-value
|
||||||
|
@ -116,18 +116,18 @@
|
||||||
{:balance {:ETH money-zero
|
{:balance {:ETH money-zero
|
||||||
:SNT money-zero}}}}]
|
:SNT money-zero}}}}]
|
||||||
(swap! rf-db/app-db assoc
|
(swap! rf-db/app-db assoc
|
||||||
:profile/wallet-accounts accounts
|
:profile/wallet-accounts accounts
|
||||||
:prices prices
|
:prices prices
|
||||||
:wallet empty-wallet
|
:wallet-legacy empty-wallet
|
||||||
:wallet/all-tokens tokens)
|
:wallet-legacy/all-tokens tokens)
|
||||||
(is (= "0" (rf/sub [sub-name main-account-id])))))
|
(is (= "0" (rf/sub [sub-name main-account-id])))))
|
||||||
|
|
||||||
(testing "returns formatted value in the default USD currency"
|
(testing "returns formatted value in the default USD currency"
|
||||||
(swap! rf-db/app-db assoc
|
(swap! rf-db/app-db assoc
|
||||||
:profile/wallet-accounts accounts
|
:profile/wallet-accounts accounts
|
||||||
:prices prices
|
:prices prices
|
||||||
:wallet wallet
|
:wallet-legacy wallet
|
||||||
:wallet/all-tokens tokens)
|
:wallet-legacy/all-tokens tokens)
|
||||||
(is (= "10,275.38" (rf/sub [sub-name main-account-id])))))
|
(is (= "10,275.38" (rf/sub [sub-name main-account-id])))))
|
||||||
|
|
||||||
(def transactions
|
(def transactions
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
network-name [:network-name]
|
network-name [:network-name]
|
||||||
waku-bloom-filter-mode [:waku/bloom-filter-mode]
|
waku-bloom-filter-mode [:waku/bloom-filter-mode]
|
||||||
wakuv2-flag [:waku/v2-flag]
|
wakuv2-flag [:waku/v2-flag]
|
||||||
transactions-management-enabled? [:wallet/transactions-management-enabled?]
|
transactions-management-enabled? [:wallet-legacy/transactions-management-enabled?]
|
||||||
current-log-level [:log-level/current-log-level]
|
current-log-level [:log-level/current-log-level]
|
||||||
current-fleet [:fleets/current-fleet]]
|
current-fleet [:fleets/current-fleet]]
|
||||||
[list/flat-list
|
[list/flat-list
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
[{:keys [id code display-name]} _ _ current-currency-id]
|
[{:keys [id code display-name]} _ _ current-currency-id]
|
||||||
(let [selected? (= id current-currency-id)]
|
(let [selected? (= id current-currency-id)]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(re-frame/dispatch [:wallet.settings.ui/currency-selected id])
|
{:on-press #(re-frame/dispatch [:wallet-legacy.settings.ui/currency-selected id])
|
||||||
:accessibility-label :currency-item}
|
:accessibility-label :currency-item}
|
||||||
[react/view styles/currency-item
|
[react/view styles/currency-item
|
||||||
[react/text {:style styles/currency-name-text}
|
[react/text {:style styles/currency-name-text}
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
(views/defview currency-settings
|
(views/defview currency-settings
|
||||||
[]
|
[]
|
||||||
(views/letsubs [currency-id [:wallet.settings/currency]
|
(views/letsubs [currency-id [:wallet-legacy/settings-currency]
|
||||||
{:keys [currencies search-filter]} [:search/filtered-currencies]]
|
{:keys [currencies search-filter]} [:wallet-legacy/search-filtered-currencies]]
|
||||||
{:component-will-unmount #(do
|
{:component-will-unmount #(do
|
||||||
(re-frame/dispatch [:search/currency-filter-changed nil])
|
(re-frame/dispatch [:search/currency-filter-changed nil])
|
||||||
(reset! search-active? false))}
|
(reset! search-active? false))}
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
[]
|
[]
|
||||||
(letsubs [read-once? (atom false)
|
(letsubs [read-once? (atom false)
|
||||||
{:keys [height width]} [:dimensions/window]
|
{:keys [height width]} [:dimensions/window]
|
||||||
camera-flashlight [:wallet.send/camera-flashlight]
|
camera-flashlight [:wallet-legacy.send/camera-flashlight]
|
||||||
opts [:get-screen-params]
|
opts [:get-screen-params]
|
||||||
camera-ref (atom nil)]
|
camera-ref (atom nil)]
|
||||||
[react/view
|
[react/view
|
||||||
|
|
|
@ -141,8 +141,8 @@
|
||||||
|
|
||||||
;;WALLET
|
;;WALLET
|
||||||
|
|
||||||
{:name :wallet
|
{:name :wallet-legacy
|
||||||
:on-focus [:wallet/tab-opened]
|
:on-focus [:wallet-legacy/tab-opened]
|
||||||
;;TODO wallet redesign
|
;;TODO wallet redesign
|
||||||
;;:options {:statusBar {:backgroundColor quo.colors/neutral-5}}
|
;;:options {:statusBar {:backgroundColor quo.colors/neutral-5}}
|
||||||
:component wallet.accounts/accounts-overview-old}
|
:component wallet.accounts/accounts-overview-old}
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
:options {:insets {:top? true}}
|
:options {:insets {:top? true}}
|
||||||
:component wallet-settings/manage-assets}
|
:component wallet-settings/manage-assets}
|
||||||
{:name :wallet-add-custom-token
|
{:name :wallet-add-custom-token
|
||||||
:on-focus [:wallet/wallet-add-custom-token]
|
:on-focus [:wallet-legacy/wallet-add-custom-token]
|
||||||
:options {:topBar {:title {:text (i18n/label :t/add-custom-token)}}
|
:options {:topBar {:title {:text (i18n/label :t/add-custom-token)}}
|
||||||
:insets {:top? true}}
|
:insets {:top? true}}
|
||||||
:component custom-tokens/add-custom-token}
|
:component custom-tokens/add-custom-token}
|
||||||
|
@ -473,7 +473,7 @@
|
||||||
|
|
||||||
;[Wallet] Prepare Transaction
|
;[Wallet] Prepare Transaction
|
||||||
{:name :prepare-send-transaction
|
{:name :prepare-send-transaction
|
||||||
:on-dissmiss [:wallet/cancel-transaction-command]
|
:on-dissmiss [:wallet-legacy/cancel-transaction-command]
|
||||||
:options {:topBar {:title {:text (i18n/label :t/send-transaction)}}
|
:options {:topBar {:title {:text (i18n/label :t/send-transaction)}}
|
||||||
:swipeToDismiss false
|
:swipeToDismiss false
|
||||||
:hardwareBackButton {:dismissModalOnPress false}
|
:hardwareBackButton {:dismissModalOnPress false}
|
||||||
|
@ -483,7 +483,7 @@
|
||||||
|
|
||||||
;[Wallet] Request Transaction
|
;[Wallet] Request Transaction
|
||||||
{:name :request-transaction
|
{:name :request-transaction
|
||||||
:on-dissmiss [:wallet/cancel-transaction-command]
|
:on-dissmiss [:wallet-legacy/cancel-transaction-command]
|
||||||
:options {:topBar {:title {:text (i18n/label :t/request-transaction)}}
|
:options {:topBar {:title {:text (i18n/label :t/request-transaction)}}
|
||||||
:swipeToDismiss false
|
:swipeToDismiss false
|
||||||
:hardwareBackButton {:dismissModalOnPress false}
|
:hardwareBackButton {:dismissModalOnPress false}
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
[gas-edit
|
[gas-edit
|
||||||
max-fee-per-gas-edit
|
max-fee-per-gas-edit
|
||||||
max-priority-fee-per-gas-edit])
|
max-priority-fee-per-gas-edit])
|
||||||
base-fee @(re-frame/subscribe [:wallet/current-base-fee])
|
base-fee @(re-frame/subscribe [:wallet-legacy/current-base-fee])
|
||||||
[fee-currency fiat-currency price]
|
[fee-currency fiat-currency price]
|
||||||
@(re-frame/subscribe [:signing/currencies])
|
@(re-frame/subscribe [:signing/currencies])
|
||||||
fee-eth
|
fee-eth
|
||||||
|
@ -306,9 +306,9 @@
|
||||||
|
|
||||||
(defn fees-warning
|
(defn fees-warning
|
||||||
[]
|
[]
|
||||||
(let [base-fee @(re-frame/subscribe [:wallet/current-base-fee])
|
(let [base-fee @(re-frame/subscribe [:wallet-legacy/current-base-fee])
|
||||||
base-fee-gwei (money/wei-> :gwei (money/bignumber base-fee))
|
base-fee-gwei (money/wei-> :gwei (money/bignumber base-fee))
|
||||||
priority-fee @(re-frame/subscribe [:wallet/current-priority-fee])
|
priority-fee @(re-frame/subscribe [:wallet-legacy/current-priority-fee])
|
||||||
priority-fee-gwei (money/wei-> :gwei (money/bignumber priority-fee))
|
priority-fee-gwei (money/wei-> :gwei (money/bignumber priority-fee))
|
||||||
{priority-fee-edit :maxPriorityFeePerGas
|
{priority-fee-edit :maxPriorityFeePerGas
|
||||||
fee-edit :maxFeePerGas}
|
fee-edit :maxFeePerGas}
|
||||||
|
|
|
@ -481,10 +481,10 @@
|
||||||
[:signing/amount-errors (:address from)]
|
[:signing/amount-errors (:address from)]
|
||||||
keycard-multiaccount? [:keycard-multiaccount?]
|
keycard-multiaccount? [:keycard-multiaccount?]
|
||||||
prices [:prices]
|
prices [:prices]
|
||||||
wallet-currency [:wallet/currency]
|
wallet-currency [:wallet-legacy/currency]
|
||||||
mainnet? [:mainnet?]
|
mainnet? [:mainnet?]
|
||||||
prices-loading? [:prices-loading?]
|
prices-loading? [:prices-loading?]
|
||||||
management-enabled? [:wallet/transactions-management-enabled?]]
|
management-enabled? [:wallet-legacy/transactions-management-enabled?]]
|
||||||
(let [display-symbol (wallet.utils/display-symbol token)
|
(let [display-symbol (wallet.utils/display-symbol token)
|
||||||
fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))]
|
fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))]
|
||||||
[react/view (styles/sheet)
|
[react/view (styles/sheet)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
(views/defview account-card
|
(views/defview account-card
|
||||||
[{:keys [address color type] :as account}]
|
[{:keys [address color type] :as account}]
|
||||||
(views/letsubs [currency [:wallet/currency]
|
(views/letsubs [currency [:wallet-legacy/currency]
|
||||||
portfolio-value [:account-portfolio-value address]
|
portfolio-value [:account-portfolio-value address]
|
||||||
window-width [:dimensions/window-width]
|
window-width [:dimensions/window-width]
|
||||||
prices-loading? [:prices-loading?]]
|
prices-loading? [:prices-loading?]]
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
:color colors/white-transparent-70-persist}}
|
:color colors/white-transparent-70-persist}}
|
||||||
(address/normalized-hex address)]]
|
(address/normalized-hex address)]]
|
||||||
[react/view {:position :absolute :top 12 :right 12}
|
[react/view {:position :absolute :top 12 :right 12}
|
||||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:wallet/share-popover address])}
|
[react/touchable-highlight {:on-press #(re-frame/dispatch [:wallet-legacy/share-popover address])}
|
||||||
[icons/icon :main-icons/share
|
[icons/icon :main-icons/share
|
||||||
{:color colors/white-persist
|
{:color colors/white-persist
|
||||||
:accessibility-label :share-wallet-address-icon}]]]
|
:accessibility-label :share-wallet-address-icon}]]]
|
||||||
|
@ -81,17 +81,17 @@
|
||||||
(i18n/label :t/wallet-send)
|
(i18n/label :t/wallet-send)
|
||||||
:main-icons/send
|
:main-icons/send
|
||||||
colors/white-persist
|
colors/white-persist
|
||||||
#(re-frame/dispatch [:wallet/prepare-transaction-from-wallet account])])
|
#(re-frame/dispatch [:wallet-legacy/prepare-transaction-from-wallet account])])
|
||||||
[react/view {:style (styles/divider)}]
|
[react/view {:style (styles/divider)}]
|
||||||
[button
|
[button
|
||||||
(i18n/label :t/receive)
|
(i18n/label :t/receive)
|
||||||
:main-icons/receive
|
:main-icons/receive
|
||||||
colors/white-persist
|
colors/white-persist
|
||||||
#(re-frame/dispatch [:wallet/share-popover address])]]]))
|
#(re-frame/dispatch [:wallet-legacy/share-popover address])]]]))
|
||||||
|
|
||||||
(views/defview transactions
|
(views/defview transactions
|
||||||
[address]
|
[address]
|
||||||
(views/letsubs [data [:wallet.transactions.history/screen address]]
|
(views/letsubs [data [:wallet-legacy.transactions.history/screen address]]
|
||||||
[history/history-list data address]))
|
[history/history-list data address]))
|
||||||
|
|
||||||
(defn opensea-link
|
(defn opensea-link
|
||||||
|
@ -115,10 +115,10 @@
|
||||||
|
|
||||||
(views/defview assets-and-collections-new
|
(views/defview assets-and-collections-new
|
||||||
[address]
|
[address]
|
||||||
(views/letsubs [{:keys [tokens]} [:wallet/visible-assets-with-values address]
|
(views/letsubs [{:keys [tokens]} [:wallet-legacy/visible-assets-with-values address]
|
||||||
currency [:wallet/currency]
|
currency [:wallet-legacy/currency]
|
||||||
opensea-enabled? [:opensea-enabled?]
|
opensea-enabled? [:opensea-enabled?]
|
||||||
collectible-collection [:wallet/collectible-collection address]]
|
collectible-collection [:wallet-legacy/collectible-collection address]]
|
||||||
;ethereum-network? [:ethereum-network?]]
|
;ethereum-network? [:ethereum-network?]]
|
||||||
(let [tab @selected-tab]
|
(let [tab @selected-tab]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
|
@ -176,12 +176,12 @@
|
||||||
(i18n/label :t/wallet-send)
|
(i18n/label :t/wallet-send)
|
||||||
:main-icons/send
|
:main-icons/send
|
||||||
colors/blue-persist
|
colors/blue-persist
|
||||||
#(re-frame/dispatch [:wallet/prepare-transaction-from-wallet account])])
|
#(re-frame/dispatch [:wallet-legacy/prepare-transaction-from-wallet account])])
|
||||||
[button
|
[button
|
||||||
(i18n/label :t/receive)
|
(i18n/label :t/receive)
|
||||||
:main-icons/receive
|
:main-icons/receive
|
||||||
colors/blue-persist
|
colors/blue-persist
|
||||||
#(re-frame/dispatch [:wallet/share-popover address])]])
|
#(re-frame/dispatch [:wallet-legacy/share-popover address])]])
|
||||||
|
|
||||||
(defn anim-listener
|
(defn anim-listener
|
||||||
[anim-y scroll-y]
|
[anim-y scroll-y]
|
||||||
|
@ -231,10 +231,10 @@
|
||||||
|
|
||||||
(views/defview assets-and-collections
|
(views/defview assets-and-collections
|
||||||
[address]
|
[address]
|
||||||
(views/letsubs [{:keys [tokens]} [:wallet/visible-assets-with-values address]
|
(views/letsubs [{:keys [tokens]} [:wallet-legacy/visible-assets-with-values address]
|
||||||
currency [:wallet/currency]
|
currency [:wallet-legacy/currency]
|
||||||
opensea-enabled? [:opensea-enabled?]
|
opensea-enabled? [:opensea-enabled?]
|
||||||
collectible-collection [:wallet/collectible-collection address]
|
collectible-collection [:wallet-legacy/collectible-collection address]
|
||||||
ethereum-network? [:ethereum-network?]]
|
ethereum-network? [:ethereum-network?]]
|
||||||
(let [{:keys [tab]} @state]
|
(let [{:keys [tab]} @state]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
|
@ -272,11 +272,11 @@
|
||||||
(defn account-new
|
(defn account-new
|
||||||
[selected-account]
|
[selected-account]
|
||||||
(let [;{:keys [name address] :as account} (rf/sub [:account-by-address selected-account])
|
(let [;{:keys [name address] :as account} (rf/sub [:account-by-address selected-account])
|
||||||
currency (rf/sub [:wallet/currency])
|
currency (rf/sub [:wallet-legacy/currency])
|
||||||
portfolio-value (rf/sub [:account-portfolio-value selected-account])
|
portfolio-value (rf/sub [:account-portfolio-value selected-account])
|
||||||
width (rf/sub [:dimensions/window-width])
|
width (rf/sub [:dimensions/window-width])
|
||||||
button-width (/ (- width 40 (* 2 12)) 3)]
|
button-width (/ (- width 40 (* 2 12)) 3)]
|
||||||
;fetching-error (rf/sub [:wallet/fetching-error])]
|
;fetching-error (rf/sub [:wallet-legacy/fetching-error])]
|
||||||
[react/view
|
[react/view
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:background-color (quo.colors/theme-colors quo.colors/white quo.colors/neutral-90)
|
:background-color (quo.colors/theme-colors quo.colors/white quo.colors/neutral-90)
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
(views/defview account
|
(views/defview account
|
||||||
[]
|
[]
|
||||||
(views/letsubs [{:keys [name address] :as current-account} [:multiaccount/current-account]
|
(views/letsubs [{:keys [name address] :as current-account} [:multiaccount/current-account]
|
||||||
fetching-error [:wallet/fetching-error]]
|
fetching-error [:wallet-legacy/fetching-error]]
|
||||||
(let [anim-y (animation/create-value button-group-height)
|
(let [anim-y (animation/create-value button-group-height)
|
||||||
scroll-y (animation/create-value 0)]
|
scroll-y (animation/create-value 0)]
|
||||||
(anim-listener anim-y scroll-y)
|
(anim-listener anim-y scroll-y)
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
:refreshControl (common/refresh-control
|
:refreshControl (common/refresh-control
|
||||||
(and
|
(and
|
||||||
@common/updates-counter
|
@common/updates-counter
|
||||||
@(re-frame/subscribe [:wallet/refreshing-history?])))}
|
@(re-frame/subscribe [:wallet-legacy/refreshing-history?])))}
|
||||||
(when fetching-error
|
(when fetching-error
|
||||||
[react/view
|
[react/view
|
||||||
{:style {:flex 1
|
{:style {:flex 1
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
(str @error)))}]
|
(str @error)))}]
|
||||||
[quo/button
|
[quo/button
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
(re-frame/dispatch [:wallet.accounts/delete-key
|
(re-frame/dispatch [:wallet-legacy.accounts/delete-key
|
||||||
account
|
account
|
||||||
@password
|
@password
|
||||||
#(reset! error :wrong-password)])
|
#(reset! error :wrong-password)])
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
[{:label (i18n/label :t/apply)
|
[{:label (i18n/label :t/apply)
|
||||||
:on-press
|
:on-press
|
||||||
#(do
|
#(do
|
||||||
(re-frame/dispatch [:wallet.accounts/save-account
|
(re-frame/dispatch [:wallet-legacy.accounts/save-account
|
||||||
account
|
account
|
||||||
@new-account])
|
@new-account])
|
||||||
(reset! new-account nil))}]))]
|
(reset! new-account nil))}]))]
|
||||||
|
@ -172,5 +172,6 @@
|
||||||
{:theme :negative
|
{:theme :negative
|
||||||
:title (i18n/label :t/delete-account)
|
:title (i18n/label :t/delete-account)
|
||||||
:on-press #(if (= :watch type)
|
:on-press #(if (= :watch type)
|
||||||
(re-frame/dispatch [:wallet.settings/show-delete-account-confirmation account])
|
(re-frame/dispatch [:wallet-legacy.settings/show-delete-account-confirmation
|
||||||
|
account])
|
||||||
(re-frame/dispatch [:show-popover {:view [delete-account account]}]))}]])]]]))
|
(re-frame/dispatch [:show-popover {:view [delete-account account]}]))}]])]]]))
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
(utils.utils/set-timeout
|
(utils.utils/set-timeout
|
||||||
(fn []
|
(fn []
|
||||||
(swap! updates-counter inc)
|
(swap! updates-counter inc)
|
||||||
(when @(re-frame/subscribe [:wallet/refreshing-history?])
|
(when @(re-frame/subscribe [:wallet-legacy/refreshing-history?])
|
||||||
(schedule-counter-reset)))
|
(schedule-counter-reset)))
|
||||||
1000))
|
1000))
|
||||||
|
|
||||||
(defn refresh-action
|
(defn refresh-action
|
||||||
[]
|
[]
|
||||||
(schedule-counter-reset)
|
(schedule-counter-reset)
|
||||||
(re-frame/dispatch [:wallet.ui/pull-to-refresh-history]))
|
(re-frame/dispatch [:wallet-legacy.ui/pull-to-refresh-history]))
|
||||||
|
|
||||||
(defn refresh-control
|
(defn refresh-control
|
||||||
[refreshing?]
|
[refreshing?]
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
:icon :main-icons/refresh
|
:icon :main-icons/refresh
|
||||||
:accessibility-label :wallet-scan-token
|
:accessibility-label :wallet-scan-token
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet/update-balances nil true])}]
|
[:wallet-legacy/update-balances nil true])}]
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:theme :accent
|
{:theme :accent
|
||||||
:title (i18n/label :t/set-currency)
|
:title (i18n/label :t/set-currency)
|
||||||
|
@ -74,14 +74,14 @@
|
||||||
:icon :main-icons/send
|
:icon :main-icons/send
|
||||||
:accessibility-label :send-transaction-button
|
:accessibility-label :send-transaction-button
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet/prepare-transaction-from-wallet account])}])
|
[:wallet-legacy/prepare-transaction-from-wallet account])}])
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:theme :accent
|
{:theme :accent
|
||||||
:title (i18n/label :t/share)
|
:title (i18n/label :t/share)
|
||||||
:icon :main-icons/share
|
:icon :main-icons/share
|
||||||
:accessibility-label :share-account-button
|
:accessibility-label :share-account-button
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet/share-popover (:address account)])}]
|
[:wallet-legacy/share-popover (:address account)])}]
|
||||||
(when-not wallet
|
(when-not wallet
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:theme :accent
|
{:theme :accent
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
:icon :main-icons/hide
|
:icon :main-icons/hide
|
||||||
:accessibility-label :hide-account-button
|
:accessibility-label :hide-account-button
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.accounts/save-account account {:hidden true}])}])])
|
[:wallet-legacy.accounts/save-account account {:hidden true}])}])])
|
||||||
|
|
||||||
(defn add-account
|
(defn add-account
|
||||||
[]
|
[]
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
:icon :main-icons/add
|
:icon :main-icons/add
|
||||||
:accessibility-label :add-account-sheet-generate
|
:accessibility-label :add-account-sheet-generate
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.accounts/start-adding-new-account
|
[:wallet-legacy.accounts/start-adding-new-account
|
||||||
{:type :generate}])}]
|
{:type :generate}])}]
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:theme :accent
|
{:theme :accent
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
:icon :main-icons/show
|
:icon :main-icons/show
|
||||||
:accessibility-label :add-account-sheet-watch
|
:accessibility-label :add-account-sheet-watch
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.accounts/start-adding-new-account
|
[:wallet-legacy.accounts/start-adding-new-account
|
||||||
{:type :watch}])}]
|
{:type :watch}])}]
|
||||||
(when-not keycard?
|
(when-not keycard?
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
:icon :main-icons/text
|
:icon :main-icons/text
|
||||||
:accessibility-label :add-account-sheet-seed
|
:accessibility-label :add-account-sheet-seed
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.accounts/start-adding-new-account
|
[:wallet-legacy.accounts/start-adding-new-account
|
||||||
{:type :seed}])}])
|
{:type :seed}])}])
|
||||||
(when-not keycard?
|
(when-not keycard?
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
:icon :main-icons/address
|
:icon :main-icons/address
|
||||||
:accessibility-label :add-account-sheet-private-key
|
:accessibility-label :add-account-sheet-private-key
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.accounts/start-adding-new-account
|
[:wallet-legacy.accounts/start-adding-new-account
|
||||||
{:type :key}])}])]))
|
{:type :key}])}])]))
|
||||||
|
|
||||||
(defn account-settings
|
(defn account-settings
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
(views/defview account-card
|
(views/defview account-card
|
||||||
[{:keys [name color address type wallet] :as account} keycard? card-width]
|
[{:keys [name color address type wallet] :as account} keycard? card-width]
|
||||||
(views/letsubs [currency [:wallet/currency]
|
(views/letsubs [currency [:wallet-legacy/currency]
|
||||||
portfolio-value [:account-portfolio-value address]
|
portfolio-value [:account-portfolio-value address]
|
||||||
prices-loading? [:prices-loading?]]
|
prices-loading? [:prices-loading?]]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
|
@ -73,8 +73,8 @@
|
||||||
|
|
||||||
(views/defview assets
|
(views/defview assets
|
||||||
[]
|
[]
|
||||||
(views/letsubs [{:keys [tokens]} [:wallet/all-visible-assets-with-values]
|
(views/letsubs [{:keys [tokens]} [:wallet-legacy/all-visible-assets-with-values]
|
||||||
currency [:wallet/currency]]
|
currency [:wallet-legacy/currency]]
|
||||||
[:<>
|
[:<>
|
||||||
(for [item tokens]
|
(for [item tokens]
|
||||||
^{:key (:name item)}
|
^{:key (:name item)}
|
||||||
|
@ -87,7 +87,8 @@
|
||||||
[components.core/button
|
[components.core/button
|
||||||
{:accessibility-label :send-transaction-button
|
{:accessibility-label :send-transaction-button
|
||||||
:type :scale
|
:type :scale
|
||||||
:on-press #(re-frame/dispatch [:wallet/prepare-transaction-from-wallet account])}
|
:on-press #(re-frame/dispatch [:wallet-legacy/prepare-transaction-from-wallet
|
||||||
|
account])}
|
||||||
[react/view (styles/send-button)
|
[react/view (styles/send-button)
|
||||||
[icons/icon :main-icons/send {:color colors/white-persist}]]]]))
|
[icons/icon :main-icons/send {:color colors/white-persist}]]]]))
|
||||||
|
|
||||||
|
@ -142,7 +143,7 @@
|
||||||
;;TOTAL VALUE OLD
|
;;TOTAL VALUE OLD
|
||||||
(views/defview total-value-old
|
(views/defview total-value-old
|
||||||
[{:keys [animation minimized]}]
|
[{:keys [animation minimized]}]
|
||||||
(views/letsubs [currency [:wallet/currency]
|
(views/letsubs [currency [:wallet-legacy/currency]
|
||||||
portfolio-value [:portfolio-value]
|
portfolio-value [:portfolio-value]
|
||||||
empty-balances? [:empty-balances?]
|
empty-balances? [:empty-balances?]
|
||||||
frozen-card? [:keycard/frozen-card?]
|
frozen-card? [:keycard/frozen-card?]
|
||||||
|
@ -203,7 +204,7 @@
|
||||||
|
|
||||||
(views/defview total-value
|
(views/defview total-value
|
||||||
[]
|
[]
|
||||||
(views/letsubs [currency [:wallet/currency]
|
(views/letsubs [currency [:wallet-legacy/currency]
|
||||||
portfolio-value [:portfolio-value]]
|
portfolio-value [:portfolio-value]]
|
||||||
[react/view {:padding-vertical 12}
|
[react/view {:padding-vertical 12}
|
||||||
[quo.text/text (i18n/label :t/wallet-total-value)]
|
[quo.text/text (i18n/label :t/wallet-total-value)]
|
||||||
|
@ -257,7 +258,7 @@
|
||||||
:accessibility-label :accounts-qr-code
|
:accessibility-label :accounts-qr-code
|
||||||
:on-press #(re-frame/dispatch
|
:on-press #(re-frame/dispatch
|
||||||
[::qr-scanner/scan-code
|
[::qr-scanner/scan-code
|
||||||
{:handler :wallet.send/qr-scanner-result}])}
|
{:handler :wallet-legacy.send/qr-scanner-result}])}
|
||||||
:i/placeholder]
|
:i/placeholder]
|
||||||
[react/view {:width 12}]
|
[react/view {:width 12}]
|
||||||
[quo/button
|
[quo/button
|
||||||
|
@ -281,12 +282,12 @@
|
||||||
[components.core/animated-header
|
[components.core/animated-header
|
||||||
{:extended-header total-value-old
|
{:extended-header total-value-old
|
||||||
:refresh-control common/refresh-control
|
:refresh-control common/refresh-control
|
||||||
:refreshing-sub (re-frame/subscribe [:wallet/refreshing-history?])
|
:refreshing-sub (re-frame/subscribe [:wallet-legacy/refreshing-history?])
|
||||||
:refreshing-counter common/updates-counter
|
:refreshing-counter common/updates-counter
|
||||||
:use-insets true
|
:use-insets true
|
||||||
:right-accessories [{:on-press #(re-frame/dispatch
|
:right-accessories [{:on-press #(re-frame/dispatch
|
||||||
[::qr-scanner/scan-code
|
[::qr-scanner/scan-code
|
||||||
{:handler :wallet.send/qr-scanner-result}])
|
{:handler :wallet-legacy.send/qr-scanner-result}])
|
||||||
:icon :main-icons/qr
|
:icon :main-icons/qr
|
||||||
:accessibility-label :accounts-qr-code}
|
:accessibility-label :accounts-qr-code}
|
||||||
{:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
{:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
:disabled wallet
|
:disabled wallet
|
||||||
:title name
|
:title name
|
||||||
:subtitle (utils/get-shortened-checksum-address address)
|
:subtitle (utils/get-shortened-checksum-address address)
|
||||||
:on-press #(rf/dispatch [:wallet.accounts/save-account account
|
:on-press #(rf/dispatch [:wallet-legacy.accounts/save-account account
|
||||||
{:hidden (not hidden)}])}])}))
|
{:hidden (not hidden)}])}])}))
|
||||||
|
|
||||||
(defn manage
|
(defn manage
|
||||||
|
|
|
@ -31,8 +31,9 @@
|
||||||
(when (= type :watch)
|
(when (= type :watch)
|
||||||
{:right-accessories
|
{:right-accessories
|
||||||
[{:icon :qr
|
[{:icon :qr
|
||||||
:on-press #(re-frame/dispatch [:wallet.add-new/qr-scanner
|
:on-press #(re-frame/dispatch [:wallet-legacy.add-new/qr-scanner
|
||||||
{:handler :wallet.add-new/qr-scanner-result}])}]}))]))
|
{:handler
|
||||||
|
:wallet-legacy.add-new/qr-scanner-result}])}]}))]))
|
||||||
|
|
||||||
(defn common-settings
|
(defn common-settings
|
||||||
[account]
|
[account]
|
||||||
|
@ -77,7 +78,7 @@
|
||||||
:monospace true
|
:monospace true
|
||||||
:placeholder (i18n/label :t/enter-address)
|
:placeholder (i18n/label :t/enter-address)
|
||||||
:accessibility-label :add-account-enter-watch-address
|
:accessibility-label :add-account-enter-watch-address
|
||||||
:on-change-text #(re-frame/dispatch [:wallet.accounts/set-account-to-watch %])}]
|
:on-change-text #(re-frame/dispatch [:wallet-legacy.accounts/set-account-to-watch %])}]
|
||||||
[quo/text-input
|
[quo/text-input
|
||||||
{:label (i18n/label :t/password)
|
{:label (i18n/label :t/password)
|
||||||
:show-cancel false
|
:show-cancel false
|
||||||
|
@ -179,7 +180,7 @@
|
||||||
#(re-frame/dispatch [:keycard/new-account-pin-sheet
|
#(re-frame/dispatch [:keycard/new-account-pin-sheet
|
||||||
{:view {:content pin
|
{:view {:content pin
|
||||||
:height 256}}])
|
:height 256}}])
|
||||||
#(re-frame/dispatch [:wallet.accounts/add-new-account
|
#(re-frame/dispatch [:wallet-legacy.accounts/add-new-account
|
||||||
(native-module/sha3 @entered-password)]))
|
(native-module/sha3 @entered-password)]))
|
||||||
:disabled
|
:disabled
|
||||||
(or add-account-disabled?
|
(or add-account-disabled?
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
[status-im.ui.components.toastable-highlight :refer [toastable-highlight-view]]
|
[status-im.ui.components.toastable-highlight :refer [toastable-highlight-view]]
|
||||||
[status-im.ui.components.topbar :as topbar]
|
[status-im.ui.components.topbar :as topbar]
|
||||||
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
||||||
[status-im.wallet.core :as wallet]
|
[status-im.wallet.core :as wallet-legacy]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
{:width width
|
{:width width
|
||||||
:border-radius 16
|
:border-radius 16
|
||||||
:margin-bottom 16}
|
:margin-bottom 16}
|
||||||
:on-press (when clickable? #(re-frame/dispatch [::wallet/show-nft-details asset]))
|
:on-press (when clickable? #(re-frame/dispatch [::wallet-legacy/show-nft-details asset]))
|
||||||
:accessibility-label
|
:accessibility-label
|
||||||
:nft-asset}
|
:nft-asset}
|
||||||
(cond
|
(cond
|
||||||
|
@ -152,9 +152,9 @@
|
||||||
|
|
||||||
(defn nft-assets
|
(defn nft-assets
|
||||||
[{:keys [num-assets address collectible-slug]}]
|
[{:keys [num-assets address collectible-slug]}]
|
||||||
(let [assets (rf/sub [:wallet/collectible-assets-by-collection-and-address address
|
(let [assets (rf/sub [:wallet-legacy/collectible-assets-by-collection-and-address address
|
||||||
collectible-slug])
|
collectible-slug])
|
||||||
fetching? (rf/sub [:wallet/fetching-assets-by-collectible-slug collectible-slug])]
|
fetching? (rf/sub [:wallet-legacy/fetching-assets-by-collectible-slug collectible-slug])]
|
||||||
[react/view
|
[react/view
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:flex-wrap :wrap
|
:flex-wrap :wrap
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
|
|
||||||
(defn nft-collections
|
(defn nft-collections
|
||||||
[address]
|
[address]
|
||||||
(let [collection (rf/sub [:wallet/collectible-collection address])]
|
(let [collection (rf/sub [:wallet-legacy/collectible-collection address])]
|
||||||
[:<>
|
[:<>
|
||||||
(for [[index collectible] (map-indexed vector collection)]
|
(for [[index collectible] (map-indexed vector collection)]
|
||||||
^{:key (:slug collectible)}
|
^{:key (:slug collectible)}
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
:border-bottom-width 8
|
:border-bottom-width 8
|
||||||
:border-color colors/gray-lighter}
|
:border-color colors/gray-lighter}
|
||||||
:on-open #(re-frame/dispatch
|
:on-open #(re-frame/dispatch
|
||||||
[::wallet/fetch-collectible-assets-by-owner-and-collection
|
[::wallet-legacy/fetch-collectible-assets-by-owner-and-collection
|
||||||
address
|
address
|
||||||
(:slug collectible)
|
(:slug collectible)
|
||||||
(:owned_asset_count collectible)])
|
(:owned_asset_count collectible)])
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
|
|
||||||
(defn nft-details-modal
|
(defn nft-details-modal
|
||||||
[]
|
[]
|
||||||
(let [nft (rf/sub [:wallet/selected-collectible])]
|
(let [nft (rf/sub [:wallet-legacy/selected-collectible])]
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:navigation {:icon :main-icons/close}
|
{:navigation {:icon :main-icons/close}
|
||||||
|
|
|
@ -20,14 +20,15 @@
|
||||||
(swap! debounce-timers assoc
|
(swap! debounce-timers assoc
|
||||||
field-key
|
field-key
|
||||||
(js/setTimeout
|
(js/setTimeout
|
||||||
#(re-frame/dispatch [:wallet.custom-token.ui/field-is-edited field-key (string/trim value)])
|
#(re-frame/dispatch [:wallet-legacy.custom-token.ui/field-is-edited field-key
|
||||||
|
(string/trim value)])
|
||||||
500))))
|
500))))
|
||||||
|
|
||||||
(defview add-custom-token
|
(defview add-custom-token
|
||||||
[]
|
[]
|
||||||
(letsubs [{:keys [contract name decimals in-progress? error error-name error-symbol]
|
(letsubs [{:keys [contract name decimals in-progress? error error-name error-symbol]
|
||||||
:as m}
|
:as m}
|
||||||
[:wallet/custom-token-screen]]
|
[:wallet-legacy/custom-token-screen]]
|
||||||
(let [sym (:symbol m)]
|
(let [sym (:symbol m)]
|
||||||
[react/keyboard-avoiding-view {:flex 1 :background-color colors/white}
|
[react/keyboard-avoiding-view {:flex 1 :background-color colors/white}
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
|
@ -50,7 +51,7 @@
|
||||||
;;tooltip covers button
|
;;tooltip covers button
|
||||||
[react/view {:position :absolute :z-index 1000 :right 0 :top 10}
|
[react/view {:position :absolute :z-index 1000 :right 0 :top 10}
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(re-frame/dispatch [:wallet.custom-token.ui/contract-address-paste])}
|
{:on-press #(re-frame/dispatch [:wallet-legacy.custom-token.ui/contract-address-paste])}
|
||||||
[react/text {:style {:color colors/blue}}
|
[react/text {:style {:color colors/blue}}
|
||||||
(i18n/label :t/paste)]]])
|
(i18n/label :t/paste)]]])
|
||||||
[quo/text-input
|
[quo/text-input
|
||||||
|
@ -117,7 +118,7 @@
|
||||||
(string/blank? name)
|
(string/blank? name)
|
||||||
(string/blank? sym)
|
(string/blank? sym)
|
||||||
(string/blank? decimals)))
|
(string/blank? decimals)))
|
||||||
:on-press #(re-frame/dispatch [:wallet.custom-token.ui/add-pressed])}
|
:on-press #(re-frame/dispatch [:wallet-legacy.custom-token.ui/add-pressed])}
|
||||||
(i18n/label :t/add)]}]])))
|
(i18n/label :t/add)]}]])))
|
||||||
|
|
||||||
(defview custom-token-details
|
(defview custom-token-details
|
||||||
|
@ -166,4 +167,5 @@
|
||||||
{:theme :negative
|
{:theme :negative
|
||||||
:title (i18n/label :t/remove-token)
|
:title (i18n/label :t/remove-token)
|
||||||
:icon :main-icons/delete
|
:icon :main-icons/delete
|
||||||
:on-press #(re-frame/dispatch [:wallet.custom-token.ui/remove-pressed token true])}])]]))
|
:on-press #(re-frame/dispatch [:wallet-legacy.custom-token.ui/remove-pressed token
|
||||||
|
true])}])]]))
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:navigation {:on-press
|
{:navigation {:on-press
|
||||||
#(do
|
#(do
|
||||||
(re-frame/dispatch [:wallet/recipient-modal-closed])
|
(re-frame/dispatch [:wallet-legacy/recipient-modal-closed])
|
||||||
(re-frame/dispatch [:search/recipient-filter-changed nil])
|
(re-frame/dispatch [:wallet-legacy/search-recipient-filter-changed nil])
|
||||||
(re-frame/dispatch [:navigate-back]))}
|
(re-frame/dispatch [:navigate-back]))}
|
||||||
:modal? true
|
:modal? true
|
||||||
:border-bottom false
|
:border-bottom false
|
||||||
|
@ -36,24 +36,24 @@
|
||||||
:right-accessories
|
:right-accessories
|
||||||
[{:icon :qr
|
[{:icon :qr
|
||||||
:accessibility-label :scan-contact-code-button
|
:accessibility-label :scan-contact-code-button
|
||||||
:on-press #(re-frame/dispatch [:wallet.send/qr-scanner
|
:on-press #(re-frame/dispatch [:wallet-legacy.send/qr-scanner
|
||||||
{:ignore-url true
|
{:ignore-url true
|
||||||
:handler :wallet.send/qr-scanner-result}])}]}])
|
:handler :wallet-legacy.send/qr-scanner-result}])}]}])
|
||||||
|
|
||||||
(defonce search-active? (reagent/atom false))
|
(defonce search-active? (reagent/atom false))
|
||||||
|
|
||||||
(defn search-input-wrapper
|
(defn search-input-wrapper
|
||||||
[]
|
[]
|
||||||
(let [search-filter @(re-frame/subscribe [:search/recipient-filter])]
|
(let [search-filter @(re-frame/subscribe [:wallet-legacy/search-recipient-filter])]
|
||||||
[react/view
|
[react/view
|
||||||
{:padding-horizontal 16
|
{:padding-horizontal 16
|
||||||
:padding-vertical 10}
|
:padding-vertical 10}
|
||||||
[search-input/search-input-old
|
[search-input/search-input-old
|
||||||
{:search-active? search-active?
|
{:search-active? search-active?
|
||||||
:search-filter search-filter
|
:search-filter search-filter
|
||||||
:on-cancel #(re-frame/dispatch [:search/recipient-filter-changed nil])
|
:on-cancel #(re-frame/dispatch [:wallet-legacy/search-recipient-filter-changed nil])
|
||||||
:on-change (fn [text]
|
:on-change (fn [text]
|
||||||
(re-frame/dispatch [:search/recipient-filter-changed text])
|
(re-frame/dispatch [:wallet-legacy/search-recipient-filter-changed text])
|
||||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
||||||
(debounce/debounce-and-dispatch [:contacts/set-new-identity text] 300))}]]))
|
(debounce/debounce-and-dispatch [:contacts/set-new-identity text] 300))}]]))
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:icon [chat-icon/custom-icon-view-list (:name account) (:color account)]
|
{:icon [chat-icon/custom-icon-view-list (:name account) (:color account)]
|
||||||
:title (:name account)
|
:title (:name account)
|
||||||
:on-press #(re-frame/dispatch [:wallet.send/set-recipient (:address account)])
|
:on-press #(re-frame/dispatch [:wallet-legacy.send/set-recipient (:address account)])
|
||||||
:subtitle [quo/text
|
:subtitle [quo/text
|
||||||
{:monospace true
|
{:monospace true
|
||||||
:color :secondary}
|
:color :secondary}
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(some-> ^js @scroll-view-ref
|
(some-> ^js @scroll-view-ref
|
||||||
(.scrollTo #js {:x 0 :animated true}))
|
(.scrollTo #js {:x 0 :animated true}))
|
||||||
(re-frame/dispatch [:wallet.recipient/address-changed name]))
|
(re-frame/dispatch [:wallet-legacy.recipient/address-changed name]))
|
||||||
:icon [chat-icon/contact-icon-contacts-tab contact]}])
|
:icon [chat-icon/contact-icon-contacts-tab contact]}])
|
||||||
|
|
||||||
(defn empty-items
|
(defn empty-items
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
[list.item/list-item
|
[list.item/list-item
|
||||||
{:title [quo/text {:monospace true}
|
{:title [quo/text {:monospace true}
|
||||||
(utils/get-shortened-checksum-address address)]
|
(utils/get-shortened-checksum-address address)]
|
||||||
:on-press #(re-frame/dispatch [:wallet.recipient/address-changed address])
|
:on-press #(re-frame/dispatch [:wallet-legacy.recipient/address-changed address])
|
||||||
:size :small
|
:size :small
|
||||||
:accessory [react/text
|
:accessory [react/text
|
||||||
{:style {:flex-shrink 1
|
{:style {:flex-shrink 1
|
||||||
|
@ -139,8 +139,8 @@
|
||||||
|
|
||||||
(defn recent-section
|
(defn recent-section
|
||||||
[]
|
[]
|
||||||
(let [{:keys [from]} @(re-frame/subscribe [:wallet/prepare-transaction])
|
(let [{:keys [from]} @(re-frame/subscribe [:wallet-legacy/prepare-transaction])
|
||||||
txs @(re-frame/subscribe [:wallet/recipient-recent-txs (:address from)])
|
txs @(re-frame/subscribe [:wallet-legacy/recipient-recent-txs (:address from)])
|
||||||
cnt (count txs)]
|
cnt (count txs)]
|
||||||
[section
|
[section
|
||||||
(i18n/label :t/recent)
|
(i18n/label :t/recent)
|
||||||
|
@ -168,12 +168,12 @@
|
||||||
{:monospace true
|
{:monospace true
|
||||||
:color :secondary}
|
:color :secondary}
|
||||||
short-address])
|
short-address])
|
||||||
:on-press #(re-frame/dispatch [:wallet.send/set-recipient address])
|
:on-press #(re-frame/dispatch [:wallet-legacy.send/set-recipient address])
|
||||||
:size (when noname? :small)}]))
|
:size (when noname? :small)}]))
|
||||||
|
|
||||||
(views/defview fav-section
|
(views/defview fav-section
|
||||||
[]
|
[]
|
||||||
(views/letsubs [favourites [:wallet/favourites-filtered]]
|
(views/letsubs [favourites [:wallet-legacy/favourites-filtered]]
|
||||||
(let [cnt (count favourites)]
|
(let [cnt (count favourites)]
|
||||||
[section
|
[section
|
||||||
(i18n/label :t/favourites)
|
(i18n/label :t/favourites)
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
(views/defview search-results
|
(views/defview search-results
|
||||||
[]
|
[]
|
||||||
(views/letsubs [contacts [:contacts/active-with-ens-names]
|
(views/letsubs [contacts [:contacts/active-with-ens-names]
|
||||||
favourites [:wallet/favourites-filtered]
|
favourites [:wallet-legacy/favourites-filtered]
|
||||||
accounts [:accounts-for-recipient]]
|
accounts [:accounts-for-recipient]]
|
||||||
[react/view
|
[react/view
|
||||||
(for [account accounts]
|
(for [account accounts]
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
|
|
||||||
(views/defview new-favourite
|
(views/defview new-favourite
|
||||||
[]
|
[]
|
||||||
(views/letsubs [{:keys [resolved-address]} [:wallet/recipient]
|
(views/letsubs [{:keys [resolved-address]} [:wallet-legacy/recipient]
|
||||||
fav-name (atom "")]
|
fav-name (atom "")]
|
||||||
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
|
@ -265,13 +265,14 @@
|
||||||
[quo/button
|
[quo/button
|
||||||
{:accessibility-label :add-fav
|
{:accessibility-label :add-fav
|
||||||
:type :secondary
|
:type :secondary
|
||||||
:on-press #(re-frame/dispatch [:wallet/add-favourite resolved-address @fav-name])}
|
:on-press #(re-frame/dispatch [:wallet-legacy/add-favourite resolved-address
|
||||||
|
@fav-name])}
|
||||||
(i18n/label :t/add)]}]]]))
|
(i18n/label :t/add)]}]]]))
|
||||||
|
|
||||||
(views/defview recipient
|
(views/defview recipient
|
||||||
[]
|
[]
|
||||||
(views/letsubs [{:keys [address resolved-address searching]} [:wallet/recipient]
|
(views/letsubs [{:keys [address resolved-address searching]} [:wallet-legacy/recipient]
|
||||||
search-filter [:search/recipient-filter]]
|
search-filter [:wallet-legacy/search-recipient-filter]]
|
||||||
(let [disabled? (or searching (not resolved-address))]
|
(let [disabled? (or searching (not resolved-address))]
|
||||||
[kb-presentation/keyboard-avoiding-view
|
[kb-presentation/keyboard-avoiding-view
|
||||||
{:style {:flex 1}
|
{:style {:flex 1}
|
||||||
|
@ -295,7 +296,7 @@
|
||||||
[quo/text (i18n/label :t/address-or-ens-name)]
|
[quo/text (i18n/label :t/address-or-ens-name)]
|
||||||
[quo/button
|
[quo/button
|
||||||
{:type :secondary
|
{:type :secondary
|
||||||
:on-press #(re-frame/dispatch [:wallet.recipient/address-paste-pressed])}
|
:on-press #(re-frame/dispatch [:wallet-legacy.recipient/address-paste-pressed])}
|
||||||
(i18n/label :t/paste)]]
|
(i18n/label :t/paste)]]
|
||||||
[quo/text-input
|
[quo/text-input
|
||||||
{:multiline true
|
{:multiline true
|
||||||
|
@ -304,11 +305,12 @@
|
||||||
:placeholder (i18n/label :t/recipient-code-placeholder)
|
:placeholder (i18n/label :t/recipient-code-placeholder)
|
||||||
:text-align-vertical :top
|
:text-align-vertical :top
|
||||||
:on-change-text #(do
|
:on-change-text #(do
|
||||||
(re-frame/dispatch [:set-in [:wallet/recipient :searching]
|
(re-frame/dispatch [:set-in [:wallet-legacy/recipient :searching]
|
||||||
:searching])
|
:searching])
|
||||||
(debounce/debounce-and-dispatch [:wallet.recipient/address-changed
|
(debounce/debounce-and-dispatch
|
||||||
(utils.string/safe-trim %)]
|
[:wallet-legacy.recipient/address-changed
|
||||||
600))
|
(utils.string/safe-trim %)]
|
||||||
|
600))
|
||||||
:accessibility-label :recipient-address-input}]]
|
:accessibility-label :recipient-address-input}]]
|
||||||
[react/view {:align-items :center :height 30 :padding-bottom 8}
|
[react/view {:align-items :center :height 30 :padding-bottom 8}
|
||||||
(if searching
|
(if searching
|
||||||
|
@ -342,5 +344,6 @@
|
||||||
:type :secondary
|
:type :secondary
|
||||||
:after :main-icons/next
|
:after :main-icons/next
|
||||||
:disabled disabled?
|
:disabled disabled?
|
||||||
:on-press #(re-frame/dispatch [:wallet.send/set-recipient resolved-address])}
|
:on-press #(re-frame/dispatch [:wallet-legacy.send/set-recipient
|
||||||
|
resolved-address])}
|
||||||
(i18n/label :t/done)]}]]])))
|
(i18n/label :t/done)]}]]])))
|
||||||
|
|
|
@ -37,6 +37,6 @@
|
||||||
:padding-horizontal 16
|
:padding-horizontal 16
|
||||||
:padding-bottom 16}
|
:padding-bottom 16}
|
||||||
[quo/button
|
[quo/button
|
||||||
{:on-press #(re-frame/dispatch [:wallet.accounts/share address])
|
{:on-press #(re-frame/dispatch [:wallet-legacy.accounts/share address])
|
||||||
:accessibility-label :share-address-button}
|
:accessibility-label :share-address-button}
|
||||||
(i18n/label :t/share-address)]]]))
|
(i18n/label :t/share-address)]]]))
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
(defn asset
|
(defn asset
|
||||||
[currency token]
|
[currency token]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(re-frame/dispatch [:wallet.send/set-symbol (:symbol token)])}
|
{:on-press #(re-frame/dispatch [:wallet-legacy.send/set-symbol (:symbol token)])}
|
||||||
[common/render-asset token nil nil (:code currency)]])
|
[common/render-asset token nil nil (:code currency)]])
|
||||||
|
|
||||||
(views/defview assets
|
(views/defview assets
|
||||||
[address]
|
[address]
|
||||||
(views/letsubs [{:keys [tokens]} [:wallet/visible-assets-with-values address]
|
(views/letsubs [{:keys [tokens]} [:wallet-legacy/visible-assets-with-values address]
|
||||||
currency [:wallet/currency]]
|
currency [:wallet-legacy/currency]]
|
||||||
[react/view
|
[react/view
|
||||||
{:style {:height 300}}
|
{:style {:height 300}}
|
||||||
[list/flat-list
|
[list/flat-list
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
[]
|
[]
|
||||||
(re-frame/dispatch [:bottom-sheet/hide-old])
|
(re-frame/dispatch [:bottom-sheet/hide-old])
|
||||||
(js/setTimeout #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
(js/setTimeout #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
||||||
{:content (fn [] [accounts-list :to :wallet.send/set-field])
|
{:content (fn [] [accounts-list :to
|
||||||
|
:wallet-legacy.send/set-field])
|
||||||
:content-height 300}])
|
:content-height 300}])
|
||||||
400))
|
400))
|
||||||
|
|
|
@ -98,7 +98,8 @@
|
||||||
:accessibility-label :choose-recipient-button
|
:accessibility-label :choose-recipient-button
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(re-frame/dispatch [:dismiss-keyboard])
|
(re-frame/dispatch [:dismiss-keyboard])
|
||||||
(re-frame/dispatch [:wallet.send/navigate-to-recipient-code]))
|
(re-frame/dispatch
|
||||||
|
[:wallet-legacy.send/navigate-to-recipient-code]))
|
||||||
:chevron true}
|
:chevron true}
|
||||||
(when-not contact
|
(when-not contact
|
||||||
{:icon :main-icons/add
|
{:icon :main-icons/add
|
||||||
|
@ -109,7 +110,7 @@
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press
|
{:on-press
|
||||||
#(when token
|
#(when token
|
||||||
(re-frame/dispatch [:wallet.send/set-max-amount token]))}
|
(re-frame/dispatch [:wallet-legacy.send/set-max-amount token]))}
|
||||||
[react/view {:style (styles/set-max-button)}
|
[react/view {:style (styles/set-max-button)}
|
||||||
[react/text {:style {:color colors/blue}} (i18n/label :t/set-max)]]])
|
[react/text {:style {:color colors/blue}} (i18n/label :t/set-max)]]])
|
||||||
|
|
||||||
|
@ -172,10 +173,10 @@
|
||||||
(views/defview request-transaction
|
(views/defview request-transaction
|
||||||
[_]
|
[_]
|
||||||
(views/letsubs [{:keys [amount-error amount-text from token sign-enabled?] :as tx}
|
(views/letsubs [{:keys [amount-error amount-text from token sign-enabled?] :as tx}
|
||||||
[:wallet.request/prepare-transaction-with-balance]
|
[:wallet-legacy.request/prepare-transaction-with-balance]
|
||||||
window-width [:dimensions/window-width]
|
window-width [:dimensions/window-width]
|
||||||
prices [:prices]
|
prices [:prices]
|
||||||
wallet-currency [:wallet/currency]]
|
wallet-currency [:wallet-legacy/currency]]
|
||||||
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
||||||
[:<>
|
[:<>
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
|
@ -196,7 +197,7 @@
|
||||||
:accessibility-label :amount-input
|
:accessibility-label :amount-input
|
||||||
:default-value amount-text
|
:default-value amount-text
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:on-change-text #(re-frame/dispatch [:wallet.request/set-amount-text %])
|
:on-change-text #(re-frame/dispatch [:wallet-legacy.request/set-amount-text %])
|
||||||
:placeholder "0.0 "}]
|
:placeholder "0.0 "}]
|
||||||
[asset-selector tx window-width]
|
[asset-selector tx window-width]
|
||||||
(when amount-error
|
(when amount-error
|
||||||
|
@ -209,7 +210,7 @@
|
||||||
(i18n/label :t/to-capitalized)]
|
(i18n/label :t/to-capitalized)]
|
||||||
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[render-account from token :wallet.request/set-field]]]]]
|
[render-account from token :wallet-legacy.request/set-field]]]]]
|
||||||
[toolbar/toolbar
|
[toolbar/toolbar
|
||||||
{:show-border? true
|
{:show-border? true
|
||||||
:right
|
:right
|
||||||
|
@ -220,7 +221,7 @@
|
||||||
:disabled (not sign-enabled?)
|
:disabled (not sign-enabled?)
|
||||||
:on-press #(do
|
:on-press #(do
|
||||||
(re-frame/dispatch
|
(re-frame/dispatch
|
||||||
[:wallet.ui/request-transaction-button-clicked tx])
|
[:wallet-legacy.ui/request-transaction-button-clicked tx])
|
||||||
(re-frame/dispatch [:navigate-back]))}
|
(re-frame/dispatch [:navigate-back]))}
|
||||||
(i18n/label :t/wallet-request)]}]]]))
|
(i18n/label :t/wallet-request)]}]]]))
|
||||||
|
|
||||||
|
@ -230,9 +231,9 @@
|
||||||
request?
|
request?
|
||||||
from token to sign-enabled? from-chat?]
|
from token to sign-enabled? from-chat?]
|
||||||
:as tx}
|
:as tx}
|
||||||
[:wallet.send/prepare-transaction-with-balance]
|
[:wallet-legacy.send/prepare-transaction-with-balance]
|
||||||
prices [:prices]
|
prices [:prices]
|
||||||
wallet-currency [:wallet/currency]
|
wallet-currency [:wallet-legacy/currency]
|
||||||
window-width [:dimensions/window-width]]
|
window-width [:dimensions/window-width]]
|
||||||
(let [to-norm (address/normalized-hex (if (string? to) to (:address to)))]
|
(let [to-norm (address/normalized-hex (if (string? to) to (:address to)))]
|
||||||
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
|
||||||
|
@ -244,7 +245,7 @@
|
||||||
:icon-name :i/arrow-left
|
:icon-name :i/arrow-left
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(re-frame/dispatch [:navigate-back])
|
(re-frame/dispatch [:navigate-back])
|
||||||
(re-frame/dispatch [:wallet/cancel-transaction-command]))
|
(re-frame/dispatch [:wallet-legacy/cancel-transaction-command]))
|
||||||
:accessibility-label :back-button}]
|
:accessibility-label :back-button}]
|
||||||
[react/scroll-view
|
[react/scroll-view
|
||||||
{:style {:flex 1}
|
{:style {:flex 1}
|
||||||
|
@ -266,7 +267,7 @@
|
||||||
:default-value amount-text
|
:default-value amount-text
|
||||||
:editable (not request?)
|
:editable (not request?)
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:on-change-text #(re-frame/dispatch [:wallet.send/set-amount-text %])
|
:on-change-text #(re-frame/dispatch [:wallet-legacy.send/set-amount-text %])
|
||||||
:placeholder "0.0 "}]
|
:placeholder "0.0 "}]
|
||||||
[asset-selector tx window-width]
|
[asset-selector tx window-width]
|
||||||
(when amount-error
|
(when amount-error
|
||||||
|
@ -283,7 +284,7 @@
|
||||||
[components.core/list-header (i18n/label :t/from-capitalized)]
|
[components.core/list-header (i18n/label :t/from-capitalized)]
|
||||||
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[render-account from token :wallet.send/set-field]]]
|
[render-account from token :wallet-legacy.send/set-field]]]
|
||||||
[components.core/list-header
|
[components.core/list-header
|
||||||
(i18n/label :t/to-capitalized)]
|
(i18n/label :t/to-capitalized)]
|
||||||
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
[react/view {:flex-direction :row :flex 1 :align-items :center}
|
||||||
|
@ -302,11 +303,11 @@
|
||||||
(re-frame/dispatch
|
(re-frame/dispatch
|
||||||
[(cond
|
[(cond
|
||||||
request?
|
request?
|
||||||
:wallet.ui/sign-transaction-button-clicked-from-request
|
:wallet-legacy.ui/sign-transaction-button-clicked-from-request
|
||||||
from-chat?
|
from-chat?
|
||||||
:wallet.ui/sign-transaction-button-clicked-from-chat
|
:wallet-legacy.ui/sign-transaction-button-clicked-from-chat
|
||||||
:else
|
:else
|
||||||
:wallet.ui/sign-transaction-button-clicked) tx]))}
|
:wallet-legacy.ui/sign-transaction-button-clicked) tx]))}
|
||||||
|
|
||||||
(if (and (not request?) from-chat? (not to-norm))
|
(if (and (not request?) from-chat? (not to-norm))
|
||||||
(i18n/label :t/wallet-send)
|
(i18n/label :t/wallet-send)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:title (i18n/label :t/wallet-assets)
|
{:title (i18n/label :t/wallet-assets)
|
||||||
:navigation
|
:navigation
|
||||||
{:on-press #(re-frame/dispatch [:wallet.settings.ui/navigate-back-pressed])}}])
|
{:on-press #(re-frame/dispatch [:wallet-legacy.settings.ui/navigate-back-pressed])}}])
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
(defn hide-sheet-and-dispatch
|
||||||
[event]
|
[event]
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
:title (i18n/label :t/remove-token)
|
:title (i18n/label :t/remove-token)
|
||||||
:icon :main-icons/delete
|
:icon :main-icons/delete
|
||||||
:on-press #(hide-sheet-and-dispatch
|
:on-press #(hide-sheet-and-dispatch
|
||||||
[:wallet.custom-token.ui/remove-pressed token])}])]))
|
[:wallet-legacy.custom-token.ui/remove-pressed token])}])]))
|
||||||
|
|
||||||
(defn render-token
|
(defn render-token
|
||||||
[_]
|
[_]
|
||||||
|
@ -69,7 +69,8 @@
|
||||||
[chat-icon/custom-icon-view-list title color])
|
[chat-icon/custom-icon-view-list title color])
|
||||||
:title title
|
:title title
|
||||||
:subtitle (name sym)
|
:subtitle (name sym)
|
||||||
:on-press #(re-frame/dispatch [:wallet.settings/toggle-visible-token (keyword sym)
|
:on-press #(re-frame/dispatch [:wallet-legacy.settings/toggle-visible-token
|
||||||
|
(keyword sym)
|
||||||
(not checked?)])
|
(not checked?)])
|
||||||
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old
|
||||||
{:content (custom-token-actions-view token)}])}])}))
|
{:content (custom-token-actions-view token)}])}])}))
|
||||||
|
@ -82,9 +83,9 @@
|
||||||
[]
|
[]
|
||||||
(letsubs [{search-filter :search-filter
|
(letsubs [{search-filter :search-filter
|
||||||
{custom-tokens true default-tokens nil} :tokens}
|
{custom-tokens true default-tokens nil} :tokens}
|
||||||
[:wallet/filtered-grouped-chain-tokens]]
|
[:wallet-legacy/filtered-grouped-chain-tokens]]
|
||||||
{:component-will-unmount #(do
|
{:component-will-unmount #(do
|
||||||
(re-frame/dispatch [:search/token-filter-changed nil])
|
(re-frame/dispatch [:wallet-legacy/search-token-filter-changed nil])
|
||||||
(reset! search-active? false))}
|
(reset! search-active? false))}
|
||||||
[react/view {:flex 1 :background-color colors/white}
|
[react/view {:flex 1 :background-color colors/white}
|
||||||
[toolbar]
|
[toolbar]
|
||||||
|
@ -95,12 +96,12 @@
|
||||||
[search-input/search-input-old
|
[search-input/search-input-old
|
||||||
{:search-active? search-active?
|
{:search-active? search-active?
|
||||||
:search-filter search-filter
|
:search-filter search-filter
|
||||||
:on-cancel #(re-frame/dispatch [:search/token-filter-changed nil])
|
:on-cancel #(re-frame/dispatch [:wallet-legacy/search-token-filter-changed nil])
|
||||||
:on-focus (fn [search-filter]
|
:on-focus (fn [search-filter]
|
||||||
(when-not search-filter
|
(when-not search-filter
|
||||||
(re-frame/dispatch [:search/token-filter-changed ""])))
|
(re-frame/dispatch [:wallet-legacy/search-token-filter-changed ""])))
|
||||||
:on-change (fn [text]
|
:on-change (fn [text]
|
||||||
(re-frame/dispatch [:search/token-filter-changed text]))}]]
|
(re-frame/dispatch [:wallet-legacy/search-token-filter-changed text]))}]]
|
||||||
[list/section-list
|
[list/section-list
|
||||||
{:header
|
{:header
|
||||||
[react/view {:margin-top 16}
|
[react/view {:margin-top 16}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
[status-im.ui.components.toolbar :as toolbar]
|
[status-im.ui.components.toolbar :as toolbar]
|
||||||
[status-im.ui.components.topbar :as topbar]
|
[status-im.ui.components.topbar :as topbar]
|
||||||
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
||||||
[status-im.wallet.swap.core :as wallet.swap]
|
[status-im.wallet.swap.core :as wallet-legacy.swap]
|
||||||
[status-im.wallet.utils :as wallet.utils]
|
[status-im.wallet.utils :as wallet.utils]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
@ -49,9 +49,9 @@
|
||||||
(defn asset-selector
|
(defn asset-selector
|
||||||
[]
|
[]
|
||||||
(let [{:keys [address]} (rf/sub [:multiaccount/current-account])
|
(let [{:keys [address]} (rf/sub [:multiaccount/current-account])
|
||||||
{:keys [tokens]} (rf/sub [:wallet/visible-assets-with-values address])
|
{:keys [tokens]} (rf/sub [:wallet-legacy/visible-assets-with-values address])
|
||||||
source? (rf/sub [:wallet/modal-selecting-source-token?])
|
source? (rf/sub [:wallet-legacy/modal-selecting-source-token?])
|
||||||
currency (rf/sub [:wallet/currency])]
|
currency (rf/sub [:wallet-legacy/currency])]
|
||||||
[:<>
|
[:<>
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
{:title (if source?
|
{:title (if source?
|
||||||
|
@ -69,8 +69,8 @@
|
||||||
{:token token
|
{:token token
|
||||||
:on-press #(re-frame/dispatch
|
:on-press #(re-frame/dispatch
|
||||||
[(if source?
|
[(if source?
|
||||||
::wallet.swap/set-from-token
|
::wallet-legacy.swap/set-from-token
|
||||||
::wallet.swap/set-to-token)
|
::wallet-legacy.swap/set-to-token)
|
||||||
(:symbol token)])
|
(:symbol token)])
|
||||||
:currency (:code currency)}])]]))
|
:currency (:code currency)}])]]))
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
[{:keys [token source?]}]
|
[{:keys [token source?]}]
|
||||||
(let [token-icon-source (-> token :icon :source)]
|
(let [token-icon-source (-> token :icon :source)]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(re-frame/dispatch [::wallet.swap/open-asset-selector-modal source?])}
|
{:on-press #(re-frame/dispatch [::wallet-legacy.swap/open-asset-selector-modal source?])}
|
||||||
[react/view
|
[react/view
|
||||||
{:style {:flex-direction :row
|
{:style {:flex-direction :row
|
||||||
:align-items :center
|
:align-items :center
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
:editable true
|
:editable true
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:on-change-text #(re-frame/dispatch [(when source?
|
:on-change-text #(re-frame/dispatch [(when source?
|
||||||
::wallet.swap/set-from-token-amount)
|
::wallet-legacy.swap/set-from-token-amount)
|
||||||
%])
|
%])
|
||||||
:placeholder "0.0"}]]
|
:placeholder "0.0"}]]
|
||||||
[token-display
|
[token-display
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
{:margin-vertical 8}
|
{:margin-vertical 8}
|
||||||
[quo/separator]
|
[quo/separator]
|
||||||
[react/touchable-opacity
|
[react/touchable-opacity
|
||||||
{:on-press #(re-frame/dispatch [::wallet.swap/switch-from-token-with-to])}
|
{:on-press #(re-frame/dispatch [::wallet-legacy.swap/switch-from-token-with-to])}
|
||||||
[react/view
|
[react/view
|
||||||
{:style {:background-color colors/gray-lighter
|
{:style {:background-color colors/gray-lighter
|
||||||
:width 40
|
:width 40
|
||||||
|
@ -412,7 +412,7 @@
|
||||||
[pill-button
|
[pill-button
|
||||||
{:label (i18n/label :t/switch-to-simple-interface)
|
{:label (i18n/label :t/switch-to-simple-interface)
|
||||||
:margin-left 0
|
:margin-left 0
|
||||||
:on-press #(re-frame/dispatch [::wallet.swap/set-advanced-mode false])}]]
|
:on-press #(re-frame/dispatch [::wallet-legacy.swap/set-advanced-mode false])}]]
|
||||||
[transaction-fee-card
|
[transaction-fee-card
|
||||||
{:gas-amount 21000
|
{:gas-amount 21000
|
||||||
:price-limit 74
|
:price-limit 74
|
||||||
|
@ -432,10 +432,10 @@
|
||||||
[]
|
[]
|
||||||
(let [{:keys [name]}
|
(let [{:keys [name]}
|
||||||
(rf/sub [:multiaccount/current-account])
|
(rf/sub [:multiaccount/current-account])
|
||||||
all-tokens (rf/sub [:wallet/all-tokens])
|
all-tokens (rf/sub [:wallet-legacy/all-tokens])
|
||||||
from-symbol (rf/sub [:wallet/swap-from-token])
|
from-symbol (rf/sub [:wallet-legacy/swap-from-token])
|
||||||
to-symbol (rf/sub [:wallet/swap-to-token])
|
to-symbol (rf/sub [:wallet-legacy/swap-to-token])
|
||||||
advanced-mode? (rf/sub [:wallet/swap-advanced-mode?])
|
advanced-mode? (rf/sub [:wallet-legacy/swap-advanced-mode?])
|
||||||
amount "0.02"
|
amount "0.02"
|
||||||
from-token (tokens/symbol->token all-tokens (or from-symbol :DGX))
|
from-token (tokens/symbol->token all-tokens (or from-symbol :DGX))
|
||||||
to-token (tokens/symbol->token all-tokens (or to-symbol :SNT))]
|
to-token (tokens/symbol->token all-tokens (or to-symbol :SNT))]
|
||||||
|
@ -481,12 +481,12 @@
|
||||||
[quo/text {} (i18n/label :t/priority)]
|
[quo/text {} (i18n/label :t/priority)]
|
||||||
[pill-button
|
[pill-button
|
||||||
{:label (i18n/label :t/advanced)
|
{:label (i18n/label :t/advanced)
|
||||||
:on-press #(re-frame/dispatch [::wallet.swap/set-advanced-mode true])}]]
|
:on-press #(re-frame/dispatch [::wallet-legacy.swap/set-advanced-mode true])}]]
|
||||||
|
|
||||||
[quo/text {:color :secondary} "0.0034 ETH/ $ 8.09"]])
|
[quo/text {:color :secondary} "0.0034 ETH/ $ 8.09"]])
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(re-frame/dispatch [::wallet.swap/set-advanced-mode false]))
|
(re-frame/dispatch [::wallet-legacy.swap/set-advanced-mode false]))
|
||||||
|
|
||||||
(when-not advanced-mode?
|
(when-not advanced-mode?
|
||||||
[react/view {:style {:padding-horizontal 16}}
|
[react/view {:style {:padding-horizontal 16}}
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
(defn chain-explorer-link
|
(defn chain-explorer-link
|
||||||
[address]
|
[address]
|
||||||
(let [link @(re-frame/subscribe [:wallet/chain-explorer-link address])]
|
(let [link @(re-frame/subscribe [:wallet-legacy/chain-explorer-link address])]
|
||||||
[react/touchable-highlight
|
[react/touchable-highlight
|
||||||
{:on-press #(when link
|
{:on-press #(when link
|
||||||
(.openURL ^js react/linking link))}
|
(.openURL ^js react/linking link))}
|
||||||
|
@ -127,13 +127,14 @@
|
||||||
|
|
||||||
(defn history-list
|
(defn history-list
|
||||||
[{:keys [transaction-history-sections total]} address]
|
[{:keys [transaction-history-sections total]} address]
|
||||||
(let [fetching-recent-history? @(re-frame/subscribe [:wallet/fetching-recent-tx-history? address])
|
(let [fetching-recent-history? @(re-frame/subscribe [:wallet-legacy/fetching-recent-tx-history?
|
||||||
fetching-more-history? @(re-frame/subscribe [:wallet/fetching-tx-history? address])
|
address])
|
||||||
|
fetching-more-history? @(re-frame/subscribe [:wallet-legacy/fetching-tx-history? address])
|
||||||
keycard-account? @(re-frame/subscribe [:multiaccounts/keycard-account?])
|
keycard-account? @(re-frame/subscribe [:multiaccounts/keycard-account?])
|
||||||
custom-rpc-node? @(re-frame/subscribe [:custom-rpc-node])
|
custom-rpc-node? @(re-frame/subscribe [:custom-rpc-node])
|
||||||
non-archival-rpc-node? @(re-frame/subscribe [:wallet/non-archival-node])
|
non-archival-rpc-node? @(re-frame/subscribe [:wallet-legacy/non-archival-node])
|
||||||
binance-chain? @(re-frame/subscribe [:wallet/binance-chain?])
|
binance-chain? @(re-frame/subscribe [:wallet-legacy/binance-chain?])
|
||||||
all-fetched? @(re-frame/subscribe [:wallet/tx-history-fetched? address])
|
all-fetched? @(re-frame/subscribe [:wallet-legacy/tx-history-fetched? address])
|
||||||
syncing-allowed? @(re-frame/subscribe [:mobile-network/syncing-allowed?])]
|
syncing-allowed? @(re-frame/subscribe [:mobile-network/syncing-allowed?])]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[chain-explorer-link address]
|
[chain-explorer-link address]
|
||||||
|
@ -280,7 +281,7 @@
|
||||||
(letsubs [{:keys [url type confirmations confirmations-progress
|
(letsubs [{:keys [url type confirmations confirmations-progress
|
||||||
date amount-text currency-text]
|
date amount-text currency-text]
|
||||||
:as transaction}
|
:as transaction}
|
||||||
[:wallet.transactions.details/screen tx-hash address]]
|
[:wallet-legacy.transactions.details/screen tx-hash address]]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
;;TODO options should be replaced by bottom sheet ,and topbar should be used here
|
;;TODO options should be replaced by bottom sheet ,and topbar should be used here
|
||||||
[topbar/topbar
|
[topbar/topbar
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
[cofx data]
|
[cofx data]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(choose-recipient/parse-eip681-uri-and-resolve-ens data true)
|
(choose-recipient/parse-eip681-uri-and-resolve-ens data true)
|
||||||
(navigation/navigate-to :wallet nil)))
|
(navigation/navigate-to :wallet-legacy nil)))
|
||||||
|
|
||||||
(defn existing-account?
|
(defn existing-account?
|
||||||
[{:keys [db]} address]
|
[{:keys [db]} address]
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
[status-im.utils.deprecated-types :as types]
|
[status-im.utils.deprecated-types :as types]
|
||||||
[status-im.utils.hex :as hex]
|
[status-im.utils.hex :as hex]
|
||||||
[status-im.utils.mobile-sync :as utils.mobile-sync]
|
[status-im.utils.mobile-sync :as utils.mobile-sync]
|
||||||
[status-im.wallet.core :as wallet]
|
[status-im.wallet.core :as wallet-legacy]
|
||||||
[status-im.wallet.prices :as prices]
|
[status-im.wallet.prices :as prices]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[status-im2.navigation.events :as navigation]
|
[status-im2.navigation.events :as navigation]
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
[utils.security.core :as security]))
|
[utils.security.core :as security]))
|
||||||
|
|
||||||
(rf/defn start-adding-new-account
|
(rf/defn start-adding-new-account
|
||||||
{:events [:wallet.accounts/start-adding-new-account]}
|
{:events [:wallet-legacy.accounts/start-adding-new-account]}
|
||||||
[{:keys [db] :as cofx} {:keys [type] :as add-account}]
|
[{:keys [db] :as cofx} {:keys [type] :as add-account}]
|
||||||
(let [{:keys [latest-derived-path]} (:profile/profile db)
|
(let [{:keys [latest-derived-path]} (:profile/profile db)
|
||||||
path-num (inc latest-derived-path)
|
path-num (inc latest-derived-path)
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
(let [{:keys [error publicKey address]} (types/json->clj result)]
|
(let [{:keys [error publicKey address]} (types/json->clj result)]
|
||||||
(if error
|
(if error
|
||||||
(re-frame/dispatch [::new-account-error :account-error error])
|
(re-frame/dispatch [::new-account-error :account-error error])
|
||||||
(re-frame/dispatch [:wallet.accounts/account-stored
|
(re-frame/dispatch [:wallet-legacy.accounts/account-stored
|
||||||
{:address address
|
{:address address
|
||||||
:public-key publicKey
|
:public-key publicKey
|
||||||
:type type
|
:type type
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
(if error
|
(if error
|
||||||
(re-frame/dispatch [::new-account-error :account-error error])
|
(re-frame/dispatch [::new-account-error :account-error error])
|
||||||
(re-frame/dispatch
|
(re-frame/dispatch
|
||||||
[:wallet.accounts/account-stored
|
[:wallet-legacy.accounts/account-stored
|
||||||
{:address address
|
{:address address
|
||||||
:public-key publicKey
|
:public-key publicKey
|
||||||
:key-uid keyUid
|
:key-uid keyUid
|
||||||
|
@ -123,7 +123,8 @@
|
||||||
(native-module/verify
|
(native-module/verify
|
||||||
address
|
address
|
||||||
hashed-password
|
hashed-password
|
||||||
#(re-frame/dispatch [:wallet.accounts/add-new-account-password-verifyied % hashed-password]))))
|
#(re-frame/dispatch [:wallet-legacy.accounts/add-new-account-password-verifyied %
|
||||||
|
hashed-password]))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::generate-account
|
::generate-account
|
||||||
|
@ -166,11 +167,11 @@
|
||||||
[{:keys [db]} passphrase hashed-password]
|
[{:keys [db]} passphrase hashed-password]
|
||||||
{:db (assoc-in db [:add-account :step] :generating)
|
{:db (assoc-in db [:add-account :step] :generating)
|
||||||
::multiaccounts/validate-mnemonic [(security/safe-unmask-data passphrase)
|
::multiaccounts/validate-mnemonic [(security/safe-unmask-data passphrase)
|
||||||
#(re-frame/dispatch [:wallet.accounts/seed-validated
|
#(re-frame/dispatch [:wallet-legacy.accounts/seed-validated
|
||||||
% passphrase hashed-password])]})
|
% passphrase hashed-password])]})
|
||||||
|
|
||||||
(rf/defn new-account-seed-validated
|
(rf/defn new-account-seed-validated
|
||||||
{:events [:wallet.accounts/seed-validated]}
|
{:events [:wallet-legacy.accounts/seed-validated]}
|
||||||
[{:keys [db] :as cofx} phrase-warnings passphrase hashed-password]
|
[{:keys [db] :as cofx} phrase-warnings passphrase hashed-password]
|
||||||
(let [error (:error (types/json->clj phrase-warnings))
|
(let [error (:error (types/json->clj phrase-warnings))
|
||||||
{:keys [key-uid]} (:profile/profile db)]
|
{:keys [key-uid]} (:profile/profile db)]
|
||||||
|
@ -220,7 +221,7 @@
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:json-rpc/call [{:method method
|
{:json-rpc/call [{:method method
|
||||||
:params params
|
:params params
|
||||||
:on-success #(re-frame/dispatch [::wallet/restart])}]
|
:on-success #(re-frame/dispatch [::wallet-legacy/restart])}]
|
||||||
:db (-> db
|
:db (-> db
|
||||||
(assoc :profile/wallet-accounts new-accounts)
|
(assoc :profile/wallet-accounts new-accounts)
|
||||||
(dissoc :add-account))}
|
(dissoc :add-account))}
|
||||||
|
@ -231,7 +232,7 @@
|
||||||
{}))))))
|
{}))))))
|
||||||
|
|
||||||
(rf/defn account-generated
|
(rf/defn account-generated
|
||||||
{:events [:wallet.accounts/account-stored]}
|
{:events [:wallet-legacy.accounts/account-stored]}
|
||||||
[{:keys [db] :as cofx} {:keys [address] :as account}]
|
[{:keys [db] :as cofx} {:keys [address] :as account}]
|
||||||
(let [accounts (:profile/wallet-accounts db)]
|
(let [accounts (:profile/wallet-accounts db)]
|
||||||
(if (some #(when (= (:address %) address) %) accounts)
|
(if (some #(when (= (:address %) address) %) accounts)
|
||||||
|
@ -240,9 +241,9 @@
|
||||||
{:db (update-in db [:add-account :account] merge account)}
|
{:db (update-in db [:add-account :account] merge account)}
|
||||||
(save-new-account)
|
(save-new-account)
|
||||||
(if (utils.mobile-sync/syncing-allowed? cofx)
|
(if (utils.mobile-sync/syncing-allowed? cofx)
|
||||||
(wallet/set-max-block address 0)
|
(wallet-legacy/set-max-block address 0)
|
||||||
(wallet/update-balances nil true))
|
(wallet-legacy/update-balances nil true))
|
||||||
(wallet/fetch-collectibles-collection)
|
(wallet-legacy/fetch-collectibles-collection)
|
||||||
(prices/update-prices)
|
(prices/update-prices)
|
||||||
(navigation/navigate-back)))))
|
(navigation/navigate-back)))))
|
||||||
|
|
||||||
|
@ -254,7 +255,7 @@
|
||||||
:type :watch})))
|
:type :watch})))
|
||||||
|
|
||||||
(rf/defn add-new-account-password-verifyied
|
(rf/defn add-new-account-password-verifyied
|
||||||
{:events [:wallet.accounts/add-new-account-password-verifyied]}
|
{:events [:wallet-legacy.accounts/add-new-account-password-verifyied]}
|
||||||
[{:keys [db] :as cofx} result hashed-password]
|
[{:keys [db] :as cofx} result hashed-password]
|
||||||
(let [{:keys [error]} (types/json->clj result)]
|
(let [{:keys [error]} (types/json->clj result)]
|
||||||
(if (not (string/blank? error))
|
(if (not (string/blank? error))
|
||||||
|
@ -274,7 +275,7 @@
|
||||||
:hashed-password hashed-password}})
|
:hashed-password hashed-password}})
|
||||||
|
|
||||||
(rf/defn set-account-to-watch
|
(rf/defn set-account-to-watch
|
||||||
{:events [:wallet.accounts/set-account-to-watch]}
|
{:events [:wallet-legacy.accounts/set-account-to-watch]}
|
||||||
[{:keys [db]} account]
|
[{:keys [db]} account]
|
||||||
(let [name? (and (>= (count account) 3)
|
(let [name? (and (>= (count account) 3)
|
||||||
(not (hex/valid-hex? account)))]
|
(not (hex/valid-hex? account)))]
|
||||||
|
@ -286,10 +287,10 @@
|
||||||
[(chain/chain-id db)
|
[(chain/chain-id db)
|
||||||
(stateofus/ens-name-parse account)
|
(stateofus/ens-name-parse account)
|
||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:wallet.accounts/set-account-to-watch %])]))))
|
[:wallet-legacy.accounts/set-account-to-watch %])]))))
|
||||||
|
|
||||||
(rf/defn add-new-account
|
(rf/defn add-new-account
|
||||||
{:events [:wallet.accounts/add-new-account]}
|
{:events [:wallet-legacy.accounts/add-new-account]}
|
||||||
[{:keys [db] :as cofx} hashed-password]
|
[{:keys [db] :as cofx} hashed-password]
|
||||||
(let [{:keys [type step]} (:add-account db)]
|
(let [{:keys [type step]} (:add-account db)]
|
||||||
(log/debug "[wallet] add-new-account"
|
(log/debug "[wallet] add-new-account"
|
||||||
|
@ -306,7 +307,7 @@
|
||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
(rf/defn save-account
|
(rf/defn save-account
|
||||||
{:events [:wallet.accounts/save-account]}
|
{:events [:wallet-legacy.accounts/save-account]}
|
||||||
[{:keys [db]} account {:keys [name color hidden]}]
|
[{:keys [db]} account {:keys [name color hidden]}]
|
||||||
(let [accounts (:profile/wallet-accounts db)
|
(let [accounts (:profile/wallet-accounts db)
|
||||||
new-account (cond-> account
|
new-account (cond-> account
|
||||||
|
@ -320,7 +321,7 @@
|
||||||
:db (assoc db :profile/wallet-accounts new-accounts)}))
|
:db (assoc db :profile/wallet-accounts new-accounts)}))
|
||||||
|
|
||||||
(rf/defn delete-account
|
(rf/defn delete-account
|
||||||
{:events [:wallet.accounts/delete-account]}
|
{:events [:wallet-legacy.accounts/delete-account]}
|
||||||
[{:keys [db] :as cofx} account]
|
[{:keys [db] :as cofx} account]
|
||||||
(let [accounts (:profile/wallet-accounts db)
|
(let [accounts (:profile/wallet-accounts db)
|
||||||
new-accounts (vec (remove #(= account %) accounts))
|
new-accounts (vec (remove #(= account %) accounts))
|
||||||
|
@ -331,7 +332,7 @@
|
||||||
:on-success #()}]
|
:on-success #()}]
|
||||||
:db (-> db
|
:db (-> db
|
||||||
(assoc :profile/wallet-accounts new-accounts)
|
(assoc :profile/wallet-accounts new-accounts)
|
||||||
(update-in [:wallet :accounts] dissoc deleted-address))}
|
(update-in [:wallet-legacy :accounts] dissoc deleted-address))}
|
||||||
(navigation/pop-to-root :shell-stack))))
|
(navigation/pop-to-root :shell-stack))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
@ -349,7 +350,7 @@
|
||||||
(on-success))))))))
|
(on-success))))))))
|
||||||
|
|
||||||
(rf/defn delete-account-key
|
(rf/defn delete-account-key
|
||||||
{:events [:wallet.accounts/delete-key]}
|
{:events [:wallet-legacy.accounts/delete-key]}
|
||||||
[{:keys [db] :as cofx} account password on-error]
|
[{:keys [db] :as cofx} account password on-error]
|
||||||
(let [deleted-address (:address account)
|
(let [deleted-address (:address account)
|
||||||
dapps-address (get-in cofx [:db :profile/profile :dapps-address])]
|
dapps-address (get-in cofx [:db :profile/profile :dapps-address])]
|
||||||
|
@ -362,11 +363,11 @@
|
||||||
:password password
|
:password password
|
||||||
:on-success #(do
|
:on-success #(do
|
||||||
(re-frame/dispatch [:hide-popover])
|
(re-frame/dispatch [:hide-popover])
|
||||||
(re-frame/dispatch [:wallet.accounts/delete-account account]))
|
(re-frame/dispatch [:wallet-legacy.accounts/delete-account account]))
|
||||||
:on-error on-error}})))
|
:on-error on-error}})))
|
||||||
|
|
||||||
(rf/defn view-only-qr-scanner-result
|
(rf/defn view-only-qr-scanner-result
|
||||||
{:events [:wallet.add-new/qr-scanner-result]}
|
{:events [:wallet-legacy.add-new/qr-scanner-result]}
|
||||||
[{db :db :as cofx} data _]
|
[{db :db :as cofx} data _]
|
||||||
(let [address (:address (eip681/parse-uri data))]
|
(let [address (:address (eip681/parse-uri data))]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
|
@ -384,7 +385,7 @@
|
||||||
(list-selection/open-share obj)))
|
(list-selection/open-share obj)))
|
||||||
|
|
||||||
(rf/defn wallet-accounts-share
|
(rf/defn wallet-accounts-share
|
||||||
{:events [:wallet.accounts/share]}
|
{:events [:wallet-legacy.accounts/share]}
|
||||||
[_ address]
|
[_ address]
|
||||||
{:list.selection/open-share {:message (eip55/address->checksum address)}})
|
{:list.selection/open-share {:message (eip55/address->checksum address)}})
|
||||||
|
|
||||||
|
|
|
@ -19,23 +19,23 @@
|
||||||
|
|
||||||
;; FIXME(Ferossgp): Should be part of QR scanner not wallet
|
;; FIXME(Ferossgp): Should be part of QR scanner not wallet
|
||||||
(rf/defn toggle-flashlight
|
(rf/defn toggle-flashlight
|
||||||
{:events [:wallet/toggle-flashlight]}
|
{:events [:wallet-legacy/toggle-flashlight]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [flashlight-state (get-in db [:wallet :send-transaction :camera-flashlight])
|
(let [flashlight-state (get-in db [:wallet-legacy :send-transaction :camera-flashlight])
|
||||||
toggled-state (if (= :on flashlight-state) :off :on)]
|
toggled-state (if (= :on flashlight-state) :off :on)]
|
||||||
{:db (assoc-in db [:wallet :send-transaction :camera-flashlight] toggled-state)}))
|
{:db (assoc-in db [:wallet-legacy :send-transaction :camera-flashlight] toggled-state)}))
|
||||||
|
|
||||||
(defn- find-address-name
|
(defn- find-address-name
|
||||||
[db address]
|
[db address]
|
||||||
(:name (contact.db/find-contact-by-address (:contacts/contacts db) address)))
|
(:name (contact.db/find-contact-by-address (:contacts/contacts db) address)))
|
||||||
|
|
||||||
(rf/defn set-recipient
|
(rf/defn set-recipient
|
||||||
{:events [:wallet.send/set-recipient]}
|
{:events [:wallet-legacy.send/set-recipient]}
|
||||||
[{:keys [db]} address]
|
[{:keys [db]} address]
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(dissoc :wallet/recipient)
|
(dissoc :wallet-legacy/recipient)
|
||||||
(assoc-in [:ui/search :recipient-filter] nil)
|
(assoc-in [:ui/search :recipient-filter] nil)
|
||||||
(assoc-in [:wallet/prepare-transaction :to] address))
|
(assoc-in [:wallet-legacy/prepare-transaction :to] address))
|
||||||
:dispatch [:navigate-back]})
|
:dispatch [:navigate-back]})
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
:or {sym :ETH}}
|
:or {sym :ETH}}
|
||||||
all-tokens]
|
all-tokens]
|
||||||
(assoc db
|
(assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
(cond-> {:to address
|
(cond-> {:to address
|
||||||
:to-name (or name (find-address-name db address))
|
:to-name (or name (find-address-name db address))
|
||||||
:from (wallet.utils/get-default-account
|
:from (wallet.utils/get-default-account
|
||||||
|
@ -80,26 +80,26 @@
|
||||||
sym (assoc :symbol sym))))
|
sym (assoc :symbol sym))))
|
||||||
|
|
||||||
(rf/defn request-uri-parsed
|
(rf/defn request-uri-parsed
|
||||||
{:events [:wallet/request-uri-parsed]}
|
{:events [:wallet-legacy/request-uri-parsed]}
|
||||||
[{{:networks/keys [networks current-network]
|
[{{:networks/keys [networks current-network]
|
||||||
:wallet/keys [all-tokens]
|
:wallet-legacy/keys [all-tokens]
|
||||||
:as db}
|
:as db}
|
||||||
:db}
|
:db}
|
||||||
{:keys [chain-id] :as data}
|
{:keys [chain-id] :as data}
|
||||||
uri]
|
uri]
|
||||||
(let [{:keys [address gasPrice] :as details}
|
(let [{:keys [address gasPrice] :as details}
|
||||||
(eip681/extract-request-details data all-tokens)]
|
(eip681/extract-request-details data all-tokens)]
|
||||||
(if address
|
(if address
|
||||||
(if (:wallet/recipient db)
|
(if (:wallet-legacy/recipient db)
|
||||||
{:db (update db
|
{:db (update db
|
||||||
:wallet/recipient assoc
|
:wallet-legacy/recipient assoc
|
||||||
:resolved-address address
|
:resolved-address address
|
||||||
:address address)}
|
:address address)}
|
||||||
(if (:wallet/prepare-transaction db)
|
(if (:wallet-legacy/prepare-transaction db)
|
||||||
{:db (update db
|
{:db (update db
|
||||||
:wallet/prepare-transaction assoc
|
:wallet-legacy/prepare-transaction assoc
|
||||||
:to address
|
:to address
|
||||||
:to-name (find-address-name db address))}
|
:to-name (find-address-name db address))}
|
||||||
(let [current-chain-id (get-in networks [current-network :config :NetworkId])]
|
(let [current-chain-id (get-in networks [current-network :config :NetworkId])]
|
||||||
(merge {:db (fill-prepare-transaction-details db details all-tokens)
|
(merge {:db (fill-prepare-transaction-details db details all-tokens)
|
||||||
:dispatch [:open-modal :prepare-send-transaction]}
|
:dispatch [:open-modal :prepare-send-transaction]}
|
||||||
|
@ -107,7 +107,8 @@
|
||||||
{:signing/update-gas-price
|
{:signing/update-gas-price
|
||||||
{:success-callback
|
{:success-callback
|
||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:wallet.send/update-gas-price-success :wallet/prepare-transaction %])
|
[:wallet-legacy.send/update-gas-price-success :wallet-legacy/prepare-transaction
|
||||||
|
%])
|
||||||
:network-id (get-in (chain/current-network db)
|
:network-id (get-in (chain/current-network db)
|
||||||
[:config :NetworkId])}})
|
[:config :NetworkId])}})
|
||||||
(when (and chain-id (not= current-chain-id chain-id))
|
(when (and chain-id (not= current-chain-id chain-id))
|
||||||
|
@ -116,14 +117,14 @@
|
||||||
{:ui/show-error (i18n/label :t/wallet-invalid-address {:data uri})})))
|
{:ui/show-error (i18n/label :t/wallet-invalid-address {:data uri})})))
|
||||||
|
|
||||||
(rf/defn qr-scanner-allowed
|
(rf/defn qr-scanner-allowed
|
||||||
{:events [:wallet.send/qr-scanner]}
|
{:events [:wallet-legacy.send/qr-scanner]}
|
||||||
[{:keys [db] :as cofx} options]
|
[{:keys [db] :as cofx} options]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(bottom-sheet/hide-bottom-sheet-old)
|
(bottom-sheet/hide-bottom-sheet-old)
|
||||||
(qr-scaner/scan-qr-code options)))
|
(qr-scaner/scan-qr-code options)))
|
||||||
|
|
||||||
(rf/defn parse-eip681-uri-and-resolve-ens
|
(rf/defn parse-eip681-uri-and-resolve-ens
|
||||||
{:events [:wallet/parse-eip681-uri-and-resolve-ens]}
|
{:events [:wallet-legacy/parse-eip681-uri-and-resolve-ens]}
|
||||||
[{db :db :as cofx} {:keys [message uri paths ens-names error]} ignore-url]
|
[{db :db :as cofx} {:keys [message uri paths ens-names error]} ignore-url]
|
||||||
(if-not error
|
(if-not error
|
||||||
;; first we get a vector of ens-names to resolve and a vector of paths of these names
|
;; first we get a vector of ens-names to resolve and a vector of paths of these names
|
||||||
|
@ -136,7 +137,7 @@
|
||||||
:callback
|
:callback
|
||||||
(fn [addresses]
|
(fn [addresses]
|
||||||
(re-frame/dispatch
|
(re-frame/dispatch
|
||||||
[:wallet/request-uri-parsed
|
[:wallet-legacy/request-uri-parsed
|
||||||
;; we replace ens-names at their path in the message by their actual address
|
;; we replace ens-names at their path in the message by their actual address
|
||||||
(reduce (fn [message [path address]]
|
(reduce (fn [message [path address]]
|
||||||
(assoc-in message path address))
|
(assoc-in message path address))
|
||||||
|
@ -153,7 +154,7 @@
|
||||||
{:ui/show-error (i18n/label :t/wallet-invalid-address {:data uri})}))))
|
{:ui/show-error (i18n/label :t/wallet-invalid-address {:data uri})}))))
|
||||||
|
|
||||||
(rf/defn qr-scanner-result
|
(rf/defn qr-scanner-result
|
||||||
{:events [:wallet.send/qr-scanner-result]}
|
{:events [:wallet-legacy.send/qr-scanner-result]}
|
||||||
[cofx data {:keys [ignore-url]}]
|
[cofx data {:keys [ignore-url]}]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(navigation/navigate-back)
|
(navigation/navigate-back)
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
:on-error on-error}))
|
:on-error on-error}))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/get-balances
|
:wallet-legacy/get-balances
|
||||||
(fn [addresses]
|
(fn [addresses]
|
||||||
(doseq [address addresses]
|
(doseq [address addresses]
|
||||||
(get-balance
|
(get-balance
|
||||||
|
@ -53,10 +53,10 @@
|
||||||
|
|
||||||
(defn assoc-error-message
|
(defn assoc-error-message
|
||||||
[db error-type err]
|
[db error-type err]
|
||||||
(assoc-in db [:wallet :errors error-type] (or err :unknown-error)))
|
(assoc-in db [:wallet-legacy :errors error-type] (or err :unknown-error)))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/get-cached-balances
|
:wallet-legacy/get-cached-balances
|
||||||
(fn [{:keys [addresses on-success on-error]}]
|
(fn [{:keys [addresses on-success on-error]}]
|
||||||
(json-rpc/call
|
(json-rpc/call
|
||||||
{:method "wallet_getCachedBalances"
|
{:method "wallet_getCachedBalances"
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
[{:keys [db]} scan-all-tokens?]
|
[{:keys [db]} scan-all-tokens?]
|
||||||
(let [addresses (map (comp string/lower-case :address)
|
(let [addresses (map (comp string/lower-case :address)
|
||||||
(get db :profile/wallet-accounts))]
|
(get db :profile/wallet-accounts))]
|
||||||
{:wallet/get-cached-balances
|
{:wallet-legacy/get-cached-balances
|
||||||
{:addresses addresses
|
{:addresses addresses
|
||||||
:on-success #(re-frame/dispatch [::set-cached-balances addresses % scan-all-tokens?])
|
:on-success #(re-frame/dispatch [::set-cached-balances addresses % scan-all-tokens?])
|
||||||
:on-error #(re-frame/dispatch [::on-get-cached-balance-fail % scan-all-tokens?])}}))
|
:on-error #(re-frame/dispatch [::on-get-cached-balance-fail % scan-all-tokens?])}}))
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
{:db (assoc-error-message db :balance-update :error-unable-to-get-token-balance)})
|
{:db (assoc-error-message db :balance-update :error-unable-to-get-token-balance)})
|
||||||
|
|
||||||
(rf/defn open-transaction-details
|
(rf/defn open-transaction-details
|
||||||
{:events [:wallet.ui/show-transaction-details]}
|
{:events [:wallet-legacy.ui/show-transaction-details]}
|
||||||
[cofx hash address]
|
[cofx hash address]
|
||||||
(navigation/navigate-to cofx :wallet-transaction-details {:hash hash :address address}))
|
(navigation/navigate-to cofx :wallet-transaction-details {:hash hash :address address}))
|
||||||
|
|
||||||
|
@ -144,13 +144,13 @@
|
||||||
#(re-frame/dispatch [::update-token-balance-fail %])}))
|
#(re-frame/dispatch [::update-token-balance-fail %])}))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/get-tokens-balances
|
:wallet-legacy/get-tokens-balances
|
||||||
get-token-balances)
|
get-token-balances)
|
||||||
|
|
||||||
(rf/defn collectibles-collection-fetch-success
|
(rf/defn collectibles-collection-fetch-success
|
||||||
{:events [::collectibles-collection-fetch-success]}
|
{:events [::collectibles-collection-fetch-success]}
|
||||||
[{:keys [db]} address collection]
|
[{:keys [db]} address collection]
|
||||||
{:db (assoc-in db [:wallet/collectible-collections address] collection)})
|
{:db (assoc-in db [:wallet-legacy/collectible-collections address] collection)})
|
||||||
|
|
||||||
(rf/defn fetch-collectibles-collection
|
(rf/defn fetch-collectibles-collection
|
||||||
{:events [::fetch-collectibles-collection]}
|
{:events [::fetch-collectibles-collection]}
|
||||||
|
@ -175,19 +175,19 @@
|
||||||
{:events [::collectible-assets-fetch-success]}
|
{:events [::collectible-assets-fetch-success]}
|
||||||
[{:keys [db]} address collectible-slug assets]
|
[{:keys [db]} address collectible-slug assets]
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet/fetching-collection-assets collectible-slug] false)
|
(assoc-in [:wallet-legacy/fetching-collection-assets collectible-slug] false)
|
||||||
(assoc-in [:wallet/collectible-assets address collectible-slug] assets))})
|
(assoc-in [:wallet-legacy/collectible-assets address collectible-slug] assets))})
|
||||||
|
|
||||||
(rf/defn collectibles-assets-fetch-error
|
(rf/defn collectibles-assets-fetch-error
|
||||||
{:events [::collectibles-assets-fetch-error]}
|
{:events [::collectibles-assets-fetch-error]}
|
||||||
[{:keys [db]} collectible-slug]
|
[{:keys [db]} collectible-slug]
|
||||||
{:db (assoc-in db [:wallet/fetching-collection-assets collectible-slug] false)})
|
{:db (assoc-in db [:wallet-legacy/fetching-collection-assets collectible-slug] false)})
|
||||||
|
|
||||||
(rf/defn fetch-collectible-assets-by-owner-and-collection
|
(rf/defn fetch-collectible-assets-by-owner-and-collection
|
||||||
{:events [::fetch-collectible-assets-by-owner-and-collection]}
|
{:events [::fetch-collectible-assets-by-owner-and-collection]}
|
||||||
[{:keys [db]} address collectible-slug limit]
|
[{:keys [db]} address collectible-slug limit]
|
||||||
(let [chain-id (chain/network->chain-id (chain/current-network db))]
|
(let [chain-id (chain/network->chain-id (chain/current-network db))]
|
||||||
{:db (assoc-in db [:wallet/fetching-collection-assets collectible-slug] true)
|
{:db (assoc-in db [:wallet-legacy/fetching-collection-assets collectible-slug] true)
|
||||||
:json-rpc/call [{:method "wallet_getOpenseaAssetsByOwnerAndCollection"
|
:json-rpc/call [{:method "wallet_getOpenseaAssetsByOwnerAndCollection"
|
||||||
:params [chain-id address collectible-slug limit]
|
:params [chain-id address collectible-slug limit]
|
||||||
:on-error (fn [error]
|
:on-error (fn [error]
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
|
|
||||||
(re-frame/reg-event-fx ::show-nft-details
|
(re-frame/reg-event-fx ::show-nft-details
|
||||||
(fn [{:keys [db]} [asset]]
|
(fn [{:keys [db]} [asset]]
|
||||||
{:db (assoc db :wallet/selected-collectible asset)
|
{:db (assoc db :wallet-legacy/selected-collectible asset)
|
||||||
:fx [[:dispatch [:open-modal :nft-details {}]]]}))
|
:fx [[:dispatch [:open-modal :nft-details {}]]]}))
|
||||||
|
|
||||||
(defn rpc->token
|
(defn rpc->token
|
||||||
|
@ -216,55 +216,56 @@
|
||||||
(let [default-tokens (utils.core/index-by :address tokens)
|
(let [default-tokens (utils.core/index-by :address tokens)
|
||||||
;;we want to override custom-tokens by default
|
;;we want to override custom-tokens by default
|
||||||
all-tokens (merge (rpc->token custom-tokens) default-tokens)]
|
all-tokens (merge (rpc->token custom-tokens) default-tokens)]
|
||||||
{:db (assoc db :wallet/all-tokens all-tokens)}))
|
{:db (assoc db :wallet-legacy/all-tokens all-tokens)}))
|
||||||
|
|
||||||
(rf/defn initialize-favourites
|
(rf/defn initialize-favourites
|
||||||
[{:keys [db]} favourites]
|
[{:keys [db]} favourites]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/favourites
|
:wallet-legacy/favourites
|
||||||
(reduce (fn [acc {:keys [address] :as favourit}]
|
(reduce (fn [acc {:keys [address] :as favourit}]
|
||||||
(assoc acc address favourit))
|
(assoc acc address favourit))
|
||||||
{}
|
{}
|
||||||
favourites))})
|
favourites))})
|
||||||
|
|
||||||
(rf/defn update-balances
|
(rf/defn update-balances
|
||||||
{:events [:wallet/update-balances]}
|
{:events [:wallet-legacy/update-balances]}
|
||||||
[{{:keys [network-status]
|
[{{:keys [network-status]
|
||||||
:wallet/keys [all-tokens]
|
:wallet-legacy/keys [all-tokens]
|
||||||
:profile/keys [profile wallet-accounts]
|
:profile/keys [profile wallet-accounts]
|
||||||
:as db}
|
:as db}
|
||||||
:db
|
:db
|
||||||
:as cofx} addresses scan-all-tokens?]
|
:as cofx} addresses scan-all-tokens?]
|
||||||
(log/debug "update-balances"
|
(log/debug "update-balances"
|
||||||
"accounts" addresses
|
"accounts" addresses
|
||||||
"scan-all-tokens?" scan-all-tokens?)
|
"scan-all-tokens?" scan-all-tokens?)
|
||||||
(let [addresses (or addresses
|
(let [addresses (or addresses
|
||||||
(map (comp string/lower-case :address) wallet-accounts))
|
(map (comp string/lower-case :address)
|
||||||
{:keys [:wallet/visible-tokens]} profile
|
wallet-accounts))
|
||||||
chain (chain/chain-keyword db)
|
{:keys [:wallet-legacy/visible-tokens]} profile
|
||||||
assets (get visible-tokens chain)
|
chain (chain/chain-keyword db)
|
||||||
tokens (->> (vals all-tokens)
|
assets (get visible-tokens chain)
|
||||||
(remove #(or (:hidden? %)
|
tokens (->> (vals all-tokens)
|
||||||
;;if not scan-all-tokens? remove not
|
(remove #(or (:hidden? %)
|
||||||
;;visible tokens
|
;;if not scan-all-tokens? remove not
|
||||||
(and (not scan-all-tokens?)
|
;;visible tokens
|
||||||
(not (get assets (:symbol %))))))
|
(and (not scan-all-tokens?)
|
||||||
(reduce (fn [acc {:keys [address symbol]}]
|
(not (get assets (:symbol %))))))
|
||||||
(assoc acc address symbol))
|
(reduce (fn [acc {:keys [address symbol]}]
|
||||||
{}))]
|
(assoc acc address symbol))
|
||||||
|
{}))]
|
||||||
(when (and (seq addresses)
|
(when (and (seq addresses)
|
||||||
(not= network-status :offline))
|
(not= network-status :offline))
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
{:wallet/get-balances addresses
|
{:wallet-legacy/get-balances addresses
|
||||||
:wallet/get-tokens-balances {:addresses addresses
|
:wallet-legacy/get-tokens-balances {:addresses addresses
|
||||||
:tokens tokens
|
:tokens tokens
|
||||||
:assets assets
|
:assets assets
|
||||||
:scan-all-tokens? scan-all-tokens?}
|
:scan-all-tokens? scan-all-tokens?}
|
||||||
:db (prices/clear-error-message db :balance-update)}
|
:db (prices/clear-error-message db :balance-update)}
|
||||||
(when-not assets
|
(when-not assets
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
:wallet/visible-tokens
|
:wallet-legacy/visible-tokens
|
||||||
(assoc visible-tokens
|
(assoc visible-tokens
|
||||||
chain
|
chain
|
||||||
(or (config/default-visible-tokens chain)
|
(or (config/default-visible-tokens chain)
|
||||||
|
@ -288,7 +289,7 @@
|
||||||
{:events [::update-balance-success]}
|
{:events [::update-balance-success]}
|
||||||
[{:keys [db]} address balance]
|
[{:keys [db]} address balance]
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet :accounts (eip55/address->checksum address) :balance :ETH]
|
[:wallet-legacy :accounts (eip55/address->checksum address) :balance :ETH]
|
||||||
(money/bignumber balance))})
|
(money/bignumber balance))})
|
||||||
|
|
||||||
(rf/defn set-cached-balances
|
(rf/defn set-cached-balances
|
||||||
|
@ -304,15 +305,15 @@
|
||||||
(defn has-empty-balances?
|
(defn has-empty-balances?
|
||||||
[db]
|
[db]
|
||||||
(some #(nil? (get-in % [:balance :ETH]))
|
(some #(nil? (get-in % [:balance :ETH]))
|
||||||
(get-in db [:wallet :accounts])))
|
(get-in db [:wallet-legacy :accounts])))
|
||||||
|
|
||||||
(rf/defn update-toggle-in-settings
|
(rf/defn update-toggle-in-settings
|
||||||
[{{:profile/keys [profile] :as db} :db :as cofx} symbol checked?]
|
[{{:profile/keys [profile] :as db} :db :as cofx} symbol checked?]
|
||||||
(let [chain (chain/chain-keyword db)
|
(let [chain (chain/chain-keyword db)
|
||||||
visible-tokens (get profile :wallet/visible-tokens)]
|
visible-tokens (get profile :wallet-legacy/visible-tokens)]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
:wallet/visible-tokens
|
:wallet-legacy/visible-tokens
|
||||||
(update visible-tokens
|
(update visible-tokens
|
||||||
chain
|
chain
|
||||||
#(set-checked % symbol checked?))
|
#(set-checked % symbol checked?))
|
||||||
|
@ -321,16 +322,16 @@
|
||||||
(update-balances % nil nil)))))
|
(update-balances % nil nil)))))
|
||||||
|
|
||||||
(rf/defn toggle-visible-token
|
(rf/defn toggle-visible-token
|
||||||
{:events [:wallet.settings/toggle-visible-token]}
|
{:events [:wallet-legacy.settings/toggle-visible-token]}
|
||||||
[cofx symbol checked?]
|
[cofx symbol checked?]
|
||||||
(update-toggle-in-settings cofx symbol checked?))
|
(update-toggle-in-settings cofx symbol checked?))
|
||||||
|
|
||||||
(rf/defn update-tokens-balances
|
(rf/defn update-tokens-balances
|
||||||
{:events [::update-tokens-balances-success]}
|
{:events [::update-tokens-balances-success]}
|
||||||
[{:keys [db]} balances]
|
[{:keys [db]} balances]
|
||||||
(let [accounts (get-in db [:wallet :accounts])]
|
(let [accounts (get-in db [:wallet-legacy :accounts])]
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet :accounts]
|
[:wallet-legacy :accounts]
|
||||||
(reduce (fn [acc [address balances]]
|
(reduce (fn [acc [address balances]]
|
||||||
(assoc-in acc
|
(assoc-in acc
|
||||||
[address :balance]
|
[address :balance]
|
||||||
|
@ -354,13 +355,13 @@
|
||||||
{:events [::tokens-found]}
|
{:events [::tokens-found]}
|
||||||
[{:keys [db] :as cofx} balances]
|
[{:keys [db] :as cofx} balances]
|
||||||
(let [chain (chain/chain-keyword db)
|
(let [chain (chain/chain-keyword db)
|
||||||
visible-tokens (get-in db [:profile/profile :wallet/visible-tokens])
|
visible-tokens (get-in db [:profile/profile :wallet-legacy/visible-tokens])
|
||||||
chain-visible-tokens (into (or (config/default-visible-tokens chain)
|
chain-visible-tokens (into (or (config/default-visible-tokens chain)
|
||||||
#{})
|
#{})
|
||||||
(flatten (map keys (vals balances))))]
|
(flatten (map keys (vals balances))))]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(multiaccounts.update/multiaccount-update
|
(multiaccounts.update/multiaccount-update
|
||||||
:wallet/visible-tokens
|
:wallet-legacy/visible-tokens
|
||||||
(update visible-tokens chain set/union chain-visible-tokens)
|
(update visible-tokens chain set/union chain-visible-tokens)
|
||||||
{})
|
{})
|
||||||
(update-tokens-balances balances)
|
(update-tokens-balances balances)
|
||||||
|
@ -375,12 +376,12 @@
|
||||||
(update-toggle-in-settings cofx symbol false))
|
(update-toggle-in-settings cofx symbol false))
|
||||||
|
|
||||||
(rf/defn set-and-validate-amount
|
(rf/defn set-and-validate-amount
|
||||||
{:events [:wallet.send/set-amount-text]}
|
{:events [:wallet-legacy.send/set-amount-text]}
|
||||||
[{:keys [db]} amount]
|
[{:keys [db]} amount]
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction :amount-text] amount)})
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction :amount-text] amount)})
|
||||||
|
|
||||||
(rf/defn wallet-send-gas-price-success
|
(rf/defn wallet-send-gas-price-success
|
||||||
{:events [:wallet.send/update-gas-price-success]}
|
{:events [:wallet-legacy.send/update-gas-price-success]}
|
||||||
[{db :db} tx-entry price {:keys [maxFeePerGas maxPriorityFeePerGas gasPrice]}]
|
[{db :db} tx-entry price {:keys [maxFeePerGas maxPriorityFeePerGas gasPrice]}]
|
||||||
(when (contains? db tx-entry)
|
(when (contains? db tx-entry)
|
||||||
(if (eip1559/sync-enabled?)
|
(if (eip1559/sync-enabled?)
|
||||||
|
@ -398,23 +399,23 @@
|
||||||
assoc
|
assoc
|
||||||
:maxFeePerGas (or maxFeePerGas fee-cap)
|
:maxFeePerGas (or maxFeePerGas fee-cap)
|
||||||
:maxPriorityFeePerGas (or maxPriorityFeePerGas tip-cap))
|
:maxPriorityFeePerGas (or maxPriorityFeePerGas tip-cap))
|
||||||
(assoc :wallet/current-base-fee current-base-fee
|
(assoc :wallet-legacy/current-base-fee current-base-fee
|
||||||
:wallet/normal-base-fee normal-base-fee
|
:wallet-legacy/normal-base-fee normal-base-fee
|
||||||
:wallet/slow-base-fee slow-base-fee
|
:wallet-legacy/slow-base-fee slow-base-fee
|
||||||
:wallet/fast-base-fee fast-base-fee
|
:wallet-legacy/fast-base-fee fast-base-fee
|
||||||
:wallet/current-priority-fee max-priority-fee)
|
:wallet-legacy/current-priority-fee max-priority-fee)
|
||||||
(assoc-in [:signing/edit-fee :gas-price-loading?] false))})
|
(assoc-in [:signing/edit-fee :gas-price-loading?] false))})
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet/prepare-transaction :gasPrice] (or gasPrice price))
|
(assoc-in [:wallet-legacy/prepare-transaction :gasPrice] (or gasPrice price))
|
||||||
(assoc-in [:signing/edit-fee :gas-price-loading?] false))})))
|
(assoc-in [:signing/edit-fee :gas-price-loading?] false))})))
|
||||||
|
|
||||||
(rf/defn set-max-amount
|
(rf/defn set-max-amount
|
||||||
{:events [:wallet.send/set-max-amount]}
|
{:events [:wallet-legacy.send/set-max-amount]}
|
||||||
[{:keys [db]} {:keys [amount decimals symbol]}]
|
[{:keys [db]} {:keys [amount decimals symbol]}]
|
||||||
(let [^js gas (money/bignumber 21000)
|
(let [^js gas (money/bignumber 21000)
|
||||||
^js gasPrice (or
|
^js gasPrice (or
|
||||||
(get-in db [:wallet/prepare-transaction :maxFeePerGas])
|
(get-in db [:wallet-legacy/prepare-transaction :maxFeePerGas])
|
||||||
(get-in db [:wallet/prepare-transaction :gasPrice]))
|
(get-in db [:wallet-legacy/prepare-transaction :gasPrice]))
|
||||||
^js fee (when gasPrice (.times gas gasPrice))
|
^js fee (when gasPrice (.times gas gasPrice))
|
||||||
amount-text (if (= :ETH symbol)
|
amount-text (if (= :ETH symbol)
|
||||||
(when (and fee (money/sufficient-funds? fee amount))
|
(when (and fee (money/sufficient-funds? fee amount))
|
||||||
|
@ -423,23 +424,23 @@
|
||||||
(when amount-text
|
(when amount-text
|
||||||
{:db (cond-> db
|
{:db (cond-> db
|
||||||
:always
|
:always
|
||||||
(assoc-in [:wallet/prepare-transaction :amount-text] amount-text)
|
(assoc-in [:wallet-legacy/prepare-transaction :amount-text] amount-text)
|
||||||
(= :ETH symbol)
|
(= :ETH symbol)
|
||||||
(assoc-in [:wallet/prepare-transaction :gas] gas))})))
|
(assoc-in [:wallet-legacy/prepare-transaction :gas] gas))})))
|
||||||
|
|
||||||
(rf/defn set-and-validate-request-amount
|
(rf/defn set-and-validate-request-amount
|
||||||
{:events [:wallet.request/set-amount-text]}
|
{:events [:wallet-legacy.request/set-amount-text]}
|
||||||
[{:keys [db]} amount]
|
[{:keys [db]} amount]
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction :amount-text] amount)})
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction :amount-text] amount)})
|
||||||
|
|
||||||
(rf/defn request-transaction-button-clicked-from-chat
|
(rf/defn request-transaction-button-clicked-from-chat
|
||||||
{:events [:wallet.ui/request-transaction-button-clicked]}
|
{:events [:wallet-legacy.ui/request-transaction-button-clicked]}
|
||||||
[{:keys [db] :as cofx} {:keys [to amount from token]}]
|
[{:keys [db] :as cofx} {:keys [to amount from token]}]
|
||||||
(let [{:keys [symbol address]} token
|
(let [{:keys [symbol address]} token
|
||||||
from-address (:address from)
|
from-address (:address from)
|
||||||
identity (:current-chat-id db)]
|
identity (:current-chat-id db)]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (dissoc db :wallet/prepare-transaction)
|
{:db (dissoc db :wallet-legacy/prepare-transaction)
|
||||||
:json-rpc/call [{:method "wakuext_requestTransaction"
|
:json-rpc/call [{:method "wakuext_requestTransaction"
|
||||||
:params [(:public-key to)
|
:params [(:public-key to)
|
||||||
amount
|
amount
|
||||||
|
@ -450,17 +451,17 @@
|
||||||
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})))
|
:on-success #(re-frame/dispatch [:transport/message-sent %])}]})))
|
||||||
|
|
||||||
(rf/defn accept-request-transaction-button-clicked-from-command
|
(rf/defn accept-request-transaction-button-clicked-from-command
|
||||||
{:events [:wallet.ui/accept-request-transaction-button-clicked-from-command]}
|
{:events [:wallet-legacy.ui/accept-request-transaction-button-clicked-from-command]}
|
||||||
[{:keys [db]} chat-id {:keys [value contract] :as request-parameters}]
|
[{:keys [db]} chat-id {:keys [value contract] :as request-parameters}]
|
||||||
(let [identity (:current-chat-id db)
|
(let [identity (:current-chat-id db)
|
||||||
all-tokens (:wallet/all-tokens db)
|
all-tokens (:wallet-legacy/all-tokens db)
|
||||||
{:keys [symbol decimals]}
|
{:keys [symbol decimals]}
|
||||||
(if (seq contract)
|
(if (seq contract)
|
||||||
(get all-tokens contract)
|
(get all-tokens contract)
|
||||||
(tokens/native-currency (chain/get-current-network db)))
|
(tokens/native-currency (chain/get-current-network db)))
|
||||||
amount-text (str (money/internal->formatted value symbol decimals))]
|
amount-text (str (money/internal->formatted value symbol decimals))]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
{:from (wallet.utils/get-default-account (:profile/wallet-accounts
|
{:from (wallet.utils/get-default-account (:profile/wallet-accounts
|
||||||
db))
|
db))
|
||||||
:to (or (get-in db [:contacts/contacts identity])
|
:to (or (get-in db [:contacts/contacts identity])
|
||||||
|
@ -476,19 +477,19 @@
|
||||||
:dispatch [:open-modal :prepare-send-transaction]}))
|
:dispatch [:open-modal :prepare-send-transaction]}))
|
||||||
|
|
||||||
(rf/defn set-and-validate-amount-request
|
(rf/defn set-and-validate-amount-request
|
||||||
{:events [:wallet.request/set-and-validate-amount]}
|
{:events [:wallet-legacy.request/set-and-validate-amount]}
|
||||||
[{:keys [db]} amount symbol decimals]
|
[{:keys [db]} amount symbol decimals]
|
||||||
(let [{:keys [value error]} (wallet.db/parse-amount amount decimals)]
|
(let [{:keys [value error]} (wallet.db/parse-amount amount decimals)]
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet :request-transaction :amount]
|
(assoc-in [:wallet-legacy :request-transaction :amount]
|
||||||
(money/formatted->internal value symbol decimals))
|
(money/formatted->internal value symbol decimals))
|
||||||
(assoc-in [:wallet :request-transaction :amount-text] amount)
|
(assoc-in [:wallet-legacy :request-transaction :amount-text] amount)
|
||||||
(assoc-in [:wallet :request-transaction :amount-error] error))}))
|
(assoc-in [:wallet-legacy :request-transaction :amount-error] error))}))
|
||||||
|
|
||||||
(rf/defn set-symbol-request
|
(rf/defn set-symbol-request
|
||||||
{:events [:wallet.request/set-symbol]}
|
{:events [:wallet-legacy.request/set-symbol]}
|
||||||
[{:keys [db]} symbol]
|
[{:keys [db]} symbol]
|
||||||
{:db (assoc-in db [:wallet :request-transaction :symbol] symbol)})
|
{:db (assoc-in db [:wallet-legacy :request-transaction :symbol] symbol)})
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::resolve-address
|
::resolve-address
|
||||||
|
@ -498,15 +499,16 @@
|
||||||
(rf/defn on-recipient-address-resolved
|
(rf/defn on-recipient-address-resolved
|
||||||
{:events [::recipient-address-resolved]}
|
{:events [::recipient-address-resolved]}
|
||||||
[{:keys [db]} address]
|
[{:keys [db]} address]
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction :to :address] address)
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction :to :address] address)
|
||||||
:signing/update-gas-price {:success-callback
|
:signing/update-gas-price {:success-callback
|
||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:wallet.send/update-gas-price-success :wallet/prepare-transaction %])
|
[:wallet-legacy.send/update-gas-price-success
|
||||||
|
:wallet-legacy/prepare-transaction %])
|
||||||
:network-id (get-in (chain/current-network db)
|
:network-id (get-in (chain/current-network db)
|
||||||
[:config :NetworkId])}})
|
[:config :NetworkId])}})
|
||||||
|
|
||||||
(rf/defn prepare-transaction-from-chat
|
(rf/defn prepare-transaction-from-chat
|
||||||
{:events [:wallet/prepare-transaction-from-chat]}
|
{:events [:wallet-legacy/prepare-transaction-from-chat]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [identity (:current-chat-id db)
|
(let [identity (:current-chat-id db)
|
||||||
{:keys [ens-verified name] :as contact}
|
{:keys [ens-verified name] :as contact}
|
||||||
|
@ -515,7 +517,7 @@
|
||||||
contact.db/public-key->new-contact
|
contact.db/public-key->new-contact
|
||||||
contact.db/enrich-contact))]
|
contact.db/enrich-contact))]
|
||||||
(cond-> {:db (assoc db
|
(cond-> {:db (assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
{:from (wallet.utils/get-default-account
|
{:from (wallet.utils/get-default-account
|
||||||
(:profile/wallet-accounts db))
|
(:profile/wallet-accounts db))
|
||||||
:to contact
|
:to contact
|
||||||
|
@ -532,11 +534,11 @@
|
||||||
:cb #(re-frame/dispatch [::recipient-address-resolved %])}))))
|
:cb #(re-frame/dispatch [::recipient-address-resolved %])}))))
|
||||||
|
|
||||||
(rf/defn prepare-request-transaction-from-chat
|
(rf/defn prepare-request-transaction-from-chat
|
||||||
{:events [:wallet/prepare-request-transaction-from-chat]}
|
{:events [:wallet-legacy/prepare-request-transaction-from-chat]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [identity (:current-chat-id db)]
|
(let [identity (:current-chat-id db)]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
{:from (wallet.utils/get-default-account (:profile/wallet-accounts db))
|
{:from (wallet.utils/get-default-account (:profile/wallet-accounts db))
|
||||||
:to (or (get-in db [:contacts/contacts identity])
|
:to (or (get-in db [:contacts/contacts identity])
|
||||||
(-> identity
|
(-> identity
|
||||||
|
@ -548,10 +550,10 @@
|
||||||
:dispatch [:open-modal :request-transaction]}))
|
:dispatch [:open-modal :request-transaction]}))
|
||||||
|
|
||||||
(rf/defn prepare-transaction-from-wallet
|
(rf/defn prepare-transaction-from-wallet
|
||||||
{:events [:wallet/prepare-transaction-from-wallet]}
|
{:events [:wallet-legacy/prepare-transaction-from-wallet]}
|
||||||
[{:keys [db]} account]
|
[{:keys [db]} account]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
{:from account
|
{:from account
|
||||||
:to nil
|
:to nil
|
||||||
:symbol :ETH
|
:symbol :ETH
|
||||||
|
@ -559,21 +561,22 @@
|
||||||
:dispatch [:open-modal :prepare-send-transaction]
|
:dispatch [:open-modal :prepare-send-transaction]
|
||||||
:signing/update-gas-price {:success-callback
|
:signing/update-gas-price {:success-callback
|
||||||
#(re-frame/dispatch
|
#(re-frame/dispatch
|
||||||
[:wallet.send/update-gas-price-success :wallet/prepare-transaction %])
|
[:wallet-legacy.send/update-gas-price-success
|
||||||
|
:wallet-legacy/prepare-transaction %])
|
||||||
:network-id (get-in (chain/current-network db)
|
:network-id (get-in (chain/current-network db)
|
||||||
[:config :NetworkId])}})
|
[:config :NetworkId])}})
|
||||||
|
|
||||||
(rf/defn cancel-transaction-command
|
(rf/defn cancel-transaction-command
|
||||||
{:events [:wallet/cancel-transaction-command]}
|
{:events [:wallet-legacy/cancel-transaction-command]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [identity (:current-chat-id db)]
|
(let [identity (:current-chat-id db)]
|
||||||
{:db (dissoc db :wallet/prepare-transaction)}))
|
{:db (dissoc db :wallet-legacy/prepare-transaction)}))
|
||||||
|
|
||||||
(rf/defn finalize-transaction-from-command
|
(rf/defn finalize-transaction-from-command
|
||||||
{:events [:wallet/finalize-transaction-from-command]}
|
{:events [:wallet-legacy/finalize-transaction-from-command]}
|
||||||
[{:keys [db]} account to symbol amount]
|
[{:keys [db]} account to symbol amount]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/prepare-transaction
|
:wallet-legacy/prepare-transaction
|
||||||
{:from account
|
{:from account
|
||||||
:to to
|
:to to
|
||||||
:symbol symbol
|
:symbol symbol
|
||||||
|
@ -581,47 +584,48 @@
|
||||||
:from-command? true})})
|
:from-command? true})})
|
||||||
|
|
||||||
(rf/defn view-only-qr-scanner-allowed
|
(rf/defn view-only-qr-scanner-allowed
|
||||||
{:events [:wallet.add-new/qr-scanner]}
|
{:events [:wallet-legacy.add-new/qr-scanner]}
|
||||||
[{:keys [db] :as cofx} options]
|
[{:keys [db] :as cofx} options]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (update-in db [:add-account] dissoc :address)}
|
{:db (update-in db [:add-account] dissoc :address)}
|
||||||
(qr-scaner/scan-qr-code options)))
|
(qr-scaner/scan-qr-code options)))
|
||||||
|
|
||||||
(rf/defn wallet-send-set-symbol
|
(rf/defn wallet-send-set-symbol
|
||||||
{:events [:wallet.send/set-symbol]}
|
{:events [:wallet-legacy.send/set-symbol]}
|
||||||
[{:keys [db] :as cofx} symbol]
|
[{:keys [db] :as cofx} symbol]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction :symbol] symbol)}
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction :symbol] symbol)}
|
||||||
(bottom-sheet/hide-bottom-sheet-old)))
|
(bottom-sheet/hide-bottom-sheet-old)))
|
||||||
|
|
||||||
(rf/defn wallet-send-set-field
|
(rf/defn wallet-send-set-field
|
||||||
{:events [:wallet.send/set-field]}
|
{:events [:wallet-legacy.send/set-field]}
|
||||||
[{:keys [db] :as cofx} field value]
|
[{:keys [db] :as cofx} field value]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction field] value)}
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction field] value)}
|
||||||
(bottom-sheet/hide-bottom-sheet-old)))
|
(bottom-sheet/hide-bottom-sheet-old)))
|
||||||
|
|
||||||
(rf/defn wallet-request-set-field
|
(rf/defn wallet-request-set-field
|
||||||
{:events [:wallet.request/set-field]}
|
{:events [:wallet-legacy.request/set-field]}
|
||||||
[{:keys [db] :as cofx} field value]
|
[{:keys [db] :as cofx} field value]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db [:wallet/prepare-transaction field] value)}
|
{:db (assoc-in db [:wallet-legacy/prepare-transaction field] value)}
|
||||||
(bottom-sheet/hide-bottom-sheet-old)))
|
(bottom-sheet/hide-bottom-sheet-old)))
|
||||||
|
|
||||||
(re-frame/reg-event-fx :wallet.send/navigate-to-recipient-code
|
(re-frame/reg-event-fx :wallet-legacy.send/navigate-to-recipient-code
|
||||||
(fn [{:keys [db]}]
|
(fn [{:keys [db]}]
|
||||||
{:db (-> db (assoc :wallet/recipient {}))
|
{:db (-> db (assoc :wallet-legacy/recipient {}))
|
||||||
:fx [[:dispatch [:bottom-sheet/hide-old]]
|
:fx [[:dispatch [:bottom-sheet/hide-old]]
|
||||||
[:dispatch [:open-modal :recipient nil]]]}))
|
[:dispatch [:open-modal :recipient nil]]]}))
|
||||||
|
|
||||||
(rf/defn show-delete-account-confirmation
|
(rf/defn show-delete-account-confirmation
|
||||||
{:events [:wallet.settings/show-delete-account-confirmation]}
|
{:events [:wallet-legacy.settings/show-delete-account-confirmation]}
|
||||||
[_ account]
|
[_ account]
|
||||||
{:ui/show-confirmation {:title (i18n/label :t/are-you-sure?)
|
{:ui/show-confirmation {:title (i18n/label :t/are-you-sure?)
|
||||||
:confirm-button-text (i18n/label :t/yes)
|
:confirm-button-text (i18n/label :t/yes)
|
||||||
:cancel-button-text (i18n/label :t/no)
|
:cancel-button-text (i18n/label :t/no)
|
||||||
:on-accept #(re-frame/dispatch [:wallet.accounts/delete-account
|
:on-accept #(re-frame/dispatch
|
||||||
account])
|
[:wallet-legacy.accounts/delete-account
|
||||||
|
account])
|
||||||
:on-cancel #()}})
|
:on-cancel #()}})
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
@ -665,7 +669,7 @@
|
||||||
max-block
|
max-block
|
||||||
block))
|
block))
|
||||||
nil
|
nil
|
||||||
(get-in db [:wallet :accounts])))
|
(get-in db [:wallet-legacy :accounts])))
|
||||||
|
|
||||||
(defn custom-rpc-node? [{:keys [id]}] (= 45 (count id)))
|
(defn custom-rpc-node? [{:keys [id]}] (= 45 (count id)))
|
||||||
|
|
||||||
|
@ -680,7 +684,7 @@
|
||||||
|
|
||||||
(and max-block
|
(and max-block
|
||||||
(zero? max-block)
|
(zero? max-block)
|
||||||
(nil? (get db :wallet/keep-watching-until-ms)))
|
(nil? (get db :wallet-legacy/keep-watching-until-ms)))
|
||||||
(log/info "[wallet] No transactions found")
|
(log/info "[wallet] No transactions found")
|
||||||
|
|
||||||
:else
|
:else
|
||||||
|
@ -697,8 +701,8 @@
|
||||||
[{:keys [db] :as cofx}]
|
[{:keys [db] :as cofx}]
|
||||||
(log/info "[wallet] after-checking-history")
|
(log/info "[wallet] after-checking-history")
|
||||||
{:db (dissoc db
|
{:db (dissoc db
|
||||||
:wallet/recent-history-fetching-started?
|
:wallet-legacy/recent-history-fetching-started?
|
||||||
:wallet/refreshing-history?)})
|
:wallet-legacy/refreshing-history?)})
|
||||||
|
|
||||||
(defn set-timeout
|
(defn set-timeout
|
||||||
[db]
|
[db]
|
||||||
|
@ -719,8 +723,8 @@
|
||||||
(assoc :wallet-service/restart-timeout timeout
|
(assoc :wallet-service/restart-timeout timeout
|
||||||
:wallet-service/custom-interval (get-next-custom-interval
|
:wallet-service/custom-interval (get-next-custom-interval
|
||||||
db)
|
db)
|
||||||
:wallet/was-started? true
|
:wallet-legacy/was-started? true
|
||||||
:wallet/on-recent-history-fetching
|
:wallet-legacy/on-recent-history-fetching
|
||||||
on-recent-history-fetching))
|
on-recent-history-fetching))
|
||||||
::check-recent-history addresses
|
::check-recent-history addresses
|
||||||
::utils.utils/clear-timeouts
|
::utils.utils/clear-timeouts
|
||||||
|
@ -747,7 +751,7 @@
|
||||||
|
|
||||||
(rf/defn restart-wallet-service-after-background
|
(rf/defn restart-wallet-service-after-background
|
||||||
[{:keys [now db] :as cofx} background-time]
|
[{:keys [now db] :as cofx} background-time]
|
||||||
(when (and (get db :wallet/was-started?)
|
(when (and (get db :wallet-legacy/was-started?)
|
||||||
(> (- now background-time)
|
(> (- now background-time)
|
||||||
background-cooldown-time))
|
background-cooldown-time))
|
||||||
(restart-wallet-service cofx nil)))
|
(restart-wallet-service cofx nil)))
|
||||||
|
@ -783,17 +787,17 @@
|
||||||
(def pull-to-refresh-cooldown-period (* 1 60 1000))
|
(def pull-to-refresh-cooldown-period (* 1 60 1000))
|
||||||
|
|
||||||
(rf/defn restart-on-pull
|
(rf/defn restart-on-pull
|
||||||
{:events [:wallet.ui/pull-to-refresh-history]}
|
{:events [:wallet-legacy.ui/pull-to-refresh-history]}
|
||||||
[{:keys [db now] :as cofx}]
|
[{:keys [db now] :as cofx}]
|
||||||
(let [last-pull (get db :wallet/last-pull-time)
|
(let [last-pull (get db :wallet-legacy/last-pull-time)
|
||||||
fetching-history? (get db :wallet/recent-history-fetching-started?)]
|
fetching-history? (get db :wallet-legacy/recent-history-fetching-started?)]
|
||||||
(when (and (not fetching-history?)
|
(when (and (not fetching-history?)
|
||||||
(or (not last-pull)
|
(or (not last-pull)
|
||||||
(> (- now last-pull) pull-to-refresh-cooldown-period)))
|
(> (- now last-pull) pull-to-refresh-cooldown-period)))
|
||||||
(rf/merge
|
(rf/merge
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/last-pull-time now
|
:wallet-legacy/last-pull-time now
|
||||||
:wallet/refreshing-history? true)}
|
:wallet-legacy/refreshing-history? true)}
|
||||||
(restart-wallet-service
|
(restart-wallet-service
|
||||||
{:force-restart? true})))))
|
{:force-restart? true})))))
|
||||||
|
|
||||||
|
@ -831,53 +835,53 @@
|
||||||
{:events [::wallet-stack]}
|
{:events [::wallet-stack]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
(let [wallet-set-up-passed? (get-in db [:profile/profile :wallet-set-up-passed?])
|
(let [wallet-set-up-passed? (get-in db [:profile/profile :wallet-set-up-passed?])
|
||||||
sign-phrase-showed? (get db :wallet/sign-phrase-showed?)]
|
sign-phrase-showed? (get db :wallet-legacy/sign-phrase-showed?)]
|
||||||
{:dispatch-n [[:wallet.ui/pull-to-refresh]] ;TODO temporary simple fix for v1
|
{:dispatch-n [[:wallet-legacy.ui/pull-to-refresh]] ;TODO temporary simple fix for v1
|
||||||
;;[:show-popover {:view [signing-phrase/signing-phrase]}]]
|
;;[:show-popover {:view [signing-phrase/signing-phrase]}]]
|
||||||
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
|
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
|
||||||
db
|
db
|
||||||
(assoc db :wallet/sign-phrase-showed? true))}))
|
(assoc db :wallet-legacy/sign-phrase-showed? true))}))
|
||||||
|
|
||||||
(rf/defn wallet-wallet-add-custom-token
|
(rf/defn wallet-wallet-add-custom-token
|
||||||
{:events [:wallet/wallet-add-custom-token]}
|
{:events [:wallet-legacy/wallet-add-custom-token]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (dissoc db :wallet/custom-token-screen)})
|
{:db (dissoc db :wallet-legacy/custom-token-screen)})
|
||||||
|
|
||||||
(rf/defn hide-buy-crypto
|
(rf/defn hide-buy-crypto
|
||||||
{:events [::hide-buy-crypto]}
|
{:events [::hide-buy-crypto]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (assoc db :wallet/buy-crypto-hidden true)
|
{:db (assoc db :wallet-legacy/buy-crypto-hidden true)
|
||||||
:async-storage-set {:buy-crypto-hidden true}})
|
:async-storage-set {:buy-crypto-hidden true}})
|
||||||
|
|
||||||
(rf/defn store-buy-crypto
|
(rf/defn store-buy-crypto
|
||||||
{:events [::store-buy-crypto-preference]}
|
{:events [::store-buy-crypto-preference]}
|
||||||
[{:keys [db]} {:keys [buy-crypto-hidden]}]
|
[{:keys [db]} {:keys [buy-crypto-hidden]}]
|
||||||
{:db (assoc db :wallet/buy-crypto-hidden buy-crypto-hidden)})
|
{:db (assoc db :wallet-legacy/buy-crypto-hidden buy-crypto-hidden)})
|
||||||
|
|
||||||
(rf/defn contract-address-paste
|
(rf/defn contract-address-paste
|
||||||
{:events [:wallet.custom-token.ui/contract-address-paste]}
|
{:events [:wallet-legacy.custom-token.ui/contract-address-paste]}
|
||||||
[_]
|
[_]
|
||||||
{:wallet.custom-token/contract-address-paste nil})
|
{:wallet-legacy.custom-token/contract-address-paste nil})
|
||||||
|
|
||||||
(rf/defn transactions-add-filter
|
(rf/defn transactions-add-filter
|
||||||
{:events [:wallet.transactions/add-filter]}
|
{:events [:wallet-legacy.transactions/add-filter]}
|
||||||
[{:keys [db]} id]
|
[{:keys [db]} id]
|
||||||
{:db (update-in db [:wallet :filters] conj id)})
|
{:db (update-in db [:wallet-legacy :filters] conj id)})
|
||||||
|
|
||||||
(rf/defn transactions-remove-filter
|
(rf/defn transactions-remove-filter
|
||||||
{:events [:wallet.transactions/remove-filter]}
|
{:events [:wallet-legacy.transactions/remove-filter]}
|
||||||
[{:keys [db]} id]
|
[{:keys [db]} id]
|
||||||
{:db (update-in db [:wallet :filters] disj id)})
|
{:db (update-in db [:wallet-legacy :filters] disj id)})
|
||||||
|
|
||||||
(rf/defn transactions-add-all-filters
|
(rf/defn transactions-add-all-filters
|
||||||
{:events [:wallet.transactions/add-all-filters]}
|
{:events [:wallet-legacy.transactions/add-all-filters]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet :filters]
|
[:wallet-legacy :filters]
|
||||||
wallet.db/default-wallet-filters)})
|
wallet.db/default-wallet-filters)})
|
||||||
|
|
||||||
(rf/defn settings-navigate-back-pressed
|
(rf/defn settings-navigate-back-pressed
|
||||||
{:events [:wallet.settings.ui/navigate-back-pressed]}
|
{:events [:wallet-legacy.settings.ui/navigate-back-pressed]}
|
||||||
[cofx on-close]
|
[cofx on-close]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(when on-close
|
(when on-close
|
||||||
|
@ -886,32 +890,34 @@
|
||||||
|
|
||||||
(rf/defn stop-fetching-on-empty-tx-history
|
(rf/defn stop-fetching-on-empty-tx-history
|
||||||
[{:keys [db now] :as cofx} transfers]
|
[{:keys [db now] :as cofx} transfers]
|
||||||
(let [non-empty-history? (get db :wallet/non-empty-tx-history?)
|
(let [non-empty-history? (get db :wallet-legacy/non-empty-tx-history?)
|
||||||
custom-node? (custom-rpc-node?
|
custom-node? (custom-rpc-node?
|
||||||
(chain/current-network db))
|
(chain/current-network db))
|
||||||
until-ms (get db :wallet/keep-watching-until-ms)]
|
until-ms (get db :wallet-legacy/keep-watching-until-ms)]
|
||||||
(when-not (and until-ms (> until-ms now))
|
(when-not (and until-ms (> until-ms now))
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
{:db (dissoc db :wallet/keep-watching-until-ms)}
|
{:db (dissoc db :wallet-legacy/keep-watching-until-ms)}
|
||||||
(if (and (not non-empty-history?)
|
(if (and (not non-empty-history?)
|
||||||
(empty? transfers)
|
(empty? transfers)
|
||||||
(not custom-node?))
|
(not custom-node?))
|
||||||
(clear-timeouts)
|
(clear-timeouts)
|
||||||
(fn [{:keys [db]}]
|
(fn [{:keys [db]}]
|
||||||
{:db (assoc db :wallet/non-empty-tx-history? true)}))))))
|
{:db (assoc db :wallet-legacy/non-empty-tx-history? true)}))))))
|
||||||
|
|
||||||
(rf/defn keep-watching-history
|
(rf/defn keep-watching-history
|
||||||
{:events [:wallet/keep-watching]}
|
{:events [:wallet-legacy/keep-watching]}
|
||||||
[{:keys [db now] :as cofx}]
|
[{:keys [db now] :as cofx}]
|
||||||
(let [non-empty-history? (get db :wallet/non-empty-tx-history?)
|
(let [non-empty-history? (get db :wallet-legacy/non-empty-tx-history?)
|
||||||
old-timeout (get db :wallet-service/restart-timeout)
|
old-timeout (get db :wallet-service/restart-timeout)
|
||||||
db (assoc db :wallet-service/custom-interval :ms-2-min)
|
db (assoc db :wallet-service/custom-interval :ms-2-min)
|
||||||
timeout (set-timeout db)]
|
timeout (set-timeout db)]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/keep-watching-until-ms (+ now (datetime/minutes 30))
|
:wallet-legacy/keep-watching-until-ms (+ now
|
||||||
:wallet-service/restart-timeout timeout
|
(datetime/minutes 30))
|
||||||
:wallet-service/custom-interval (get-next-custom-interval db))
|
:wallet-service/restart-timeout timeout
|
||||||
|
:wallet-service/custom-interval (get-next-custom-interval
|
||||||
|
db))
|
||||||
::utils.utils/clear-timeouts [old-timeout]}))
|
::utils.utils/clear-timeouts [old-timeout]}))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
@ -925,15 +931,15 @@
|
||||||
:on-error #(log/info "Initial blocks range was not set")})))
|
:on-error #(log/info "Initial blocks range was not set")})))
|
||||||
|
|
||||||
(rf/defn set-initial-blocks-range
|
(rf/defn set-initial-blocks-range
|
||||||
{:events [:wallet/set-initial-blocks-range]}
|
{:events [:wallet-legacy/set-initial-blocks-range]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (assoc db :wallet/new-account true)
|
{:db (assoc db :wallet-legacy/new-account true)
|
||||||
::set-inital-range nil})
|
::set-inital-range nil})
|
||||||
|
|
||||||
(rf/defn tab-opened
|
(rf/defn tab-opened
|
||||||
{:events [:wallet/tab-opened]}
|
{:events [:wallet-legacy/tab-opened]}
|
||||||
[{:keys [db] :as cofx}]
|
[{:keys [db] :as cofx}]
|
||||||
(when-not (get db :wallet/was-started?)
|
(when-not (get db :wallet-legacy/was-started?)
|
||||||
(restart-wallet-service cofx nil)))
|
(restart-wallet-service cofx nil)))
|
||||||
|
|
||||||
(rf/defn set-max-block
|
(rf/defn set-max-block
|
||||||
|
@ -941,7 +947,7 @@
|
||||||
(log/debug "set-max-block"
|
(log/debug "set-max-block"
|
||||||
"address" address
|
"address" address
|
||||||
"block" block)
|
"block" block)
|
||||||
{:db (assoc-in db [:wallet :accounts address :max-block] block)})
|
{:db (assoc-in db [:wallet-legacy :accounts address :max-block] block)})
|
||||||
|
|
||||||
(rf/defn set-max-block-with-transfers
|
(rf/defn set-max-block-with-transfers
|
||||||
[{:keys [db] :as cofx} address transfers]
|
[{:keys [db] :as cofx} address transfers]
|
||||||
|
@ -950,15 +956,15 @@
|
||||||
(if (> block max-block)
|
(if (> block max-block)
|
||||||
block
|
block
|
||||||
max-block))
|
max-block))
|
||||||
(get-in db [:wallet :accounts address :max-block] 0)
|
(get-in db [:wallet-legacy :accounts address :max-block] 0)
|
||||||
transfers)]
|
transfers)]
|
||||||
(set-max-block cofx address max-block)))
|
(set-max-block cofx address max-block)))
|
||||||
|
|
||||||
(rf/defn share
|
(rf/defn share
|
||||||
{:events [:wallet/share-popover]}
|
{:events [:wallet-legacy/share-popover]}
|
||||||
[{:keys [db] :as cofx} address]
|
[{:keys [db] :as cofx} address]
|
||||||
(let [non-empty-history? (get db :wallet/non-empty-tx-history?)
|
(let [non-empty-history? (get db :wallet-legacy/non-empty-tx-history?)
|
||||||
restart? (and (not (get db :wallet/non-empty-tx-history?))
|
restart? (and (not (get db :wallet-legacy/non-empty-tx-history?))
|
||||||
(not (get db :wallet-service/restart-timeout)))]
|
(not (get db :wallet-service/restart-timeout)))]
|
||||||
(rf/merge
|
(rf/merge
|
||||||
cofx
|
cofx
|
||||||
|
@ -973,10 +979,10 @@
|
||||||
(json-rpc/call
|
(json-rpc/call
|
||||||
{:method "wallet_getPendingTransactions"
|
{:method "wallet_getPendingTransactions"
|
||||||
:params []
|
:params []
|
||||||
:on-success #(re-frame/dispatch [:wallet/on-retreiving-pending-transactions %])})))
|
:on-success #(re-frame/dispatch [:wallet-legacy/on-retreiving-pending-transactions %])})))
|
||||||
|
|
||||||
(rf/defn get-pending-transactions
|
(rf/defn get-pending-transactions
|
||||||
{:events [:wallet/get-pending-transactions]}
|
{:events [:wallet-legacy/get-pending-transactions]}
|
||||||
[_]
|
[_]
|
||||||
(log/info "[wallet] get pending transactions")
|
(log/info "[wallet] get pending transactions")
|
||||||
{::get-pending-transactions nil})
|
{::get-pending-transactions nil})
|
||||||
|
@ -984,7 +990,7 @@
|
||||||
(defn normalize-transaction
|
(defn normalize-transaction
|
||||||
[db {:keys [gasPrice gasLimit value from to] :as transaction}]
|
[db {:keys [gasPrice gasLimit value from to] :as transaction}]
|
||||||
(let [sym (-> transaction :symbol keyword)
|
(let [sym (-> transaction :symbol keyword)
|
||||||
token (tokens/symbol->token (:wallet/all-tokens db) sym)]
|
token (tokens/symbol->token (:wallet-legacy/all-tokens db) sym)]
|
||||||
(-> transaction
|
(-> transaction
|
||||||
(select-keys [:timestamp :hash :data])
|
(select-keys [:timestamp :hash :data])
|
||||||
(assoc :from (eip55/address->checksum from)
|
(assoc :from (eip55/address->checksum from)
|
||||||
|
@ -997,12 +1003,12 @@
|
||||||
:gas-limit (money/bignumber gasLimit)))))
|
:gas-limit (money/bignumber gasLimit)))))
|
||||||
|
|
||||||
(rf/defn on-retriving-pending-transactions
|
(rf/defn on-retriving-pending-transactions
|
||||||
{:events [:wallet/on-retreiving-pending-transactions]}
|
{:events [:wallet-legacy/on-retreiving-pending-transactions]}
|
||||||
[{:keys [db]} raw-transactions]
|
[{:keys [db]} raw-transactions]
|
||||||
(log/info "[wallet] pending transactions")
|
(log/info "[wallet] pending transactions")
|
||||||
{:db
|
{:db
|
||||||
(reduce (fn [db {:keys [from] :as transaction}]
|
(reduce (fn [db {:keys [from] :as transaction}]
|
||||||
(let [path [:wallet :accounts from :transactions (:hash transaction)]]
|
(let [path [:wallet-legacy :accounts from :transactions (:hash transaction)]]
|
||||||
(if-not (get-in db path)
|
(if-not (get-in db path)
|
||||||
(assoc-in db path transaction)
|
(assoc-in db path transaction)
|
||||||
db)))
|
db)))
|
||||||
|
@ -1011,7 +1017,7 @@
|
||||||
::start-watching (map (juxt :from :hash :network_id) raw-transactions)})
|
::start-watching (map (juxt :from :hash :network_id) raw-transactions)})
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/delete-pending-transactions
|
:wallet-legacy/delete-pending-transactions
|
||||||
(fn [hashes]
|
(fn [hashes]
|
||||||
(log/info "[wallet] delete pending transactions")
|
(log/info "[wallet] delete pending transactions")
|
||||||
(doseq [tx-hash hashes]
|
(doseq [tx-hash hashes]
|
||||||
|
@ -1024,10 +1030,10 @@
|
||||||
{:events [:multiaccounts.ui/switch-transactions-management-enabled]}
|
{:events [:multiaccounts.ui/switch-transactions-management-enabled]}
|
||||||
[{:keys [db]} enabled?]
|
[{:keys [db]} enabled?]
|
||||||
{:async-storage-set {:transactions-management-enabled? enabled?}
|
{:async-storage-set {:transactions-management-enabled? enabled?}
|
||||||
:db (assoc db :wallet/transactions-management-enabled? enabled?)})
|
:db (assoc db :wallet-legacy/transactions-management-enabled? enabled?)})
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/initialize-transactions-management-enabled
|
:wallet-legacy/initialize-transactions-management-enabled
|
||||||
(fn []
|
(fn []
|
||||||
(let [callback #(re-frame/dispatch [:multiaccounts.ui/switch-transactions-management-enabled %])]
|
(let [callback #(re-frame/dispatch [:multiaccounts.ui/switch-transactions-management-enabled %])]
|
||||||
(async-storage/get-item :transactions-management-enabled? callback))))
|
(async-storage/get-item :transactions-management-enabled? callback))))
|
||||||
|
@ -1058,13 +1064,13 @@
|
||||||
tokens))
|
tokens))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/get-tokens
|
:wallet-legacy/get-tokens
|
||||||
(fn [[network-id accounts recovered-account?]]
|
(fn [[network-id accounts recovered-account?]]
|
||||||
(utils.utils/set-timeout
|
(utils.utils/set-timeout
|
||||||
(fn []
|
(fn []
|
||||||
(json-rpc/call {:method "wallet_getTokens"
|
(json-rpc/call {:method "wallet_getTokens"
|
||||||
:params [(int network-id)]
|
:params [(int network-id)]
|
||||||
:on-success #(re-frame/dispatch [:wallet/initialize-wallet
|
:on-success #(re-frame/dispatch [:wallet-legacy/initialize-wallet
|
||||||
accounts
|
accounts
|
||||||
(normalize-tokens network-id %)
|
(normalize-tokens network-id %)
|
||||||
nil nil
|
nil nil
|
||||||
|
@ -1074,7 +1080,7 @@
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
;;TODO: this could be replaced by a single API call on status-go side
|
;;TODO: this could be replaced by a single API call on status-go side
|
||||||
:wallet/initialize-wallet
|
:wallet-legacy/initialize-wallet
|
||||||
(fn [[network-id network callback]]
|
(fn [[network-id network callback]]
|
||||||
(-> (js/Promise.all
|
(-> (js/Promise.all
|
||||||
(clj->js
|
(clj->js
|
||||||
|
@ -1178,7 +1184,7 @@
|
||||||
(native-module/start-local-notifications)))
|
(native-module/start-local-notifications)))
|
||||||
|
|
||||||
(rf/defn initialize-wallet
|
(rf/defn initialize-wallet
|
||||||
{:events [:wallet/initialize-wallet]}
|
{:events [:wallet-legacy/initialize-wallet]}
|
||||||
[{:keys [db] :as cofx} accounts tokens custom-tokens
|
[{:keys [db] :as cofx} accounts tokens custom-tokens
|
||||||
favourites scan-all-tokens? new-account?]
|
favourites scan-all-tokens? new-account?]
|
||||||
(rf/merge
|
(rf/merge
|
||||||
|
@ -1208,7 +1214,7 @@
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(get-cached-balances scan-all-tokens?))
|
(get-cached-balances scan-all-tokens?))
|
||||||
(when-not (get db :wallet/new-account)
|
(when-not (get db :wallet-legacy/new-account)
|
||||||
(restart-wallet-service nil))
|
(restart-wallet-service nil))
|
||||||
(when (chain/binance-chain? db)
|
(when (chain/binance-chain? db)
|
||||||
(request-current-block-update))
|
(request-current-block-update))
|
||||||
|
|
|
@ -13,46 +13,47 @@
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet.custom-token/contract-address-paste
|
:wallet-legacy.custom-token/contract-address-paste
|
||||||
(fn []
|
(fn []
|
||||||
(react/get-from-clipboard
|
(react/get-from-clipboard
|
||||||
#(re-frame/dispatch [:wallet.custom-token/contract-address-is-pasted (string/trim %)]))))
|
#(re-frame/dispatch [:wallet-legacy.custom-token/contract-address-is-pasted (string/trim %)]))))
|
||||||
|
|
||||||
(defn field-exists?
|
(defn field-exists?
|
||||||
[{:wallet/keys [all-tokens]} field-key field-value]
|
[{:wallet-legacy/keys [all-tokens]} field-key field-value]
|
||||||
(some #(= field-value (get % field-key))
|
(some #(= field-value (get % field-key))
|
||||||
(vals all-tokens)))
|
(vals all-tokens)))
|
||||||
|
|
||||||
(defn token-in-list?
|
(defn token-in-list?
|
||||||
[{:wallet/keys [all-tokens]} contract]
|
[{:wallet-legacy/keys [all-tokens]} contract]
|
||||||
(not (nil? (get all-tokens (string/lower-case contract)))))
|
(not (nil? (get all-tokens (string/lower-case contract)))))
|
||||||
|
|
||||||
(rf/defn contract-address-is-changed
|
(rf/defn contract-address-is-changed
|
||||||
{:events [:wallet.custom-token/contract-address-is-pasted]}
|
{:events [:wallet-legacy.custom-token/contract-address-is-pasted]}
|
||||||
[{:keys [db]} contract]
|
[{:keys [db]} contract]
|
||||||
(if (address/address? contract)
|
(if (address/address? contract)
|
||||||
(if (token-in-list? db contract)
|
(if (token-in-list? db contract)
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
{:contract contract :error (i18n/label :t/already-have-asset)})}
|
{:contract contract :error (i18n/label :t/already-have-asset)})}
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
{:contract contract :in-progress? true})
|
{:contract contract :in-progress? true})
|
||||||
:json-rpc/call [{:method "wallet_discoverToken"
|
:json-rpc/call [{:method "wallet_discoverToken"
|
||||||
:params [(chain/chain-id db) contract]
|
:params [(chain/chain-id db) contract]
|
||||||
:on-success #(re-frame/dispatch [:wallet.custom-token/token-discover-result %])
|
:on-success #(re-frame/dispatch
|
||||||
:on-error #(re-frame/dispatch [:wallet.custom-token/not-supported])}]})
|
[:wallet-legacy.custom-token/token-discover-result %])
|
||||||
|
:on-error #(re-frame/dispatch [:wallet-legacy.custom-token/not-supported])}]})
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
{:contract contract
|
{:contract contract
|
||||||
:error (i18n/label :t/wrong-address)})}))
|
:error (i18n/label :t/wrong-address)})}))
|
||||||
|
|
||||||
(rf/defn token-discover-result
|
(rf/defn token-discover-result
|
||||||
{:events [:wallet.custom-token/token-discover-result]}
|
{:events [:wallet-legacy.custom-token/token-discover-result]}
|
||||||
[{:keys [db]} {:keys [name symbol decimals]}]
|
[{:keys [db]} {:keys [name symbol decimals]}]
|
||||||
(let [symbol-exists? (field-exists? db :symbol (keyword symbol))]
|
(let [symbol-exists? (field-exists? db :symbol (keyword symbol))]
|
||||||
{:db (update db
|
{:db (update db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
merge
|
merge
|
||||||
{:name name
|
{:name name
|
||||||
:symbol symbol
|
:symbol symbol
|
||||||
|
@ -62,15 +63,15 @@
|
||||||
:in-progress? nil})}))
|
:in-progress? nil})}))
|
||||||
|
|
||||||
(rf/defn not-supported
|
(rf/defn not-supported
|
||||||
{:events [:wallet.custom-token/not-supported]}
|
{:events [:wallet-legacy.custom-token/not-supported]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (assoc-in db [:wallet/custom-token-screen :in-progress?] nil)
|
{:db (assoc-in db [:wallet-legacy/custom-token-screen :in-progress?] nil)
|
||||||
:utils/show-popup {:content (i18n/label :t/contract-isnt-supported)}})
|
:utils/show-popup {:content (i18n/label :t/contract-isnt-supported)}})
|
||||||
|
|
||||||
(rf/defn add-custom-token
|
(rf/defn add-custom-token
|
||||||
{:events [:wallet.custom-token.ui/add-pressed]}
|
{:events [:wallet-legacy.custom-token.ui/add-pressed]}
|
||||||
[{:keys [db] :as cofx}]
|
[{:keys [db] :as cofx}]
|
||||||
(let [{:keys [contract name symbol decimals]} (get db :wallet/custom-token-screen)
|
(let [{:keys [contract name symbol decimals]} (get db :wallet-legacy/custom-token-screen)
|
||||||
symbol (keyword symbol)
|
symbol (keyword symbol)
|
||||||
new-token {:address contract
|
new-token {:address contract
|
||||||
:name name
|
:name name
|
||||||
|
@ -79,7 +80,7 @@
|
||||||
:color (rand-nth colors/chat-colors)}]
|
:color (rand-nth colors/chat-colors)}]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db
|
{:db (assoc-in db
|
||||||
[:wallet/all-tokens contract]
|
[:wallet-legacy/all-tokens contract]
|
||||||
(assoc new-token :custom? true))
|
(assoc new-token :custom? true))
|
||||||
:json-rpc/call [{:method "wallet_addCustomToken"
|
:json-rpc/call [{:method "wallet_addCustomToken"
|
||||||
:params [new-token]
|
:params [new-token]
|
||||||
|
@ -89,10 +90,10 @@
|
||||||
(navigation/navigate-back))))
|
(navigation/navigate-back))))
|
||||||
|
|
||||||
(rf/defn remove-custom-token
|
(rf/defn remove-custom-token
|
||||||
{:events [:wallet.custom-token.ui/remove-pressed]}
|
{:events [:wallet-legacy.custom-token.ui/remove-pressed]}
|
||||||
[{:keys [db] :as cofx} {:keys [address] :as token} navigate-back?]
|
[{:keys [db] :as cofx} {:keys [address] :as token} navigate-back?]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (update db :wallet/all-tokens dissoc address)
|
{:db (update db :wallet-legacy/all-tokens dissoc address)
|
||||||
:json-rpc/call [{:method "wallet_deleteCustomToken"
|
:json-rpc/call [{:method "wallet_deleteCustomToken"
|
||||||
:params [address]
|
:params [address]
|
||||||
:on-success #()}]}
|
:on-success #()}]}
|
||||||
|
@ -101,12 +102,12 @@
|
||||||
(navigation/navigate-back))))
|
(navigation/navigate-back))))
|
||||||
|
|
||||||
(rf/defn field-is-edited
|
(rf/defn field-is-edited
|
||||||
{:events [:wallet.custom-token.ui/field-is-edited]}
|
{:events [:wallet-legacy.custom-token.ui/field-is-edited]}
|
||||||
[{:keys [db] :as cofx} field-key value]
|
[{:keys [db] :as cofx} field-key value]
|
||||||
(case field-key
|
(case field-key
|
||||||
:contract (contract-address-is-changed cofx value)
|
:contract (contract-address-is-changed cofx value)
|
||||||
:name {:db (update db
|
:name {:db (update db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
merge
|
merge
|
||||||
{field-key
|
{field-key
|
||||||
value
|
value
|
||||||
|
@ -115,7 +116,7 @@
|
||||||
(i18n/label :t/you-already-have-an-asset
|
(i18n/label :t/you-already-have-an-asset
|
||||||
{:value value}))})}
|
{:value value}))})}
|
||||||
:symbol {:db (update db
|
:symbol {:db (update db
|
||||||
:wallet/custom-token-screen
|
:wallet-legacy/custom-token-screen
|
||||||
merge
|
merge
|
||||||
{field-key
|
{field-key
|
||||||
value
|
value
|
||||||
|
@ -123,5 +124,5 @@
|
||||||
(when (field-exists? db field-key (keyword value))
|
(when (field-exists? db field-key (keyword value))
|
||||||
(i18n/label :t/you-already-have-an-asset {:value value}))})}
|
(i18n/label :t/you-already-have-an-asset {:value value}))})}
|
||||||
:decimals {:db (assoc-in db
|
:decimals {:db (assoc-in db
|
||||||
[:wallet/custom-token-screen :decimals]
|
[:wallet-legacy/custom-token-screen :decimals]
|
||||||
value)}))
|
value)}))
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
|
|
||||||
(defn assoc-error-message
|
(defn assoc-error-message
|
||||||
[db error-type err]
|
[db error-type err]
|
||||||
(assoc-in db [:wallet :errors error-type] (or err :unknown-error)))
|
(assoc-in db [:wallet-legacy :errors error-type] (or err :unknown-error)))
|
||||||
|
|
||||||
(defn clear-error-message
|
(defn clear-error-message
|
||||||
[db error-type]
|
[db error-type]
|
||||||
(update-in db [:wallet :errors] dissoc error-type))
|
(update-in db [:wallet-legacy :errors] dissoc error-type))
|
||||||
|
|
||||||
(defn tokens-symbols
|
(defn tokens-symbols
|
||||||
[visible-token-symbols all-tokens]
|
[visible-token-symbols all-tokens]
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
(set (map :symbol (tokens/nfts-for all-tokens)))))
|
(set (map :symbol (tokens/nfts-for all-tokens)))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet/get-prices
|
:wallet-legacy/get-prices
|
||||||
(fn [{:keys [from to mainnet? success-event error-event]}]
|
(fn [{:keys [from to mainnet? success-event error-event]}]
|
||||||
(prices/get-prices from
|
(prices/get-prices from
|
||||||
to
|
to
|
||||||
|
@ -48,9 +48,9 @@
|
||||||
(assoc :prices-loading? false))})
|
(assoc :prices-loading? false))})
|
||||||
|
|
||||||
(rf/defn update-prices
|
(rf/defn update-prices
|
||||||
{:events [:wallet.ui/pull-to-refresh]}
|
{:events [:wallet-legacy.ui/pull-to-refresh]}
|
||||||
[{{:keys [network-status :wallet/all-tokens]
|
[{{:keys [network-status :wallet-legacy/all-tokens]
|
||||||
{:keys [currency :wallet/visible-tokens]
|
{:keys [currency :wallet-legacy/visible-tokens]
|
||||||
:or {currency :usd}}
|
:or {currency :usd}}
|
||||||
:profile/profile
|
:profile/profile
|
||||||
:as db}
|
:as db}
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
tokens (tokens-symbols assets all-tokens)
|
tokens (tokens-symbols assets all-tokens)
|
||||||
currency (get currency/currencies currency)]
|
currency (get currency/currencies currency)]
|
||||||
(when (not= network-status :offline)
|
(when (not= network-status :offline)
|
||||||
{:wallet/get-prices
|
{:wallet-legacy/get-prices
|
||||||
{:from (if mainnet?
|
{:from (if mainnet?
|
||||||
(conj tokens "ETH")
|
(conj tokens "ETH")
|
||||||
[(-> (tokens/native-currency (chain/get-current-network db))
|
[(-> (tokens/native-currency (chain/get-current-network db))
|
||||||
|
|
|
@ -25,15 +25,15 @@
|
||||||
(ens/address chain-id ens-name cb)))
|
(ens/address chain-id ens-name cb)))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:wallet.recipient/address-paste
|
:wallet-legacy.recipient/address-paste
|
||||||
(fn []
|
(fn []
|
||||||
(react/get-from-clipboard
|
(react/get-from-clipboard
|
||||||
#(re-frame/dispatch [:wallet.recipient/address-changed (string/trim %)]))))
|
#(re-frame/dispatch [:wallet-legacy.recipient/address-changed (string/trim %)]))))
|
||||||
|
|
||||||
(rf/defn address-paste-pressed
|
(rf/defn address-paste-pressed
|
||||||
{:events [:wallet.recipient/address-paste-pressed]}
|
{:events [:wallet-legacy.recipient/address-paste-pressed]}
|
||||||
[_]
|
[_]
|
||||||
{:wallet.recipient/address-paste nil})
|
{:wallet-legacy.recipient/address-paste nil})
|
||||||
|
|
||||||
(rf/defn set-recipient
|
(rf/defn set-recipient
|
||||||
{:events [::recipient-address-resolved]}
|
{:events [::recipient-address-resolved]}
|
||||||
|
@ -47,8 +47,8 @@
|
||||||
(if (eip55/valid-address-checksum? checksum)
|
(if (eip55/valid-address-checksum? checksum)
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet/recipient :searching] false)
|
(assoc-in [:wallet-legacy/recipient :searching] false)
|
||||||
(assoc-in [:wallet/recipient :resolved-address] checksum))}
|
(assoc-in [:wallet-legacy/recipient :resolved-address] checksum))}
|
||||||
(json-rpc/call
|
(json-rpc/call
|
||||||
{:method "eth_getCode"
|
{:method "eth_getCode"
|
||||||
:params [checksum "latest"]
|
:params [checksum "latest"]
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
:t/warning-sending-to-contract-descr)))
|
:t/warning-sending-to-contract-descr)))
|
||||||
:number-of-retries 3}))
|
:number-of-retries 3}))
|
||||||
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
{:ui/show-error (i18n/label :t/wallet-invalid-address-checksum {:data recipient})
|
||||||
:db (assoc-in db [:wallet/recipient :searching] false)}))
|
:db (assoc-in db [:wallet-legacy/recipient :searching] false)}))
|
||||||
(and (not (string/blank? recipient))
|
(and (not (string/blank? recipient))
|
||||||
(not (string/starts-with? recipient "0x"))
|
(not (string/starts-with? recipient "0x"))
|
||||||
(ens/valid-eth-name-prefix? recipient))
|
(ens/valid-eth-name-prefix? recipient))
|
||||||
|
@ -72,34 +72,34 @@
|
||||||
{:chain-id (chain/chain-id db)
|
{:chain-id (chain/chain-id db)
|
||||||
:ens-name ens-name
|
:ens-name ens-name
|
||||||
:cb #(re-frame/dispatch [::recipient-address-resolved % @resolve-last-id])}})
|
:cb #(re-frame/dispatch [::recipient-address-resolved % @resolve-last-id])}})
|
||||||
{:db (assoc-in db [:wallet/recipient :searching] false)}))
|
{:db (assoc-in db [:wallet-legacy/recipient :searching] false)}))
|
||||||
:else
|
:else
|
||||||
{:db (assoc-in db [:wallet/recipient :searching] false)}))))
|
{:db (assoc-in db [:wallet-legacy/recipient :searching] false)}))))
|
||||||
|
|
||||||
(rf/defn address-changed
|
(rf/defn address-changed
|
||||||
{:events [:wallet.recipient/address-changed]}
|
{:events [:wallet-legacy.recipient/address-changed]}
|
||||||
[{:keys [db] :as cofx} new-identity]
|
[{:keys [db] :as cofx} new-identity]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (update db
|
{:db (update db
|
||||||
:wallet/recipient assoc
|
:wallet-legacy/recipient assoc
|
||||||
:address new-identity
|
:address new-identity
|
||||||
:resolved-address nil
|
:resolved-address nil
|
||||||
:searching true)}
|
:searching true)}
|
||||||
(set-recipient new-identity nil)))
|
(set-recipient new-identity nil)))
|
||||||
|
|
||||||
(rf/defn recipient-modal-closed
|
(rf/defn recipient-modal-closed
|
||||||
{:events [:wallet/recipient-modal-closed]}
|
{:events [:wallet-legacy/recipient-modal-closed]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (dissoc db :wallet/recipient)})
|
{:db (dissoc db :wallet-legacy/recipient)})
|
||||||
|
|
||||||
(rf/defn add-favourite
|
(rf/defn add-favourite
|
||||||
{:events [:wallet/add-favourite]}
|
{:events [:wallet-legacy/add-favourite]}
|
||||||
[{:keys [db] :as cofx} address name]
|
[{:keys [db] :as cofx} address name]
|
||||||
(let [new-favourite {:address address
|
(let [new-favourite {:address address
|
||||||
:name (or name "")
|
:name (or name "")
|
||||||
:favourite true}]
|
:favourite true}]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:db (assoc-in db [:wallet/favourites address] new-favourite)
|
{:db (assoc-in db [:wallet-legacy/favourites address] new-favourite)
|
||||||
:json-rpc/call [{:method "wallet_addSavedAddress"
|
:json-rpc/call [{:method "wallet_addSavedAddress"
|
||||||
:params [new-favourite]
|
:params [new-favourite]
|
||||||
:on-success #()}]}
|
:on-success #()}]}
|
||||||
|
|
|
@ -9,44 +9,44 @@
|
||||||
;; selection of sink asset."
|
;; selection of sink asset."
|
||||||
(re-frame/reg-event-fx ::open-asset-selector-modal
|
(re-frame/reg-event-fx ::open-asset-selector-modal
|
||||||
(fn [{:keys [db]} [source?]]
|
(fn [{:keys [db]} [source?]]
|
||||||
{:db (assoc db :wallet/modal-selecting-source-token? source?)
|
{:db (assoc db :wallet-legacy/modal-selecting-source-token? source?)
|
||||||
:fx [[:dispatch [:open-modal :swap-asset-selector {}]]]}))
|
:fx [[:dispatch [:open-modal :swap-asset-selector {}]]]}))
|
||||||
|
|
||||||
(rf/defn set-from-token
|
(rf/defn set-from-token
|
||||||
{:events [::set-from-token]}
|
{:events [::set-from-token]}
|
||||||
[{:keys [db]} from-symbol]
|
[{:keys [db]} from-symbol]
|
||||||
(rf/merge {:db (assoc db :wallet/swap-from-token from-symbol)}
|
(rf/merge {:db (assoc db :wallet-legacy/swap-from-token from-symbol)}
|
||||||
(navigation/navigate-back)))
|
(navigation/navigate-back)))
|
||||||
|
|
||||||
(rf/defn set-to-token
|
(rf/defn set-to-token
|
||||||
{:events [::set-to-token]}
|
{:events [::set-to-token]}
|
||||||
[{:keys [db]} to-symbol]
|
[{:keys [db]} to-symbol]
|
||||||
(rf/merge {:db (assoc db :wallet/swap-to-token to-symbol)}
|
(rf/merge {:db (assoc db :wallet-legacy/swap-to-token to-symbol)}
|
||||||
(navigation/navigate-back)))
|
(navigation/navigate-back)))
|
||||||
|
|
||||||
(rf/defn set-from-token-amount
|
(rf/defn set-from-token-amount
|
||||||
[{:keys [db]} from-amount]
|
[{:keys [db]} from-amount]
|
||||||
{:db (assoc db :wallet/swap-from-token-amount from-amount)})
|
{:db (assoc db :wallet-legacy/swap-from-token-amount from-amount)})
|
||||||
|
|
||||||
(rf/defn set-max-from-token-amount
|
(rf/defn set-max-from-token-amount
|
||||||
[{:keys [db]} _]
|
[{:keys [db]} _]
|
||||||
{:db (assoc db :wallet/swap-from-token-amount 0)})
|
{:db (assoc db :wallet-legacy/swap-from-token-amount 0)})
|
||||||
|
|
||||||
(rf/defn switch-from-token-with-to
|
(rf/defn switch-from-token-with-to
|
||||||
{:events [::switch-from-token-with-to]}
|
{:events [::switch-from-token-with-to]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (assoc db
|
{:db (assoc db
|
||||||
:wallet/swap-from-token (:wallet/swap-to-token db)
|
:wallet-legacy/swap-from-token (:wallet-legacy/swap-to-token db)
|
||||||
:wallet/swap-to-token (:wallet/swap-from-token db))})
|
:wallet-legacy/swap-to-token (:wallet-legacy/swap-from-token db))})
|
||||||
|
|
||||||
(rf/defn set-advanced-mode
|
(rf/defn set-advanced-mode
|
||||||
{:events [::set-advanced-mode]}
|
{:events [::set-advanced-mode]}
|
||||||
[{:keys [db]} mode]
|
[{:keys [db]} mode]
|
||||||
{:db (assoc db :wallet/swap-advanced-mode? mode)})
|
{:db (assoc db :wallet-legacy/swap-advanced-mode? mode)})
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(->> re-frame.db/app-db
|
(->> re-frame.db/app-db
|
||||||
deref
|
deref
|
||||||
:wallet/all-tokens
|
:wallet-legacy/all-tokens
|
||||||
vals
|
vals
|
||||||
(map #(str (:name %) "-" (:symbol %)))))
|
(map #(str (:name %) "-" (:symbol %)))))
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
|
|
||||||
(def default-multiaccount
|
(def default-multiaccount
|
||||||
{:preview-privacy? blank-preview?
|
{:preview-privacy? blank-preview?
|
||||||
:wallet/visible-tokens {:mainnet #{:SNT}}
|
:wallet-legacy/visible-tokens {:mainnet #{:SNT}}
|
||||||
:currency :usd
|
:currency :usd
|
||||||
:appearance 0
|
:appearance 0
|
||||||
:profile-pictures-show-to 2
|
:profile-pictures-show-to 2
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
|
|
||||||
(defn default-visible-tokens
|
(defn default-visible-tokens
|
||||||
[chain]
|
[chain]
|
||||||
(get-in default-multiaccount [:wallet/visible-tokens chain]))
|
(get-in default-multiaccount [:wallet-legacy/visible-tokens chain]))
|
||||||
|
|
||||||
(def mainnet-networks
|
(def mainnet-networks
|
||||||
[{:id "mainnet_rpc"
|
[{:id "mainnet_rpc"
|
||||||
|
|
|
@ -103,12 +103,12 @@
|
||||||
network-id (str (get-in networks
|
network-id (str (get-in networks
|
||||||
[current-network :config :NetworkId]))]
|
[current-network :config :NetworkId]))]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
(cond-> {:wallet/initialize-transactions-management-enabled nil
|
(cond-> {:wallet-legacy/initialize-transactions-management-enabled nil
|
||||||
:wallet/initialize-wallet
|
:wallet-legacy/initialize-wallet
|
||||||
[network-id
|
[network-id
|
||||||
current-network-config
|
current-network-config
|
||||||
(fn [accounts tokens custom-tokens favourites]
|
(fn [accounts tokens custom-tokens favourites]
|
||||||
(re-frame/dispatch [:wallet/initialize-wallet
|
(re-frame/dispatch [:wallet-legacy/initialize-wallet
|
||||||
accounts tokens custom-tokens favourites]))]
|
accounts tokens custom-tokens favourites]))]
|
||||||
:check-eip1559-activation {:network-id network-id}
|
:check-eip1559-activation {:network-id network-id}
|
||||||
:chat/open-last-chat (get-in db [:profile/profile :key-uid])}
|
:chat/open-last-chat (get-in db [:profile/profile :key-uid])}
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
{:db (dissoc db :profile/login)
|
{:db (dissoc db :profile/login)
|
||||||
:dispatch-n [[:logging/initialize-web3-client-version]
|
:dispatch-n [[:logging/initialize-web3-client-version]
|
||||||
(when (and new-account? (not recovered-account?))
|
(when (and new-account? (not recovered-account?))
|
||||||
[:wallet/set-initial-blocks-range])
|
[:wallet-legacy/set-initial-blocks-range])
|
||||||
[:ens/update-usernames ensUsernames]]}
|
[:ens/update-usernames ensUsernames]]}
|
||||||
(login-existing-profile settings account))))
|
(login-existing-profile settings account))))
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
(:require [utils.re-frame :as rf]))
|
(:require [utils.re-frame :as rf]))
|
||||||
|
|
||||||
(rf/defn scan-address-success
|
(rf/defn scan-address-success
|
||||||
{:events [:wallet-2/scan-address-success]}
|
{:events [:wallet/scan-address-success]}
|
||||||
[{:keys [db]} address]
|
[{:keys [db]} address]
|
||||||
{:db (assoc db :wallet-2/scanned-address address)})
|
{:db (assoc db :wallet/scanned-address address)})
|
||||||
|
|
||||||
(rf/defn clean-scanned-address
|
(rf/defn clean-scanned-address
|
||||||
{:events [:wallet-2/clean-scanned-address]}
|
{:events [:wallet/clean-scanned-address]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (dissoc db :wallet-2/scanned-address)})
|
{:db (dissoc db :wallet/scanned-address)})
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
(deftest scan-address-success
|
(deftest scan-address-success
|
||||||
(let [db {}]
|
(let [db {}]
|
||||||
(testing "scan-address-success"
|
(testing "scan-address-success"
|
||||||
(let [expected-db {:wallet-2/scanned-address address}
|
(let [expected-db {:wallet/scanned-address address}
|
||||||
effects (events/scan-address-success {:db db} address)
|
effects (events/scan-address-success {:db db} address)
|
||||||
result-db (:db effects)]
|
result-db (:db effects)]
|
||||||
(is (= result-db expected-db))))))
|
(is (= result-db expected-db))))))
|
||||||
|
|
||||||
(deftest clean-scanned-address
|
(deftest clean-scanned-address
|
||||||
(let [db {:wallet-2/scanned-address address}]
|
(let [db {:wallet/scanned-address address}]
|
||||||
(testing "clean-scanned-address"
|
(testing "clean-scanned-address"
|
||||||
(let [expected-db {}
|
(let [expected-db {}
|
||||||
effects (events/clean-scanned-address {:db db})
|
effects (events/clean-scanned-address {:db db})
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
:subtitle (i18n/label :t/scan-an-account-qr-code)
|
:subtitle (i18n/label :t/scan-an-account-qr-code)
|
||||||
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
|
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
|
||||||
:validate-fn #(contains-address? %)
|
:validate-fn #(contains-address? %)
|
||||||
:on-success-scan #(debounce/debounce-and-dispatch [:wallet-2/scan-address-success
|
:on-success-scan #(debounce/debounce-and-dispatch [:wallet/scan-address-success
|
||||||
(extract-address %)]
|
(extract-address %)]
|
||||||
300)}])
|
300)}])
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
(reset! timer (js/setTimeout #(reset! valid-ens-or-address? true)
|
(reset! timer (js/setTimeout #(reset! valid-ens-or-address? true)
|
||||||
2000)))]
|
2000)))]
|
||||||
(fn []
|
(fn []
|
||||||
(let [scanned-address (rf/sub [:wallet-2/scanned-address])]
|
(let [scanned-address (rf/sub [:wallet/scanned-address])]
|
||||||
[quo/address-input
|
[quo/address-input
|
||||||
{:on-scan #(rf/dispatch [:open-modal :scan-address])
|
{:on-scan #(rf/dispatch [:open-modal :scan-address])
|
||||||
:ens-regex constants/regx-ens
|
:ens-regex constants/regx-ens
|
||||||
|
@ -61,9 +61,9 @@
|
||||||
:on-detect-address on-detect-address-or-ens
|
:on-detect-address on-detect-address-or-ens
|
||||||
:on-change-text (fn [text]
|
:on-change-text (fn [text]
|
||||||
(when-not (= scanned-address text)
|
(when-not (= scanned-address text)
|
||||||
(rf/dispatch [:wallet-2/clean-scanned-address]))
|
(rf/dispatch [:wallet/clean-scanned-address]))
|
||||||
(reset! input-value text))
|
(reset! input-value text))
|
||||||
:on-clear #(rf/dispatch [:wallet-2/clean-scanned-address])
|
:on-clear #(rf/dispatch [:wallet/clean-scanned-address])
|
||||||
:valid-ens-or-address? @valid-ens-or-address?}]))))
|
:valid-ens-or-address? @valid-ens-or-address?}]))))
|
||||||
|
|
||||||
(defn- f-view-internal
|
(defn- f-view-internal
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
on-close #(rf/dispatch [:dismiss-modal :wallet-select-address])
|
on-close #(rf/dispatch [:dismiss-modal :wallet-select-address])
|
||||||
on-change-tab #(reset! selected-tab %)]
|
on-change-tab #(reset! selected-tab %)]
|
||||||
(fn []
|
(fn []
|
||||||
(rn/use-effect (fn [] #(rf/dispatch [:wallet-2/clean-scanned-address])))
|
(rn/use-effect (fn [] #(rf/dispatch [:wallet/clean-scanned-address])))
|
||||||
[rn/scroll-view
|
[rn/scroll-view
|
||||||
{:content-container-style (style/container margin-top)
|
{:content-container-style (style/container margin-top)
|
||||||
:keyboard-should-persist-taps :never
|
:keyboard-should-persist-taps :never
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
:sync-state :done
|
:sync-state :done
|
||||||
:link-previews-whitelist []
|
:link-previews-whitelist []
|
||||||
:app-state "active"
|
:app-state "active"
|
||||||
:wallet wallet.db/default-wallet
|
:wallet-legacy wallet.db/default-wallet
|
||||||
:wallet/all-tokens {}
|
:wallet-legacy/all-tokens {}
|
||||||
:peers-count 0
|
:peers-count 0
|
||||||
:node-info {}
|
:node-info {}
|
||||||
:peers-summary []
|
:peers-summary []
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:contacts/active-with-ens-names
|
:contacts/active-with-ens-names
|
||||||
:<- [:contacts/active]
|
:<- [:contacts/active]
|
||||||
:<- [:search/recipient-filter]
|
:<- [:wallet-legacy/search-recipient-filter]
|
||||||
(fn [[contacts search-filter]]
|
(fn [[contacts search-filter]]
|
||||||
(let [contacts (filter :ens-verified contacts)]
|
(let [contacts (filter :ens-verified contacts)]
|
||||||
(if (string/blank? search-filter)
|
(if (string/blank? search-filter)
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
(get-in animations [type item-id :delete-swiped])))
|
(get-in animations [type item-id :delete-swiped])))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:search/recipient-filter
|
:wallet-legacy/search-recipient-filter
|
||||||
:<- [:ui/search]
|
:<- [:ui/search]
|
||||||
(fn [search]
|
(fn [search]
|
||||||
(get search :recipient-filter)))
|
(get search :recipient-filter)))
|
||||||
|
@ -158,12 +158,6 @@
|
||||||
(fn [search]
|
(fn [search]
|
||||||
(get search :currency-filter)))
|
(get search :currency-filter)))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
|
||||||
:search/token-filter
|
|
||||||
:<- [:ui/search]
|
|
||||||
(fn [search]
|
|
||||||
(get search :token-filter)))
|
|
||||||
|
|
||||||
(defn- node-version
|
(defn- node-version
|
||||||
[web3-node-version]
|
[web3-node-version]
|
||||||
(or web3-node-version "N/A"))
|
(or web3-node-version "N/A"))
|
||||||
|
|
|
@ -190,8 +190,8 @@
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:accounts-for-recipient
|
:accounts-for-recipient
|
||||||
:<- [:multiaccount/visible-accounts]
|
:<- [:multiaccount/visible-accounts]
|
||||||
:<- [:wallet/prepare-transaction]
|
:<- [:wallet-legacy/prepare-transaction]
|
||||||
:<- [:search/recipient-filter]
|
:<- [:wallet-legacy/search-recipient-filter]
|
||||||
(fn [[accounts {:keys [from]} search-filter]]
|
(fn [[accounts {:keys [from]} search-filter]]
|
||||||
(let [accounts (remove #(= (:address %) (:address from)) accounts)]
|
(let [accounts (remove #(= (:address %) (:address from)) accounts)]
|
||||||
(if (string/blank? search-filter)
|
(if (string/blank? search-filter)
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
;;bottom sheet
|
;;bottom sheet
|
||||||
(reg-root-key-sub :bottom-sheet :bottom-sheet)
|
(reg-root-key-sub :bottom-sheet :bottom-sheet)
|
||||||
|
|
||||||
; media-server
|
;;media-server
|
||||||
(reg-root-key-sub :mediaserver/port :mediaserver/port)
|
(reg-root-key-sub :mediaserver/port :mediaserver/port)
|
||||||
|
|
||||||
;; push notifications
|
;;push notifications
|
||||||
(reg-root-key-sub :push-notifications/preferences :push-notifications/preferences)
|
(reg-root-key-sub :push-notifications/preferences :push-notifications/preferences)
|
||||||
|
|
||||||
;;general
|
;;general
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
(reg-root-key-sub :multiaccount/reset-password-form-vals :multiaccount/reset-password-form-vals)
|
(reg-root-key-sub :multiaccount/reset-password-form-vals :multiaccount/reset-password-form-vals)
|
||||||
(reg-root-key-sub :multiaccount/reset-password-errors :multiaccount/reset-password-errors)
|
(reg-root-key-sub :multiaccount/reset-password-errors :multiaccount/reset-password-errors)
|
||||||
(reg-root-key-sub :multiaccount/resetting-password? :multiaccount/resetting-password?)
|
(reg-root-key-sub :multiaccount/resetting-password? :multiaccount/resetting-password?)
|
||||||
;; delete profile
|
;;delete profile
|
||||||
(reg-root-key-sub :delete-profile/error :delete-profile/error)
|
(reg-root-key-sub :delete-profile/error :delete-profile/error)
|
||||||
(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?)
|
(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?)
|
||||||
|
|
||||||
|
@ -127,119 +127,9 @@
|
||||||
(reg-root-key-sub :messages/pin-messages :pin-messages)
|
(reg-root-key-sub :messages/pin-messages :pin-messages)
|
||||||
(reg-root-key-sub :messages/pin-modal :pin-modal)
|
(reg-root-key-sub :messages/pin-modal :pin-modal)
|
||||||
|
|
||||||
; Messages home view -> tabs
|
|
||||||
(reg-root-key-sub :messages-home/selected-tab :messages-home/selected-tab)
|
(reg-root-key-sub :messages-home/selected-tab :messages-home/selected-tab)
|
||||||
|
|
||||||
;;browser
|
;;communities
|
||||||
(reg-root-key-sub :browsers :browser/browsers)
|
|
||||||
(reg-root-key-sub :browser/options :browser/options)
|
|
||||||
(reg-root-key-sub :dapps/permissions :dapps/permissions)
|
|
||||||
(reg-root-key-sub :bookmarks :bookmarks/bookmarks)
|
|
||||||
(reg-root-key-sub :browser/screen-id :browser/screen-id)
|
|
||||||
|
|
||||||
;;stickers
|
|
||||||
(reg-root-key-sub :stickers/selected-pack :stickers/selected-pack)
|
|
||||||
(reg-root-key-sub :stickers/packs :stickers/packs)
|
|
||||||
(reg-root-key-sub :stickers/recent-stickers :stickers/recent-stickers)
|
|
||||||
|
|
||||||
;;mailserver
|
|
||||||
(reg-root-key-sub :mailserver/current-id :mailserver/current-id)
|
|
||||||
(reg-root-key-sub :mailserver/mailservers :mailserver/mailservers)
|
|
||||||
(reg-root-key-sub :mailserver.edit/mailserver :mailserver.edit/mailserver)
|
|
||||||
(reg-root-key-sub :mailserver/state :mailserver/state)
|
|
||||||
(reg-root-key-sub :mailserver/pending-requests :mailserver/pending-requests)
|
|
||||||
(reg-root-key-sub :mailserver/request-error? :mailserver/request-error)
|
|
||||||
(reg-root-key-sub :mailserver/fetching-gaps-in-progress :mailserver/fetching-gaps-in-progress)
|
|
||||||
|
|
||||||
;;contacts
|
|
||||||
(reg-root-key-sub :contacts/contacts-raw :contacts/contacts)
|
|
||||||
(reg-root-key-sub :contacts/current-contact-identity :contacts/identity)
|
|
||||||
(reg-root-key-sub :contacts/current-contact-ens-name :contacts/ens-name)
|
|
||||||
(reg-root-key-sub :contacts/new-identity :contacts/new-identity)
|
|
||||||
(reg-root-key-sub :group/selected-contacts :group/selected-contacts)
|
|
||||||
(reg-root-key-sub :contacts/search-query :contacts/search-query)
|
|
||||||
|
|
||||||
;;wallet
|
|
||||||
(reg-root-key-sub :wallet :wallet)
|
|
||||||
(reg-root-key-sub :prices :prices)
|
|
||||||
(reg-root-key-sub :prices-loading? :prices-loading?)
|
|
||||||
(reg-root-key-sub :wallet.transactions :wallet.transactions)
|
|
||||||
(reg-root-key-sub :wallet/custom-token-screen :wallet/custom-token-screen)
|
|
||||||
(reg-root-key-sub :wallet/prepare-transaction :wallet/prepare-transaction)
|
|
||||||
(reg-root-key-sub :wallet-service/manual-setting :wallet-service/manual-setting)
|
|
||||||
(reg-root-key-sub :wallet/recipient :wallet/recipient)
|
|
||||||
(reg-root-key-sub :wallet/favourites :wallet/favourites)
|
|
||||||
(reg-root-key-sub :wallet/refreshing-history? :wallet/refreshing-history?)
|
|
||||||
(reg-root-key-sub :wallet/fetching-error :wallet/fetching-error)
|
|
||||||
(reg-root-key-sub :wallet/non-archival-node :wallet/non-archival-node)
|
|
||||||
(reg-root-key-sub :wallet/current-base-fee :wallet/current-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/slow-base-fee :wallet/slow-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/normal-base-fee :wallet/normal-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/fast-base-fee :wallet/fast-base-fee)
|
|
||||||
(reg-root-key-sub :wallet/current-priority-fee :wallet/current-priority-fee)
|
|
||||||
(reg-root-key-sub :wallet/transactions-management-enabled? :wallet/transactions-management-enabled?)
|
|
||||||
(reg-root-key-sub :wallet/all-tokens :wallet/all-tokens)
|
|
||||||
(reg-root-key-sub :wallet/collectible-collections :wallet/collectible-collections)
|
|
||||||
(reg-root-key-sub :wallet/fetching-collection-assets :wallet/fetching-collection-assets)
|
|
||||||
(reg-root-key-sub :wallet/collectible-assets :wallet/collectible-assets)
|
|
||||||
(reg-root-key-sub :wallet/selected-collectible :wallet/selected-collectible)
|
|
||||||
(reg-root-key-sub :wallet/modal-selecting-source-token? :wallet/modal-selecting-source-token?)
|
|
||||||
(reg-root-key-sub :wallet/swap-from-token :wallet/swap-from-token)
|
|
||||||
(reg-root-key-sub :wallet/swap-to-token :wallet/swap-to-token)
|
|
||||||
(reg-root-key-sub :wallet/swap-from-token-amount :wallet/swap-from-token-amount)
|
|
||||||
(reg-root-key-sub :wallet/swap-to-token-amount :wallet/swap-to-token-amount)
|
|
||||||
(reg-root-key-sub :wallet/swap-advanced-mode? :wallet/swap-advanced-mode?)
|
|
||||||
|
|
||||||
;; Wallet 2
|
|
||||||
(reg-root-key-sub :wallet-2/scanned-address :wallet-2/scanned-address)
|
|
||||||
|
|
||||||
;;; Link previews
|
|
||||||
|
|
||||||
(reg-root-key-sub :link-previews-whitelist :link-previews-whitelist)
|
|
||||||
(reg-root-key-sub :chat/link-previews :chat/link-previews)
|
|
||||||
|
|
||||||
;;commands
|
|
||||||
(reg-root-key-sub :commands/select-account :commands/select-account)
|
|
||||||
|
|
||||||
;;ethereum
|
|
||||||
(reg-root-key-sub :ethereum/current-block :ethereum/current-block)
|
|
||||||
|
|
||||||
;;ens
|
|
||||||
(reg-root-key-sub :ens/registration :ens/registration)
|
|
||||||
(reg-root-key-sub :ens/registrations :ens/registrations)
|
|
||||||
(reg-root-key-sub :ens/names :ens/names)
|
|
||||||
|
|
||||||
;;signing
|
|
||||||
(reg-root-key-sub :signing/sign :signing/sign)
|
|
||||||
(reg-root-key-sub :signing/tx :signing/tx)
|
|
||||||
(reg-root-key-sub :signing/edit-fee :signing/edit-fee)
|
|
||||||
|
|
||||||
;;intro-wizard
|
|
||||||
(reg-root-key-sub :intro-wizard-state :intro-wizard)
|
|
||||||
|
|
||||||
(reg-root-key-sub :toasts :toasts)
|
|
||||||
(reg-root-key-sub :popover/popover :popover/popover)
|
|
||||||
(reg-root-key-sub :visibility-status-popover/popover :visibility-status-popover/popover)
|
|
||||||
(reg-root-key-sub :add-account :add-account)
|
|
||||||
|
|
||||||
(reg-root-key-sub :keycard :keycard)
|
|
||||||
|
|
||||||
(reg-root-key-sub :auth-method :auth-method)
|
|
||||||
|
|
||||||
;; keycard
|
|
||||||
(reg-root-key-sub :keycard/banner-hidden :keycard/banner-hidden)
|
|
||||||
|
|
||||||
;; delete profile
|
|
||||||
(reg-root-key-sub :delete-profile/error :delete-profile/error)
|
|
||||||
(reg-root-key-sub :delete-profile/keep-keys-on-keycard? :delete-profile/keep-keys-on-keycard?)
|
|
||||||
|
|
||||||
;; push notifications
|
|
||||||
(reg-root-key-sub :push-notifications/servers :push-notifications/servers)
|
|
||||||
(reg-root-key-sub :push-notifications/preferences :push-notifications/preferences)
|
|
||||||
|
|
||||||
(reg-root-key-sub :buy-crypto/on-ramps :buy-crypto/on-ramps)
|
|
||||||
|
|
||||||
;; communities
|
|
||||||
(reg-root-key-sub :communities :communities)
|
(reg-root-key-sub :communities :communities)
|
||||||
(reg-root-key-sub :communities/create :communities/create)
|
(reg-root-key-sub :communities/create :communities/create)
|
||||||
(reg-root-key-sub :communities/create-channel :communities/create-channel)
|
(reg-root-key-sub :communities/create-channel :communities/create-channel)
|
||||||
|
@ -251,5 +141,8 @@
|
||||||
(reg-root-key-sub :communities/selected-tab :communities/selected-tab)
|
(reg-root-key-sub :communities/selected-tab :communities/selected-tab)
|
||||||
(reg-root-key-sub :contract-communities :contract-communities)
|
(reg-root-key-sub :contract-communities :contract-communities)
|
||||||
|
|
||||||
;; activity center
|
;;activity center
|
||||||
(reg-root-key-sub :activity-center :activity-center)
|
(reg-root-key-sub :activity-center :activity-center)
|
||||||
|
|
||||||
|
;;wallet
|
||||||
|
(reg-root-key-sub :wallet/scanned-address :wallet/scanned-address)
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
```clojure
|
```clojure
|
||||||
(require '[test-helpers.unit :as h])
|
(require '[test-helpers.unit :as h])
|
||||||
|
|
||||||
(h/deftest-sub :wallet/sorted-tokens
|
(h/deftest-sub :wallet-legacy/sorted-tokens
|
||||||
[sub-name]
|
[sub-name]
|
||||||
(testing \"sorts tokens by name, lowercased\"
|
(testing \"sorts tokens by name, lowercased\"
|
||||||
;; Arrange
|
;; Arrange
|
||||||
|
|
Loading…
Reference in New Issue