@rango-dev/widget-embedded 0.17.1-next.2 → 0.17.1-next.21

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 (374) hide show
  1. package/dist/QueueManager.d.ts +5 -2
  2. package/dist/QueueManager.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +0 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts +1 -6
  6. package/dist/components/AppRoutes.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
  12. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
  15. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  16. package/dist/components/Layout/Layout.d.ts.map +1 -1
  17. package/dist/components/Layout/Layout.types.d.ts +2 -2
  18. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  19. package/dist/components/NoResult/NoResult.d.ts +4 -0
  20. package/dist/components/NoResult/NoResult.d.ts.map +1 -0
  21. package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
  22. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
  23. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
  24. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
  25. package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
  26. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
  27. package/dist/components/NoResult/index.d.ts +2 -0
  28. package/dist/components/NoResult/index.d.ts.map +1 -0
  29. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  30. package/dist/components/Quote/Quote.d.ts +4 -0
  31. package/dist/components/Quote/Quote.d.ts.map +1 -0
  32. package/dist/components/Quote/Quote.styles.d.ts +1588 -0
  33. package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
  34. package/dist/components/Quote/Quote.types.d.ts +21 -0
  35. package/dist/components/Quote/Quote.types.d.ts.map +1 -0
  36. package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
  37. package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
  38. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
  39. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
  40. package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
  41. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
  42. package/dist/components/Quote/QuoteSummary.d.ts +11 -0
  43. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
  44. package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
  45. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
  46. package/dist/components/Quote/index.d.ts +4 -0
  47. package/dist/components/Quote/index.d.ts.map +1 -0
  48. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
  49. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
  50. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
  51. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
  52. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
  53. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
  54. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
  55. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
  56. package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
  57. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
  58. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +23 -0
  59. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
  60. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
  61. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
  62. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
  63. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
  64. package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
  65. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
  66. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  67. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  68. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  69. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  70. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  71. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  72. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  73. package/dist/components/UpdateUrl.d.ts +1 -6
  74. package/dist/components/UpdateUrl.d.ts.map +1 -1
  75. package/dist/components/WidgetEvents.d.ts.map +1 -1
  76. package/dist/constants/errors.d.ts +4 -4
  77. package/dist/constants/errors.d.ts.map +1 -1
  78. package/dist/constants/index.d.ts +1 -0
  79. package/dist/constants/index.d.ts.map +1 -1
  80. package/dist/constants/messages.d.ts +1 -1
  81. package/dist/constants/navigationRoutes.d.ts +1 -2
  82. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  83. package/dist/constants/searchParams.d.ts +2 -1
  84. package/dist/constants/searchParams.d.ts.map +1 -1
  85. package/dist/constants/warnings.d.ts +2 -2
  86. package/dist/constants/warnings.d.ts.map +1 -1
  87. package/dist/containers/App/App.d.ts +3 -0
  88. package/dist/containers/App/App.d.ts.map +1 -0
  89. package/dist/containers/App/App.styles.d.ts +158 -0
  90. package/dist/containers/App/App.styles.d.ts.map +1 -0
  91. package/dist/containers/App/index.d.ts +2 -0
  92. package/dist/containers/App/index.d.ts.map +1 -0
  93. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
  94. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
  95. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +788 -0
  96. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
  97. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +20 -0
  98. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
  99. package/dist/containers/QuoteInfo/index.d.ts +2 -0
  100. package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
  101. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  102. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  103. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  104. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  105. package/dist/containers/Wallets/index.d.ts +2 -0
  106. package/dist/containers/Wallets/index.d.ts.map +1 -0
  107. package/dist/containers/Widget/Widget.d.ts +5 -0
  108. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  109. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  110. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  111. package/dist/containers/Widget/index.d.ts +3 -0
  112. package/dist/containers/Widget/index.d.ts.map +1 -0
  113. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  114. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  115. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +14 -0
  116. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  117. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  118. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  119. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  120. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  121. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  122. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  123. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  124. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  125. package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
  126. package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
  127. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
  128. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
  129. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +19 -0
  130. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
  131. package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
  132. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
  133. package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
  134. package/dist/hooks/useFetchQuote.d.ts.map +1 -0
  135. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  136. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  137. package/dist/hooks/useLanguage.d.ts +1 -1
  138. package/dist/hooks/useLanguage.d.ts.map +1 -1
  139. package/dist/hooks/useNavigateBack.d.ts +1 -3
  140. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  141. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  142. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  143. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  144. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +5 -7
  145. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  146. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
  147. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  148. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
  149. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  150. package/dist/hooks/useSwapInput.d.ts +4 -2
  151. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  152. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  153. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  154. package/dist/hooks/useWalletList.d.ts.map +1 -1
  155. package/dist/index.d.ts +13 -5
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +1 -1
  158. package/dist/index.js.map +4 -4
  159. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  160. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  161. package/dist/pages/HistoryPage.d.ts.map +1 -1
  162. package/dist/pages/Home.d.ts.map +1 -1
  163. package/dist/pages/LanguagePage.d.ts.map +1 -1
  164. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  165. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  166. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  167. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  168. package/dist/pages/SettingsPage.d.ts +1 -6
  169. package/dist/pages/SettingsPage.d.ts.map +1 -1
  170. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  171. package/dist/pages/ThemePage.d.ts.map +1 -1
  172. package/dist/pages/WalletsPage.d.ts +1 -8
  173. package/dist/pages/WalletsPage.d.ts.map +1 -1
  174. package/dist/store/AppStore.d.ts +11 -0
  175. package/dist/store/AppStore.d.ts.map +1 -0
  176. package/dist/store/app.d.ts +5 -23
  177. package/dist/store/app.d.ts.map +1 -1
  178. package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
  179. package/dist/store/quote.d.ts.map +1 -0
  180. package/dist/store/settings.d.ts +3 -2
  181. package/dist/store/settings.d.ts.map +1 -1
  182. package/dist/store/slices/config.d.ts +3 -2
  183. package/dist/store/slices/config.d.ts.map +1 -1
  184. package/dist/store/slices/data.d.ts +3 -0
  185. package/dist/store/slices/data.d.ts.map +1 -1
  186. package/dist/store/wallets.d.ts +5 -4
  187. package/dist/store/wallets.d.ts.map +1 -1
  188. package/dist/types/config.d.ts +19 -5
  189. package/dist/types/config.d.ts.map +1 -1
  190. package/dist/types/index.d.ts +1 -1
  191. package/dist/types/index.d.ts.map +1 -1
  192. package/dist/types/quote.d.ts +82 -0
  193. package/dist/types/quote.d.ts.map +1 -0
  194. package/dist/types/swap.d.ts +3 -13
  195. package/dist/types/swap.d.ts.map +1 -1
  196. package/dist/utils/colors.d.ts.map +1 -1
  197. package/dist/utils/configs.d.ts +1 -0
  198. package/dist/utils/configs.d.ts.map +1 -1
  199. package/dist/utils/meta.d.ts +2 -1
  200. package/dist/utils/meta.d.ts.map +1 -1
  201. package/dist/utils/numbers.d.ts +1 -1
  202. package/dist/utils/numbers.d.ts.map +1 -1
  203. package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
  204. package/dist/utils/quote.d.ts.map +1 -0
  205. package/dist/utils/settings.d.ts +3 -2
  206. package/dist/utils/settings.d.ts.map +1 -1
  207. package/dist/utils/swap.d.ts +34 -23
  208. package/dist/utils/swap.d.ts.map +1 -1
  209. package/dist/utils/wallets.d.ts +2 -2
  210. package/dist/utils/wallets.d.ts.map +1 -1
  211. package/package.json +6 -6
  212. package/src/QueueManager.tsx +18 -17
  213. package/src/components/AppRouter.tsx +8 -32
  214. package/src/components/AppRoutes.tsx +57 -69
  215. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  216. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  217. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
  218. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +39 -45
  219. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
  220. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  221. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  222. package/src/components/Layout/Layout.tsx +10 -7
  223. package/src/components/Layout/Layout.types.ts +2 -2
  224. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  225. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  226. package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +23 -16
  227. package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
  228. package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
  229. package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
  230. package/src/components/NoResult/index.ts +1 -0
  231. package/src/components/NotificationContent/NotificationContent.tsx +5 -3
  232. package/src/components/Quote/Quote.styles.ts +239 -0
  233. package/src/components/Quote/Quote.tsx +413 -0
  234. package/src/components/Quote/Quote.types.ts +15 -0
  235. package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
  236. package/src/components/Quote/QuoteSkeleton.tsx +108 -0
  237. package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
  238. package/src/components/Quote/QuoteSummary.styles.ts +15 -0
  239. package/src/components/Quote/QuoteSummary.tsx +46 -0
  240. package/src/components/Quote/index.ts +3 -0
  241. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
  242. package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +4 -4
  243. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +74 -0
  244. package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +8 -1
  245. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
  246. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +25 -0
  247. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
  248. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
  249. package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
  250. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
  251. package/src/components/SwapDetails/SwapDetails.tsx +17 -24
  252. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  253. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  254. package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
  255. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
  256. package/src/components/SwitchFromAndTo.tsx +2 -2
  257. package/src/components/TokenList/TokenList.styles.ts +14 -2
  258. package/src/components/TokenList/TokenList.tsx +6 -7
  259. package/src/components/UpdateUrl.tsx +36 -29
  260. package/src/components/WidgetEvents.tsx +4 -2
  261. package/src/constants/errors.ts +17 -15
  262. package/src/constants/index.ts +1 -0
  263. package/src/constants/messages.ts +1 -1
  264. package/src/constants/navigationRoutes.ts +7 -8
  265. package/src/constants/searchParams.ts +1 -0
  266. package/src/constants/warnings.ts +7 -7
  267. package/src/containers/App/App.styles.ts +18 -0
  268. package/src/containers/App/App.tsx +55 -0
  269. package/src/containers/App/index.ts +1 -0
  270. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +31 -0
  271. package/src/containers/QuoteInfo/QuoteInfo.tsx +98 -0
  272. package/src/containers/QuoteInfo/QuoteInfo.types.ts +20 -0
  273. package/src/containers/QuoteInfo/index.ts +1 -0
  274. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
  275. package/src/containers/Wallets/Wallets.types.ts +12 -0
  276. package/src/containers/Wallets/index.ts +1 -0
  277. package/src/containers/Widget/Widget.tsx +19 -0
  278. package/src/containers/Widget/Widget.types.ts +5 -0
  279. package/src/containers/Widget/index.ts +2 -0
  280. package/src/containers/WidgetInfo/WidgetInfo.tsx +47 -0
  281. package/src/containers/WidgetInfo/WidgetInfo.types.ts +14 -0
  282. package/src/containers/WidgetInfo/index.ts +1 -0
  283. package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
  284. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  285. package/src/containers/WidgetProvider/index.ts +1 -0
  286. package/src/hooks/useConfirmSwap/index.ts +1 -0
  287. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +172 -0
  288. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +137 -0
  289. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
  290. package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
  291. package/src/hooks/useForceAutoConnect.ts +27 -0
  292. package/src/hooks/useLanguage.ts +2 -2
  293. package/src/hooks/useNavigateBack.ts +3 -52
  294. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  295. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
  296. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
  297. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
  298. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +13 -4
  299. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
  300. package/src/hooks/useSwapInput.ts +139 -46
  301. package/src/hooks/useSyncStoresWithConfig.ts +22 -19
  302. package/src/hooks/useWalletList.ts +3 -5
  303. package/src/index.ts +14 -3
  304. package/src/pages/ConfirmSwapPage.tsx +95 -248
  305. package/src/pages/HistoryPage.tsx +1 -5
  306. package/src/pages/Home.tsx +75 -270
  307. package/src/pages/LanguagePage.tsx +0 -5
  308. package/src/pages/LiquiditySourcePage.tsx +22 -35
  309. package/src/pages/SelectBlockchainPage.tsx +31 -24
  310. package/src/pages/SelectSwapItemsPage.tsx +9 -23
  311. package/src/pages/SettingsPage.tsx +8 -15
  312. package/src/pages/SwapDetailsPage.tsx +6 -7
  313. package/src/pages/ThemePage.tsx +0 -4
  314. package/src/pages/WalletsPage.tsx +4 -15
  315. package/src/services/httpService.ts +1 -1
  316. package/src/store/AppStore.tsx +35 -0
  317. package/src/store/app.ts +18 -6
  318. package/src/store/{bestRoute.ts → quote.ts} +68 -60
  319. package/src/store/settings.ts +7 -4
  320. package/src/store/slices/config.ts +25 -15
  321. package/src/store/slices/data.ts +64 -29
  322. package/src/store/wallets.ts +12 -8
  323. package/src/types/config.ts +20 -5
  324. package/src/types/index.ts +1 -1
  325. package/src/types/quote.ts +107 -0
  326. package/src/types/swap.ts +3 -12
  327. package/src/utils/colors.ts +2 -1
  328. package/src/utils/configs.ts +2 -1
  329. package/src/utils/meta.ts +8 -1
  330. package/src/utils/numbers.ts +1 -1
  331. package/src/utils/quote.ts +338 -0
  332. package/src/utils/settings.ts +8 -7
  333. package/src/utils/swap.ts +153 -116
  334. package/src/utils/wallets.ts +29 -17
  335. package/dist/Wallets.d.ts +0 -17
  336. package/dist/Wallets.d.ts.map +0 -1
  337. package/dist/Widget.d.ts +0 -9
  338. package/dist/Widget.d.ts.map +0 -1
  339. package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
  340. package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
  341. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
  342. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
  343. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
  344. package/dist/components/NoRoutes/index.d.ts +0 -2
  345. package/dist/components/NoRoutes/index.d.ts.map +0 -1
  346. package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
  347. package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
  348. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
  349. package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
  350. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
  351. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
  352. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
  353. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
  354. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
  355. package/dist/components/RouteErrors/index.d.ts +0 -2
  356. package/dist/components/RouteErrors/index.d.ts.map +0 -1
  357. package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
  358. package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
  359. package/dist/store/bestRoute.d.ts.map +0 -1
  360. package/dist/store/meta.d.ts +0 -23
  361. package/dist/store/meta.d.ts.map +0 -1
  362. package/dist/types/routing.d.ts +0 -65
  363. package/dist/types/routing.d.ts.map +0 -1
  364. package/dist/utils/routing.d.ts.map +0 -1
  365. package/src/Widget.tsx +0 -119
  366. package/src/components/NoRoutes/index.ts +0 -1
  367. package/src/components/RouteErrors/RouteErrors.tsx +0 -79
  368. package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
  369. package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
  370. package/src/components/RouteErrors/index.ts +0 -1
  371. package/src/hooks/useConfirmSwap.ts +0 -303
  372. package/src/store/meta.ts +0 -39
  373. package/src/types/routing.ts +0 -77
  374. package/src/utils/routing.ts +0 -321
