Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c939412b8e | ||
|
|
3cbc7c1730 | ||
|
|
a4db8d6995 | ||
|
|
6417221c6d | ||
|
|
fcdfc890e8 | ||
|
|
bda7d1c58d | ||
|
|
bf1b039df5 | ||
|
|
b55e4208e5 | ||
|
|
07005f8ad5 | ||
|
|
3ab345563c |
@@ -12,13 +12,16 @@
|
||||
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/clean-routes-calculation]))
|
||||
[rn/view {:style style/bridge-send-wrapper}
|
||||
[input-amount/view
|
||||
{:current-screen-id :screen/wallet.bridge-input-amount
|
||||
:button-one-label (i18n/label :t/review-bridge)
|
||||
:button-one-props {:icon-left :i/bridge}
|
||||
:on-confirm (fn [amount]
|
||||
(rf/dispatch [:wallet/set-token-amount-to-bridge
|
||||
{:amount amount
|
||||
:stack-id :screen/wallet.bridge-input-amount}]))
|
||||
:on-navigate-back (fn []
|
||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||
(rf/dispatch [:wallet/clean-send-amount]))}]])
|
||||
{:current-screen-id :screen/wallet.bridge-input-amount
|
||||
:button-one-label (i18n/label :t/review-bridge)
|
||||
:button-one-props {:icon-left :i/bridge}
|
||||
:enabled-from-chain-ids (rf/sub
|
||||
[:wallet/bridge-from-chain-ids])
|
||||
:from-enabled-networks (rf/sub [:wallet/bridge-from-networks])
|
||||
:on-confirm (fn [amount]
|
||||
(rf/dispatch [:wallet/set-token-amount-to-bridge
|
||||
{:amount amount
|
||||
:stack-id :screen/wallet.bridge-input-amount}]))
|
||||
:on-navigate-back (fn []
|
||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||
(rf/dispatch [:wallet/clean-send-amount]))}]])
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns status-im.contexts.wallet.common.token-value.view
|
||||
(:require [quo.core :as quo]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.contexts.wallet.sheets.buy-token.view :as buy-token]
|
||||
[status-im.feature-flags :as ff]
|
||||
[utils.i18n :as i18n]
|
||||
@@ -44,11 +43,18 @@
|
||||
(rf/dispatch [:wallet/bridge-select-token bridge-params]))})
|
||||
|
||||
(defn- action-swap
|
||||
[]
|
||||
{:icon :i/swap
|
||||
:accessibility-label :swap
|
||||
:label (i18n/label :t/swap)
|
||||
:on-press #(not-implemented/alert)})
|
||||
[token-symbol]
|
||||
(let [current-viewing-account-address (rf/sub [:wallet/current-viewing-account-address])
|
||||
account-address (or current-viewing-account-address
|
||||
(:address (first (rf/sub [:wallet/operable-accounts]))))
|
||||
token (rf/sub [:wallet/token-with-networks token-symbol
|
||||
account-address])]
|
||||
{:icon :i/swap
|
||||
:accessibility-label :swap
|
||||
:label (i18n/label :t/swap)
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(rf/dispatch [:wallet.swap/start-with-token token]))}))
|
||||
|
||||
(defn- action-manage-tokens
|
||||
[watch-only?]
|
||||
@@ -90,7 +96,7 @@
|
||||
(when (seq token-owners)
|
||||
(action-send send-or-bridge-params entry-point))
|
||||
(action-receive selected-account?)
|
||||
(when (ff/enabled? ::ff/wallet.swap) (action-swap))
|
||||
(when (ff/enabled? ::ff/wallet.swap) (action-swap token-symbol))
|
||||
(when (seq (seq token-owners))
|
||||
(action-bridge send-or-bridge-params))]))]]))
|
||||
|
||||
|
||||
@@ -146,6 +146,8 @@
|
||||
button-one-props :button-one-props
|
||||
current-screen-id :current-screen-id
|
||||
initial-crypto-currency? :initial-crypto-currency?
|
||||
enabled-from-chain-ids :enabled-from-chain-ids
|
||||
from-enabled-networks :from-enabled-networks
|
||||
:or {initial-crypto-currency? true}}]
|
||||
(let [_ (rn/dismiss-keyboard!)
|
||||
bottom (safe-area/get-bottom)
|
||||
@@ -164,9 +166,6 @@
|
||||
token-decimals :decimals
|
||||
:as
|
||||
token} (rf/sub [:wallet/wallet-send-token])
|
||||
send-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
|
||||
enabled-from-chain-ids (rf/sub
|
||||
[:wallet/wallet-send-enabled-from-chain-ids])
|
||||
send-from-locked-amounts (rf/sub [:wallet/wallet-send-from-locked-amounts])
|
||||
{token-balance :total-balance
|
||||
available-balance :available-balance
|
||||
@@ -355,7 +354,7 @@
|
||||
:currency-symbol currency-symbol
|
||||
:crypto-decimals (min token-decimals 6)
|
||||
:error? (controlled-input/input-error input-state)
|
||||
:networks (seq send-enabled-networks)
|
||||
:networks (seq from-enabled-networks)
|
||||
:title (i18n/label
|
||||
:t/send-limit
|
||||
{:limit (if crypto-currency?
|
||||
@@ -429,3 +428,4 @@
|
||||
(set-just-toggled-mode? false)
|
||||
(set-input-state controlled-input/delete-all)
|
||||
(rf/dispatch [:wallet/clean-suggested-routes]))}]]))
|
||||
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
(defn view
|
||||
[]
|
||||
[input-amount/view
|
||||
{:current-screen-id :screen/wallet.send-input-amount
|
||||
:button-one-label (i18n/label :t/review-send)
|
||||
:on-navigate-back (fn []
|
||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||
(rf/dispatch [:wallet/clean-from-locked-amounts])
|
||||
(rf/dispatch [:wallet/clean-send-amount]))}])
|
||||
{:current-screen-id :screen/wallet.send-input-amount
|
||||
:button-one-label (i18n/label :t/review-send)
|
||||
:enabled-from-chain-ids (rf/sub
|
||||
[:wallet/wallet-send-enabled-from-chain-ids])
|
||||
:from-enabled-networks (rf/sub [:wallet/wallet-send-enabled-networks])
|
||||
:on-navigate-back (fn []
|
||||
(rf/dispatch [:wallet/clean-disabled-from-networks])
|
||||
(rf/dispatch [:wallet/clean-from-locked-amounts])
|
||||
(rf/dispatch [:wallet/clean-send-amount]))}])
|
||||
|
||||
@@ -1,18 +1,33 @@
|
||||
(ns status-im.contexts.wallet.swap.events
|
||||
(:require [re-frame.core :as rf]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.communities.utils :as utils]
|
||||
[status-im.contexts.wallet.sheets.network-selection.view :as network-selection]
|
||||
[utils.number]))
|
||||
|
||||
(rf/reg-event-fx :wallet.swap/start
|
||||
(fn [{:keys [_db]}]
|
||||
(fn [{:keys [_]}]
|
||||
{:fx [[:dispatch [:open-modal :screen/wallet.swap-select-asset-to-pay]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet.swap/start-with-token
|
||||
(fn [{:keys [db]} [token]]
|
||||
(let [current-address (get-in db [:wallet :current-viewing-account-address])
|
||||
address (:address (first (utils/sorted-operable-non-watch-only-accounts db)))
|
||||
token-networks (:networks token)]
|
||||
{:fx [(when-not current-address
|
||||
[:dispatch
|
||||
[:wallet/switch-current-viewing-account address]])
|
||||
[:dispatch
|
||||
[:wallet.swap/select-asset-to-pay
|
||||
{:token token
|
||||
:network (when (= count token-networks)
|
||||
(first token-networks))}]]]})))
|
||||
|
||||
(rf/reg-event-fx :wallet.swap/select-asset-to-pay
|
||||
(fn [{:keys [db]} [{:keys [token network]}]]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :swap :asset-to-pay] token)
|
||||
(assoc-in [:wallet :ui :swap :network] network))
|
||||
(cond-> network (assoc-in [:wallet :ui :swap :network] network)))
|
||||
:fx (if network
|
||||
[[:dispatch [:navigate-to :screen/wallet.swap-propasal]]
|
||||
[:dispatch [:wallet.swap/set-default-slippage]]]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
(ns status-im.contexts.wallet.swap.swap-proposal.style)
|
||||
|
||||
(def container
|
||||
{:flex 1})
|
||||
{:flex 1
|
||||
:padding 16
|
||||
:gap 16})
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
[]
|
||||
(let [max-slippage (rf/sub [:wallet/swap-max-slippage])]
|
||||
[rn/view {:style style/container}
|
||||
[quo/button
|
||||
{:on-press #(rf/dispatch [:navigate-back])
|
||||
:type :grey}
|
||||
"Back"]
|
||||
[quo/button
|
||||
{:on-press #(rf/dispatch [:show-bottom-sheet
|
||||
{:content slippage-settings/view}])}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[clojure.string :as string]
|
||||
[native-module.core :as native-module]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.common.utils.networks :as networks]
|
||||
[utils.security.core :as security]
|
||||
[utils.string]
|
||||
[utils.transforms :as transforms]))
|
||||
@@ -101,7 +102,7 @@
|
||||
networks (get-in db [:wallet :networks (if test-mode? :test :prod)])]
|
||||
(mapv #(-> % :chain-id) networks)))
|
||||
|
||||
(defn add-full-testnet-name
|
||||
(defn- add-full-testnet-name
|
||||
"Updates the `:full-name` key with the full testnet name if using testnet `:chain-id`.\n
|
||||
e.g. `{:full-name \"Mainnet\"}` -> `{:full-name \"Mainnet Sepolia\"`}`"
|
||||
[network]
|
||||
@@ -112,6 +113,12 @@
|
||||
constants/goerli-chain-ids (add-testnet-name constants/goerli-full-name)
|
||||
network)))
|
||||
|
||||
(defn chain-id->network-details
|
||||
[chain-id]
|
||||
(-> chain-id
|
||||
(networks/get-network-details)
|
||||
(add-full-testnet-name)))
|
||||
|
||||
(defn event-should-be-handled?
|
||||
[db {:keys [topic]}]
|
||||
(some #(= topic %)
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
[quo/page-nav
|
||||
{:icon-name :i/close
|
||||
:background :blur
|
||||
:on-press #(do (rf/dispatch [:navigate-back])
|
||||
:on-press #(do (rf/dispatch [:wallet-connect/dismiss-request-modal])
|
||||
(rf/dispatch [:wallet-connect/reject-session-request]))
|
||||
:accessibility-label accessibility-label}])
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
[re-frame.core :as rf]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.wallet-connect.core :as wallet-connect-core]
|
||||
[status-im.contexts.wallet.wallet-connect.signing :as signing]
|
||||
[status-im.contexts.wallet.wallet-connect.transactions :as transactions]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.transforms :as transforms]))
|
||||
|
||||
(rf/reg-event-fx
|
||||
@@ -122,15 +124,30 @@
|
||||
:wallet-connect/process-sign-typed
|
||||
(fn [{:keys [db]}]
|
||||
(let [[address raw-data] (wallet-connect-core/get-db-current-request-params db)
|
||||
parsed-data (try (-> raw-data
|
||||
transforms/js-parse
|
||||
parsed-raw-data (transforms/js-parse raw-data)
|
||||
session-chain-id (-> (wallet-connect-core/get-db-current-request-event db)
|
||||
(get-in [:params :chainId])
|
||||
wallet-connect-core/eip155->chain-id)
|
||||
data-chain-id (-> parsed-raw-data
|
||||
transforms/js->clj
|
||||
signing/typed-data-chain-id)
|
||||
parsed-data (try (-> parsed-raw-data
|
||||
(transforms/js-dissoc :types :primaryType)
|
||||
(transforms/js-stringify 2))
|
||||
(catch js/Error _ nil))]
|
||||
(if (nil? parsed-data)
|
||||
(cond
|
||||
(nil? parsed-data)
|
||||
{:fx [[:dispatch
|
||||
[:wallet-connect/on-processing-error
|
||||
(ex-info "Failed to parse JSON typed data" {:data raw-data})]]]}
|
||||
|
||||
(not= session-chain-id data-chain-id)
|
||||
{:fx [[:dispatch
|
||||
[:wallet-connect/wrong-typed-data-chain-id
|
||||
{:expected-chain-id session-chain-id
|
||||
:wrong-chain-id data-chain-id}]]]}
|
||||
|
||||
:else
|
||||
{:db (update-in db
|
||||
[:wallet-connect/current-request]
|
||||
assoc
|
||||
@@ -139,19 +156,39 @@
|
||||
:raw-data raw-data)
|
||||
:fx [[:dispatch [:wallet-connect/show-request-modal]]]}))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/wrong-typed-data-chain-id
|
||||
(fn [_ [{:keys [expected-chain-id wrong-chain-id]}]]
|
||||
(let [wrong-network-name (-> wrong-chain-id
|
||||
wallet-connect-core/chain-id->network-details
|
||||
:full-name)
|
||||
expected-network-name (-> expected-chain-id
|
||||
wallet-connect-core/chain-id->network-details
|
||||
:full-name)
|
||||
toast-message (i18n/label :t/wallet-connect-typed-data-wrong-chain-id-warning
|
||||
{:wrong-chain wrong-network-name
|
||||
:expected-chain expected-network-name})]
|
||||
{:fx [[:dispatch
|
||||
[:toasts/upsert
|
||||
{:type :negative
|
||||
:theme :dark
|
||||
:text toast-message}]]
|
||||
[:dispatch
|
||||
[:wallet-connect/on-processing-error
|
||||
(ex-info "Can't proceed signing typed data due to wrong chain-id included in the data"
|
||||
{:expected-chain-id expected-chain-id
|
||||
:wrong-chain-id wrong-chain-id})]]]})))
|
||||
|
||||
;; TODO: we should reject a request if processing fails
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/on-processing-error
|
||||
(fn [{:keys [db]} [error]]
|
||||
(let [{:keys [address event]} (get db :wallet-connect/current-request)
|
||||
method (wallet-connect-core/get-request-method event)
|
||||
screen (wallet-connect-core/method-to-screen method)]
|
||||
method (wallet-connect-core/get-request-method event)]
|
||||
(log/error "Failed to process Wallet Connect request"
|
||||
{:error error
|
||||
:address address
|
||||
:method method
|
||||
:wallet-connect-event event
|
||||
:event :wallet-connect/on-processing-error})
|
||||
|
||||
{:fx [[:dispatch [:dismiss-modal screen]]
|
||||
[:dispatch [:wallet-connect/reset-current-request]]]})))
|
||||
{:fx [[:dispatch [:wallet-connect/reject-session-request]]]})))
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
:data raw-data
|
||||
:rpc-method rpc-method
|
||||
:on-error #(rf/dispatch [:wallet-connect/on-sign-error %])
|
||||
:on-success #(rf/dispatch [:wallet-connect/send-response {:result %}])}]]})))
|
||||
:on-success #(rf/dispatch [:wallet-connect/finish-session-request %])}]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/respond-sign-typed-data
|
||||
@@ -53,7 +53,7 @@
|
||||
:chain-id chain-id
|
||||
:version typed-data-version
|
||||
:on-error #(rf/dispatch [:wallet-connect/on-sign-error %])
|
||||
:on-success #(rf/dispatch [:wallet-connect/send-response {:result %}])}]]})))
|
||||
:on-success #(rf/dispatch [:wallet-connect/finish-session-request %])}]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/respond-send-transaction-data
|
||||
@@ -67,7 +67,7 @@
|
||||
:tx-hash tx-hash
|
||||
:tx-args tx-args
|
||||
:on-error #(rf/dispatch [:wallet-connect/on-sign-error %])
|
||||
:on-success #(rf/dispatch [:wallet-connect/send-response {:result %}])}]]})))
|
||||
:on-success #(rf/dispatch [:wallet-connect/finish-session-request %])}]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/respond-sign-transaction-data
|
||||
@@ -81,15 +81,13 @@
|
||||
:tx-hash tx-hash
|
||||
:tx-params tx-args
|
||||
:on-error #(rf/dispatch [:wallet-connect/on-sign-error %])
|
||||
:on-success #(rf/dispatch [:wallet-connect/send-response {:result %}])}]]})))
|
||||
:on-success #(rf/dispatch [:wallet-connect/finish-session-request %])}]]})))
|
||||
|
||||
;; TODO: should reject if "signing" fails
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/on-sign-error
|
||||
(fn [{:keys [db]} [error]]
|
||||
(let [{:keys [raw-data address event]} (get db :wallet-connect/current-request)
|
||||
method (wallet-connect-core/get-request-method event)
|
||||
screen (wallet-connect-core/method-to-screen method)]
|
||||
method (wallet-connect-core/get-request-method event)]
|
||||
(log/error "Failed to sign Wallet Connect request"
|
||||
{:error error
|
||||
:address address
|
||||
@@ -97,15 +95,14 @@
|
||||
:method method
|
||||
:wallet-connect-event event
|
||||
:event :wallet-connect/on-sign-error})
|
||||
{:fx [[:dispatch [:dismiss-modal screen]]
|
||||
[:dispatch [:wallet-connect/reset-current-request]]]})))
|
||||
{:fx [[:dispatch [:wallet-connect/reject-session-request]]
|
||||
[:dispatch [:wallet-connect/dismiss-request-modal]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/send-response
|
||||
(fn [{:keys [db]} [{:keys [result error]}]]
|
||||
(let [{:keys [id topic] :as event} (get-in db [:wallet-connect/current-request :event])
|
||||
method (wallet-connect-core/get-request-method event)
|
||||
screen (wallet-connect-core/method-to-screen method)
|
||||
web3-wallet (get db :wallet-connect/web3-wallet)]
|
||||
{:fx [[:effects.wallet-connect/respond-session-request
|
||||
{:web3-wallet web3-wallet
|
||||
@@ -119,31 +116,45 @@
|
||||
:method method
|
||||
:event :wallet-connect/send-response
|
||||
:wallet-connect-event event})
|
||||
(rf/dispatch [:dismiss-modal screen])
|
||||
(rf/dispatch [:wallet-connect/reset-current-request]))
|
||||
:on-success (fn []
|
||||
(log/info "Successfully sent Wallet Connect response to dApp")
|
||||
(rf/dispatch [:dismiss-modal screen])
|
||||
(rf/dispatch [:wallet-connect/reset-current-request]))}]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/dismiss-request-modal
|
||||
(fn [{:keys [db]} _]
|
||||
(let [screen (-> db
|
||||
(get-in [:wallet-connect/current-request :event])
|
||||
wallet-connect-core/get-request-method
|
||||
wallet-connect-core/method-to-screen)]
|
||||
{:fx [[:dispatch [:dismiss-modal screen]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/finish-session-request
|
||||
(fn [_ [result]]
|
||||
{:fx [[:dispatch [:wallet-connect/send-response {:result result}]]
|
||||
[:dispatch [:wallet-connect/dismiss-request-modal]]]}))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/reject-session-proposal
|
||||
(fn [{:keys [db]} _]
|
||||
(let [web3-wallet (get db :wallet-connect/web3-wallet)
|
||||
current-proposal (get-in db [:wallet-connect/current-proposal :request])]
|
||||
{:db (dissoc db :wallet-connect/current-proposal)
|
||||
:fx [[:effects.wallet-connect/reject-session-proposal
|
||||
{:fx [[:effects.wallet-connect/reject-session-proposal
|
||||
{:web3-wallet web3-wallet
|
||||
:proposal current-proposal
|
||||
:on-success #(log/info "Wallet Connect session proposal rejected")
|
||||
:on-error #(log/error "Wallet Connect unable to reject session proposal")}]
|
||||
[:dispatch [:dismiss-modal :screen/wallet.wallet-connect-session-proposal]]]})))
|
||||
[:dispatch [:wallet-connect/reset-current-session-proposal]]]})))
|
||||
|
||||
;; NOTE: Currently we only reject a session if the user rejected it
|
||||
;; But this needs to be solidified to ensure other cases:
|
||||
;; - Unsupported WC version
|
||||
;; - Invalid params from dapps
|
||||
;; - Unsupported method
|
||||
;; - Failed processing of request
|
||||
;; - Failed "responding" (signing or sending message/transaction)
|
||||
(rf/reg-event-fx
|
||||
:wallet-connect/reject-session-request
|
||||
(fn [_ _]
|
||||
|
||||
@@ -149,6 +149,7 @@
|
||||
:button-two-props {:type :grey
|
||||
:accessibility-label :wc-deny-connection
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:navigate-back])
|
||||
(rf/dispatch
|
||||
[:wallet-connect/reject-session-proposal]))}
|
||||
:button-one-label (i18n/label :t/connect)
|
||||
|
||||
@@ -6,6 +6,20 @@
|
||||
[utils.hex :as hex]
|
||||
[utils.transforms :as transforms]))
|
||||
|
||||
(defn typed-data-chain-id
|
||||
"Returns the `:chain-id` from typed data if it's present and if the EIP712 domain defines it. Without
|
||||
the `:chain-id` in the domain type, it will not be signed as part of the typed-data."
|
||||
[typed-data]
|
||||
(let [chain-id-type? (->> typed-data
|
||||
:types
|
||||
:EIP712Domain
|
||||
(some #(= "chainId" (:name %))))
|
||||
data-chain-id (-> typed-data
|
||||
:domain
|
||||
:chainId)]
|
||||
(when chain-id-type?
|
||||
data-chain-id)))
|
||||
|
||||
(defn eth-sign
|
||||
[password address data]
|
||||
(-> {:data data
|
||||
|
||||
@@ -61,3 +61,22 @@
|
||||
:wallet/send-token-not-supported-in-receiver-networks?
|
||||
:<- [:wallet/wallet-send]
|
||||
:-> :token-not-supported-in-receiver-networks?)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/bridge-from-networks
|
||||
:<- [:wallet/wallet-send]
|
||||
:<- [:wallet/network-details]
|
||||
(fn [[{:keys [bridge-to-chain-id]} networks]]
|
||||
(set (filter (fn [network]
|
||||
(not= (:chain-id network) bridge-to-chain-id))
|
||||
networks))))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/bridge-from-chain-ids
|
||||
:<- [:wallet/wallet-send]
|
||||
:<- [:wallet/networks-by-mode]
|
||||
(fn [[{:keys [bridge-to-chain-id]} networks]]
|
||||
(keep (fn [network]
|
||||
(when (not= (:chain-id network) bridge-to-chain-id)
|
||||
(:chain-id network)))
|
||||
networks)))
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/swap-asset-to-pay-networks
|
||||
:<- [:wallet/swap-asset-to-pay]
|
||||
(fn [token]
|
||||
(let [{token-networks :networks} token
|
||||
(fn []
|
||||
[(rf/subscribe [:wallet/swap-asset-to-pay])
|
||||
(rf/subscribe [:wallet/current-viewing-account-tokens-filtered])])
|
||||
(fn [[asset-to-pay tokens]]
|
||||
(let [{token-networks :networks} (some #(when (= (:symbol %) (:symbol asset-to-pay)) %) tokens)
|
||||
grouped-networks (group-by :layer
|
||||
token-networks)
|
||||
mainnet-network (first (get grouped-networks constants/layer-1-network))
|
||||
|
||||
@@ -90,14 +90,6 @@
|
||||
swap-data)
|
||||
(is (match? "SNT" (rf/sub [sub-name])))))
|
||||
|
||||
(h/deftest-sub :wallet/swap-asset-to-pay-networks
|
||||
[sub-name]
|
||||
(testing "Return the available networks for the swap asset-to-pay"
|
||||
(swap! rf-db/app-db assoc-in
|
||||
[:wallet :ui :swap]
|
||||
swap-data)
|
||||
(is (match? networks (rf/sub [sub-name])))))
|
||||
|
||||
(h/deftest-sub :wallet/swap-asset-to-pay-network-balance
|
||||
[sub-name]
|
||||
(testing "Return swap asset-to-pay"
|
||||
|
||||
@@ -426,6 +426,18 @@
|
||||
sorted-tokens))
|
||||
sorted-tokens))))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/token-with-networks
|
||||
:<- [:wallet/accounts]
|
||||
:<- [:wallet/network-details]
|
||||
(fn [[accounts networks] [_ token-symbol account-address]]
|
||||
(let [account (utils/get-account-by-address accounts account-address)
|
||||
token (some #(when (= token-symbol (:symbol %)) %)
|
||||
(:tokens account))]
|
||||
(assoc token
|
||||
:networks
|
||||
(network-utils/network-list token networks)))))
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet/token-by-symbol
|
||||
:<- [:wallet/current-viewing-account]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as rf]
|
||||
[status-im.contexts.wallet.common.utils :as wallet-utils]
|
||||
[status-im.contexts.wallet.common.utils.networks :as networks]
|
||||
[status-im.contexts.wallet.wallet-connect.core :as wallet-connect-core]
|
||||
[status-im.contexts.wallet.wallet-connect.transactions :as transactions]
|
||||
[utils.money :as money]
|
||||
@@ -70,10 +69,7 @@
|
||||
(rf/reg-sub
|
||||
:wallet-connect/current-request-network
|
||||
:<- [:wallet-connect/chain-id]
|
||||
(fn [chain-id]
|
||||
(-> chain-id
|
||||
(networks/get-network-details)
|
||||
(wallet-connect-core/add-full-testnet-name))))
|
||||
wallet-connect-core/chain-id->network-details)
|
||||
|
||||
(rf/reg-sub
|
||||
:wallet-connect/transaction-args
|
||||
|
||||
@@ -2642,6 +2642,7 @@
|
||||
"wallet-connect-sign-transaction-header": "wants you to sign this transaction with",
|
||||
"wallet-connect-sign-transaction-warning": "Sign transactions only if you trust the dApp",
|
||||
"wallet-connect-sign-warning": "Sign only if you trust the dApp",
|
||||
"wallet-connect-typed-data-wrong-chain-id-warning": "Wrong network in the request data. Expected '{{expected-chain}}', but got '{{wrong-chain}}'",
|
||||
"wallet-connect-version-not-supported": "WalletConnect version {{version}} is not supported",
|
||||
"wallet-connect-via": "via",
|
||||
"wallet-connect-wrong-qr": "It’s not a WalletConnect QR",
|
||||
|
||||
Reference in New Issue
Block a user