@lifi/widget 1.32.7 → 2.0.0-alpha.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 (309) hide show
  1. package/App.js +3 -3
  2. package/AppDrawer.js +4 -3
  3. package/AppDrawer.style.d.ts +5 -5
  4. package/cjs/App.js +3 -3
  5. package/cjs/AppDrawer.js +4 -3
  6. package/cjs/AppDrawer.style.d.ts +5 -5
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  8. package/cjs/components/Card/CardIconButton.d.ts +29 -0
  9. package/cjs/components/Card/CardIconButton.js +17 -0
  10. package/cjs/components/Card/CardLabel.d.ts +26 -0
  11. package/cjs/components/Card/CardLabel.js +45 -0
  12. package/cjs/components/Card/CardTitle.d.ts +2 -2
  13. package/cjs/components/Card/index.d.ts +2 -0
  14. package/cjs/components/Card/index.js +2 -0
  15. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  16. package/cjs/components/GasMessage/FundsSufficiencyMessage.js +16 -0
  17. package/cjs/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  18. package/cjs/components/GasMessage/GasMessage.js +19 -0
  19. package/cjs/components/GasMessage/GasMessage.style.d.ts +34 -0
  20. package/cjs/components/GasMessage/GasMessage.style.js +48 -0
  21. package/cjs/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  22. package/cjs/components/GasMessage/GasRefuelMessage.js +26 -0
  23. package/cjs/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  24. package/cjs/components/GasMessage/GasSufficiencyMessage.js +21 -0
  25. package/cjs/components/GasMessage/index.d.ts +2 -0
  26. package/cjs/components/GasMessage/index.js +18 -0
  27. package/cjs/components/Header/Header.style.d.ts +5 -5
  28. package/cjs/components/Header/NavigationHeader.js +4 -4
  29. package/cjs/components/Header/WalletHeader.js +5 -5
  30. package/cjs/components/Insurance/Insurance.d.ts +3 -0
  31. package/cjs/components/Insurance/Insurance.js +11 -0
  32. package/cjs/components/Insurance/InsuranceCard.d.ts +3 -0
  33. package/cjs/components/Insurance/InsuranceCard.js +20 -0
  34. package/cjs/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  35. package/cjs/components/Insurance/InsuranceCollapsed.js +32 -0
  36. package/cjs/components/Insurance/index.d.ts +1 -0
  37. package/cjs/components/{GasSufficiencyMessage → Insurance}/index.js +1 -1
  38. package/cjs/components/Insurance/types.d.ts +14 -0
  39. package/cjs/components/Insurance/types.js +2 -0
  40. package/cjs/components/NFT/NFT.style.d.ts +1 -1
  41. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  42. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  43. package/cjs/components/SendToWallet/SendToWallet.js +31 -25
  44. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  45. package/cjs/components/SendToWallet/SendToWalletButton.js +3 -3
  46. package/cjs/components/SmallAvatar.d.ts +2 -2
  47. package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
  48. package/cjs/components/Step/DestinationWalletAddress.js +2 -2
  49. package/cjs/components/Step/GasStepProcess.js +2 -2
  50. package/cjs/components/Step/Step.js +7 -5
  51. package/cjs/components/Step/StepList.d.ts +1 -1
  52. package/cjs/components/Step/StepProcess.style.d.ts +3 -3
  53. package/cjs/components/StepActions/StepActions.d.ts +5 -0
  54. package/cjs/components/StepActions/StepActions.js +55 -17
  55. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  56. package/cjs/components/SwapButton/SwapButton.js +2 -2
  57. package/cjs/components/SwapButton/types.d.ts +1 -2
  58. package/cjs/components/SwapInput/SwapInput.style.d.ts +2 -2
  59. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  60. package/cjs/components/SwapInput/SwapInputEndAdornment.js +18 -1
  61. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  62. package/cjs/components/SwapRouteCard/SwapRouteCard.js +10 -26
  63. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  64. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  65. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  66. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +27 -0
  67. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  68. package/cjs/components/SwapRouteCard/types.d.ts +2 -2
  69. package/cjs/components/SwapRouteCard/utils.d.ts +5 -0
  70. package/cjs/components/SwapRouteCard/utils.js +32 -2
  71. package/cjs/components/SwapRoutes/SwapRoutes.js +3 -12
  72. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -5
  73. package/cjs/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  74. package/cjs/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  75. package/cjs/components/Switch.js +4 -4
  76. package/cjs/components/TextFitter/TextFitter.js +9 -3
  77. package/cjs/components/Token/Token.style.d.ts +2 -2
  78. package/cjs/config/theme.js +1 -1
  79. package/cjs/config/version.d.ts +1 -1
  80. package/cjs/config/version.js +1 -1
  81. package/cjs/hooks/index.d.ts +4 -0
  82. package/cjs/hooks/index.js +4 -0
  83. package/cjs/hooks/useChains.js +2 -2
  84. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  85. package/cjs/hooks/useFeaturedTokens.js +2 -2
  86. package/cjs/hooks/useFundsSufficiency.d.ts +5 -0
  87. package/cjs/hooks/useFundsSufficiency.js +73 -0
  88. package/cjs/hooks/useGasRecommendation.d.ts +2 -0
  89. package/cjs/hooks/useGasRecommendation.js +23 -0
  90. package/cjs/hooks/useGasRefuel.d.ts +7 -0
  91. package/cjs/hooks/useGasRefuel.js +61 -0
  92. package/cjs/hooks/useGasSufficiency.d.ts +2 -3
  93. package/cjs/hooks/useGasSufficiency.js +6 -37
  94. package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  95. package/cjs/hooks/useGetTokenBalancesWithRetry.js +33 -0
  96. package/cjs/hooks/useSwapRoutes.d.ts +7 -2
  97. package/cjs/hooks/useSwapRoutes.js +31 -11
  98. package/cjs/hooks/useTokenAddressBalance.js +4 -2
  99. package/cjs/hooks/useTokenBalance.js +4 -22
  100. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  101. package/cjs/hooks/useTokenSearch.js +2 -2
  102. package/cjs/hooks/useTokens.js +2 -3
  103. package/cjs/i18n/en.json +14 -7
  104. package/cjs/i18n/it.json +6 -2
  105. package/cjs/i18n/pt.json +234 -0
  106. package/cjs/i18n/uk.json +5 -1
  107. package/cjs/icons/InsuraceLogo.d.ts +2 -0
  108. package/cjs/icons/InsuraceLogo.js +11 -0
  109. package/cjs/icons/index.d.ts +1 -0
  110. package/cjs/icons/index.js +1 -0
  111. package/cjs/index.d.ts +0 -6
  112. package/cjs/index.js +1 -6
  113. package/cjs/pages/MainPage/MainGasMessage.d.ts +3 -0
  114. package/cjs/pages/MainPage/MainGasMessage.js +12 -0
  115. package/cjs/pages/MainPage/MainPage.js +3 -2
  116. package/cjs/pages/MainPage/MainSwapButton.js +1 -1
  117. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  118. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  119. package/cjs/pages/SettingsPage/ResetSettingsButton.js +3 -1
  120. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  121. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  122. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  123. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -14
  124. package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -2
  125. package/cjs/pages/SwapPage/StartSwapButton.js +14 -4
  126. package/cjs/pages/SwapPage/SwapPage.js +18 -7
  127. package/cjs/pages/SwapPage/types.d.ts +9 -0
  128. package/cjs/pages/SwapPage/types.js +2 -0
  129. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  130. package/cjs/providers/SDKProvider/SDKProvider.d.ts +2 -2
  131. package/cjs/providers/SDKProvider/SDKProvider.js +2 -1
  132. package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -3
  133. package/cjs/providers/WidgetProvider/WidgetProvider.js +17 -4
  134. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  135. package/cjs/providers/WidgetProvider/utils.js +2 -4
  136. package/cjs/stores/StoreProvider.js +1 -1
  137. package/cjs/stores/routes/createRouteExecutionStore.js +3 -2
  138. package/cjs/stores/routes/index.d.ts +0 -1
  139. package/cjs/stores/routes/index.js +0 -1
  140. package/cjs/stores/routes/types.d.ts +1 -5
  141. package/cjs/stores/routes/useSetExecutableRoute.d.ts +1 -1
  142. package/cjs/stores/settings/types.d.ts +3 -2
  143. package/cjs/stores/settings/useSettingsStore.js +3 -1
  144. package/cjs/types/widget.d.ts +5 -10
  145. package/cjs/utils/format.js +4 -1
  146. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  147. package/components/Card/CardIconButton.d.ts +29 -0
  148. package/components/Card/CardIconButton.js +14 -0
  149. package/components/Card/CardLabel.d.ts +26 -0
  150. package/components/Card/CardLabel.js +42 -0
  151. package/components/Card/CardTitle.d.ts +2 -2
  152. package/components/Card/index.d.ts +2 -0
  153. package/components/Card/index.js +2 -0
  154. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  155. package/components/GasMessage/FundsSufficiencyMessage.js +12 -0
  156. package/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  157. package/components/GasMessage/GasMessage.js +15 -0
  158. package/components/GasMessage/GasMessage.style.d.ts +34 -0
  159. package/components/GasMessage/GasMessage.style.js +45 -0
  160. package/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  161. package/components/GasMessage/GasRefuelMessage.js +22 -0
  162. package/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  163. package/components/GasMessage/GasSufficiencyMessage.js +17 -0
  164. package/components/GasMessage/index.d.ts +2 -0
  165. package/components/GasMessage/index.js +2 -0
  166. package/components/Header/Header.style.d.ts +5 -5
  167. package/components/Header/NavigationHeader.js +4 -4
  168. package/components/Header/WalletHeader.js +6 -6
  169. package/components/Insurance/Insurance.d.ts +3 -0
  170. package/components/Insurance/Insurance.js +7 -0
  171. package/components/Insurance/InsuranceCard.d.ts +3 -0
  172. package/components/Insurance/InsuranceCard.js +16 -0
  173. package/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  174. package/components/Insurance/InsuranceCollapsed.js +28 -0
  175. package/components/Insurance/index.d.ts +1 -0
  176. package/components/Insurance/index.js +1 -0
  177. package/components/Insurance/types.d.ts +14 -0
  178. package/components/Insurance/types.js +1 -0
  179. package/components/NFT/NFT.style.d.ts +1 -1
  180. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  181. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  182. package/components/SendToWallet/SendToWallet.js +34 -28
  183. package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  184. package/components/SendToWallet/SendToWalletButton.js +4 -4
  185. package/components/SmallAvatar.d.ts +2 -2
  186. package/components/Step/CircularProgress.style.d.ts +1 -1
  187. package/components/Step/DestinationWalletAddress.js +2 -2
  188. package/components/Step/GasStepProcess.js +2 -2
  189. package/components/Step/Step.js +7 -5
  190. package/components/Step/StepList.d.ts +1 -1
  191. package/components/Step/StepProcess.style.d.ts +3 -3
  192. package/components/StepActions/StepActions.d.ts +5 -0
  193. package/components/StepActions/StepActions.js +52 -16
  194. package/components/StepActions/StepActions.style.d.ts +1 -1
  195. package/components/SwapButton/SwapButton.js +2 -2
  196. package/components/SwapButton/types.d.ts +1 -2
  197. package/components/SwapInput/SwapInput.style.d.ts +2 -2
  198. package/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  199. package/components/SwapInput/SwapInputEndAdornment.js +19 -2
  200. package/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  201. package/components/SwapRouteCard/SwapRouteCard.js +11 -26
  202. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  203. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  204. package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  205. package/components/SwapRouteCard/SwapRouteCardEssentials.js +23 -0
  206. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  207. package/components/SwapRouteCard/types.d.ts +2 -2
  208. package/components/SwapRouteCard/utils.d.ts +5 -0
  209. package/components/SwapRouteCard/utils.js +30 -1
  210. package/components/SwapRoutes/SwapRoutes.js +5 -14
  211. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -4
  212. package/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  213. package/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  214. package/components/Switch.js +5 -5
  215. package/components/TextFitter/TextFitter.js +9 -3
  216. package/components/Token/Token.style.d.ts +2 -2
  217. package/config/theme.js +1 -1
  218. package/config/version.d.ts +1 -1
  219. package/config/version.js +1 -1
  220. package/hooks/index.d.ts +4 -0
  221. package/hooks/index.js +4 -0
  222. package/hooks/useChains.js +2 -2
  223. package/hooks/useFeaturedTokens.d.ts +1 -1
  224. package/hooks/useFeaturedTokens.js +2 -2
  225. package/hooks/useFundsSufficiency.d.ts +5 -0
  226. package/hooks/useFundsSufficiency.js +69 -0
  227. package/hooks/useGasRecommendation.d.ts +2 -0
  228. package/hooks/useGasRecommendation.js +19 -0
  229. package/hooks/useGasRefuel.d.ts +7 -0
  230. package/hooks/useGasRefuel.js +57 -0
  231. package/hooks/useGasSufficiency.d.ts +2 -3
  232. package/hooks/useGasSufficiency.js +7 -38
  233. package/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  234. package/hooks/useGetTokenBalancesWithRetry.js +29 -0
  235. package/hooks/useSwapRoutes.d.ts +7 -2
  236. package/hooks/useSwapRoutes.js +32 -12
  237. package/hooks/useTokenAddressBalance.js +4 -2
  238. package/hooks/useTokenBalance.js +5 -23
  239. package/hooks/useTokenBalances.d.ts +1 -1
  240. package/hooks/useTokenSearch.js +2 -2
  241. package/hooks/useTokens.js +2 -3
  242. package/i18n/en.json +14 -7
  243. package/i18n/it.json +6 -2
  244. package/i18n/pt.json +234 -0
  245. package/i18n/uk.json +5 -1
  246. package/icons/InsuraceLogo.d.ts +2 -0
  247. package/icons/InsuraceLogo.js +7 -0
  248. package/icons/index.d.ts +1 -0
  249. package/icons/index.js +1 -0
  250. package/index.d.ts +0 -6
  251. package/index.js +0 -5
  252. package/package.json +12 -11
  253. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -2
  254. package/pages/MainPage/MainGasMessage.d.ts +3 -0
  255. package/pages/MainPage/MainGasMessage.js +8 -0
  256. package/pages/MainPage/MainPage.js +3 -2
  257. package/pages/MainPage/MainSwapButton.js +1 -1
  258. package/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  259. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  260. package/pages/SettingsPage/ResetSettingsButton.js +3 -1
  261. package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  262. package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
  263. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  264. package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  265. package/pages/SwapPage/ExchangeRateBottomSheet.js +0 -12
  266. package/pages/SwapPage/StartSwapButton.d.ts +3 -2
  267. package/pages/SwapPage/StartSwapButton.js +13 -4
  268. package/pages/SwapPage/SwapPage.js +21 -10
  269. package/pages/SwapPage/types.d.ts +9 -0
  270. package/pages/SwapPage/types.js +1 -0
  271. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  272. package/providers/SDKProvider/SDKProvider.d.ts +2 -2
  273. package/providers/SDKProvider/SDKProvider.js +3 -2
  274. package/providers/SwapFormProvider/FormUpdater.js +2 -3
  275. package/providers/WidgetProvider/WidgetProvider.js +17 -4
  276. package/providers/WidgetProvider/utils.d.ts +1 -1
  277. package/providers/WidgetProvider/utils.js +2 -4
  278. package/stores/StoreProvider.js +2 -2
  279. package/stores/routes/createRouteExecutionStore.js +3 -2
  280. package/stores/routes/index.d.ts +0 -1
  281. package/stores/routes/index.js +0 -1
  282. package/stores/routes/types.d.ts +1 -5
  283. package/stores/routes/useSetExecutableRoute.d.ts +1 -1
  284. package/stores/settings/types.d.ts +3 -2
  285. package/stores/settings/useSettingsStore.js +3 -1
  286. package/tsconfig.cjs.tsbuildinfo +1 -1
  287. package/types/widget.d.ts +5 -10
  288. package/utils/format.js +4 -1
  289. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -31
  290. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  291. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -14
  292. package/cjs/components/GasSufficiencyMessage/index.d.ts +0 -1
  293. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  294. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +0 -13
  295. package/cjs/config/env.d.ts +0 -3
  296. package/cjs/config/env.js +0 -6
  297. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  298. package/cjs/stores/routes/useRecommendedRouteStore.js +0 -39
  299. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -27
  300. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  301. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -11
  302. package/components/GasSufficiencyMessage/index.d.ts +0 -1
  303. package/components/GasSufficiencyMessage/index.js +0 -1
  304. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  305. package/components/SwapRoutes/useSetRecommendedRoute.js +0 -9
  306. package/config/env.d.ts +0 -3
  307. package/config/env.js +0 -3
  308. package/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  309. package/stores/routes/useRecommendedRouteStore.js +0 -32
