@rango-dev/widget-embedded 0.17.1-next.0 → 0.17.1-next.10

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 (317) 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/NoResult/NoResult.d.ts +4 -0
  17. package/dist/components/NoResult/NoResult.d.ts.map +1 -0
  18. package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
  19. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
  20. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
  21. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
  22. package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
  23. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
  24. package/dist/components/NoResult/index.d.ts +2 -0
  25. package/dist/components/NoResult/index.d.ts.map +1 -0
  26. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  27. package/dist/components/Quote/Quote.d.ts +4 -0
  28. package/dist/components/Quote/Quote.d.ts.map +1 -0
  29. package/dist/components/Quote/Quote.styles.d.ts +1429 -0
  30. package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
  31. package/dist/components/Quote/Quote.types.d.ts +22 -0
  32. package/dist/components/Quote/Quote.types.d.ts.map +1 -0
  33. package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
  34. package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
  35. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
  36. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
  37. package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
  38. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
  39. package/dist/components/Quote/QuoteSummary.d.ts +11 -0
  40. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
  41. package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
  42. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
  43. package/dist/components/Quote/index.d.ts +4 -0
  44. package/dist/components/Quote/index.d.ts.map +1 -0
  45. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
  46. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
  47. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
  48. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
  49. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
  50. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
  51. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
  52. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
  53. package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
  54. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
  55. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +22 -0
  56. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
  57. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
  58. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
  59. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
  60. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
  61. package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
  62. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
  63. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  64. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  65. package/dist/components/UpdateUrl.d.ts +1 -6
  66. package/dist/components/UpdateUrl.d.ts.map +1 -1
  67. package/dist/components/WidgetEvents.d.ts.map +1 -1
  68. package/dist/constants/errors.d.ts +4 -4
  69. package/dist/constants/errors.d.ts.map +1 -1
  70. package/dist/constants/messages.d.ts +1 -1
  71. package/dist/constants/searchParams.d.ts +2 -1
  72. package/dist/constants/searchParams.d.ts.map +1 -1
  73. package/dist/constants/warnings.d.ts +2 -2
  74. package/dist/constants/warnings.d.ts.map +1 -1
  75. package/dist/containers/App/App.d.ts +3 -0
  76. package/dist/containers/App/App.d.ts.map +1 -0
  77. package/dist/containers/App/App.styles.d.ts +158 -0
  78. package/dist/containers/App/App.styles.d.ts.map +1 -0
  79. package/dist/containers/App/index.d.ts +2 -0
  80. package/dist/containers/App/index.d.ts.map +1 -0
  81. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
  82. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
  83. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +472 -0
  84. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
  85. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +17 -0
  86. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
  87. package/dist/containers/QuoteInfo/index.d.ts +2 -0
  88. package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
  89. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  90. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  91. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  92. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  93. package/dist/containers/Wallets/index.d.ts +2 -0
  94. package/dist/containers/Wallets/index.d.ts.map +1 -0
  95. package/dist/containers/Widget/Widget.d.ts +5 -0
  96. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  97. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  98. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  99. package/dist/containers/Widget/index.d.ts +3 -0
  100. package/dist/containers/Widget/index.d.ts.map +1 -0
  101. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  102. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  103. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +5 -0
  104. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  105. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  106. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  107. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  108. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  109. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  110. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  111. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  112. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  113. package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
  114. package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
  115. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
  116. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
  117. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +16 -0
  118. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
  119. package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
  120. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
  121. package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
  122. package/dist/hooks/useFetchQuote.d.ts.map +1 -0
  123. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  124. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  125. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  126. package/dist/hooks/useSwapInput.d.ts +4 -2
  127. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  128. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  129. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  130. package/dist/hooks/useWalletList.d.ts.map +1 -1
  131. package/dist/index.d.ts +10 -4
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +1 -1
  134. package/dist/index.js.map +4 -4
  135. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  136. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  137. package/dist/pages/Home.d.ts.map +1 -1
  138. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  139. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  140. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  141. package/dist/pages/SettingsPage.d.ts +1 -6
  142. package/dist/pages/SettingsPage.d.ts.map +1 -1
  143. package/dist/pages/WalletsPage.d.ts +1 -8
  144. package/dist/pages/WalletsPage.d.ts.map +1 -1
  145. package/dist/store/AppStore.d.ts +11 -0
  146. package/dist/store/AppStore.d.ts.map +1 -0
  147. package/dist/store/app.d.ts +5 -23
  148. package/dist/store/app.d.ts.map +1 -1
  149. package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
  150. package/dist/store/quote.d.ts.map +1 -0
  151. package/dist/store/settings.d.ts +3 -2
  152. package/dist/store/settings.d.ts.map +1 -1
  153. package/dist/store/slices/config.d.ts +3 -2
  154. package/dist/store/slices/config.d.ts.map +1 -1
  155. package/dist/store/slices/data.d.ts +3 -0
  156. package/dist/store/slices/data.d.ts.map +1 -1
  157. package/dist/store/wallets.d.ts +5 -4
  158. package/dist/store/wallets.d.ts.map +1 -1
  159. package/dist/types/config.d.ts +5 -5
  160. package/dist/types/config.d.ts.map +1 -1
  161. package/dist/types/index.d.ts +1 -1
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/quote.d.ts +82 -0
  164. package/dist/types/quote.d.ts.map +1 -0
  165. package/dist/utils/numbers.d.ts +1 -1
  166. package/dist/utils/numbers.d.ts.map +1 -1
  167. package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
  168. package/dist/utils/quote.d.ts.map +1 -0
  169. package/dist/utils/settings.d.ts +3 -2
  170. package/dist/utils/settings.d.ts.map +1 -1
  171. package/dist/utils/swap.d.ts +25 -22
  172. package/dist/utils/swap.d.ts.map +1 -1
  173. package/dist/utils/wallets.d.ts +2 -2
  174. package/dist/utils/wallets.d.ts.map +1 -1
  175. package/package.json +6 -6
  176. package/src/QueueManager.tsx +17 -17
  177. package/src/components/AppRouter.tsx +6 -5
  178. package/src/components/AppRoutes.tsx +6 -39
  179. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  180. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  181. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
  182. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +28 -40
  183. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
  184. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  185. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  186. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  187. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  188. package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +16 -9
  189. package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
  190. package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
  191. package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
  192. package/src/components/NoResult/index.ts +1 -0
  193. package/src/components/NotificationContent/NotificationContent.tsx +3 -2
  194. package/src/components/Quote/Quote.styles.ts +212 -0
  195. package/src/components/Quote/Quote.tsx +345 -0
  196. package/src/components/Quote/Quote.types.ts +16 -0
  197. package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
  198. package/src/components/Quote/QuoteSkeleton.tsx +108 -0
  199. package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
  200. package/src/components/Quote/QuoteSummary.styles.ts +15 -0
  201. package/src/components/Quote/QuoteSummary.tsx +46 -0
  202. package/src/components/Quote/index.ts +3 -0
  203. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
  204. package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +3 -3
  205. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +67 -0
  206. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
  207. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +24 -0
  208. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
  209. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
  210. package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
  211. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
  212. package/src/components/SwapDetails/SwapDetails.tsx +18 -22
  213. package/src/components/SwitchFromAndTo.tsx +2 -2
  214. package/src/components/TokenList/TokenList.tsx +5 -6
  215. package/src/components/UpdateUrl.tsx +36 -26
  216. package/src/components/WidgetEvents.tsx +4 -2
  217. package/src/constants/errors.ts +8 -10
  218. package/src/constants/messages.ts +1 -1
  219. package/src/constants/searchParams.ts +1 -0
  220. package/src/constants/warnings.ts +7 -7
  221. package/src/containers/App/App.styles.ts +18 -0
  222. package/src/containers/App/App.tsx +65 -0
  223. package/src/containers/App/index.ts +1 -0
  224. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +15 -0
  225. package/src/containers/QuoteInfo/QuoteInfo.tsx +97 -0
  226. package/src/containers/QuoteInfo/QuoteInfo.types.ts +17 -0
  227. package/src/containers/QuoteInfo/index.ts +1 -0
  228. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
  229. package/src/containers/Wallets/Wallets.types.ts +12 -0
  230. package/src/containers/Wallets/index.ts +1 -0
  231. package/src/containers/Widget/Widget.tsx +19 -0
  232. package/src/containers/Widget/Widget.types.ts +5 -0
  233. package/src/containers/Widget/index.ts +2 -0
  234. package/src/containers/WidgetInfo/WidgetInfo.tsx +36 -0
  235. package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
  236. package/src/containers/WidgetInfo/index.ts +1 -0
  237. package/src/containers/WidgetProvider/WidgetProvider.tsx +19 -0
  238. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  239. package/src/containers/WidgetProvider/index.ts +1 -0
  240. package/src/hooks/useConfirmSwap/index.ts +1 -0
  241. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +168 -0
  242. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +136 -0
  243. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
  244. package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
  245. package/src/hooks/useForceAutoConnect.ts +27 -0
  246. package/src/hooks/useNavigateBack.ts +3 -3
  247. package/src/hooks/useSwapInput.ts +58 -23
  248. package/src/hooks/useSyncStoresWithConfig.ts +22 -19
  249. package/src/hooks/useWalletList.ts +3 -5
  250. package/src/index.ts +10 -3
  251. package/src/pages/ConfirmSwapPage.tsx +58 -235
  252. package/src/pages/HistoryPage.tsx +1 -1
  253. package/src/pages/Home.tsx +58 -247
  254. package/src/pages/LanguagePage.tsx +1 -1
  255. package/src/pages/LiquiditySourcePage.tsx +23 -32
  256. package/src/pages/SelectBlockchainPage.tsx +6 -7
  257. package/src/pages/SelectSwapItemsPage.tsx +5 -5
  258. package/src/pages/SettingsPage.tsx +9 -13
  259. package/src/pages/SwapDetailsPage.tsx +3 -3
  260. package/src/pages/ThemePage.tsx +1 -1
  261. package/src/pages/WalletsPage.tsx +5 -12
  262. package/src/store/AppStore.tsx +35 -0
  263. package/src/store/app.ts +18 -6
  264. package/src/store/{bestRoute.ts → quote.ts} +68 -60
  265. package/src/store/settings.ts +7 -4
  266. package/src/store/slices/config.ts +25 -15
  267. package/src/store/slices/data.ts +64 -29
  268. package/src/store/wallets.ts +11 -8
  269. package/src/types/config.ts +5 -5
  270. package/src/types/index.ts +1 -1
  271. package/src/types/quote.ts +107 -0
  272. package/src/utils/numbers.ts +1 -1
  273. package/src/utils/quote.ts +338 -0
  274. package/src/utils/settings.ts +8 -7
  275. package/src/utils/swap.ts +113 -85
  276. package/src/utils/wallets.ts +29 -17
  277. package/dist/Wallets.d.ts +0 -17
  278. package/dist/Wallets.d.ts.map +0 -1
  279. package/dist/Widget.d.ts +0 -9
  280. package/dist/Widget.d.ts.map +0 -1
  281. package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
  282. package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
  283. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
  284. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
  285. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
  286. package/dist/components/NoRoutes/index.d.ts +0 -2
  287. package/dist/components/NoRoutes/index.d.ts.map +0 -1
  288. package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
  289. package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
  290. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
  291. package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
  292. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
  293. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
  294. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
  295. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
  296. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
  297. package/dist/components/RouteErrors/index.d.ts +0 -2
  298. package/dist/components/RouteErrors/index.d.ts.map +0 -1
  299. package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
  300. package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
  301. package/dist/store/bestRoute.d.ts.map +0 -1
  302. package/dist/store/meta.d.ts +0 -23
  303. package/dist/store/meta.d.ts.map +0 -1
  304. package/dist/types/routing.d.ts +0 -65
  305. package/dist/types/routing.d.ts.map +0 -1
  306. package/dist/utils/routing.d.ts.map +0 -1
  307. package/src/Widget.tsx +0 -119
  308. package/src/components/NoRoutes/index.ts +0 -1
  309. package/src/components/RouteErrors/RouteErrors.tsx +0 -79
  310. package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
  311. package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
  312. package/src/components/RouteErrors/index.ts +0 -1
  313. package/src/hooks/useConfirmSwap.ts +0 -303
  314. package/src/store/meta.ts +0 -39
  315. package/src/types/routing.ts +0 -77
  316. package/src/utils/routing.ts +0 -321
  317. /package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +0 -0
