@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
@@ -0,0 +1,77 @@
1
+ import type {
2
+ HighSlippageWarning,
3
+ InsufficientSlippageWarning,
4
+ } from '../../types';
5
+
6
+ import { i18n } from '@lingui/core';
7
+ import { Button, Divider, MessageBox, Modal, Typography } from '@rango-dev/ui';
8
+ import React from 'react';
9
+ import { useNavigate } from 'react-router-dom';
10
+
11
+ import { navigationRoutes } from '../../constants/navigationRoutes';
12
+ import { useSettingsStore } from '../../store/settings';
13
+ import { QuoteWarningType } from '../../types';
14
+ import { getContainer } from '../../utils/common';
15
+
16
+ type PropsTypes = {
17
+ open: boolean;
18
+ onClose: () => void;
19
+ onConfirm: () => void;
20
+ warning: InsufficientSlippageWarning | HighSlippageWarning;
21
+ };
22
+
23
+ export function SlippageWarningModal(props: PropsTypes) {
24
+ const { customSlippage, slippage } = useSettingsStore();
25
+ const { open, onClose, onConfirm, warning } = props;
26
+ const navigate = useNavigate();
27
+ const userSlippage = customSlippage ?? slippage;
28
+ return (
29
+ <Modal
30
+ anchor="bottom"
31
+ open={open}
32
+ prefix={
33
+ <Button
34
+ size="small"
35
+ variant="ghost"
36
+ onClick={() => navigate('../' + navigationRoutes.settings)}>
37
+ <Typography variant="label" size="medium" color="$neutral900">
38
+ {i18n.t('Change settings')}
39
+ </Typography>
40
+ </Button>
41
+ }
42
+ container={getContainer()}
43
+ onClose={onClose}>
44
+ <MessageBox
45
+ type="warning"
46
+ title={
47
+ warning.type === QuoteWarningType.HIGH_SLIPPAGE
48
+ ? i18n.t('High slippage')
49
+ : i18n.t('Low slippage')
50
+ }
51
+ description={
52
+ warning.type === QuoteWarningType.HIGH_SLIPPAGE
53
+ ? i18n.t({
54
+ id: ' Caution, your slippage is high (={userSlippage}). Your trade may be front run.',
55
+ values: { userSlippage },
56
+ })
57
+ : i18n.t({
58
+ id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
59
+ values: {
60
+ minRequiredSlippage: warning.minRequiredSlippage,
61
+ },
62
+ })
63
+ }>
64
+ <Divider size={18} />
65
+ <Divider size={32} />
66
+ <Button
67
+ size="large"
68
+ type="primary"
69
+ variant="contained"
70
+ fullWidth
71
+ onClick={onConfirm}>
72
+ {i18n.t('Confirm anyway')}
73
+ </Button>
74
+ </MessageBox>
75
+ </Modal>
76
+ );
77
+ }
@@ -0,0 +1,38 @@
1
+ import type { UnknownPriceWarning } from '../../types';
2
+
3
+ import { Button, Divider, MessageBox, Modal, WarningIcon } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { errorMessages } from '../../constants/errors';
7
+ import { getContainer } from '../../utils/common';
8
+
9
+ type Props = {
10
+ open: boolean;
11
+ onClose: () => void;
12
+ onConfirm: () => void;
13
+ warning: UnknownPriceWarning;
14
+ };
15
+
16
+ export function UnknownPriceWarningModal(props: Props) {
17
+ const { open, onClose, onConfirm } = props;
18
+
19
+ return (
20
+ <Modal open={open} onClose={onClose} container={getContainer()}>
21
+ <MessageBox
22
+ type="warning"
23
+ title={errorMessages().unknownPriceError.impactTitle}
24
+ description={errorMessages().unknownPriceError.description}
25
+ />
26
+
27
+ <Divider size={32} />
28
+ <Button
29
+ type="primary"
30
+ size="large"
31
+ prefix={<WarningIcon />}
32
+ fullWidth
33
+ onClick={onConfirm}>
34
+ {errorMessages().unknownPriceError.confirmMessage}
35
+ </Button>
36
+ </Modal>
37
+ );
38
+ }
@@ -0,0 +1 @@
1
+ export { QuoteWarningsAndErrors } from './QuoteWarningsAndErrors';
@@ -10,8 +10,6 @@ import {
10
10
  } from '@rango-dev/ui';
11
11
  import React from 'react';
12
12
 
