@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
@@ -11,7 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React, { useEffect, useState } from 'react';
13
13
 
14
- import { useMetaStore } from '../../store/meta';
14
+ import { useAppStore } from '../../store/AppStore';
15
15
 
16
16
  import { filterBlockchains } from './BlockchainList.helpers';
17
17
  import { Container, List } from './BlockchainList.styles';
@@ -20,7 +20,7 @@ import { LoadingBlockchainList } from './LoadingBlockchainList';
20
20
  export function BlockchainList(props: PropTypes) {
21
21
  const { list, searchedFor, onChange, blockchainCategory } = props;
22
22
  const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
23
- const loadingStatus = useMetaStore.use.loadingStatus();
23
+ const { fetchStatus } = useAppStore();
24
24
 
25
25
  useEffect(() => {
26
26
  setBlockchains([
@@ -66,8 +66,8 @@ export function BlockchainList(props: PropTypes) {
66
66
  {i18n.t('Select Blockchain')}
67
67
  </Typography>
68
68
  <Divider size={4} />
69
- {loadingStatus === 'loading' && <LoadingBlockchainList />}
70
- {loadingStatus === 'success' && renderList()}
69
+ {fetchStatus === 'loading' && <LoadingBlockchainList />}
70
+ {fetchStatus === 'success' && renderList()}
71
71
  </Container>
72
72
  );
73
73
  }
@@ -13,8 +13,8 @@ import React from 'react';
13
13
 
14
14
  import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
15
15
  import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
16
- import { useBestRouteStore } from '../../store/bestRoute';
17
- import { useMetaStore } from '../../store/meta';
16
+ import { useAppStore } from '../../store/AppStore';
17
+ import { useQuoteStore } from '../../store/quote';
18
18
 
19
19
  import { Container } from './BlockchainsSection.styles';
20
20
 
@@ -27,9 +27,9 @@ export function BlockchainsSection(props: PropTypes) {
27
27
  selected: blockchain?.name,
28
28
  });
29
29
 
30
- const loadingStatus = useMetaStore.use.loadingStatus();
31
- const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
32
- const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
30
+ const { fetchStatus } = useAppStore();
31
+ const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
32
+ const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
33
33
  const hasMoreItemsInList = blockchainsList.more.length > 0;
34
34
  /**
35
35
  * When only one item is left on list, we will not show the `More` button and will show the item itself instead.
@@ -45,11 +45,11 @@ export function BlockchainsSection(props: PropTypes) {
45
45
  </Typography>
46
46
  <Divider size={12} />
47
47
  <Container>
48
- {loadingStatus === 'loading' &&
48
+ {fetchStatus === 'loading' &&
49
49
  Array.from(Array(NUMBER_OF_LOADING), (e) => (
50
50
  <Skeleton key={e} variant="rounded" height={50} />
51
51
  ))}
52
- {loadingStatus === 'success' && (
52
+ {fetchStatus === 'success' && (
53
53
  <>
54
54
  <BlockchainsChip
55
55
  selected={!blockchain}
@@ -1,71 +1,9 @@
1
- /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- import type { Step } from '@rango-dev/ui/dist/widget/ui/src/components/BestRoute/BestRoute.types';
3
1
  import type { BestRouteResponse, BlockchainMeta } from 'rango-sdk';
4
2
 
5
- import {
6
- TOKEN_AMOUNT_MAX_DECIMALS,
7
- TOKEN_AMOUNT_MIN_DECIMALS,
8
- USD_VALUE_MAX_DECIMALS,
9
- USD_VALUE_MIN_DECIMALS,
10
- } from '../../constants/routing';
11
- import { getBlockchainShortNameFor } from '../../utils/meta';
12
- import { numberToString } from '../../utils/numbers';
13
-
14
- export function formatBestRoute(
15
- bestRoute: BestRouteResponse,
16
- blockchains: BlockchainMeta[]
17
- ): Step[] | undefined {
18
- return bestRoute.result?.swaps.map((swap) => {
19
- return {
20
- swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
21
- from: {
22
- token: { displayName: swap.from.symbol, image: swap.from.logo },
23
- chain: {
24
- displayName:
25
- getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
26
- image: swap.from.blockchainLogo,
27
- },
28
- price: {
29
- value: numberToString(
30
- swap.fromAmount,
31
- TOKEN_AMOUNT_MIN_DECIMALS,
32
- TOKEN_AMOUNT_MAX_DECIMALS
33
- ),
34
- usdValue: numberToString(
35
- swap.from.usdPrice?.toString(),
36
- USD_VALUE_MIN_DECIMALS,
37
- USD_VALUE_MAX_DECIMALS
38
- ),
39
- },
40
- },
41
- to: {
42
- token: { displayName: swap.to.symbol, image: swap.to.logo },
43
- chain: {
44
- displayName:
45
- getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
46
- image: swap.to.blockchainLogo,
47
- },
48
- price: {
49
- value: numberToString(
50
- swap.toAmount,
51
- TOKEN_AMOUNT_MIN_DECIMALS,
52
- TOKEN_AMOUNT_MAX_DECIMALS
53
- ),
54
- usdValue: numberToString(
55
- swap.to.usdPrice?.toString(),
56
- USD_VALUE_MIN_DECIMALS,
57
- USD_VALUE_MAX_DECIMALS
58
- ),
59
- },
60
- },
61
- };
62
- });
63
- }
64
-
65
- export function getRequiredWallets(route: BestRouteResponse | null): string[] {
3
+ export function getRequiredWallets(quote: BestRouteResponse | null): string[] {
66
4
  const wallets: string[] = [];
67
5
 
68
- route?.result?.swaps.forEach((swap) => {
6
+ quote?.result?.swaps.forEach((swap) => {
69
7
  const currentStepFromBlockchain = swap.from.blockchain;
70
8
  const currentStepToBlockchain = swap.to.blockchain;
71
9
  let lastAddedWallet = wallets[wallets.length - 1];
@@ -18,12 +18,12 @@ import {
18
18
  import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
19
19
  import { useNavigate } from 'react-router-dom';
20
20
 
21
- import { getConfirmSwapErrorMessage } from '../../constants/errors';
22
- import { navigationRoutes } from '../../constants/navigationRoutes';
23
- import { getRouteWarningMessage } from '../../constants/warnings';
24
- import { useBestRouteStore } from '../../store/bestRoute';
25
- import { useMetaStore } from '../../store/meta';
21
+ import { getQuoteErrorMessage } from '../../constants/errors';
22
+ import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
23
+ import { useAppStore } from '../../store/AppStore';
24
+ import { useQuoteStore } from '../../store/quote';
26
25
  import { useWalletsStore } from '../../store/wallets';
26
+ import { getBlockchainShortNameFor } from '../../utils/meta';
27
27
  import { confirmSwapDisabled } from '../../utils/swap';
28
28
 
29
29
  import { getRequiredWallets, isValidAddress } from './ConfirmWallets.helpers';
@@ -50,23 +50,24 @@ const NUMBER_OF_WALLETS_TO_DISPLAY = 2;
50
50
 
51
51
  export function ConfirmWalletsModal(props: PropTypes) {
52
52
  //TODO: move component's logics to a custom hook
53
- const { open, onClose, onCancel, onCheckBalance, config, loading } = props;
54
- const { blockchains } = useMetaStore.use.meta();
53
+ const { open, onClose, onCancel, onCheckBalance, loading } = props;
54
+ const config = useAppStore().config;
55
+ const blockchains = useAppStore().blockchains();
55
56
  const {
56
- bestRoute,
57
- setSelectedWallets: selectRouteWallets,
58
- routeWalletsConfirmed,
59
- setRouteWalletConfirmed,
57
+ quote,
58
+ setSelectedWallets: selectQuoteWallets,
59
+ quoteWalletsConfirmed: quoteWalletsConfirmed,
60
+ setQuoteWalletConfirmed: setQuoteWalletConfirmed,
60
61
  customDestination,
61
62
  setCustomDestination,
62
- } = useBestRouteStore();
63
+ } = useQuoteStore();
63
64
  const { connectedWallets, selectWallets } = useWalletsStore();
64
65
 
65
66
  const [showMoreWalletFor, setShowMoreWalletFor] = useState('');
66
67
  const [balanceWarnings, setBalanceWarnings] = useState<string[]>([]);
67
68
  const [error, setError] = useState('');
68
- const [routeWarning, setRouteWarning] = useState<
69
- ConfirmSwapWarnings['route'] | null
69
+ const [quoteWarning, setQuoteWarning] = useState<
70
+ ConfirmSwapWarnings['quoteUpdate'] | null
70
71
  >(null);
71
72
  const [destination, setDestination] = useState(customDestination);
72
73
  const [showCustomDestination, setShowCustomDestination] = useState(
@@ -74,22 +75,15 @@ export function ConfirmWalletsModal(props: PropTypes) {
74
75
  );
75
76
  const customDestinationRef = useRef<HTMLDivElement | null>(null);
76
77
 
77
- const requiredWallets = getRequiredWallets(bestRoute);
78
- const customDestinationEnabled =
79
- typeof config?.customDestination === 'undefined'
80
- ? true
81
- : config.customDestination;
78
+ const requiredWallets = getRequiredWallets(quote);
82
79
 
83
80
  const lastStepToBlockchain = blockchains.find(
84
81
  (blockchain) =>
85
82
  blockchain.name ===
86
- bestRoute?.result?.swaps[bestRoute?.result?.swaps.length - 1].to
87
- .blockchain
83
+ quote?.result?.swaps[quote?.result?.swaps.length - 1].to.blockchain
88
84
  );
89
85
  const isWalletRequiredFor = (blockchain: string) =>
90
- !!bestRoute?.result?.swaps.find(
91
- (swap) => swap.from.blockchain === blockchain
92
- );
86
+ !!quote?.result?.swaps.find((swap) => swap.from.blockchain === blockchain);
93
87
 
94
88
  const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
95
89
  connectedWallets.filter((connectedWallet) => {
@@ -175,16 +169,16 @@ export function ConfirmWalletsModal(props: PropTypes) {
175
169
  (wallet) => wallet.selected
176
170
  );
177
171
  selectWallets(lastSelectedWallets);
178
- selectRouteWallets(lastSelectedWallets);
172
+ selectQuoteWallets(lastSelectedWallets);
179
173
  setCustomDestination(destination);
180
- setRouteWalletConfirmed(true);
174
+ setQuoteWalletConfirmed(true);
181
175
  onClose();
182
176
  };
183
177
 
184
178
  const onConfirmWallets = async () => {
185
179
  setBalanceWarnings([]);
186
180
  setError('');
187
- setRouteWarning(null);
181
+ setQuoteWarning(null);
188
182
  const selectedWallets = connectedWallets.filter((connectedWallet) =>
189
183
  selectableWallets.find(
190
184
  (selectableWallet) =>
@@ -201,11 +195,11 @@ export function ConfirmWalletsModal(props: PropTypes) {
201
195
  if (warnings?.balance?.messages) {
202
196
  setBalanceWarnings(warnings.balance.messages);
203
197
  }
204
- if (warnings?.route) {
205
- setRouteWarning(warnings.route);
198
+ if (warnings?.quoteUpdate) {
199
+ setQuoteWarning(warnings.quoteUpdate);
206
200
  }
207
201
  if (result.error) {
208
- setError(getConfirmSwapErrorMessage(result.error));
202
+ setError(getQuoteErrorMessage(result.error));
209
203
  }
210
204
 
211
205
  if (!result.error && (!warnings?.balance?.messages.length || 0 > 0)) {
@@ -249,8 +243,9 @@ export function ConfirmWalletsModal(props: PropTypes) {
249
243
  <Modal
250
244
  open={open}
251
245
  onClose={() => {
252
- if (!routeWalletsConfirmed) {
253
- navigate(navigationRoutes.home, { replace: true });
246
+ if (!quoteWalletsConfirmed) {
247
+ const home = '../';
248
+ navigate(home, { replace: true });
254
249
  }
255
250
  onClose();
256
251
  }}
@@ -265,7 +260,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
265
260
  loading,
266
261
  showCustomDestination,
267
262
  destination,
268
- bestRoute,
263
+ quote,
269
264
  selectableWallets,
270
265
  lastStepToBlockchain
271
266
  )}
@@ -291,7 +286,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
291
286
  <Typography variant="headline" size="small">
292
287
  {i18n.t({
293
288
  id: 'Your {blockchainName} wallets',
294
- values: { blockchainName: showMoreWalletFor },
289
+ values: {
290
+ blockchainName: getBlockchainShortNameFor(
291
+ showMoreWalletFor,
292
+ blockchains
293
+ ),
294
+ },
295
295
  })}
296
296
  </Typography>
297
297
  </ShowMoreHeader>
@@ -323,9 +323,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
323
323
  chain={showMoreWalletFor}
324
324
  isSelected={isSelected}
325
325
  selectWallet={onChange}
326
- multiWallets={config?.multiWallets ?? true}
327
- supportedWallets={config?.wallets ?? []}
328
- config={config}
329
326
  onShowMore={setShowMoreWalletFor.bind(null, showMoreWalletFor)}
330
327
  />
331
328
  </div>
@@ -339,12 +336,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
339
336
  <Divider size={12} />
340
337
  </>
341
338
  )}
342
- {routeWarning && (
339
+ {quoteWarning && (
343
340
  <>
344
341
  <Alert
345
342
  variant="alarm"
346
343
  type="warning"
347
- title={getRouteWarningMessage(routeWarning)}
344
+ title={getQuoteUpdateWarningMessage(quoteWarning)}
348
345
  />
349
346
  <Divider size={12} />
350
347
  </>
@@ -364,7 +361,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
364
361
  <Typography variant="title" size="xmedium">
365
362
  {i18n.t({
366
363
  id: 'Your {blockchainName} wallets',
367
- values: { blockchainName: blockchain?.displayName },
364
+ values: { blockchainName: blockchain?.shortName },
368
365
  })}
369
366
  </Typography>
370
367
  <Typography
@@ -373,7 +370,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
373
370
  size="medium">
374
371
  {i18n.t({
375
372
  id: 'You need to connect a {blockchainName} wallet.',
376
- values: { blockchainName: blockchain?.displayName },
373
+ values: { blockchainName: blockchain?.shortName },
377
374
  })}
378
375
  </Typography>
379
376
  </Title>
@@ -383,9 +380,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
383
380
  chain={requiredWallet}
384
381
  isSelected={isSelected}
385
382
  selectWallet={onChange}
386
- multiWallets={config?.multiWallets ?? true}
387
- supportedWallets={config?.wallets ?? []}
388
- config={config}
389
383
  limit={NUMBER_OF_WALLETS_TO_DISPLAY}
390
384
  onShowMore={() =>
391
385
  setShowMoreWalletFor(blockchain?.name ?? '')
@@ -393,7 +387,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
393
387
  />
394
388
  </ListContainer>
395
389
  {!isLastWallet && <Divider size={32} />}
396
- {isLastWallet && customDestinationEnabled && (
390
+ {isLastWallet && config?.customDestination && (
397
391
  <CustomDestination>
398
392
  <CollapsibleRoot
399
393
  ref={customDestinationRef}
@@ -1,11 +1,9 @@
1
- import type { WidgetConfig } from '../..';
2
- import type { ConfirmSwap } from '../../hooks/useConfirmSwap';
1
+ import type { ConfirmSwap } from '../../hooks/useConfirmSwap/useConfirmSwap.types';
3
2
 
4
3
  export type PropTypes = {
5
4
  open: boolean;
6
5
  onClose: () => void;
7
6
  onCancel: () => void;
8
7
  onCheckBalance: ConfirmSwap['fetch'];
9
- config?: WidgetConfig;
10
8
  loading: boolean;
11
9
  };
@@ -23,7 +23,7 @@ import {
23
23
  TIME_TO_CLOSE_MODAL,
24
24
  TIME_TO_IGNORE_MODAL,
25
25
  } from '../../pages/WalletsPage';
26
- import { useMetaStore } from '../../store/meta';
26
+ import { useAppStore } from '../../store/AppStore';
27
27
  import { useWalletsStore } from '../../store/wallets';
28
28
  import { getBlockchainDisplayNameFor } from '../../utils/meta';
29
29
  import {
@@ -41,10 +41,11 @@ import {
41
41
  } from './WalletList.styles';
42
42
 
43
43
  export function WalletList(props: PropTypes) {
44
- const { config, chain, isSelected, selectWallet, limit, onShowMore } = props;
44
+ const { chain, isSelected, selectWallet, limit, onShowMore } = props;
45
+ const { config } = useAppStore();
45
46
 
46
47
  const connectedWallets = useWalletsStore.use.connectedWallets();
47
- const { blockchains } = useMetaStore.use.meta();
48
+ const { blockchains } = useAppStore();
48
49
  const [openWalletStateModal, setOpenWalletStateModal] =
49
50
  useState<WalletType>('');
50
51
  const [experimentalChainWallet, setExperimentalChainWallet] =
@@ -137,7 +138,7 @@ export function WalletList(props: PropTypes) {
137
138
  });
138
139
  const conciseAddress = address ? getConciseAddress(address) : '';
139
140
 
140
- const experimentalChain = isExperimentalChain(blockchains, chain);
141
+ const experimentalChain = isExperimentalChain(blockchains(), chain);
141
142
 
142
143
  const experimentalChainNotAdded = !connectedWallets.find(
143
144
  (connectedWallet) =>
@@ -180,7 +181,7 @@ export function WalletList(props: PropTypes) {
180
181
  experimentalChainWallet?.chain
181
182
  ? getBlockchainDisplayNameFor(
182
183
  experimentalChainWallet.chain,
183
- blockchains
184
+ blockchains()
184
185
  )
185
186
  : undefined;
186
187
  return (
@@ -1,12 +1,9 @@
1
- import type { Wallet, WidgetConfig } from '../../types';
1
+ import type { Wallet } from '../../types';
2
2
 
3
3
  export type PropTypes = {
4
4
  chain: string;
5
- supportedWallets: WidgetConfig['wallets'];
6
5
  isSelected: (walletType: string, chain: string) => boolean;
7
6
  selectWallet: (wallet: Wallet) => void;
8
- multiWallets: boolean;
9
- config?: WidgetConfig;
10
7
  limit?: number;
11
8
  onShowMore: () => void;
12
9
  };
@@ -3,9 +3,8 @@ import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { BottomLogo, Divider, Header } from '@rango-dev/ui';
5
5
  import React from 'react';
6
- import { useNavigate } from 'react-router-dom';
7
6
 
8
- import { navigationRoutes } from '../../constants/navigationRoutes';
7
+ import { useNavigateBack } from '../../hooks/useNavigateBack';
9
8
  import { useUiStore } from '../../store/ui';
10
9
  import { useWalletsStore } from '../../store/wallets';
11
10
  import { getContainer } from '../../utils/common';
@@ -26,22 +25,26 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
26
25
 
27
26
  const connectWalletsButtonDisabled =
28
27
  useUiStore.use.connectWalletsButtonDisabled();
29
- const navigate = useNavigate();
28
+ const navigateBack = useNavigateBack();
30
29
 
31
30
  const onConnectWallet = () => {
32
- if (!connectWalletsButtonDisabled) {
33
- navigate('/' + navigationRoutes.wallets);
31
+ if (!connectWalletsButtonDisabled && header.onWallet) {
32
+ header.onWallet();
34
33
  }
35
34
  };
35
+
36
+ const showBackButton =
37
+ typeof header.hasBackButton === 'undefined' || header.hasBackButton;
38
+
36
39
  return (
37
40
  <Container ref={ref} fixedHeight={fixedHeight} id="swap-box">
38
41
  <Header
39
- prefix={<>{header.onBack && <BackButton onClick={header.onBack} />}</>}
42
+ prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
40
43
  title={header.title}
41
44
  suffix={
42
45
  <>
43
46
  {header.suffix}
44
- {header.hasConnectWallet && (
47
+ {header.onWallet && (
45
48
  <WalletButton
46
49
  container={getContainer()}
47
50
  onClick={onConnectWallet}
@@ -1,10 +1,10 @@
1
1
  export interface PropTypes {
2
2
  header: {
3
3
  title: string;
4
- hasConnectWallet?: boolean;
4
+ onWallet?: () => void;
5
5
  hasSettings?: boolean;
6
6
  suffix?: React.ReactNode;
7
- onBack?: () => void;
7
+ hasBackButton?: boolean;
8
8
  onCancel?: () => void;
9
9
  };
10
10
  hasLogo?: boolean;
@@ -10,11 +10,11 @@ export const Container = styled('div', {
10
10
  display: 'flex',
11
11
  },
12
12
 
13
- '.route-summary': {
13
+ '.quote-summary': {
14
14
  padding: '$15 $0',
15
15
  },
16
16
 
17
- '.route-summary-item': {
17
+ '.quote-summary-item': {
18
18
  display: 'flex',
19
19
  justifyContent: 'space-between',
20
20
  alignItems: 'center',
@@ -26,7 +26,7 @@ export const Container = styled('div', {
26
26
  alignItems: 'center',
27
27
  },
28
28
 
29
- '.route-summary-separator': {
29
+ '.quote-summary-separator': {
30
30
  width: '0px',
31
31
  height: '$16',
32
32
  borderLeft: '1px solid $neutral400',
@@ -6,8 +6,8 @@ import { Container, StepSeparator } from './LoadingSwapDetails.styles';
6
6
  import { LoadingSwapDetailStep } from './LoadingSwapDetailStep';
7
7
 
8
8
  export function LoadingSwapDetails() {
9
- const routeSummary = (
10
- <div className="route-summary-item">
9
+ const quoteSummary = (
10
+ <div className="quote-summary-item">
11
11
  <div className="token-amount">
12
12
  <ChainToken loading size="medium" chainImage="" tokenImage="" />
13
13
  <Divider size={8} direction="horizontal" />
@@ -27,10 +27,10 @@ export function LoadingSwapDetails() {
27
27
  <Skeleton width={60} height={10} variant="rounded" />
28
28
  </div>
29
29
 
30
- <div className="route-summary">
31
- {routeSummary}
32
- <div className="route-summary-separator"></div>
33
- {routeSummary}
30
+ <div className="quote-summary">
31
+ {quoteSummary}
32
+ <div className="quote-summary-separator"></div>
33
+ {quoteSummary}
34
34
  </div>
35
35
 
36
36
  <div className="swaps-steps">
@@ -1,37 +1,32 @@
1
- import type { Info } from './NoRoutes.types';
1
+ import type { Info } from './NoResult.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
 
5
5
  import { errorMessages } from '../../constants/errors';
6
+ import {
7
+ type NoResultError,
8
+ QuoteErrorType,
9
+ type QuoteRequestFailed,
10
+ } from '../../types';
6
11
 
7
12
  export function makeInfo(
8
- diagnosisMessage: string | null,
13
+ error: NoResultError | QuoteRequestFailed | null,
9
14
  disabledLiquiditySources: string[],
10
- hasError: boolean,
11
15
  toggleAllLiquiditySources: (shouldReset: boolean) => void,
12
- refetchBestRoute: () => void
16
+ refetchQuote: () => void
13
17
  ): Info {
14
- if (hasError) {
18
+ if (error?.type === QuoteErrorType.REQUEST_FAILED) {
15
19
  return {
16
20
  alert: {
17
21
  type: 'warning',
18
22
  text: errorMessages().genericServerError,
19
23
  action: {
20
- onClick: refetchBestRoute,
24
+ onClick: refetchQuote,
21
25
  title: i18n.t('Retry'),
22
26
  },
23
27
  },
24
28
  description: '',
25
29
  };
26
- } else if (diagnosisMessage) {
27
- return {
28
- alert: {
29
- type: 'error',
30
- text: diagnosisMessage,
31
- action: null,
32
- },
33
- description: '',
34
- };
35
30
  } else if (disabledLiquiditySources.length) {
36
31
  return {
37
32
  alert: {
@@ -44,9 +39,21 @@ export function makeInfo(
44
39
  },
45
40
  description: errorMessages().liquiditySourcesError.description,
46
41
  };
42
+ } else if (
43
+ error?.type === QuoteErrorType.NO_RESULT &&
44
+ error.diagnosisMessage
45
+ ) {
46
+ return {
47
+ alert: {
48
+ type: 'error',
49
+ text: error.diagnosisMessage,
50
+ action: null,
51
+ },
52
+ description: '',
53
+ };
47
54
  }
48
55
  return {
49
56
  alert: null,
50
- description: errorMessages().noRoutesError.description,
57
+ description: errorMessages().noResultError.description,
51
58
  };
52
59
  }
@@ -1,9 +1,11 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Container = styled('div', {
4
+ minHeight: '162px',
4
5
  display: 'flex',
5
6
  flexDirection: 'column',
6
7
  alignItems: 'center',
8
+ justifyContent: 'center',
7
9
  });
8
10
 
9
11
  export const Footer = styled('div', {
@@ -1,4 +1,4 @@
1
- import type { PropTypes } from './NoRoutes.types';
1
+ import type { PropTypes } from './NoResult.types';
2
2
 
3
3
  import {
4
4
  Alert,
@@ -11,27 +11,25 @@ import {
11
11
  import React from 'react';
12
12
 
13
13
  import { errorMessages } from '../../constants/errors';
14
- import { useMetaStore } from '../../store/meta';
14
+ import { useAppStore } from '../../store/AppStore';
15
15
  import { useSettingsStore } from '../../store/settings';
16
16
 
17
- import { makeInfo } from './NoRoutes.helper';
18
- import { Container, Footer, PrefixIcon } from './NoRoutes.styles';
17
+ import { makeInfo } from './NoResult.helpers';
18
+ import { Container, Footer, PrefixIcon } from './NoResult.styles';
19
19
 
20
- export function NoRoutes(props: PropTypes) {
21
- const { diagnosisMessage, fetch, error } = props;
20
+ export function NoResult(props: PropTypes) {
21
+ const { fetch, error } = props;
22
22
  const disabledLiquiditySources =
23
23
  useSettingsStore.use.disabledLiquiditySources();
24
- const loadingMetaStatus = useMetaStore.use.loadingStatus();
25
24
  const toggleAllLiquiditySources =
26
25
  useSettingsStore.use.toggleAllLiquiditySources();
27
26
 
28
- const hasError = error || loadingMetaStatus === 'failed';
27
+ const swappers = useAppStore().swappers();
29
28
 
30
29
  const info = makeInfo(
31
- diagnosisMessage ?? null,
30
+ error,
32
31
  disabledLiquiditySources,
33
- hasError,
34
- toggleAllLiquiditySources,
32
+ () => toggleAllLiquiditySources(swappers, true),
35
33
  fetch
36
34
  );
37
35
 
@@ -40,7 +38,7 @@ export function NoRoutes(props: PropTypes) {
40
38
  <NoRouteIcon size={24} color="gray" />
41
39
  <Divider size={4} />
42
40
  <Typography variant="title" size="small">
43
- {errorMessages().noRoutesError.title}
41
+ {errorMessages().noResultError.title}
44
42
  </Typography>
45
43
  {!!info.description && (
46
44
  <Typography