@@ -1,14 +1,13 @@
1
- import type { WidgetConfig } from '../types';
2
1
  import type { Asset } from 'rango-sdk';
3
2
 
4
3
  import { useEffect, useMemo, useRef } from 'react';
5
4
 
6
- import { useBestRouteStore } from '../store/bestRoute';
7
- import { useMetaStore } from '../store/meta';
5
+ import { useAppStore } from '../store/AppStore';
6
+ import { useQuoteStore } from '../store/quote';
8
7
  import { useSettingsStore } from '../store/settings';
9
8
  import { tokensAreEqual } from '../utils/wallets';
10
9
 
11
- export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
10
+ export function useSyncStoresWithConfig() {
12
11
  const {
13
12
  setInputAmount,
14
13
  setToToken,
@@ -19,12 +18,12 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
19
18
  toToken,
20
19
  fromBlockchain,
21
20
  toBlockchain,
22
- } = useBestRouteStore();
21
+ } = useQuoteStore();
23
22
 
24
- const {
25
- meta: { tokens, blockchains },
26
- loadingStatus: loadingMetaStatus,
27
- } = useMetaStore();
23
+ const config = useAppStore().config;
24
+ const fetchMetaStatus = useAppStore().fetchStatus;
25
+ const blockchains = useAppStore().blockchains();
26
+ const tokens = useAppStore().tokens();
28
27
 