13
- import { navigationRoutes } from '../../constants/navigationRoutes';
14
- import { useNavigateBack } from '../../hooks/useNavigateBack';
15
13
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
16
14
  import { Layout } from '../Layout';
17
15
  import { LoadingSwapDetails } from '../LoadingSwapDetails';
@@ -24,14 +22,12 @@ import {
24
22
 
25
23
  export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
26
24
  const { requestId, showSkeleton } = props;
27
- const { navigateBackFrom } = useNavigateBack();
28
25
 
29
26
  return (
30
27
  <Layout
31
28
  noPadding
32
29
  header={{
33
30
  title: i18n.t('Swap and Bridge'),
34
- onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
35
31
  suffix: <SuffixContainer />,
36
32
  }}>
37
33
  {showSkeleton && (
@@ -13,8 +13,7 @@ import {
13
13
  CopyIcon,
14
14
  Divider,
15
15
  IconButton,
16
- RouteCost,
17
- RouteSummary,
16
+ QuoteCost,
18
17
  StepDetails,
19
18
  Typography,
20
19
  useCopyToClipboard,
@@ -23,7 +22,6 @@ import { useWallets } from '@rango-dev/wallets-react';
23
22
  import React, { useEffect, useRef, useState } from 'react';
24
23
  import { useNavigate } from 'react-router-dom';
25
24
 
26
- import { navigationRoutes } from '../../constants/navigationRoutes';
27
25
  import {
28
26
  GAS_FEE_MAX_DECIMALS,
29
27
  GAS_FEE_MIN_DECIMALS,
@@ -34,19 +32,17 @@ import {
34
32
  USD_VALUE_MAX_DECIMALS,
35
33
  USD_VALUE_MIN_DECIMALS,
36
34
  } from '../../constants/routing';
37
- import { useNavigateBack } from '../../hooks/useNavigateBack';
38
- import { useBestRouteStore } from '../../store/bestRoute';
39
- import { useMetaStore } from '../../store/meta';
35
+ import { useAppStore } from '../../store/AppStore';
40
36
  import { useNotificationStore } from '../../store/notification';
37
+ import { useQuoteStore } from '../../store/quote';
41
38
  import {
42
39
  numberToString,
43
40
  secondsToString,
44
41
  totalArrivalTime,
45
42
  } from '../../utils/numbers';
46
- import { getPriceImpactLevel } from '../../utils/routing';
43
+ import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
47
44
  import {
48
45
  getLastConvertedTokenInFailedSwap,
49
- getPercentageChange,
50
46
  getSwapMessages,
51
47
  shouldRetrySwap,
52
48
  } from '../../utils/swap';
@@ -54,6 +50,7 @@ import { getSwapDate } from '../../utils/time';
54
50
  import { getConciseAddress, getUsdPrice } from '../../utils/wallets';
55
51
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
56
52
  import { Layout } from '../Layout';
53
+ import { QuoteSummary } from '../Quote';
57
54
  import {
58
55
  SwapDetailsCompleteModal,
59
56
  SwapDetailsModal,
@@ -65,18 +62,16 @@ import { Container, HeaderDetails, StepsList } from './SwapDetails.styles';
65
62
  export function SwapDetails(props: SwapDetailsProps) {
66
63
  const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
67
64
  const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
68
- const retry = useBestRouteStore.use.retry();
65
+ const blockchains = useAppStore().blockchains();
66
+ const tokens = useAppStore().tokens();
67
+ const retry = useQuoteStore.use.retry();
69
68
  const navigate = useNavigate();
70
- const { navigateBackFrom } = useNavigateBack();
71
69
  const [_, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
72
70
  const listRef = useRef<HTMLDivElement | null>(null);
73
71
  const [modalState, setModalState] = useState<ModalState>(null);
74
72
  const [showCompletedModal, setShowCompletedModal] = useState<
75
73
  'success' | 'failed' | null
76
74
  >(null);
77
- const {
78
- meta: { tokens, blockchains },
79
- } = useMetaStore();
80
75
 
81
76
  const onCancel = () => {
82
77
  onCancelProps();
@@ -151,7 +146,7 @@ export function SwapDetails(props: SwapDetailsProps) {
151
146
  showNetworkModal: currentStepNetworkStatus,
152
147
  setNetworkModal: setModalState,
153
148
  message: stepMessage,
154
- blockchains,
149
+ blockchains: blockchains,
155
150
  });
156
151
  const numberOfSteps = steps.length;
157
152
  const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
@@ -201,7 +196,7 @@ export function SwapDetails(props: SwapDetailsProps) {
201
196
  USD_VALUE_MAX_DECIMALS
202
197
  );
203
198
 
204
- const percentageChange = getPercentageChange(inputUsdValue, outputUsdValue);
199
+ const percentageChange = getPriceImpact(inputUsdValue, outputUsdValue);
205
200
 
206
201
  const completeModalDesc =
207
202
  swap.status === 'success'
@@ -239,7 +234,6 @@ export function SwapDetails(props: SwapDetailsProps) {
239
234
  noPadding
240
235
  header={{
241
236
  title: i18n.t('Swap and Bridge'),
242
- onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
243
237
  onCancel:
244
238
  swap.status === 'running' ? () => setModalState('cancel') : undefined,
245
239
  suffix: swap.status !== 'running' && (
@@ -265,9 +259,10 @@ export function SwapDetails(props: SwapDetailsProps) {
265
259
  type="primary"
266
260
  size="large"
267
261
  onClick={() => {
268
- retry(swap);
262
+ retry(swap, { blockchains: blockchains, tokens: tokens });
269
263
  setTimeout(() => {
270
- navigate(navigationRoutes.home);
264
+ const home = '../../';
265
+ navigate(home);
271
266
  }, 0);
272
267
  }}>
273
268
  {i18n.t('Try again')}
@@ -302,7 +297,7 @@ export function SwapDetails(props: SwapDetailsProps) {
302
297
  </HeaderDetails>
303
298
 
304
299
  <div className="output">
305
- <RouteCost
300
+ <QuoteCost
306
301
  fee={numberToString(
307
302
  String(totalFee),
308
303
  GAS_FEE_MIN_DECIMALS,
@@ -311,7 +306,7 @@ export function SwapDetails(props: SwapDetailsProps) {
311
306
  time={secondsToString(totalArrivalTime(swap.steps))}
312
307
  steps={numberOfSteps}
313
308
  />
314
- <RouteSummary
309
+ <QuoteSummary
315
310
  from={{
316
311
  price: {
317
312
  value: numberToString(
@@ -353,9 +348,7 @@ export function SwapDetails(props: SwapDetailsProps) {
353
348
  PERCENTAGE_CHANGE_MIN_DECIMALS,
354
349
  PERCENTAGE_CHANGE_MAX_DECIMALS
355
350
  )}
356
- warningLevel={getPriceImpactLevel(
357
- percentageChange?.toNumber() ?? 0
358
- )}
351
+ warningLevel={getPriceImpactLevel(percentageChange ?? 0)}
359
352
  />
360
353
  </div>
361
354
  <div className="title-steps">
@@ -377,7 +370,7 @@ export function SwapDetails(props: SwapDetailsProps) {
377
370
  <StepDetails
378
371
  key={key}
379
372
  step={step}
380
- type="route-progress"
373
+ type="swap-progress"
381
374
  ref={listRef}
382
375
  state={state}
383
376
  hasSeparator={index !== 0}
@@ -12,8 +12,6 @@ import {
12
12
  import React from 'react';
13
13
  import { useNavigate } from 'react-router-dom';
14
14
 
15
- import { navigationRoutes } from '../../constants/navigationRoutes';
16
-
17
15
  export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
18
16
  const {
19
17
  open,
@@ -70,7 +68,10 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
70
68
  variant="contained"
71
69
  type="primary"
72
70
  size="large"
73
- onClick={() => navigate(navigationRoutes.home)}>
71
+ onClick={() => {
72
+ const home = '../../';
73
+ navigate(home);
74
+ }}>
74
75
  <Typography variant="title" size="medium" color="neutral100">
75
76
  {i18n.t('Done')}
76
77
  </Typography>
@@ -10,8 +10,8 @@ export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
10
10
  <Divider size={20} />
11
11
  <MessageBox
12
12
  type="error"
13
- title={i18n.t('Transaction Cancel')}
14
- description={i18n.t('Are you sure you want to Cancel this swap?')}
13
+ title={i18n.t('Cancel Swap')}
14
+ description={i18n.t('Are you sure you want to cancel this swap?')}
15
15
  />
16
16
  <Divider size={32} />
17
17
  <Button
@@ -1,9 +1,16 @@
1
- import { styled } from '@rango-dev/ui';
1
+ import { darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Group = styled('div', {
4
4
  width: '100%',
5
5
  display: 'flex',
6
6
  flexDirection: 'column',
7
+ '.group-title': {
8
+ $$color: '$colors$neutral600',
9
+ [`.${darkTheme} &`]: {
10
+ $$color: '$colors$neutral700',
11
+ },
12
+ color: '$$color',
13
+ },
7
14
  });
8
15
 
9
16
  export const Time = styled('div', {
@@ -34,7 +34,6 @@ export function SwapsGroup(props: PropTypes) {
34
34
  <Typography
35
35
  variant="label"
36
36
  size="medium"
37
- color="neutral600"
38
37
  className="group-title">
39
38
  {i18n.t(group.title)}
40
39
  </Typography>
@@ -68,7 +67,6 @@ export function SwapsGroup(props: PropTypes) {
68
67
  <Typography
69
68
  variant="label"
70
69
  size="medium"
71
- color="neutral600"
72
70
  className="group-title">
73
71
  {i18n.t(group.title)}
74
72
  </Typography>
@@ -1,7 +1,7 @@
1
1
  import { ReverseIcon, styled } from '@rango-dev/ui';
2
2
  import React from 'react';
3
3
 
4
- import { useBestRouteStore } from '../store/bestRoute';
4
+ import { useQuoteStore } from '../store/quote';
5
5
 
6
6
  const SwitchButtonContainer = styled('div', {
7
7
  position: 'absolute',
@@ -27,7 +27,7 @@ const StyledButton = styled('div', {
27
27
  });
28
28
 
29
29
  export function SwitchFromAndToButton() {
30
- const switchFromAndTo = useBestRouteStore.use.switchFromAndTo();
30
+ const switchFromAndTo = useQuoteStore.use.switchFromAndTo();
31
31
 
32
32
  return (
33
33
  <SwitchButtonContainer>
@@ -1,4 +1,4 @@
1
- import { styled, Typography } from '@rango-dev/ui';
1
+ import { darkTheme, styled, Typography } from '@rango-dev/ui';
2
2
 
3
3
  export const Container = styled('div', {
4
4
  display: 'flex',
@@ -40,7 +40,11 @@ export const List = styled('ul', {
40
40
  '& a': {
41
41
  fontSize: '$12',
42
42
  lineHeight: '$16',
43
- color: '$neutral600',
43
+ $$color: '$colors$neutral600',
44
+ [`.${darkTheme} &`]: {
45
+ $$color: '$colors$neutral700',
46
+ },
47
+ color: '$$color',
44
48
  textDecoration: 'none',
45
49
  },
46
50
  },
@@ -92,6 +96,14 @@ export const TagTitle = styled(Typography, {});
92
96
 
93
97
  export const BalanceContainer = styled('div', {
94
98
  textAlign: 'right',
99
+
100
+ '.usd-value': {
101
+ $$color: '$colors$neutral600',
102
+ [`.${darkTheme} &`]: {
103
+ $$color: '$colors$neutral700',
104
+ },
105
+ color: '$$color',
106
+ },
95
107
  });
96
108
 
97
109
  export const End = styled('ul', {
@@ -21,8 +21,7 @@ import {
21
21
  } from '@rango-dev/ui';
22
22
  import React, { forwardRef, useEffect, useState } from 'react';
23
23
 
24
- import { useAppStore } from '../../store/app';
25
- import { useMetaStore } from '../../store/meta';
24
+ import { useAppStore } from '../../store/AppStore';
26
25
  import { useWalletsStore } from '../../store/wallets';
27
26
  import { generateRangeColors } from '../../utils/colors';
28
27
 
@@ -87,10 +86,10 @@ export function TokenList(props: PropTypes) {
87
86
  const { list, searchedFor = '', onChange, selectedBlockchain } = props;
88
87
 
89
88
  const [tokens, setTokens] = useState<TokenWithBalance[]>(list);
90
- const loadingStatus = useMetaStore.use.loadingStatus();
89
+ const fetchStatus = useAppStore().fetchStatus;
90
+ const blockchains = useAppStore().blockchains();
91
91
  const [hasNextPage, setHasNextPage] = useState<boolean>(true);
92
92
  const loadingWallet = useWalletsStore.use.loading();
93
- const { blockchains } = useMetaStore.use.meta();
94
93
  const { isTokenPinned } = useAppStore();
95
94
 
96
95
  // eslint-disable-next-line react/display-name
@@ -239,7 +238,7 @@ export function TokenList(props: PropTypes) {
239
238
  {token.balance?.usdValue && (
240
239
  <Typography
241
240
  variant="body"
242
- color="neutral600"
241
+ className="usd-value"
243
242
  size="xsmall">
244
243
  {`$${token.balance?.usdValue}`}
245
244
  </Typography>
@@ -268,8 +267,8 @@ export function TokenList(props: PropTypes) {
268
267
  {i18n.t('Select Token')}
269
268
  </Typography>
270
269
  <Divider size={4} />
271
- {loadingStatus === 'loading' && <LoadingTokenList size={PAGE_SIZE} />}
272
- {loadingStatus === 'success' && <List>{renderList()}</List>}
270
+ {fetchStatus === 'loading' && <LoadingTokenList size={PAGE_SIZE} />}
271
+ {fetchStatus === 'success' && <List>{renderList()}</List>}
273
272
  </Container>
274
273
  );
275
274
  }
@@ -1,5 +1,3 @@
1
- import type { WidgetConfig } from '../types';
2
-
3
1
  import { useEffect, useRef } from 'react';
4
2
  import {
5
3
  createSearchParams,
@@ -10,33 +8,32 @@ import {
10
8
  import { navigationRoutes } from '../constants/navigationRoutes';
11
9
  import { SearchParams } from '../constants/searchParams';
12
10
  import { useSyncStoresWithConfig } from '../hooks/useSyncStoresWithConfig';
13
- import { useBestRouteStore } from '../store/bestRoute';
14
- import { useMetaStore } from '../store/meta';
11
+ import { useAppStore } from '../store/AppStore';
12
+ import { useQuoteStore } from '../store/quote';
15
13
  import { useUiStore } from '../store/ui';
16
- import { searchParamsToToken } from '../utils/routing';
17
-
18
- type Props = { config: WidgetConfig | undefined };
14
+ import { searchParamsToToken } from '../utils/quote';
19
15
 
20
- export function UpdateUrl(props: Props) {
16
+ export function UpdateUrl() {
21
17
  const firstRender = useRef(true);
22
18
  const [searchParams, setSearchParams] = useSearchParams();
23
19
  const location = useLocation();
24
20
  const firstRenderSearchParams = useRef(location.search);
25
21
  const searchParamsRef = useRef<Record<string, string>>({});
26
- const fromBlockchain = useBestRouteStore.use.fromBlockchain();
27
- const toBlockchain = useBestRouteStore.use.toBlockchain();
28
- const fromToken = useBestRouteStore.use.fromToken();
29
- const toToken = useBestRouteStore.use.toToken();
30
- const setFromBlockchain = useBestRouteStore.use.setFromBlockchain();
31
- const setFromToken = useBestRouteStore.use.setFromToken();
32
- const setToBlockchain = useBestRouteStore.use.setToBlockchain();
33
- const setToToken = useBestRouteStore.use.setToToken();
34
- const inputAmount = useBestRouteStore.use.inputAmount();
35
- const setInputAmount = useBestRouteStore.use.setInputAmount();
36
- const loadingStatus = useMetaStore.use.loadingStatus();
37
- const { blockchains, tokens } = useMetaStore.use.meta();
22
+ const fromBlockchain = useQuoteStore.use.fromBlockchain();
23
+ const toBlockchain = useQuoteStore.use.toBlockchain();
24
+ const fromToken = useQuoteStore.use.fromToken();
25
+ const toToken = useQuoteStore.use.toToken();
26
+ const setFromBlockchain = useQuoteStore.use.setFromBlockchain();
27
+ const setFromToken = useQuoteStore.use.setFromToken();
28
+ const setToBlockchain = useQuoteStore.use.setToBlockchain();
29
+ const setToToken = useQuoteStore.use.setToToken();
30
+ const inputAmount = useQuoteStore.use.inputAmount();
31
+ const setInputAmount = useQuoteStore.use.setInputAmount();
32
+ const fetchMetaStatus = useAppStore().fetchStatus;
33
+ const blockchains = useAppStore().blockchains();
34
+ const tokens = useAppStore().tokens();
38
35
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
39
- useSyncStoresWithConfig(props.config);
36
+ useSyncStoresWithConfig();
40
37
 
41
38
  useEffect(() => {
42
39
  const params: Record<string, string> = {};
@@ -60,7 +57,8 @@ export function UpdateUrl(props: Props) {
60
57
  toChainString = '',
61
58
  toTokenString = '',
62
59
  fromAmount = '';
63
- if (loadingStatus !== 'success') {
60
+ const autoConnect = searchParamsRef.current[SearchParams.AUTO_CONNECT];
61
+ if (fetchMetaStatus !== 'success') {
64
62
  fromChainString = searchParamsRef.current[SearchParams.FROM_CHAIN];
65
63
  fromTokenString = searchParamsRef.current[SearchParams.FROM_TOKEN];
66
64
  toChainString = searchParamsRef.current[SearchParams.TO_CHAIN];
@@ -68,9 +66,6 @@ export function UpdateUrl(props: Props) {
68
66
  fromAmount =
69
67
  searchParamsRef.current[SearchParams.FROM_AMOUNT] || inputAmount;
70
68
  } else {
71
- if (location.state === 'redirect') {
72
- return;
73
- }
74
69
  fromChainString = fromBlockchain?.name || '';
75
70
  fromTokenString =
76
71
  (fromToken?.symbol || '') +
@@ -94,6 +89,9 @@ export function UpdateUrl(props: Props) {
94
89
  ...(fromAmount && {
95
90
  [SearchParams.FROM_AMOUNT]: fromAmount.toString(),
96
91
  }),
92
+ ...(autoConnect && {
93
+ [SearchParams.AUTO_CONNECT]: autoConnect,
94
+ }),
97
95
  },
98
96
  { replace: true }
99
97
  );
@@ -109,7 +107,7 @@ export function UpdateUrl(props: Props) {
109
107
  ]);
110
108
 
111
109
  useEffect(() => {
112
- if (loadingStatus === 'success') {
110
+ if (fetchMetaStatus === 'success') {
113
111
  const fromChainString = searchParams.get(SearchParams.FROM_CHAIN);
114
112
  const fromTokenString = searchParams.get(SearchParams.FROM_TOKEN);
115
113
  const toChainString = searchParams.get(SearchParams.TO_CHAIN);
@@ -134,20 +132,29 @@ export function UpdateUrl(props: Props) {
134
132
  if (!!fromBlockchain) {
135
133
  setFromBlockchain(fromBlockchain);
136
134
  if (!!fromToken) {
137
- setFromToken(fromToken);
135
+ setFromToken({
136
+ token: fromToken,
137
+ meta: {
138
+ blockchains: blockchains,
139
+ tokens: tokens,
140
+ },
141
+ });
138
142
  }
139
143
  }
140
144
  if (!!toBlockchain) {
141
145
  setToBlockchain(toBlockchain);
142
146
  if (!!toToken) {
143
- setToToken(toToken);
147
+ setToToken({
148
+ token: toToken,
149
+ meta: { blockchains: blockchains, tokens: tokens },
150
+ });
144
151
  }
145
152
  }
146
153
  if (fromAmount) {
147
154
  setInputAmount(fromAmount);
148
155
  }
149
156
  }
150
- }, [loadingStatus]);
157
+ }, [fetchMetaStatus]);
151
158
 
152
159
  return null;
153
160
  }
@@ -8,11 +8,13 @@ import {
8
8
  } from '@rango-dev/queue-manager-rango-preset';
9
9
  import { useEffect } from 'react';
10
10
 
11
+ import { useAppStore } from '../store/AppStore';
11
12
  import { useNotificationStore } from '../store/notification';
12
13
  import { useWalletsStore } from '../store/wallets';
13
14
  import { validBlockedStatuses } from '../types/notification';
14
15
 
15
16
  export function WidgetEvents() {
17
+ const tokens = useAppStore().tokens();
16
18
  const connectedWallets = useWalletsStore.use.connectedWallets();
17
19
  const getWalletsDetails = useWalletsStore.use.getWalletsDetails();
18
20
  const setNotification = useNotificationStore.use.setNotification();
@@ -38,8 +40,8 @@ export function WidgetEvents() {
38
40
  (wallet) => wallet.chain === step?.toBlockchain
39
41
  );
40
42
 
41
- fromAccount && getWalletsDetails([fromAccount]);
42
- toAccount && getWalletsDetails([toAccount]);
43
+ fromAccount && getWalletsDetails([fromAccount], tokens);
44
+ toAccount && getWalletsDetails([toAccount], tokens);
43
45
  }
44
46
  if (
45
47
  (event.type === StepEventType.TX_EXECUTION_BLOCKED &&