@rango-dev/widget-embedded 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (476) hide show
  1. package/CHANGELOG.md +1 -113
  2. package/dist/QueueManager.d.ts +2 -5
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/Wallets.d.ts +17 -0
  5. package/dist/Wallets.d.ts.map +1 -0
  6. package/dist/Widget.d.ts +9 -0
  7. package/dist/Widget.d.ts.map +1 -0
  8. package/dist/components/AppRouter.d.ts +2 -0
  9. package/dist/components/AppRouter.d.ts.map +1 -1
  10. package/dist/components/AppRoutes.d.ts +6 -1
  11. package/dist/components/AppRoutes.d.ts.map +1 -1
  12. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  13. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -1
  14. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
  16. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +62 -691
  18. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  20. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +3 -1
  21. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  22. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  23. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
  24. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  25. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  26. package/dist/components/Layout/Layout.d.ts.map +1 -1
  27. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  28. package/dist/components/Layout/Layout.types.d.ts +2 -2
  29. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  30. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
  31. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
  32. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -1
  33. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +0 -1727
  34. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  35. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
  36. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
  37. package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
  38. package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
  39. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
  40. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
  41. package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
  42. package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
  43. package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
  44. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
  45. package/dist/components/NoRoutes/index.d.ts +2 -0
  46. package/dist/components/NoRoutes/index.d.ts.map +1 -0
  47. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  48. package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
  49. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
  50. package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
  51. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
  52. package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
  53. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
  54. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
  55. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
  56. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
  57. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
  58. package/dist/components/RouteErrors/index.d.ts +2 -0
  59. package/dist/components/RouteErrors/index.d.ts.map +1 -0
  60. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  61. package/dist/components/Slippage/Slippage.styles.d.ts +0 -158
  62. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  63. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  64. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  65. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  66. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  67. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +0 -628
  68. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  69. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  70. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  71. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
  72. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
  73. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
  74. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  75. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  76. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +0 -157
  77. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  78. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  79. package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
  80. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  81. package/dist/components/TokenList/TokenList.styles.d.ts +1 -1100
  82. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  83. package/dist/components/TokenList/TokenList.types.d.ts +9 -4
  84. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  85. package/dist/components/TokenList/index.d.ts +1 -0
  86. package/dist/components/TokenList/index.d.ts.map +1 -1
  87. package/dist/components/UpdateUrl.d.ts +6 -1
  88. package/dist/components/UpdateUrl.d.ts.map +1 -1
  89. package/dist/components/WidgetEvents.d.ts.map +1 -1
  90. package/dist/constants/errors.d.ts +4 -4
  91. package/dist/constants/errors.d.ts.map +1 -1
  92. package/dist/constants/index.d.ts +0 -1
  93. package/dist/constants/index.d.ts.map +1 -1
  94. package/dist/constants/messages.d.ts +1 -1
  95. package/dist/constants/navigationRoutes.d.ts +2 -1
  96. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  97. package/dist/constants/searchParams.d.ts +1 -2
  98. package/dist/constants/searchParams.d.ts.map +1 -1
  99. package/dist/constants/warnings.d.ts +2 -2
  100. package/dist/constants/warnings.d.ts.map +1 -1
  101. package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
  102. package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
  103. package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
  104. package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
  105. package/dist/hooks/useLanguage.d.ts +1 -1
  106. package/dist/hooks/useLanguage.d.ts.map +1 -1
  107. package/dist/hooks/useNavigateBack.d.ts +3 -1
  108. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  109. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  110. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  111. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  112. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +7 -5
  113. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  114. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +0 -1
  115. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  116. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +1 -5
  117. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  118. package/dist/hooks/useSwapInput.d.ts +2 -4
  119. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  120. package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
  121. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  122. package/dist/hooks/useTheme.d.ts +1 -1
  123. package/dist/hooks/useTheme.d.ts.map +1 -1
  124. package/dist/hooks/useWalletList.d.ts.map +1 -1
  125. package/dist/index.d.ts +8 -20
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +1 -1
  128. package/dist/index.js.map +4 -4
  129. package/dist/pages/ConfirmSwapPage.d.ts +6 -1
  130. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  131. package/dist/pages/HistoryPage.d.ts.map +1 -1
  132. package/dist/pages/Home.d.ts.map +1 -1
  133. package/dist/pages/LanguagePage.d.ts.map +1 -1
  134. package/dist/pages/LiquiditySourcePage.d.ts +2 -1
  135. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  136. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  137. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  138. package/dist/pages/SettingsPage.d.ts +6 -1
  139. package/dist/pages/SettingsPage.d.ts.map +1 -1
  140. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  141. package/dist/pages/ThemePage.d.ts.map +1 -1
  142. package/dist/pages/WalletsPage.d.ts +8 -1
  143. package/dist/pages/WalletsPage.d.ts.map +1 -1
  144. package/dist/store/app.d.ts +22 -41
  145. package/dist/store/app.d.ts.map +1 -1
  146. package/dist/store/bestRoute.d.ts +77 -0
  147. package/dist/store/bestRoute.d.ts.map +1 -0
  148. package/dist/store/meta.d.ts +23 -0
  149. package/dist/store/meta.d.ts.map +1 -0
  150. package/dist/store/notification.d.ts +3 -4
  151. package/dist/store/notification.d.ts.map +1 -1
  152. package/dist/store/settings.d.ts +81 -0
  153. package/dist/store/settings.d.ts.map +1 -0
  154. package/dist/store/slices/config.d.ts +2 -3
  155. package/dist/store/slices/config.d.ts.map +1 -1
  156. package/dist/store/slices/data.d.ts +2 -5
  157. package/dist/store/slices/data.d.ts.map +1 -1
  158. package/dist/store/ui.d.ts +1 -2
  159. package/dist/store/ui.d.ts.map +1 -1
  160. package/dist/store/wallets.d.ts +9 -14
  161. package/dist/store/wallets.d.ts.map +1 -1
  162. package/dist/types/config.d.ts +8 -41
  163. package/dist/types/config.d.ts.map +1 -1
  164. package/dist/types/index.d.ts +1 -1
  165. package/dist/types/index.d.ts.map +1 -1
  166. package/dist/types/routing.d.ts +65 -0
  167. package/dist/types/routing.d.ts.map +1 -0
  168. package/dist/types/swap.d.ts +14 -4
  169. package/dist/types/swap.d.ts.map +1 -1
  170. package/dist/types/wallets.d.ts +1 -15
  171. package/dist/types/wallets.d.ts.map +1 -1
  172. package/dist/utils/colors.d.ts.map +1 -1
  173. package/dist/utils/configs.d.ts +0 -1
  174. package/dist/utils/configs.d.ts.map +1 -1
  175. package/dist/utils/meta.d.ts +1 -2
  176. package/dist/utils/meta.d.ts.map +1 -1
  177. package/dist/utils/numbers.d.ts +1 -1
  178. package/dist/utils/numbers.d.ts.map +1 -1
  179. package/dist/utils/providers.d.ts +2 -2
  180. package/dist/utils/providers.d.ts.map +1 -1
  181. package/dist/utils/queue.d.ts +2 -2
  182. package/dist/utils/queue.d.ts.map +1 -1
  183. package/dist/utils/routing.d.ts +28 -0
  184. package/dist/utils/routing.d.ts.map +1 -0
  185. package/dist/utils/settings.d.ts +2 -6
  186. package/dist/utils/settings.d.ts.map +1 -1
  187. package/dist/utils/swap.d.ts +24 -35
  188. package/dist/utils/swap.d.ts.map +1 -1
  189. package/dist/utils/time.d.ts +1 -1
  190. package/dist/utils/time.d.ts.map +1 -1
  191. package/dist/utils/wallets.d.ts +10 -9
  192. package/dist/utils/wallets.d.ts.map +1 -1
  193. package/package.json +10 -12
  194. package/src/QueueManager.tsx +17 -18
  195. package/src/{containers/Wallets/Wallets.tsx → Wallets.tsx} +34 -48
  196. package/src/Widget.tsx +119 -0
  197. package/src/components/AppRouter.tsx +32 -8
  198. package/src/components/AppRoutes.tsx +69 -57
  199. package/src/components/BlockchainList/BlockchainList.styles.ts +2 -2
  200. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  201. package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +1 -1
  202. package/src/components/BlockchainsSection/BlockchainsSection.tsx +17 -26
  203. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
  204. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +10 -29
  205. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +47 -43
  206. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
  207. package/src/components/ConfirmWalletsModal/WalletList.tsx +8 -9
  208. package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
  209. package/src/components/HeaderButtons/HomeButtons.tsx +18 -28
  210. package/src/components/Layout/Layout.styles.ts +0 -2
  211. package/src/components/Layout/Layout.tsx +7 -20
  212. package/src/components/Layout/Layout.types.ts +2 -2
  213. package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
  214. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +61 -65
  215. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +34 -28
  216. package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
  217. package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +16 -23
  218. package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
  219. package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +17 -12
  220. package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
  221. package/src/components/NoRoutes/index.ts +1 -0
  222. package/src/components/NotificationContent/NotificationContent.tsx +3 -5
  223. package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +1 -8
  224. package/src/components/RouteErrors/RouteErrors.tsx +79 -0
  225. package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
  226. package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
  227. package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +4 -4
  228. package/src/components/RouteErrors/index.ts +1 -0
  229. package/src/components/Slippage/Slippage.styles.ts +5 -15
  230. package/src/components/Slippage/Slippage.tsx +10 -11
  231. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +8 -5
  232. package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
  233. package/src/components/SwapDetails/SwapDetails.styles.ts +33 -36
  234. package/src/components/SwapDetails/SwapDetails.tsx +56 -41
  235. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
  236. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +3 -4
  237. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  238. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +8 -14
  239. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
  240. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
  241. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
  242. package/src/components/SwapsGroup/SwapsGroup.styles.ts +1 -10
  243. package/src/components/SwapsGroup/SwapsGroup.tsx +5 -3
  244. package/src/components/SwitchFromAndTo.tsx +2 -2
  245. package/src/components/TokenList/TokenList.helpers.ts +2 -2
  246. package/src/components/TokenList/TokenList.styles.ts +38 -74
  247. package/src/components/TokenList/TokenList.tsx +26 -35
  248. package/src/components/TokenList/TokenList.types.ts +10 -4
  249. package/src/components/TokenList/index.ts +1 -0
  250. package/src/components/UpdateUrl.tsx +30 -35
  251. package/src/components/WidgetEvents.tsx +2 -4
  252. package/src/constants/errors.ts +15 -17
  253. package/src/constants/index.ts +0 -1
  254. package/src/constants/messages.ts +1 -1
  255. package/src/constants/navigationRoutes.ts +8 -7
  256. package/src/constants/searchParams.ts +0 -1
  257. package/src/constants/warnings.ts +7 -7
  258. package/src/hooks/useConfirmSwap.ts +303 -0
  259. package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
  260. package/src/hooks/useLanguage.ts +5 -4
  261. package/src/hooks/useNavigateBack.ts +52 -3
  262. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  263. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +7 -37
  264. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +0 -60
  265. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +3 -78
  266. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +6 -15
  267. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +1 -6
  268. package/src/hooks/useSwapInput.ts +48 -141
  269. package/src/hooks/useSyncStoresWithConfig.ts +24 -40
  270. package/src/hooks/useTheme.ts +5 -4
  271. package/src/hooks/useWalletList.ts +5 -3
  272. package/src/index.ts +5 -53
  273. package/src/pages/ConfirmSwapPage.tsx +266 -117
  274. package/src/pages/HistoryPage.tsx +7 -2
  275. package/src/pages/Home.tsx +303 -88
  276. package/src/pages/LanguagePage.tsx +5 -0
  277. package/src/pages/LiquiditySourcePage.tsx +37 -24
  278. package/src/pages/SelectBlockchainPage.tsx +24 -31
  279. package/src/pages/SelectSwapItemsPage.tsx +31 -18
  280. package/src/pages/SettingsPage.tsx +27 -32
  281. package/src/pages/SwapDetailsPage.tsx +7 -6
  282. package/src/pages/ThemePage.tsx +7 -2
  283. package/src/pages/WalletsPage.tsx +19 -9
  284. package/src/services/httpService.ts +1 -1
  285. package/src/store/app.ts +6 -44
  286. package/src/store/{quote.ts → bestRoute.ts} +64 -71
  287. package/src/store/meta.ts +39 -0
  288. package/src/store/settings.ts +158 -0
  289. package/src/store/slices/config.ts +15 -26
  290. package/src/store/slices/data.ts +35 -74
  291. package/src/store/wallets.ts +37 -68
  292. package/src/types/config.ts +8 -53
  293. package/src/types/index.ts +1 -1
  294. package/src/types/routing.ts +77 -0
  295. package/src/types/swap.ts +13 -4
  296. package/src/types/wallets.ts +1 -18
  297. package/src/utils/colors.ts +1 -2
  298. package/src/utils/configs.ts +1 -2
  299. package/src/utils/date.ts +1 -1
  300. package/src/utils/meta.ts +1 -8
  301. package/src/utils/numbers.ts +1 -1
  302. package/src/utils/providers.ts +5 -8
  303. package/src/utils/queue.ts +2 -2
  304. package/src/utils/routing.ts +321 -0
  305. package/src/utils/settings.ts +10 -17
  306. package/src/utils/swap.ts +120 -154
  307. package/src/utils/time.ts +1 -1
  308. package/src/utils/wallets.ts +161 -156
  309. package/dist/components/NoResult/NoResult.d.ts +0 -4
  310. package/dist/components/NoResult/NoResult.d.ts.map +0 -1
  311. package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
  312. package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
  313. package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
  314. package/dist/components/NoResult/index.d.ts +0 -2
  315. package/dist/components/NoResult/index.d.ts.map +0 -1
  316. package/dist/components/Quote/Quote.d.ts +0 -4
  317. package/dist/components/Quote/Quote.d.ts.map +0 -1
  318. package/dist/components/Quote/Quote.styles.d.ts +0 -2217
  319. package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
  320. package/dist/components/Quote/Quote.types.d.ts +0 -21
  321. package/dist/components/Quote/Quote.types.d.ts.map +0 -1
  322. package/dist/components/Quote/QuoteSummary.d.ts +0 -11
  323. package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
  324. package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -315
  325. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
  326. package/dist/components/Quote/index.d.ts +0 -3
  327. package/dist/components/Quote/index.d.ts.map +0 -1
  328. package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts +0 -4
  329. package/dist/components/QuoteSkeleton/QuoteSkeleton.d.ts.map +0 -1
  330. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +0 -633
  331. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +0 -1
  332. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +0 -6
  333. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +0 -1
  334. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts +0 -4
  335. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +0 -1
  336. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +0 -1571
  337. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +0 -1
  338. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +0 -6
  339. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +0 -1
  340. package/dist/components/QuoteSkeleton/StepSkeleton.d.ts +0 -4
  341. package/dist/components/QuoteSkeleton/StepSkeleton.d.ts.map +0 -1
  342. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +0 -786
  343. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +0 -1
  344. package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts +0 -4
  345. package/dist/components/QuoteSkeleton/StepSkeleton.types.d.ts.map +0 -1
  346. package/dist/components/QuoteSkeleton/index.d.ts +0 -4
  347. package/dist/components/QuoteSkeleton/index.d.ts.map +0 -1
  348. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
  349. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
  350. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
  351. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
  352. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
  353. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
  354. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
  355. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
  356. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
  357. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -23
  358. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
  359. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
  360. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
  361. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
  362. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
  363. package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
  364. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
  365. package/dist/containers/App/App.d.ts +0 -3
  366. package/dist/containers/App/App.d.ts.map +0 -1
  367. package/dist/containers/App/App.styles.d.ts +0 -158
  368. package/dist/containers/App/App.styles.d.ts.map +0 -1
  369. package/dist/containers/App/index.d.ts +0 -2
  370. package/dist/containers/App/index.d.ts.map +0 -1
  371. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
  372. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
  373. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -788
  374. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
  375. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -20
  376. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
  377. package/dist/containers/QuoteInfo/index.d.ts +0 -2
  378. package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
  379. package/dist/containers/Wallets/Wallets.d.ts +0 -6
  380. package/dist/containers/Wallets/Wallets.d.ts.map +0 -1
  381. package/dist/containers/Wallets/Wallets.types.d.ts +0 -11
  382. package/dist/containers/Wallets/Wallets.types.d.ts.map +0 -1
  383. package/dist/containers/Wallets/index.d.ts +0 -2
  384. package/dist/containers/Wallets/index.d.ts.map +0 -1
  385. package/dist/containers/Widget/Widget.d.ts +0 -5
  386. package/dist/containers/Widget/Widget.d.ts.map +0 -1
  387. package/dist/containers/Widget/Widget.types.d.ts +0 -5
  388. package/dist/containers/Widget/Widget.types.d.ts.map +0 -1
  389. package/dist/containers/Widget/index.d.ts +0 -3
  390. package/dist/containers/Widget/index.d.ts.map +0 -1
  391. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +0 -6
  392. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +0 -1
  393. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +0 -20
  394. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +0 -1
  395. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +0 -21
  396. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +0 -1
  397. package/dist/containers/WidgetInfo/index.d.ts +0 -2
  398. package/dist/containers/WidgetInfo/index.d.ts.map +0 -1
  399. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +0 -5
  400. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +0 -1
  401. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +0 -7
  402. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +0 -1
  403. package/dist/containers/WidgetProvider/index.d.ts +0 -2
  404. package/dist/containers/WidgetProvider/index.d.ts.map +0 -1
  405. package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
  406. package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
  407. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
  408. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
  409. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -19
  410. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
  411. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
  412. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  413. package/dist/hooks/useForceAutoConnect.d.ts +0 -2
  414. package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
  415. package/dist/store/AppStore.d.ts +0 -47
  416. package/dist/store/AppStore.d.ts.map +0 -1
  417. package/dist/store/quote.d.ts +0 -89
  418. package/dist/store/quote.d.ts.map +0 -1
  419. package/dist/store/slices/settings.d.ts +0 -39
  420. package/dist/store/slices/settings.d.ts.map +0 -1
  421. package/dist/types/quote.d.ts +0 -82
  422. package/dist/types/quote.d.ts.map +0 -1
  423. package/dist/utils/quote.d.ts +0 -32
  424. package/dist/utils/quote.d.ts.map +0 -1
  425. package/src/components/NoResult/index.ts +0 -1
  426. package/src/components/Quote/Quote.styles.ts +0 -249
  427. package/src/components/Quote/Quote.tsx +0 -414
  428. package/src/components/Quote/Quote.types.ts +0 -15
  429. package/src/components/Quote/QuoteSummary.styles.ts +0 -16
  430. package/src/components/Quote/QuoteSummary.tsx +0 -46
  431. package/src/components/Quote/index.ts +0 -2
  432. package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +0 -42
  433. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +0 -30
  434. package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +0 -5
  435. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +0 -57
  436. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +0 -76
  437. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +0 -6
  438. package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +0 -33
  439. package/src/components/QuoteSkeleton/StepSkeleton.tsx +0 -44
  440. package/src/components/QuoteSkeleton/StepSkeleton.types.ts +0 -1
  441. package/src/components/QuoteSkeleton/index.ts +0 -3
  442. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
  443. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -74
  444. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
  445. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -25
  446. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
  447. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
  448. package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
  449. package/src/containers/App/App.styles.ts +0 -18
  450. package/src/containers/App/App.tsx +0 -52
  451. package/src/containers/App/index.ts +0 -1
  452. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -31
  453. package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -99
  454. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -20
  455. package/src/containers/QuoteInfo/index.ts +0 -1
  456. package/src/containers/Wallets/Wallets.types.ts +0 -12
  457. package/src/containers/Wallets/index.ts +0 -1
  458. package/src/containers/Widget/Widget.tsx +0 -19
  459. package/src/containers/Widget/Widget.types.ts +0 -5
  460. package/src/containers/Widget/index.ts +0 -2
  461. package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +0 -64
  462. package/src/containers/WidgetInfo/WidgetInfo.tsx +0 -62
  463. package/src/containers/WidgetInfo/WidgetInfo.types.ts +0 -21
  464. package/src/containers/WidgetInfo/index.ts +0 -1
  465. package/src/containers/WidgetProvider/WidgetProvider.tsx +0 -28
  466. package/src/containers/WidgetProvider/WidgetProvider.types.ts +0 -7
  467. package/src/containers/WidgetProvider/index.ts +0 -1
  468. package/src/hooks/useConfirmSwap/index.ts +0 -1
  469. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -172
  470. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -137
  471. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
  472. package/src/hooks/useForceAutoConnect.ts +0 -27
  473. package/src/store/AppStore.tsx +0 -41
  474. package/src/store/slices/settings.ts +0 -168
  475. package/src/types/quote.ts +0 -107
  476. package/src/utils/quote.ts +0 -338
