@lifi/widget 1.31.1 → 1.32.1

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 (441) hide show
  1. package/App.js +4 -16
  2. package/AppDrawer.js +13 -7
  3. package/AppDrawer.style.d.ts +3 -3
  4. package/AppDrawer.style.js +1 -1
  5. package/AppProvider.js +1 -1
  6. package/AppRoutes.js +9 -0
  7. package/cjs/App.js +4 -16
  8. package/cjs/AppDrawer.js +13 -7
  9. package/cjs/AppDrawer.style.d.ts +3 -3
  10. package/cjs/AppDrawer.style.js +1 -1
  11. package/cjs/AppProvider.js +1 -1
  12. package/cjs/AppRoutes.js +9 -0
  13. package/cjs/components/ActiveSwaps/ActiveSwapItem.js +9 -7
  14. package/cjs/components/ActiveSwaps/ActiveSwaps.js +3 -3
  15. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +5 -5
  16. package/cjs/components/AppContainer.d.ts +2 -2
  17. package/cjs/components/AppContainer.js +1 -1
  18. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  19. package/cjs/components/BottomSheet/BottomSheet.js +2 -2
  20. package/cjs/components/Card/Card.d.ts +2 -2
  21. package/cjs/components/Card/CardHeader.d.ts +1 -1
  22. package/cjs/components/Card/CardTitle.d.ts +1 -1
  23. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  24. package/cjs/components/ChainSelect/ChainSelect.js +3 -4
  25. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +3 -3
  26. package/cjs/components/ContractComponent/ContractComponent.js +1 -1
  27. package/cjs/components/Dialog.js +1 -1
  28. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
  29. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
  30. package/cjs/components/Header/Header.js +1 -1
  31. package/cjs/components/Header/Header.style.d.ts +4 -4
  32. package/cjs/components/Header/NavigationHeader.js +6 -2
  33. package/cjs/components/Header/WalletHeader.js +12 -22
  34. package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
  35. package/cjs/{pages/SelectWalletPage/SelectWalletPage.style.js → components/ListItemButton.js} +2 -8
  36. package/cjs/components/ListItemText.d.ts +2 -0
  37. package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js → components/ListItemText.js} +1 -10
  38. package/cjs/components/NFT/NFT.js +2 -14
  39. package/cjs/components/NFT/NFT.style.d.ts +1 -1
  40. package/cjs/components/NotFound.js +2 -2
  41. package/cjs/components/PoweredBy/PoweredBy.js +2 -2
  42. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  43. package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
  44. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  45. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  46. package/cjs/components/Select.js +1 -0
  47. package/cjs/components/SelectChainAndToken.js +4 -4
  48. package/cjs/components/SelectTokenButton/SelectTokenButton.js +2 -2
  49. package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  50. package/cjs/components/SendToWallet/SendToWallet.js +9 -19
  51. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  52. package/cjs/components/SendToWallet/SendToWalletButton.js +5 -5
  53. package/cjs/components/SmallAvatar.d.ts +3 -3
  54. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  55. package/cjs/components/Step/CircularProgress.js +2 -2
  56. package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
  57. package/cjs/components/Step/DestinationWalletAddress.js +6 -7
  58. package/cjs/components/Step/GasStepProcess.js +8 -8
  59. package/cjs/components/Step/Step.js +4 -5
  60. package/cjs/components/Step/StepList.d.ts +0 -1
  61. package/cjs/components/Step/StepList.js +8 -4
  62. package/cjs/components/Step/StepProcess.js +3 -3
  63. package/cjs/components/Step/StepProcess.style.d.ts +3 -3
  64. package/cjs/components/Step/StepTimer.js +4 -8
  65. package/cjs/components/StepActions/StepActions.js +20 -37
  66. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  67. package/cjs/components/StepDivider/StepDivider.style.d.ts +1 -1
  68. package/cjs/components/SwapButton/SwapButton.js +5 -14
  69. package/cjs/components/SwapInput/FormPriceHelperText.js +6 -6
  70. package/cjs/components/SwapInput/SwapInput.js +4 -16
  71. package/cjs/components/SwapInput/SwapInput.style.d.ts +2 -2
  72. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +2 -2
  73. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  74. package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -3
  75. package/cjs/components/SwapRouteCard/SwapRouteCard.js +9 -25
  76. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +3 -3
  77. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
  78. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
  79. package/cjs/components/SwapRouteCard/utils.js +1 -1
  80. package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
  81. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
  82. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  83. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
  84. package/cjs/components/TextFitter/TextFitter.js +3 -3
  85. package/cjs/components/Token/Token.js +19 -33
  86. package/cjs/components/Token/Token.style.d.ts +3 -3
  87. package/cjs/components/TokenAvatar/TokenAvatar.js +6 -7
  88. package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
  89. package/cjs/components/TokenList/TokenList.js +3 -4
  90. package/cjs/components/TokenList/TokenList.style.d.ts +3 -3
  91. package/cjs/components/TokenList/TokenList.style.js +2 -6
  92. package/cjs/components/TokenList/TokenListItem.js +9 -9
  93. package/cjs/components/TokenList/TokenNotFound.js +4 -5
  94. package/cjs/components/TokenList/VirtualizedTokenList.js +10 -11
  95. package/cjs/components/TokenList/useTokenSelect.js +2 -2
  96. package/cjs/config/env.js +1 -1
  97. package/cjs/config/sentry.js +3 -12
  98. package/cjs/config/theme.js +44 -16
  99. package/cjs/config/version.d.ts +1 -1
  100. package/cjs/config/version.js +1 -1
  101. package/cjs/hooks/useChain.js +1 -1
  102. package/cjs/hooks/useChains.js +5 -14
  103. package/cjs/hooks/useContentHeight.js +1 -2
  104. package/cjs/hooks/useFeaturedTokens.js +1 -4
  105. package/cjs/hooks/useGasSufficiency.js +28 -34
  106. package/cjs/hooks/useProcessMessage.js +7 -11
  107. package/cjs/hooks/useRouteExecution.js +16 -26
  108. package/cjs/hooks/useSwapRoutes.js +16 -26
  109. package/cjs/hooks/useToken.js +2 -2
  110. package/cjs/hooks/useTokenAddressBalance.js +1 -2
  111. package/cjs/hooks/useTokenBalance.js +24 -27
  112. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  113. package/cjs/hooks/useTokenBalances.js +8 -20
  114. package/cjs/hooks/useTokenSearch.d.ts +1 -1
  115. package/cjs/hooks/useTokenSearch.js +12 -21
  116. package/cjs/hooks/useTokens.d.ts +1 -1
  117. package/cjs/hooks/useTokens.js +36 -38
  118. package/cjs/hooks/useTools.d.ts +2 -11
  119. package/cjs/hooks/useTools.js +11 -21
  120. package/cjs/i18n/en.json +8 -8
  121. package/cjs/i18n/uk.json +8 -8
  122. package/cjs/icons/LiFiFullLogo.js +1 -1
  123. package/cjs/icons/LiFiLogo.js +1 -1
  124. package/cjs/icons/LiFiToolLogo.js +1 -1
  125. package/cjs/index.d.ts +1 -0
  126. package/cjs/index.js +2 -0
  127. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
  128. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  129. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
  130. package/cjs/pages/MainPage/MainPage.js +1 -1
  131. package/cjs/pages/MainPage/MainPage.style.d.ts +1 -1
  132. package/cjs/pages/MainPage/MainSwapButton.js +3 -12
  133. package/cjs/pages/SelectChainPage/SelectChainPage.js +6 -14
  134. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
  135. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +51 -0
  136. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
  137. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +8 -0
  138. package/cjs/pages/SelectEnabledToolsPage/index.d.ts +1 -0
  139. package/cjs/pages/SelectEnabledToolsPage/index.js +17 -0
  140. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
  141. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  142. package/cjs/pages/SelectTokenPage/SearchTokenInput.js +4 -1
  143. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -3
  144. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  145. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +13 -19
  146. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
  147. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  148. package/cjs/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
  149. package/cjs/pages/SettingsPage/EnabledToolsButton.js +25 -0
  150. package/cjs/pages/{SelectChainPage/SelectChainPage.style.d.ts → SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
  151. package/cjs/pages/{SelectChainPage/SelectChainPage.style.js → SettingsPage/EnabledToolsButton.style.js} +7 -10
  152. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  153. package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
  154. package/cjs/pages/SettingsPage/LanguageSelect.js +5 -6
  155. package/cjs/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
  156. package/cjs/pages/SettingsPage/ResetSettingsButton.js +27 -0
  157. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +4 -4
  158. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  159. package/cjs/pages/SettingsPage/SettingsPage.js +3 -2
  160. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  161. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +3 -3
  162. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  163. package/cjs/pages/SettingsPage/SlippageInput.js +3 -3
  164. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
  165. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
  166. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  167. package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
  168. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  169. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
  170. package/cjs/pages/SwapPage/StartSwapButton.js +1 -1
  171. package/cjs/pages/SwapPage/StatusBottomSheet.js +21 -19
  172. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
  173. package/cjs/pages/SwapPage/SwapPage.js +9 -21
  174. package/cjs/pages/SwapPage/SwapPage.style.d.ts +1 -1
  175. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +8 -9
  176. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
  177. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
  178. package/cjs/providers/I18nProvider/I18nProvider.js +7 -8
  179. package/cjs/providers/SDKProvider/SDKProvider.js +15 -4
  180. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +12 -6
  181. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
  182. package/cjs/providers/TelemetryProvider/TelemetryProvider.js +1 -1
  183. package/cjs/providers/ThemeProvider/ThemeProvider.js +2 -2
  184. package/cjs/providers/WalletProvider/WalletProvider.js +30 -39
  185. package/cjs/providers/WidgetProvider/WidgetProvider.js +20 -27
  186. package/cjs/providers/WidgetProvider/utils.js +2 -3
  187. package/cjs/stores/StoreProvider.js +1 -7
  188. package/cjs/stores/chains/index.d.ts +1 -2
  189. package/cjs/stores/chains/index.js +1 -2
  190. package/cjs/stores/chains/useChainOrder.js +2 -2
  191. package/cjs/stores/chains/useChainOrderStore.d.ts +3 -0
  192. package/cjs/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +3 -4
  193. package/cjs/stores/routes/RouteExecutionStore.js +2 -14
  194. package/cjs/stores/routes/createRouteExecutionStore.js +27 -16
  195. package/cjs/stores/routes/types.d.ts +1 -1
  196. package/cjs/stores/routes/useExecutingRoutesIds.js +2 -5
  197. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +10 -2
  198. package/cjs/stores/routes/useRecommendedRouteStore.js +30 -2
  199. package/cjs/stores/routes/useSwapHistory.js +3 -6
  200. package/cjs/stores/routes/utils.js +4 -4
  201. package/cjs/stores/settings/index.d.ts +1 -1
  202. package/cjs/stores/settings/index.js +1 -1
  203. package/cjs/stores/settings/types.d.ts +6 -6
  204. package/cjs/stores/settings/useAppearance.js +2 -2
  205. package/cjs/stores/settings/useSettings.js +2 -2
  206. package/cjs/stores/settings/useSettingsStore.d.ts +6 -0
  207. package/cjs/stores/settings/{createSettingsStore.js → useSettingsStore.js} +48 -28
  208. package/cjs/utils/colors.js +1 -1
  209. package/cjs/utils/format.js +3 -3
  210. package/cjs/utils/navigationRoutes.d.ts +2 -0
  211. package/cjs/utils/navigationRoutes.js +6 -0
  212. package/components/ActiveSwaps/ActiveSwapItem.js +9 -7
  213. package/components/ActiveSwaps/ActiveSwaps.js +3 -3
  214. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +5 -5
  215. package/components/AppContainer.d.ts +2 -2
  216. package/components/AppContainer.js +1 -1
  217. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  218. package/components/BottomSheet/BottomSheet.js +2 -2
  219. package/components/Card/Card.d.ts +2 -2
  220. package/components/Card/CardHeader.d.ts +1 -1
  221. package/components/Card/CardTitle.d.ts +1 -1
  222. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  223. package/components/ChainSelect/ChainSelect.js +3 -4
  224. package/components/ChainSelect/ChainSelect.style.d.ts +3 -3
  225. package/components/ContractComponent/ContractComponent.js +1 -1
  226. package/components/Dialog.js +1 -1
  227. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
  228. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
  229. package/components/Header/Header.js +1 -1
  230. package/components/Header/Header.style.d.ts +4 -4
  231. package/components/Header/NavigationHeader.js +6 -2
  232. package/components/Header/WalletHeader.js +12 -22
  233. package/{pages/SelectChainPage/SelectChainPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
  234. package/components/ListItemButton.js +11 -0
  235. package/components/ListItemText.d.ts +2 -0
  236. package/components/ListItemText.js +8 -0
  237. package/components/NFT/NFT.js +2 -14
  238. package/components/NFT/NFT.style.d.ts +1 -1
  239. package/components/NotFound.js +2 -2
  240. package/components/PoweredBy/PoweredBy.js +2 -2
  241. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  242. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
  243. package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  244. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  245. package/components/Select.js +1 -0
  246. package/components/SelectChainAndToken.js +4 -4
  247. package/components/SelectTokenButton/SelectTokenButton.js +2 -2
  248. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  249. package/components/SendToWallet/SendToWallet.js +9 -19
  250. package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  251. package/components/SendToWallet/SendToWalletButton.js +5 -5
  252. package/components/SmallAvatar.d.ts +3 -3
  253. package/components/Step/CircularProgress.d.ts +0 -1
  254. package/components/Step/CircularProgress.js +2 -2
  255. package/components/Step/CircularProgress.style.d.ts +1 -1
  256. package/components/Step/DestinationWalletAddress.js +6 -7
  257. package/components/Step/GasStepProcess.js +8 -8
  258. package/components/Step/Step.js +4 -5
  259. package/components/Step/StepList.d.ts +0 -1
  260. package/components/Step/StepList.js +8 -4
  261. package/components/Step/StepProcess.js +3 -3
  262. package/components/Step/StepProcess.style.d.ts +3 -3
  263. package/components/Step/StepTimer.js +4 -8
  264. package/components/StepActions/StepActions.js +20 -37
  265. package/components/StepActions/StepActions.style.d.ts +1 -1
  266. package/components/StepDivider/StepDivider.style.d.ts +1 -1
  267. package/components/SwapButton/SwapButton.js +5 -14
  268. package/components/SwapInput/FormPriceHelperText.js +6 -6
  269. package/components/SwapInput/SwapInput.js +4 -16
  270. package/components/SwapInput/SwapInput.style.d.ts +2 -2
  271. package/components/SwapInput/SwapInputAdornment.style.d.ts +2 -2
  272. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  273. package/components/SwapInput/SwapInputEndAdornment.js +2 -3
  274. package/components/SwapRouteCard/SwapRouteCard.js +9 -25
  275. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +3 -3
  276. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
  277. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
  278. package/components/SwapRouteCard/utils.js +1 -1
  279. package/components/SwapRoutes/SwapRoutes.js +4 -4
  280. package/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
  281. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  282. package/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
  283. package/components/TextFitter/TextFitter.js +3 -3
  284. package/components/Token/Token.js +19 -33
  285. package/components/Token/Token.style.d.ts +3 -3
  286. package/components/TokenAvatar/TokenAvatar.js +6 -7
  287. package/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
  288. package/components/TokenList/TokenList.js +3 -4
  289. package/components/TokenList/TokenList.style.d.ts +3 -3
  290. package/components/TokenList/TokenList.style.js +3 -7
  291. package/components/TokenList/TokenListItem.js +9 -9
  292. package/components/TokenList/TokenNotFound.js +4 -5
  293. package/components/TokenList/VirtualizedTokenList.js +10 -11
  294. package/components/TokenList/useTokenSelect.js +2 -2
  295. package/config/env.js +1 -1
  296. package/config/sentry.js +3 -12
  297. package/config/theme.js +44 -16
  298. package/config/version.d.ts +1 -1
  299. package/config/version.js +1 -1
  300. package/hooks/useChain.js +1 -1
  301. package/hooks/useChains.js +5 -14
  302. package/hooks/useContentHeight.js +1 -2
  303. package/hooks/useFeaturedTokens.js +1 -4
  304. package/hooks/useGasSufficiency.js +28 -34
  305. package/hooks/useProcessMessage.js +7 -11
  306. package/hooks/useRouteExecution.js +16 -26
  307. package/hooks/useSwapRoutes.js +16 -26
  308. package/hooks/useToken.js +2 -2
  309. package/hooks/useTokenAddressBalance.js +1 -2
  310. package/hooks/useTokenBalance.js +24 -27
  311. package/hooks/useTokenBalances.d.ts +1 -1
  312. package/hooks/useTokenBalances.js +8 -20
  313. package/hooks/useTokenSearch.d.ts +1 -1
  314. package/hooks/useTokenSearch.js +12 -21
  315. package/hooks/useTokens.d.ts +1 -1
  316. package/hooks/useTokens.js +36 -38
  317. package/hooks/useTools.d.ts +2 -11
  318. package/hooks/useTools.js +12 -22
  319. package/i18n/en.json +8 -8
  320. package/i18n/uk.json +8 -8
  321. package/icons/LiFiFullLogo.js +1 -1
  322. package/icons/LiFiLogo.js +1 -1
  323. package/icons/LiFiToolLogo.js +1 -1
  324. package/index.d.ts +1 -0
  325. package/index.js +2 -0
  326. package/package.json +7 -7
  327. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
  328. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  329. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
  330. package/pages/MainPage/MainPage.js +1 -1
  331. package/pages/MainPage/MainPage.style.d.ts +1 -1
  332. package/pages/MainPage/MainSwapButton.js +3 -12
  333. package/pages/SelectChainPage/SelectChainPage.js +6 -14
  334. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
  335. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +47 -0
  336. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
  337. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +5 -0
  338. package/pages/SelectEnabledToolsPage/index.d.ts +1 -0
  339. package/pages/SelectEnabledToolsPage/index.js +1 -0
  340. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
  341. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  342. package/pages/SelectTokenPage/SearchTokenInput.js +4 -1
  343. package/pages/SelectTokenPage/SelectTokenPage.js +2 -3
  344. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  345. package/pages/SelectWalletPage/SelectWalletPage.js +13 -19
  346. package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
  347. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  348. package/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
  349. package/pages/SettingsPage/EnabledToolsButton.js +21 -0
  350. package/{cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts → pages/SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
  351. package/pages/SettingsPage/EnabledToolsButton.style.js +14 -0
  352. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  353. package/pages/SettingsPage/GasPriceSelect.js +1 -1
  354. package/pages/SettingsPage/LanguageSelect.js +5 -6
  355. package/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
  356. package/pages/SettingsPage/ResetSettingsButton.js +23 -0
  357. package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
  358. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  359. package/pages/SettingsPage/SettingsPage.js +3 -2
  360. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  361. package/pages/SettingsPage/ShowDestinationWallet.js +3 -3
  362. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  363. package/pages/SettingsPage/SlippageInput.js +3 -3
  364. package/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
  365. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
  366. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  367. package/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
  368. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  369. package/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
  370. package/pages/SwapPage/StartSwapButton.js +1 -1
  371. package/pages/SwapPage/StatusBottomSheet.js +21 -19
  372. package/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
  373. package/pages/SwapPage/SwapPage.js +9 -21
  374. package/pages/SwapPage/SwapPage.style.d.ts +1 -1
  375. package/pages/SwapPage/TokenValueBottomSheet.js +8 -9
  376. package/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
  377. package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
  378. package/providers/I18nProvider/I18nProvider.js +7 -8
  379. package/providers/SDKProvider/SDKProvider.js +15 -4
  380. package/providers/SwapFormProvider/SwapFormProvider.js +12 -6
  381. package/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
  382. package/providers/TelemetryProvider/TelemetryProvider.js +1 -1
  383. package/providers/ThemeProvider/ThemeProvider.js +2 -2
  384. package/providers/WalletProvider/WalletProvider.js +30 -39
  385. package/providers/WidgetProvider/WidgetProvider.js +22 -29
  386. package/providers/WidgetProvider/utils.js +2 -3
  387. package/stores/StoreProvider.js +2 -8
  388. package/stores/chains/index.d.ts +1 -2
  389. package/stores/chains/index.js +1 -2
  390. package/stores/chains/useChainOrder.js +1 -1
  391. package/stores/chains/useChainOrderStore.d.ts +3 -0
  392. package/stores/chains/{createChainOrderStore.js → useChainOrderStore.js} +2 -2
  393. package/stores/routes/RouteExecutionStore.js +2 -14
  394. package/stores/routes/createRouteExecutionStore.js +27 -16
  395. package/stores/routes/types.d.ts +1 -1
  396. package/stores/routes/useExecutingRoutesIds.js +2 -5
  397. package/stores/routes/useRecommendedRouteStore.d.ts +10 -2
  398. package/stores/routes/useRecommendedRouteStore.js +25 -1
  399. package/stores/routes/useSwapHistory.js +3 -6
  400. package/stores/routes/utils.js +4 -4
  401. package/stores/settings/index.d.ts +1 -1
  402. package/stores/settings/index.js +1 -1
  403. package/stores/settings/types.d.ts +6 -6
  404. package/stores/settings/useAppearance.js +1 -1
  405. package/stores/settings/useSettings.js +1 -1
  406. package/stores/settings/useSettingsStore.d.ts +6 -0
  407. package/stores/settings/{createSettingsStore.js → useSettingsStore.js} +46 -26
  408. package/tsconfig.cjs.tsbuildinfo +1 -1
  409. package/utils/colors.js +1 -1
  410. package/utils/format.js +3 -3
  411. package/utils/navigationRoutes.d.ts +2 -0
  412. package/utils/navigationRoutes.js +6 -0
  413. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
  414. package/cjs/pages/SettingsPage/AdvancedPreferences.js +0 -24
  415. package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
  416. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +0 -24
  417. package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
  418. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +0 -24
  419. package/cjs/stores/chains/ChainOrderStore.d.ts +0 -9
  420. package/cjs/stores/chains/ChainOrderStore.js +0 -44
  421. package/cjs/stores/chains/createChainOrderStore.d.ts +0 -4
  422. package/cjs/stores/settings/SettingsStore.d.ts +0 -11
  423. package/cjs/stores/settings/SettingsStore.js +0 -58
  424. package/cjs/stores/settings/createSettingsStore.d.ts +0 -5
  425. package/pages/SelectChainPage/SelectChainPage.style.js +0 -17
  426. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +0 -21
  427. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +0 -17
  428. package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +0 -21
  429. package/pages/SelectWalletPage/SelectWalletPage.style.js +0 -17
  430. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
  431. package/pages/SettingsPage/AdvancedPreferences.js +0 -20
  432. package/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
  433. package/pages/SettingsPage/EnabledBridgesSelect.js +0 -20
  434. package/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
  435. package/pages/SettingsPage/EnabledExchangesSelect.js +0 -20
  436. package/stores/chains/ChainOrderStore.d.ts +0 -9
  437. package/stores/chains/ChainOrderStore.js +0 -38
  438. package/stores/chains/createChainOrderStore.d.ts +0 -4
  439. package/stores/settings/SettingsStore.d.ts +0 -11
  440. package/stores/settings/SettingsStore.js +0 -51
  441. package/stores/settings/createSettingsStore.d.ts +0 -5
@@ -45,10 +45,12 @@ const shape = {
45
45
  borderRadiusSecondary: 8,
46
46
  };
47
47
  const createTheme = (mode, theme = {}) => {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
49
- const primaryMainColor = (_c = (_b = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main) !== null && _c !== void 0 ? _c : palette.primary.main;
50
- const primaryLightColor = (0, styles_1.lighten)((_f = (_e = (_d = theme.palette) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e.main) !== null && _f !== void 0 ? _f : palette.primary.main, 0.5);
51
- const primaryDarkColor = (0, styles_1.darken)((_j = (_h = (_g = theme.palette) === null || _g === void 0 ? void 0 : _g.primary) === null || _h === void 0 ? void 0 : _h.main) !== null && _j !== void 0 ? _j : palette.primary.main, 0.2);
48
+ const primaryMainColor = theme.palette?.primary?.main ??
49
+ palette.primary.main;
50
+ const primaryLightColor = (0, styles_1.lighten)(theme.palette?.primary?.main ??
51
+ palette.primary.main, 0.5);
52
+ const primaryDarkColor = (0, styles_1.darken)(theme.palette?.primary?.main ??
53
+ palette.primary.main, 0.2);
52
54
  const contrastButtonColor = (0, styles_1.getContrastRatio)(colors_1.common.white, primaryMainColor) >= 3
53
55
  ? colors_1.common.white
54
56
  : colors_1.common.black;
@@ -56,17 +58,33 @@ const createTheme = (mode, theme = {}) => {
56
58
  ? colors_1.common.white
57
59
  : colors_1.common.black;
58
60
  return (0, styles_1.createTheme)({
59
- typography: Object.assign({ fontFamily: 'Inter var, Inter, sans-serif' }, theme.typography),
60
- palette: Object.assign(Object.assign(Object.assign(Object.assign({ mode }, palette), (mode === 'light' ? paletteLight : paletteDark)), theme.palette), { primary: {
61
+ typography: {
62
+ fontFamily: 'Inter var, Inter, sans-serif',
63
+ ...theme.typography,
64
+ },
65
+ palette: {
66
+ mode,
67
+ ...palette,
68
+ ...(mode === 'light' ? paletteLight : paletteDark),
69
+ ...theme.palette,
70
+ primary: {
61
71
  main: primaryMainColor,
62
72
  light: primaryLightColor,
63
73
  dark: primaryDarkColor,
64
- }, secondary: {
65
- main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
66
- light: (0, styles_1.lighten)((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
67
- dark: (0, styles_1.darken)((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
68
- } }),
69
- shape: Object.assign(Object.assign({}, shape), theme.shape),
74
+ },
75
+ secondary: {
76
+ main: theme.palette?.secondary?.main ??
77
+ palette.secondary.main,
78
+ light: (0, styles_1.lighten)(theme.palette?.secondary?.main ??
79
+ palette.secondary.main, 0.5),
80
+ dark: (0, styles_1.darken)(theme.palette?.secondary?.main ??
81
+ palette.secondary.main, 0.2),
82
+ },
83
+ },
84
+ shape: {
85
+ ...shape,
86
+ ...theme.shape,
87
+ },
70
88
  breakpoints: {
71
89
  values: {
72
90
  xs: 0,
@@ -79,7 +97,14 @@ const createTheme = (mode, theme = {}) => {
79
97
  components: {
80
98
  MuiScopedCssBaseline: {
81
99
  styleOverrides: {
82
- root: Object.assign(Object.assign({ fontFamily: 'Inter, sans-serif' }, theme.typography), { '@supports (font-variation-settings: normal)': Object.assign({ fontFamily: 'Inter var, sans-serif' }, theme.typography) }),
100
+ root: {
101
+ fontFamily: 'Inter, sans-serif',
102
+ ...theme.typography,
103
+ '@supports (font-variation-settings: normal)': {
104
+ fontFamily: 'Inter var, sans-serif',
105
+ ...theme.typography,
106
+ },
107
+ },
83
108
  },
84
109
  },
85
110
  MuiButton: {
@@ -88,7 +113,7 @@ const createTheme = (mode, theme = {}) => {
88
113
  },
89
114
  styleOverrides: {
90
115
  root: {
91
- borderRadius: (_v = (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary) !== null && _v !== void 0 ? _v : shape.borderRadiusSecondary,
116
+ borderRadius: theme.shape?.borderRadiusSecondary ?? shape.borderRadiusSecondary,
92
117
  textTransform: 'none',
93
118
  fontSize: '1rem',
94
119
  [`&.Mui-disabled, &.Mui-disabled:hover`]: {
@@ -145,12 +170,15 @@ const createTheme = (mode, theme = {}) => {
145
170
  },
146
171
  },
147
172
  },
148
- MuiAvatar: Object.assign({ styleOverrides: {
173
+ MuiAvatar: {
174
+ styleOverrides: {
149
175
  root: {
150
176
  height: 32,
151
177
  width: 32,
152
178
  },
153
- } }, (_w = theme.components) === null || _w === void 0 ? void 0 : _w.MuiAvatar),
179
+ },
180
+ ...theme.components?.MuiAvatar,
181
+ },
154
182
  MuiListItemAvatar: {
155
183
  styleOverrides: {
156
184
  root: {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.31.1";
2
+ export declare const version = "1.32.1";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '1.31.1';
5
+ exports.version = '1.32.1';
@@ -6,7 +6,7 @@ const useChains_1 = require("./useChains");
6
6
  const useChain = (chainId) => {
7
7
  const { chains, isLoading } = (0, useChains_1.useChains)();
8
8
  const chain = (0, react_1.useMemo)(() => {
9
- const chain = chains === null || chains === void 0 ? void 0 : chains.find((chain) => chain.id === chainId);
9
+ const chain = chains?.find((chain) => chain.id === chainId);
10
10
  return chain;
11
11
  }, [chainId, chains]);
12
12
  return {
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.useChains = void 0;
13
4
  const react_query_1 = require("@tanstack/react-query");
@@ -20,8 +11,8 @@ const useChains = () => {
20
11
  const lifi = (0, providers_1.useLiFi)();
21
12
  const { getValues, setValue } = (0, react_hook_form_1.useFormContext)();
22
13
  const initializeChains = (0, stores_1.useChainOrderStore)((state) => state.initializeChains);
23
- const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
24
- const availableChains = yield lifi.getChains();
14
+ const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], async () => {
15
+ const availableChains = await lifi.getChains();
25
16
  const filteredChains = availableChains.filter((chain) => (0, providers_1.isItemAllowed)(chain.id, chains, disabledChains));
26
17
  const chainOrder = initializeChains(filteredChains.map((chain) => chain.id));
27
18
  const [fromChainValue, toChainValue] = getValues([
@@ -35,17 +26,17 @@ const useChains = () => {
35
26
  setValue(providers_1.SwapFormKey.ToChain, chainOrder[0]);
36
27
  }
37
28
  return { availableChains, filteredChains };
38
- }), {
29
+ }, {
39
30
  refetchInterval: 180000,
40
31
  staleTime: 180000,
41
32
  });
42
33
  const getChainById = (0, react_1.useCallback)((chainId) => {
43
- const chain = data === null || data === void 0 ? void 0 : data.availableChains.find((chain) => chain.id === chainId);
34
+ const chain = data?.availableChains.find((chain) => chain.id === chainId);
44
35
  // if (!chain) {
45
36
  // throw new Error('Chain not found or chainId is invalid.');
46
37
  // }
47
38
  return chain;
48
39
  }, [data]);
49
- return { chains: data === null || data === void 0 ? void 0 : data.filteredChains, getChainById, isLoading };
40
+ return { chains: data?.filteredChains, getChainById, isLoading };
50
41
  };
51
42
  exports.useChains = useChains;
@@ -31,11 +31,10 @@ exports.useContentHeight = useContentHeight;
31
31
  const useSetContentHeight = (ref) => {
32
32
  const elementId = (0, useDefaultElementId_1.useDefaultElementId)();
33
33
  (0, react_1.useLayoutEffect)(() => {
34
- var _a;
35
34
  const scrollableContainer = (0, useScrollableContainer_1.getScrollableContainer)(elementId);
36
35
  if (!scrollableContainer ||
37
36
  !ref.current ||
38
- ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.clientHeight) <= (scrollableContainer === null || scrollableContainer === void 0 ? void 0 : scrollableContainer.clientHeight)) {
37
+ ref.current?.clientHeight <= scrollableContainer?.clientHeight) {
39
38
  return;
40
39
  }
41
40
  scrollableContainer.style.height = `${ref.current.clientHeight}px`;
@@ -5,9 +5,6 @@ const react_1 = require("react");
5
5
  const providers_1 = require("../providers");
6
6
  const useFeaturedTokens = (selectedChainId) => {
7
7
  const { featuredTokens, tokens } = (0, providers_1.useWidgetConfig)();
8
- return (0, react_1.useMemo)(() => {
9
- var _a;
10
- return [...((_a = tokens === null || tokens === void 0 ? void 0 : tokens.featured) !== null && _a !== void 0 ? _a : []), ...(featuredTokens !== null && featuredTokens !== void 0 ? featuredTokens : [])].filter((token) => token.chainId === selectedChainId);
11
- }, [featuredTokens, selectedChainId, tokens === null || tokens === void 0 ? void 0 : tokens.featured]);
8
+ return (0, react_1.useMemo)(() => [...(tokens?.featured ?? []), ...(featuredTokens ?? [])].filter((token) => token.chainId === selectedChainId), [featuredTokens, selectedChainId, tokens?.featured]);
12
9
  };
13
10
  exports.useFeaturedTokens = useFeaturedTokens;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.useGasSufficiency = void 0;
13
4
  const react_query_1 = require("@tanstack/react-query");
@@ -20,9 +11,8 @@ const refetchInterval = 30000;
20
11
  const useGasSufficiency = (route) => {
21
12
  const { account } = (0, providers_1.useWallet)();
22
13
  const { getChainById } = (0, _1.useChains)();
23
- const { token: fromToken, getTokenBalancesWithRetry } = (0, useTokenBalance_1.useTokenBalance)(route === null || route === void 0 ? void 0 : route.fromToken);
24
- const { data: insufficientGas, isInitialLoading: insufficientGasLoading } = (0, react_query_1.useQuery)(['gas-sufficiency-check', account.address, route === null || route === void 0 ? void 0 : route.id], () => __awaiter(void 0, void 0, void 0, function* () {
25
- var _a, _b;
14
+ const { token: fromToken, getTokenBalancesWithRetry } = (0, useTokenBalance_1.useTokenBalance)(route?.fromToken);
15
+ const { data: insufficientGas, isInitialLoading: insufficientGasLoading } = (0, react_query_1.useQuery)(['gas-sufficiency-check', account.address, route?.id], async () => {
26
16
  if (!account.address || !route) {
27
17
  return null;
28
18
  }
@@ -33,7 +23,7 @@ const useGasSufficiency = (route) => {
33
23
  const { token } = step.estimate.gasCosts[0];
34
24
  const gasCostAmount = step.estimate.gasCosts
35
25
  .reduce((amount, gasCost) => amount.plus((0, big_js_1.default)(gasCost.amount || 0)), (0, big_js_1.default)(0))
36
- .div(Math.pow(10, token.decimals));
26
+ .div(10 ** token.decimals);
37
27
  const groupedGasCost = groupedGasCosts[token.chainId];
38
28
  const gasAmount = groupedGasCost
39
29
  ? groupedGasCost.gasAmount.plus(gasCostAmount)
@@ -47,59 +37,63 @@ const useGasSufficiency = (route) => {
47
37
  }
48
38
  return groupedGasCosts;
49
39
  }, {});
50
- if (route.fromToken.address === ((_a = gasCosts[route.fromChainId]) === null || _a === void 0 ? void 0 : _a.token.address)) {
51
- gasCosts[route.fromChainId].tokenAmount = (_b = gasCosts[route.fromChainId]) === null || _b === void 0 ? void 0 : _b.gasAmount.plus((0, big_js_1.default)(route.fromAmount).div(Math.pow(10, route.fromToken.decimals)));
40
+ if (route.fromToken.address === gasCosts[route.fromChainId]?.token.address) {
41
+ gasCosts[route.fromChainId].tokenAmount = gasCosts[route.fromChainId]?.gasAmount.plus((0, big_js_1.default)(route.fromAmount).div(10 ** route.fromToken.decimals));
52
42
  }
53
- const tokenBalances = yield getTokenBalancesWithRetry(account.address, Object.values(gasCosts).map((item) => item.token));
54
- if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
43
+ const tokenBalances = await getTokenBalancesWithRetry(account.address, Object.values(gasCosts).map((item) => item.token));
44
+ if (!tokenBalances?.length) {
55
45
  return null;
56
46
  }
57
47
  [route.fromChainId, route.toChainId].forEach((chainId) => {
58
- var _a, _b, _c, _d, _e, _f;
59
48
  if (gasCosts[chainId]) {
60
- const gasTokenBalance = (0, big_js_1.default)((_b = (_a = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find((t) => t.chainId === gasCosts[chainId].token.chainId &&
61
- t.address === gasCosts[chainId].token.address)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
49
+ const gasTokenBalance = (0, big_js_1.default)(tokenBalances?.find((t) => t.chainId === gasCosts[chainId].token.chainId &&
50
+ t.address === gasCosts[chainId].token.address)?.amount ?? 0);
62
51
  const insufficient = gasTokenBalance.lte(0) ||
63
- gasTokenBalance.lt((_c = gasCosts[chainId].gasAmount) !== null && _c !== void 0 ? _c : (0, big_js_1.default)(0)) ||
64
- gasTokenBalance.lt((_d = gasCosts[chainId].tokenAmount) !== null && _d !== void 0 ? _d : (0, big_js_1.default)(0));
52
+ gasTokenBalance.lt(gasCosts[chainId].gasAmount ?? (0, big_js_1.default)(0)) ||
53
+ gasTokenBalance.lt(gasCosts[chainId].tokenAmount ?? (0, big_js_1.default)(0));
65
54
  const insufficientAmount = insufficient
66
- ? (_f = (_e = gasCosts[chainId].tokenAmount) === null || _e === void 0 ? void 0 : _e.minus(gasTokenBalance)) !== null && _f !== void 0 ? _f : gasCosts[chainId].gasAmount.minus(gasTokenBalance)
55
+ ? gasCosts[chainId].tokenAmount?.minus(gasTokenBalance) ??
56
+ gasCosts[chainId].gasAmount.minus(gasTokenBalance)
67
57
  : undefined;
68
- gasCosts[chainId] = Object.assign(Object.assign({}, gasCosts[chainId]), { insufficient, insufficientAmount: insufficientAmount === null || insufficientAmount === void 0 ? void 0 : insufficientAmount.round(5, big_js_1.default.roundUp), chain: insufficient ? getChainById(chainId) : undefined });
58
+ gasCosts[chainId] = {
59
+ ...gasCosts[chainId],
60
+ insufficient,
61
+ insufficientAmount: insufficientAmount?.round(5, big_js_1.default.roundUp),
62
+ chain: insufficient ? getChainById(chainId) : undefined,
63
+ };
69
64
  }
70
65
  });
71
66
  const gasCostResult = Object.values(gasCosts).filter((gasCost) => gasCost.insufficient);
72
67
  return gasCostResult;
73
- }), {
68
+ }, {
74
69
  enabled: Boolean(account.address && route),
75
70
  refetchInterval,
76
71
  staleTime: refetchInterval,
77
72
  cacheTime: refetchInterval,
78
73
  });
79
- const { data: insufficientFunds, isInitialLoading: insufficientFundsLoading, } = (0, react_query_1.useQuery)(['funds-sufficiency-check', account.address, route === null || route === void 0 ? void 0 : route.id], () => __awaiter(void 0, void 0, void 0, function* () {
80
- var _c, _d, _e, _f;
74
+ const { data: insufficientFunds, isInitialLoading: insufficientFundsLoading, } = (0, react_query_1.useQuery)(['funds-sufficiency-check', account.address, route?.id], async () => {
81
75
  if (!account.address || !fromToken || !route || (0, stores_1.isRouteDone)(route)) {
82
76
  return null;
83
77
  }
84
- let currentTokenBalance = (0, big_js_1.default)((_c = fromToken === null || fromToken === void 0 ? void 0 : fromToken.amount) !== null && _c !== void 0 ? _c : 0);
85
- const currentAction = (_d = route.steps.filter((step) => !step.execution || step.execution.status !== 'DONE')[0]) === null || _d === void 0 ? void 0 : _d.action;
78
+ let currentTokenBalance = (0, big_js_1.default)(fromToken?.amount ?? 0);
79
+ const currentAction = route.steps.filter((step) => !step.execution || step.execution.status !== 'DONE')[0]?.action;
86
80
  if (fromToken.chainId === currentAction.fromToken.chainId &&
87
81
  fromToken.address === currentAction.fromToken.address &&
88
82
  currentTokenBalance.gt(0)) {
89
83
  const insufficientFunds = (0, big_js_1.default)(route.fromAmount)
90
- .div(Math.pow(10, route.fromToken.decimals))
84
+ .div(10 ** route.fromToken.decimals)
91
85
  .gt(currentTokenBalance);
92
86
  return insufficientFunds;
93
87
  }
94
- const tokenBalances = yield getTokenBalancesWithRetry(account.address, [
88
+ const tokenBalances = await getTokenBalancesWithRetry(account.address, [
95
89
  currentAction.fromToken,
96
90
  ]);
97
- currentTokenBalance = (0, big_js_1.default)((_f = (_e = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances[0]) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0);
91
+ currentTokenBalance = (0, big_js_1.default)(tokenBalances?.[0]?.amount ?? 0);
98
92
  const insufficientFunds = (0, big_js_1.default)(currentAction.fromAmount)
99
- .div(Math.pow(10, currentAction.fromToken.decimals))
93
+ .div(10 ** currentAction.fromToken.decimals)
100
94
  .gt(currentTokenBalance);
101
95
  return insufficientFunds;
102
- }), {
96
+ }, {
103
97
  enabled: Boolean(account.address && route && fromToken),
104
98
  refetchInterval,
105
99
  staleTime: refetchInterval,
@@ -69,16 +69,12 @@ const processSubstatusMessages = {
69
69
  NOT_FOUND: {},
70
70
  };
71
71
  function getProcessMessage(t, getChainById, step, process) {
72
- var _a, _b, _c, _d, _e, _f, _g;
73
72
  if (process.error && process.status === 'FAILED') {
74
- const getTransactionNotSentMessage = () => {
75
- var _a, _b;
76
- return t(`swap.error.message.transactionNotSent`, {
77
- amount: (0, utils_1.formatTokenAmount)(step.action.fromAmount, step.action.fromToken.decimals),
78
- tokenSymbol: step.action.fromToken.symbol,
79
- chainName: (_b = (_a = getChainById(step.action.fromChainId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
80
- });
81
- };
73
+ const getTransactionNotSentMessage = () => t(`swap.error.message.transactionNotSent`, {
74
+ amount: (0, utils_1.formatTokenAmount)(step.action.fromAmount, step.action.fromToken.decimals),
75
+ tokenSymbol: step.action.fromToken.symbol,
76
+ chainName: getChainById(step.action.fromChainId)?.name ?? '',
77
+ });
82
78
  let title = '';
83
79
  let message = '';
84
80
  switch (process.error.code) {
@@ -119,7 +115,7 @@ function getProcessMessage(t, getChainById, step, process) {
119
115
  message = t(`swap.error.message.transactionRejected`, {
120
116
  amount: (0, utils_1.formatTokenAmount)(step.action.fromAmount, step.action.fromToken.decimals),
121
117
  tokenSymbol: step.action.fromToken.symbol,
122
- chainName: (_b = (_a = getChainById(step.action.fromChainId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
118
+ chainName: getChainById(step.action.fromChainId)?.name ?? '',
123
119
  });
124
120
  break;
125
121
  case sdk_1.LifiErrorCode.ProviderUnavailable:
@@ -135,7 +131,7 @@ function getProcessMessage(t, getChainById, step, process) {
135
131
  }
136
132
  return { title, message };
137
133
  }
138
- const title = (_e = (_d = (_c = processSubstatusMessages[process.status]) === null || _c === void 0 ? void 0 : _c[process.substatus]) === null || _d === void 0 ? void 0 : _d.call(_c, t)) !== null && _e !== void 0 ? _e : (_g = (_f = processStatusMessages[process.type]) === null || _f === void 0 ? void 0 : _f[process.status]) === null || _g === void 0 ? void 0 : _g.call(_f, t);
134
+ const title = processSubstatusMessages[process.status]?.[process.substatus]?.(t) ?? processStatusMessages[process.type]?.[process.status]?.(t);
139
135
  return { title };
140
136
  }
141
137
  exports.getProcessMessage = getProcessMessage;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.useRouteExecution = void 0;
13
4
  const react_query_1 = require("@tanstack/react-query");
@@ -51,31 +42,31 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
51
42
  }
52
43
  console.log('Route updated.', clonedUpdatedRoute);
53
44
  };
54
- const switchChainHook = (requiredChainId) => __awaiter(void 0, void 0, void 0, function* () {
45
+ const switchChainHook = async (requiredChainId) => {
55
46
  if (!account.isActive || !account.signer) {
56
47
  return account.signer;
57
48
  }
58
- const currentChainId = yield account.signer.getChainId();
49
+ const currentChainId = await account.signer.getChainId();
59
50
  if (currentChainId !== requiredChainId) {
60
- const switched = yield switchChain(requiredChainId);
51
+ const switched = await switchChain(requiredChainId);
61
52
  if (!switched) {
62
53
  throw new Error('Chain was not switched.');
63
54
  }
64
55
  }
65
56
  return account.signer;
66
- });
67
- const acceptExchangeRateUpdateHook = (params) => __awaiter(void 0, void 0, void 0, function* () {
57
+ };
58
+ const acceptExchangeRateUpdateHook = async (params) => {
68
59
  if (!onAcceptExchangeRateUpdate) {
69
60
  return false;
70
61
  }
71
- const accepted = yield new Promise((resolve) => onAcceptExchangeRateUpdate(resolve, params));
62
+ const accepted = await new Promise((resolve) => onAcceptExchangeRateUpdate(resolve, params));
72
63
  return accepted;
73
- });
64
+ };
74
65
  const executeRouteMutation = (0, react_query_1.useMutation)(() => {
75
66
  if (!account.signer) {
76
67
  throw Error('Account signer not found.');
77
68
  }
78
- if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
69
+ if (!routeExecution?.route) {
79
70
  throw Error('Execution route not found.');
80
71
  }
81
72
  queryClient.removeQueries(['routes']);
@@ -98,10 +89,10 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
98
89
  if (!account.signer) {
99
90
  throw Error('Account signer not found.');
100
91
  }
101
- if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
92
+ if (!routeExecution?.route) {
102
93
  throw Error('Execution route not found.');
103
94
  }
104
- return lifi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
95
+ return lifi.resumeRoute(account.signer, resumedRoute ?? routeExecution.route, {
105
96
  updateCallback,
106
97
  switchChainHook,
107
98
  acceptExchangeRateUpdateHook,
@@ -137,9 +128,9 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
137
128
  }, [resumeRouteMutation, routeId]);
138
129
  const restartRouteMutation = (0, react_1.useCallback)(() => {
139
130
  restartRoute(routeId);
140
- resumeRoute(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route);
131
+ resumeRoute(routeExecution?.route);
141
132
  // eslint-disable-next-line react-hooks/exhaustive-deps
142
- }, [resumeRoute, routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route, routeId]);
133
+ }, [resumeRoute, routeExecution?.route, routeId]);
143
134
  const deleteRouteMutation = (0, react_1.useCallback)(() => {
144
135
  deleteRoute(routeId);
145
136
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -147,7 +138,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
147
138
  // Resume route execution after page reload
148
139
  (0, react_1.useEffect)(() => {
149
140
  // Check if route is eligible for automatic resuming
150
- if ((0, stores_1.isRouteActive)(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route) &&
141
+ if ((0, stores_1.isRouteActive)(routeExecution?.route) &&
151
142
  account.isActive &&
152
143
  !resumedAfterMount.current) {
153
144
  resumedAfterMount.current = true;
@@ -157,8 +148,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
157
148
  }, [account.isActive]);
158
149
  (0, react_1.useEffect)(() => {
159
150
  return () => {
160
- var _a;
161
- const route = (_a = routeExecutionStoreContext.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
151
+ const route = routeExecutionStoreContext.getState().routes[routeId]?.route;
162
152
  if (!route || !(0, stores_1.isRouteActive)(route)) {
163
153
  return;
164
154
  }
@@ -171,8 +161,8 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
171
161
  executeRoute,
172
162
  restartRoute: restartRouteMutation,
173
163
  deleteRoute: deleteRouteMutation,
174
- route: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route,
175
- status: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.status,
164
+ route: routeExecution?.route,
165
+ status: routeExecution?.status,
176
166
  };
177
167
  };
178
168
  exports.useRouteExecution = useRouteExecution;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.useSwapRoutes = void 0;
13
4
  const address_1 = require("@ethersproject/address");
@@ -21,7 +12,6 @@ const providers_1 = require("../providers");
21
12
  const stores_1 = require("../stores");
22
13
  const refetchTime = 60000;
23
14
  const useSwapRoutes = () => {
24
- var _a, _b;
25
15
  const lifi = (0, providers_1.useLiFi)();
26
16
  const { variant, sdkConfig } = (0, providers_1.useWidgetConfig)();
27
17
  const { account, provider } = (0, providers_1.useWallet)();
@@ -55,8 +45,8 @@ const useSwapRoutes = () => {
55
45
  : true;
56
46
  const isEnabled = !isNaN(fromChainId) &&
57
47
  !isNaN(toChainId) &&
58
- Boolean(fromToken === null || fromToken === void 0 ? void 0 : fromToken.address) &&
59
- Boolean(toToken === null || toToken === void 0 ? void 0 : toToken.address) &&
48
+ Boolean(fromToken?.address) &&
49
+ Boolean(toToken?.address) &&
60
50
  !Number.isNaN(slippage) &&
61
51
  hasAmount &&
62
52
  contractCallQuoteEnabled;
@@ -64,11 +54,11 @@ const useSwapRoutes = () => {
64
54
  'routes',
65
55
  account.address,
66
56
  fromChainId,
67
- fromToken === null || fromToken === void 0 ? void 0 : fromToken.address,
57
+ fromToken?.address,
68
58
  fromTokenAmount,
69
59
  toAddress,
70
60
  toChainId,
71
- toToken === null || toToken === void 0 ? void 0 : toToken.address,
61
+ toToken?.address,
72
62
  toTokenAmount,
73
63
  toContractAddress,
74
64
  toContractCallData,
@@ -78,28 +68,28 @@ const useSwapRoutes = () => {
78
68
  enabledExchanges,
79
69
  routePriority,
80
70
  variant,
81
- (_a = sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.defaultRouteOptions) === null || _a === void 0 ? void 0 : _a.allowSwitchChain,
71
+ sdkConfig?.defaultRouteOptions?.allowSwitchChain,
82
72
  ];
83
- const previousDataUpdatedAt = (_b = queryClient.getQueryState(queryKey)) === null || _b === void 0 ? void 0 : _b.dataUpdatedAt;
73
+ const previousDataUpdatedAt = queryClient.getQueryState(queryKey)?.dataUpdatedAt;
84
74
  const refetchInterval = previousDataUpdatedAt
85
75
  ? Math.min(Math.abs(refetchTime - (Date.now() - previousDataUpdatedAt)), refetchTime)
86
76
  : refetchTime;
87
- const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = (0, react_query_1.useQuery)(queryKey, ({ queryKey: [_, fromAddress, fromChainId, fromTokenAddress, fromTokenAmount, toAddress, toChainId, toTokenAddress, toTokenAmount, toContractAddress, toContractCallData, toContractGasLimit, slippage, enabledBridges, enabledExchanges, routePriority, variant, allowSwitchChain,], signal, }) => __awaiter(void 0, void 0, void 0, function* () {
88
- var _c, _d, _e;
77
+ const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = (0, react_query_1.useQuery)(queryKey, async ({ queryKey: [_, fromAddress, fromChainId, fromTokenAddress, fromTokenAmount, toAddress, toChainId, toTokenAddress, toTokenAmount, toContractAddress, toContractCallData, toContractGasLimit, slippage, enabledBridges, enabledExchanges, routePriority, variant, allowSwitchChain,], signal, }) => {
89
78
  let toWalletAddress;
90
79
  try {
91
80
  toWalletAddress =
92
- (_c = (yield (provider === null || provider === void 0 ? void 0 : provider.resolveName(toAddress)))) !== null && _c !== void 0 ? _c : ((0, address_1.isAddress)(toAddress) ? toAddress : fromAddress);
81
+ (await provider?.resolveName(toAddress)) ??
82
+ ((0, address_1.isAddress)(toAddress) ? toAddress : fromAddress);
93
83
  }
94
- catch (_f) {
84
+ catch {
95
85
  toWalletAddress = (0, address_1.isAddress)(toAddress) ? toAddress : fromAddress;
96
86
  }
97
87
  const fromAmount = (0, big_js_1.default)(fromTokenAmount || 0)
98
- .mul(Math.pow(10, ((_d = fromToken === null || fromToken === void 0 ? void 0 : fromToken.decimals) !== null && _d !== void 0 ? _d : 0)))
88
+ .mul(10 ** (fromToken?.decimals ?? 0))
99
89
  .toFixed(0);
100
90
  const formattedSlippage = parseFloat(slippage) / 100;
101
91
  if (variant === 'nft') {
102
- const contractCallQuote = yield lifi.getContractCallQuote({
92
+ const contractCallQuote = await lifi.getContractCallQuote({
103
93
  fromAddress,
104
94
  fromChain: fromChainId,
105
95
  fromToken: fromTokenAddress,
@@ -128,7 +118,7 @@ const useSwapRoutes = () => {
128
118
  toAmountMin: toTokenAmount,
129
119
  toToken: toToken,
130
120
  toAddress: toAddress,
131
- gasCostUSD: (_e = contractCallQuote.estimate.gasCosts) === null || _e === void 0 ? void 0 : _e[0].amountUSD,
121
+ gasCostUSD: contractCallQuote.estimate.gasCosts?.[0].amountUSD,
132
122
  steps: [contractCallQuote],
133
123
  };
134
124
  return { routes: [route] };
@@ -153,20 +143,20 @@ const useSwapRoutes = () => {
153
143
  allowSwitchChain: variant === 'refuel' ? false : allowSwitchChain,
154
144
  },
155
145
  }, { signal });
156
- }), {
146
+ }, {
157
147
  enabled: isEnabled,
158
148
  refetchInterval,
159
149
  staleTime: refetchTime,
160
150
  cacheTime: refetchTime,
161
151
  retry(failureCount, error) {
162
- if ((error === null || error === void 0 ? void 0 : error.code) === sdk_1.LifiErrorCode.NotFound) {
152
+ if (error?.code === sdk_1.LifiErrorCode.NotFound) {
163
153
  return false;
164
154
  }
165
155
  return true;
166
156
  },
167
157
  });
168
158
  return {
169
- routes: data === null || data === void 0 ? void 0 : data.routes,
159
+ routes: data?.routes,
170
160
  isLoading: isEnabled && isLoading,
171
161
  isFetching,
172
162
  isFetched,
@@ -7,13 +7,13 @@ const useTokenSearch_1 = require("./useTokenSearch");
7
7
  const useToken = (chainId, tokenAddress) => {
8
8
  const { tokens, isLoading } = (0, useTokens_1.useTokens)(chainId);
9
9
  const token = (0, react_1.useMemo)(() => {
10
- const token = tokens === null || tokens === void 0 ? void 0 : tokens.find((token) => token.address === tokenAddress && token.chainId === chainId);
10
+ const token = tokens?.find((token) => token.address === tokenAddress && token.chainId === chainId);
11
11
  return token;
12
12
  }, [chainId, tokenAddress, tokens]);
13
13
  const tokenSearchEnabled = !isLoading && !token;
14
14
  const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, useTokenSearch_1.useTokenSearch)(chainId, tokenAddress, tokenSearchEnabled);
15
15
  return {
16
- token: token !== null && token !== void 0 ? token : searchedToken,
16
+ token: token ?? searchedToken,
17
17
  isLoading: isLoading || (tokenSearchEnabled && isSearchedTokenLoading),
18
18
  };
19
19
  };
@@ -6,8 +6,7 @@ const useTokenBalances_1 = require("./useTokenBalances");
6
6
  const useTokenAddressBalance = (chainId, tokenAddress) => {
7
7
  const { tokens, tokensWithBalance, isBalanceLoading, refetch } = (0, useTokenBalances_1.useTokenBalances)(chainId);
8
8
  const token = (0, react_1.useMemo)(() => {
9
- var _a;
10
- const token = (_a = (tokensWithBalance !== null && tokensWithBalance !== void 0 ? tokensWithBalance : tokens)) === null || _a === void 0 ? void 0 : _a.find((token) => token.address === tokenAddress && token.chainId === chainId);
9
+ const token = (tokensWithBalance ?? tokens)?.find((token) => token.address === tokenAddress && token.chainId === chainId);
11
10
  return token;
12
11
  }, [chainId, tokenAddress, tokens, tokensWithBalance]);
13
12
  return {