@rango-dev/widget-embedded 0.17.1-next.9 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/QueueManager.d.ts +1 -2
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/Wallets.d.ts +0 -1
  5. package/dist/Wallets.d.ts.map +1 -1
  6. package/dist/Widget.d.ts +1 -1
  7. package/dist/Widget.d.ts.map +1 -1
  8. package/dist/components/AppRouter.d.ts +2 -0
  9. package/dist/components/AppRouter.d.ts.map +1 -1
  10. package/dist/components/AppRoutes.d.ts +6 -1
  11. package/dist/components/AppRoutes.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +3 -1
  13. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  14. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  16. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +3 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  18. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +4 -1
  20. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  21. package/dist/components/NoRoutes/NoRoutes.d.ts +4 -0
  22. package/dist/components/NoRoutes/NoRoutes.d.ts.map +1 -0
  23. package/dist/components/NoRoutes/NoRoutes.helper.d.ts +3 -0
  24. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -0
  25. package/dist/components/{NoResult/NoResult.styles.d.ts → NoRoutes/NoRoutes.styles.d.ts} +1 -1
  26. package/dist/components/{NoResult/NoResult.styles.d.ts.map → NoRoutes/NoRoutes.styles.d.ts.map} +1 -1
  27. package/dist/components/{NoResult/NoResult.types.d.ts → NoRoutes/NoRoutes.types.d.ts} +3 -3
  28. package/dist/components/NoRoutes/NoRoutes.types.d.ts.map +1 -0
  29. package/dist/components/NoRoutes/index.d.ts +2 -0
  30. package/dist/components/NoRoutes/index.d.ts.map +1 -0
  31. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  32. package/dist/components/RouteErrors/RouteErrors.d.ts +4 -0
  33. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -0
  34. package/dist/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts → RouteErrors/RouteErrors.styles.d.ts} +1 -1
  35. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -0
  36. package/dist/components/RouteErrors/RouteErrors.types.d.ts +24 -0
  37. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -0
  38. package/dist/components/RouteErrors/RouteErrorsModal.d.ts +4 -0
  39. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -0
  40. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts +4 -0
  41. package/dist/components/RouteErrors/RouteErrorsModalItem.d.ts.map +1 -0
  42. package/dist/components/RouteErrors/index.d.ts +2 -0
  43. package/dist/components/RouteErrors/index.d.ts.map +1 -0
  44. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  45. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  46. package/dist/components/UpdateUrl.d.ts +6 -1
  47. package/dist/components/UpdateUrl.d.ts.map +1 -1
  48. package/dist/components/WidgetEvents.d.ts.map +1 -1
  49. package/dist/constants/errors.d.ts +4 -4
  50. package/dist/constants/errors.d.ts.map +1 -1
  51. package/dist/constants/messages.d.ts +1 -1
  52. package/dist/constants/searchParams.d.ts +1 -2
  53. package/dist/constants/searchParams.d.ts.map +1 -1
  54. package/dist/constants/warnings.d.ts +2 -2
  55. package/dist/constants/warnings.d.ts.map +1 -1
  56. package/dist/hooks/{useConfirmSwap/useConfirmSwap.types.d.ts → useConfirmSwap.d.ts} +7 -5
  57. package/dist/hooks/useConfirmSwap.d.ts.map +1 -0
  58. package/dist/hooks/{useFetchQuote.d.ts → useFetchBestRoute.d.ts} +3 -3
  59. package/dist/hooks/useFetchBestRoute.d.ts.map +1 -0
  60. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  61. package/dist/hooks/useSwapInput.d.ts +2 -4
  62. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  63. package/dist/hooks/useSyncStoresWithConfig.d.ts +2 -1
  64. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  65. package/dist/hooks/useWalletList.d.ts.map +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.js.map +4 -4
  68. package/dist/pages/ConfirmSwapPage.d.ts +6 -1
  69. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  70. package/dist/pages/Home.d.ts.map +1 -1
  71. package/dist/pages/LiquiditySourcePage.d.ts +2 -1
  72. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  73. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  74. package/dist/pages/SettingsPage.d.ts +6 -1
  75. package/dist/pages/SettingsPage.d.ts.map +1 -1
  76. package/dist/pages/WalletsPage.d.ts +8 -1
  77. package/dist/pages/WalletsPage.d.ts.map +1 -1
  78. package/dist/store/app.d.ts +23 -5
  79. package/dist/store/app.d.ts.map +1 -1
  80. package/dist/store/{quote.d.ts → bestRoute.d.ts} +27 -39
  81. package/dist/store/bestRoute.d.ts.map +1 -0
  82. package/dist/store/meta.d.ts +23 -0
  83. package/dist/store/meta.d.ts.map +1 -0
  84. package/dist/store/settings.d.ts +2 -3
  85. package/dist/store/settings.d.ts.map +1 -1
  86. package/dist/store/slices/config.d.ts +2 -3
  87. package/dist/store/slices/config.d.ts.map +1 -1
  88. package/dist/store/slices/data.d.ts +0 -3
  89. package/dist/store/slices/data.d.ts.map +1 -1
  90. package/dist/store/wallets.d.ts +4 -5
  91. package/dist/store/wallets.d.ts.map +1 -1
  92. package/dist/types/config.d.ts +5 -5
  93. package/dist/types/config.d.ts.map +1 -1
  94. package/dist/types/index.d.ts +1 -1
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/types/routing.d.ts +65 -0
  97. package/dist/types/routing.d.ts.map +1 -0
  98. package/dist/utils/numbers.d.ts +1 -1
  99. package/dist/utils/numbers.d.ts.map +1 -1
  100. package/dist/utils/{quote.d.ts → routing.d.ts} +12 -16
  101. package/dist/utils/routing.d.ts.map +1 -0
  102. package/dist/utils/settings.d.ts +2 -3
  103. package/dist/utils/settings.d.ts.map +1 -1
  104. package/dist/utils/swap.d.ts +22 -25
  105. package/dist/utils/swap.d.ts.map +1 -1
  106. package/dist/utils/wallets.d.ts +2 -2
  107. package/dist/utils/wallets.d.ts.map +1 -1
  108. package/package.json +8 -8
  109. package/src/QueueManager.tsx +14 -14
  110. package/src/Wallets.tsx +15 -35
  111. package/src/Widget.tsx +24 -11
  112. package/src/components/AppRouter.tsx +5 -6
  113. package/src/components/AppRoutes.tsx +39 -6
  114. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  115. package/src/components/BlockchainsSection/BlockchainsSection.tsx +7 -7
  116. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +64 -2
  117. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +40 -28
  118. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +3 -1
  119. package/src/components/ConfirmWalletsModal/WalletList.tsx +5 -6
  120. package/src/components/ConfirmWalletsModal/WalletList.type.ts +4 -1
  121. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +3 -3
  122. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +6 -6
  123. package/src/components/{NoResult/NoResult.helpers.ts → NoRoutes/NoRoutes.helper.ts} +9 -16
  124. package/src/components/{NoResult/NoResult.styles.ts → NoRoutes/NoRoutes.styles.ts} +0 -2
  125. package/src/components/{NoResult/NoResult.tsx → NoRoutes/NoRoutes.tsx} +12 -10
  126. package/src/components/{NoResult/NoResult.types.ts → NoRoutes/NoRoutes.types.ts} +2 -3
  127. package/src/components/NoRoutes/index.ts +1 -0
  128. package/src/components/NotificationContent/NotificationContent.tsx +2 -3
  129. package/src/components/RouteErrors/RouteErrors.tsx +79 -0
  130. package/src/components/RouteErrors/RouteErrors.types.ts +29 -0
  131. package/src/components/RouteErrors/RouteErrorsModal.tsx +129 -0
  132. package/src/components/{QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx → RouteErrors/RouteErrorsModalItem.tsx} +3 -3
  133. package/src/components/RouteErrors/index.ts +1 -0
  134. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
  135. package/src/components/SwapDetails/SwapDetails.tsx +22 -18
  136. package/src/components/SwitchFromAndTo.tsx +2 -2
  137. package/src/components/TokenList/TokenList.tsx +6 -5
  138. package/src/components/UpdateUrl.tsx +26 -36
  139. package/src/components/WidgetEvents.tsx +2 -4
  140. package/src/constants/errors.ts +10 -8
  141. package/src/constants/messages.ts +1 -1
  142. package/src/constants/searchParams.ts +0 -1
  143. package/src/constants/warnings.ts +7 -7
  144. package/src/hooks/useConfirmSwap.ts +303 -0
  145. package/src/hooks/{useFetchQuote.ts → useFetchBestRoute.ts} +3 -3
  146. package/src/hooks/useNavigateBack.ts +3 -3
  147. package/src/hooks/useSwapInput.ts +23 -58
  148. package/src/hooks/useSyncStoresWithConfig.ts +19 -22
  149. package/src/hooks/useWalletList.ts +5 -3
  150. package/src/pages/ConfirmSwapPage.tsx +235 -58
  151. package/src/pages/HistoryPage.tsx +1 -1
  152. package/src/pages/Home.tsx +247 -58
  153. package/src/pages/LanguagePage.tsx +1 -1
  154. package/src/pages/LiquiditySourcePage.tsx +32 -23
  155. package/src/pages/SelectBlockchainPage.tsx +7 -6
  156. package/src/pages/SelectSwapItemsPage.tsx +5 -5
  157. package/src/pages/SettingsPage.tsx +13 -9
  158. package/src/pages/SwapDetailsPage.tsx +3 -3
  159. package/src/pages/ThemePage.tsx +1 -1
  160. package/src/pages/WalletsPage.tsx +12 -5
  161. package/src/store/app.ts +6 -18
  162. package/src/store/{quote.ts → bestRoute.ts} +60 -68
  163. package/src/store/meta.ts +39 -0
  164. package/src/store/settings.ts +4 -7
  165. package/src/store/slices/config.ts +15 -25
  166. package/src/store/slices/data.ts +29 -64
  167. package/src/store/wallets.ts +8 -11
  168. package/src/types/config.ts +5 -5
  169. package/src/types/index.ts +1 -1
  170. package/src/types/routing.ts +77 -0
  171. package/src/utils/numbers.ts +1 -1
  172. package/src/utils/routing.ts +321 -0
  173. package/src/utils/settings.ts +7 -8
  174. package/src/utils/swap.ts +85 -113
  175. package/src/utils/wallets.ts +17 -29
  176. package/dist/components/NoResult/NoResult.d.ts +0 -4
  177. package/dist/components/NoResult/NoResult.d.ts.map +0 -1
  178. package/dist/components/NoResult/NoResult.helpers.d.ts +0 -4
  179. package/dist/components/NoResult/NoResult.helpers.d.ts.map +0 -1
  180. package/dist/components/NoResult/NoResult.types.d.ts.map +0 -1
  181. package/dist/components/NoResult/index.d.ts +0 -2
  182. package/dist/components/NoResult/index.d.ts.map +0 -1
  183. package/dist/components/Quote/Quote.d.ts +0 -4
  184. package/dist/components/Quote/Quote.d.ts.map +0 -1
  185. package/dist/components/Quote/Quote.styles.d.ts +0 -1429
  186. package/dist/components/Quote/Quote.styles.d.ts.map +0 -1
  187. package/dist/components/Quote/Quote.types.d.ts +0 -22
  188. package/dist/components/Quote/Quote.types.d.ts.map +0 -1
  189. package/dist/components/Quote/QuoteSkeleton.d.ts +0 -4
  190. package/dist/components/Quote/QuoteSkeleton.d.ts.map +0 -1
  191. package/dist/components/Quote/QuoteSkeleton.styles.d.ts +0 -319
  192. package/dist/components/Quote/QuoteSkeleton.styles.d.ts.map +0 -1
  193. package/dist/components/Quote/QuoteSkeleton.types.d.ts +0 -6
  194. package/dist/components/Quote/QuoteSkeleton.types.d.ts.map +0 -1
  195. package/dist/components/Quote/QuoteSummary.d.ts +0 -11
  196. package/dist/components/Quote/QuoteSummary.d.ts.map +0 -1
  197. package/dist/components/Quote/QuoteSummary.styles.d.ts +0 -158
  198. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +0 -1
  199. package/dist/components/Quote/index.d.ts +0 -4
  200. package/dist/components/Quote/index.d.ts.map +0 -1
  201. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts +0 -11
  202. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +0 -1
  203. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts +0 -4
  204. package/dist/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.d.ts.map +0 -1
  205. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts +0 -4
  206. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +0 -1
  207. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts +0 -9
  208. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +0 -1
  209. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +0 -1
  210. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -22
  211. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +0 -1
  212. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts +0 -11
  213. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +0 -1
  214. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts +0 -11
  215. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +0 -1
  216. package/dist/components/QuoteWarningsAndErrors/index.d.ts +0 -2
  217. package/dist/components/QuoteWarningsAndErrors/index.d.ts.map +0 -1
  218. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +0 -4
  219. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +0 -1
  220. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +0 -472
  221. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +0 -1
  222. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -17
  223. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +0 -1
  224. package/dist/containers/QuoteInfo/index.d.ts +0 -2
  225. package/dist/containers/QuoteInfo/index.d.ts.map +0 -1
  226. package/dist/hooks/useConfirmSwap/index.d.ts +0 -2
  227. package/dist/hooks/useConfirmSwap/index.d.ts.map +0 -1
  228. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts +0 -3
  229. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +0 -1
  230. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +0 -16
  231. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +0 -1
  232. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +0 -1
  233. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  234. package/dist/hooks/useForceAutoConnect.d.ts +0 -2
  235. package/dist/hooks/useForceAutoConnect.d.ts.map +0 -1
  236. package/dist/store/AppStore.d.ts +0 -11
  237. package/dist/store/AppStore.d.ts.map +0 -1
  238. package/dist/store/quote.d.ts.map +0 -1
  239. package/dist/types/quote.d.ts +0 -82
  240. package/dist/types/quote.d.ts.map +0 -1
  241. package/dist/utils/quote.d.ts.map +0 -1
  242. package/src/components/NoResult/index.ts +0 -1
  243. package/src/components/Quote/Quote.styles.ts +0 -212
  244. package/src/components/Quote/Quote.tsx +0 -345
  245. package/src/components/Quote/Quote.types.ts +0 -16
  246. package/src/components/Quote/QuoteSkeleton.styles.ts +0 -110
  247. package/src/components/Quote/QuoteSkeleton.tsx +0 -108
  248. package/src/components/Quote/QuoteSkeleton.types.ts +0 -5
  249. package/src/components/Quote/QuoteSummary.styles.ts +0 -15
  250. package/src/components/Quote/QuoteSummary.tsx +0 -46
  251. package/src/components/Quote/index.ts +0 -3
  252. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +0 -107
  253. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +0 -67
  254. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +0 -103
  255. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -24
  256. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +0 -77
  257. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +0 -38
  258. package/src/components/QuoteWarningsAndErrors/index.ts +0 -1
  259. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  260. package/src/containers/QuoteInfo/QuoteInfo.tsx +0 -97
  261. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -17
  262. package/src/containers/QuoteInfo/index.ts +0 -1
  263. package/src/hooks/useConfirmSwap/index.ts +0 -1
  264. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +0 -168
  265. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +0 -136
  266. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +0 -19
  267. package/src/hooks/useForceAutoConnect.ts +0 -27
  268. package/src/store/AppStore.tsx +0 -35
  269. package/src/types/quote.ts +0 -107
  270. package/src/utils/quote.ts +0 -338
  271. /package/src/components/{QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts → RouteErrors/RouteErrors.styles.ts} +0 -0