@@ -6,7 +6,6 @@ import type { StateCreator } from 'zustand';
6
6
 
7
7
  import { httpService as sdk } from '../../services/httpService';
8
8
  import { containsText } from '../../utils/common';
9
- import { sortLiquiditySourcesByGroupTitle } from '../../utils/settings';
10
9
  import { tokensAreEqual } from '../../utils/wallets';
11
10
 
12
11
  type BlockchainOptions = {
@@ -14,22 +13,21 @@ type BlockchainOptions = {
14
13
  };
15
14
 
16
15
  type TokenOptions = {
17
- type: 'source' | 'destination';
16
+ type?: 'source' | 'destination';
18
17
  // filter by an specific blockchain
19
18
  blockchain?: string;
20
19
  searchFor?: string;
21
20
  };
22
- export type FetchStatus = 'loading' | 'success' | 'failed';
21
+
23
22
  export interface DataSlice {
24
23
  _blockchains: BlockchainMeta[];
25
24
  _tokens: Token[];
26
25
  _popularTokens: Token[];
27
26
  _swappers: SwapperMeta[];
28
- fetchStatus: FetchStatus;
27
+
29
28
  blockchains: (options?: BlockchainOptions) => BlockchainMeta[];
30
29
  tokens: (options?: TokenOptions) => Token[];
31
- swappers: () => SwapperMeta[];
32
- isTokenPinned: (token: Token, type: 'source' | 'destination') => boolean;
30
+ isTokenPinned: (token: Token) => boolean;
33
31
 
34
32
  fetch: () => Promise<void>;
35
33
  }
@@ -45,7 +43,7 @@ export const createDataSlice: StateCreator<
45
43
  _tokens: [],
46
44
  _popularTokens: [],
47
45
  _swappers: [],
48
- fetchStatus: 'loading',
46
+
49
47
  // Selectors
50
48
  blockchains: (options) => {
51
49
  const blockchainsFromState = get()._blockchains;
@@ -131,10 +129,10 @@ export const createDataSlice: StateCreator<
131
129
  })
