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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/dist/QueueManager.d.ts +5 -2
  2. package/dist/QueueManager.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +0 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts +1 -6
  6. package/dist/components/AppRoutes.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -3
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +1 -3
  12. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
  15. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  16. package/dist/components/NoResult/NoResult.d.ts +4 -0
  17. package/dist/components/NoResult/NoResult.d.ts.map +1 -0
  18. package/dist/components/NoResult/NoResult.helpers.d.ts +4 -0
  19. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -0
  20. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts → NoResult/NoResult.styles.d.ts} +1 -1
  21. package/dist/components/{NoRoutes/NoRoutes.styles.d.ts.map → NoResult/NoResult.styles.d.ts.map} +1 -1
  22. package/dist/components/{NoRoutes/NoRoutes.types.d.ts → NoResult/NoResult.types.d.ts} +3 -3
  23. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -0
  24. package/dist/components/NoResult/index.d.ts +2 -0
  25. package/dist/components/NoResult/index.d.ts.map +1 -0
  26. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  27. package/dist/components/Quote/Quote.d.ts +4 -0
  28. package/dist/components/Quote/Quote.d.ts.map +1 -0
  29. package/dist/components/Quote/Quote.styles.d.ts +1429 -0
  30. package/dist/components/Quote/Quote.styles.d.ts.map +1 -0
  31. package/dist/components/Quote/Quote.types.d.ts +22 -0
  32. package/dist/components/Quote/Quote.types.d.ts.map +1 -0
  33. package/dist/components/Quote/QuoteSkeleton.d.ts +4 -0
  34. package/dist/components/Quote/QuoteSkeleton.d.ts.map +1 -0
  35. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +319 -0
  36. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +1 -0
  37. package/dist/components/Quote/QuoteSkeleton.types.d.ts +6 -0
  38. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +1 -0
  39. package/dist/components/Quote/QuoteSummary.d.ts +11 -0
  40. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -0
  41. package/dist/components/Quote/QuoteSummary.styles.d.ts +158 -0
  42. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -0
  43. package/dist/components/Quote/index.d.ts +4 -0
  44. package/dist/components/Quote/index.d.ts.map +1 -0
  45. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +11 -0
  46. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -0
  47. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +4 -0
  48. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +1 -0
  49. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +4 -0
  50. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -0
  51. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +9 -0
  52. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -0
  53. package/dist/components/{RouteErrors/RouteErrors.styles.d.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts} +1 -1
  54. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -0
  55. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +22 -0
  56. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -0
  57. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +11 -0
  58. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -0
  59. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +11 -0
  60. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -0
  61. package/dist/components/QuoteWarningsAndErrors/index.d.ts +2 -0
  62. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +1 -0
  63. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  64. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  65. package/dist/components/UpdateUrl.d.ts +1 -6
  66. package/dist/components/UpdateUrl.d.ts.map +1 -1
  67. package/dist/components/WidgetEvents.d.ts.map +1 -1
  68. package/dist/constants/errors.d.ts +4 -4
  69. package/dist/constants/errors.d.ts.map +1 -1
  70. package/dist/constants/messages.d.ts +1 -1
  71. package/dist/constants/searchParams.d.ts +2 -1
  72. package/dist/constants/searchParams.d.ts.map +1 -1
  73. package/dist/constants/warnings.d.ts +2 -2
  74. package/dist/constants/warnings.d.ts.map +1 -1
  75. package/dist/containers/App/App.d.ts +3 -0
  76. package/dist/containers/App/App.d.ts.map +1 -0
  77. package/dist/containers/App/App.styles.d.ts +158 -0
  78. package/dist/containers/App/App.styles.d.ts.map +1 -0
  79. package/dist/containers/App/index.d.ts +2 -0
  80. package/dist/containers/App/index.d.ts.map +1 -0
  81. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +4 -0
  82. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -0
  83. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +472 -0
  84. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -0
  85. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +17 -0
  86. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -0
  87. package/dist/containers/QuoteInfo/index.d.ts +2 -0
  88. package/dist/containers/QuoteInfo/index.d.ts.map +1 -0
  89. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  90. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  91. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  92. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  93. package/dist/containers/Wallets/index.d.ts +2 -0
  94. package/dist/containers/Wallets/index.d.ts.map +1 -0
  95. package/dist/containers/Widget/Widget.d.ts +5 -0
  96. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  97. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  98. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  99. package/dist/containers/Widget/index.d.ts +3 -0
  100. package/dist/containers/Widget/index.d.ts.map +1 -0
  101. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  102. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  103. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +5 -0
  104. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  105. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  106. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  107. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  108. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  109. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  110. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  111. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  112. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  113. package/dist/hooks/useConfirmSwap/index.d.ts +2 -0
  114. package/dist/hooks/useConfirmSwap/index.d.ts.map +1 -0
  115. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +3 -0
  116. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -0
  117. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +16 -0
  118. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -0
  119. package/dist/hooks/{useConfirmSwap.d.ts → useConfirmSwap/useConfirmSwap.types.d.ts} +5 -7
  120. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -0
  121. package/dist/hooks/{useFetchBestRoute.d.ts → useFetchQuote.d.ts} +3 -3
  122. package/dist/hooks/useFetchQuote.d.ts.map +1 -0
  123. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  124. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  125. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  126. package/dist/hooks/useSwapInput.d.ts +4 -2
  127. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  128. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  129. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  130. package/dist/hooks/useWalletList.d.ts.map +1 -1
  131. package/dist/index.d.ts +10 -4
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +1 -1
  134. package/dist/index.js.map +4 -4
  135. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  136. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  137. package/dist/pages/Home.d.ts.map +1 -1
  138. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  139. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  140. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  141. package/dist/pages/SettingsPage.d.ts +1 -6
  142. package/dist/pages/SettingsPage.d.ts.map +1 -1
  143. package/dist/pages/WalletsPage.d.ts +1 -8
  144. package/dist/pages/WalletsPage.d.ts.map +1 -1
  145. package/dist/store/AppStore.d.ts +11 -0
  146. package/dist/store/AppStore.d.ts.map +1 -0
  147. package/dist/store/app.d.ts +5 -23
  148. package/dist/store/app.d.ts.map +1 -1
  149. package/dist/store/{bestRoute.d.ts → quote.d.ts} +39 -27
  150. package/dist/store/quote.d.ts.map +1 -0
  151. package/dist/store/settings.d.ts +3 -2
  152. package/dist/store/settings.d.ts.map +1 -1
  153. package/dist/store/slices/config.d.ts +3 -2
  154. package/dist/store/slices/config.d.ts.map +1 -1
  155. package/dist/store/slices/data.d.ts +3 -0
  156. package/dist/store/slices/data.d.ts.map +1 -1
  157. package/dist/store/wallets.d.ts +5 -4
  158. package/dist/store/wallets.d.ts.map +1 -1
  159. package/dist/types/config.d.ts +5 -5
  160. package/dist/types/config.d.ts.map +1 -1
  161. package/dist/types/index.d.ts +1 -1
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/quote.d.ts +82 -0
  164. package/dist/types/quote.d.ts.map +1 -0
  165. package/dist/utils/numbers.d.ts +1 -1
  166. package/dist/utils/numbers.d.ts.map +1 -1
  167. package/dist/utils/{routing.d.ts → quote.d.ts} +16 -12
  168. package/dist/utils/quote.d.ts.map +1 -0
  169. package/dist/utils/settings.d.ts +3 -2
  170. package/dist/utils/settings.d.ts.map +1 -1
  171. package/dist/utils/swap.d.ts +25 -22
  172. package/dist/utils/swap.d.ts.map +1 -1
  173. package/dist/utils/wallets.d.ts +2 -2
  174. package/dist/utils/wallets.d.ts.map +1 -1
  175. package/package.json +6 -6
  176. package/src/QueueManager.tsx +17 -17
  177. package/src/components/AppRouter.tsx +6 -5
  178. package/src/components/AppRoutes.tsx +6 -39
  179. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  180. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  181. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +2 -64
  182. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +28 -40
  183. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +1 -3
  184. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  185. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  186. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  187. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  188. package/src/components/{NoRoutes/NoRoutes.helper.ts → NoResult/NoResult.helpers.ts} +16 -9
  189. package/src/components/{NoRoutes/NoRoutes.styles.ts → NoResult/NoResult.styles.ts} +2 -0
  190. package/src/components/{NoRoutes/NoRoutes.tsx → NoResult/NoResult.tsx} +10 -12
  191. package/src/components/{NoRoutes/NoRoutes.types.ts → NoResult/NoResult.types.ts} +3 -2
  192. package/src/components/NoResult/index.ts +1 -0
  193. package/src/components/NotificationContent/NotificationContent.tsx +3 -2
  194. package/src/components/Quote/Quote.styles.ts +212 -0
  195. package/src/components/Quote/Quote.tsx +345 -0
  196. package/src/components/Quote/Quote.types.ts +16 -0
  197. package/src/components/Quote/QuoteSkeleton.styles.ts +110 -0
  198. package/src/components/Quote/QuoteSkeleton.tsx +108 -0
  199. package/src/components/Quote/QuoteSkeleton.types.ts +5 -0
  200. package/src/components/Quote/QuoteSummary.styles.ts +15 -0
  201. package/src/components/Quote/QuoteSummary.tsx +46 -0
  202. package/src/components/Quote/index.ts +3 -0
  203. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +107 -0
  204. package/src/components/{RouteErrors/RouteErrorsModalItem.tsx → QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx} +3 -3
  205. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +67 -0
  206. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +103 -0
  207. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +24 -0
  208. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +77 -0
  209. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +38 -0
  210. package/src/components/QuoteWarningsAndErrors/index.ts +1 -0
  211. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
  212. package/src/components/SwapDetails/SwapDetails.tsx +18 -22
  213. package/src/components/SwitchFromAndTo.tsx +2 -2
  214. package/src/components/TokenList/TokenList.tsx +5 -6
  215. package/src/components/UpdateUrl.tsx +36 -26
  216. package/src/components/WidgetEvents.tsx +4 -2
  217. package/src/constants/errors.ts +8 -10
  218. package/src/constants/messages.ts +1 -1
  219. package/src/constants/searchParams.ts +1 -0
  220. package/src/constants/warnings.ts +7 -7
  221. package/src/containers/App/App.styles.ts +18 -0
  222. package/src/containers/App/App.tsx +65 -0
  223. package/src/containers/App/index.ts +1 -0
  224. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +15 -0
  225. package/src/containers/QuoteInfo/QuoteInfo.tsx +97 -0
  226. package/src/containers/QuoteInfo/QuoteInfo.types.ts +17 -0
  227. package/src/containers/QuoteInfo/index.ts +1 -0
  228. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +40 -32
  229. package/src/containers/Wallets/Wallets.types.ts +12 -0
  230. package/src/containers/Wallets/index.ts +1 -0
  231. package/src/containers/Widget/Widget.tsx +19 -0
  232. package/src/containers/Widget/Widget.types.ts +5 -0
  233. package/src/containers/Widget/index.ts +2 -0
  234. package/src/containers/WidgetInfo/WidgetInfo.tsx +36 -0
  235. package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
  236. package/src/containers/WidgetInfo/index.ts +1 -0
  237. package/src/containers/WidgetProvider/WidgetProvider.tsx +19 -0
  238. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  239. package/src/containers/WidgetProvider/index.ts +1 -0
  240. package/src/hooks/useConfirmSwap/index.ts +1 -0
  241. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +168 -0
  242. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +136 -0
  243. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +19 -0
  244. package/src/hooks/{useFetchBestRoute.ts → useFetchQuote.ts} +3 -3
  245. package/src/hooks/useForceAutoConnect.ts +27 -0
  246. package/src/hooks/useNavigateBack.ts +3 -3
  247. package/src/hooks/useSwapInput.ts +58 -23
  248. package/src/hooks/useSyncStoresWithConfig.ts +22 -19
  249. package/src/hooks/useWalletList.ts +3 -5
  250. package/src/index.ts +10 -3
  251. package/src/pages/ConfirmSwapPage.tsx +58 -235
  252. package/src/pages/HistoryPage.tsx +1 -1
  253. package/src/pages/Home.tsx +58 -247
  254. package/src/pages/LanguagePage.tsx +1 -1
  255. package/src/pages/LiquiditySourcePage.tsx +23 -32
  256. package/src/pages/SelectBlockchainPage.tsx +6 -7
  257. package/src/pages/SelectSwapItemsPage.tsx +5 -5
  258. package/src/pages/SettingsPage.tsx +9 -13
  259. package/src/pages/SwapDetailsPage.tsx +3 -3
  260. package/src/pages/ThemePage.tsx +1 -1
  261. package/src/pages/WalletsPage.tsx +5 -12
  262. package/src/store/AppStore.tsx +35 -0
  263. package/src/store/app.ts +18 -6
  264. package/src/store/{bestRoute.ts → quote.ts} +68 -60
  265. package/src/store/settings.ts +7 -4
  266. package/src/store/slices/config.ts +25 -15
  267. package/src/store/slices/data.ts +64 -29
  268. package/src/store/wallets.ts +11 -8
  269. package/src/types/config.ts +5 -5
  270. package/src/types/index.ts +1 -1
  271. package/src/types/quote.ts +107 -0
  272. package/src/utils/numbers.ts +1 -1
  273. package/src/utils/quote.ts +338 -0
  274. package/src/utils/settings.ts +8 -7
  275. package/src/utils/swap.ts +113 -85
  276. package/src/utils/wallets.ts +29 -17
  277. package/dist/Wallets.d.ts +0 -17
  278. package/dist/Wallets.d.ts.map +0 -1
  279. package/dist/Widget.d.ts +0 -9
  280. package/dist/Widget.d.ts.map +0 -1
  281. package/dist/components/NoRoutes/NoRoutes.d.ts +0 -4
  282. package/dist/components/NoRoutes/NoRoutes.d.ts.map +0 -1
  283. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +0 -3
  284. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +0 -1
  285. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +0 -1
  286. package/dist/components/NoRoutes/index.d.ts +0 -2
  287. package/dist/components/NoRoutes/index.d.ts.map +0 -1
  288. package/dist/components/RouteErrors/RouteErrors.d.ts +0 -4
  289. package/dist/components/RouteErrors/RouteErrors.d.ts.map +0 -1
  290. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +0 -1
  291. package/dist/components/RouteErrors/RouteErrors.types.d.ts +0 -24
  292. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +0 -1
  293. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +0 -4
  294. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +0 -1
  295. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +0 -4
  296. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +0 -1
  297. package/dist/components/RouteErrors/index.d.ts +0 -2
  298. package/dist/components/RouteErrors/index.d.ts.map +0 -1
  299. package/dist/hooks/useConfirmSwap.d.ts.map +0 -1
  300. package/dist/hooks/useFetchBestRoute.d.ts.map +0 -1
  301. package/dist/store/bestRoute.d.ts.map +0 -1
  302. package/dist/store/meta.d.ts +0 -23
  303. package/dist/store/meta.d.ts.map +0 -1
  304. package/dist/types/routing.d.ts +0 -65
  305. package/dist/types/routing.d.ts.map +0 -1
  306. package/dist/utils/routing.d.ts.map +0 -1
  307. package/src/Widget.tsx +0 -119
  308. package/src/components/NoRoutes/index.ts +0 -1
  309. package/src/components/RouteErrors/RouteErrors.tsx +0 -79
  310. package/src/components/RouteErrors/RouteErrors.types.ts +0 -29
  311. package/src/components/RouteErrors/RouteErrorsModal.tsx +0 -129
  312. package/src/components/RouteErrors/index.ts +0 -1
  313. package/src/hooks/useConfirmSwap.ts +0 -303
  314. package/src/store/meta.ts +0 -39
  315. package/src/types/routing.ts +0 -77
  316. package/src/utils/routing.ts +0 -321
  317. /package/src/components/{RouteErrors/RouteErrors.styles.ts → QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts} +0 -0