@@ -0,0 +1,69 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import Big from 'big.js';
3
+ import { useWatch } from 'react-hook-form';
4
+ import { SwapFormKey, useWallet } from '../providers';
5
+ import { isRouteDone } from '../stores';
6
+ import { useGetTokenBalancesWithRetry } from './useGetTokenBalancesWithRetry';
7
+ import { useTokenAddressBalance } from './useTokenAddressBalance';
8
+ const refetchInterval = 30000;
9
+ export const useFundsSufficiency = (route) => {
10
+ const { account, provider } = useWallet();
11
+ const getTokenBalancesWithRetry = useGetTokenBalancesWithRetry(provider);
12
+ const [fromChainId, fromTokenAddress, fromAmount] = useWatch({
13
+ name: [
14
+ SwapFormKey.FromChain,
15
+ SwapFormKey.FromToken,
16
+ SwapFormKey.FromAmount,
17
+ ],
18
+ });
19
+ let chainId = fromChainId;
20
+ let tokenAddress = fromTokenAddress;
21
+ if (route) {
22
+ chainId = route.fromToken.chainId;
23
+ tokenAddress = route.fromToken.address;
24
+ }
25
+ const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
26
+ const { data: insufficientFunds, isInitialLoading } = useQuery([
27
+ 'funds-sufficiency-check',
28
+ account.address,
29
+ chainId,
30
+ tokenAddress,
31
+ route?.id ?? fromAmount,
32
+ ], async () => {
33
+ if (!account.address || !token) {
34
+ return;
35
+ }
36
+ let currentTokenBalance = Big(token?.amount || 0);
37
+ if (!route || isRouteDone(route)) {
38
+ const insufficientFunds = currentTokenBalance.lt(Big(fromAmount || 0));
39
+ return insufficientFunds;
40
+ }
41
+ const currentAction = route.steps.filter((step) => !step.execution || step.execution.status !== 'DONE')[0]?.action;
42
+ if (token.chainId === currentAction.fromToken.chainId &&
43
+ token.address === currentAction.fromToken.address &&
44
+ currentTokenBalance.gt(0)) {
45
+ const insufficientFunds = Big(route.fromAmount)
46
+ .div(10 ** route.fromToken.decimals)
47
+ .gt(currentTokenBalance);
48
+ return insufficientFunds;
49
+ }
50
+ const tokenBalances = await getTokenBalancesWithRetry(account.address, [
51
+ currentAction.fromToken,
52
+ ]);
53
+ currentTokenBalance = Big(tokenBalances?.[0]?.amount || 0);
54
+ const insufficientFunds = Big(currentAction.fromAmount)
55
+ .div(10 ** currentAction.fromToken.decimals)
56
+ .gt(currentTokenBalance);
57
+ return insufficientFunds;
58
+ }, {
59
+ enabled: Boolean(account.address && token && !isLoading),
60
+ refetchInterval,
61
+ staleTime: refetchInterval,
62
+ cacheTime: refetchInterval,
63
+ keepPreviousData: true,
64
+ });
65
+ return {
66
+ insufficientFunds,
67
+ isInitialLoading,
68
+ };
69
+ };
@@ -0,0 +1,2 @@
1
+ import type { ChainId } from '@lifi/sdk';
2
+ export declare const useGasRecommendation: (chainId: ChainId, fromChain?: ChainId, fromToken?: string) => import("@tanstack/react-query").UseQueryResult<import("@lifi/sdk").GasRecommendationResponse, unknown>;
@@ -0,0 +1,19 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { useLiFi } from '../providers';
3
+ const refetchInterval = 60000;
4
+ export const useGasRecommendation = (chainId, fromChain, fromToken) => {
5
+ const lifi = useLiFi();
6
+ return useQuery(['gas-recommendation', chainId, fromChain, fromToken], async ({ queryKey: [_, chainId, fromChain, fromToken] }) => {
7
+ const gasRecommendation = await lifi.getGasRecommendation({
8
+ chainId: chainId,
9
+ fromChain: fromChain,
10
+ fromToken: fromToken,
11
+ });
12
+ return gasRecommendation;
13
+ }, {
14
+ enabled: Boolean(chainId),
15
+ refetchInterval,
16
+ staleTime: refetchInterval,
17
+ cacheTime: refetchInterval,
18
+ });
19
+ };
@@ -0,0 +1,7 @@
1
+ export declare const useGasRefuel: () => {
2
+ enabled: boolean;
3
+ availble: boolean | undefined;
4
+ isLoading: boolean;
5
+ chain: import("@lifi/types").ExtendedChain | undefined;
6
+ gasRecommendation: import("@lifi/types").GasRecommendationResponse | undefined;
7
+ };
@@ -0,0 +1,57 @@
1
+ import Big from 'big.js';
2
+ import { useMemo } from 'react';
3
+ import { useWatch } from 'react-hook-form';
4
+ import { useChains } from '.';
5
+ import { SwapFormKey } from '../providers';
6
+ import { useGasRecommendation } from './useGasRecommendation';
7
+ import { useTokenBalance } from './useTokenBalance';
8
+ export const useGasRefuel = () => {
9
+ const { getChainById } = useChains();
10
+ const [fromChainId, fromTokenAddress, toChainId, toTokenAddress, toAddress] = useWatch({
11
+ name: [
12
+ SwapFormKey.FromChain,
13
+ SwapFormKey.FromToken,
14
+ SwapFormKey.ToChain,
15
+ SwapFormKey.ToToken,
16
+ SwapFormKey.ToAddress,
17
+ ],
18
+ });
19
+ const toChain = getChainById(toChainId);
20
+ const { token: nativeToken } = useTokenBalance(toChainId && toChain?.nativeToken, toAddress);
21
+ const { data: gasRecommendation, isLoading } = useGasRecommendation(toChainId, fromChainId, fromTokenAddress);
22
+ const enabled = useMemo(() => {
23
+ if (
24
+ // We don't allow same chain refuel.
25
+ // If a user runs out of gas, he can't send a source chain transaction.
26
+ fromChainId === toChainId ||
27
+ // We don't want to apply auto refuel when swapping to native tokens
28
+ toChain?.nativeToken.address === toTokenAddress ||
29
+ !gasRecommendation?.available ||
30
+ !gasRecommendation.recommended ||
31
+ !nativeToken) {
32
+ return false;
33
+ }
34
+ const tokenBalance = Big(nativeToken.amount ?? 0);
35
+ // check if the user balance < 50% of the recommended amount
36
+ const recommendedAmount = Big(gasRecommendation.recommended.amount)
37
+ .div(10 ** gasRecommendation.recommended.token.decimals)
38
+ .div(2);
39
+ const insufficientGas = tokenBalance.lt(recommendedAmount);
40
+ return insufficientGas;
41
+ }, [
42
+ fromChainId,
43
+ gasRecommendation?.available,
44
+ gasRecommendation?.recommended,
45
+ nativeToken,
46
+ toChain?.nativeToken.address,
47
+ toChainId,
48
+ toTokenAddress,
49
+ ]);
50
+ return {
51
+ enabled: enabled,
52
+ availble: gasRecommendation?.available,
53
+ isLoading: isLoading,
54
+ chain: toChain,
55
+ gasRecommendation,
56
+ };
57
+ };
@@ -9,7 +9,6 @@ export interface GasSufficiency {
9
9
  chain?: EVMChain;
10
10
  }
