|
1 | 1 | (ns status-im.contexts.wallet.swap.set-spending-cap.view
|
2 | 2 | (:require
|
| 3 | + [native-module.core :as native-module] |
3 | 4 | [quo.core :as quo]
|
4 | 5 | [quo.foundations.resources :as resources]
|
5 | 6 | [quo.theme :as quo.theme]
|
6 | 7 | [react-native.core :as rn]
|
7 | 8 | [status-im.common.events-helper :as events-helper]
|
8 | 9 | [status-im.common.floating-button-page.view :as floating-button-page]
|
9 | 10 | [status-im.common.standard-authentication.core :as standard-auth]
|
| 11 | + [status-im.constants :as constants] |
10 | 12 | [status-im.contexts.wallet.common.utils.external-links :as external-links]
|
11 | 13 | [status-im.contexts.wallet.swap.set-spending-cap.style :as style]
|
12 | 14 | [utils.address :as address-utils]
|
| 15 | + [utils.hex :as hex] |
13 | 16 | [utils.i18n :as i18n]
|
| 17 | + [utils.number :as number] |
14 | 18 | [utils.re-frame :as rf]))
|
15 | 19 |
|
16 | 20 | (defn- swap-title
|
|
171 | 175 | :size :small}]]])
|
172 | 176 |
|
173 | 177 | (defn footer
|
174 |
| - [{:keys [estimated-time-min native-currency-symbol network theme account-color loading-fees?]}] |
175 |
| - (let [fee-formatted (rf/sub [:wallet/wallet-send-fee-fiat-formatted native-currency-symbol]) |
| 178 | + [{:keys [estimated-time-min network theme account-color loading-fees?]}] |
| 179 | + (let [fee-formatted (rf/sub [:wallet/wallet-swap-proposal-fee-fiat-formatted |
| 180 | + constants/token-for-fees-symbol]) |
176 | 181 | on-auth-success (rn/use-callback #(js/alert "Not implemented yet"))]
|
177 | 182 | [rn/view {:style {:margin-bottom -10}}
|
178 | 183 | [transaction-details
|
|
194 | 199 | []
|
195 | 200 | (let [theme (quo.theme/use-theme)
|
196 | 201 | swap-transaction-data (rf/sub [:wallet/swap])
|
197 |
| - {:keys [asset-to-pay network pay-amount |
198 |
| - providers swap-proposal |
| 202 | + {:keys [asset-to-pay network |
| 203 | + swap-proposal |
199 | 204 | loading-fees?]} swap-transaction-data
|
| 205 | + amount-in (rf/sub [:wallet/swap-proposal-amount-in]) |
| 206 | + pay-token-decimals (:decimals asset-to-pay) |
| 207 | + pay-token-address (get-in asset-to-pay |
| 208 | + [:balances-per-chain |
| 209 | + (:chain-id network) :address]) |
| 210 | + pay-amount (when amount-in |
| 211 | + (number/convert-to-whole-number |
| 212 | + (native-module/hex-to-number |
| 213 | + (hex/normalize-hex |
| 214 | + amount-in)) |
| 215 | + pay-token-decimals)) |
200 | 216 | estimated-time-min (:estimated-time swap-proposal)
|
201 | 217 | pay-token-symbol (:symbol asset-to-pay)
|
202 |
| - pay-token-address (:address asset-to-pay) |
203 |
| - native-currency-symbol (get-in swap-proposal [:from :native-currency-symbol]) |
204 | 218 | account (rf/sub [:wallet/current-viewing-account])
|
205 | 219 | account-color (:color account)
|
206 |
| - provider (first providers)] |
| 220 | + provider (rf/sub [:wallet/swap-proposal-provider])] |
207 | 221 | [rn/view {:style style/container}
|
208 | 222 | [floating-button-page/view
|
209 | 223 | {:footer-container-padding 0
|
|
214 | 228 | :background :blur
|
215 | 229 | :accessibility-label :top-bar}]
|
216 | 230 | :footer [footer
|
217 |
| - {:estimated-time-min estimated-time-min |
218 |
| - :native-currency-symbol native-currency-symbol |
219 |
| - :network network |
220 |
| - :account-color account-color |
221 |
| - :provider provider |
222 |
| - :loading-fees? loading-fees? |
223 |
| - :theme theme}] |
| 231 | + {:estimated-time-min estimated-time-min |
| 232 | + :network network |
| 233 | + :account-color account-color |
| 234 | + :provider provider |
| 235 | + :loading-fees? loading-fees? |
| 236 | + :theme theme}] |
224 | 237 | :gradient-cover? true
|
225 | 238 | :customization-color account-color}
|
226 | 239 | [:<>
|
|
0 commit comments