@rango-dev/widget-embedded 0.17.1-next.3 → 0.17.1-next.30

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 (312) 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.styles.d.ts +56 -56
  8. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +0 -2
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
  13. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  14. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  15. package/dist/components/Layout/Layout.d.ts.map +1 -1
  16. package/dist/components/Layout/Layout.types.d.ts +2 -2
  17. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  18. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  19. package/dist/components/Quote/Quote.d.ts.map +1 -1
  20. package/dist/components/Quote/Quote.styles.d.ts +159 -0
  21. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  22. package/dist/components/Quote/Quote.types.d.ts +0 -1
  23. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  24. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  25. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  26. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  27. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
  28. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  29. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  30. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  31. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  32. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  33. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  34. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  35. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
  36. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
  37. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
  38. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  39. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  40. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  41. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  42. package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
  43. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  44. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  45. package/dist/components/TokenList/TokenList.types.d.ts +3 -9
  46. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  47. package/dist/components/TokenList/index.d.ts +0 -1
  48. package/dist/components/TokenList/index.d.ts.map +1 -1
  49. package/dist/components/UpdateUrl.d.ts +1 -6
  50. package/dist/components/UpdateUrl.d.ts.map +1 -1
  51. package/dist/components/WidgetEvents.d.ts.map +1 -1
  52. package/dist/constants/errors.d.ts.map +1 -1
  53. package/dist/constants/index.d.ts +1 -0
  54. package/dist/constants/index.d.ts.map +1 -1
  55. package/dist/constants/navigationRoutes.d.ts +1 -2
  56. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  57. package/dist/constants/searchParams.d.ts +2 -1
  58. package/dist/constants/searchParams.d.ts.map +1 -1
  59. package/dist/containers/App/App.d.ts +3 -0
  60. package/dist/containers/App/App.d.ts.map +1 -0
  61. package/dist/containers/App/App.styles.d.ts +158 -0
  62. package/dist/containers/App/App.styles.d.ts.map +1 -0
  63. package/dist/containers/App/index.d.ts +2 -0
  64. package/dist/containers/App/index.d.ts.map +1 -0
  65. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  66. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
  67. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  68. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
  69. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  70. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  71. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  72. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  73. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  74. package/dist/containers/Wallets/index.d.ts +2 -0
  75. package/dist/containers/Wallets/index.d.ts.map +1 -0
  76. package/dist/containers/Widget/Widget.d.ts +5 -0
  77. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  78. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  79. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  80. package/dist/containers/Widget/index.d.ts +3 -0
  81. package/dist/containers/Widget/index.d.ts.map +1 -0
  82. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  83. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  84. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +20 -0
  85. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
  86. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -0
  87. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  88. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  89. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  90. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  91. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  92. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  93. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  94. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  95. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  96. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  97. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
  98. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  99. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
  100. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
  101. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  102. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  103. package/dist/hooks/useLanguage.d.ts +1 -1
  104. package/dist/hooks/useLanguage.d.ts.map +1 -1
  105. package/dist/hooks/useNavigateBack.d.ts +1 -3
  106. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  107. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  108. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  109. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  110. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +3 -5
  111. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  112. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
  113. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  114. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
  115. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  116. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  117. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  118. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  119. package/dist/hooks/useTheme.d.ts +1 -1
  120. package/dist/hooks/useTheme.d.ts.map +1 -1
  121. package/dist/hooks/useWalletList.d.ts.map +1 -1
  122. package/dist/index.d.ts +20 -8
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +1 -1
  125. package/dist/index.js.map +4 -4
  126. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  127. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  128. package/dist/pages/HistoryPage.d.ts.map +1 -1
  129. package/dist/pages/Home.d.ts.map +1 -1
  130. package/dist/pages/LanguagePage.d.ts.map +1 -1
  131. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  132. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  133. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  134. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  135. package/dist/pages/SettingsPage.d.ts +1 -6
  136. package/dist/pages/SettingsPage.d.ts.map +1 -1
  137. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  138. package/dist/pages/ThemePage.d.ts.map +1 -1
  139. package/dist/pages/WalletsPage.d.ts +1 -8
  140. package/dist/pages/WalletsPage.d.ts.map +1 -1
  141. package/dist/store/AppStore.d.ts +47 -0
  142. package/dist/store/AppStore.d.ts.map +1 -0
  143. package/dist/store/app.d.ts +41 -22
  144. package/dist/store/app.d.ts.map +1 -1
  145. package/dist/store/notification.d.ts +4 -3
  146. package/dist/store/notification.d.ts.map +1 -1
  147. package/dist/store/quote.d.ts +23 -16
  148. package/dist/store/quote.d.ts.map +1 -1
  149. package/dist/store/slices/config.d.ts +3 -2
  150. package/dist/store/slices/config.d.ts.map +1 -1
  151. package/dist/store/slices/data.d.ts +3 -0
  152. package/dist/store/slices/data.d.ts.map +1 -1
  153. package/dist/store/slices/settings.d.ts +39 -0
  154. package/dist/store/slices/settings.d.ts.map +1 -0
  155. package/dist/store/ui.d.ts +2 -1
  156. package/dist/store/ui.d.ts.map +1 -1
  157. package/dist/store/wallets.d.ts +14 -9
  158. package/dist/store/wallets.d.ts.map +1 -1
  159. package/dist/types/config.d.ts +38 -5
  160. package/dist/types/config.d.ts.map +1 -1
  161. package/dist/types/swap.d.ts +4 -14
  162. package/dist/types/swap.d.ts.map +1 -1
  163. package/dist/types/wallets.d.ts +15 -1
  164. package/dist/types/wallets.d.ts.map +1 -1
  165. package/dist/utils/colors.d.ts.map +1 -1
  166. package/dist/utils/configs.d.ts +1 -0
  167. package/dist/utils/configs.d.ts.map +1 -1
  168. package/dist/utils/meta.d.ts +2 -1
  169. package/dist/utils/meta.d.ts.map +1 -1
  170. package/dist/utils/providers.d.ts +2 -2
  171. package/dist/utils/providers.d.ts.map +1 -1
  172. package/dist/utils/queue.d.ts +2 -2
  173. package/dist/utils/queue.d.ts.map +1 -1
  174. package/dist/utils/quote.d.ts +1 -1
  175. package/dist/utils/quote.d.ts.map +1 -1
  176. package/dist/utils/settings.d.ts +6 -2
  177. package/dist/utils/settings.d.ts.map +1 -1
  178. package/dist/utils/swap.d.ts +16 -7
  179. package/dist/utils/swap.d.ts.map +1 -1
  180. package/dist/utils/time.d.ts +1 -1
  181. package/dist/utils/time.d.ts.map +1 -1
  182. package/dist/utils/wallets.d.ts +7 -9
  183. package/dist/utils/wallets.d.ts.map +1 -1
  184. package/package.json +12 -10
  185. package/src/QueueManager.tsx +18 -17
  186. package/src/components/AppRouter.tsx +8 -32
  187. package/src/components/AppRoutes.tsx +57 -69
  188. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  189. package/src/components/BlockchainsSection/BlockchainsSection.tsx +4 -4
  190. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +16 -19
  191. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +0 -2
  192. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  193. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  194. package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
  195. package/src/components/Layout/Layout.tsx +20 -7
  196. package/src/components/Layout/Layout.types.ts +2 -2
  197. package/src/components/NoResult/NoResult.helpers.ts +12 -12
  198. package/src/components/NoResult/NoResult.tsx +6 -6
  199. package/src/components/NotificationContent/NotificationContent.tsx +5 -3
  200. package/src/components/Quote/Quote.styles.ts +28 -1
  201. package/src/components/Quote/Quote.tsx +100 -34
  202. package/src/components/Quote/Quote.types.ts +0 -1
  203. package/src/components/Quote/QuoteSkeleton.tsx +1 -1
  204. package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
  205. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
  206. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
  207. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
  208. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
  209. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
  210. package/src/components/Slippage/Slippage.tsx +3 -5
  211. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
  212. package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
  213. package/src/components/SwapDetails/SwapDetails.tsx +19 -39
  214. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
  215. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  216. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  217. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
  218. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
  219. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
  220. package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
  221. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
  222. package/src/components/TokenList/TokenList.helpers.ts +2 -2
  223. package/src/components/TokenList/TokenList.styles.ts +14 -2
  224. package/src/components/TokenList/TokenList.tsx +16 -19
  225. package/src/components/TokenList/TokenList.types.ts +3 -10
  226. package/src/components/TokenList/index.ts +0 -1
  227. package/src/components/UpdateUrl.tsx +23 -18
  228. package/src/components/WidgetEvents.tsx +4 -2
  229. package/src/constants/errors.ts +9 -5
  230. package/src/constants/index.ts +1 -0
  231. package/src/constants/navigationRoutes.ts +7 -8
  232. package/src/constants/searchParams.ts +1 -0
  233. package/src/containers/App/App.styles.ts +18 -0
  234. package/src/containers/App/App.tsx +52 -0
  235. package/src/containers/App/index.ts +1 -0
  236. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
  237. package/src/containers/QuoteInfo/QuoteInfo.tsx +44 -43
  238. package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
  239. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +48 -34
  240. package/src/containers/Wallets/Wallets.types.ts +12 -0
  241. package/src/containers/Wallets/index.ts +1 -0
  242. package/src/containers/Widget/Widget.tsx +19 -0
  243. package/src/containers/Widget/Widget.types.ts +5 -0
  244. package/src/containers/Widget/index.ts +2 -0
  245. package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +64 -0
  246. package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
  247. package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -0
  248. package/src/containers/WidgetInfo/index.ts +1 -0
  249. package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
  250. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  251. package/src/containers/WidgetProvider/index.ts +1 -0
  252. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
  253. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +25 -24
  254. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
  255. package/src/hooks/useForceAutoConnect.ts +27 -0
  256. package/src/hooks/useLanguage.ts +4 -5
  257. package/src/hooks/useNavigateBack.ts +3 -52
  258. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  259. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
  260. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
  261. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
  262. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +15 -6
  263. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
  264. package/src/hooks/useSwapInput.ts +89 -30
  265. package/src/hooks/useSyncStoresWithConfig.ts +38 -22
  266. package/src/hooks/useTheme.ts +4 -5
  267. package/src/hooks/useWalletList.ts +3 -5
  268. package/src/index.ts +53 -5
  269. package/src/pages/ConfirmSwapPage.tsx +39 -24
  270. package/src/pages/HistoryPage.tsx +2 -7
  271. package/src/pages/Home.tsx +58 -88
  272. package/src/pages/LanguagePage.tsx +0 -5
  273. package/src/pages/LiquiditySourcePage.tsx +24 -37
  274. package/src/pages/SelectBlockchainPage.tsx +28 -21
  275. package/src/pages/SelectSwapItemsPage.tsx +10 -27
  276. package/src/pages/SettingsPage.tsx +28 -24
  277. package/src/pages/SwapDetailsPage.tsx +6 -7
  278. package/src/pages/ThemePage.tsx +2 -7
  279. package/src/pages/WalletsPage.tsx +4 -15
  280. package/src/services/httpService.ts +1 -1
  281. package/src/store/AppStore.tsx +41 -0
  282. package/src/store/app.ts +44 -6
  283. package/src/store/quote.ts +29 -26
  284. package/src/store/slices/config.ts +25 -15
  285. package/src/store/slices/data.ts +64 -29
  286. package/src/store/slices/settings.ts +168 -0
  287. package/src/store/wallets.ts +68 -37
  288. package/src/types/config.ts +50 -5
  289. package/src/types/swap.ts +4 -13
  290. package/src/types/wallets.ts +18 -1
  291. package/src/utils/colors.ts +2 -1
  292. package/src/utils/configs.ts +2 -1
  293. package/src/utils/date.ts +1 -1
  294. package/src/utils/meta.ts +8 -1
  295. package/src/utils/providers.ts +8 -5
  296. package/src/utils/queue.ts +2 -2
  297. package/src/utils/quote.ts +7 -7
  298. package/src/utils/settings.ts +17 -10
  299. package/src/utils/swap.ts +59 -55
  300. package/src/utils/time.ts +1 -1
  301. package/src/utils/wallets.ts +107 -149
  302. package/dist/Wallets.d.ts +0 -17
  303. package/dist/Wallets.d.ts.map +0 -1
  304. package/dist/Widget.d.ts +0 -9
  305. package/dist/Widget.d.ts.map +0 -1
  306. package/dist/store/meta.d.ts +0 -23
  307. package/dist/store/meta.d.ts.map +0 -1
  308. package/dist/store/settings.d.ts +0 -81
  309. package/dist/store/settings.d.ts.map +0 -1
  310. package/src/Widget.tsx +0 -119
  311. package/src/store/meta.ts +0 -39
  312. package/src/store/settings.ts +0 -158