@@ -1,4 +1,3 @@
1
- import type { SwapperMeta } from 'rango-sdk';
2
1
  export type LiquiditySourceType = 'BRIDGE' | 'AGGREGATOR' | 'DEX';
3
2
  export type UniqueSwappersGroupType = {
4
3
  id: string;
@@ -7,6 +6,6 @@ export type UniqueSwappersGroupType = {
7
6
  type: LiquiditySourceType;
8
7
  selected: boolean;
9
8
  };
10
- export declare function getUniqueSwappersGroups(swappers: SwapperMeta[]): UniqueSwappersGroupType[];
11
- export declare function sortLiquiditySourcesByGroupTitle(a: SwapperMeta, b: SwapperMeta): 1 | -1 | 0;
9
+ export declare function getUniqueSwappersGroups(supportedSwappers?: string[]): UniqueSwappersGroupType[];
10
+ export declare function sortLiquiditySourcesByGroupTitle(a: UniqueSwappersGroupType, b: UniqueSwappersGroupType): 0 | 1 | -1;
12
11
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,EAAE,GACtB,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,cAWf"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,uBAAuB,EAC1B,CAAC,EAAE,uBAAuB,cAW3B"}
@@ -1,40 +1,36 @@
1
- import type { FetchStatus } from '../store/slices/data';
1
+ import type { LoadingStatus } from '../store/meta';
2
2
  import type { ConnectedWallet } from '../store/wallets';