132
130
  .sort((a, b) => {
133
131
  // Check pinned tokens
134
- if (get().isTokenPinned(a, options.type)) {
132
+ if (get().isTokenPinned(a)) {
135
133
  return -1;
136
134
  }
137
- if (get().isTokenPinned(b, options.type)) {
135
+ if (get().isTokenPinned(b)) {
138
136
  return 1;
139
137
  }
140
138
 
@@ -159,84 +157,47 @@ export const createDataSlice: StateCreator<
159
157
 
160
158
  return list;
161
159
  },
162
- isTokenPinned: (token, type) => {
163
- const pinnedTokens =
164
- type === 'source'
165
- ? get().config.from?.pinnedTokens
166
- : get().config.to?.pinnedTokens;
167
- const pinned = !!pinnedTokens?.some((pinnedToken) =>
160
+ isTokenPinned: (token) => {
161
+ const pinned = !!get().config.pinnedTokens?.some((pinnedToken) =>
168
162
  tokensAreEqual(pinnedToken, token)
169
163
  );
170
164
  return pinned;
171
165
  },
172
- swappers: () => {
173
- const {
174
- config: { enableNewLiquiditySources, liquiditySources },
175
- } = get();
176
-
177
- /*
178
- * If the enableNewLiquiditySources flag is set to true, we return all swappers that are not included in the config.
179
- * Otherwise, we return all swappers that are included in the config.
180
- */
181
- const swappers = get()._swappers.filter((swapper) => {
182
- const swapperGroupIncludedInLiquiditySources = liquiditySources?.includes(
183
- swapper.swapperGroup
184
- );
185
-
186
- const shouldExcludeLiquiditySources =
187
- enableNewLiquiditySources ||
188
- !liquiditySources ||
189
- liquiditySources.length === 0;
190
-
191
- return shouldExcludeLiquiditySources
192
- ? !swapperGroupIncludedInLiquiditySources
193
- : swapperGroupIncludedInLiquiditySources;
194
- });
195
166
 
196
- const sortedSwappers = swappers.sort(sortLiquiditySourcesByGroupTitle);
197
-
198
- return sortedSwappers;
199
- },
200
167
  // Actions
201
168
  fetch: async () => {
202
- try {
203
- const response = await sdk().getAllMetadata();
169
+ const response = await sdk().getAllMetadata();
204
170
 
205
- set({ fetchStatus: 'success' });
206
- const blockchains: BlockchainMeta[] = [];
207
- const tokens: Token[] = [];
208
- const popularTokens: Token[] = response.popularTokens;
209
- const swappers: SwapperMeta[] = response.swappers;
171
+ const blockchains: BlockchainMeta[] = [];
172
+ const tokens: Token[] = [];
173
+ const popularTokens: Token[] = response.popularTokens;
174
+ const swappers: SwapperMeta[] = response.swappers;
210
175
 
211
- const blockchainsWithAtLeastOneToken = new Set();
176
+ const blockchainsWithAtLeastOneToken = new Set();
212
177
 
213
- response.tokens.forEach((token) => {
214
- blockchainsWithAtLeastOneToken.add(token.blockchain);
178
+ response.tokens.forEach((token) => {
179
+ blockchainsWithAtLeastOneToken.add(token.blockchain);
215
180
 
216
- tokens.push(token);
217
- });
181
+ tokens.push(token);
182
+ });
218
183
 
219
- response.blockchains.forEach((blockchain) => {
220
- if (
221
- blockchain.enabled &&
222
- blockchainsWithAtLeastOneToken.has(blockchain.name)
223
- ) {
224
- blockchains.push(blockchain);
225
- }
226
- });
184
+ response.blockchains.forEach((blockchain) => {
185
+ if (
186
+ blockchain.enabled &&
187
+ blockchainsWithAtLeastOneToken.has(blockchain.name)
188
+ ) {
189
+ blockchains.push(blockchain);
190
+ }
191
+ });
227
192
 
228
- // Sort
229
- blockchains.sort((a, b) => a.sort - b.sort);
193
+ // Sort
194
+ blockchains.sort((a, b) => a.sort - b.sort);
230
195
 
231
- set({
232
- _blockchains: blockchains,
233
- _tokens: tokens,
234
- _popularTokens: popularTokens,
235
- _swappers: swappers,
236
- });
237
- } catch (error) {
238
- set({ fetchStatus: 'failed' });
239
- throw error;
240
- }
196
+ set({
197
+ _blockchains: blockchains,
198
+ _tokens: tokens,
199
+ _popularTokens: popularTokens,
200
+ _swappers: swappers,
201
+ });
241
202
  },
242
203
  });
@@ -1,19 +1,17 @@
1
- import type { Balance, TokensBalance, Wallet } from '../types';
1
+ import type { Wallet } from '../types';
2
2
  import type { WalletType } from '@rango-dev/wallets-shared';
3
- import type { Token } from 'rango-sdk';
4
3
 
5
4
  import { create } from 'zustand';
6
5
  import { subscribeWithSelector } from 'zustand/middleware';
7
6
 
8
7
  import { httpService } from '../services/httpService';
9
8
  import {
10
- createTokenHash,
11
9
  isAccountAndWalletMatched,
12
10
  makeBalanceFor,
13
- makeTokensBalance,
14
11
  resetConnectedWalletState,
15
12
  } from '../utils/wallets';
16
13
 
14
+ import { useMetaStore } from './meta';
17
15
  import createSelectors from './selectors';
18
16
 
19
17
  export type TokenBalance = {
@@ -35,31 +33,25 @@ export interface ConnectedWallet extends Wallet {
35
33
  loading: boolean;
36
34
  error: boolean;
37
35
  }
36
+
38
37
  interface WalletsStore {
39
38
  connectedWallets: ConnectedWallet[];
40
- balances: TokensBalance;
41
39
  customDestination: string;
42
40
  loading: boolean;
43
- connectWallet: (accounts: Wallet[], tokens: Token[]) => void;
41
+ connectWallet: (accounts: Wallet[]) => void;
44
42
  disconnectWallet: (walletType: WalletType) => void;
45
43
  selectWallets: (wallets: { walletType: string; chain: string }[]) => void;
46
44
  clearConnectedWallet: () => void;
47
- getWalletsDetails: (
48
- accounts: Wallet[],
49
- tokens: Token[],
50
- shouldRetry?: boolean
51
- ) => void;
52
- getBalanceFor: (token: Token) => Balance | null;
45
+ getWalletsDetails: (accounts: Wallet[], shouldRetry?: boolean) => void;
53
46
  }
54
47
 
55
48
  export const useWalletsStore = createSelectors(
56
49
  create<WalletsStore>()(
57
50
  subscribeWithSelector((set, get) => ({
58
51
  connectedWallets: [],
59
- balances: {},
60
52
  customDestination: '',
61
53
  loading: false,
62
- connectWallet: (accounts, tokens) => {
54
+ connectWallet: (accounts) => {
63
55
  const getWalletsDetails = get().getWalletsDetails;
64
56
  set((state) => ({
65
57
  loading: true,
@@ -85,7 +77,7 @@ export const useWalletsStore = createSelectors(
85
77
  })
86
78
  ),
87
79
  }));
88
- getWalletsDetails(accounts, tokens);
80
+ getWalletsDetails(accounts);
89
81
  },
90
82
  disconnectWallet: (walletType) => {
91
83
  set((state) => {
@@ -96,27 +88,21 @@ export const useWalletsStore = createSelectors(
96
88
  connectedWallet.walletType !== walletType
97
89
  )
98
90
  .map((selectedWallet) => selectedWallet.chain);
99
-
100
- const connectedWallets = state.connectedWallets
101
- .filter(
102
- (connectedWallet) => connectedWallet.walletType !== walletType
103
- )
104
- .map((connectedWallet) => {
105
- const anyWalletSelectedForBlockchain = selectedWallets.includes(
106
- connectedWallet.chain
107
- );
108
- if (anyWalletSelectedForBlockchain) {
109
- return connectedWallet;
110
- }
111
- selectedWallets.push(connectedWallet.chain);
112
- return { ...connectedWallet, selected: true };
113
- });
114
-
115
- const balances = makeTokensBalance(connectedWallets);
116
-
117
91
  return {
118
- balances,
119
- connectedWallets,
92
+ connectedWallets: state.connectedWallets
93
+ .filter(
94
+ (connectedWallet) => connectedWallet.walletType !== walletType
95
+ )
96
+ .map((connectedWallet) => {
97
+ const anyWalletSelectedForBlockchain = selectedWallets.includes(
98
+ connectedWallet.chain
99
+ );
100
+ if (anyWalletSelectedForBlockchain) {
101
+ return connectedWallet;
102
+ }
103
+ selectedWallets.push(connectedWallet.chain);
104
+ return { ...connectedWallet, selected: true };
105
+ }),
120
106
  };
121
107
  });
122
108
  },
@@ -149,8 +135,9 @@ export const useWalletsStore = createSelectors(
149
135
  connectedWallets: [],
150
136
  selectedWallets: [],
151
137
  })),
152
- getWalletsDetails: async (accounts, tokens, shouldRetry = true) => {
138
+ getWalletsDetails: async (accounts, shouldRetry = true) => {
153
139
  const getWalletsDetails = get().getWalletsDetails;
140
+ const { tokens } = useMetaStore.getState().meta;
154
141
  set((state) => ({
155
142
  loading: true,
156
143
  connectedWallets: state.connectedWallets.map((wallet) => {
@@ -169,8 +156,9 @@ export const useWalletsStore = createSelectors(
169
156
  const response = await httpService().getWalletsDetails(data);
170
157
  const retrievedBalance = response.wallets;
171
158
  if (retrievedBalance) {
172
- set((state) => {
173
- const connectedWallets = state.connectedWallets.map(
159
+ set((state) => ({
160
+ loading: false,
161
+ connectedWallets: state.connectedWallets.map(
174
162
  (connectedWallet) => {
175
163
  const matchedAccount = accounts.find((account) =>
176
164
  isAccountAndWalletMatched(account, connectedWallet)
@@ -185,7 +173,7 @@ export const useWalletsStore = createSelectors(
185
173
  matchedAccount &&
186
174
  shouldRetry
187
175
  ) {
188
- getWalletsDetails([matchedAccount], tokens, false);
176
+ getWalletsDetails([matchedAccount], false);
189
177
  }
190
178
  return matchedAccount && retrievedBalanceAccount
191
179
  ? {
@@ -195,49 +183,30 @@ export const useWalletsStore = createSelectors(
195
183
  retrievedBalanceAccount,
196
184
  tokens
197
185
  ),
198
- loading: false,
199
186
  }
200
187
  : connectedWallet;
201
188
  }
202
- );
203
-
204
- const balances = makeTokensBalance(connectedWallets);
205
-
206
- return {
207
- loading: false,
208
- balances,
209
- connectedWallets,
210
- };
211
- });
189
+ ),
190
+ }));
212
191
  } else {
213
192
  throw new Error('Wallet not found');
214
193
  }
215
194
  } catch (error) {
216
- set((state) => {
217
- const connectedWallets = state.connectedWallets.map((balance) => {
195
+ set((state) => ({
196
+ loading: false,
197
+ connectedWallets: state.connectedWallets.map((balance) => {
218
198
  return accounts.find((account) =>
219
199
  isAccountAndWalletMatched(account, balance)
220
200
  )
221
201
  ? resetConnectedWalletState(balance)
222
202
  : balance;
223
- });
224
-
225
- const balances = makeTokensBalance(connectedWallets);
226
-
227
- return {
228
- loading: false,
229
- balances,
230
- connectedWallets,
231
- };
232
- });
203
+ }),
204
+ }));
233
205
  }
234
206
  },
235
- getBalanceFor: (token) => {
236
- const { balances } = get();
237
- const tokenHash = createTokenHash(token);
238
- const balance = balances[tokenHash];
239
- return balance ?? null;
240
- },
241
207
  }))
242
208
  )
243
209
  );
210
+
211
+ export const fetchingBalanceSelector = (state: WalletsStore) =>
212
+ !!state.connectedWallets.find((wallet) => wallet.loading);
@@ -61,7 +61,7 @@ export type WidgetTheme = {
61
61
  * @property {{ [key: string]: string }} wallets - If you want to change the default affiliate wallet
62
62
  * addresses, you can provide new values here. (Map of route blockchains to affiliate address)
63
63
  */
64
- export type WidgetAffiliate = {
64
+ export type WidgeAffiliate = {
65
65
  ref?: string;
66
66
  percent?: number;
67
67
  wallets?: { [key: string]: string };
@@ -77,58 +77,21 @@ export type WidgetAffiliate = {
77
77
  * blockchains. e.g. ['BSC','ETHEREUM']
78
78
  * @property {Asset[]} tokens - The `tokens` property is an optional array of `Asset` objects that
79
79
  * you could use that to limit tokens to some limited ones.
80
- * @property {Asset} pinnedTokens - The `pinnedTokens` property is an optional array of `Asset` objects that
81
- * you could use to pin tokens of your choice to the top of the token list.
82
80
  */
83
81
  export type BlockchainAndTokenConfig = {
84
82
  blockchain?: string;
85
83
  token?: Asset;
86
84
  blockchains?: string[];
87
85
  tokens?: Asset[];
88
- pinnedTokens?: Asset[];
89
86
  };
90
87
 
91
- /**
92
- * `Features`
93
- *
94
- * @property {'visible' | 'hidden'} [theme]
95
- * - The visibility state for the theme feature. Optional property.
96
- *
97
- * @property {'visible' | 'hidden'} [language]
98
- * - The visibility state for the language feature. Optional property.
99
- *
100
- * @property {'disabled' | 'enabled'} [experimentalRoute]
101
- * - The enablement state for the experimental route feature. Optional property.
102
- *
103
- * @property {'visible' | 'hidden'} [connectWalletButton]
104
- * - The visibility state for the connect wallet button feature. Optional property.
105
- *
106
- * @property {'visible' | 'hidden'} [notification]
107
- * - The visibility state for the notification feature. Optional property.
108
- *
109
- * @property {'visible' | 'hidden'} [liquiditySource]
110
- * - The visibility state for the liquiditySource feature. Optional property.
111
- */
112
- export type Features = Partial<
113
- Record<
114
- | 'theme'
115
- | 'language'
116
- | 'connectWalletButton'
117
- | 'notification'
118
- | 'liquiditySource',
119
- 'visible' | 'hidden'
120
- >
121
- > &
122
- Partial<Record<'experimentalRoute', 'disabled' | 'enabled'>>;
123
-
124
88
  /**
125
89
  * The type WidgetConfig defines the configuration options for a widget, including API key, affiliate
126
90
  * reference, amount, blockchain and token configurations, liquidity sources, wallet types, language,
127
91
  * and theme.
128
92
  *
129
93
  * @property {string} apiKey - The API key used to communicate with Rango API
130
- * @property {string} apiUrl - The API url used to set custom API url
131
- * @property {WidgetAffiliate} affiliate - If you want to charge users fee per transaction, you should
94
+ * @property {WidgeAffiliate} affiliate - If you want to charge users fee per transaction, you should
132
95
  * pass `WidgetAffiliate` including affiliateRef, affiliatePercent, and affiliateWallets.
133
96
  * @property {number} amount - The default input amount.
134
97
  * @property {BlockchainAndTokenConfig} from - The `from` property is an optional property of type
@@ -156,23 +119,15 @@ export type Features = Partial<
156
119
  * that defines the various properties of the theme, such as colors, fonts, and others.
157
120
  * @property {boolean} externalWallets
158
121
  * If `externalWallets` is `true`, you should add `WidgetWallets` to your app.
159
- * @property {boolean} enableNewLiquiditySources - The `enableNewLiquiditySources` property is a boolean value that when you
122
+ * @property {Asset} pinnedTokens - The `pinnedTokens` property is an optional array of `Asset` objects that
123
+ * you could use to pin tokens of your choice to the top of the token list.
124
+ * @property {boolean} includeNewLiquiditySources - The `includeNewLiquiditySources` property is a boolean value that when you
160
125
  * set it to true, whenever a new liquidity source is added, it will be added to your list as well.
161
- * @property {Features} features - An optional object for configuring the visibility or enablement of various features.
162
- * Keys include:
163
- * - 'notification': Visibility state for the notification icon.
164
- * - 'theme': Visibility state for the theme.
165
- * - 'liquiditySource': Visibility state for liquidity source.
166
- * - 'connectWalletButton': Visibility state for the wallet connect icon.
167
- * - 'language': Visibility state for the language.
168
- * - 'experimentalRoute': Enablement state for the experimental route.
169
126
  */
170
-
171
127
  export type WidgetConfig = {
172
128
  apiKey: string;
173
- apiUrl?: string;
174
129
  walletConnectProjectId?: string;
175
- affiliate?: WidgetAffiliate;
130
+ affiliate?: WidgeAffiliate;
176
131
  amount?: number;
177
132
  from?: BlockchainAndTokenConfig;
178
133
  to?: BlockchainAndTokenConfig;
@@ -183,6 +138,6 @@ export type WidgetConfig = {
183
138
  language?: Language;
184
139
  theme?: WidgetTheme;
185
140
  externalWallets?: boolean;
186
- enableNewLiquiditySources?: boolean;
187
- features?: Features;
141
+ pinnedTokens?: Asset[];
142
+ includeNewLiquiditySources?: boolean;
188
143
  };
@@ -1,4 +1,4 @@
1
1
  export * from './swap';
2
2
  export * from './config';
3
- export * from './quote';
3
+ export * from './routing';
4
4
  export * from './wallets';
@@ -0,0 +1,77 @@
1
+ /* eslint-disable @typescript-eslint/prefer-enum-initializers */
2
+ import type { RouteState } from '../store/bestRoute';
3
+ import type { SettingsState } from '../store/settings';
4
+
5
+ interface BestRouteStoreParams {
6
+ fromBlockchain?: RouteState['fromBlockchain'];
7
+ toBlockchain?: RouteState['toBlockchain'];
8
+ fromToken?: RouteState['fromToken'];
9
+ toToken?: RouteState['toToken'];
10
+ inputAmount?: RouteState['inputAmount'];
11
+ }
12
+
13
+ interface SettingsStoreParams {
14
+ slippage?: SettingsState['slippage'];
15
+ customSlippage?: SettingsState['customSlippage'];
16
+ disabledLiquiditySources?: SettingsState['disabledLiquiditySources'];
17
+ infiniteApprove?: SettingsState['infiniteApprove'];
18
+ }
19
+
20
+ export type BestRouteEqualityParams =
21
+ | {
22
+ store: 'bestRoute';
23
+ prevState: BestRouteStoreParams;
24
+ currentState: BestRouteStoreParams;
25
+ }
26
+ | {
27
+ store: 'settings';
28
+ prevState: SettingsStoreParams;
29
+ currentState: SettingsStoreParams;
30
+ };
31
+
32
+ export enum ConfirmSwapErrorTypes {
33
+ NO_ROUTE,
34
+ ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS,
35
+ REQUEST_FAILED,
36
+ REQUEST_CANCELED,
37
+ }
38
+
39
+ export type ConfirmSwapError =
40
+ | {
41
+ type: ConfirmSwapErrorTypes.NO_ROUTE;
42
+ diagnosisMessage?: string;
43
+ }
44
+ | {
45
+ type: Exclude<ConfirmSwapErrorTypes, ConfirmSwapErrorTypes.NO_ROUTE>;
46
+ };
47
+
48
+ export enum RouteWarningType {
49
+ ROUTE_UPDATED,
50
+ ROUTE_SWAPPERS_UPDATED,
51
+ ROUTE_COINS_UPDATED,
52
+ ROUTE_AND_OUTPUT_AMOUNT_UPDATED,
53
+ }
54
+
55
+ export type RouteWarning =
56
+ | {
57
+ type: RouteWarningType.ROUTE_AND_OUTPUT_AMOUNT_UPDATED;
58
+ newOutputAmount: string;
59
+ percentageChange: string;
60
+ }
61
+ | {
62
+ type: Exclude<
63
+ RouteWarningType,
64
+ RouteWarningType.ROUTE_AND_OUTPUT_AMOUNT_UPDATED
65
+ >;
66
+ };
67
+
68
+ export enum SlippageWarningType {
69
+ INSUFFICIENT_SLIPPAGE,
70
+ HIGH_SLIPPAGE,
71
+ }
72
+
73
+ export type ConfirmSwapWarnings = {
74
+ route: RouteWarning | null;
75
+ balance: { messages: string[] } | null;
76
+ slippage: { type: SlippageWarningType; slippage: string | null } | null;
77
+ };
package/src/types/swap.ts CHANGED
@@ -1,14 +1,23 @@
1
- import type { SwapSavedSettings } from 'rango-types';
1
+ import type { SwapSavedSettings } from 'rango-types/lib';
2
2
 
3
3
  export type PendingSwapSettings = Omit<
4
4
  SwapSavedSettings,
5
5
  'disabledSwappersIds'
6
6
  >;
7
7
 
8
- export type SwapButtonState = {
9
- disabled: boolean;
8
+ export enum ButtonState {
9
+ WAITFORCONNECTING = 'waitForConnecting',
10
+ SWAP = 'swap',
11
+ NEEDTOCONFIRM = 'needToConfirm',
12
+ WARNING = 'warning',
13
+ }
14
+
15
+ export type SwapButtonState = (
16
+ | { disabled: true }
17
+ | { disabled: false; hasWarning?: boolean }
18
+ ) & {
10
19
  title: string;
11
- action: 'connect-wallet' | 'confirm-warning' | 'confirm-swap';
20
+ state: ButtonState;
12
21
  };
13
22
 
14
23
  export type ConvertedToken = {
@@ -1,24 +1,7 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
1
+ import { WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  export interface Wallet {
4
4
  chain: string;
5
5
  address: string;
6
6
  walletType: WalletType;
7
7
  }
8
-
9
- export type Balance = {
10
- amount: string;
11
- decimals: number;
12
- usdValue: string;
13
- };
14
-
15
- type Blockchain = string;
16
- type TokenSymbol = string;
17
- type Address = string;
18
-
19
- /** `blockchain-symbol-Address` */
20
- export type TokenHash = `${Blockchain}-${TokenSymbol}-${Address}`;
21
-
22
- export type TokensBalance = {
23
- [key: TokenHash]: Balance;
24
- };
@@ -31,7 +31,7 @@ export const generateRangeColors = (name: string, color: string) => {
31
31
  const NUMBER_OF_COLORS = 10;
32
32
  const HALF_NUMBER_OF_COLORS = 5;
33
33
  const COLOR_SUFFIX = 100;
34
- const AMT = 25;
34
+ const AMT = 32;
35
35
 
36
36
  let colors = { [name]: color };
37
37
  for (let i = 1; i < NUMBER_OF_COLORS; i++) {
@@ -60,7 +60,6 @@ export const generateRangeColors = (name: string, color: string) => {
60
60
  };
61
61
  }
62
62
  }
63
-
64
63
  return colors;
65
64
  };
66
65
  export const generateColors = (
@@ -2,7 +2,6 @@ import { RANGO_PUBLIC_API_KEY } from '../constants';
2
2
 
3
3
  export interface Configs {
4
4
  API_KEY: string;
5
- BASE_URL?: string;
6
5
  }
7
6
 
8
7
  let configs: Configs = {
@@ -10,7 +9,7 @@ let configs: Configs = {
10
9
  };
11
10
 
12
11
  export function getConfig(name: keyof Configs) {
13
- return configs[name] || '';
12
+ return configs[name];
14
13
  }
15
14
 
16
15
  export function setConfig(name: keyof Configs, value: any) {
package/src/utils/date.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { GroupBy } from '../components/SwapsGroup/SwapsGroup.types';
2
- import type { PendingSwap } from 'rango-types';
2
+ import type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
3
3
 
4
4
  import dayjs from 'dayjs';
5
5
 
package/src/utils/meta.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
1
+ import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
2
2
 
3
3
  import { tokensAreEqual } from './wallets';
4
4
 
@@ -17,13 +17,6 @@ export function getBlockchainShortNameFor(
17
17
  ?.shortName;
18
18
  }
19
19
 
20
- export function getSwapperDisplayName(
21
- swapperId: string,
22
- swappers: SwapperMeta[]
23
- ) {
24
- return swappers.find((swapper) => swapper.id === swapperId)?.swapperGroup;
25
- }
26
-
27
20
  export function findToken(t: Asset, tokens: Token[]) {
28
21
  return tokens.find((token) => tokensAreEqual(token, t)) ?? null;
29
22
  }
@@ -16,7 +16,7 @@ export const secondsToString = (s: number): string => {
16
16
  };
17
17
 
18
18
  export const numberToString = (
19
- number: BigNumber | string | number | null | undefined,
19
+ number: BigNumber | string | null | undefined,
20
20
  minDecimals: number | null = null,
21
21
  maxDecimals: number | null = null
22
22
  ): string => {