@rango-dev/widget-embedded 0.17.1-next.9 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/QueueManager.d.ts +1 -2
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/Wallets.d.ts +0 -1
  5. package/dist/Wallets.d.ts.map +1 -1
  6. package/dist/Widget.d.ts +1 -1
  7. package/dist/Widget.d.ts.map +1 -1
  8. package/dist/components/AppRouter.d.ts +2 -0
  9. package/dist/components/AppRouter.d.ts.map +1 -1
  10. package/dist/components/AppRoutes.d.ts +6 -1
  11. package/dist/components/AppRoutes.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
  13. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  16. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +3 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  18. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
  20. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  21. package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
  22. package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
  23. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
  24. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
  25. package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
  26. package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
  27. package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
  28. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
  29. package/dist/components/NoRoutes/index.d.ts +2 -0
  30. package/dist/components/NoRoutes/index.d.ts.map +1 -0
  31. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  32. package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
  33. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
  34. package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
  35. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
  36. package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
  37. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
  38. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
  39. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
  40. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
  41. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
  42. package/dist/components/RouteErrors/index.d.ts +2 -0
  43. package/dist/components/RouteErrors/index.d.ts.map +1 -0
  44. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  45. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  46. package/dist/components/UpdateUrl.d.ts +6 -1
  47. package/dist/components/UpdateUrl.d.ts.map +1 -1
  48. package/dist/components/WidgetEvents.d.ts.map +1 -1
  49. package/dist/constants/errors.d.ts +4 -4
  50. package/dist/constants/errors.d.ts.map +1 -1
  51. package/dist/constants/messages.d.ts +1 -1
  52. package/dist/constants/searchParams.d.ts +1 -2
  53. package/dist/constants/searchParams.d.ts.map +1 -1
  54. package/dist/constants/warnings.d.ts +2 -2
  55. package/dist/constants/warnings.d.ts.map +1 -1
  56. package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
  57. package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
  58. package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
  59. package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
  60. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  61. package/dist/hooks/useSwapInput.d.ts +2 -4
  62. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  63. package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
  64. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  65. package/dist/hooks/useWalletList.d.ts.map +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.js.map +4 -4
  68. package/dist/pages/ConfirmSwapPage.d.ts +6 -1
  69. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  70. package/dist/pages/Home.d.ts.map +1 -1
  71. package/dist/pages/LiquiditySourcePage.d.ts +2 -1
  72. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  73. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  74. package/dist/pages/SettingsPage.d.ts +6 -1
  75. package/dist/pages/SettingsPage.d.ts.map +1 -1
  76. package/dist/pages/WalletsPage.d.ts +8 -1
  77. package/dist/pages/WalletsPage.d.ts.map +1 -1
  78. package/dist/store/app.d.ts +23 -5
  79. package/dist/store/app.d.ts.map +1 -1
  80. package/dist/store/{quote.d.ts → bestRoute.d.ts} +27 -39
  81. package/dist/store/bestRoute.d.ts.map +1 -0
  82. package/dist/store/meta.d.ts +23 -0
  83. package/dist/store/meta.d.ts.map +1 -0
  84. package/dist/store/settings.d.ts +2 -3
  85. package/dist/store/settings.d.ts.map +1 -1
  86. package/dist/store/slices/config.d.ts +2 -3
  87. package/dist/store/slices/config.d.ts.map +1 -1
  88. package/dist/store/slices/data.d.ts +0 -3
  89. package/dist/store/slices/data.d.ts.map +1 -1
  90. package/dist/store/wallets.d.ts +4 -5
  91. package/dist/store/wallets.d.ts.map +1 -1
  92. package/dist/types/config.d.ts +5 -5
  93. package/dist/types/config.d.ts.map +1 -1
  94. package/dist/types/index.d.ts +1 -1
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/types/routing.d.ts +65 -0
  97. package/dist/types/routing.d.ts.map +1 -0
  98. package/dist/utils/numbers.d.ts +1 -1
  99. package/dist/utils/numbers.d.ts.map +1 -1
  100. package/dist/utils/{quote.d.ts → routing.d.ts} +12 -16
  101. package/dist/utils/routing.d.ts.map +1 -0
  102. package/dist/utils/settings.d.ts +2 -3
  103. package/dist/utils/settings.d.ts.map +1 -1
  104. package/dist/utils/swap.d.ts +22 -25
  105. package/dist/utils/swap.d.ts.map +1 -1
  106. package/dist/utils/wallets.d.ts +2 -2
  107. package/dist/utils/wallets.d.ts.map +1 -1
  108. package/package.json +8 -8
  109. package/src/QueueManager.tsx +14 -14
  110. package/src/Wallets.tsx +15 -35
  111. package/src/Widget.tsx +24 -11
  112. package/src/components/AppRouter.tsx +5 -6
  113. package/src/components/AppRoutes.tsx +39 -6
  114. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  115. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  116. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
  117. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +40 -28
  118. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
  119. package/src/components/ConfirmWalletsModal/WalletList.tsx +5 -6
  120. package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
  121. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  122. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  123. package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +9 -16
  124. package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
  125. package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +12 -10
  126. package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
  127. package/src/components/NoRoutes/index.ts +1 -0
  128. package/src/components/NotificationContent/NotificationContent.tsx +2 -3
  129. package/src/components/RouteErrors/RouteErrors.tsx +79 -0
  130. package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
  131. package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
  132. package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +3 -3
  133. package/src/components/RouteErrors/index.ts +1 -0
  134. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
  135. package/src/components/SwapDetails/SwapDetails.tsx +22 -18
  136. package/src/components/SwitchFromAndTo.tsx +2 -2
  137. package/src/components/TokenList/TokenList.tsx +6 -5
  138. package/src/components/UpdateUrl.tsx +26 -36
  139. package/src/components/WidgetEvents.tsx +2 -4
  140. package/src/constants/errors.ts +10 -8
  141. package/src/constants/messages.ts +1 -1
  142. package/src/constants/searchParams.ts +0 -1
  143. package/src/constants/warnings.ts +7 -7
  144. package/src/hooks/useConfirmSwap.ts +303 -0
  145. package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
  146. package/src/hooks/useNavigateBack.ts +3 -3
  147. package/src/hooks/useSwapInput.ts +23 -58
  148. package/src/hooks/useSyncStoresWithConfig.ts +19 -22
  149. package/src/hooks/useWalletList.ts +5 -3
  150. package/src/pages/ConfirmSwapPage.tsx +235 -58
  151. package/src/pages/HistoryPage.tsx +1 -1
  152. package/src/pages/Home.tsx +247 -58
  153. package/src/pages/LanguagePage.tsx +1 -1
  154. package/src/pages/LiquiditySourcePage.tsx +32 -23
  155. package/src/pages/SelectBlockchainPage.tsx +7 -6
  156. package/src/pages/SelectSwapItemsPage.tsx +5 -5
  157. package/src/pages/SettingsPage.tsx +13 -9
  158. package/src/pages/SwapDetailsPage.tsx +3 -3
  159. package/src/pages/ThemePage.tsx +1 -1
  160. package/src/pages/WalletsPage.tsx +12 -5
  161. package/src/store/app.ts +6 -18
  162. package/src/store/{quote.ts → bestRoute.ts} +60 -68
  163. package/src/store/meta.ts +39 -0
  164. package/src/store/settings.ts +4 -7
  165. package/src/store/slices/config.ts +15 -25
  166. package/src/store/slices/data.ts +29 -64
  167. package/src/store/wallets.ts +8 -11
  168. package/src/types/config.ts +5 -5
  169. package/src/types/index.ts +1 -1
  170. package/src/types/routing.ts +77 -0
  171. package/src/utils/numbers.ts +1 -1
  172. package/src/utils/routing.ts +321 -0
  173. package/src/utils/settings.ts +7 -8
  174. package/src/utils/swap.ts +85 -113
  175. package/src/utils/wallets.ts +17 -29
  176. package/dist/components/NoResult/NoResult.d.ts +0 -4
  177. package/dist/components/NoResult/NoResult.d.ts.map +0 -1
  178. package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
  179. package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
  180. package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
  181. package/dist/components/NoResult/index.d.ts +0 -2
  182. package/dist/components/NoResult/index.d.ts.map +0 -1
  183. package/dist/components/Quote/Quote.d.ts +0 -4
  184. package/dist/components/Quote/Quote.d.ts.map +0 -1
  185. package/dist/components/Quote/Quote.styles.d.ts +0 -1429
  186. package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
  187. package/dist/components/Quote/Quote.types.d.ts +0 -22
  188. package/dist/components/Quote/Quote.types.d.ts.map +0 -1
  189. package/dist/components/Quote/QuoteSkeleton.d.ts +0 -4
  190. package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
  191. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +0 -319
  192. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
  193. package/dist/components/Quote/QuoteSkeleton.types.d.ts +0 -6
  194. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
  195. package/dist/components/Quote/QuoteSummary.d.ts +0 -11
  196. package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
  197. package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -158
  198. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
  199. package/dist/components/Quote/index.d.ts +0 -4
  200. package/dist/components/Quote/index.d.ts.map +0 -1
  201. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
  202. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
  203. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
  204. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
  205. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
  206. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
  207. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
  208. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
  209. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
  210. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -22
  211. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
  212. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
  213. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
  214. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
  215. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
  216. package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
  217. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
  218. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
  219. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
  220. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -472
  221. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
  222. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -17
  223. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
  224. package/dist/containers/QuoteInfo/index.d.ts +0 -2
  225. package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
  226. package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
  227. package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
  228. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
  229. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
  230. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -16
  231. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
  232. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
  233. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  234. package/dist/hooks/useForceAutoConnect.d.ts +0 -2
  235. package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
  236. package/dist/store/AppStore.d.ts +0 -11
  237. package/dist/store/AppStore.d.ts.map +0 -1
  238. package/dist/store/quote.d.ts.map +0 -1
  239. package/dist/types/quote.d.ts +0 -82
  240. package/dist/types/quote.d.ts.map +0 -1
  241. package/dist/utils/quote.d.ts.map +0 -1
  242. package/src/components/NoResult/index.ts +0 -1
  243. package/src/components/Quote/Quote.styles.ts +0 -212
  244. package/src/components/Quote/Quote.tsx +0 -345
  245. package/src/components/Quote/Quote.types.ts +0 -16
  246. package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
  247. package/src/components/Quote/QuoteSkeleton.tsx +0 -108
  248. package/src/components/Quote/QuoteSkeleton.types.ts +0 -5
  249. package/src/components/Quote/QuoteSummary.styles.ts +0 -15
  250. package/src/components/Quote/QuoteSummary.tsx +0 -46
  251. package/src/components/Quote/index.ts +0 -3
  252. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
  253. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -67
  254. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
  255. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -24
  256. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
  257. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
  258. package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
  259. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  260. package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -97
  261. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -17
  262. package/src/containers/QuoteInfo/index.ts +0 -1
  263. package/src/hooks/useConfirmSwap/index.ts +0 -1
  264. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -168
  265. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -136
  266. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
  267. package/src/hooks/useForceAutoConnect.ts +0 -27
  268. package/src/store/AppStore.tsx +0 -35
  269. package/src/types/quote.ts +0 -107
  270. package/src/utils/quote.ts +0 -338
  271. /package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +0 -0