@@ -1,7 +1,8 @@
1
+ import type { NoResultError, QuoteRequestFailed } from '../../types';
2
+
1
3
  export interface PropTypes {
2
4
  fetch: () => void;
3
- error: boolean;
4
- diagnosisMessage?: string;
5
+ error: NoResultError | QuoteRequestFailed | null;
5
6
  }
6
7
 
7
8
  type AlertAction = {
@@ -0,0 +1 @@
1
+ export { NoResult } from './NoResult';
@@ -10,7 +10,8 @@ import {
10
10
  import React from 'react';
11
11
  import { useNavigate } from 'react-router-dom';
12
12
 
13
- import { useMetaStore } from '../../store/meta';
13
+ import { navigationRoutes } from '../../constants/navigationRoutes';
14
+ import { useAppStore } from '../../store/AppStore';
14
15
  import { useNotificationStore } from '../../store/notification';
15
16
  import { useUiStore } from '../../store/ui';
16
17
 
@@ -26,14 +27,15 @@ export function NotificationContent() {
26
27
  const { getUnreadNotifications } = useNotificationStore();
27
28
 
28
29
  const notifications: Notification[] = getUnreadNotifications();
29
- const { tokens, blockchains } = useMetaStore.use.meta();
30
+ const blockchains = useAppStore().blockchains();
31
+ const tokens = useAppStore().tokens();
30
32
  const sortedNotification = notifications
31
33
  .sort((a, b) => b.creationTime - a.creationTime)
32
34
  .slice(0, MAX_NOTIFICATIONS_DISPLAYED);
33
35
 
34
36
  const handleOnClick = (requestId: Notification['requestId']) => {
35
37
  setSelectedSwap(requestId);
36
- navigate(`/swaps/${requestId}`);
38
+ navigate(`${navigationRoutes.swaps}/${requestId}`);
37
39
  };
38
40
 
39
41
  return (
@@ -0,0 +1,239 @@
1
+ import * as Collapsible from '@radix-ui/react-collapsible';
2
+ import { darkTheme, Image, styled } from '@rango-dev/ui';
3
+
4
+ import { CollapsibleContent } from '../ConfirmWalletsModal/ConfirmWallets.styles';
5
+
6
+ export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
7
+
8
+ export const QuoteContainer = styled(Collapsible.Root, {
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ alignItems: 'start',
12
+ overflowX: 'auto',
13
+ overflowY: 'hidden',
14
+ width: '100%',
15
+ borderRadius: '$xm',
16
+ cursor: 'default',
17
+ variants: {
18
+ recommended: {
19
+ true: {
20
+ $$color: '$colors$info300',
21
+ [`.${darkTheme} &`]: {
22
+ $$color: '$colors$secondary800',
23
+ },
24
+ backgroundColor: '$$color',
25
+ },
26
+ false: {
27
+ $$color: '$colors$neutral400',
28
+ [`.${darkTheme} &`]: {
29
+ $$color: '$colors$neutral200',
30
+ },
31
+ backgroundColor: '$$color',
32
+ },
33
+ },
34
+ },
35
+ '& .steps-details': {
36
+ padding: '$10 $15',
37
+ },
38
+ });
39
+
40
+ export const SummaryContainer = styled('div', {
41
+ borderRadius: '$xm',
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ alignItems: 'start',
45
+ justifyContent: 'space-between',
46
+ color: '$foreground',
47
+ cursor: 'pointer',
48
+ boxSizing: 'border-box',
49
+ position: 'relative',
50
+ variants: {
51
+ recommended: {
52
+ true: {
53
+ $$color: '$colors$info100',
54
+ [`.${darkTheme} &`]: {
55
+ $$color: '$colors$secondary600',
56
+ },
57
+ backgroundColor: '$$color',
58
+ '&:hover': {
59
+ backgroundColor: '$$color',
60
+ },
61
+ },
62
+ false: {
63
+ $$color: '$colors$neutral200',
64
+ [`.${darkTheme} &`]: {
65
+ $$color: '$colors$neutral500',
66
+ },
67
+ backgroundColor: '$$color',
68
+ '&:hover': {
69
+ backgroundColor: '$$color',
70
+ },
71
+ },
72
+ },
73
+ basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
74
+ listItem: {
75
+ true: {},
76
+ false: {},
77
+ },
78
+ },
79
+
80
+ compoundVariants: [
81
+ {
82
+ listItem: true,
83
+ recommended: true,
84
+ css: {
85
+ '&:hover': {
86
+ $$color: '$colors$secondary200',
87
+ [`.${darkTheme} &`]: {
88
+ $$color: '$colors$secondary700',
89
+ },
90
+ backgroundColor: '$$color',
91
+ },
92
+ },
93
+ },
94
+ {
95
+ listItem: true,
96
+ recommended: false,
97
+ css: {
98
+ '&:hover': {
99
+ $$color: '$colors$neutral300',
100
+ [`.${darkTheme} &`]: {
101
+ $$color: '$colors$neutral400',
102
+ },
103
+ backgroundColor: '$$color',
104
+ },
105
+ },
106
+ },
107
+ ],
108
+ '& .summary': {
109
+ width: '100%',
110
+ padding: '$15 $15 $10 $15',
111
+ cursor: 'default',
112
+ },
113
+ '& .basic-info': {
114
+ paddingTop: '$10',
115
+ display: 'flex',
116
+ alignItems: 'center',
117
+ '.usd-value': {
118
+ $$color: '$colors$neutral600',
119
+ [`.${darkTheme} &`]: {
120
+ $$color: '$colors$neutral700',
121
+ },
122
+ color: '$$color',
123
+ },
124
+ },
125
+ });
126
+
127
+ export const Chains = styled(Collapsible.Trigger, {
128
+ display: 'flex',
129
+ width: '100%',
130
+ justifyContent: 'space-between',
131
+ alignItems: 'center',
132
+ height: '$36',
133
+ padding: '$10 $15',
134
+ boxSizing: 'border-box',
135
+ cursor: 'pointer',
136
+ border: 'none',
137
+ outline: 'none',
138
+ backgroundColor: 'transparent',
139
+ variants: {
140
+ error: {
141
+ true: {
142
+ [`& ${Image}`]: {
143
+ border: '1px $warning500 solid',
144
+ borderRadius: '100%',
145
+ },
146
+ },
147
+ false: {
148
+ [`& ${Image}`]: {
149
+ border: '1px transparent solid',
150
+ borderRadius: '100%',
151
+ },
152
+ },
153
+ },
154
+ recommended: {
155
+ true: {
156
+ $$color: '$colors$info300',
157
+ [`.${darkTheme} &`]: {
158
+ $$color: '$colors$secondary800',
159
+ },
160
+ backgroundColor: '$$color',
161
+ },
162
+ false: {
163
+ $$color: '$colors$neutral400',
164
+ [`.${darkTheme} &`]: {
165
+ $$color: '$colors$neutral200',
166
+ },
167
+ backgroundColor: '$$color',
168
+ },
169
+ },
170
+ },
171
+ '& div:nth-child(1)': { display: 'flex' },
172
+ });
173
+
174
+ export const ChainImageContainer = styled('div', {
175
+ width: '18px',
176
+ height: '18px',
177
+ borderRadius: '100%',
178
+ border: '1.5px transparent solid',
179
+ display: 'flex',
180
+ justifyContent: 'center',
181
+ alignItems: 'center',
182
+ variants: {
183
+ state: {
184
+ error: {
185
+ borderColor: '$error500',
186
+ },
187
+ warning: { borderColor: '$warning500' },
188
+ },
189
+ },
190
+ });
191
+
192
+ export const Content = styled(CollapsibleContent, {
193
+ width: '100%',
194
+ });
195
+
196
+ export const IconContainer = styled('div', {
197
+ display: 'flex',
198
+ justifyContent: 'center',
199
+ alignItems: 'center',
200
+ padding: '$2',
201
+ transition: `all ${EXPANDABLE_QUOTE_TRANSITION_DURATION}ms ease`,
202
+ variants: {
203
+ orientation: {
204
+ down: {
205
+ transform: 'rotate(0)',
206
+ },
207
+ up: {
208
+ transform: 'rotate(180deg)',
209
+ },
210
+ },
211
+ },
212
+ });
213
+
214
+ export const Separator = styled('div', {
215
+ height: '$12',
216
+ marginLeft: '$10',
217
+ marginRight: '$10',
218
+ borderLeft: '1px solid $foreground',
219
+ });
220
+
221
+ export const HorizontalSeparator = styled('div', {
222
+ display: 'flex',
223
+ justifyContent: 'center',
224
+ margin: '0 $15',
225
+ borderTop: '1px solid',
226
+ $$color: '$colors$neutral300',
227
+ [`.${darkTheme} &`]: {
228
+ $$color: '$colors$neutral400',
229
+ },
230
+ borderColor: '$$color',
231
+ });
232
+
233
+ export const FrameIcon = styled('div', {
234
+ width: '$16',
235
+ height: '$16',
236
+ justifyContent: 'center',
237
+ alignItems: 'center',
238
+ display: 'flex',
239
+ });
@@ -0,0 +1,413 @@
1
+ import type { QuoteProps } from './Quote.types';
2
+ import type { Step } from '@rango-dev/ui';
3
+ import type { SwapResult } from 'rango-sdk';
4
+
5
+ import { i18n } from '@lingui/core';
6
+ import {
7
+ Alert,
8
+ ChevronDownIcon,
9
+ ChevronRightIcon,
10
+ Divider,
11
+ Image,
12
+ InfoIcon,
13
+ QuoteCost,
14
+ StepDetails,
15
+ TokenAmount,
16
+ Tooltip,
17
+ Typography,
18
+ } from '@rango-dev/ui';
19
+ import React, { useLayoutEffect, useRef, useState } from 'react';
20
+
21
+ import {
22
+ GAS_FEE_MAX_DECIMALS,
23
+ GAS_FEE_MIN_DECIMALS,
24
+ PERCENTAGE_CHANGE_MAX_DECIMALS,
25
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
26
+ TOKEN_AMOUNT_MAX_DECIMALS,
27
+ TOKEN_AMOUNT_MIN_DECIMALS,
28
+ USD_VALUE_MAX_DECIMALS,
29
+ USD_VALUE_MIN_DECIMALS,
30
+ } from '../../constants/routing';
31
+ import {
32
+ FooterAlert,
33
+ FooterStepAlarm,
34
+ } from '../../containers/QuoteInfo/QuoteInfo.styles';
35
+ import { useAppStore } from '../../store/AppStore';
36
+ import { QuoteErrorType, QuoteWarningType } from '../../types';
37
+ import { getContainer } from '../../utils/common';
38
+ import {
39
+ getBlockchainShortNameFor,
40
+ getSwapperDisplayName,
41
+ } from '../../utils/meta';
42
+ import {
43
+ numberToString,
44
+ secondsToString,
45
+ totalArrivalTime,
46
+ } from '../../utils/numbers';
47
+ import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
48
+ import { getTotalFeeInUsd } from '../../utils/swap';
49
+
50
+ import {
51
+ ChainImageContainer,
52
+ Chains,
53
+ Content,
54
+ EXPANDABLE_QUOTE_TRANSITION_DURATION,
55
+ FrameIcon,
56
+ HorizontalSeparator,
57
+ IconContainer,
58
+ QuoteContainer,
59
+ SummaryContainer,
60
+ } from './Quote.styles';
61
+ import { QuoteSummary } from './QuoteSummary';
62
+
63
+ export function Quote(props: QuoteProps) {
64
+ const {
65
+ quote,
66
+ input,
67
+ output,
68
+ error,
69
+ warning,
70
+ type,
71
+ recommended = true,
72
+ } = props;
73
+ const tokens = useAppStore().tokens();
74
+ const blockchains = useAppStore().blockchains();
75
+ const swappers = useAppStore().swappers();
76
+
77
+ const [expanded, setExpanded] = useState(props.expanded);
78
+ const quoteRef = useRef<HTMLButtonElement | null>(null);
79
+ const prevExpanded = useRef(expanded);
80
+ const totalFee = numberToString(
81
+ getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
82
+ GAS_FEE_MIN_DECIMALS,
83
+ GAS_FEE_MAX_DECIMALS
84
+ );
85
+ const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
86
+ const roundedInput = numberToString(
87
+ input.value,
88
+ TOKEN_AMOUNT_MIN_DECIMALS,
89
+ TOKEN_AMOUNT_MAX_DECIMALS
90
+ );
91
+ const roundedOutput = numberToString(
92
+ output.value,
93
+ TOKEN_AMOUNT_MIN_DECIMALS,
94
+ TOKEN_AMOUNT_MAX_DECIMALS
95
+ );
96
+ const roundedOutputUsdValue = output.usdValue
97
+ ? numberToString(
98
+ output.usdValue,
99
+ USD_VALUE_MIN_DECIMALS,
100
+ USD_VALUE_MAX_DECIMALS
101
+ )
102
+ : '';
103
+ const priceImpact = getPriceImpact(input.usdValue, output.usdValue ?? null);
104
+ const percentageChange = numberToString(
105
+ priceImpact,
106
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
107
+ PERCENTAGE_CHANGE_MAX_DECIMALS
108
+ );
109
+ const priceImpactWarningLevel = getPriceImpactLevel(priceImpact ?? 0);
110
+
111
+ const getQuoteSteps = (swaps: SwapResult[]): Step[] => {
112
+ return swaps.map((swap, index) => {
113
+ let stepState: 'error' | 'warning' | undefined = undefined;
114
+ const stepHasError =
115
+ (error?.type === QuoteErrorType.BRIDGE_LIMIT &&
116
+ error.swap.swapperId === swap.swapperId) ||
117
+ (error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE &&
118
+ error.recommendedSlippages?.has(index));
119
+ const stepHasWarning =
120
+ warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
121
+ warning.recommendedSlippages?.has(index);
122
+
123
+ if (stepHasError) {
124
+ stepState = 'error';
125
+ } else if (stepHasWarning) {
126
+ stepState = 'warning';
127
+ }
128
+
129
+ return {
130
+ swapper: {
131
+ displayName: getSwapperDisplayName(swap.swapperId, swappers),
132
+ image: swap.swapperLogo,
133
+ },
134
+ from: {
135
+ token: { displayName: swap.from.symbol, image: swap.from.logo },
136
+ chain: {
137
+ displayName: getBlockchainShortNameFor(
138
+ swap.from.blockchain,
139
+ blockchains
140
+ ),
141
+ image: swap.from.blockchainLogo,
142
+ },
143
+ price: {
144
+ value:
145
+ index === 0
146
+ ? numberToString(
147
+ input.value,
148
+ TOKEN_AMOUNT_MIN_DECIMALS,
149
+ TOKEN_AMOUNT_MAX_DECIMALS
150
+ )
151
+ : numberToString(
152
+ swap.fromAmount,
153
+ TOKEN_AMOUNT_MIN_DECIMALS,
154
+ TOKEN_AMOUNT_MAX_DECIMALS
155
+ ),
156
+ usdValue: numberToString(
157
+ (swap.from.usdPrice ?? 0) * parseFloat(swap.fromAmount),
158
+ USD_VALUE_MIN_DECIMALS,
159
+ USD_VALUE_MAX_DECIMALS
160
+ ),
161
+ },
162
+ },
163
+ to: {
164
+ token: { displayName: swap.to.symbol, image: swap.to.logo },
165
+ chain: {
166
+ displayName: getBlockchainShortNameFor(
167
+ swap.to.blockchain,
168
+ blockchains
169
+ ),
170
+ image: swap.to.blockchainLogo,
171
+ },
172
+ price: {
173
+ value: numberToString(
174
+ swap.toAmount,
175
+ TOKEN_AMOUNT_MIN_DECIMALS,
176
+ TOKEN_AMOUNT_MAX_DECIMALS
177
+ ),
178
+ usdValue: numberToString(
179
+ (swap.to.usdPrice ?? 0) * parseFloat(swap.toAmount),
180
+ USD_VALUE_MIN_DECIMALS,
181
+ USD_VALUE_MAX_DECIMALS
182
+ ),
183
+ },
184
+ },
185
+ state: stepState,
186
+ alerts:
187
+ stepHasError || stepHasWarning ? (
188
+ <FooterStepAlarm>
189
+ <Alert
190
+ type={stepHasError ? 'error' : 'warning'}
191
+ title={
192
+ error?.type === QuoteErrorType.BRIDGE_LIMIT
193
+ ? error?.recommendation
194
+ : i18n.t('Slippage Error:')
195
+ }
196
+ footer={
197
+ <FooterAlert>
198
+ {error?.type === QuoteErrorType.BRIDGE_LIMIT && (
199
+ <>
200
+ <Typography
201
+ size="xsmall"
202
+ variant="body"
203
+ color="neutral900">
204
+ {error.fromAmountRangeError}
205
+ </Typography>
206
+ <Divider direction="horizontal" size={8} />
207
+ <Typography
208
+ size="xsmall"
209
+ variant="body"
210
+ color="neutral900">
211
+ |
212
+ </Typography>
213
+ <Divider direction="horizontal" size={8} />
214
+ <Typography
215
+ size="xsmall"
216
+ variant="body"
217
+ color="neutral900">
218
+ {i18n.t({
219
+ id: 'Yours: {amount} {symbol}',
220
+ values: {
221
+ amount: numberToString(
222
+ swap.fromAmount,
223
+ TOKEN_AMOUNT_MIN_DECIMALS,
224
+ TOKEN_AMOUNT_MAX_DECIMALS
225
+ ),
226
+ symbol: swap?.from.symbol,
227
+ },
228
+ })}
229
+ </Typography>
230
+ </>
231
+ )}
232
+ {(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE ||
233
+ warning?.type ===
234
+ QuoteWarningType.INSUFFICIENT_SLIPPAGE) && (
235
+ <Typography
236
+ size="xsmall"
237
+ variant="body"
238
+ color="neutral900">
239
+ {i18n.t({
240
+ id: 'Minimum required slippage is {minRequiredSlippage}',
241
+ values: {
242
+ ...(error?.type ===
243
+ QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
244
+ minRequiredSlippage:
245
+ error.recommendedSlippages?.get(index),
246
+ }),
247
+ ...(warning?.type ===
248
+ QuoteWarningType.INSUFFICIENT_SLIPPAGE && {
249
+ minRequiredSlippage:
250
+ warning.recommendedSlippages?.get(index),
251
+ }),
252
+ },
253
+ })}
254
+ </Typography>
255
+ )}
256
+ </FooterAlert>
257
+ }
258
+ />
259
+ </FooterStepAlarm>
260
+ ) : undefined,
261
+ };
262
+ });
263
+ };
264
+ const steps = getQuoteSteps(quote.result?.swaps ?? []);
265
+ const numberOfSteps = steps.length;
266
+ const tooltipContainer = getContainer();
267
+
268
+ useLayoutEffect(() => {
269
+ if (expanded && !prevExpanded.current && quoteRef.current) {
270
+ setTimeout(() => {
271
+ quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
272
+ }, EXPANDABLE_QUOTE_TRANSITION_DURATION);
273
+ }
274
+ prevExpanded.current = expanded;
275
+ }, [expanded, prevExpanded]);
276
+
277
+ return (
278
+ <>
279
+ <SummaryContainer
280
+ recommended={recommended}
281
+ listItem={type === 'list-item'}
282
+ basic={type === 'basic'}>
283
+ <div className="summary">
284
+ <QuoteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
285
+ {type === 'basic' && (
286
+ <div className="basic-info">
287
+ <FrameIcon>
288
+ <InfoIcon size={12} color="gray" />
289
+ </FrameIcon>
290
+ <Typography
291
+ size="small"
292
+ variant="body"
293
+ style={{ letterSpacing: 0.4 }}>
294
+ {`${roundedInput} ${
295
+ steps[0].from.token.displayName
296
+ } = ${roundedOutput} ${
297
+ steps[steps.length - 1].to.token.displayName
298
+ }`}
299
+ </Typography>
300
+ <Typography
301
+ color="$neutral600"
302
+ ml={2}
303
+ size="xsmall"
304
+ variant="body">
305
+ {`($${roundedOutputUsdValue})`}
306
+ </Typography>
307
+ </div>
308
+ )}
309
+ {type === 'list-item' && (
310
+ <TokenAmount
311
+ type="output"
312
+ direction="vertical"
313
+ price={{ value: roundedOutput, usdValue: roundedOutputUsdValue }}
314
+ token={{
315
+ displayName: steps[numberOfSteps - 1].to.token.displayName,
316
+ image: steps[numberOfSteps - 1].to.token.image,
317
+ }}
318
+ chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
319
+ percentageChange={percentageChange}
320
+ warningLevel={priceImpactWarningLevel}
321
+ />
322
+ )}
323
+ {type === 'swap-preview' && (
324
+ <>
325
+ <QuoteSummary
326
+ from={steps[0].from}
327
+ to={steps[numberOfSteps - 1].to}
328
+ percentageChange={percentageChange}
329
+ warningLevel={priceImpactWarningLevel}
330
+ />
331
+ <Divider size={4} />
332
+ </>
333
+ )}
334
+ </div>
335
+ <QuoteContainer
336
+ recommended={recommended}
337
+ open={expanded}
338
+ onOpenChange={setExpanded}>
339
+ <Chains
340
+ ref={(ref) => (quoteRef.current = ref)}
341
+ recommended={recommended}
342
+ onClick={() => setExpanded((prevState) => !prevState)}>
343
+ <div>
344
+ {steps.map((step, index) => {
345
+ const key = `item-${index}`;
346
+ const arrow = (
347
+ <IconContainer>
348
+ <ChevronRightIcon
349
+ size={12}
350
+ color="black"
351
+ {...(step.state && {
352
+ color: step.state === 'error' ? 'error' : 'warning',
353
+ })}
354
+ />
355
+ </IconContainer>
356
+ );
357
+ return (
358
+ <React.Fragment key={key}>
359
+ <Tooltip
360
+ container={tooltipContainer}
361
+ side="bottom"
362
+ sideOffset={4}
363
+ content={step.from.chain.displayName}>
364
+ <ChainImageContainer
365
+ state={step.state || steps[index - 1]?.state}>
366
+ <Image src={step.from.chain.image} size={16} />
367
+ </ChainImageContainer>
368
+ </Tooltip>
369
+ {index === numberOfSteps - 1 && (
370
+ <>
371
+ {arrow}
372
+ <Tooltip
373
+ container={tooltipContainer}
374
+ side="bottom"
375
+ sideOffset={4}
376
+ content={step.to.chain.displayName}>
377
+ <ChainImageContainer state={step.state}>
378
+ <Image src={step.to.chain.image} size={16} />
379
+ </ChainImageContainer>
380
+ </Tooltip>
381
+ </>
382
+ )}
383
+ {index !== numberOfSteps - 1 && <>{arrow}</>}
384
+ </React.Fragment>
385
+ );
386
+ })}
387
+ </div>
388
+ <IconContainer orientation={expanded ? 'up' : 'down'}>
389
+ <ChevronDownIcon size={12} color="black" />
390
+ </IconContainer>
391
+ </Chains>
392
+ <Content open={expanded}>
393
+ <HorizontalSeparator />
394
+ <div className="steps-details">
395
+ {steps.map((step, index) => {
396
+ const key = `item-${index}`;
397
+ return (
398
+ <StepDetails
399
+ type="quote-details"
400
+ key={key}
401
+ step={step}
402
+ hasSeparator={index !== steps.length - 1}
403
+ state={step.state}
404
+ />
405
+ );
406
+ })}
407
+ </div>
408
+ </Content>
409
+ </QuoteContainer>
410
+ </SummaryContainer>
411
+ </>
412
+ );
413
+ }