@@ -0,0 +1,345 @@
1
+ import type { QuoteProps } from './Quote.types';
2
+ import type { Step } from '@rango-dev/ui';
3
+ import type { SwapResult } from 'rango-sdk';
4
+
5
+ import { i18n } from '@lingui/core';
6
+ import {
7
+ Alert,
8
+ ChevronDownIcon,
9
+ ChevronRightIcon,
10
+ Divider,
11
+ Image,
12
+ InfoIcon,
13
+ QuoteCost,
14
+ StepDetails,
15
+ TokenAmount,
16
+ Tooltip,
17
+ Typography,
18
+ } from '@rango-dev/ui';
19
+ import React, { useLayoutEffect, useRef, useState } from 'react';
20
+
21
+ import {
22
+ GAS_FEE_MAX_DECIMALS,
23
+ GAS_FEE_MIN_DECIMALS,
24
+ PERCENTAGE_CHANGE_MAX_DECIMALS,
25
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
26
+ TOKEN_AMOUNT_MAX_DECIMALS,
27
+ TOKEN_AMOUNT_MIN_DECIMALS,
28
+ } from '../../constants/routing';
29
+ import {
30
+ FooterAlert,
31
+ FooterStepAlarm,
32
+ } from '../../containers/QuoteInfo/QuoteInfo.styles';
33
+ import { useAppStore } from '../../store/AppStore';
34
+ import { QuoteErrorType, QuoteWarningType } from '../../types';
35
+ import {
36
+ numberToString,
37
+ secondsToString,
38
+ totalArrivalTime,
39
+ } from '../../utils/numbers';
40
+ import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
41
+ import { getTotalFeeInUsd } from '../../utils/swap';
42
+
43
+ import {
44
+ Chains,
45
+ Content,
46
+ EXPANDABLE_QUOTE_TRANSITION_DURATION,
47
+ FrameIcon,
48
+ HorizontalSeparator,
49
+ IconContainer,
50
+ QuoteContainer,
51
+ SummaryContainer,
52
+ } from './Quote.styles';
53
+ import { QuoteSummary } from './QuoteSummary';
54
+
55
+ export function Quote(props: QuoteProps) {
56
+ const {
57
+ quote,
58
+ input,
59
+ output,
60
+ error,
61
+ warning,
62
+ type,
63
+ recommended = true,
64
+ } = props;
65
+ const tokens = useAppStore().tokens();
66
+
67
+ const [expanded, setExpanded] = useState(props.expanded);
68
+ const quoteRef = useRef<HTMLButtonElement | null>(null);
69
+ const totalFee = numberToString(
70
+ getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
71
+ GAS_FEE_MIN_DECIMALS,
72
+ GAS_FEE_MAX_DECIMALS
73
+ );
74
+ const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
75
+
76
+ const priceImpact = getPriceImpact(input.usdValue, output.usdValue ?? null);
77
+ const percentageChange = numberToString(
78
+ String(priceImpact),
79
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
80
+ PERCENTAGE_CHANGE_MAX_DECIMALS
81
+ );
82
+ const priceImpactWarningLevel = getPriceImpactLevel(priceImpact ?? 0);
83
+
84
+ const getQuoteSteps = (swaps: SwapResult[]): Step[] => {
85
+ return swaps.map((swap, index) => {
86
+ let stepState: 'error' | 'warning' | undefined = undefined;
87
+ const stepHasError =
88
+ (error?.type === QuoteErrorType.BRIDGE_LIMIT &&
89
+ error.swap.swapperId === swap.swapperId) ||
90
+ (warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
91
+ warning.recommendedSlippages?.has(index));
92
+ const stepHasWarning =
93
+ warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
94
+ warning.recommendedSlippages?.has(index);
95
+
96
+ if (stepHasError) {
97
+ stepState = 'error';
98
+ } else if (stepHasWarning) {
99
+ stepState = 'warning';
100
+ }
101
+
102
+ return {
103
+ swapper: { displayName: swap.swapperId, image: swap.swapperLogo },
104
+ from: {
105
+ token: { displayName: swap.from.symbol, image: swap.from.logo },
106
+ chain: {
107
+ displayName: swap.from.blockchain,
108
+ image: swap.from.blockchainLogo,
109
+ },
110
+ price: {
111
+ value:
112
+ index === 0
113
+ ? numberToString(
114
+ input.value,
115
+ TOKEN_AMOUNT_MIN_DECIMALS,
116
+ TOKEN_AMOUNT_MAX_DECIMALS
117
+ )
118
+ : swap.fromAmount,
119
+ },
120
+ },
121
+ to: {
122
+ token: { displayName: swap.to.symbol, image: swap.to.logo },
123
+ chain: {
124
+ displayName: swap.to.blockchain,
125
+ image: swap.to.blockchainLogo,
126
+ },
127
+ price: {
128
+ value: swap.toAmount,
129
+ },
130
+ },
131
+ state: stepState,
132
+ alerts:
133
+ stepHasError || stepHasWarning ? (
134
+ <FooterStepAlarm>
135
+ <Alert
136
+ type={stepHasError ? 'error' : 'warning'}
137
+ title={
138
+ error?.type === QuoteErrorType.BRIDGE_LIMIT
139
+ ? error?.recommendation
140
+ : i18n.t('Slippage Error:')
141
+ }
142
+ footer={
143
+ <FooterAlert>
144
+ {error?.type === QuoteErrorType.BRIDGE_LIMIT && (
145
+ <>
146
+ <Typography
147
+ size="xsmall"
148
+ variant="body"
149
+ color="neutral900">
150
+ {error.fromAmountRangeError}
151
+ </Typography>
152
+ <Divider direction="horizontal" size={8} />
153
+ <Typography
154
+ size="xsmall"
155
+ variant="body"
156
+ color="neutral900">
157
+ |
158
+ </Typography>
159
+ <Divider direction="horizontal" size={8} />
160
+ <Typography
161
+ size="xsmall"
162
+ variant="body"
163
+ color="neutral900">
164
+ {i18n.t({
165
+ id: 'Yours: {amount} {symbol}',
166
+ values: {
167
+ amount: numberToString(
168
+ swap.fromAmount,
169
+ TOKEN_AMOUNT_MIN_DECIMALS,
170
+ TOKEN_AMOUNT_MAX_DECIMALS
171
+ ),
172
+ symbol: swap?.from.symbol,
173
+ },
174
+ })}
175
+ </Typography>
176
+ </>
177
+ )}
178
+ {(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE ||
179
+ warning?.type ===
180
+ QuoteWarningType.INSUFFICIENT_SLIPPAGE) && (
181
+ <Typography
182
+ size="xsmall"
183
+ variant="body"
184
+ color="neutral900">
185
+ {i18n.t({
186
+ id: 'min required Slippage: {minRequiredSlippage}',
187
+ values: {
188
+ ...(error?.type ===
189
+ QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
190
+ minRequiredSlippage:
191
+ error.recommendedSlippages?.get(index),
192
+ }),
193
+ ...(warning?.type ===
194
+ QuoteWarningType.INSUFFICIENT_SLIPPAGE && {
195
+ minRequiredSlippage:
196
+ warning.recommendedSlippages?.get(index),
197
+ }),
198
+ },
199
+ })}
200
+ </Typography>
201
+ )}
202
+ </FooterAlert>
203
+ }
204
+ />
205
+ </FooterStepAlarm>
206
+ ) : undefined,
207
+ };
208
+ });
209
+ };
210
+ const steps = getQuoteSteps(quote.result?.swaps ?? []);
211
+ const numberOfSteps = steps.length;
212
+
213
+ useLayoutEffect(() => {
214
+ if (expanded && quoteRef.current) {
215
+ setTimeout(() => {
216
+ quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
217
+ }, EXPANDABLE_QUOTE_TRANSITION_DURATION);
218
+ }
219
+ }, [expanded]);
220
+
221
+ return (
222
+ <>
223
+ <SummaryContainer
224
+ recommended={recommended}
225
+ listItem={type === 'list-item'}
226
+ basic={type === 'basic'}>
227
+ <div className="summary">
228
+ <QuoteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
229
+ {type === 'basic' && (
230
+ <div className="basic-info">
231
+ <FrameIcon>
232
+ <InfoIcon size={12} color="gray" />
233
+ </FrameIcon>
234
+ <Typography
235
+ size="small"
236
+ variant="body"
237
+ style={{ letterSpacing: 0.4 }}>
238
+ {`${input.value} ${steps[0].from.token.displayName} = ${
239
+ output.value
240
+ } ${steps[steps.length - 1].to.token.displayName}`}
241
+ </Typography>
242
+ <Typography
243
+ color="$neutral600"
244
+ ml={2}
245
+ size="xsmall"
246
+ variant="body">
247
+ {`($${output.usdValue})`}
248
+ </Typography>
249
+ </div>
250
+ )}
251
+ {type === 'list-item' && (
252
+ <TokenAmount
253
+ type="output"
254
+ direction="vertical"
255
+ price={{ value: output.value, usdValue: output.usdValue }}
256
+ token={{
257
+ displayName: steps[numberOfSteps - 1].to.token.displayName,
258
+ image: steps[numberOfSteps - 1].to.token.image,
259
+ }}
260
+ chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
261
+ percentageChange={percentageChange}
262
+ warningLevel={priceImpactWarningLevel}
263
+ />
264
+ )}
265
+ {type === 'swap-preview' && (
266
+ <>
267
+ <QuoteSummary
268
+ from={steps[0].from}
269
+ to={steps[numberOfSteps - 1].to}
270
+ percentageChange={percentageChange}
271
+ warningLevel={priceImpactWarningLevel}
272
+ />
273
+ <Divider size={4} />
274
+ </>
275
+ )}
276
+ </div>
277
+ <QuoteContainer
278
+ recommended={recommended}
279
+ open={expanded}
280
+ onOpenChange={setExpanded}>
281
+ <Chains
282
+ ref={(ref) => (quoteRef.current = ref)}
283
+ recommended={recommended}
284
+ onClick={setExpanded.bind(null, (prevState) => !prevState)}>
285
+ <div>
286
+ {steps.map((step, index) => {
287
+ const key = `item-${index}`;
288
+ return (
289
+ <React.Fragment key={key}>
290
+ <Tooltip
291
+ container={props.tooltipContainer}
292
+ side="bottom"
293
+ sideOffset={4}
294
+ content={step.from.chain.displayName}>
295
+ <Image src={step.from.chain.image} size={16} />
296
+ </Tooltip>
297
+ {index === numberOfSteps - 1 && (
298
+ <>
299
+ <IconContainer>
300
+ <ChevronRightIcon size={12} color="black" />
301
+ </IconContainer>
302
+ <Tooltip
303
+ container={props.tooltipContainer}
304
+ side="bottom"
305
+ sideOffset={4}
306
+ content={step.to.chain.displayName}>
307
+ <Image src={step.to.chain.image} size={16} />
308
+ </Tooltip>
309
+ </>
310
+ )}
311
+ {index !== numberOfSteps - 1 && (
312
+ <IconContainer>
313
+ <ChevronRightIcon size={12} color="black" />
314
+ </IconContainer>
315
+ )}
316
+ </React.Fragment>
317
+ );
318
+ })}
319
+ </div>
320
+ <IconContainer orientation={expanded ? 'up' : 'down'}>
321
+ <ChevronDownIcon size={12} color="black" />
322
+ </IconContainer>
323
+ </Chains>
324
+ <Content open={expanded}>
325
+ <HorizontalSeparator />
326
+ <div className="steps-details">
327
+ {steps.map((step, index) => {
328
+ const key = `item-${index}`;
329
+ return (
330
+ <StepDetails
331
+ type="quote-details"
332
+ key={key}
333
+ step={step}
334
+ hasSeparator={index !== steps.length - 1}
335
+ state={step.state}
336
+ />
337
+ );
338
+ })}
339
+ </div>
340
+ </Content>
341
+ </QuoteContainer>
342
+ </SummaryContainer>
343
+ </>
344
+ );
345
+ }
@@ -0,0 +1,16 @@
1
+ import type { QuoteError, QuoteWarning } from '../../types';
2
+ import type { BestRouteResponse } from 'rango-sdk';
3
+ import type { ReactNode } from 'react';
4
+
5
+ export type QuoteProps = {
6
+ type: 'basic' | 'list-item' | 'swap-preview';
7
+ error: QuoteError | null;
8
+ warning: QuoteWarning | null;
9
+ recommended: boolean;
10
+ tag?: ReactNode;
11
+ quote: BestRouteResponse;
12
+ input: { value: string; usdValue: string };
13
+ output: { value: string; usdValue?: string };
14
+ expanded?: boolean;
15
+ tooltipContainer?: HTMLElement;
16
+ };
@@ -0,0 +1,110 @@
1
+ import { darkTheme, styled } from '@rango-dev/ui';
2
+
3
+ export const Container = styled('div', {
4
+ $$color: '$colors$neutral100',
5
+ [`.${darkTheme} &`]: {
6
+ $$color: '$colors$neutral300',
7
+ },
8
+ backgroundColor: '$$color',
9
+ borderBottomLeftRadius: '$xm',
10
+ borderBottomRightRadius: '$xm',
11
+ padding: '$15 ',
12
+ '& .cost-and-tag': {
13
+ display: 'flex',
14
+ justifyContent: 'space-between',
15
+ alignItems: 'center',
16
+ height: '22px',
17
+ },
18
+ variants: {
19
+ rounded: {
20
+ true: {
21
+ borderRadius: '$xm',
22
+ },
23
+ },
24
+ },
25
+ '& .cost': {
26
+ display: 'flex',
27
+ },
28
+ '& .basic-summary': {
29
+ padding: '$15 $0 14px $0',
30
+ },
31
+ '& .output': {
32
+ padding: '$6 $0 $15 $0',
33
+ display: 'flex',
34
+ flexDirection: 'column',
35
+ },
36
+ '& .output__token-info': {
37
+ display: 'flex',
38
+ justifyContent: 'start',
39
+ alignItems: 'center',
40
+ paddingBottom: '$5',
41
+ },
42
+ '& .quote-summary': {
43
+ display: 'flex',
44
+ justifyContent: 'space-between',
45
+ alignItems: 'end',
46
+ },
47
+ '& .quote-summary__separator': {
48
+ height: '$28',
49
+ marginLeft: '13px',
50
+ borderLeft: '1px solid $neutral700',
51
+ },
52
+ '& .token-amount': {
53
+ display: 'flex',
54
+ justifyContent: 'space-between',
55
+ },
56
+ '& .token-amount__label': {
57
+ display: 'flex',
58
+ flexDirection: 'column',
59
+ alignItems: 'start',
60
+ },
61
+ '& .chains': {
62
+ paddingTop: '$2',
63
+ },
64
+ '& .swap-preview': {
65
+ padding: '$15 $0 $15 $0',
66
+ },
67
+ '& .steps': {
68
+ paddingLeft: '$8',
69
+ },
70
+ '& .step__title': {
71
+ display: 'flex',
72
+ alignItems: 'center',
73
+ },
74
+ '& .step__content': {
75
+ display: 'flex',
76
+ alignItems: 'start',
77
+ },
78
+ '& .step__tokens': {
79
+ paddingTop: '$5',
80
+ paddingBottom: '$10',
81
+ display: 'flex',
82
+ alignItems: 'center',
83
+ },
84
+ '& .step__token-info': {
85
+ display: 'flex',
86
+ alignItems: 'center',
87
+ },
88
+ '& .step__icon-container': {
89
+ margin: '$0 $2',
90
+ padding: '$4',
91
+ display: 'flex',
92
+ justifyContent: 'center',
93
+ alignItems: 'center',
94
+ },
95
+ });
96
+
97
+ export const StepSeparator = styled('div', {
98
+ borderLeft: '1px dashed black',
99
+ minHeight: ' 64px',
100
+ margin: '0px 11.5px',
101
+ alignSelf: 'stretch',
102
+ variants: {
103
+ hideSeparator: {
104
+ true: {
105
+ minHeight: 'unset',
106
+ height: '0',
107
+ },
108
+ },
109
+ },
110
+ });
@@ -0,0 +1,108 @@
1
+ import type { PropTypes } from './QuoteSkeleton.types';
2
+
3
+ import { ChainToken, Divider, NextIcon, Skeleton } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { Container, StepSeparator } from './QuoteSkeleton.styles';
7
+
8
+ function StepSkeleton(props: { separator?: boolean }) {
9
+ const { separator = true } = props;
10
+ return (
11
+ <>
12
+ <div className="step__title">
13
+ <Skeleton height={22} width={22} variant="circular" />
14
+ <Divider direction="horizontal" size={8} />
15
+ <Skeleton height={15} width={148} variant="rounded" />
16
+ </div>
17
+ <div className="step__content">
18
+ <StepSeparator hideSeparator={!separator} />
19
+ <div className="step__tokens">
20
+ <div className="step__token-info">
21
+ <ChainToken size="small" loading chainImage="" tokenImage="" />
22
+ <Divider direction="horizontal" size={8} />
23
+ <Skeleton height={12} width={76} variant="rounded" />
24
+ </div>
25
+ <div className="step__icon-container">
26
+ <NextIcon color="gray" size={16} />
27
+ </div>
28
+ <div className="step__token-info">
29
+ <ChainToken size="small" loading chainImage="" tokenImage="" />
30
+ <Divider direction="horizontal" size={8} />
31
+ <Skeleton height={12} width={76} variant="rounded" />
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </>
36
+ );
37
+ }
38
+
39
+ export function QuoteSkeleton(props: PropTypes) {
40
+ const { type, expanded, tag = false } = props;
41
+ const quoteSummary = (
42
+ <div className="quote-summary">
43
+ <div className="token-amount">
44
+ <ChainToken loading size="medium" chainImage="" tokenImage="" />
45
+ <Divider size={8} direction="horizontal" />
46
+ <div className="token-amount__label">
47
+ <Skeleton height={10} width={60} variant="rounded" />
48
+ <Divider size={4} />
49
+ <Skeleton height={15} width={148} variant="rounded" />
50
+ </div>
51
+ </div>
52
+ <Skeleton height={12} width={64} variant="rounded" />
53
+ </div>
54
+ );
55
+
56
+ return (
57
+ <Container>
58
+ <div className="cost-and-tag">
59
+ <div className="cost">
60
+ <Skeleton width={60} height={10} variant="rounded" />
61
+ <Divider size={4} direction="horizontal" />
62
+ <Skeleton width={60} height={10} variant="rounded" />
63
+ <Divider size={4} direction="horizontal" />
64
+ <Skeleton width={60} height={10} variant="rounded" />
65
+ </div>
66
+ {tag && <Skeleton height={22} width={100} variant="rounded" />}
67
+ </div>
68
+ {type === 'basic' && (
69
+ <div className="basic-summary">
70
+ <Skeleton height={15} width={148} variant="rounded" />
71
+ </div>
72
+ )}
73
+ {type === 'list-item' && (
74
+ <div className="output">
75
+ <div className="output__token-info">
76
+ <ChainToken loading size="medium" chainImage="" tokenImage="" />
77
+ <Divider direction="horizontal" size={4} />
78
+ <Skeleton height={15} width={150} variant="rounded" />
79
+ </div>
80
+ <Divider size={4} />
81
+ <Skeleton height={10} width={184} variant="rounded" />
82
+ </div>
83
+ )}
84
+ {type === 'swap-preview' && (
85
+ <>
86
+ <Divider size={4} />
87
+ <div className="swap-preview">
88
+ {quoteSummary}
89
+ <div className="quote-summary__separator" />
90
+ {quoteSummary}
91
+ </div>
92
+ </>
93
+ )}
94
+ <div className="chains">
95
+ <Skeleton height={15} width={321} variant="rounded" />
96
+ </div>
97
+
98
+ {expanded && (
99
+ <div className="steps">
100
+ <Divider size={20} />
101
+ <StepSkeleton />
102
+ <StepSkeleton />
103
+ <StepSkeleton separator={false} />
104
+ </div>
105
+ )}
106
+ </Container>
107
+ );
108
+ }
@@ -0,0 +1,5 @@
1
+ export type PropTypes = {
2
+ type: 'basic' | 'list-item' | 'swap-preview';
3
+ expanded?: boolean;
4
+ tag?: boolean;
5
+ };
@@ -0,0 +1,15 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const Container = styled('div', {
4
+ position: 'relative',
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ width: '100%',
8
+ '& .separator': {
9
+ height: '14px',
10
+ marginLeft: '14px',
11
+ position: 'absolute',
12
+ borderLeft: '1px solid $foreground',
13
+ top: '42%',
14
+ },
15
+ });
@@ -0,0 +1,46 @@
1
+ import type { PriceImpactWarningLevel, Step } from '@rango-dev/ui';
2
+
3
+ import { TokenAmount } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { Container } from './QuoteSummary.styles';
7
+
8
+ type PropTypes = {
9
+ from: Step['from'];
10
+ to: Step['to'];
11
+ percentageChange?: string | null;
12
+ warningLevel: PriceImpactWarningLevel;
13
+ };
14
+
15
+ export function QuoteSummary(props: PropTypes) {
16
+ const { from, to, percentageChange, warningLevel } = props;
17
+ return (
18
+ <Container>
19
+ <TokenAmount
20
+ direction="horizontal"
21
+ label="Swap input"
22
+ type="input"
23
+ price={{ value: from.price.value, usdValue: from.price.usdValue }}
24
+ token={{
25
+ displayName: from.token.displayName,
26
+ image: from.token.image,
27
+ }}
28
+ chain={{ image: from.chain.image }}
29
+ />
30
+ <div className="separator" />
31
+ <TokenAmount
32
+ direction="horizontal"
33
+ label="Estimated output"
34
+ type="output"
35
+ price={{ value: to.price.value, usdValue: to.price.usdValue }}
36
+ token={{
37
+ displayName: to.token.displayName,
38
+ image: to.token.image,
39
+ }}
40
+ chain={{ image: to.chain.image }}
41
+ percentageChange={percentageChange}
42
+ warningLevel={warningLevel}
43
+ />
44
+ </Container>
45
+ );
46
+ }
@@ -0,0 +1,3 @@
1
+ export { Quote } from './Quote';
2
+ export { QuoteSkeleton } from './QuoteSkeleton';
3
+ export { QuoteSummary } from './QuoteSummary';