@@ -1,108 +0,0 @@
1
- import type { PropTypes } from './QuoteSkeleton.types';
2
-
3
- import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
4
- import React from 'react';
5
-
6
- import { Container, StepSeparator } from './QuoteSkeleton.styles';
7
-
8
- function StepSkeleton(props: { separator?: boolean }) {
9
- const { separator = true } = props;
10
- return (
11
- <>
12
- <div className="step__title">
13
- <Skeleton height={22} width={22} variant="circular" />
14
- <Divider direction="horizontal" size={8} />
15
- <Skeleton height={15} width={148} variant="rounded" />
16
- </div>
17
- <div className="step__content">
18
- <StepSeparator hideSeparator={!separator} />
19
- <div className="step__tokens">
20
- <div className="step__token-info">
21
- <ChainToken size="small" loading chainImage="" tokenImage="" />
22
- <Divider direction="horizontal" size={8} />
23
- <Skeleton height={12} width={76} variant="rounded" />
24
- </div>
25
- <div className="step__icon-container">
26
- <NextIcon color="gray" size={16} />
27
- </div>
28
- <div className="step__token-info">
29
- <ChainToken size="small" loading chainImage="" tokenImage="" />
30
- <Divider direction="horizontal" size={8} />
31
- <Skeleton height={12} width={76} variant="rounded" />
32
- </div>
33
- </div>
34
- </div>
35
- </>
36
- );
37
- }
38
-
39
- export function QuoteSkeleton(props: PropTypes) {
40
- const { type, expanded, tag = false } = props;
41
- const quoteSummary = (
42
- <div className="quote-summary">
43
- <div className="token-amount">
44
- <ChainToken loading size="medium" chainImage="" tokenImage="" />
45
- <Divider size={8} direction="horizontal" />
46
- <div className="token-amount__label">
47
- <Skeleton height={10} width={60} variant="rounded" />
48
- <Divider size={4} />
49
- <Skeleton height={15} width={148} variant="rounded" />
50
- </div>
51
- </div>
52
- <Skeleton height={12} width={64} variant="rounded" />
53
- </div>
54
- );
55
-
56
- return (
57
- <Container>
58
- <div className="cost-and-tag">
59
- <div className="cost">
60
- <Skeleton width={60} height={10} variant="rounded" />
61
- <Divider size={4} direction="horizontal" />
62
- <Skeleton width={60} height={10} variant="rounded" />
63
- <Divider size={4} direction="horizontal" />
64
- <Skeleton width={60} height={10} variant="rounded" />
65
- </div>
66
- {tag && <Skeleton height={22} width={100} variant="rounded" />}
67
- </div>
68
- {type === 'basic' && (
69
- <div className="basic-summary">
70
- <Skeleton height={15} width={148} variant="rounded" />
71
- </div>
72
- )}
73
- {type === 'list-item' && (
74
- <div className="output">
75
- <div className="output__token-info">
76
- <ChainToken loading size="medium" chainImage="" tokenImage="" />
77
- <Divider direction="horizontal" size={4} />
78
- <Skeleton height={15} width={150} variant="rounded" />
79
- </div>
80
- <Divider size={4} />
81
- <Skeleton height={10} width={184} variant="rounded" />
82
- </div>
83
- )}
84
- {type === 'swap-preview' && (
85
- <>
86
- <Divider size={4} />
87
- <div className="swap-preview">
88
- {quoteSummary}
89
- <div className="quote-summary__separator" />
90
- {quoteSummary}
91
- </div>
92
- </>
93
- )}
94
- <div className="chains">
95
- <Skeleton height={15} width={321} variant="rounded" />
96
- </div>
97
-
98
- {expanded && (
99
- <div className="steps">
100
- <Divider size={20} />
101
- <StepSkeleton />
102
- <StepSkeleton />
103
- <StepSkeleton separator={false} />
104
- </div>
105
- )}
106
- </Container>
107
- );
108
- }
@@ -1,5 +0,0 @@
1
- export type PropTypes = {
2
- type: 'basic' | 'list-item' | 'swap-preview';
3
- expanded?: boolean;
4
- tag?: boolean;
5
- };
@@ -1,15 +0,0 @@
1
- import { styled } from '@rango-dev/ui';
2
-
3
- export const Container = styled('div', {
4
- position: 'relative',
5
- display: 'flex',
6
- flexDirection: 'column',
7
- width: '100%',
8
- '& .separator': {
9
- height: '14px',
10
- marginLeft: '14px',
11
- position: 'absolute',
12
- borderLeft: '1px solid $foreground',
13
- top: '42%',
14
- },
15
- });
@@ -1,46 +0,0 @@
1
- import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
2
-
3
- import { TokenAmount } from '@rango-dev/ui';
4
- import React from 'react';
5
-
6
- import { Container } from './QuoteSummary.styles';
7
-
8
- type PropTypes = {
9
- from: Step['from'];
10
- to: Step['to'];
11
- percentageChange?: string | null;
12
- warningLevel: PriceImpactWarningLevel;
13
- };
14
-
15
- export function QuoteSummary(props: PropTypes) {
16
- const { from, to, percentageChange, warningLevel } = props;
17
- return (
18
- <Container>
19
- <TokenAmount
20
- direction="horizontal"
21
- label="Swap input"
22
- type="input"
23
- price={{ value: from.price.value, usdValue: from.price.usdValue }}
24
- token={{
25
- displayName: from.token.displayName,
26
- image: from.token.image,
27
- }}
28
- chain={{ image: from.chain.image }}
29
- />
30
- <div className="separator" />
31
- <TokenAmount
32
- direction="horizontal"
33
- label="Estimated output"
34
- type="output"
35
- price={{ value: to.price.value, usdValue: to.price.usdValue }}
36
- token={{
37
- displayName: to.token.displayName,
38
- image: to.token.image,
39
- }}
40
- chain={{ image: to.chain.image }}
41
- percentageChange={percentageChange}
42
- warningLevel={warningLevel}
43
- />
44
- </Container>
45
- );
46
- }
@@ -1,3 +0,0 @@
1
- export { Quote } from './Quote';
2
- export { QuoteSkeleton } from './QuoteSkeleton';
3
- export { QuoteSummary } from './QuoteSummary';
@@ -1,107 +0,0 @@
1
- import type { HighValueLossWarning } from '../../types';
2
-
3
- import { i18n } from '@lingui/core';
4
- import {
5
- Button,
6
- Divider,
7
- MessageBox,
8
- Modal,
9
- Typography,
10
- WarningIcon,
11
- } from '@rango-dev/ui';
12
- import React from 'react';
13
-
14
- import { errorMessages } from '../../constants/errors';
15
- import {
16
- GAS_FEE_MAX_DECIMALS,
17
- GAS_FEE_MIN_DECIMALS,
18
- PERCENTAGE_CHANGE_MAX_DECIMALS,
19
- PERCENTAGE_CHANGE_MIN_DECIMALS,
20
- USD_VALUE_MAX_DECIMALS,
21
- USD_VALUE_MIN_DECIMALS,
22
- } from '../../constants/routing';
23
- import { getContainer } from '../../utils/common';
24
- import { numberToString } from '../../utils/numbers';
25
-
26
- import { QuoteErrorsModalItem } from './QuoteErrorsModalItem';
27
- import { Flex } from './QuoteWarningsAndErrors.styles';
28
-
29
- type Props = {
30
- open: boolean;
31
- onClose: () => void;
32
- onConfirm: () => void;
33
- warning: HighValueLossWarning;
34
- };
35
-
36
- export function HighValueLossWarningModal(props: Props) {
37
- const { open, onClose, onConfirm, warning } = props;
38
- const type = warning.warningLevel === 'high' ? 'error' : 'warning';
39
- const highValueLossData = [
40
- {
41
- title: i18n.t('Swapping'),
42
- value: numberToString(
43
- warning.inputUsdValue,
44
- USD_VALUE_MIN_DECIMALS,
45
- USD_VALUE_MAX_DECIMALS
46
- ),
47
- },
48
- {
49
- title: i18n.t('Gas cost'),
50
- value: numberToString(
51
- warning.totalFee,
52
- GAS_FEE_MIN_DECIMALS,
53
- GAS_FEE_MAX_DECIMALS
54
- ),
55
- },
56
- {
57
- title: i18n.t('Receiving'),
58
- value: numberToString(
59
- warning.outputUsdValue,
60
- USD_VALUE_MIN_DECIMALS,
61
- USD_VALUE_MAX_DECIMALS
62
- ),
63
- },
64
- {
65
- title: i18n.t('Price impact'),
66
- value: numberToString(
67
- warning.priceImpact,
68
- PERCENTAGE_CHANGE_MIN_DECIMALS,
69
- PERCENTAGE_CHANGE_MAX_DECIMALS
70
- ),
71
- valueColor: `${type}500`,
72
- },
73
- ];
74
-
75
- return (
76
- <Modal open={open} onClose={onClose} container={getContainer()}>
77
- <MessageBox
78
- type={type}
79
- title={errorMessages().highValueLossError.impactTitle}
80
- description={errorMessages().highValueLossError.description}
81
- />
82
-
83
- <Flex>
84
- <Divider size={20} />
85
- <Typography size="small" variant="title">
86
- {i18n.t('Details')}
87
- </Typography>
88
- <Flex>
89
- {highValueLossData.map((item, index) => {
90
- const key = index;
91
- return <QuoteErrorsModalItem key={key} {...item} />;
92
- })}
93
- </Flex>
94
- </Flex>
95
-
96
- <Divider size={32} />
97
- <Button
98
- type="primary"
99
- size="large"
100
- prefix={<WarningIcon />}
101
- fullWidth
102
- onClick={onConfirm}>
103
- {errorMessages().highValueLossError.confirmMessage}
104
- </Button>
105
- </Modal>
106
- );
107
- }
@@ -1,67 +0,0 @@
1
- import type {
2
- BridgeLimitError,
3
- InsufficientSlippageError,
4
- QuoteWarning,
5
- } from '../../types';
6
-
7
- import { i18n } from '@lingui/core';
8
-
9
- import { errorMessages } from '../../constants/errors';
10
- import { QuoteErrorType, QuoteWarningType } from '../../types';
11
- import { getPriceImpactLevel } from '../../utils/quote';
12
-
13
- type AlertInfo = {
14
- alertType: 'error' | 'warning';
15
- title: string;
16
- action: 'show-info' | 'change-settings' | null;
17
- };
18
-
19
- export function makeAlerts(
20
- warning: QuoteWarning | null,
21
- error: BridgeLimitError | InsufficientSlippageError | null
22
- ): AlertInfo | null {
23
- const alertInfo: AlertInfo = {
24
- alertType: 'warning',
25
- title: '',
26
- action: 'show-info',
27
- };
28
- if (warning) {
29
- if (warning.type === QuoteWarningType.HIGH_VALUE_LOSS) {
30
- const warningLevel = getPriceImpactLevel(warning.priceImpact);
31
- if (warningLevel === 'high') {
32
- alertInfo.alertType = 'error';
33
- }
34
- alertInfo.title = errorMessages().highValueLossError.title;
35
- }
36
- if (warning.type === QuoteWarningType.UNKNOWN_PRICE) {
37
- alertInfo.title = errorMessages().unknownPriceError.title;
38
- }
39
- if (warning.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE) {
40
- alertInfo.title = i18n.t({
41
- id: 'minimum required slippage for this route: {minRequiredSlippage}',
42
- values: {
43
- minRequiredSlippage: warning.minRequiredSlippage,
44
- },
45
- });
46
- }
47
- if (warning.type === QuoteWarningType.HIGH_SLIPPAGE) {
48
- alertInfo.title = i18n.t('Caution, your slippage is high');
49
- }
50
- return alertInfo;
51
- }
52
- if (error) {
53
- alertInfo.alertType = 'error';
54
- if (error.type === QuoteErrorType.BRIDGE_LIMIT) {
55
- alertInfo.title = error.recommendation;
56
- alertInfo.action = null;
57
- }
58
-
59
- if (error.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE) {
60
- alertInfo.title = '';
61
- alertInfo.action = 'change-settings';
62
- }
63
-
64
- return alertInfo;
65
- }
66
- return null;
67
- }
@@ -1,103 +0,0 @@
1
- import type { PropTypes } from './QuoteWarningsAndErrors.types';
2
-
3
- import { i18n } from '@lingui/core';
4
- import { Alert, Button, InfoIcon } from '@rango-dev/ui';
5
- import React from 'react';
6
- import { useNavigate } from 'react-router-dom';
7
-
8
- import { navigationRoutes } from '../../constants/navigationRoutes';
9
- import { QuoteErrorType, QuoteWarningType } from '../../types';
10
- import { NoResult } from '../NoResult';
11
-
12
- import { HighValueLossWarningModal } from './HighValueLossWarningModal';
13
- import { makeAlerts } from './QuoteWarningsAndErrors.helpers';
14
- import { Action, Alerts } from './QuoteWarningsAndErrors.styles';
15
- import { SlippageWarningModal } from './SlippageWariningModal';
16
- import { UnknownPriceWarningModal } from './UnknownPriceWarningModal';
17
-
18
- export function QuoteWarningsAndErrors(props: PropTypes) {
19
- const {
20
- warning,
21
- error,
22
- refetchQuote,
23
- showWarningModal,
24
- onOpenWarningModal,
25
- onCloseWarningModal,
26
- onConfirmWarningModal,
27
- } = props;
28
-
29
- const navigate = useNavigate();
30
-
31
- const warningModalHandlers = {
32
- open: showWarningModal,
33
- onClose: onCloseWarningModal,
34
- onConfirm: onConfirmWarningModal,
35
- };
36
-
37
- const showNoResultMessage =
38
- error?.type === QuoteErrorType.NO_RESULT ||
39
- error?.type === QuoteErrorType.REQUEST_FAILED;
40
-
41
- const alertInfo = makeAlerts(
42
- warning,
43
- error?.type === QuoteErrorType.BRIDGE_LIMIT ||
44
- error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE
45
- ? error
46
- : null
47
- );
48
-
49
- const showAlerts = !!alertInfo;
50
-
51
- return (
52
- <>
53
- {showNoResultMessage && <NoResult error={error} fetch={refetchQuote} />}
54
-
55
- {showAlerts && (
56
- <Alerts>
57
- <Alert
58
- title={alertInfo.title}
59
- type={alertInfo.alertType}
60
- variant="alarm"
61
- action={
62
- alertInfo.action === 'show-info' ? (
63
- <Action onClick={onOpenWarningModal}>
64
- <InfoIcon size={12} color="gray" />
65
- </Action>
66
- ) : (
67
- <Button
68
- size="xsmall"
69
- type={'error'}
70
- onClick={() => navigate(navigationRoutes.settings)}>
71
- {i18n.t('Change Settings')}
72
- </Button>
73
- )
74
- }
75
- />
76
- </Alerts>
77
- )}
78
-
79
- {warning && (
80
- <>
81
- {warning.type === QuoteWarningType.HIGH_VALUE_LOSS && (
82
- <HighValueLossWarningModal
83
- {...warningModalHandlers}
84
- warning={warning}
85
- />
86
- )}
87
-
88
- {(warning.type === QuoteWarningType.HIGH_SLIPPAGE ||
89
- warning.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE) && (
90
- <SlippageWarningModal {...warningModalHandlers} warning={warning} />
91
- )}
92
-
93
- {warning.type === QuoteWarningType.UNKNOWN_PRICE && (
94
- <UnknownPriceWarningModal
95
- {...warningModalHandlers}
96
- warning={warning}
97
- />
98
- )}
99
- </>
100
- )}
101
- </>
102
- );
103
- }
@@ -1,24 +0,0 @@
1
- import type { QuoteError, QuoteWarning } from '../../types';
2
-
3
- export interface PropTypes {
4
- loading: boolean;
5
- error: QuoteError | null;
6
- warning: QuoteWarning | null;
7
- showWarningModal: boolean;
8
- refetchQuote: () => void;
9
- onOpenWarningModal: () => void;
10
- onCloseWarningModal: () => void;
11
- onConfirmWarningModal: () => void;
12
- }
13
-
14
- type ModalPropTypesKeys = keyof Omit<PropTypes, 'extraSpace' | 'loading'>;
15
-
16
- export type ModalPropTypes = Pick<PropTypes, ModalPropTypesKeys> & {
17
- open: boolean;
18
- };
19
-
20
- export interface ModalContentData {
21
- title: string;
22
- value: string;
23
- valueColor?: string;
24
- }
@@ -1,77 +0,0 @@
1
- import type {
2
- HighSlippageWarning,
3
- InsufficientSlippageWarning,
4
- } from '../../types';
5
-
6
- import { i18n } from '@lingui/core';
7
- import { Button, Divider, MessageBox, Modal, Typography } from '@rango-dev/ui';
8
- import React from 'react';
9
- import { useNavigate } from 'react-router-dom';
10
-
11
- import { navigationRoutes } from '../../constants/navigationRoutes';
12
- import { useSettingsStore } from '../../store/settings';
13
- import { QuoteWarningType } from '../../types';
14
- import { getContainer } from '../../utils/common';
15
-
16
- type PropsTypes = {
17
- open: boolean;
18
- onClose: () => void;
19
- onConfirm: () => void;
20
- warning: InsufficientSlippageWarning | HighSlippageWarning;
21
- };
22
-
23
- export function SlippageWarningModal(props: PropsTypes) {
24
- const { customSlippage, slippage } = useSettingsStore();
25
- const { open, onClose, onConfirm, warning } = props;
26
- const navigate = useNavigate();
27
- const userSlippage = customSlippage ?? slippage;
28
- return (
29
- <Modal
30
- anchor="bottom"
31
- open={open}
32
- prefix={
33
- <Button
34
- size="small"
35
- variant="ghost"
36
- onClick={() => navigate('/' + navigationRoutes.settings)}>
37
- <Typography variant="label" size="medium" color="$neutral900">
38
- {i18n.t('Change settings')}
39
- </Typography>
40
- </Button>
41
- }
42
- container={getContainer()}
43
- onClose={onClose}>
44
- <MessageBox
45
- type="warning"
46
- title={
47
- warning.type === QuoteWarningType.HIGH_SLIPPAGE
48
- ? i18n.t('High slippage')
49
- : i18n.t('Low slippage')
50
- }
51
- description={
52
- warning.type === QuoteWarningType.HIGH_SLIPPAGE
53
- ? i18n.t({
54
- id: ' Caution, your slippage is high (={userSlippage}). Your trade may be front run.',
55
- values: { userSlippage },
56
- })
57
- : i18n.t({
58
- id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
59
- values: {
60
- minRequiredSlippage: warning.minRequiredSlippage,
61
- },
62
- })
63
- }>
64
- <Divider size={18} />
65
- <Divider size={32} />
66
- <Button
67
- size="large"
68
- type="primary"
69
- variant="contained"
70
- fullWidth
71
- onClick={onConfirm}>
72
- {i18n.t('Confirm anyway')}
73
- </Button>
74
- </MessageBox>
75
- </Modal>
76
- );
77
- }
@@ -1,38 +0,0 @@
1
- import type { UnknownPriceWarning } from '../../types';
2
-
3
- import { Button, Divider, MessageBox, Modal, WarningIcon } from '@rango-dev/ui';
4
- import React from 'react';
5
-
6
- import { errorMessages } from '../../constants/errors';
7
- import { getContainer } from '../../utils/common';
8
-
9
- type Props = {
10
- open: boolean;
11
- onClose: () => void;
12
- onConfirm: () => void;
13
- warning: UnknownPriceWarning;
14
- };
15
-
16
- export function UnknownPriceWarningModal(props: Props) {
17
- const { open, onClose, onConfirm } = props;
18
-
19
- return (
20
- <Modal open={open} onClose={onClose} container={getContainer()}>
21
- <MessageBox
22
- type="warning"
23
- title={errorMessages().unknownPriceError.impactTitle}
24
- description={errorMessages().unknownPriceError.description}
25
- />
26
-
27
- <Divider size={32} />
28
- <Button
29
- type="primary"
30
- size="large"
31
- prefix={<WarningIcon />}
32
- fullWidth
33
- onClick={onConfirm}>
34
- {errorMessages().unknownPriceError.confirmMessage}
35
- </Button>
36
- </Modal>
37
- );
38
- }
@@ -1 +0,0 @@
1
- export { QuoteWarningsAndErrors } from './QuoteWarningsAndErrors';
@@ -1,15 +0,0 @@
1
- import { styled } from '@rango-dev/ui';
2
-
3
- export const QuoteContainer = styled('div', {
4
- width: '100%',
5
- paddingTop: '$2',
6
- });
7
-
8
- export const FooterStepAlarm = styled('div', {
9
- paddingBottom: '$15',
10
- });
11
-
12
- export const FooterAlert = styled('div', {
13
- width: '100%',
14
- display: 'flex',
15
- });