@rango-dev/widget-embedded 0.12.1-next.7 → 0.12.1-next.8

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 (469) hide show
  1. package/dist/Wallets.d.ts +4 -3
  2. package/dist/Wallets.d.ts.map +1 -1
  3. package/dist/Widget.d.ts +3 -2
  4. package/dist/Widget.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts +1 -1
  6. package/dist/components/AppRoutes.d.ts.map +1 -1
  7. package/dist/components/BlockchainList/BlockchainList.d.ts +4 -0
  8. package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -0
  9. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +4 -0
  10. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -0
  11. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +297 -0
  12. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -0
  13. package/dist/components/BlockchainList/BlockchainList.types.d.ts +8 -0
  14. package/dist/components/BlockchainList/BlockchainList.types.d.ts.map +1 -0
  15. package/dist/components/BlockchainList/LoadingBlockchainList.d.ts +3 -0
  16. package/dist/components/BlockchainList/LoadingBlockchainList.d.ts.map +1 -0
  17. package/dist/components/BlockchainList/index.d.ts +2 -0
  18. package/dist/components/BlockchainList/index.d.ts.map +1 -0
  19. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
  20. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
  21. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +151 -0
  22. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
  23. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
  24. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
  25. package/dist/components/BlockchainsChip/index.d.ts +2 -0
  26. package/dist/components/BlockchainsChip/index.d.ts.map +1 -0
  27. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +3 -0
  28. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +1 -0
  29. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts +4 -0
  30. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -0
  31. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +149 -0
  32. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -0
  33. package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts +9 -0
  34. package/dist/components/BlockchainsSection/BlockchainsSection.types.d.ts.map +1 -0
  35. package/dist/components/BlockchainsSection/index.d.ts +2 -0
  36. package/dist/components/BlockchainsSection/index.d.ts.map +1 -0
  37. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +6 -0
  38. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -0
  39. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +2522 -0
  40. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -0
  41. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts +4 -0
  42. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -0
  43. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +11 -0
  44. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -0
  45. package/dist/components/ConfirmWalletsModal/WalletList.d.ts +4 -0
  46. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -0
  47. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +445 -0
  48. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -0
  49. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +12 -0
  50. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -0
  51. package/dist/components/HeaderButtons/BackButton.d.ts +5 -0
  52. package/dist/components/HeaderButtons/BackButton.d.ts.map +1 -0
  53. package/dist/components/HeaderButtons/CancelButton.d.ts +5 -0
  54. package/dist/components/HeaderButtons/CancelButton.d.ts.map +1 -0
  55. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +875 -0
  56. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -0
  57. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +12 -0
  58. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -0
  59. package/dist/components/HeaderButtons/HomeButtons.d.ts +4 -0
  60. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -0
  61. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts +3 -0
  62. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -0
  63. package/dist/components/HeaderButtons/WalletButton.d.ts +5 -0
  64. package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -0
  65. package/dist/components/HeaderButtons/index.d.ts +5 -0
  66. package/dist/components/HeaderButtons/index.d.ts.map +1 -0
  67. package/dist/components/Layout/Layout.d.ts +7 -0
  68. package/dist/components/Layout/Layout.d.ts.map +1 -0
  69. package/dist/components/Layout/Layout.styles.d.ts +449 -0
  70. package/dist/components/Layout/Layout.styles.d.ts.map +1 -0
  71. package/dist/components/Layout/Layout.types.d.ts +17 -0
  72. package/dist/components/Layout/Layout.types.d.ts.map +1 -0
  73. package/dist/components/Layout/index.d.ts +2 -0
  74. package/dist/components/Layout/index.d.ts.map +1 -0
  75. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts +3 -0
  76. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.d.ts.map +1 -0
  77. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +150 -0
  78. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -0
  79. package/dist/components/LoadingLiquiditySourceList/index.d.ts +2 -0
  80. package/dist/components/LoadingLiquiditySourceList/index.d.ts.map +1 -0
  81. package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
  82. package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
  83. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
  84. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
  85. package/dist/components/NoRoutes/NoRoutes.styles.d.ts +445 -0
  86. package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -0
  87. package/dist/components/NoRoutes/NoRoutes.types.d.ts +20 -0
  88. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
  89. package/dist/components/NoRoutes/index.d.ts +2 -0
  90. package/dist/components/NoRoutes/index.d.ts.map +1 -0
  91. package/dist/components/NotificationContent/NotificationContent.d.ts +3 -0
  92. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -0
  93. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +593 -0
  94. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -0
  95. package/dist/components/NotificationContent/NotificationNotFound.d.ts +3 -0
  96. package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +1 -0
  97. package/dist/components/NotificationContent/index.d.ts +2 -0
  98. package/dist/components/NotificationContent/index.d.ts.map +1 -0
  99. package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
  100. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
  101. package/dist/components/RouteErrors/RouteErrors.styles.d.ts +593 -0
  102. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
  103. package/dist/components/RouteErrors/RouteErrors.types.d.ts +22 -0
  104. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
  105. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
  106. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
  107. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
  108. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
  109. package/dist/components/RouteErrors/index.d.ts +2 -0
  110. package/dist/components/RouteErrors/index.d.ts.map +1 -0
  111. package/dist/components/SearchInput/SearchInput.d.ts +4 -0
  112. package/dist/components/SearchInput/SearchInput.d.ts.map +1 -0
  113. package/dist/components/SearchInput/SearchInput.styles.d.ts +149 -0
  114. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -0
  115. package/dist/components/SearchInput/SearchInput.types.d.ts +10 -0
  116. package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -0
  117. package/dist/components/SearchInput/index.d.ts +2 -0
  118. package/dist/components/SearchInput/index.d.ts.map +1 -0
  119. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
  120. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
  121. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
  122. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
  123. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +445 -0
  124. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
  125. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +12 -0
  126. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
  127. package/dist/components/SelectableCategoryList/index.d.ts +2 -0
  128. package/dist/components/SelectableCategoryList/index.d.ts.map +1 -0
  129. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +741 -0
  130. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -0
  131. package/dist/components/SettingsContainer/index.d.ts +2 -0
  132. package/dist/components/SettingsContainer/index.d.ts.map +1 -0
  133. package/dist/components/Slippage/Slippage.d.ts +3 -0
  134. package/dist/components/Slippage/Slippage.d.ts.map +1 -0
  135. package/dist/components/Slippage/Slippage.styles.d.ts +593 -0
  136. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -0
  137. package/dist/components/Slippage/SlippageTooltipContent.d.ts +3 -0
  138. package/dist/components/Slippage/SlippageTooltipContent.d.ts.map +1 -0
  139. package/dist/components/Slippage/index.d.ts +2 -0
  140. package/dist/components/Slippage/index.d.ts.map +1 -0
  141. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts +4 -0
  142. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -0
  143. package/dist/components/SwapDetails/SwapDetails.d.ts +4 -0
  144. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -0
  145. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +15 -0
  146. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -0
  147. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1037 -0
  148. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -0
  149. package/dist/components/SwapDetails/SwapDetails.types.d.ts +12 -0
  150. package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -0
  151. package/dist/components/SwapDetails/index.d.ts +2 -0
  152. package/dist/components/SwapDetails/index.d.ts.map +1 -0
  153. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts +4 -0
  154. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -0
  155. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts +4 -0
  156. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -0
  157. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts +4 -0
  158. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -0
  159. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +149 -0
  160. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -0
  161. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +20 -0
  162. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -0
  163. package/dist/components/SwapDetailsAlerts/index.d.ts +3 -0
  164. package/dist/components/SwapDetailsAlerts/index.d.ts.map +1 -0
  165. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts +4 -0
  166. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -0
  167. package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts +4 -0
  168. package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -0
  169. package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts +4 -0
  170. package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -0
  171. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +4 -0
  172. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -0
  173. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts +4 -0
  174. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -0
  175. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +4 -0
  176. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -0
  177. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +149 -0
  178. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -0
  179. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +45 -0
  180. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -0
  181. package/dist/components/SwapDetailsModal/index.d.ts +4 -0
  182. package/dist/components/SwapDetailsModal/index.d.ts.map +1 -0
  183. package/dist/components/SwapsGroup/SwapsGroup.d.ts +4 -0
  184. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -0
  185. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +593 -0
  186. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -0
  187. package/dist/components/SwapsGroup/SwapsGroup.types.d.ts +12 -0
  188. package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +1 -0
  189. package/dist/components/SwapsGroup/index.d.ts +2 -0
  190. package/dist/components/SwapsGroup/index.d.ts.map +1 -0
  191. package/dist/components/SwitchFromAndTo.d.ts +1 -1
  192. package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
  193. package/dist/components/TokenList/LoadingTokenList.d.ts +4 -0
  194. package/dist/components/TokenList/LoadingTokenList.d.ts.map +1 -0
  195. package/dist/components/TokenList/TokenList.d.ts +4 -0
  196. package/dist/components/TokenList/TokenList.d.ts.map +1 -0
  197. package/dist/components/TokenList/TokenList.helpers.d.ts +3 -0
  198. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -0
  199. package/dist/components/TokenList/TokenList.styles.d.ts +1334 -0
  200. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -0
  201. package/dist/components/TokenList/TokenList.types.d.ts +40 -0
  202. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -0
  203. package/dist/components/TokenList/index.d.ts +3 -0
  204. package/dist/components/TokenList/index.d.ts.map +1 -0
  205. package/dist/components/UpdateUrl.d.ts.map +1 -1
  206. package/dist/components/WalletModal/WalletModal.d.ts +4 -0
  207. package/dist/components/WalletModal/WalletModal.d.ts.map +1 -0
  208. package/dist/components/WalletModal/WalletModal.types.d.ts +10 -0
  209. package/dist/components/WalletModal/WalletModal.types.d.ts.map +1 -0
  210. package/dist/components/WalletModal/WalletModalContent.d.ts +4 -0
  211. package/dist/components/WalletModal/WalletModalContent.d.ts.map +1 -0
  212. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +593 -0
  213. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -0
  214. package/dist/components/WalletModal/index.d.ts +2 -0
  215. package/dist/components/WalletModal/index.d.ts.map +1 -0
  216. package/dist/components/WidgetEvents.d.ts.map +1 -1
  217. package/dist/constants/errors.d.ts +29 -0
  218. package/dist/constants/errors.d.ts.map +1 -1
  219. package/dist/constants/messages.d.ts +7 -0
  220. package/dist/constants/messages.d.ts.map +1 -0
  221. package/dist/constants/navigationRoutes.d.ts +8 -4
  222. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  223. package/dist/constants/routing.d.ts +3 -0
  224. package/dist/constants/routing.d.ts.map +1 -0
  225. package/dist/constants/searchParams.d.ts +2 -2
  226. package/dist/constants/searchParams.d.ts.map +1 -1
  227. package/dist/constants/swapSettings.d.ts.map +1 -1
  228. package/dist/constants/wallets.d.ts +3 -0
  229. package/dist/constants/wallets.d.ts.map +1 -0
  230. package/dist/constants/warnings.d.ts +3 -0
  231. package/dist/constants/warnings.d.ts.map +1 -0
  232. package/dist/hooks/useConfirmSwap.d.ts +14 -6
  233. package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
  234. package/dist/hooks/useFetchBestRoute.d.ts +9 -0
  235. package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
  236. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  237. package/dist/hooks/useSwapInput.d.ts +12 -0
  238. package/dist/hooks/useSwapInput.d.ts.map +1 -0
  239. package/dist/hooks/useTheme.d.ts +3 -26
  240. package/dist/hooks/useTheme.d.ts.map +1 -1
  241. package/dist/hooks/useWalletList.d.ts +20 -0
  242. package/dist/hooks/useWalletList.d.ts.map +1 -0
  243. package/dist/index.js +1 -1
  244. package/dist/index.js.map +4 -4
  245. package/dist/pages/ConfirmSwapPage.d.ts +6 -3
  246. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  247. package/dist/pages/HistoryPage.d.ts.map +1 -1
  248. package/dist/pages/Home.d.ts.map +1 -1
  249. package/dist/pages/LanguagePage.d.ts +3 -0
  250. package/dist/pages/LanguagePage.d.ts.map +1 -0
  251. package/dist/pages/LiquiditySourcePage.d.ts +8 -0
  252. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -0
  253. package/dist/pages/SelectBlockchainPage.d.ts +8 -0
  254. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -0
  255. package/dist/pages/SelectSwapItemsPage.d.ts +11 -0
  256. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -0
  257. package/dist/pages/SettingsPage.d.ts.map +1 -1
  258. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  259. package/dist/pages/ThemePage.d.ts +3 -0
  260. package/dist/pages/ThemePage.d.ts.map +1 -0
  261. package/dist/pages/WalletsPage.d.ts +4 -2
  262. package/dist/pages/WalletsPage.d.ts.map +1 -1
  263. package/dist/store/bestRoute.d.ts +32 -19
  264. package/dist/store/bestRoute.d.ts.map +1 -1
  265. package/dist/store/meta.d.ts +10 -3
  266. package/dist/store/meta.d.ts.map +1 -1
  267. package/dist/store/notification.d.ts +38 -0
  268. package/dist/store/notification.d.ts.map +1 -0
  269. package/dist/store/settings.d.ts +2 -2
  270. package/dist/store/settings.d.ts.map +1 -1
  271. package/dist/store/ui.d.ts +0 -2
  272. package/dist/store/ui.d.ts.map +1 -1
  273. package/dist/store/wallets.d.ts +14 -12
  274. package/dist/store/wallets.d.ts.map +1 -1
  275. package/dist/types/config.d.ts +8 -6
  276. package/dist/types/config.d.ts.map +1 -1
  277. package/dist/types/notification.d.ts +22 -0
  278. package/dist/types/notification.d.ts.map +1 -0
  279. package/dist/types/routing.d.ts +30 -23
  280. package/dist/types/routing.d.ts.map +1 -1
  281. package/dist/types/swap.d.ts +8 -1
  282. package/dist/types/swap.d.ts.map +1 -1
  283. package/dist/utils/common.d.ts +5 -0
  284. package/dist/utils/common.d.ts.map +1 -1
  285. package/dist/utils/date.d.ts +1 -1
  286. package/dist/utils/date.d.ts.map +1 -1
  287. package/dist/utils/meta.d.ts +3 -0
  288. package/dist/utils/meta.d.ts.map +1 -0
  289. package/dist/utils/numbers.d.ts +2 -1
  290. package/dist/utils/numbers.d.ts.map +1 -1
  291. package/dist/utils/routing.d.ts +5 -5
  292. package/dist/utils/routing.d.ts.map +1 -1
  293. package/dist/utils/settings.d.ts +10 -0
  294. package/dist/utils/settings.d.ts.map +1 -0
  295. package/dist/utils/swap.d.ts +28 -13
  296. package/dist/utils/swap.d.ts.map +1 -1
  297. package/dist/utils/wallets.d.ts +20 -14
  298. package/dist/utils/wallets.d.ts.map +1 -1
  299. package/package.json +7 -7
  300. package/src/Wallets.tsx +23 -17
  301. package/src/Widget.tsx +21 -27
  302. package/src/components/AppRoutes.tsx +54 -19
  303. package/src/components/BlockchainList/BlockchainList.helpers.ts +37 -0
  304. package/src/components/BlockchainList/BlockchainList.styles.ts +18 -0
  305. package/src/components/BlockchainList/BlockchainList.tsx +76 -0
  306. package/src/components/BlockchainList/BlockchainList.types.ts +8 -0
  307. package/src/components/BlockchainList/LoadingBlockchainList.tsx +20 -0
  308. package/src/components/BlockchainList/index.ts +1 -0
  309. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +30 -0
  310. package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
  311. package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
  312. package/src/components/BlockchainsChip/index.ts +1 -0
  313. package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +20 -0
  314. package/src/components/BlockchainsSection/BlockchainsSection.styles.ts +7 -0
  315. package/src/components/BlockchainsSection/BlockchainsSection.tsx +100 -0
  316. package/src/components/BlockchainsSection/BlockchainsSection.types.ts +9 -0
  317. package/src/components/BlockchainsSection/index.ts +1 -0
  318. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -0
  319. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +169 -0
  320. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +451 -0
  321. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +11 -0
  322. package/src/components/ConfirmWalletsModal/WalletList.styles.ts +34 -0
  323. package/src/components/ConfirmWalletsModal/WalletList.tsx +250 -0
  324. package/src/components/ConfirmWalletsModal/WalletList.type.ts +12 -0
  325. package/src/components/HeaderButtons/BackButton.tsx +16 -0
  326. package/src/components/HeaderButtons/CancelButton.tsx +21 -0
  327. package/src/components/HeaderButtons/HeaderButtons.styles.ts +40 -0
  328. package/src/components/HeaderButtons/HeaderButtons.types.ts +11 -0
  329. package/src/components/HeaderButtons/HomeButtons.tsx +68 -0
  330. package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +21 -0
  331. package/src/components/HeaderButtons/WalletButton.tsx +20 -0
  332. package/src/components/HeaderButtons/index.ts +4 -0
  333. package/src/components/Layout/Layout.styles.ts +51 -0
  334. package/src/components/Layout/Layout.tsx +89 -0
  335. package/src/components/Layout/Layout.types.ts +20 -0
  336. package/src/components/Layout/index.ts +1 -0
  337. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +5 -0
  338. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +23 -0
  339. package/src/components/LoadingLiquiditySourceList/index.ts +1 -0
  340. package/src/components/NoRoutes/NoRoutes.helper.ts +50 -0
  341. package/src/components/NoRoutes/NoRoutes.styles.ts +15 -0
  342. package/src/components/NoRoutes/NoRoutes.tsx +81 -0
  343. package/src/components/NoRoutes/NoRoutes.types.ts +21 -0
  344. package/src/components/NoRoutes/index.ts +1 -0
  345. package/src/components/NotificationContent/NotificationContent.styles.ts +34 -0
  346. package/src/components/NotificationContent/NotificationContent.tsx +112 -0
  347. package/src/components/NotificationContent/NotificationNotFound.tsx +17 -0
  348. package/src/components/NotificationContent/index.ts +1 -0
  349. package/src/components/RouteErrors/RouteErrors.styles.ts +27 -0
  350. package/src/components/RouteErrors/RouteErrors.tsx +68 -0
  351. package/src/components/RouteErrors/RouteErrors.types.ts +27 -0
  352. package/src/components/RouteErrors/RouteErrorsModal.tsx +101 -0
  353. package/src/components/RouteErrors/RouteErrorsModalItem.tsx +24 -0
  354. package/src/components/RouteErrors/index.ts +1 -0
  355. package/src/components/SearchInput/SearchInput.styles.ts +9 -0
  356. package/src/components/SearchInput/SearchInput.tsx +51 -0
  357. package/src/components/SearchInput/SearchInput.types.ts +10 -0
  358. package/src/components/SearchInput/index.ts +1 -0
  359. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +20 -0
  360. package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
  361. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +79 -0
  362. package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +12 -0
  363. package/src/components/SelectableCategoryList/index.ts +1 -0
  364. package/src/components/SettingsContainer/SettingsContainer.style.ts +33 -0
  365. package/src/components/SettingsContainer/index.ts +7 -0
  366. package/src/components/Slippage/Slippage.styles.ts +24 -0
  367. package/src/components/Slippage/Slippage.tsx +90 -0
  368. package/src/components/Slippage/SlippageTooltipContent.tsx +23 -0
  369. package/src/components/Slippage/index.ts +1 -0
  370. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +43 -0
  371. package/src/components/SwapDetails/SwapDetails.helpers.tsx +102 -0
  372. package/src/components/SwapDetails/SwapDetails.styles.ts +76 -0
  373. package/src/components/SwapDetails/SwapDetails.tsx +387 -0
  374. package/src/components/SwapDetails/SwapDetails.types.ts +12 -0
  375. package/src/components/SwapDetails/index.ts +1 -0
  376. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +36 -0
  377. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +55 -0
  378. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.ts +7 -0
  379. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +74 -0
  380. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +28 -0
  381. package/src/components/SwapDetailsAlerts/index.ts +2 -0
  382. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +101 -0
  383. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +34 -0
  384. package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +34 -0
  385. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +35 -0
  386. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +22 -0
  387. package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +6 -0
  388. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +42 -0
  389. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +53 -0
  390. package/src/components/SwapDetailsModal/index.ts +3 -0
  391. package/src/components/SwapsGroup/SwapsGroup.styles.ts +26 -0
  392. package/src/components/SwapsGroup/SwapsGroup.tsx +125 -0
  393. package/src/components/SwapsGroup/SwapsGroup.types.ts +13 -0
  394. package/src/components/SwapsGroup/index.ts +1 -0
  395. package/src/components/SwitchFromAndTo.tsx +24 -8
  396. package/src/components/TokenList/LoadingTokenList.tsx +34 -0
  397. package/src/components/TokenList/TokenList.helpers.ts +13 -0
  398. package/src/components/TokenList/TokenList.styles.ts +115 -0
  399. package/src/components/TokenList/TokenList.tsx +269 -0
  400. package/src/components/TokenList/TokenList.types.ts +47 -0
  401. package/src/components/TokenList/index.ts +2 -0
  402. package/src/components/UpdateUrl.tsx +40 -22
  403. package/src/components/WalletModal/WalletModal.tsx +20 -0
  404. package/src/components/WalletModal/WalletModal.types.ts +11 -0
  405. package/src/components/WalletModal/WalletModalContent.styles.ts +44 -0
  406. package/src/components/WalletModal/WalletModalContent.tsx +54 -0
  407. package/src/components/WalletModal/index.ts +1 -0
  408. package/src/components/WidgetEvents.tsx +30 -4
  409. package/src/constants/errors.ts +56 -1
  410. package/src/constants/messages.ts +8 -0
  411. package/src/constants/navigationRoutes.ts +8 -4
  412. package/src/constants/routing.ts +2 -0
  413. package/src/constants/searchParams.ts +2 -2
  414. package/src/constants/swapSettings.ts +5 -1
  415. package/src/constants/wallets.ts +3 -0
  416. package/src/constants/warnings.ts +26 -0
  417. package/src/hooks/useConfirmSwap.ts +251 -220
  418. package/src/hooks/useFetchBestRoute.ts +38 -0
  419. package/src/hooks/useNavigateBack.ts +15 -9
  420. package/src/hooks/useSwapInput.ts +102 -0
  421. package/src/hooks/useTheme.ts +59 -60
  422. package/src/hooks/useWalletList.ts +125 -0
  423. package/src/pages/ConfirmSwapPage.tsx +470 -228
  424. package/src/pages/HistoryPage.tsx +104 -15
  425. package/src/pages/Home.tsx +345 -111
  426. package/src/pages/LanguagePage.tsx +83 -0
  427. package/src/pages/LiquiditySourcePage.tsx +160 -0
  428. package/src/pages/SelectBlockchainPage.tsx +77 -0
  429. package/src/pages/SelectSwapItemsPage.tsx +153 -0
  430. package/src/pages/SettingsPage.tsx +144 -72
  431. package/src/pages/SwapDetailsPage.tsx +35 -143
  432. package/src/pages/ThemePage.tsx +96 -0
  433. package/src/pages/WalletsPage.tsx +73 -124
  434. package/src/store/bestRoute.ts +85 -180
  435. package/src/store/meta.ts +23 -3
  436. package/src/store/notification.ts +77 -0
  437. package/src/store/settings.ts +20 -13
  438. package/src/store/ui.ts +1 -5
  439. package/src/store/wallets.ts +92 -76
  440. package/src/types/config.ts +9 -7
  441. package/src/types/notification.ts +33 -0
  442. package/src/types/routing.ts +29 -28
  443. package/src/types/swap.ts +9 -1
  444. package/src/utils/common.ts +53 -3
  445. package/src/utils/date.ts +15 -18
  446. package/src/utils/meta.ts +9 -0
  447. package/src/utils/numbers.ts +63 -18
  448. package/src/utils/routing.ts +30 -14
  449. package/src/utils/settings.ts +57 -0
  450. package/src/utils/swap.ts +166 -95
  451. package/src/utils/wallets.ts +159 -110
  452. package/dist/components/ConfirmSwapErrors.d.ts +0 -4
  453. package/dist/components/ConfirmSwapErrors.d.ts.map +0 -1
  454. package/dist/components/ConfirmSwapWarnings.d.ts +0 -3
  455. package/dist/components/ConfirmSwapWarnings.d.ts.map +0 -1
  456. package/dist/components/Layout.d.ts +0 -7
  457. package/dist/components/Layout.d.ts.map +0 -1
  458. package/dist/pages/LiquiditySourcesPage.d.ts +0 -7
  459. package/dist/pages/LiquiditySourcesPage.d.ts.map +0 -1
  460. package/dist/pages/SelectChainPage.d.ts +0 -8
  461. package/dist/pages/SelectChainPage.d.ts.map +0 -1
  462. package/dist/pages/SelectTokenPage.d.ts +0 -15
  463. package/dist/pages/SelectTokenPage.d.ts.map +0 -1
  464. package/src/components/ConfirmSwapErrors.tsx +0 -34
  465. package/src/components/ConfirmSwapWarnings.tsx +0 -22
  466. package/src/components/Layout.tsx +0 -105
  467. package/src/pages/LiquiditySourcesPage.tsx +0 -63
  468. package/src/pages/SelectChainPage.tsx +0 -42
  469. package/src/pages/SelectTokenPage.tsx +0 -64