3
- import type { ConvertedToken, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
3
+ import type { ConvertedToken, SwapButtonState, Wallet } from '../types';
4
4
  import type { PendingSwap, PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
5
5
  import type { WalletType } from '@rango-dev/wallets-shared';
6
6
  import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
7
7
  import BigNumber from 'bignumber.js';
8
- export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null): number;
9
- export declare function hasHighValueLoss(inputUsdValue: BigNumber | null, priceImpact: number): boolean;
10
- export declare function hasLimitError(quote: BestRouteResponse | null): boolean;
11
- export declare function getLimitErrorMessage(quote: BestRouteResponse): {
12
- swap: SwapResult;
8
+ export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null): BigNumber | 0;
9
+ export declare function outputRatioHasWarning(inputUsdValue: BigNumber | null, outputRatio: BigNumber | 0): boolean;
10
+ export declare function hasLimitError(bestRoute: BestRouteResponse | null): boolean;
11
+ export declare function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
12
+ swap: SwapResult | null;
13
13
  fromAmountRangeError: string;
14
14
  recommendation: string;
15
15
  };
16
- export declare function getSwapButtonState(loadingMetaStatus: FetchStatus, connectedWallets: ConnectedWallet[], loading: boolean, quote: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
17
- export declare function canComputePriceImpact(quote: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
18
- export declare function requiredWallets(quote: BestRouteResponse | null): string[];
16
+ export declare function getSwapButtonState(loadingMetaStatus: LoadingStatus, connectedWallets: ConnectedWallet[], loading: boolean, bestRoute: BestRouteResponse | null, hasLimitError: boolean, highValueLoss: boolean, priceImpactCanNotBeComputed: boolean, needsToWarnEthOnPath: boolean, inputAmount: string): SwapButtonState;
17
+ export declare function canComputePriceImpact(bestRoute: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
18
+ export declare function requiredWallets(route: BestRouteResponse | null): string[];
19
19
  export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
20
20
  export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
21
- export declare function getTotalFeeInUsd(swaps: SwapResult[], allTokens: Token[]): BigNumber;
21
+ export declare function getTotalFeeInUsd(bestRoute: BestRouteResponse | null, allTokens: Token[]): BigNumber | null;
22
22
  export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
23
23
  export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
24
- export declare function checkSlippageErrors(quote: BestRouteResponse): RecommendedSlippages | null;
25
- export declare function checkSlippageWarnings(quote: BestRouteResponse, userSlippage: number): RecommendedSlippages | null;
26
- export declare function getMinRequiredSlippage(quote: BestRouteResponse): string | null;
24
+ export declare function getMinRequiredSlippage(route: BestRouteResponse): string | null;
27
25
  export declare function hasProperSlippage(userSlippage: string, minRequiredSlippage: string | null): boolean;
28
- export declare function hasEnoughBalance(quote: BestRouteResponse, selectedWallets: Wallet[]): boolean;
29
- export declare function hasEnoughBalanceAndProperSlippage(quote: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
30
- export declare function createQuoteRequestBody(params: {
26
+ export declare function hasEnoughBalance(route: BestRouteResponse, selectedWallets: Wallet[]): boolean;
27
+ export declare function hasEnoughBalanceAndProperSlippage(route: BestRouteResponse, selectedWallets: Wallet[], userSlippage: string, minRequiredSlippage: string | null): boolean;
28
+ export declare function createBestRouteRequestBody(params: {
31
29
  fromToken: Token;
32
30
  toToken: Token;
33
31
  inputAmount: string;
34
32
  wallets?: Wallet[];
35
33
  selectedWallets?: Wallet[];
36
- liquiditySources?: string[];
37
- excludeLiquiditySources?: boolean;
38
34
  disabledLiquiditySources: string[];
39
35
  slippage: number;
40
36
  affiliateRef: string | null;
@@ -42,7 +38,7 @@ export declare function createQuoteRequestBody(params: {
42
38
  affiliateWallets: {
43
39
  [key: string]: string;
44
40
  } | null;
45
- initialQuote?: BestRouteResponse;
41
+ initialRoute?: BestRouteResponse;
46
42
  destination?: string;
47
43
  }): BestRouteRequest;
48
44
  export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
@@ -51,10 +47,10 @@ export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
51
47
  walletType: WalletType;
52
48
  };
53
49
  };
54
- export declare function getQuoteOutputAmount(quote: BestRouteResponse): string | null;
55
- export declare function getPercentageChange(input: string, output: string): number;
56
- export declare function isOutputAmountChangedALot(oldQuote: BestRouteResponse, newQuote: BestRouteResponse): boolean;
57
- export declare function getBalanceWarnings(quote: BestRouteResponse, selectedWallets: Wallet[]): string[];
50
+ export declare function getRouteOutputAmount(route: BestRouteResponse | null): string | null;
51
+ export declare function getPercentageChange(inputUsdValue: string | number | null, outputUsdValue: string | number | null): BigNumber | null;
52
+ export declare function isOutputAmountChangedALot(oldRoute: BestRouteResponse, newRoute: BestRouteResponse): boolean;
53
+ export declare function getBalanceWarnings(route: BestRouteResponse, selectedWallets: Wallet[]): string[];
58
54
  export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
59
55
  export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
60
56
  export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
@@ -66,7 +62,8 @@ export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: P
66
62
  };
67
63
  export declare function getLastConvertedTokenInFailedSwap(pendingSwap: PendingSwap): ConvertedToken;
68
64
  export declare function shouldRetrySwap(pendingSwap: PendingSwap): boolean;
69
- export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, quote: BestRouteResponse | null, selectedWallets: {
65
+ export declare function isValidCustomDestination(blockchain: string, address: string): boolean;
66
+ export declare function confirmSwapDisabled(fetching: boolean, showCustomDestination: boolean, customDestination: string, bestRoute: BestRouteResponse | null, selectedWallets: {
70
67
  walletType: string;
71
68
  chain: string;
72
69
  }[], lastStepToBlockchain?: BlockchainMeta): boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AAInB,OAAO,SAAS,MAAM,cAAc,CAAC;AAmBrC,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,cAAc,EAAE,SAAS,GAAG,IAAI,UAejC;AAED,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,WAAW,EAAE,MAAM,GAClB,OAAO,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Ae,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD;AACD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAMT;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC"}
@@ -8,8 +8,8 @@ import { WalletState as WalletStatus } from '@rango-dev/ui';
8
8
  export declare function mapStatusToWalletState(state: WalletState): WalletStatus;
9
9
  export declare function mapWalletTypesToWalletInfo(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[], chain?: string): ModalWalletInfo[];
10
10
  export declare function walletAndSupportedChainsNames(supportedBlockchains: BlockchainMeta[]): Network[] | null;
11
- export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null, isContractWallet: boolean): Wallet[];
12
- export declare function getRequiredChains(quote: BestRouteResponse | null): string[];
11
+ export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null): Wallet[];
12
+ export declare function getRequiredChains(route: BestRouteResponse | null): string[];
13
13
  export declare function getBalanceFromWallet(connectedWallets: ConnectedWallet[], chain: string, symbol: string, address: string | null): TokenBalance | null;
14
14
  export declare function isAccountAndWalletMatched(account: Wallet, connectedWallet: ConnectedWallet): boolean;
15
15
  export declare function makeBalanceFor(retrievedBalance: WalletDetail, tokens: Token[]): TokenBalance[];
@@ -1 +1 @@
1
- {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EAEX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB5D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAWvE;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,EAC3C,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,EAC/C,IAAI,EAAE,UAAU,EAAE,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,eAAe,EAAE,CA6BnB;AAED,wBAAgB,6BAA6B,CAC3C,oBAAoB,EAAE,cAAc,EAAE,GACrC,OAAO,EAAE,GAAG,IAAI,CAUlB;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EAAE,EACxB,mBAAmB,EAAE,OAAO,EAAE,GAAG,IAAI,EACrC,gBAAgB,EAAE,OAAO,GACxB,MAAM,EAAE,CAkFV;AAED,wBAA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get-embedded",
3
- "version": "0.17.1-next.9",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,13 +19,13 @@
19
19
  "dependencies": {
20
20
  "@lingui/core": "4.2.1",
21
21
  "@lingui/react": "4.2.1",
22
- "@rango-dev/provider-all": "^0.22.1-next.4",
23
- "@rango-dev/queue-manager-core": "^0.22.1-next.0",
24
- "@rango-dev/queue-manager-rango-preset": "^0.22.1-next.5",
25
- "@rango-dev/queue-manager-react": "^0.22.1-next.0",
26
- "@rango-dev/ui": "^0.22.1-next.6",
27
- "@rango-dev/wallets-react": "^0.8.1-next.3",
28
- "@rango-dev/wallets-shared": "^0.21.1-next.3",
22
+ "@rango-dev/provider-all": "^0.24.0",
23
+ "@rango-dev/queue-manager-core": "^0.23.0",
24
+ "@rango-dev/queue-manager-rango-preset": "^0.24.0",
25
+ "@rango-dev/queue-manager-react": "^0.23.0",
26
+ "@rango-dev/ui": "^0.24.0",
27
+ "@rango-dev/wallets-react": "^0.10.0",
28
+ "@rango-dev/wallets-shared": "^0.23.0",
29
29
  "bignumber.js": "^9.1.1",
30
30
  "copy-to-clipboard": "^3.3.3",
31
31
  "dayjs": "^1.11.7",
@@ -1,21 +1,21 @@
1
- import type { SwapQueueContext } from '@rango-dev/queue-manager-rango-preset';
2
- import type { Network, WalletType } from '@rango-dev/wallets-shared';
3
- import type { PropsWithChildren } from 'react';
4
-
1
+ import React, { PropsWithChildren, useMemo } from 'react';
2
+ import { Provider as ManagerProvider } from '@rango-dev/queue-manager-react';
5
3
  import {
6
- checkWaitingForNetworkChange,
7
4
  makeQueueDefinition,
5
+ SwapQueueContext,
6
+ checkWaitingForNetworkChange,
8
7
  } from '@rango-dev/queue-manager-rango-preset';
9
- import { Provider as ManagerProvider } from '@rango-dev/queue-manager-react';
10
8
  import { useWallets } from '@rango-dev/wallets-react';
11
- import { convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-shared';
12
- import { isEvmBlockchain } from 'rango-types';
13
- import React, { useMemo } from 'react';
14
-
15
- import { useAppStore } from './store/AppStore';
9
+ import {
10
+ convertEvmBlockchainMetaToEvmChainInfo,
11
+ Network,
12
+ WalletType,
13
+ } from '@rango-dev/wallets-shared';
14
+ import { useMetaStore } from './store/meta';
16
15
  import { useWalletsStore } from './store/wallets';
17
- import { getConfig } from './utils/configs';
18
16
  import { walletAndSupportedChainsNames } from './utils/wallets';
17
+ import { getConfig } from './utils/configs';
18
+ import { isEvmBlockchain } from 'rango-types';
19
19
 
20
20
  function QueueManager(props: PropsWithChildren) {
21
21
  const {
@@ -33,7 +33,7 @@ function QueueManager(props: PropsWithChildren) {
33
33
  });
34
34
  }, []);
35
35
 
36
- const blockchains = useAppStore().blockchains();
36
+ const { blockchains } = useMetaStore.use.meta();
37
37
  const connectedWallets = useWalletsStore.use.connectedWallets();
38
38
 
39
39
  const wallets = {
@@ -43,7 +43,7 @@ function QueueManager(props: PropsWithChildren) {
43
43
  })),
44
44
  };
45
45
 
46
- const switchNetwork = async (wallet: WalletType, network: Network) => {
46
+ const switchNetwork = (wallet: WalletType, network: Network) => {
47
47
  if (!canSwitchNetworkTo(wallet, network)) {
48
48
  return undefined;
49
49
  }
package/src/Wallets.tsx CHANGED
@@ -6,10 +6,10 @@ import type { PropsWithChildren } from 'react';
6
6
 
7
7
  import { Events, Provider } from '@rango-dev/wallets-react';
8
8
  import { isEvmBlockchain } from 'rango-sdk';
9
- import React, { createContext, useEffect, useRef } from 'react';
9
+ import React, { createContext, useRef } from 'react';
10
10
 
11
11
  import { useWalletProviders } from './hooks/useWalletProviders';
12
- import { AppStoreProvider, useAppStore } from './store/AppStore';
12
+ import { useMetaStore } from './store/meta';
13
13
  import { useWalletsStore } from './store/wallets';
14
14
  import {
15
15
  prepareAccountsForWalletStore,
@@ -27,45 +27,41 @@ export const WidgetContext = createContext<WidgetContextInterface>({
27
27
  },
28
28
  });
29
29
 
30
- function Main(
30
+ export function WidgetWallets(
31
31
  props: PropsWithChildren<{
32
32
  providers: WidgetConfig['wallets'];
33
33
  options?: ProvidersOptions;
34
34
  onUpdateState?: EventHandler;
35
- config: WidgetConfig;
36
35
  }>
37
36
  ) {
38
- const updateConfig = useAppStore().updateConfig;
39
- const blockchains = useAppStore().blockchains();
40
- const tokens = useAppStore().tokens();
37
+ const { blockchains } = useMetaStore.use.meta();
41
38
  const { providers } = useWalletProviders(props.providers, props?.options);
42
39
  const disconnectWallet = useWalletsStore.use.disconnectWallet();
43
40
  const connectWallet = useWalletsStore.use.connectWallet();
44
41
  const onConnectWalletHandler = useRef<OnConnectHandler>();
45
42
 
46
- useEffect(() => {
47
- if (props.config) {
48
- updateConfig(props.config);
49
- }
50
- }, [props.config]);
51
-
52
43
  const evmBasedChainNames = blockchains
53
44
  .filter(isEvmBlockchain)
54
45
  .map((chain) => chain.name);
55
46
 
56
- const onUpdateState: EventHandler = (type, event, value, state, meta) => {
47
+ const onUpdateState: EventHandler = (
48
+ type,
49
+ event,
50
+ value,
51
+ state,
52
+ supportedBlockchains
53
+ ) => {
57
54
  if (event === Events.ACCOUNTS) {
58
55
  if (value) {
59
56
  const supportedChainNames: Network[] | null =
60
- walletAndSupportedChainsNames(meta.supportedBlockchains);
57
+ walletAndSupportedChainsNames(supportedBlockchains);
61
58
  const data = prepareAccountsForWalletStore(
62
59
  type,
63
60
  value,
64
61
  evmBasedChainNames,
65
- supportedChainNames,
66
- meta.isContractWallet
62
+ supportedChainNames
67
63
  );
68
- connectWallet(data, tokens);
64
+ connectWallet(data);
69
65
  } else {
70
66
  disconnectWallet(type);
71
67
  }
@@ -95,7 +91,7 @@ function Main(
95
91
 
96
92
  // propagate updates for Dapps using external wallets
97
93
  if (props.onUpdateState) {
98
- props.onUpdateState(type, event, value, state, meta);
94
+ props.onUpdateState(type, event, value, state, supportedBlockchains);
99
95
  }
100
96
  };
101
97
  return (
@@ -116,19 +112,3 @@ function Main(
116
112
  </WidgetContext.Provider>
117
113
  );
118
114
  }
119
-
120
- export function WidgetWallets(
121
- props: PropsWithChildren<{
122
- providers: WidgetConfig['wallets'];
123
- options?: ProvidersOptions;
124
- onUpdateState?: EventHandler;
125
- config: WidgetConfig;
126
- }>
127
- ) {
128
- const { config, ...otherProps } = props;
129
- return (
130
- <AppStoreProvider config={config}>
131
- <Main {...otherProps} config={config} />
132
- </AppStoreProvider>
133
- );
134
- }
package/src/Widget.tsx CHANGED
@@ -12,10 +12,10 @@ import { globalFont } from './globalStyles';
12
12
  import { useLanguage } from './hooks/useLanguage';
13
13
  import { useTheme } from './hooks/useTheme';
14
14
  import QueueManager from './QueueManager';
15
- import { useAppStore } from './store/AppStore';
15
+ import { useAppStore } from './store/app';
16
+ import { useMetaStore } from './store/meta';
16
17
  import { useNotificationStore } from './store/notification';
17
18
  import { useSettingsStore } from './store/settings';
18
- import { DEFAULT_CONFIG } from './store/slices/config';
19
19
  import { initConfig } from './utils/configs';
20
20
  import { WidgetContext, WidgetWallets } from './Wallets';
21
21
 
@@ -40,16 +40,18 @@ export type WidgetProps = {
40
40
  config?: WidgetConfig;
41
41
  };
42
42
 
43
- export function Main() {
43
+ export function Main(props: PropsWithChildren<WidgetProps>) {
44
+ const { config } = props;
44
45
  globalFont();
45
46
 
46
- const { fetch: fetchMeta, config } = useAppStore();
47
47
  const { activeTheme } = useTheme(config?.theme || {});
48
48
  const { activeLanguage, changeLanguage } = useLanguage();
49
+
49
50
  const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
50
51
  useState<string>('');
51
52
  const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
52
53
  const widgetContext = useContext(WidgetContext);
54
+ const fetchMeta = useMetaStore.use.fetchMeta();
53
55
 
54
56
  useMemo(() => {
55
57
  if (config?.apiKey) {
@@ -58,12 +60,14 @@ export function Main() {
58
60
  });
59
61
  }
60
62
  }, [config]);
63
+
61
64
  useEffect(() => {
62
- void fetchMeta().catch();
65
+ void fetchMeta();
63
66
  void useSettingsStore.persist.rehydrate();
64
67
  void useNotificationStore.persist.rehydrate();
65
68
  widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
66
69
  }, []);
70
+
67
71
  useEffect(() => {
68
72
  if (config?.language) {
69
73
  changeLanguage(config.language);
@@ -76,12 +80,13 @@ export function Main() {
76
80
  <QueueManager>
77
81
  <WidgetEvents />
78
82
  <AppRouter
83
+ config={config}
79
84
  lastConnectedWallet={lastConnectedWalletWithNetwork}
80
85
  disconnectedWallet={disconnectedWallet}
81
86
  clearDisconnectedWallet={() => {
82
87
  setDisconnectedWallet(undefined);
83
88
  }}>
84
- <AppRoutes />
89
+ <AppRoutes config={config} />
85
90
  </AppRouter>
86
91
  </QueueManager>
87
92
  </MainContainer>
@@ -90,17 +95,25 @@ export function Main() {
90
95
  }
91
96
 
92
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
+
93
105
  if (!props.config?.externalWallets) {
94
106
  return (
95
107
  <WidgetWallets
96
- config={props.config ?? DEFAULT_CONFIG}
97
- providers={props.config?.wallets}
108
+ providers={config?.wallets}
98
109
  options={{
99
- walletConnectProjectId: props.config?.walletConnectProjectId,
110
+ walletConnectProjectId:
111
+ config?.walletConnectProjectId ||
112
+ props.config?.walletConnectProjectId,
100
113
  }}>
101
- <Main />
114
+ <Main {...props} />
102
115
  </WidgetWallets>
103
116
  );
104
117
  }
105
- return <Main />;
118
+ return <Main {...props} />;
106
119
  }
@@ -1,3 +1,4 @@
1
+ import type { WidgetConfig } from '../types';
1
2
  import type { WalletType } from '@rango-dev/wallets-shared';
2
3
  import type { PropsWithChildren } from 'react';
3
4
 
@@ -9,9 +10,8 @@ import { MemoryRouter, useInRouterContext } from 'react-router';
9
10
  import { useLocation, useNavigate } from 'react-router-dom';
10
11
 
11
12
  import { navigationRoutes } from '../constants/navigationRoutes';
12
- import { useForceAutoConnect } from '../hooks/useForceAutoConnect';
13
13
  import { Home } from '../pages/Home';
14
- import { useAppStore } from '../store/AppStore';
14
+ import { useMetaStore } from '../store/meta';
15
15
 
16
16
  import { UpdateUrl } from './UpdateUrl';
17
17
 
@@ -44,14 +44,13 @@ export function AppRouter({
44
44
  lastConnectedWallet: string;
45
45
  disconnectedWallet: WalletType | undefined;
46
46
  clearDisconnectedWallet: () => void;
47
+ config: WidgetConfig | undefined;
47
48
  }) {
48
49
  const isRouterInContext = useInRouterContext();
49
50
  const Router = isRouterInContext ? Route : MemoryRouter;
50
- const blockchains = useAppStore().blockchains();
51
+ const { blockchains } = useMetaStore.use.meta();
51
52
  const { canSwitchNetworkTo } = useWallets();
52
53
 
53
- useForceAutoConnect();
54
-
55
54
  const evmChains = blockchains.filter(isEvmBlockchain);
56
55
 
57
56
  useQueueManager({
@@ -65,7 +64,7 @@ export function AppRouter({
65
64
  return (
66
65
  <>
67
66
  <Router>{children}</Router>
68
- {isRouterInContext && <UpdateUrl />}
67
+ {isRouterInContext && <UpdateUrl config={props.config} />}
69
68
  </>
70
69
  );
71
70
  }
@@ -1,3 +1,5 @@
1
+ import type { WidgetConfig } from '../types';
2
+
1
3
  import React from 'react';
2
4
  import { useRoutes } from 'react-router-dom';
3
5
 
@@ -16,7 +18,13 @@ import { WalletsPage } from '../pages/WalletsPage';
16
18
 
17
19
  const getAbsolutePath = (path: string) => path.replace('/', '');
18
20
 
19
- export function AppRoutes() {
21
+ interface PropTypes {
22
+ config?: WidgetConfig;
23
+ }
24
+
25
+ export function AppRoutes(props: PropTypes) {
26
+ const { config } = props;
27
+
20
28
  return useRoutes([
21
29
  {
22
30
  path: navigationRoutes.home,
@@ -40,7 +48,12 @@ export function AppRoutes() {
40
48
  },
41
49
  {
42
50
  path: navigationRoutes.settings,
43
- element: <SettingsPage />,
51
+ element: (
52
+ <SettingsPage
53
+ singleTheme={config?.theme?.singleTheme}
54
+ supportedSwappers={config?.liquiditySources}
55
+ />
56
+ ),
44
57
  },
45
58
  {
46
59
  path: navigationRoutes.themes,
@@ -52,11 +65,21 @@ export function AppRoutes() {
52
65
  },
53
66
  {
54
67
  path: navigationRoutes.exchanges,
55
- element: <LiquiditySourcePage sourceType="Exchanges" />,
68
+ element: (
69
+ <LiquiditySourcePage
70
+ sourceType="Exchanges"
71
+ supportedSwappers={config?.liquiditySources}
72
+ />
73
+ ),
56
74
  },
57
75
  {
58
76
  path: navigationRoutes.bridges,
59
- element: <LiquiditySourcePage sourceType="Bridges" />,
77
+ element: (
78
+ <LiquiditySourcePage
79
+ sourceType="Bridges"
80
+ supportedSwappers={config?.liquiditySources}
81
+ />
82
+ ),
60
83
  },
61
84
  { path: navigationRoutes.swaps, element: <HistoryPage /> },
62
85
  {
@@ -65,11 +88,21 @@ export function AppRoutes() {
65
88
  },
66
89
  {
67
90
  path: navigationRoutes.wallets,
68
- element: <WalletsPage />,
91
+ element: (
92
+ <WalletsPage
93
+ supportedWallets={config?.wallets}
94
+ multiWallets={
95
+ typeof config?.multiWallets === 'undefined'
96
+ ? true
97
+ : config.multiWallets
98
+ }
99
+ config={config}
100
+ />
101
+ ),
69
102
  },
70
103
  {
71
104
  path: getAbsolutePath(navigationRoutes.confirmSwap),
72
- element: <ConfirmSwapPage />,
105
+ element: <ConfirmSwapPage config={config} />,
73
106
  },
74
107
  ]);
75
108
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React, { useEffect, useState } from 'react';
13
13
 
14
- import { useAppStore } from '../../store/AppStore';
14
+ import { useMetaStore } from '../../store/meta';
15
15
 
16
16
  import { filterBlockchains } from './BlockchainList.helpers';
17
17
  import { Container, List } from './BlockchainList.styles';
@@ -20,7 +20,7 @@ import { LoadingBlockchainList } from './LoadingBlockchainList';
20
20
  export function BlockchainList(props: PropTypes) {
21
21
  const { list, searchedFor, onChange, blockchainCategory } = props;
22
22
  const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
23
- const { fetchStatus } = useAppStore();
23
+ const loadingStatus = useMetaStore.use.loadingStatus();
24
24
 
25
25
  useEffect(() => {
26
26
  setBlockchains([
@@ -66,8 +66,8 @@ export function BlockchainList(props: PropTypes) {
66
66
  {i18n.t('Select Blockchain')}
67
67
  </Typography>
68
68
  <Divider size={4} />
69
- {fetchStatus === 'loading' && <LoadingBlockchainList />}
70
- {fetchStatus === 'success' && renderList()}
69
+ {loadingStatus === 'loading' && <LoadingBlockchainList />}
70
+ {loadingStatus === 'success' && renderList()}
71
71
  </Container>
72
72
  );
73
73
  }
@@ -13,8 +13,8 @@ import React from 'react';
13
13
 
14
14
  import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
15
15
  import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
16
- import { useAppStore } from '../../store/AppStore';
17
- import { useQuoteStore } from '../../store/quote';
16
+ import { useBestRouteStore } from '../../store/bestRoute';
17
+ import { useMetaStore } from '../../store/meta';
18
18
 
19
19
  import { Container } from './BlockchainsSection.styles';
20
20
 
@@ -27,9 +27,9 @@ export function BlockchainsSection(props: PropTypes) {
27
27
  selected: blockchain?.name,
28
28
  });
29
29
 
30
- const { fetchStatus } = useAppStore();
31
- const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
32
- const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
30
+ const loadingStatus = useMetaStore.use.loadingStatus();
31
+ const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
32
+ const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
33
33
  const hasMoreItemsInList = blockchainsList.more.length > 0;
34
34
  /**
35
35
  * When only one item is left on list, we will not show the `More` button and will show the item itself instead.
@@ -45,11 +45,11 @@ export function BlockchainsSection(props: PropTypes) {
45
45
  </Typography>
46
46
  <Divider size={12} />
47
47
  <Container>
48
- {fetchStatus === 'loading' &&
48
+ {loadingStatus === 'loading' &&
49
49
  Array.from(Array(NUMBER_OF_LOADING), (e) => (
50
50
  <Skeleton key={e} variant="rounded" height={50} />
51
51
  ))}
52
- {fetchStatus === 'success' && (
52
+ {loadingStatus === 'success' && (
53
53
  <>
54
54
  <BlockchainsChip
55
55
  selected={!blockchain}