@@ -1,23 +0,0 @@
1
- import type { TokenWithBalance } from '../components/TokenList';
2
- import type { MetaResponse } from 'rango-sdk';
3
- export type LoadingStatus = 'loading' | 'success' | 'failed';
4
- export interface MetaState {
5
- meta: MetaResponse & {
6
- tokens: TokenWithBalance[];
7
- };
8
- loadingStatus: LoadingStatus;
9
- fetchMeta: () => Promise<void>;
10
- }
11
- export declare const useMetaStore: {
12
- (): MetaState;
13
- <U>(selector: (state: MetaState) => U, equals?: ((a: U, b: U) => boolean) | undefined): U;
14
- } & import("zustand").StoreApi<MetaState> & {
15
- use: {
16
- meta: () => MetaResponse & {
17
- tokens: TokenWithBalance[];
18
- };
19
- loadingStatus: () => LoadingStatus;
20
- fetchMeta: () => () => Promise<void>;
21
- };
22
- };
23
- //# sourceMappingURL=meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/store/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAO9C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,YAAY,GAAG;QAAE,MAAM,EAAE,gBAAgB,EAAE,CAAA;KAAE,CAAC;IACpD,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,YAAY;;;;;;oBALQ,gBAAgB,EAAE;;;+BAEhC,QAAQ,IAAI,CAAC;;CAyB/B,CAAC"}
@@ -1,81 +0,0 @@
1
- import { type Language } from '@rango-dev/ui';
2
- export type ThemeMode = 'auto' | 'dark' | 'light';
3
- export interface SettingsState {
4
- /** Keeping a history of blockchains that user has selected (in Swap process) */
5
- preferredBlockchains: string[];
6
- slippage: number;
7
- customSlippage: number | null;
8
- infiniteApprove: boolean;
9
- disabledLiquiditySources: string[];
10
- theme: ThemeMode;
11
- language: Language;
12
- affiliateRef: string | null;
13
- affiliatePercent: number | null;
14
- affiliateWallets: {
15
- [key: string]: string;
16
- } | null;
17
- setSlippage: (slippage: number) => void;
18
- setCustomSlippage: (customSlippage: number | null) => void;
19
- toggleInfiniteApprove: () => void;
20
- toggleLiquiditySource: (name: string) => void;
21
- setTheme: (theme: ThemeMode) => void;
22
- setLanguage: (language: Language) => void;
23
- toggleAllLiquiditySources: (shouldReset?: boolean) => void;
24
- setAffiliateRef: (affiliateRef: string | null) => void;
25
- setAffiliatePercent: (affiliatePercent: number | null) => void;
26
- setAffiliateWallets: (affiliateWallets: {
27
- [key: string]: string;
28
- } | null) => void;
29
- addPreferredBlockchain: (blockchain: string) => void;
30
- }
31
- export declare const useSettingsStore: {
32
- (): SettingsState;
33
- <U>(selector: (state: SettingsState) => U, equals?: ((a: U, b: U) => boolean) | undefined): U;
34
- } & Omit<Omit<import("zustand").StoreApi<SettingsState>, "persist"> & {
35
- persist: {
36
- setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SettingsState, SettingsState>>) => void;
37
- clearStorage: () => void;
38
- rehydrate: () => void | Promise<void>;
39
- hasHydrated: () => boolean;
40
- onHydrate: (fn: (state: SettingsState) => void) => () => void;
41
- onFinishHydration: (fn: (state: SettingsState) => void) => () => void;
42
- getOptions: () => Partial<import("zustand/middleware").PersistOptions<SettingsState, SettingsState>>;
43
- };
44
- }, "subscribe"> & {
45
- subscribe: {
46
- (listener: (selectedState: SettingsState, previousSelectedState: SettingsState) => void): () => void;
47
- <U_1>(selector: (state: SettingsState) => U_1, listener: (selectedState: U_1, previousSelectedState: U_1) => void, options?: {
48
- equalityFn?: ((a: U_1, b: U_1) => boolean) | undefined;
49
- fireImmediately?: boolean | undefined;
50
- } | undefined): () => void;
51
- };
52
- } & {
53
- use: {
54
- preferredBlockchains: () => string[];
55
- slippage: () => number;
56
- customSlippage: () => number | null;
57
- infiniteApprove: () => boolean;
58
- disabledLiquiditySources: () => string[];
59
- theme: () => ThemeMode;
60
- language: () => "en" | "es" | "ja" | "fr";
61
- affiliateRef: () => string | null;
62
- affiliatePercent: () => number | null;
63
- affiliateWallets: () => {
64
- [key: string]: string;
65
- } | null;
66
- setSlippage: () => (slippage: number) => void;
67
- setCustomSlippage: () => (customSlippage: number | null) => void;
68
- toggleInfiniteApprove: () => () => void;
69
- toggleLiquiditySource: () => (name: string) => void;
70
- setTheme: () => (theme: ThemeMode) => void;
71
- setLanguage: () => (language: Language) => void;
72
- toggleAllLiquiditySources: () => (shouldReset?: boolean) => void;
73
- setAffiliateRef: () => (affiliateRef: string | null) => void;
74
- setAffiliatePercent: () => (affiliatePercent: number | null) => void;
75
- setAffiliateWallets: () => (affiliateWallets: {
76
- [key: string]: string;
77
- } | null) => void;
78
- addPreferredBlockchain: () => (blockchain: string) => void;
79
- };
80
- };
81
- //# sourceMappingURL=settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/store/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAY9C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAEnD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,yBAAyB,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,mBAAmB,EAAE,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/D,mBAAmB,EAAE,CACnB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,KAC/C,IAAI,CAAC;IACV,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAfH,MAAM,KAAK,IAAI;kDACH,MAAM,GAAG,IAAI,KAAK,IAAI;2CAC7B,IAAI;4CACH,MAAM,KAAK,IAAI;gCAC3B,SAAS,KAAK,IAAI;sCACZ,QAAQ,KAAK,IAAI;wDACC,OAAO,KAAK,IAAI;8CAC1B,MAAM,GAAG,IAAI,KAAK,IAAI;sDACd,MAAM,GAAG,IAAI,KAAK,IAAI;;;qBAGzD,IAAI;mDAC4B,MAAM,KAAK,IAAI;;CAsHrD,CAAC"}
package/src/Widget.tsx DELETED
@@ -1,119 +0,0 @@
1
- import type { WidgetConfig } from './types';
2
- import type { WalletType } from '@rango-dev/wallets-shared';
3
- import type { PropsWithChildren } from 'react';
4
-
5
- import { I18nManager, styled } from '@rango-dev/ui';
6
- import React, { useContext, useEffect, useMemo, useState } from 'react';
7
-
8
- import { AppRouter } from './components/AppRouter';
9
- import { AppRoutes } from './components/AppRoutes';
10
- import { WidgetEvents } from './components/WidgetEvents';
11
- import { globalFont } from './globalStyles';
12
- import { useLanguage } from './hooks/useLanguage';
13
- import { useTheme } from './hooks/useTheme';
14
- import QueueManager from './QueueManager';
15
- import { useAppStore } from './store/app';
16
- import { useMetaStore } from './store/meta';
17
- import { useNotificationStore } from './store/notification';
18
- import { useSettingsStore } from './store/settings';
19
- import { initConfig } from './utils/configs';
20
- import { WidgetContext, WidgetWallets } from './Wallets';
21
-
22
- const MainContainer = styled('div', {
23
- width: '100%',
24
- display: 'flex',
25
- justifyContent: 'center',
26
- alignItems: 'center',
27
- fontFamily: '$widget',
28
- boxSizing: 'border-box',
29
- '& *, *::before, *::after': {
30
- boxSizing: 'inherit',
31
- listStyleType: 'none',
32
- },
33
- '& *:focus-visible': {
34
- outlineColor: '$info500',
35
- transition: 'none',
36
- },
37
- });
38
-
39
- export type WidgetProps = {
40
- config?: WidgetConfig;
41
- };
42
-
43
- export function Main(props: PropsWithChildren<WidgetProps>) {
44
- const { config } = props;
45
- globalFont();
46
-
47
- const { activeTheme } = useTheme(config?.theme || {});
48
- const { activeLanguage, changeLanguage } = useLanguage();
49
-
50
- const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
51
- useState<string>('');
52
- const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
53
- const widgetContext = useContext(WidgetContext);
54
- const fetchMeta = useMetaStore.use.fetchMeta();
55
-
56
- useMemo(() => {
57
- if (config?.apiKey) {
58
- initConfig({
59
- API_KEY: config?.apiKey,
60
- });
61
- }
62
- }, [config]);
63
-
64
- useEffect(() => {
65
- void fetchMeta();
66
- void useSettingsStore.persist.rehydrate();
67
- void useNotificationStore.persist.rehydrate();
68
- widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
69
- }, []);
70
-
71
- useEffect(() => {
72
- if (config?.language) {
73
- changeLanguage(config.language);
74
- }
75
- }, [config?.language]);
76
-
77
- return (
78
- <I18nManager language={activeLanguage}>
79
- <MainContainer id="swap-container" className={activeTheme()}>
80
- <QueueManager>
81
- <WidgetEvents />
82
- <AppRouter
83
- config={config}
84
- lastConnectedWallet={lastConnectedWalletWithNetwork}
85
- disconnectedWallet={disconnectedWallet}
86
- clearDisconnectedWallet={() => {
87
- setDisconnectedWallet(undefined);
88
- }}>
89
- <AppRoutes config={config} />
90
- </AppRouter>
91
- </QueueManager>
92
- </MainContainer>
93
- </I18nManager>
94
- );
95
- }
96
-
97
- export function Widget(props: PropsWithChildren<WidgetProps>) {
98
- const { updateConfig, config } = useAppStore();
99
- useEffect(() => {
100
- if (props.config) {
101
- updateConfig(props.config);
102
- }
103
- }, [props.config]);
104
-
105
- if (!props.config?.externalWallets) {
106
- return (
107
- <WidgetWallets
108
- providers={config?.wallets}
109
- options={{
110
- walletConnectProjectId:
111
- config?.walletConnectProjectId ||
112
- props.config?.walletConnectProjectId,
113
- }}>
114
- <Main {...props} />
115
- </WidgetWallets>
116
- );
117
- }
118
- return <Main {...props} />;
119
- }
package/src/store/meta.ts DELETED
@@ -1,39 +0,0 @@
1
- import type { TokenWithBalance } from '../components/TokenList';
2
- import type { MetaResponse } from 'rango-sdk';
3
-
4
- import { create } from 'zustand';
5
-
6
- import { useAppStore } from './app';
7
- import createSelectors from './selectors';
8
-
9
- export type LoadingStatus = 'loading' | 'success' | 'failed';
10
-
11
- export interface MetaState {
12
- meta: MetaResponse & { tokens: TokenWithBalance[] };
13
- loadingStatus: LoadingStatus;
14
- fetchMeta: () => Promise<void>;
15
- }
16
-
17
- export const useMetaStore = createSelectors(
18
- create<MetaState>()((set) => ({
19
- meta: { blockchains: [], popularTokens: [], swappers: [], tokens: [] },
20
- loadingStatus: 'loading',
21
- fetchMeta: async () => {
22
- try {
23
- await useAppStore.getState().fetch();
24
-
25
- const state = useAppStore.getState();
26
- const response: MetaResponse = {
27
- blockchains: state.blockchains(),
28
- tokens: state.tokens(),
29
- popularTokens: state._popularTokens,
30
- swappers: state._swappers,
31
- };
32
-
33
- set({ meta: response, loadingStatus: 'success' });
34
- } catch (error) {
35
- set({ loadingStatus: 'failed' });
36
- }
37
- },
38
- }))
39
- );
@@ -1,158 +0,0 @@
1
- import { type Language } from '@rango-dev/ui';
2
- import { create } from 'zustand';
3
- import { persist, subscribeWithSelector } from 'zustand/middleware';
4
-
5
- import { BLOCKCHAIN_LIST_SIZE } from '../constants/configs';
6
- import { DEFAULT_LANGUAGE } from '../constants/languages';
7
- import { DEFAULT_SLIPPAGE } from '../constants/swapSettings';
8
- import { removeDuplicateFrom } from '../utils/common';
9
-
10
- import { useMetaStore } from './meta';
11
- import createSelectors from './selectors';
12
-
13
- export type ThemeMode = 'auto' | 'dark' | 'light';
14
-
15
- export interface SettingsState {
16
- /** Keeping a history of blockchains that user has selected (in Swap process) */
17
- preferredBlockchains: string[];
18
- slippage: number;
19
- customSlippage: number | null;
20
- infiniteApprove: boolean;
21
- disabledLiquiditySources: string[];
22
- theme: ThemeMode;
23
- language: Language;
24
- affiliateRef: string | null;
25
- affiliatePercent: number | null;
26
- affiliateWallets: { [key: string]: string } | null;
27
-
28
- setSlippage: (slippage: number) => void;
29
- setCustomSlippage: (customSlippage: number | null) => void;
30
- toggleInfiniteApprove: () => void;
31
- toggleLiquiditySource: (name: string) => void;
32
- setTheme: (theme: ThemeMode) => void;
33
- setLanguage: (language: Language) => void;
34
- toggleAllLiquiditySources: (shouldReset?: boolean) => void;
35
- setAffiliateRef: (affiliateRef: string | null) => void;
36
- setAffiliatePercent: (affiliatePercent: number | null) => void;
37
- setAffiliateWallets: (
38
- affiliateWallets: { [key: string]: string } | null
39
- ) => void;
40
- addPreferredBlockchain: (blockchain: string) => void;
41
- }
42
-
43
- export const useSettingsStore = createSelectors(
44
- create<SettingsState>()(
45
- persist(
46
- subscribeWithSelector((set, get) => ({
47
- preferredBlockchains: [],
48
- slippage: DEFAULT_SLIPPAGE,
49
- customSlippage: null,
50
- infiniteApprove: false,
51
- affiliateRef: null,
52
- affiliatePercent: null,
53
- affiliateWallets: null,
54
- disabledLiquiditySources: [],
55
- theme: 'auto',
56
- language: DEFAULT_LANGUAGE,
57
- addPreferredBlockchain: (blockchain) => {
58
- const currentPreferredBlockchains = get().preferredBlockchains;
59
-
60
- const noNeedToDoAnything = currentPreferredBlockchains.find(
61
- (preferredBlockchain, index) => {
62
- const isSameBlockchain = preferredBlockchain === blockchain;
63
- const isInVisibleList = index <= BLOCKCHAIN_LIST_SIZE - 1;
64
-
65
- return isSameBlockchain && isInVisibleList;
66
- }
67
- );
68
-
69
- if (noNeedToDoAnything) {
70
- return;
71
- }
72
-
73
- const nextPreferredBlockchains: string[] =
74
- currentPreferredBlockchains.filter((preferredBlockchain) => {
75
- const isSameBlockchain = preferredBlockchain === blockchain;
76
-
77
- return !isSameBlockchain;
78
- });
79
-
80
- set(() => ({
81
- preferredBlockchains: [blockchain, ...nextPreferredBlockchains],
82
- }));
83
- },
84
- setSlippage: (slippage) =>
85
- set(() => ({
86
- slippage: slippage,
87
- })),
88
- setCustomSlippage: (customSlippage) =>
89
- set(() => ({
90
- customSlippage: customSlippage,
91
- })),
92
- setAffiliateRef: (affiliateRef) =>
93
- set(() => ({
94
- affiliateRef,
95
- })),
96
- setAffiliatePercent: (affiliatePercent) =>
97
- set(() => ({
98
- affiliatePercent,
99
- })),
100
-
101
- setAffiliateWallets: (affiliateWallets) =>
102
- set(() => ({
103
- affiliateWallets,
104
- })),
105
- toggleAllLiquiditySources: (shouldReset?: boolean) =>
106
- set((state) => {
107
- if (shouldReset) {
108
- return { disabledLiquiditySources: [] };
109
- }
110
- const { swappers } = useMetaStore.getState().meta;
111
- const swappersGroup = removeDuplicateFrom(
112
- swappers.map((swapper) => swapper.swapperGroup)
113
- );
114
-
115
- if (
116
- swappersGroup.length === state.disabledLiquiditySources.length
117
- ) {
118
- return { disabledLiquiditySources: [] };
119
- }
120
-
121
- return {
122
- disabledLiquiditySources: swappersGroup,
123
- };
124
- }),
125
- toggleInfiniteApprove: () =>
126
- set((state) => ({
127
- infiniteApprove: !state.infiniteApprove,
128
- })),
129
- toggleLiquiditySource: (name) =>
130
- set((state) => {
131
- if (state.disabledLiquiditySources.includes(name)) {
132
- return {
133
- disabledLiquiditySources: state.disabledLiquiditySources.filter(
134
- (liquiditySource) => liquiditySource != name
135
- ),
136
- };
137
- }
138
- return {
139
- disabledLiquiditySources:
140
- state.disabledLiquiditySources.concat(name),
141
- };
142
- }),
143
- setTheme: (theme) =>
144
- set(() => ({
145
- theme,
146
- })),
147
- setLanguage: (language) =>
148
- set(() => ({
149
- language,
150
- })),
151
- })),
152
- {
153
- name: 'user-settings',
154
- skipHydration: true,
155
- }
156
- )
157
- )
158
- );