Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44249994ed | ||
|
|
314a9d204b | ||
|
|
e98425987e | ||
|
|
b2e5ca5d13 | ||
|
|
76b1c9cd1d | ||
|
|
3e767dbb37 | ||
|
|
3b94362cc0 | ||
|
|
2d77f287df |
@@ -33,22 +33,22 @@
|
||||
[rn/view
|
||||
{:style style/networks-container
|
||||
:accessibility-label :networks}
|
||||
(when (pos? ethereum)
|
||||
(when (and ethereum (pos? (:amount ethereum)))
|
||||
[network-amount
|
||||
{:network :ethereum
|
||||
:amount (str ethereum " ETH")
|
||||
:amount (str (:amount ethereum) " " (or (:token-symbol ethereum) "ETH"))
|
||||
:divider? (or show-arbitrum? show-optimism?)
|
||||
:theme theme}])
|
||||
(when show-optimism?
|
||||
[network-amount
|
||||
{:network :optimism
|
||||
:amount (str optimism " OPT")
|
||||
:amount (str (:amount optimism) " " (or (:token-symbol optimism) "OPT"))
|
||||
:divider? show-arbitrum?
|
||||
:theme theme}])
|
||||
(when show-arbitrum?
|
||||
[network-amount
|
||||
{:network :arbitrum
|
||||
:amount (str arbitrum " ARB")
|
||||
:amount (str (:amount arbitrum) " " (or (:token-symbol arbitrum) "ARB"))
|
||||
:theme theme}])]))
|
||||
|
||||
(defn- view-internal
|
||||
|
||||
@@ -437,3 +437,5 @@
|
||||
(def ^:const send-type-stickers-buy 4)
|
||||
(def ^:const send-type-bridge 5)
|
||||
(def ^:const send-type-erc-721-transfer 6)
|
||||
|
||||
(def ^:const bridge-name-erc-721-transfer "ERC721Transfer")
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
[]
|
||||
(let [state (reagent/atom {:type :status-account
|
||||
:networks? true
|
||||
:values {:ethereum 150
|
||||
:optimism 50
|
||||
:arbitrum 25}})
|
||||
:values {:ethereum {:amount 150}
|
||||
:optimism {:amount 50}
|
||||
:arbitrum {:amount 25}}})
|
||||
status-account-props {:customization-color :purple
|
||||
:size 32
|
||||
:emoji "🍑"
|
||||
|
||||
@@ -7,18 +7,24 @@
|
||||
[status-im.contexts.wallet.common.activity-tab.view :as activity]
|
||||
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles]
|
||||
[status-im.contexts.wallet.common.empty-tab.view :as empty-tab]
|
||||
[utils.i18n :as i18n]))
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[{:keys [selected-tab]}]
|
||||
[rn/view {:style {:flex 1}}
|
||||
(case selected-tab
|
||||
:assets [assets/view]
|
||||
:collectibles [collectibles/view]
|
||||
:activity [activity/view]
|
||||
:permissions [empty-tab/view
|
||||
{:title (i18n/label :t/no-permissions)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:placeholder? true}]
|
||||
:dapps [dapps/view]
|
||||
[about/view])])
|
||||
(let [collectible-list (rf/sub [:wallet/current-viewing-account-collectibles])]
|
||||
[rn/view {:style {:flex 1}}
|
||||
(case selected-tab
|
||||
:assets [assets/view]
|
||||
:collectibles [collectibles/view
|
||||
{:collectibles collectible-list
|
||||
:on-collectible-press (fn [id]
|
||||
(rf/dispatch [:wallet/get-collectible-details id])
|
||||
(rf/dispatch [:navigate-to :wallet-collectible]))}]
|
||||
:activity [activity/view]
|
||||
:permissions [empty-tab/view
|
||||
{:title (i18n/label :t/no-permissions)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:placeholder? true}]
|
||||
:dapps [dapps/view]
|
||||
[about/view])]))
|
||||
|
||||
@@ -5,32 +5,34 @@
|
||||
[react-native.core :as rn]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.contexts.wallet.common.empty-tab.view :as empty-tab]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn- view-internal
|
||||
[{:keys [theme]}]
|
||||
(let [specific-address (rf/sub [:wallet/current-viewing-account-address])
|
||||
collectible-list (if specific-address
|
||||
(rf/sub [:wallet/collectibles-per-account specific-address])
|
||||
(rf/sub [:wallet/all-collectibles]))]
|
||||
(if (empty? collectible-list)
|
||||
[{:keys [theme collectibles filtered? on-collectible-press]}]
|
||||
(let [no-results-match-query? (and filtered? (empty? collectibles))]
|
||||
(cond
|
||||
no-results-match-query?
|
||||
[rn/view {:style {:flex 1 :justify-content :center}}
|
||||
[quo/empty-state
|
||||
{:title (i18n/label :t/nothing-found)
|
||||
:description (i18n/label :t/try-to-search-something-else)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]]
|
||||
|
||||
(empty? collectibles)
|
||||
[empty-tab/view
|
||||
{:title (i18n/label :t/no-collectibles)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:image (resources/get-themed-image :no-collectibles theme)}]
|
||||
|
||||
:else
|
||||
[rn/flat-list
|
||||
{:data collectible-list
|
||||
{:data collectibles
|
||||
:style {:flex 1}
|
||||
:content-container-style {:align-items :center}
|
||||
:num-columns 2
|
||||
:render-fn (fn [{:keys [preview-url id]}]
|
||||
:render-fn (fn [{:keys [preview-url] :as collectible}]
|
||||
[quo/collectible
|
||||
{:images [preview-url]
|
||||
:on-press (fn []
|
||||
(rf/dispatch [:wallet/get-collectible-details id])
|
||||
(rf/dispatch
|
||||
[:navigate-to
|
||||
:wallet-collectible]))}])}])))
|
||||
:on-press #(on-collectible-press collectible)}])}])))
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -4,12 +4,18 @@
|
||||
[status-im.contexts.wallet.common.activity-tab.view :as activity]
|
||||
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles]
|
||||
[status-im.contexts.wallet.home.tabs.assets.view :as assets]
|
||||
[status-im.contexts.wallet.home.tabs.style :as style]))
|
||||
[status-im.contexts.wallet.home.tabs.style :as style]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn view
|
||||
[{:keys [selected-tab]}]
|
||||
[rn/view {:style style/container}
|
||||
(case selected-tab
|
||||
:assets [assets/view]
|
||||
:collectibles [collectibles/view]
|
||||
[activity/view])])
|
||||
(let [collectible-list (rf/sub [:wallet/all-collectibles])]
|
||||
[rn/view {:style style/container}
|
||||
(case selected-tab
|
||||
:assets [assets/view]
|
||||
:collectibles [collectibles/view
|
||||
{:collectibles collectible-list
|
||||
:on-collectible-press (fn [id]
|
||||
(rf/dispatch [:wallet/get-collectible-details id])
|
||||
(rf/dispatch [:navigate-to :wallet-collectible]))}]
|
||||
[activity/view])]))
|
||||
|
||||
@@ -56,9 +56,20 @@
|
||||
|
||||
(rf/reg-event-fx :wallet/send-select-token
|
||||
(fn [{:keys [db]} [{:keys [token stack-id]}]]
|
||||
{:db (assoc-in db [:wallet :ui :send :token] token)
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :collectible)
|
||||
(assoc-in [:wallet :ui :send :token] token))
|
||||
:fx [[:navigate-to-within-stack [:wallet-send-input-amount stack-id]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/send-select-collectible
|
||||
(fn [{:keys [db]} [{:keys [collectible stack-id]}]]
|
||||
{:db (-> db
|
||||
(update-in [:wallet :ui :send] dissoc :token)
|
||||
(assoc-in [:wallet :ui :send :collectible] collectible)
|
||||
(assoc-in [:wallet :ui :send :amount] 1))
|
||||
:fx [[:dispatch [:wallet/get-suggested-routes 1]]
|
||||
[:navigate-to-within-stack [:wallet-transaction-confirmation stack-id]]]}))
|
||||
|
||||
(rf/reg-event-fx :wallet/send-select-amount
|
||||
(fn [{:keys [db]} [{:keys [amount stack-id]}]]
|
||||
{:db (assoc-in db [:wallet :ui :send :amount] amount)
|
||||
@@ -68,18 +79,26 @@
|
||||
(fn [{:keys [db now]} [amount]]
|
||||
(let [wallet-address (get-in db [:wallet :current-viewing-account-address])
|
||||
token (get-in db [:wallet :ui :send :token])
|
||||
collectible (get-in db [:wallet :ui :send :collectible])
|
||||
account-address (get-in db [:wallet :ui :send :send-account-address])
|
||||
to-address (or account-address (get-in db [:wallet :ui :send :to-address]))
|
||||
token-decimal (:decimals token)
|
||||
token-id (:symbol token)
|
||||
network-preferences []
|
||||
token-decimal (when token (:decimals token))
|
||||
token-id (if token
|
||||
(:symbol token)
|
||||
(str (get-in collectible [:id :contract-id :address])
|
||||
":"
|
||||
(get-in collectible [:id :token-id])))
|
||||
network-preferences (if token [] [(get-in collectible [:id :contract-id :chain-id])])
|
||||
gas-rates constants/gas-rate-medium
|
||||
amount-in (send-utils/amount-in-hex amount token-decimal)
|
||||
amount-in (send-utils/amount-in-hex amount (if token token-decimal 0))
|
||||
from-address wallet-address
|
||||
disabled-from-chain-ids []
|
||||
disabled-to-chain-ids []
|
||||
from-locked-amount {}
|
||||
request-params [constants/send-type-transfer
|
||||
transaction-type (if token
|
||||
constants/send-type-transfer
|
||||
constants/send-type-erc-721-transfer)
|
||||
request-params [transaction-type
|
||||
from-address
|
||||
to-address
|
||||
amount-in
|
||||
@@ -116,21 +135,43 @@
|
||||
:fx [[:dispatch [:navigate-to :wallet-transaction-progress]]]})))
|
||||
|
||||
(defn- transaction-bridge
|
||||
[{:keys [from-address to-address route]}]
|
||||
(let [{:keys [from bridge-name amount-out gas-amount gas-fees]} route
|
||||
{:keys [gas-price max-fee-per-gas-medium max-priority-fee-per-gas]} gas-fees]
|
||||
[{:BridgeName bridge-name
|
||||
:ChainID (:chain-id from)
|
||||
:TransferTx {:From from-address
|
||||
:To to-address
|
||||
:Gas (money/to-hex gas-amount)
|
||||
:GasPrice (money/to-hex (money/->wei :gwei gas-price))
|
||||
:Value amount-out
|
||||
:Nonce nil
|
||||
:MaxFeePerGas (money/to-hex (money/->wei :gwei max-fee-per-gas-medium))
|
||||
:MaxPriorityFeePerGas (money/to-hex (money/->wei :gwei max-priority-fee-per-gas))
|
||||
:Input ""
|
||||
:Data "0x"}}]))
|
||||
[{:keys [from-address to-address token-id token-address route]}]
|
||||
(let [{:keys [from bridge-name amount-out gas-amount
|
||||
gas-fees]} route
|
||||
eip-1559-enabled? (:eip-1559-enabled gas-fees)
|
||||
{:keys [gas-price max-fee-per-gas-medium
|
||||
max-priority-fee-per-gas]} gas-fees
|
||||
transfer-tx (merge
|
||||
(if eip-1559-enabled?
|
||||
{:TxType "0x02"
|
||||
:MaxFeePerGas (money/to-hex
|
||||
(money/->wei
|
||||
:gwei
|
||||
max-fee-per-gas-medium))
|
||||
:MaxPriorityFeePerGas (money/to-hex
|
||||
(money/->wei
|
||||
:gwei
|
||||
max-priority-fee-per-gas))}
|
||||
{:TxType "0x00"
|
||||
:GasPrice (money/to-hex (money/->wei :gwei
|
||||
gas-price))})
|
||||
{:From from-address
|
||||
:To (or token-address to-address)
|
||||
:Gas (money/to-hex gas-amount)
|
||||
:Value amount-out
|
||||
:Nonce nil
|
||||
:Input ""
|
||||
:Data "0x"})]
|
||||
[(merge
|
||||
{:BridgeName bridge-name
|
||||
:ChainID (:chain-id from)}
|
||||
(if (= bridge-name constants/bridge-name-erc-721-transfer)
|
||||
{:ERC721TransferTx
|
||||
(merge
|
||||
{:Recipient to-address
|
||||
:TokenID token-id}
|
||||
transfer-tx)}
|
||||
{:TransferTx transfer-tx}))]))
|
||||
|
||||
(defn- multi-transaction-command
|
||||
[{:keys [from-address to-address from-asset to-asset amount-out transfer-type]
|
||||
@@ -146,17 +187,27 @@
|
||||
(fn [{:keys [db]} [sha3-pwd]]
|
||||
(let [route (get-in db [:wallet :ui :send :route])
|
||||
from-address (get-in db [:wallet :current-viewing-account-address])
|
||||
to-address (get-in db [:wallet :ui :send :to-address])
|
||||
token (get-in db [:wallet :ui :send :token])
|
||||
token-id (:symbol token)
|
||||
request-params [(multi-transaction-command {:from-address from-address
|
||||
:to-address to-address
|
||||
:from-asset token-id
|
||||
:to-asset token-id
|
||||
:amount-out (:amount-out route)})
|
||||
(transaction-bridge {:to-address to-address
|
||||
:from-address from-address
|
||||
:route route})
|
||||
collectible (get-in db [:wallet :ui :send :collectible])
|
||||
token-address (when collectible
|
||||
(get-in collectible
|
||||
[:id :contract-id :address]))
|
||||
to-address (get-in db [:wallet :ui :send :to-address])
|
||||
token-id (if token
|
||||
(:symbol token)
|
||||
(get-in collectible [:id :token-id]))
|
||||
request-params [(multi-transaction-command
|
||||
{:from-address from-address
|
||||
:to-address to-address
|
||||
:from-asset token-id
|
||||
:to-asset token-id
|
||||
:amount-out (:amount-out route)})
|
||||
(transaction-bridge {:to-address to-address
|
||||
:from-address from-address
|
||||
:route route
|
||||
:token-address token-address
|
||||
:token-id (when collectible
|
||||
(money/to-hex (js/parseInt token-id)))})
|
||||
sha3-pwd]]
|
||||
{:json-rpc/call [{:method "wallet_createMultiTransaction"
|
||||
:params request-params
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
(ns status-im.contexts.wallet.send.select-asset.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
|
||||
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles-tab]
|
||||
[status-im.contexts.wallet.send.select-asset.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
@@ -17,13 +18,12 @@
|
||||
(defn- asset-component
|
||||
[]
|
||||
(fn [token _ _ _]
|
||||
(let [on-press
|
||||
#(rf/dispatch [:wallet/send-select-token
|
||||
{:token token
|
||||
:stack-id :wallet-select-asset}])
|
||||
(let [on-press #(rf/dispatch [:wallet/send-select-token
|
||||
{:token token
|
||||
:stack-id :wallet-select-asset}])
|
||||
total-balance-formatted (.toFixed (:total-balance token) 2)
|
||||
balance-fiat-formatted (.toFixed (:total-balance-fiat token) 2)
|
||||
currency-symbol (rf/sub [:profile/currency-symbol])]
|
||||
balance-fiat-formatted (.toFixed (:total-balance-fiat token) 2)
|
||||
currency-symbol (rf/sub [:profile/currency-symbol])]
|
||||
[quo/token-network
|
||||
{:token (:symbol token)
|
||||
:label (:name token)
|
||||
@@ -44,34 +44,48 @@
|
||||
:on-scroll-to-index-failed identity
|
||||
:render-fn asset-component}]))
|
||||
|
||||
(defn- tab-view
|
||||
[search-text selected-tab]
|
||||
(case selected-tab
|
||||
:tab/assets [asset-list search-text]
|
||||
:tab/collectibles [quo/empty-state
|
||||
{:title (i18n/label :t/no-collectibles)
|
||||
:description (i18n/label :t/no-collectibles-description)
|
||||
:placeholder? true
|
||||
:container-style (style/empty-container-style (safe-area/get-top))}]))
|
||||
|
||||
(defn- search-input
|
||||
[search-text on-change-text]
|
||||
[rn/view {:style style/search-input-container}
|
||||
[quo/input
|
||||
{:small? true
|
||||
:placeholder (i18n/label :t/search-assets)
|
||||
:icon-name :i/search
|
||||
:value search-text
|
||||
:on-change-text on-change-text}]])
|
||||
|
||||
(defn collectibles-grid
|
||||
[search-text]
|
||||
(let [on-change-text #(reset! search-text %)]
|
||||
(fn []
|
||||
[rn/view {:style style/search-input-container}
|
||||
[quo/input
|
||||
{:small? true
|
||||
:placeholder (i18n/label :t/search-assets)
|
||||
:icon-name :i/search
|
||||
:value @search-text
|
||||
:on-change-text on-change-text}]])))
|
||||
(let [collectibles (rf/sub [:wallet/current-viewing-account-collectibles-filtered search-text])
|
||||
search-performed? (not (string/blank? search-text))]
|
||||
[collectibles-tab/view
|
||||
{:collectibles collectibles
|
||||
:filtered? search-performed?
|
||||
:on-collectible-press #(rf/dispatch [:wallet/send-select-collectible
|
||||
{:collectible %
|
||||
:stack-id :wallet-select-asset}])}]))
|
||||
|
||||
(defn- tab-view
|
||||
[search-text selected-tab on-change-text]
|
||||
(let [unfiltered-collectibles (rf/sub [:wallet/current-viewing-account-collectibles])
|
||||
show-search-input? (or (= selected-tab :tab/assets)
|
||||
(and (= selected-tab :tab/collectibles)
|
||||
(seq unfiltered-collectibles)))]
|
||||
[:<>
|
||||
(when show-search-input?
|
||||
[search-input search-text on-change-text])
|
||||
(case selected-tab
|
||||
:tab/assets [asset-list search-text]
|
||||
:tab/collectibles [collectibles-grid search-text])]))
|
||||
|
||||
|
||||
(defn- f-view-internal
|
||||
[]
|
||||
(let [selected-tab (reagent/atom (:id (first tabs-data)))
|
||||
search-text (reagent/atom "")
|
||||
on-close #(rf/dispatch [:navigate-back-within-stack
|
||||
:wallet-select-asset])]
|
||||
(let [selected-tab (reagent/atom (:id (first tabs-data)))
|
||||
search-text (reagent/atom "")
|
||||
on-change-text #(reset! search-text %)
|
||||
on-change-tab #(reset! selected-tab %)
|
||||
on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])]
|
||||
(fn []
|
||||
[rn/safe-area-view {:style style/container}
|
||||
[rn/scroll-view
|
||||
@@ -94,9 +108,8 @@
|
||||
:container-style {:margin-horizontal 20
|
||||
:margin-vertical 8}
|
||||
:data tabs-data
|
||||
:on-change #(reset! selected-tab %)}]
|
||||
[search-input search-text]
|
||||
[tab-view @search-text @selected-tab]]])))
|
||||
:on-change on-change-tab}]
|
||||
[tab-view @search-text @selected-tab on-change-text]]])))
|
||||
|
||||
(defn- view-internal
|
||||
[]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns status-im.contexts.wallet.send.transaction-confirmation.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.utils.utils :as utils]
|
||||
[quo.core :as quo]
|
||||
[quo.theme :as quo.theme]
|
||||
@@ -9,10 +10,11 @@
|
||||
[status-im.common.standard-authentication.core :as standard-auth]
|
||||
[status-im.contexts.wallet.send.transaction-confirmation.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.re-frame :as rf]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
(defn- transaction-title
|
||||
[{:keys [token-symbol amount account to-address]}]
|
||||
[{:keys [token-symbol amount account to-address image-url collectible?]}]
|
||||
[rn/view {:style style/content-container}
|
||||
[rn/view {:style {:flex-direction :row}}
|
||||
[quo/text
|
||||
@@ -22,10 +24,10 @@
|
||||
:accessibility-label :send-label}
|
||||
(i18n/label :t/send)]
|
||||
[quo/summary-tag
|
||||
{:token token-symbol
|
||||
{:token (if collectible? "" token-symbol)
|
||||
:label (str amount " " token-symbol)
|
||||
:type :token
|
||||
:image-source :eth}]]
|
||||
:type (if collectible? :collectible :token)
|
||||
:image-source (if collectible? image-url :eth)}]]
|
||||
[rn/view
|
||||
{:style {:flex-direction :row
|
||||
:margin-top 4}}
|
||||
@@ -54,7 +56,7 @@
|
||||
:label (utils/get-shortened-address to-address)}]]])
|
||||
|
||||
(defn- user-summary
|
||||
[{:keys [amount account-props theme label accessibility-label summary-type]}]
|
||||
[{:keys [amount token-symbol account-props theme label accessibility-label summary-type]}]
|
||||
[rn/view
|
||||
{:style {:padding-horizontal 20
|
||||
:padding-bottom 16}}
|
||||
@@ -67,7 +69,8 @@
|
||||
[quo/summary-info
|
||||
{:type summary-type
|
||||
:networks? true
|
||||
:values {:ethereum amount}
|
||||
:values {:ethereum {:amount amount
|
||||
:token-symbol token-symbol}}
|
||||
:account-props account-props}]])
|
||||
|
||||
(defn- transaction-details
|
||||
@@ -124,72 +127,85 @@
|
||||
(let [on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])
|
||||
send-transaction-data (rf/sub [:wallet/wallet-send])
|
||||
token (:token send-transaction-data)
|
||||
token-symbol (:symbol token)
|
||||
amount (:amount send-transaction-data)
|
||||
route (:route send-transaction-data)
|
||||
estimated-time-min (:estimated-time route)
|
||||
max-fees "-"
|
||||
to-address (:to-address send-transaction-data)
|
||||
account (rf/sub [:wallet/current-viewing-account])
|
||||
account-color (:color account)
|
||||
from-account-props {:customization-color account-color
|
||||
:size 32
|
||||
:emoji (:emoji account)
|
||||
:type :default
|
||||
:name (:name account)
|
||||
:address (utils/get-shortened-address (:address account))}
|
||||
user-props {:full-name to-address
|
||||
:address (utils/get-shortened-address to-address)}]
|
||||
(prn route)
|
||||
collectible (:collectible send-transaction-data)
|
||||
collection-data (:collection-data collectible)
|
||||
collectible-data (:collectible-data collectible)
|
||||
collectible-id (get-in collectible [:id :token-id])
|
||||
token-symbol (if collectible
|
||||
(first (remove string/blank?
|
||||
[(:name collectible-data)
|
||||
(str (:name collection-data) " #" collectible-id)]))
|
||||
(:symbol token))
|
||||
image-url (when collectible (:image-url collectible-data))
|
||||
amount (:amount send-transaction-data)]
|
||||
|
||||
(fn [{:keys [theme]}]
|
||||
[rn/view {:style {:flex 1}}
|
||||
[floating-button-page/view
|
||||
{:header [quo/page-nav
|
||||
{:icon-name :i/arrow-left
|
||||
:on-press on-close
|
||||
:margin-top (safe-area/get-top)
|
||||
:background :blur
|
||||
:accessibility-label :top-bar
|
||||
:right-side [{:icon-name :i/advanced
|
||||
:on-press #(js/alert
|
||||
"to be implemented")
|
||||
:accessibility-label :advanced-options}]}]
|
||||
:footer [standard-auth/slide-button
|
||||
{:size :size-48
|
||||
:track-text (i18n/label :t/slide-to-send)
|
||||
:container-style {:z-index 2}
|
||||
:customization-color account-color
|
||||
:on-auth-success #(rf/dispatch [:wallet/send-transaction %])
|
||||
:auth-button-label (i18n/label :t/confirm)}]
|
||||
:gradient-cover? true
|
||||
:customization-color (:color account)}
|
||||
[rn/view
|
||||
[transaction-title
|
||||
{:token-symbol token-symbol
|
||||
:amount amount
|
||||
:account account
|
||||
:to-address to-address}]
|
||||
[user-summary
|
||||
{:amount amount
|
||||
:summary-type :status-account
|
||||
:accessibility-label :summary-from-label
|
||||
:label (i18n/label :t/from-capitalized)
|
||||
:account-props from-account-props
|
||||
:theme theme}]
|
||||
[user-summary
|
||||
{:amount amount
|
||||
:summary-type :account
|
||||
:accessibility-label :summary-to-label
|
||||
:label (i18n/label :t/to-capitalized)
|
||||
:account-props user-props
|
||||
:theme theme}]
|
||||
[transaction-details
|
||||
{:estimated-time-min estimated-time-min
|
||||
:max-fees max-fees
|
||||
:token token
|
||||
:amount amount
|
||||
:to-address to-address
|
||||
:theme theme}]]]])))
|
||||
(let [route (:route send-transaction-data)
|
||||
estimated-time-min (:estimated-time route)
|
||||
max-fees "-"
|
||||
to-address (:to-address send-transaction-data)
|
||||
account (rf/sub [:wallet/current-viewing-account])
|
||||
account-color (:color account)
|
||||
from-account-props {:customization-color account-color
|
||||
:size 32
|
||||
:emoji (:emoji account)
|
||||
:type :default
|
||||
:name (:name account)
|
||||
:address (utils/get-shortened-address (:address account))}
|
||||
user-props {:full-name to-address
|
||||
:address (utils/get-shortened-address to-address)}]
|
||||
[rn/view {:style {:flex 1}}
|
||||
[floating-button-page/view
|
||||
{:header [quo/page-nav
|
||||
{:icon-name :i/arrow-left
|
||||
:on-press on-close
|
||||
:margin-top (safe-area/get-top)
|
||||
:background :blur
|
||||
:accessibility-label :top-bar
|
||||
:right-side [{:icon-name :i/advanced
|
||||
:on-press #(js/alert
|
||||
"to be implemented")
|
||||
:accessibility-label :advanced-options}]}]
|
||||
:footer [standard-auth/slide-button
|
||||
{:size :size-48
|
||||
:track-text (i18n/label :t/slide-to-send)
|
||||
:container-style {:z-index 2}
|
||||
:customization-color account-color
|
||||
:on-auth-success #(rf/dispatch [:wallet/send-transaction
|
||||
(security/safe-unmask-data %)])
|
||||
:auth-button-label (i18n/label :t/confirm)}]
|
||||
:gradient-cover? true
|
||||
:customization-color (:color account)}
|
||||
[rn/view
|
||||
[transaction-title
|
||||
{:token-symbol token-symbol
|
||||
:amount amount
|
||||
:account account
|
||||
:to-address to-address
|
||||
:image-url image-url
|
||||
:collectible? (some? collectible)}]
|
||||
[user-summary
|
||||
{:amount amount
|
||||
:token-symbol token-symbol
|
||||
:summary-type :status-account
|
||||
:accessibility-label :summary-from-label
|
||||
:label (i18n/label :t/from-capitalized)
|
||||
:account-props from-account-props
|
||||
:theme theme}]
|
||||
[user-summary
|
||||
{:amount amount
|
||||
:token-symbol token-symbol
|
||||
:summary-type :account
|
||||
:accessibility-label :summary-to-label
|
||||
:label (i18n/label :t/to-capitalized)
|
||||
:account-props user-props
|
||||
:theme theme}]
|
||||
[transaction-details
|
||||
{:estimated-time-min estimated-time-min
|
||||
:max-fees max-fees
|
||||
:token token
|
||||
:amount amount
|
||||
:to-address to-address
|
||||
:theme theme}]]]]))))
|
||||
|
||||
(def view (quo.theme/with-theme view-internal))
|
||||
|
||||
@@ -10,15 +10,17 @@
|
||||
animation-url
|
||||
image-url))
|
||||
|
||||
(defn add-collectibles-preview-url
|
||||
[collectibles]
|
||||
(map (fn [{:keys [collectible-data] :as collectible}]
|
||||
(assoc collectible :preview-url (preview-url collectible-data)))
|
||||
collectibles))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/collectibles-per-account
|
||||
:<- [:wallet]
|
||||
(fn [wallet [_ address]]
|
||||
(as-> wallet $
|
||||
(get-in $ [:accounts address :collectibles])
|
||||
(map (fn [{:keys [collectible-data] :as collectible}]
|
||||
(assoc collectible :preview-url (preview-url collectible-data)))
|
||||
$))))
|
||||
:wallet/current-viewing-account-collectibles
|
||||
:<- [:wallet/current-viewing-account]
|
||||
(fn [current-account]
|
||||
(-> current-account :collectibles add-collectibles-preview-url)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/all-collectibles
|
||||
@@ -27,8 +29,7 @@
|
||||
(->> wallet
|
||||
:accounts
|
||||
(mapcat (comp :collectibles val))
|
||||
(map (fn [{:keys [collectible-data] :as collectible}]
|
||||
(assoc collectible :preview-url (preview-url collectible-data)))))))
|
||||
(add-collectibles-preview-url))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/last-collectible-details
|
||||
@@ -57,3 +58,14 @@
|
||||
(let [address (:address (first (:ownership collectible)))
|
||||
account (get-in wallet [:accounts address])]
|
||||
account)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:wallet/current-viewing-account-collectibles-filtered
|
||||
:<- [:wallet/current-viewing-account-collectibles]
|
||||
(fn [current-account-collectibles [_ search-text]]
|
||||
(let [search-text-lower-case (string/lower-case search-text)]
|
||||
(filter (fn [{{collection-name :name} :collection-data
|
||||
{collectible-name :name} :collectible-data}]
|
||||
(or (string/includes? (string/lower-case collection-name) search-text-lower-case)
|
||||
(string/includes? (string/lower-case collectible-name) search-text-lower-case)))
|
||||
current-account-collectibles))))
|
||||
|
||||
@@ -124,10 +124,10 @@
|
||||
:<- [:wallet/balances]
|
||||
:<- [:profile/currency-symbol]
|
||||
(fn [[accounts current-viewing-account-address balances currency-symbol]]
|
||||
(let [current-viewing-account (utils/get-account-by-address accounts current-viewing-account-address)
|
||||
balance (get balances current-viewing-account-address)
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)]
|
||||
(-> current-viewing-account
|
||||
(let [balance (get balances current-viewing-account-address)
|
||||
formatted-balance (utils/prettify-balance currency-symbol balance)]
|
||||
(-> accounts
|
||||
(utils/get-account-by-address current-viewing-account-address)
|
||||
(assoc :balance balance
|
||||
:formatted-balance formatted-balance)))))
|
||||
|
||||
|
||||
@@ -1793,6 +1793,8 @@
|
||||
"community-info-not-found": "Community information not found",
|
||||
"community-info": "Community info",
|
||||
"not-found": "Not found",
|
||||
"nothing-found": "Nothing found",
|
||||
"try-to-search-something-else": "Try to search something else",
|
||||
"activity": "Activity",
|
||||
"reject-and-delete": "Reject and delete",
|
||||
"accept-and-add": "Accept and add",
|
||||
|
||||
Reference in New Issue
Block a user