11
11
  export declare const useGasSufficiency: (route?: Route) => {
12
- insufficientGas: GasSufficiency[] | null | undefined;
13
- insufficientFunds: boolean | null | undefined;
14
- isLoading: boolean;
12
+ insufficientGas: GasSufficiency[] | undefined;
13
+ isInitialLoading: boolean;
15
14
  };
@@ -1,17 +1,15 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import Big from 'big.js';
3
- import { useChains } from '.';
3
+ import { useChains, useGetTokenBalancesWithRetry } from '.';
4
4
  import { useWallet } from '../providers';
5
- import { isRouteDone } from '../stores';
6
- import { useTokenBalance } from './useTokenBalance';
7
5
  const refetchInterval = 30000;
8
6
  export const useGasSufficiency = (route) => {
9
- const { account } = useWallet();
7
+ const { account, provider } = useWallet();
10
8
  const { getChainById } = useChains();
11
- const { token: fromToken, getTokenBalancesWithRetry } = useTokenBalance(route?.fromToken);
12
- const { data: insufficientGas, isInitialLoading: insufficientGasLoading } = useQuery(['gas-sufficiency-check', account.address, route?.id], async () => {
9
+ const getTokenBalancesWithRetry = useGetTokenBalancesWithRetry(provider);
10
+ const { data: insufficientGas, isInitialLoading } = useQuery(['gas-sufficiency-check', account.address, route?.id], async () => {
13
11
  if (!account.address || !route) {
14
- return null;
12
+ return;
15
13
  }
16
14
  const gasCosts = route.steps
17
15
  .filter((step) => !step.execution || step.execution.status !== 'DONE')
@@ -39,7 +37,7 @@ export const useGasSufficiency = (route) => {
39
37
  }
40
38
  const tokenBalances = await getTokenBalancesWithRetry(account.address, Object.values(gasCosts).map((item) => item.token));
41
39
  if (!tokenBalances?.length) {
42
- return null;
40
+ return;
43
41
  }
44
42
  [route.fromChainId, route.toChainId].forEach((chainId) => {
45
43
  if (gasCosts[chainId]) {
@@ -68,37 +66,8 @@ export const useGasSufficiency = (route) => {
68
66
  staleTime: refetchInterval,
69
67
  cacheTime: refetchInterval,
70
68
  });
71
- const { data: insufficientFunds, isInitialLoading: insufficientFundsLoading, } = useQuery(['funds-sufficiency-check', account.address, route?.id], async () => {
72
- if (!account.address || !fromToken || !route || isRouteDone(route)) {
73
- return null;
74
- }
75
- let currentTokenBalance = Big(fromToken?.amount ?? 0);
76
- const currentAction = route.steps.filter((step) => !step.execution || step.execution.status !== 'DONE')[0]?.action;
77
- if (fromToken.chainId === currentAction.fromToken.chainId &&
78
- fromToken.address === currentAction.fromToken.address &&
79
- currentTokenBalance.gt(0)) {
80
- const insufficientFunds = Big(route.fromAmount)
81
- .div(10 ** route.fromToken.decimals)
82
- .gt(currentTokenBalance);
83
- return insufficientFunds;
84
- }
85
- const tokenBalances = await getTokenBalancesWithRetry(account.address, [
86
- currentAction.fromToken,
87
- ]);
88
- currentTokenBalance = Big(tokenBalances?.[0]?.amount ?? 0);
89
- const insufficientFunds = Big(currentAction.fromAmount)
90
- .div(10 ** currentAction.fromToken.decimals)
91
- .gt(currentTokenBalance);
92
- return insufficientFunds;
93
- }, {
94
- enabled: Boolean(account.address && route && fromToken),
95
- refetchInterval,
96
- staleTime: refetchInterval,
97
- cacheTime: refetchInterval,
98
- });
99
69
  return {
100
70
  insufficientGas,
101
- insufficientFunds,
102
- isLoading: insufficientGasLoading || insufficientFundsLoading,
71
+ isInitialLoading,
103
72
  };
104
73
  };
@@ -0,0 +1,3 @@
1
+ import type { Provider } from '@ethersproject/providers';
2
+ import type { Token, TokenAmount } from '@lifi/sdk';
3
+ export declare const useGetTokenBalancesWithRetry: (provider?: Provider) => (accountAddress: string, tokens: Token[], depth?: number) => Promise<TokenAmount[] | undefined>;
@@ -0,0 +1,29 @@
1
+ import { isAddress } from '@ethersproject/address';
2
+ import { useCallback } from 'react';
3
+ import { useLiFi } from '../providers';
4
+ export const useGetTokenBalancesWithRetry = (provider) => {
5
+ const lifi = useLiFi();
6
+ const getTokenBalancesWithRetry = useCallback(async (accountAddress, tokens, depth = 0) => {
7
+ try {
8
+ const walletAddress = isAddress(accountAddress)
9
+ ? accountAddress
10
+ : await provider?.resolveName(accountAddress);
11
+ const tokenBalances = await lifi.getTokenBalances(walletAddress, tokens);
12
+ if (!tokenBalances.every((token) => token.blockNumber)) {
13
+ if (depth > 10) {
14
+ console.warn('Token balance backoff depth exceeded.');
15
+ return undefined;
16
+ }
17
+ await new Promise((resolve) => {
18
+ setTimeout(resolve, 1.5 ** depth * 100);
19
+ });
20
+ return getTokenBalancesWithRetry(accountAddress, tokens, depth + 1);
21
+ }
22
+ return tokenBalances;
23
+ }
24
+ catch (error) {
25
+ //
26
+ }
27
+ }, [lifi, provider]);
28
+ return getTokenBalancesWithRetry;
29
+ };
@@ -1,10 +1,15 @@
1
1
  import type { Route, RoutesResponse } from '@lifi/sdk';
2
- export declare const useSwapRoutes: () => {
2
+ interface SwapRoutesProps {
3
+ onSettled?: (data?: RoutesResponse) => void;
4
+ insurableRoute?: Route;
5
+ }
6
+ export declare const useSwapRoutes: ({ onSettled, insurableRoute, }?: SwapRoutesProps) => {
3
7
  routes: Route[] | undefined;
4
8
  isLoading: boolean;
5
9
  isFetching: boolean;
6
10
  isFetched: boolean;
7
11
  dataUpdatedAt: number;
8
12
  refetchTime: number;
9
- refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<RoutesResponse, any>>;
13
+ refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<RoutesResponse, unknown>>;
10
14
  };
15
+ export {};
@@ -4,18 +4,19 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
4
4
  import Big from 'big.js';
5
5
  import { useWatch } from 'react-hook-form';
6
6
  import { v4 as uuidv4 } from 'uuid';
7
- import { useDebouncedWatch, useToken } from '.';
7
+ import { useDebouncedWatch, useGasRefuel, useToken } from '.';
8
8
  import { SwapFormKey, useLiFi, useWallet, useWidgetConfig } from '../providers';
9
9
  import { useSettings } from '../stores';
10
10
  const refetchTime = 60000;
11
- export const useSwapRoutes = () => {
11
+ export const useSwapRoutes = ({ onSettled, insurableRoute, } = {}) => {
12
12
  const lifi = useLiFi();
13
- const { variant, sdkConfig } = useWidgetConfig();
13
+ const { variant, sdkConfig, insurance } = useWidgetConfig();
14
14
  const { account, provider } = useWallet();
15
15
  const queryClient = useQueryClient();
16
- const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
16
+ const { slippage, enabledBridges, enabledAutoRefuel, enabledExchanges, routePriority, } = useSettings([
17
17
  'slippage',
18
18
  'routePriority',
19
+ 'enabledAutoRefuel',
19
20
  'enabledBridges',
20
21
  'enabledExchanges',
21
22
  ]);
@@ -35,6 +36,7 @@ export const useSwapRoutes = () => {
35
36
  });
36
37
  const { token: fromToken } = useToken(fromChainId, fromTokenAddress);
37
38
  const { token: toToken } = useToken(toChainId, toTokenAddress);
39
+ const { enabled: enabledRefuel, gasRecommendation } = useGasRefuel();
38
40
  const hasAmount = (!isNaN(fromTokenAmount) && Number(fromTokenAmount) > 0) ||
39
41
  (!isNaN(toTokenAmount) && Number(toTokenAmount) > 0);
40
42
  const contractCallQuoteEnabled = variant === 'nft'
@@ -66,12 +68,12 @@ export const useSwapRoutes = () => {
66
68
  routePriority,
67
69
  variant,
68
70
  sdkConfig?.defaultRouteOptions?.allowSwitchChain,
71
+ enabledRefuel && enabledAutoRefuel,
72
+ gasRecommendation?.fromAmount,
73
+ insurance,
74
+ insurableRoute?.id,
69
75
  ];
70
- const previousDataUpdatedAt = queryClient.getQueryState(queryKey)?.dataUpdatedAt;
71
- const refetchInterval = previousDataUpdatedAt
72
- ? Math.min(Math.abs(refetchTime - (Date.now() - previousDataUpdatedAt)), refetchTime)
73
- : refetchTime;
74
- const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = useQuery(queryKey, async ({ queryKey: [_, fromAddress, fromChainId, fromTokenAddress, fromTokenAmount, toAddress, toChainId, toTokenAddress, toTokenAmount, toContractAddress, toContractCallData, toContractGasLimit, slippage, enabledBridges, enabledExchanges, routePriority, variant, allowSwitchChain,], signal, }) => {
76
+ const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = useQuery(queryKey, async ({ queryKey: [_, fromAddress, fromChainId, fromTokenAddress, fromTokenAmount, toAddress, toChainId, toTokenAddress, toTokenAmount, toContractAddress, toContractCallData, toContractGasLimit, slippage, enabledBridges, enabledExchanges, routePriority, variant, allowSwitchChain, enabledRefuel, gasRecommendationFromAmount, insurance, insurableRouteId,], signal, }) => {
75
77
  let toWalletAddress;
76
78
  try {
77
79
  toWalletAddress =
@@ -117,9 +119,20 @@ export const useSwapRoutes = () => {
117
119
  toAddress: toAddress,
118
120
  gasCostUSD: contractCallQuote.estimate.gasCosts?.[0].amountUSD,
119
121
  steps: [contractCallQuote],
122
+ insurance: { state: 'NOT_INSURABLE', feeAmountUsd: '0' },
120
123
  };
121
124
  return { routes: [route] };
122
125
  }
126
+ const allowedBridges = insurableRoute
127
+ ? insurableRoute.steps.flatMap((step) => step.includedSteps
128
+ .filter((includedStep) => includedStep.type === 'cross')
129
+ .map((includedStep) => includedStep.toolDetails.key))
130
+ : enabledBridges;
131
+ const allowedExchanges = insurableRoute
132
+ ? insurableRoute.steps.flatMap((step) => step.includedSteps
133
+ .filter((includedStep) => includedStep.type === 'swap')
134
+ .map((includedStep) => includedStep.toolDetails.key))
135
+ : enabledExchanges;
123
136
  return lifi.getRoutes({
124
137
  fromChainId,
125
138
  fromAmount,
@@ -128,23 +141,29 @@ export const useSwapRoutes = () => {
128
141
  toTokenAddress,
129
142
  fromAddress,
130
143
  toAddress: toWalletAddress,
144
+ fromAmountForGas: enabledRefuel && gasRecommendationFromAmount
145
+ ? gasRecommendationFromAmount
146
+ : undefined,
131
147
  options: {
132
148
  slippage: formattedSlippage,
133
149
  bridges: {
134
- allow: enabledBridges,
150
+ allow: allowedBridges,
135
151
  },
136
152
  exchanges: {
137
- allow: enabledExchanges,
153
+ allow: allowedExchanges,
138
154
  },
139
155
  order: routePriority,
140
156
  allowSwitchChain: variant === 'refuel' ? false : allowSwitchChain,
157
+ insurance: insurance ? Boolean(insurableRoute) : undefined,
141
158
  },
142
159
  }, { signal });
143
160
  }, {
144
161
  enabled: isEnabled,
145
- refetchInterval,
146
162
  staleTime: refetchTime,
147
163
  cacheTime: refetchTime,
164
+ refetchInterval(data, query) {
165
+ return Math.min(Math.abs(refetchTime - (Date.now() - query.state.dataUpdatedAt)), refetchTime);
166
+ },
148
167
  retry(failureCount, error) {
149
168
  if (error?.code === LifiErrorCode.NotFound) {
150
169
  return false;
@@ -170,6 +189,7 @@ export const useSwapRoutes = () => {
170
189
  });
171
190
  }
172
191
  },
192
+ onSettled,
173
193
  });
174
194
  return {
175
195
  routes: data?.routes,
@@ -3,8 +3,10 @@ import { useTokenBalances } from './useTokenBalances';
3
3
  export const useTokenAddressBalance = (chainId, tokenAddress) => {
4
4
  const { tokens, tokensWithBalance, isBalanceLoading, refetch } = useTokenBalances(chainId);
5
5
  const token = useMemo(() => {
6
- const token = (tokensWithBalance ?? tokens)?.find((token) => token.address === tokenAddress && token.chainId === chainId);
7
- return token;
6
+ if (tokenAddress && chainId) {
7
+ const token = (tokensWithBalance ?? tokens)?.find((token) => token.address === tokenAddress && token.chainId === chainId);
8
+ return token;
9
+ }
8
10
  }, [chainId, tokenAddress, tokens, tokensWithBalance]);
9
11
  return {
10
12
  token,
@@ -1,32 +1,14 @@
1
1
  import { useQuery, useQueryClient } from '@tanstack/react-query';
2
2
  import { useCallback, useMemo } from 'react';
3
- import { useLiFi, useWallet } from '../providers';
3
+ import { useWallet } from '../providers';
4
4
  import { formatTokenAmount } from '../utils';
5
+ import { useGetTokenBalancesWithRetry } from './useGetTokenBalancesWithRetry';
5
6
  const defaultRefetchInterval = 30000;
6
7
  export const useTokenBalance = (token, accountAddress) => {
7
- const lifi = useLiFi();
8
- const { account } = useWallet();
8
+ const { account, provider } = useWallet();
9
9
  const queryClient = useQueryClient();
10
- const walletAddress = accountAddress ?? account.address;
11
- const getTokenBalancesWithRetry = useCallback(async (accountAddress, tokens, depth = 0) => {
12
- try {
13
- const tokenBalances = await lifi.getTokenBalances(accountAddress, tokens);
14
- if (!tokenBalances.every((token) => token.blockNumber)) {
15
- if (depth > 10) {
16
- console.warn('Token balance backoff depth exceeded.');
17
- return undefined;
18
- }
19
- await new Promise((resolve) => {
20
- setTimeout(resolve, 1.5 ** depth * 100);
21
- });
22
- return getTokenBalancesWithRetry(accountAddress, tokens, depth + 1);
23
- }
24
- return tokenBalances;
25
- }
26
- catch (error) {
27
- //
28
- }
29
- }, [lifi]);
10
+ const walletAddress = accountAddress || account.address;
11
+ const getTokenBalancesWithRetry = useGetTokenBalancesWithRetry(provider);
30
12
  const tokenBalanceQueryKey = useMemo(() => ['token-balance', walletAddress, token?.chainId, token?.address], [token?.address, token?.chainId, walletAddress]);
31
13
  const { data, isLoading, refetch } = useQuery(tokenBalanceQueryKey, async ({ queryKey: [, accountAddress] }) => {
32
14
  const cachedToken = queryClient
@@ -2,7 +2,7 @@ import type { Token } from '../types';
2
2
  export declare const useTokenBalances: (selectedChainId?: number) => {
3
3
  tokens: Token[];
4
4
  tokensWithBalance: Token[] | undefined;
5
- featuredTokens: import("@lifi/types").Token[];
5
+ featuredTokens: import("@lifi/types").Token[] | undefined;
6
6
  isLoading: boolean;
7
7
  isBalanceLoading: boolean;
8
8
  refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<Token[], unknown>>;
@@ -10,9 +10,9 @@ export const useTokenSearch = (chainId, tokenQuery, enabled) => {
10
10
  if (token) {
11
11
  queryClient.setQueriesData(['tokens'], (data) => {
12
12
  if (data &&
13
- !data.tokens[chainId].some((t) => t.address === token.address)) {
13
+ !data.tokens[chainId]?.some((t) => t.address === token.address)) {
14
14
  const clonedData = { ...data };
15
- clonedData.tokens[chainId].push(token);
15
+ clonedData.tokens[chainId]?.push(token);
16
16
  return clonedData;
17
17
  }
18
18
  });
@@ -8,14 +8,14 @@ export const useTokens = (selectedChainId) => {
8
8
  const { data, isLoading, dataUpdatedAt } = useQuery(['tokens'], () => lifi.getTokens());
9
9
  const { getChainById, isLoading: isSupportedChainsLoading } = useChains();
10
10
  const featuredTokens = useFeaturedTokens(selectedChainId);
11
- const { tokens: configTokens, chains: configChains, disabledChains, } = useWidgetConfig();
11
+ const { tokens: configTokens, chains: configChains } = useWidgetConfig();
12
12
  const tokens = useMemo(() => {
13
13
  if (isSupportedChainsLoading) {
14
14
  return [];
15
15
  }
16
16
  const chainAllowed = selectedChainId &&
17
17
  getChainById(selectedChainId) &&
18
- isItemAllowed(selectedChainId, configChains, disabledChains);
18
+ isItemAllowed(selectedChainId, configChains);
19
19
  if (!chainAllowed) {
20
20
  return [];
21
21
  }
@@ -44,7 +44,6 @@ export const useTokens = (selectedChainId) => {
44
44
  selectedChainId,
45
45
  getChainById,
46
46
  configChains,
47
- disabledChains,
48
47
  configTokens?.allow,
49
48
  configTokens?.deny,
50
49
  featuredTokens,
package/i18n/en.json CHANGED
@@ -106,12 +106,14 @@
106
106
  "inProgress": "in progress",
107
107
  "info": {
108
108
  "message": {
109
+ "autoRefuel": "You're low on {{chainName}} gas. By continuing, you'll get enough gas to complete the swap.",
109
110
  "emptyActiveSwaps": "Swaps in progress will appear here. Once completed, find them in swap history.",
110
111
  "emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data.",
111
112
  "emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please try search again or choose another chain.",
112
113
  "routeNotFound": "Try another token combination."
113
114
  },
114
115
  "title": {
116
+ "autoRefuel": "Get gas",
115
117
  "emptyActiveSwaps": "No active swaps",
116
118
  "emptySwapHistory": "No recent swaps",
117
119
  "routeNotFound": "No routes available"
@@ -154,6 +156,7 @@
154
156
  "quotedAmount": "Quoted amount",
155
157
  "rateChange": "Rate change",
156
158
  "receiving": "Receiving",
159
+ "refuelStepDetails": "Get gas via {{tool}}",
157
160
  "routes": "You get",
158
161
  "selectChain": "Chain",
159
162
  "selectChainAndToken": "Select chain and token",
@@ -162,6 +165,7 @@
162
165
  "sendToWallet": "Send to a different wallet",
163
166
  "sentToAddress": "Sent to {{address}}",
164
167
  "stepBridge": "Bridge",
168
+ "stepDetails": "{{tool}} via LI.FI",
165
169
  "stepSwap": "Swap",
166
170
  "stepSwapAndBridge": "Swap and bridge",
167
171
  "success": {
@@ -180,11 +184,13 @@
180
184
  "swapStepDetails": "Swap on {{chain}} via {{tool}}",
181
185
  "swapping": "Swapping",
182
186
  "tags": {
183
- "ALTERNATIVE": "ALTERNATIVE",
184
- "CHEAPEST": "CHEAP",
185
- "FASTEST": "FAST",
186
- "RECOMMENDED": "RECOMMENDED",
187
- "SAFEST": "SAFE"
187
+ "cheapest": "Cheap",
188
+ "fastest": "Fast",
189
+ "insurable": "Insurable",
190
+ "insurance": "Insurance",
191
+ "insured": "Insured",
192
+ "recommended": "Recommended",
193
+ "safest": "Safe"
188
194
  },
189
195
  "to": "To",
190
196
  "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
@@ -197,8 +203,8 @@
197
203
  "deleteActiveSwaps": "Active swaps are only stored locally and can't be recovered if you delete them.",
198
204
  "deleteSwapHistory": "Swap history is only stored locally and can't be recovered if you delete it.",
199
205
  "highValueLoss": "The value of the received tokens is significantly lower than the swapped tokens and transaction cost.",
200
- "insufficientFunds": "You don't have enough funds to execute the swap.",
201
- "insufficientGas": "You need to add at least:",
206
+ "insufficientFunds": "You don't have enough funds to complete the swap.",
207
+ "insufficientGas": "You don't have enough gas to complete the swap. You need to add at least:",
202
208
  "rateChanged": "The exchange rate has changed. By continuing the swap, you'll accept the new rate.",
203
209
  "resetSettings": "This will reset your route priority, slippage, gas price, enabled bridges and exchanges."
204
210
  },
@@ -214,6 +220,7 @@
214
220
  }
215
221
  },
216
222
  "tooltip": {
223
+ "additionalProviderFee": "Additional bridges, DEXs, and service fees.",
217
224
  "estimatedNetworkFee": "Estimated network fee.",
218
225
  "estimatedTime": "Estimated swap execution time in minutes.",
219
226
  "notFound": {
package/i18n/it.json CHANGED
@@ -106,12 +106,14 @@
106
106
  "inProgress": "in corso",
107
107
  "info": {
108
108
  "message": {
109
+ "autoRefuel": "Livello basso di gas su {{chainName}}. Continuando avrai abbastanza gas per completare lo scambio.",
109
110
  "emptyActiveSwaps": "Gli scambi in corso verranno visualizzati qui. Una volta completati, saranno presenti nella cronologia di scambi.",
110
111
  "emptySwapHistory": "La cronologia di scambi viene memorizzata solo localmente e verrà cancellata se si cancellano i dati del browser.",
111
112
  "emptyTokenList": "Non siamo riusciti a trovare token sulla chain {{chainName}} o non ne hai. Riprova o scegli un'altra chain.",
112
113
  "routeNotFound": "Prova un'altra combinazione di token."
113
114
  },
114
115
  "title": {
116
+ "autoRefuel": "Ottieni gas",
115
117
  "emptyActiveSwaps": "Nessuno scambio attivo",
116
118
  "emptySwapHistory": "Nessuno scambio recente",
117
119
  "routeNotFound": "Nessuna rotta disponibile"
@@ -154,6 +156,7 @@
154
156
  "quotedAmount": "Totale quotato",
155
157
  "rateChange": "Tasso di scambio",
156
158
  "receiving": "In ricezione",
159
+ "refuelStepDetails": "Ottieni gas tramite {{tool}}",
157
160
  "routes": "Ottieni",
158
161
  "selectChain": "Chain",
159
162
  "selectChainAndToken": "Selezionare la chain ed il token",
@@ -162,6 +165,7 @@
162
165
  "sendToWallet": "Invia ad un altro portafoglio",
163
166
  "sentToAddress": "Inviati a {{address}}",
164
167
  "stepBridge": "Bridge",
168
+ "stepDetails": "{{tool}} tramite LI.FI",
165
169
  "stepSwap": "Scambio",
166
170
  "stepSwapAndBridge": "Scambia e bridge",
167
171
  "success": {
@@ -197,8 +201,8 @@
197
201
  "deleteActiveSwaps": "Gli scambi attivi vengono memorizzati solo localmente e non possono essere recuperati se vengono cancellati.",
198
202
  "deleteSwapHistory": "La cronologia degli scambi viene memorizzata solo localmente e, se cancellata, non può essere recuperata.",
199
203
  "highValueLoss": "Il valore dei token ricevuti è significativamente inferiore ai token scambiati più il costo della transazione.",
200
- "insufficientFunds": "Non hai abbastanza fondi per eseguire lo scambio.",
201
- "insufficientGas": "È necessario aggiungere almeno:",
204
+ "insufficientFunds": "Non hai abbastanza fondi per completare lo scambio.",
205
+ "insufficientGas": "Non hai abbastanza gas per completare lo scambio. Devi aggiungere almeno:",
202
206
  "rateChanged": "Il tasso di scambio è cambiato. Se procedi, confermi di accettare il nuovo tasso.",
203
207
  "resetSettings": "Questo porterà al ripristino della priorità di route, slittamento di prezzo, prezzo del gas, bridge abilitati ed exchanges."
204
208
  },