29
28
  const { setAffiliateRef, setAffiliatePercent, setAffiliateWallets } =
30
29
  useSettingsStore();
@@ -55,7 +54,7 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
55
54
  }, [config?.amount]);
56
55
 
57
56
  useEffect(() => {
58
- if (loadingMetaStatus === 'success') {
57
+ if (fetchMetaStatus === 'success') {
59
58
  const chain = blockchains.find(
60
59
  (chain) => chain.name === config?.from?.blockchain
61
60
  );
@@ -67,8 +66,10 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
67
66
  setFromBlockchain(chain ?? null);
68
67
  }
69
68
 
70
- if (token || (!token && prevConfigFromToken.current)) {
71
- setFromToken(token ?? null);
69
+ if (token) {
70
+ setFromToken({ token, meta: { blockchains, tokens } });
71
+ } else if (!token && prevConfigFromToken.current) {
72
+ setFromToken({ token: null });
72
73
  }
73
74
 
74
75
  prevConfigFromBlockchain.current = config?.from?.blockchain;
@@ -79,13 +80,13 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
79
80
  config?.from?.token?.address,
80
81
  config?.from?.token?.blockchain,
81
82
  config?.from?.blockchain,
82
- loadingMetaStatus,
83
+ fetchMetaStatus,
83
84
  ]);
84
85
 
85
86
  useEffect(() => {
86
87
  if (fromToken && fromTokensConfig) {
87
88
  if (!fromTokensConfig.some((token) => tokensAreEqual(token, fromToken))) {
88
- setFromToken(null);
89
+ setFromToken({ token: null });
89
90
  }
90
91
  }
91
92
 
@@ -99,7 +100,7 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
99
100
  useEffect(() => {
100
101
  if (toToken && toTokensConfig) {
101
102
  if (!toTokensConfig.some((token) => tokensAreEqual(token, toToken))) {
102
- setToToken(null);
103
+ setToToken({ token: null });
103
104
  }
104
105
  }
105
106
 
@@ -111,7 +112,7 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
111
112
  }, [toTokensConfig, toBlockchainsConfig]);
112
113
 
113
114
  useEffect(() => {
114
- if (loadingMetaStatus === 'success') {
115
+ if (fetchMetaStatus === 'success') {
115
116
  const chain = blockchains.find(
116
117
  (chain) => chain.name === config?.to?.blockchain
117
118
  );
@@ -123,8 +124,10 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
123
124
  setToBlockchain(chain ?? null);
124
125
  }
125
126
 
126
- if (token || (!token && prevConfigToToken.current)) {
127
- setToToken(token ?? null);
127
+ if (token) {
128
+ setToToken({ token, meta: { blockchains, tokens } });
129
+ } else if (!token && prevConfigToToken.current) {
130
+ setToToken({ token: null });
128
131
  }
129
132
 
130
133
  prevConfigToBlockchain.current = config?.to?.blockchain;
@@ -135,7 +138,7 @@ export function useSyncStoresWithConfig(config: WidgetConfig | undefined) {
135
138
  config?.to?.token?.address,
136
139
  config?.to?.token?.blockchain,
137
140
  config?.to?.blockchain,
138
- loadingMetaStatus,
141
+ fetchMetaStatus,
139
142
  ]);
140
143
 
141
144
  useEffect(() => {
@@ -10,7 +10,7 @@ import {
10
10
  } from '@rango-dev/wallets-shared';
11
11
  import { useEffect, useState } from 'react';
12
12
 
13
- import { useMetaStore } from '../store/meta';
13
+ import { useAppStore } from '../store/AppStore';
14
14
  import { useWalletsStore } from '../store/wallets';
15
15
  import { configWalletsToWalletName } from '../utils/providers';
16
16
  import {
@@ -37,9 +37,7 @@ export function useWalletList(params: Params) {
37
37
  const { config, chain, onBeforeConnect, onConnect } = params;
38
38
  const { state, disconnect, getWalletInfo, connect } = useWallets();
39
39
  const { connectedWallets } = useWalletsStore();
40
- const { blockchains } = useMetaStore().meta;
41
- const multiWallets =
42
- typeof config?.multiWallets === 'undefined' ? true : config.multiWallets;
40
+ const blockchains = useAppStore().blockchains();
43
41
 
44
42
  /** It can be what has been set by widget config or as a fallback we use all the supported wallets by our library */
45
43
  const listAvailableWalletTypes =
@@ -76,7 +74,7 @@ export function useWalletList(params: Params) {
76
74
  const atLeastOneWalletIsConnected = !!wallets.find(
77
75
  (w) => w.state === WalletState.CONNECTED
78
76
  );
79
- if (!multiWallets && atLeastOneWalletIsConnected) {
77
+ if (!config?.multiWallets && atLeastOneWalletIsConnected) {
80
78
  return;
81
79
  }
82
80
  onBeforeConnect?.(type);
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { WidgetProps } from './containers/Widget';
1
2
  import type {
2
3
  BlockchainAndTokenConfig,
3
4
  WidgetColors,
@@ -5,7 +6,6 @@ import type {
5
6
  WidgetConfig,
6
7
  WidgetTheme,
7
8
  } from './types';
8
- import type { WidgetProps } from './Widget';
9
9
  import type {
10
10
  Route,
11
11
  RouteEvent,
@@ -39,8 +39,10 @@ import {
39
39
  } from '@rango-dev/queue-manager-rango-preset';
40
40
  import { useWallets } from '@rango-dev/wallets-react';
41
41
 
42
- import { WidgetWallets } from './Wallets';
43
- import { Widget } from './Widget';
42
+ import { WidgetWallets } from './containers/Wallets';
43
+ import { Widget } from './containers/Widget';
44
+ import { useWidget } from './containers/WidgetInfo';
45
+ import { WidgetProvider } from './containers/WidgetProvider';
44
46
 
45
47
  export type {
46
48
  WidgetConfig,
@@ -70,7 +72,12 @@ export type {
70
72
  };
71
73
  export {
72
74
  Widget,
75
+ /**
76
+ * @deprecated Use `WidgetProvider` instead. This component will be removed in future versions.
77
+ */
73
78
  WidgetWallets,
79
+ WidgetProvider,
80
+ useWidget,
74
81
  useWallets,
75
82
  useWidgetEvents,
76
83
  MainEvents,
@@ -2,20 +2,15 @@
2
2
  import type {
3
3
  ConfirmSwap,
4
4
  ConfirmSwapFetchResult,
5
- } from '../hooks/useConfirmSwap';
6
- import type { WidgetConfig } from '../types';
5
+ } from '../hooks/useConfirmSwap/useConfirmSwap.types';
7
6
 
8
7
  import { i18n } from '@lingui/core';
9
8
  import { useManager } from '@rango-dev/queue-manager-react';
10
9
  import {
11
10
  Alert,
12
- BestRoute,
13
- BestRouteSkeleton,
14
11
  Button,
15
12
  Divider,
16
13
  IconButton,
17
- MessageBox,
18
- Modal,
19
14
  RefreshIcon,
20
15
  SettingsIcon,
21
16
  styled,
@@ -27,46 +22,19 @@ import React, { useEffect, useState } from 'react';
27
22
  import { flushSync } from 'react-dom';
28
23
  import { useNavigate } from 'react-router-dom';
29
24
 
30
- import {
31
- formatBestRoute,
32
- getRequiredWallets,
33
- } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
25
+ import { getRequiredWallets } from '../components/ConfirmWalletsModal/ConfirmWallets.helpers';
34
26
  import { ConfirmWalletsModal } from '../components/ConfirmWalletsModal/ConfirmWalletsModal';
35
27
  import { HeaderButton } from '../components/HeaderButtons/HeaderButtons.styles';
36
28
  import { Layout } from '../components/Layout';
37
- import { NoRoutes } from '../components/NoRoutes';
38
- import { getConfirmSwapErrorMessage } from '../constants/errors';
39
29
  import { navigationRoutes } from '../constants/navigationRoutes';
40
- import {
41
- GAS_FEE_MAX_DECIMALS,
42
- GAS_FEE_MIN_DECIMALS,
43
- PERCENTAGE_CHANGE_MAX_DECIMALS,
44
- PERCENTAGE_CHANGE_MIN_DECIMALS,
45
- TOKEN_AMOUNT_MAX_DECIMALS,
46
- TOKEN_AMOUNT_MIN_DECIMALS,
47
- USD_VALUE_MAX_DECIMALS,
48
- USD_VALUE_MIN_DECIMALS,
49
- } from '../constants/routing';
50
- import { getRouteWarningMessage } from '../constants/warnings';
30
+ import { getQuoteUpdateWarningMessage } from '../constants/warnings';
31
+ import { QuoteInfo } from '../containers/QuoteInfo';
51
32
  import { useConfirmSwap } from '../hooks/useConfirmSwap';
52
- import { useBestRouteStore } from '../store/bestRoute';
53
- import { useMetaStore } from '../store/meta';
54
- import { useSettingsStore } from '../store/settings';
33
+ import { useQuoteStore } from '../store/quote';
55
34
  import { useUiStore } from '../store/ui';
56
35
  import { useWalletsStore } from '../store/wallets';
57
- import {
58
- ConfirmSwapErrorTypes,
59
- RouteWarningType,
60
- SlippageWarningType,
61
- } from '../types';
36
+ import { QuoteWarningType } from '../types';
62
37
  import { getContainer } from '../utils/common';
63
- import {
64
- numberToString,
65
- secondsToString,
66
- totalArrivalTime,
67
- } from '../utils/numbers';
68
- import { getPriceImpactLevel } from '../utils/routing';
69
- import { getPercentageChange, getTotalFeeInUsd } from '../utils/swap';
70
38
 
71
39
  const Container = styled('div', {
72
40
  position: 'relative',
@@ -100,44 +68,28 @@ const Buttons = styled('div', {
100
68
  },
101
69
  });
102
70
 
103
- type PropTypes = {
104
- config?: WidgetConfig;
105
- };
106
-
107
- export function ConfirmSwapPage(props: PropTypes) {
71
+ export function ConfirmSwapPage() {
108
72
  //TODO: move component's logics to a custom hook
109
- const { config } = props;
110
73
  const {
111
- bestRoute,
112
- inputAmount,
113
- outputAmount,
114
- inputUsdValue,
115
- outputUsdValue,
74
+ quote,
116
75
  setInputAmount,
117
76
  selectedWallets,
118
- routeWalletsConfirmed,
119
- setRouteWalletConfirmed,
77
+ quoteWalletsConfirmed,
78
+ setQuoteWalletConfirmed,
120
79
  customDestination,
121
- } = useBestRouteStore();
80
+ quoteWarningsConfirmed,
81
+ } = useQuoteStore();
122
82
  const navigate = useNavigate();
123
83
  const [dbErrorMessage, setDbErrorMessage] = useState<string>('');
124
- const [showSlippageWarning, setShowSlippageWarning] = useState(false);
125
84
 
126
85
  const { connectedWallets } = useWalletsStore();
127
- const showWalletsOnInit = !routeWalletsConfirmed;
86
+ const showWalletsOnInit = !quoteWalletsConfirmed;
128
87
  const [showWallets, setShowWallets] = useState(false);
129
88
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
130
- const {
131
- meta: { tokens, blockchains },
132
- loadingStatus: loadingMetaStatus,
133
- } = useMetaStore();
134
- const slippage = useSettingsStore.use.slippage();
135
- const customSlippage = useSettingsStore.use.customSlippage();
136
89
  const { manager } = useManager();
137
- const selectedSlippage = customSlippage || slippage;
138
90
  const {
139
91
  fetch: confirmSwap,
140
- loading: fetchingConfirmationRoute,
92
+ loading: fetchingConfirmationQuote,
141
93
  cancelFetch,
142
94
  } = useConfirmSwap();
143
95
  const [confirmSwapResult, setConfirmSwapResult] =
@@ -146,32 +98,8 @@ export function ConfirmSwapPage(props: PropTypes) {
146
98
  error: null,
147
99
  warnings: null,
148
100
  });
149
- const showSkeleton =
150
- fetchingConfirmationRoute || loadingMetaStatus === 'loading';
151
- const showNoRouteFound =
152
- !fetchingConfirmationRoute &&
153
- confirmSwapResult.error &&
154
- [
155
- ConfirmSwapErrorTypes.NO_ROUTE,
156
- ConfirmSwapErrorTypes.REQUEST_FAILED,
157
- ].includes(confirmSwapResult.error.type);
158
- const showBestRoute =
159
- !showNoRouteFound &&
160
- !fetchingConfirmationRoute &&
161
- bestRoute &&
162
- bestRoute.result;
163
-
164
- const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
165
- const percentageChange = numberToString(
166
- getPercentageChange(
167
- inputUsdValue?.toNumber() ?? 0,
168
- outputUsdValue?.toNumber() ?? 0
169
- ),
170
- PERCENTAGE_CHANGE_MIN_DECIMALS,
171
- PERCENTAGE_CHANGE_MAX_DECIMALS
172
- );
173
101
 
174
- const warningLevel = getPriceImpactLevel(parseFloat(percentageChange));
102
+ const [showQuoteWarningModal, setShowQuoteWarningModal] = useState(false);
175
103
 
176
104
  const onConfirmSwap: ConfirmSwap['fetch'] = async ({
177
105
  selectedWallets,
@@ -183,7 +111,7 @@ export function ConfirmSwapPage(props: PropTypes) {
183
111
  };
184
112
 
185
113
  const addNewSwap = async () => {
186
- if (confirmSwapResult.swap && routeWalletsConfirmed) {
114
+ if (confirmSwapResult.swap && quoteWalletsConfirmed) {
187
115
  try {
188
116
  await manager?.create(
189
117
  'swap',
@@ -211,8 +139,8 @@ export function ConfirmSwapPage(props: PropTypes) {
211
139
  };
212
140
 
213
141
  const onStartConfirmSwap = async () => {
214
- if (confirmSwapResult?.warnings?.slippage) {
215
- setShowSlippageWarning(true);
142
+ if (confirmSwapResult?.warnings?.quote && !quoteWarningsConfirmed) {
143
+ setShowQuoteWarningModal(true);
216
144
  } else {
217
145
  await onConfirm();
218
146
  }
@@ -252,10 +180,10 @@ export function ConfirmSwapPage(props: PropTypes) {
252
180
  }, []);
253
181
 
254
182
  useEffect(() => {
255
- const routeChanged =
256
- confirmSwapResult.warnings?.route?.type &&
257
- Object.values(RouteWarningType).includes(
258
- confirmSwapResult.warnings?.route?.type
183
+ const quoteChanged =
184
+ confirmSwapResult.warnings?.quote?.type &&
185
+ Object.values(QuoteWarningType).includes(
186
+ confirmSwapResult.warnings?.quote?.type
259
187
  );
260
188
 
261
189
  const selectedWalletDisconnected =
@@ -269,16 +197,15 @@ export function ConfirmSwapPage(props: PropTypes) {
269
197
  )
270
198
  );
271
199
 
272
- let routeWalletsChanged = false;
200
+ let quoteWalletsChanged = false;
273
201
 
274
- if (routeChanged) {
275
- let requiredWallets = getRequiredWallets(bestRoute);
202
+ if (quoteChanged) {
203
+ let requiredWallets = getRequiredWallets(quote);
276
204
 
277
205
  const lastStepToBlockchain =
278
- bestRoute?.result?.swaps[bestRoute.result.swaps.length - 1].to
279
- .blockchain;
206
+ quote?.result?.swaps[quote.result.swaps.length - 1].to.blockchain;
280
207
 
281
- const isLastWalletRequired = !!bestRoute?.result?.swaps.find(
208
+ const isLastWalletRequired = !!quote?.result?.swaps.find(
282
209
  (swap) => swap.from.blockchain === lastStepToBlockchain
283
210
  );
284
211
 
@@ -297,16 +224,16 @@ export function ConfirmSwapPage(props: PropTypes) {
297
224
  );
298
225
 
299
226
  if (!allRequiredWalletsSelected) {
300
- routeWalletsChanged = true;
227
+ quoteWalletsChanged = true;
301
228
  }
302
229
  }
303
230
 
304
- if (bestRoute && (selectedWalletDisconnected || routeWalletsChanged)) {
231
+ if (quote && (selectedWalletDisconnected || quoteWalletsChanged)) {
305
232
  queueMicrotask(() => flushSync(setShowWallets.bind(null, true)));
306
- setRouteWalletConfirmed(false);
233
+ setQuoteWalletConfirmed(false);
307
234
  }
308
235
  }, [
309
- confirmSwapResult.warnings?.route,
236
+ confirmSwapResult.warnings?.quote,
310
237
  selectedWallets.length,
311
238
  connectedWallets.length,
312
239
  ]);
@@ -315,7 +242,7 @@ export function ConfirmSwapPage(props: PropTypes) {
315
242
  <Layout
316
243
  header={{
317
244
  title: i18n.t('Confirm Swap'),
318
- onBack: navigate.bind(null, -1),
245
+ onBack: () => navigate(-1),
319
246
  hasConnectWallet: true,
320
247
  suffix: (
321
248
  <Tooltip
@@ -339,7 +266,7 @@ export function ConfirmSwapPage(props: PropTypes) {
339
266
  type="primary"
340
267
  size="large"
341
268
  fullWidth
342
- loading={fetchingConfirmationRoute}
269
+ loading={fetchingConfirmationQuote}
343
270
  disabled={!!confirmSwapResult.error}
344
271
  onClick={onStartConfirmSwap}>
345
272
  {i18n.t('Start Swap')}
@@ -349,72 +276,19 @@ export function ConfirmSwapPage(props: PropTypes) {
349
276
  variant="contained"
350
277
  type="primary"
351
278
  size="large"
352
- loading={fetchingConfirmationRoute}
279
+ loading={fetchingConfirmationQuote}
353
280
  onClick={setShowWallets.bind(null, true)}>
354
281
  <WalletIcon size={24} />
355
282
  </IconButton>
356
283
  </Buttons>
357
284
  }>
358
- <Modal
359
- anchor="bottom"
360
- open={showSlippageWarning}
361
- prefix={
362
- <Button
363
- size="small"
364
- variant="ghost"
365
- onClick={() => navigate('/' + navigationRoutes.settings)}>
366
- <Typography variant="label" size="medium" color="$neutral700">
367
- {i18n.t('Change settings')}
368
- </Typography>
369
- </Button>
370
- }
371
- container={document.querySelector('#swap-box') as HTMLDivElement}
372
- onClose={setShowSlippageWarning.bind(null, (prevState) => !prevState)}>
373
- {confirmSwapResult.warnings?.slippage && (
374
- <MessageBox
375
- type="warning"
376
- title={
377
- confirmSwapResult.warnings.slippage.type ===
378
- SlippageWarningType.HIGH_SLIPPAGE
379
- ? i18n.t('High slippage')
380
- : i18n.t('Low slippage')
381
- }
382
- description={
383
- confirmSwapResult.warnings.slippage.type ===
384
- SlippageWarningType.HIGH_SLIPPAGE
385
- ? i18n.t({
386
- id: ' Caution, your slippage is high (={selectedSlippage}). Your trade may be front run.',
387
- values: { selectedSlippage },
388
- })
389
- : i18n.t({
390
- id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
391
- values: {
392
- minRequiredSlippage:
393
- confirmSwapResult.warnings.slippage.slippage,
394
- },
395
- })
396
- }>
397
- <Divider size={18} />
398
- <Divider size={32} />
399
- <Button
400
- size="large"
401
- type="primary"
402
- variant="contained"
403
- fullWidth
404
- onClick={onConfirm}>
405
- {i18n.t('Confirm anyway')}
406
- </Button>
407
- </MessageBox>
408
- )}
409
- </Modal>
410
285
  {showWallets && (
411
286
  <ConfirmWalletsModal
412
287
  open={showWallets}
413
288
  onClose={() => setShowWallets(false)}
414
289
  onCancel={cancelFetch}
415
- loading={fetchingConfirmationRoute}
290
+ loading={fetchingConfirmationQuote}
416
291
  onCheckBalance={onConfirmSwap}
417
- config={config}
418
292
  />
419
293
  )}
420
294
 
@@ -426,7 +300,7 @@ export function ConfirmSwapPage(props: PropTypes) {
426
300
  <Button
427
301
  style={{ padding: '0' }}
428
302
  variant="ghost"
429
- disabled={fetchingConfirmationRoute}
303
+ disabled={fetchingConfirmationQuote}
430
304
  onClick={onRefresh}>
431
305
  <div className="icon">
432
306
  <RefreshIcon size={16} />
@@ -439,88 +313,37 @@ export function ConfirmSwapPage(props: PropTypes) {
439
313
  <Divider size={12} />
440
314
  </>
441
315
  )}
442
- {confirmSwapResult.warnings?.route && (
316
+ {confirmSwapResult.warnings?.quoteUpdate && (
443
317
  <>
444
318
  <Alert
445
319
  variant="alarm"
446
320
  type="warning"
447
- title={getRouteWarningMessage(confirmSwapResult.warnings.route)}
448
- />
449
- <Divider size={12} />
450
- </>
451
- )}
452
- {showSkeleton && <BestRouteSkeleton type="swap-preview" expanded />}
453
- {showBestRoute && (
454
- <BestRoute
455
- expanded={true}
456
- tooltipContainer={getContainer()}
457
- steps={formatBestRoute(bestRoute, blockchains) ?? []}
458
- input={{
459
- value: numberToString(
460
- inputAmount,
461
- TOKEN_AMOUNT_MIN_DECIMALS,
462
- TOKEN_AMOUNT_MAX_DECIMALS
463
- ),
464
- usdValue: numberToString(
465
- inputUsdValue,
466
- USD_VALUE_MIN_DECIMALS,
467
- USD_VALUE_MAX_DECIMALS
468
- ),
469
- }}
470
- output={{
471
- value: numberToString(
472
- outputAmount,
473
- TOKEN_AMOUNT_MIN_DECIMALS,
474
- TOKEN_AMOUNT_MAX_DECIMALS
475
- ),
476
- usdValue: numberToString(
477
- outputUsdValue,
478
- USD_VALUE_MIN_DECIMALS,
479
- USD_VALUE_MAX_DECIMALS
480
- ),
481
- }}
482
- totalFee={numberToString(
483
- totalFeeInUsd,
484
- GAS_FEE_MIN_DECIMALS,
485
- GAS_FEE_MAX_DECIMALS
486
- )}
487
- totalTime={secondsToString(
488
- totalArrivalTime(bestRoute.result?.swaps)
489
- )}
490
- recommended={true}
491
- type="swap-preview"
492
- percentageChange={percentageChange}
493
- warningLevel={warningLevel}
494
- />
495
- )}
496
- {showNoRouteFound && (
497
- <>
498
- <Divider size={12} />
499
- <NoRoutes
500
- diagnosisMessage={
501
- confirmSwapResult.error?.type === ConfirmSwapErrorTypes.NO_ROUTE
502
- ? confirmSwapResult.error.diagnosisMessage
503
- : undefined
321
+ title={
322
+ confirmSwapResult.warnings.quoteUpdate &&
323
+ getQuoteUpdateWarningMessage(
324
+ confirmSwapResult.warnings.quoteUpdate
325
+ )
504
326
  }
505
- error={
506
- confirmSwapResult.error?.type ===
507
- ConfirmSwapErrorTypes.REQUEST_FAILED
508
- }
509
- fetch={onRefresh}
510
- />
511
- </>
512
- )}
513
- {confirmSwapResult.error?.type ===
514
- ConfirmSwapErrorTypes.ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS && (
515
- <>
516
- <Alert
517
- variant="alarm"
518
- type="error"
519
- title={getConfirmSwapErrorMessage(confirmSwapResult.error)}
520
327
  />
521
328
  <Divider size={12} />
522
329
  </>
523
330
  )}
331
+ <QuoteInfo
332
+ quote={quote}
333
+ type="swap-preview"
334
+ expanded={true}
335
+ error={confirmSwapResult.error}
336
+ loading={fetchingConfirmationQuote}
337
+ warning={confirmSwapResult.warnings?.quote ?? null}
338
+ refetchQuote={onRefresh}
339
+ showWarningModal={showQuoteWarningModal}
340
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
341
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
342
+ onConfirmWarningModal={async () => {
343
+ setShowQuoteWarningModal(false);
344
+ await addNewSwap();
345
+ }}
346
+ />
524
347
  </Container>
525
348
  </Layout>
526
349
  );
@@ -78,7 +78,7 @@ export function HistoryPage() {
78
78
  return (
79
79
  <Layout
80
80
  header={{
81
- onBack: navigateBackFrom.bind(null, navigationRoutes.swaps),
81
+ onBack: () => navigateBackFrom(navigationRoutes.swaps),
82
82
  title: i18n.t('History'),
83
83
  }}>
84
84
  <Container>