@@ -0,0 +1,50 @@
1
+ import type { Info } from './NoRoutes.types';
2
+
3
+ import { errorMessages } from '../../constants/errors';
4
+
5
+ export function makeInfo(
6
+ diagnosisMessage: string | null,
7
+ disabledLiquiditySources: string[],
8
+ hasError: boolean,
9
+ toggleAllLiquiditySources: (shouldReset: boolean) => void,
10
+ refetchBestRoute: () => void
11
+ ): Info {
12
+ if (hasError) {
13
+ return {
14
+ alert: {
15
+ type: 'warning',
16
+ text: errorMessages.genericServerError,
17
+ action: {
18
+ onClick: refetchBestRoute,
19
+ title: 'Retry',
20
+ },
21
+ },
22
+ description: '',
23
+ };
24
+ } else if (diagnosisMessage) {
25
+ return {
26
+ alert: {
27
+ type: 'error',
28
+ text: diagnosisMessage,
29
+ action: null,
30
+ },
31
+ description: '',
32
+ };
33
+ } else if (disabledLiquiditySources.length) {
34
+ return {
35
+ alert: {
36
+ type: 'warning',
37
+ text: errorMessages.liquiditySourcesError.title,
38
+ action: {
39
+ onClick: () => toggleAllLiquiditySources(true),
40
+ title: 'Reset',
41
+ },
42
+ },
43
+ description: errorMessages.liquiditySourcesError.description,
44
+ };
45
+ }
46
+ return {
47
+ alert: null,
48
+ description: errorMessages.noRoutesError.description,
49
+ };
50
+ }
@@ -0,0 +1,15 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const Container = styled('div', {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ alignItems: 'center',
7
+ });
8
+
9
+ export const Footer = styled('div', {
10
+ width: '100%',
11
+ });
12
+
13
+ export const PrefixIcon = styled('div', {
14
+ padding: '$6 $0',
15
+ });
@@ -0,0 +1,81 @@
1
+ import type { PropTypes } from './NoRoutes.types';
2
+
3
+ import {
4
+ Alert,
5
+ Button,
6
+ Divider,
7
+ NoRouteIcon,
8
+ RefreshIcon,
9
+ Typography,
10
+ } from '@rango-dev/ui';
11
+ import React from 'react';
12
+
13
+ import { errorMessages } from '../../constants/errors';
14
+ import { useMetaStore } from '../../store/meta';
15
+ import { useSettingsStore } from '../../store/settings';
16
+
17
+ import { makeInfo } from './NoRoutes.helper';
18
+ import { Container, Footer, PrefixIcon } from './NoRoutes.styles';
19
+
20
+ export function NoRoutes(props: PropTypes) {
21
+ const { diagnosisMessage, fetch, error } = props;
22
+ const disabledLiquiditySources =
23
+ useSettingsStore.use.disabledLiquiditySources();
24
+ const loadingMetaStatus = useMetaStore.use.loadingStatus();
25
+ const toggleAllLiquiditySources =
26
+ useSettingsStore.use.toggleAllLiquiditySources();
27
+
28
+ const hasError = error || loadingMetaStatus === 'failed';
29
+
30
+ const info = makeInfo(
31
+ diagnosisMessage ?? null,
32
+ disabledLiquiditySources,
33
+ hasError,
34
+ toggleAllLiquiditySources,
35
+ fetch
36
+ );
37
+
38
+ return (
39
+ <Container>
40
+ <NoRouteIcon size={24} color="gray" />
41
+ <Divider size={4} />
42
+ <Typography variant="title" size="small">
43
+ {errorMessages.noRoutesError.title}
44
+ </Typography>
45
+ {!!info.description && (
46
+ <Typography
47
+ variant="body"
48
+ size="small"
49
+ align="center"
50
+ color="neutral900">
51
+ {info.description}
52
+ </Typography>
53
+ )}
54
+ <Divider size={4} />
55
+ {!!info.alert && (
56
+ <Footer>
57
+ <Alert
58
+ type={info.alert.type}
59
+ title={info.alert.text}
60
+ action={
61
+ info.alert.action && (
62
+ <Button
63
+ size="xsmall"
64
+ type={info.alert.type}
65
+ prefix={
66
+ <PrefixIcon>
67
+ <RefreshIcon size={8} />
68
+ </PrefixIcon>
69
+ }
70
+ onClick={info.alert.action.onClick}>
71
+ {info.alert.action.title}
72
+ </Button>
73
+ )
74
+ }
75
+ variant="alarm"
76
+ />
77
+ </Footer>
78
+ )}
79
+ </Container>
80
+ );
81
+ }
@@ -0,0 +1,21 @@
1
+ export interface PropTypes {
2
+ fetch: () => void;
3
+ error: boolean;
4
+ diagnosisMessage?: string;
5
+ }
6
+
7
+ type AlertAction = {
8
+ title: string;
9
+ onClick: () => void;
10
+ };
11
+
12
+ type NotFoundAlert = {
13
+ type: 'error' | 'warning';
14
+ text: string;
15
+ action: AlertAction | null;
16
+ };
17
+
18
+ export interface Info {
19
+ alert: NotFoundAlert | null;
20
+ description: string;
21
+ }
@@ -0,0 +1 @@
1
+ export { NoRoutes } from './NoRoutes';
@@ -0,0 +1,34 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const Container = styled('div', {
4
+ padding: '$10',
5
+ width: '350px',
6
+ minHeight: '150px',
7
+ });
8
+
9
+ export const List = styled('ul', {
10
+ padding: 0,
11
+ margin: 0,
12
+ listStyle: 'none',
13
+
14
+ '.to-chain-token': {
15
+ transform: 'translateX(-3px)',
16
+ },
17
+ });
18
+
19
+ export const Images = styled('div', {
20
+ display: 'flex',
21
+ padding: 0,
22
+ alignItems: 'center',
23
+ alignSelf: 'stretch',
24
+ });
25
+
26
+ export const NotFoundContainer = styled('div', {
27
+ display: 'flex',
28
+ justifyContent: 'center',
29
+ alignItems: 'center',
30
+ flexDirection: 'column',
31
+ padding: '$10',
32
+ width: '100%',
33
+ height: '150px',
34
+ });
@@ -0,0 +1,112 @@
1
+ import type { Notification } from '../../types/notification';
2
+
3
+ import {
4
+ ChainToken,
5
+ ChevronRightIcon,
6
+ ListItemButton,
7
+ Typography,
8
+ } from '@rango-dev/ui';
9
+ import React from 'react';
10
+ import { useNavigate } from 'react-router-dom';
11
+
12
+ import { useMetaStore } from '../../store/meta';
13
+ import { useNotificationStore } from '../../store/notification';
14
+ import { useUiStore } from '../../store/ui';
15
+
16
+ import { Container, Images, List } from './NotificationContent.styles';
17
+ import { NotificationNotFound } from './NotificationNotFound';
18
+
19
+ const MAX_NOTIFICATIONS_DISPLAYED = 4;
20
+
21
+ export function NotificationContent() {
22
+ const navigate = useNavigate();
23
+ const setSelectedSwap = useUiStore.use.setSelectedSwap();
24
+
25
+ const getUnreadNotifications =
26
+ useNotificationStore.use.getUnreadNotifications();
27
+
28
+ const notifications: Notification[] = getUnreadNotifications();
29
+
30
+ const setAsRead = useNotificationStore.use.setAsRead();
31
+
32
+ const { tokens, blockchains } = useMetaStore.use.meta();
33
+ const sortedNotification = notifications
34
+ .sort((a, b) => b.creationTime - a.creationTime)
35
+ .slice(0, MAX_NOTIFICATIONS_DISPLAYED);
36
+
37
+ const handleOnClick = (requestId: Notification['requestId']) => {
38
+ setAsRead(requestId);
39
+ setSelectedSwap(requestId);
40
+ navigate(`/swaps/${requestId}`);
41
+ };
42
+
43
+ return (
44
+ <Container>
45
+ {sortedNotification.length ? (
46
+ <List>
47
+ {sortedNotification.map((notificationItem) => {
48
+ const fromToken = tokens.find(
49
+ (tokenItem) =>
50
+ tokenItem.address ===
51
+ notificationItem.route.from.tokenAddress &&
52
+ tokenItem.blockchain ===
53
+ notificationItem.route.from.blockchain &&
54
+ tokenItem.symbol === notificationItem.route.from.tokenSymbol
55
+ );
56
+
57
+ const fromBlockchain = blockchains.find(
58
+ (blockchainItem) =>
59
+ blockchainItem.name === notificationItem.route.from.blockchain
60
+ );
61
+
62
+ const toToken = tokens.find(
63
+ (tokenItem) =>
64
+ tokenItem.address === notificationItem.route.to.tokenAddress &&
65
+ tokenItem.blockchain === notificationItem.route.to.blockchain &&
66
+ tokenItem.symbol === notificationItem.route.to.tokenSymbol
67
+ );
68
+
69
+ const toBlockchain = blockchains.find(
70
+ (blockchainItem) =>
71
+ blockchainItem.name === notificationItem.route.to.blockchain
72
+ );
73
+
74
+ return (
75
+ <ListItemButton
76
+ key={notificationItem.requestId}
77
+ onClick={() => handleOnClick(notificationItem.requestId)}
78
+ title={
79
+ <Typography variant="body" size="small" color="$neutral900">
80
+ {notificationItem.event.message}
81
+ </Typography>
82
+ }
83
+ id={notificationItem.requestId}
84
+ start={
85
+ <Images>
86
+ <div className="from-chain-token">
87
+ <ChainToken
88
+ tokenImage={fromToken ? fromToken.image : ''}
89
+ chainImage={fromBlockchain ? fromBlockchain.logo : ''}
90
+ size="small"
91
+ />
92
+ </div>
93
+ <div className="to-chain-token">
94
+ <ChainToken
95
+ tokenImage={toToken ? toToken.image : ''}
96
+ chainImage={toBlockchain ? toBlockchain.logo : ''}
97
+ size="small"
98
+ />
99
+ </div>
100
+ </Images>
101
+ }
102
+ end={<ChevronRightIcon size={12} color="gray" />}
103
+ />
104
+ );
105
+ })}
106
+ </List>
107
+ ) : (
108
+ <NotificationNotFound />
109
+ )}
110
+ </Container>
111
+ );
112
+ }
@@ -0,0 +1,17 @@
1
+ import { i18n } from '@lingui/core';
2
+ import { Divider, NoNotificationIcon, Typography } from '@rango-dev/ui';
3
+ import React from 'react';
4
+
5
+ import { NotFoundContainer } from './NotificationContent.styles';
6
+
7
+ export function NotificationNotFound() {
8
+ return (
9
+ <NotFoundContainer>
10
+ <NoNotificationIcon color="secondary" size={26} />
11
+ <Divider size={12} />
12
+ <Typography variant="body" size="medium" color="neutral900">
13
+ {i18n.t('You have no notification')}
14
+ </Typography>
15
+ </NotFoundContainer>
16
+ );
17
+ }
@@ -0,0 +1 @@
1
+ export { NotificationContent } from './NotificationContent';
@@ -0,0 +1,27 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const Alerts = styled('div', {
4
+ width: '100%',
5
+ paddingTop: '$16',
6
+ });
7
+
8
+ export const Flex = styled('div', {
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ alignItems: 'flex-start',
12
+ gap: 10,
13
+ width: '100%',
14
+ });
15
+
16
+ export const Item = styled('div', {
17
+ display: 'flex',
18
+ padding: '$5 0',
19
+ justifyContent: 'space-between',
20
+ alignItems: 'center',
21
+ width: '100%',
22
+ });
23
+
24
+ export const Action = styled('div', {
25
+ padding: '$2',
26
+ alignSelf: 'flex-start',
27
+ });
@@ -0,0 +1,68 @@
1
+ import type { PropTypes } from './RouteErrors.types';
2
+
3
+ import { Alert, InfoIcon } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { errorMessages } from '../../constants/errors';
7
+ import { useBestRouteStore } from '../../store/bestRoute';
8
+ import { hasLimitError, LimitErrorMessage } from '../../utils/swap';
9
+
10
+ import { Action, Alerts } from './RouteErrors.styles';
11
+ import { RouteErrorsModal } from './RouteErrorsModal';
12
+
13
+ const WARNING_LEVEL_LIMIT = -10;
14
+
15
+ export function RouteErrors(props: PropTypes) {
16
+ const { bestRoute } = useBestRouteStore();
17
+ const {
18
+ highValueLoss,
19
+ percentageChange,
20
+ priceImpactCanNotBeComputed,
21
+ openModal,
22
+ onToggle,
23
+ totalFeeInUsd,
24
+ outputUsdValue,
25
+ inputUsdValue,
26
+ } = props;
27
+ const error = hasLimitError(bestRoute);
28
+ const { recommendation } = LimitErrorMessage(bestRoute);
29
+
30
+ return (
31
+ <>
32
+ <Alerts>
33
+ {!error && (highValueLoss || priceImpactCanNotBeComputed) && (
34
+ <>
35
+ <Alert
36
+ title={
37
+ highValueLoss
38
+ ? errorMessages.highValueLossError.title
39
+ : errorMessages.unknownPriceError.title
40
+ }
41
+ type={
42
+ highValueLoss && !!percentageChange?.lt(WARNING_LEVEL_LIMIT)
43
+ ? 'error'
44
+ : 'warning'
45
+ }
46
+ variant="alarm"
47
+ action={
48
+ <Action onClick={() => onToggle(true)}>
49
+ <InfoIcon size={12} color="gray" />
50
+ </Action>
51
+ }
52
+ />
53
+ </>
54
+ )}
55
+ {error && <Alert type="error" variant="alarm" title={recommendation} />}
56
+ </Alerts>
57
+ <RouteErrorsModal
58
+ highValueLoss={highValueLoss}
59
+ open={openModal}
60
+ onToggle={onToggle}
61
+ percentageChange={percentageChange}
62
+ inputUsdValue={inputUsdValue}
63
+ outputUsdValue={outputUsdValue}
64
+ totalFeeInUsd={totalFeeInUsd}
65
+ />
66
+ </>
67
+ );
68
+ }
@@ -0,0 +1,27 @@
1
+ import type BigNumber from 'bignumber.js';
2
+
3
+ export interface PropTypes {
4
+ openModal: boolean;
5
+ onToggle: (open: boolean) => void;
6
+ totalFeeInUsd: BigNumber | null;
7
+ outputUsdValue: BigNumber | null;
8
+ inputUsdValue: BigNumber | null;
9
+ percentageChange: BigNumber | null;
10
+ highValueLoss: boolean;
11
+ priceImpactCanNotBeComputed: boolean;
12
+ }
13
+
14
+ type ModalPropTypesKeys = keyof Omit<
15
+ PropTypes,
16
+ 'priceImpactCanNotBeComputed' | 'openModal'
17
+ >;
18
+
19
+ export type ModalPropTypes = Pick<PropTypes, ModalPropTypesKeys> & {
20
+ open: boolean;
21
+ };
22
+
23
+ export interface ModalContentData {
24
+ title: string;
25
+ value: string;
26
+ valueColor?: string;
27
+ }
@@ -0,0 +1,101 @@
1
+ import type { ModalPropTypes } from './RouteErrors.types';
2
+
3
+ import {
4
+ Button,
5
+ Divider,
6
+ MessageBox,
7
+ Modal,
8
+ Typography,
9
+ WarningIcon,
10
+ } from '@rango-dev/ui';
11
+ import React from 'react';
12
+ import { useNavigate } from 'react-router-dom';
13
+
14
+ import { errorMessages } from '../../constants/errors';
15
+ import { navigationRoutes } from '../../constants/navigationRoutes';
16
+ import { numberToString } from '../../utils/numbers';
17
+
18
+ import { Flex } from './RouteErrors.styles';
19
+ import { RouteErrorsModalItem } from './RouteErrorsModalItem';
20
+
21
+ const WARNING_LEVEL_LIMIT = -10;
22
+ const MAX_DECIMAL = 2;
23
+ const MIN_DECIMAL = 0;
24
+
25
+ export function RouteErrorsModal(props: ModalPropTypes) {
26
+ const {
27
+ highValueLoss,
28
+ open,
29
+ onToggle,
30
+ percentageChange,
31
+ inputUsdValue,
32
+ outputUsdValue,
33
+ totalFeeInUsd,
34
+ } = props;
35
+ const navigate = useNavigate();
36
+ const type =
37
+ highValueLoss && !!percentageChange?.lt(WARNING_LEVEL_LIMIT)
38
+ ? 'error'
39
+ : 'warning';
40
+ const highValueLossData = [
41
+ { title: 'Swapping', value: numberToString(inputUsdValue) },
42
+ {
43
+ title: 'Gas cost',
44
+ value: numberToString(totalFeeInUsd, MIN_DECIMAL, MAX_DECIMAL),
45
+ },
46
+ { title: 'Receiving', value: numberToString(outputUsdValue) },
47
+ {
48
+ title: 'Price impact',
49
+ value: numberToString(percentageChange, MIN_DECIMAL, MAX_DECIMAL),
50
+ valueColor: `${type}500`,
51
+ },
52
+ ];
53
+
54
+ return (
55
+ <Modal
56
+ open={open}
57
+ onClose={() => onToggle(false)}
58
+ container={document.getElementById('swap-box') || document.body}>
59
+ {highValueLoss ? (
60
+ <MessageBox
61
+ type={type}
62
+ title={errorMessages.highValueLossError.impacTitle}
63
+ description={errorMessages.highValueLossError.description}
64
+ />
65
+ ) : (
66
+ <MessageBox
67
+ type={type}
68
+ title={errorMessages.unknownPriceError.impacTitle}
69
+ description={errorMessages.unknownPriceError.description}
70
+ />
71
+ )}
72
+ {highValueLoss && (
73
+ <Flex>
74
+ <Divider size={20} />
75
+ <Typography size="small" variant="title">
76
+ Details
77
+ </Typography>
78
+ <Flex>
79
+ {highValueLossData.map((item, index) => {
80
+ const key = index;
81
+ return <RouteErrorsModalItem key={key} {...item} />;
82
+ })}
83
+ </Flex>
84
+ </Flex>
85
+ )}
86
+ <Divider size={32} />
87
+ <Button
88
+ type="primary"
89
+ size="large"
90
+ prefix={<WarningIcon />}
91
+ fullWidth
92
+ onClick={() => {
93
+ navigate(navigationRoutes.confirmSwap);
94
+ }}>
95
+ {highValueLoss
96
+ ? errorMessages.highValueLossError.confirmMessage
97
+ : errorMessages.unknownPriceError.confirmMessage}
98
+ </Button>
99
+ </Modal>
100
+ );
101
+ }
@@ -0,0 +1,24 @@
1
+ import type { ModalContentData } from './RouteErrors.types';
2
+
3
+ import { Typography } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { Item } from './RouteErrors.styles';
7
+
8
+ export function RouteErrorsModalItem(props: ModalContentData) {
9
+ const { title, value, valueColor } = props;
10
+
11
+ return (
12
+ <Item>
13
+ <Typography size="medium" variant="label" color="neutral800">
14
+ {title}
15
+ </Typography>
16
+ <Typography
17
+ size="large"
18
+ variant="label"
19
+ color={valueColor || 'foreground'}>
20
+ {`${valueColor ? '%' : '$'}${value}`}
21
+ </Typography>
22
+ </Item>
23
+ );
24
+ }
@@ -0,0 +1 @@
1
+ export { RouteErrors } from './RouteErrors';
@@ -0,0 +1,9 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const IconWrapper = styled('div', {
4
+ width: '$24',
5
+ height: '$24',
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ });
@@ -0,0 +1,51 @@
1
+ import type { PropTypes } from './SearchInput.types';
2
+
3
+ import { CloseIcon, IconButton, SearchIcon, TextField } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { IconWrapper } from './SearchInput.styles';
7
+
8
+ export function SearchInput(props: PropTypes) {
9
+ const {
10
+ variant,
11
+ fullWidth,
12
+ color,
13
+ size,
14
+ onChange,
15
+ value,
16
+ setValue,
17
+ ...inputAttributes
18
+ } = props;
19
+
20
+ return (
21
+ <TextField
22
+ prefix={
23
+ <IconWrapper>
24
+ <SearchIcon color="black" />
25
+ </IconWrapper>
26
+ }
27
+ suffix={
28
+ !!value.length && (
29
+ <IconButton
30
+ variant="ghost"
31
+ onClick={() => setValue?.('')}
32
+ size="small">
33
+ <CloseIcon color="gray" size={10} />
34
+ </IconButton>
35
+ )
36
+ }
37
+ fullWidth={fullWidth}
38
+ color={color}
39
+ variant={variant}
40
+ style={{
41
+ padding: 10,
42
+ borderRadius: 25,
43
+ alignItems: 'center',
44
+ }}
45
+ size={size}
46
+ value={value}
47
+ onChange={onChange}
48
+ {...inputAttributes}
49
+ />
50
+ );
51
+ }
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+
3
+ export type PropTypes = {
4
+ variant?: 'contained' | 'outlined' | 'ghost';
5
+ fullWidth?: boolean;
6
+ color?: 'dark' | 'light';
7
+ size?: 'small' | 'large';
8
+ value: string;
9
+ setValue?: (value: string) => void;
10
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'value'>;
@@ -0,0 +1 @@
1
+ export { SearchInput } from './SearchInput';