@lifi/widget 1.32.8 → 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 (305) 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/Token/Token.style.d.ts +2 -2
  77. package/cjs/config/theme.js +1 -1
  78. package/cjs/config/version.d.ts +1 -1
  79. package/cjs/config/version.js +1 -1
  80. package/cjs/hooks/index.d.ts +4 -0
  81. package/cjs/hooks/index.js +4 -0
  82. package/cjs/hooks/useChains.js +2 -2
  83. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  84. package/cjs/hooks/useFeaturedTokens.js +2 -2
  85. package/cjs/hooks/useFundsSufficiency.d.ts +5 -0
  86. package/cjs/hooks/useFundsSufficiency.js +73 -0
  87. package/cjs/hooks/useGasRecommendation.d.ts +2 -0
  88. package/cjs/hooks/useGasRecommendation.js +23 -0
  89. package/cjs/hooks/useGasRefuel.d.ts +7 -0
  90. package/cjs/hooks/useGasRefuel.js +61 -0
  91. package/cjs/hooks/useGasSufficiency.d.ts +2 -3
  92. package/cjs/hooks/useGasSufficiency.js +6 -37
  93. package/cjs/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  94. package/cjs/hooks/useGetTokenBalancesWithRetry.js +33 -0
  95. package/cjs/hooks/useSwapRoutes.d.ts +7 -2
  96. package/cjs/hooks/useSwapRoutes.js +31 -11
  97. package/cjs/hooks/useTokenAddressBalance.js +4 -2
  98. package/cjs/hooks/useTokenBalance.js +4 -22
  99. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  100. package/cjs/hooks/useTokenSearch.js +2 -2
  101. package/cjs/hooks/useTokens.js +2 -3
  102. package/cjs/i18n/en.json +14 -7
  103. package/cjs/i18n/it.json +6 -2
  104. package/cjs/i18n/pt.json +234 -0
  105. package/cjs/i18n/uk.json +5 -1
  106. package/cjs/icons/InsuraceLogo.d.ts +2 -0
  107. package/cjs/icons/InsuraceLogo.js +11 -0
  108. package/cjs/icons/index.d.ts +1 -0
  109. package/cjs/icons/index.js +1 -0
  110. package/cjs/index.d.ts +0 -6
  111. package/cjs/index.js +1 -6
  112. package/cjs/pages/MainPage/MainGasMessage.d.ts +3 -0
  113. package/cjs/pages/MainPage/MainGasMessage.js +12 -0
  114. package/cjs/pages/MainPage/MainPage.js +3 -2
  115. package/cjs/pages/MainPage/MainSwapButton.js +1 -1
  116. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  117. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  118. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  119. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  120. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  121. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -14
  122. package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -2
  123. package/cjs/pages/SwapPage/StartSwapButton.js +14 -4
  124. package/cjs/pages/SwapPage/SwapPage.js +18 -7
  125. package/cjs/pages/SwapPage/types.d.ts +9 -0
  126. package/cjs/pages/SwapPage/types.js +2 -0
  127. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  128. package/cjs/providers/SDKProvider/SDKProvider.d.ts +2 -2
  129. package/cjs/providers/SDKProvider/SDKProvider.js +2 -1
  130. package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -3
  131. package/cjs/providers/WidgetProvider/WidgetProvider.js +17 -4
  132. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  133. package/cjs/providers/WidgetProvider/utils.js +2 -4
  134. package/cjs/stores/StoreProvider.js +1 -1
  135. package/cjs/stores/routes/createRouteExecutionStore.js +3 -2
  136. package/cjs/stores/routes/index.d.ts +0 -1
  137. package/cjs/stores/routes/index.js +0 -1
  138. package/cjs/stores/routes/types.d.ts +1 -5
  139. package/cjs/stores/routes/useSetExecutableRoute.d.ts +1 -1
  140. package/cjs/stores/settings/types.d.ts +1 -0
  141. package/cjs/stores/settings/useSettingsStore.js +1 -0
  142. package/cjs/types/widget.d.ts +5 -10
  143. package/cjs/utils/format.js +4 -1
  144. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  145. package/components/Card/CardIconButton.d.ts +29 -0
  146. package/components/Card/CardIconButton.js +14 -0
  147. package/components/Card/CardLabel.d.ts +26 -0
  148. package/components/Card/CardLabel.js +42 -0
  149. package/components/Card/CardTitle.d.ts +2 -2
  150. package/components/Card/index.d.ts +2 -0
  151. package/components/Card/index.js +2 -0
  152. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -0
  153. package/components/GasMessage/FundsSufficiencyMessage.js +12 -0
  154. package/components/{GasSufficiencyMessage/GasSufficiencyMessage.d.ts → GasMessage/GasMessage.d.ts} +4 -2
  155. package/components/GasMessage/GasMessage.js +15 -0
  156. package/components/GasMessage/GasMessage.style.d.ts +34 -0
  157. package/components/GasMessage/GasMessage.style.js +45 -0
  158. package/components/GasMessage/GasRefuelMessage.d.ts +3 -0
  159. package/components/GasMessage/GasRefuelMessage.js +22 -0
  160. package/components/GasMessage/GasSufficiencyMessage.d.ts +7 -0
  161. package/components/GasMessage/GasSufficiencyMessage.js +17 -0
  162. package/components/GasMessage/index.d.ts +2 -0
  163. package/components/GasMessage/index.js +2 -0
  164. package/components/Header/Header.style.d.ts +5 -5
  165. package/components/Header/NavigationHeader.js +4 -4
  166. package/components/Header/WalletHeader.js +6 -6
  167. package/components/Insurance/Insurance.d.ts +3 -0
  168. package/components/Insurance/Insurance.js +7 -0
  169. package/components/Insurance/InsuranceCard.d.ts +3 -0
  170. package/components/Insurance/InsuranceCard.js +16 -0
  171. package/components/Insurance/InsuranceCollapsed.d.ts +3 -0
  172. package/components/Insurance/InsuranceCollapsed.js +28 -0
  173. package/components/Insurance/index.d.ts +1 -0
  174. package/components/Insurance/index.js +1 -0
  175. package/components/Insurance/types.d.ts +14 -0
  176. package/components/Insurance/types.js +1 -0
  177. package/components/NFT/NFT.style.d.ts +1 -1
  178. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  179. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
  180. package/components/SendToWallet/SendToWallet.js +34 -28
  181. package/components/SendToWallet/SendToWallet.style.d.ts +2 -2
  182. package/components/SendToWallet/SendToWalletButton.js +4 -4
  183. package/components/SmallAvatar.d.ts +2 -2
  184. package/components/Step/CircularProgress.style.d.ts +1 -1
  185. package/components/Step/DestinationWalletAddress.js +2 -2
  186. package/components/Step/GasStepProcess.js +2 -2
  187. package/components/Step/Step.js +7 -5
  188. package/components/Step/StepList.d.ts +1 -1
  189. package/components/Step/StepProcess.style.d.ts +3 -3
  190. package/components/StepActions/StepActions.d.ts +5 -0
  191. package/components/StepActions/StepActions.js +52 -16
  192. package/components/StepActions/StepActions.style.d.ts +1 -1
  193. package/components/SwapButton/SwapButton.js +2 -2
  194. package/components/SwapButton/types.d.ts +1 -2
  195. package/components/SwapInput/SwapInput.style.d.ts +2 -2
  196. package/components/SwapInput/SwapInputAdornment.style.d.ts +3 -3
  197. package/components/SwapInput/SwapInputEndAdornment.js +19 -2
  198. package/components/SwapRouteCard/SwapRouteCard.d.ts +1 -2
  199. package/components/SwapRouteCard/SwapRouteCard.js +11 -26
  200. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +4 -36
  201. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -38
  202. package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +3 -0
  203. package/components/SwapRouteCard/SwapRouteCardEssentials.js +23 -0
  204. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +5 -5
  205. package/components/SwapRouteCard/types.d.ts +2 -2
  206. package/components/SwapRouteCard/utils.d.ts +5 -0
  207. package/components/SwapRouteCard/utils.js +30 -1
  208. package/components/SwapRoutes/SwapRoutes.js +5 -14
  209. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -4
  210. package/components/SwapRoutes/{SwapRoutes.style.d.ts → SwapRoutesExpanded.style.d.ts} +0 -9
  211. package/components/SwapRoutes/{SwapRoutes.style.js → SwapRoutesExpanded.style.js} +1 -12
  212. package/components/Switch.js +5 -5
  213. package/components/Token/Token.style.d.ts +2 -2
  214. package/config/theme.js +1 -1
  215. package/config/version.d.ts +1 -1
  216. package/config/version.js +1 -1
  217. package/hooks/index.d.ts +4 -0
  218. package/hooks/index.js +4 -0
  219. package/hooks/useChains.js +2 -2
  220. package/hooks/useFeaturedTokens.d.ts +1 -1
  221. package/hooks/useFeaturedTokens.js +2 -2
  222. package/hooks/useFundsSufficiency.d.ts +5 -0
  223. package/hooks/useFundsSufficiency.js +69 -0
  224. package/hooks/useGasRecommendation.d.ts +2 -0
  225. package/hooks/useGasRecommendation.js +19 -0
  226. package/hooks/useGasRefuel.d.ts +7 -0
  227. package/hooks/useGasRefuel.js +57 -0
  228. package/hooks/useGasSufficiency.d.ts +2 -3
  229. package/hooks/useGasSufficiency.js +7 -38
  230. package/hooks/useGetTokenBalancesWithRetry.d.ts +3 -0
  231. package/hooks/useGetTokenBalancesWithRetry.js +29 -0
  232. package/hooks/useSwapRoutes.d.ts +7 -2
  233. package/hooks/useSwapRoutes.js +32 -12
  234. package/hooks/useTokenAddressBalance.js +4 -2
  235. package/hooks/useTokenBalance.js +5 -23
  236. package/hooks/useTokenBalances.d.ts +1 -1
  237. package/hooks/useTokenSearch.js +2 -2
  238. package/hooks/useTokens.js +2 -3
  239. package/i18n/en.json +14 -7
  240. package/i18n/it.json +6 -2
  241. package/i18n/pt.json +234 -0
  242. package/i18n/uk.json +5 -1
  243. package/icons/InsuraceLogo.d.ts +2 -0
  244. package/icons/InsuraceLogo.js +7 -0
  245. package/icons/index.d.ts +1 -0
  246. package/icons/index.js +1 -0
  247. package/index.d.ts +0 -6
  248. package/index.js +0 -5
  249. package/package.json +10 -10
  250. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +2 -2
  251. package/pages/MainPage/MainGasMessage.d.ts +3 -0
  252. package/pages/MainPage/MainGasMessage.js +8 -0
  253. package/pages/MainPage/MainPage.js +3 -2
  254. package/pages/MainPage/MainSwapButton.js +1 -1
  255. package/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  256. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
  257. package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
  258. package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
  259. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  260. package/pages/SwapPage/ExchangeRateBottomSheet.d.ts +1 -2
  261. package/pages/SwapPage/ExchangeRateBottomSheet.js +0 -12
  262. package/pages/SwapPage/StartSwapButton.d.ts +3 -2
  263. package/pages/SwapPage/StartSwapButton.js +13 -4
  264. package/pages/SwapPage/SwapPage.js +21 -10
  265. package/pages/SwapPage/types.d.ts +9 -0
  266. package/pages/SwapPage/types.js +1 -0
  267. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  268. package/providers/SDKProvider/SDKProvider.d.ts +2 -2
  269. package/providers/SDKProvider/SDKProvider.js +3 -2
  270. package/providers/SwapFormProvider/FormUpdater.js +2 -3
  271. package/providers/WidgetProvider/WidgetProvider.js +17 -4
  272. package/providers/WidgetProvider/utils.d.ts +1 -1
  273. package/providers/WidgetProvider/utils.js +2 -4
  274. package/stores/StoreProvider.js +2 -2
  275. package/stores/routes/createRouteExecutionStore.js +3 -2
  276. package/stores/routes/index.d.ts +0 -1
  277. package/stores/routes/index.js +0 -1
  278. package/stores/routes/types.d.ts +1 -5
  279. package/stores/routes/useSetExecutableRoute.d.ts +1 -1
  280. package/stores/settings/types.d.ts +1 -0
  281. package/stores/settings/useSettingsStore.js +1 -0
  282. package/tsconfig.cjs.tsbuildinfo +1 -1
  283. package/types/widget.d.ts +5 -10
  284. package/utils/format.js +4 -1
  285. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -31
  286. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  287. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -14
  288. package/cjs/components/GasSufficiencyMessage/index.d.ts +0 -1
  289. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  290. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +0 -13
  291. package/cjs/config/env.d.ts +0 -3
  292. package/cjs/config/env.js +0 -6
  293. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  294. package/cjs/stores/routes/useRecommendedRouteStore.js +0 -39
  295. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +0 -27
  296. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +0 -9
  297. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +0 -11
  298. package/components/GasSufficiencyMessage/index.d.ts +0 -1
  299. package/components/GasSufficiencyMessage/index.js +0 -1
  300. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +0 -2
  301. package/components/SwapRoutes/useSetRecommendedRoute.js +0 -9
  302. package/config/env.d.ts +0 -3
  303. package/config/env.js +0 -3
  304. package/stores/routes/useRecommendedRouteStore.d.ts +0 -10
  305. package/stores/routes/useRecommendedRouteStore.js +0 -32
@@ -6,7 +6,7 @@ export declare const Link: import("@emotion/styled").StyledComponent<Omit<import
6
6
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
7
7
  TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
8
8
  underline?: "none" | "always" | "hover" | undefined;
9
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
9
+ variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
10
10
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
11
11
  ref?: ((instance: HTMLAnchorElement | null) => void) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
12
12
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "underline" | "TypographyClasses"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -2,11 +2,11 @@
2
2
  export declare const IconButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
5
- color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
5
+ color?: import("@mui/types").OverridableStringUnion<"inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").IconButtonPropsColorOverrides> | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
9
- size?: "small" | "medium" | "large" | undefined;
9
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").IconButtonPropsSizeOverrides> | undefined;
10
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
11
  } & Omit<{
12
12
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
@@ -1,24 +1,46 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { isAddress } from '@ethersproject/address';
3
3
  import { Collapse, FormHelperText } from '@mui/material';
4
- import { forwardRef, useEffect } from 'react';
5
- import { useFormContext, useFormState } from 'react-hook-form';
4
+ import { forwardRef, useEffect, useRef } from 'react';
5
+ import { useController, useFormContext, useFormState } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { SwapFormKey, useWallet, useWidgetConfig } from '../../providers';
8
8
  import { useSendToWalletStore, useSettings } from '../../stores';
9
- import { DisabledUI, HiddenUI } from '../../types';
9
+ import { DisabledUI, HiddenUI, RequiredUI } from '../../types';
10
10
  import { Card, CardTitle } from '../Card';
11
11
  import { FormControl, Input } from './SendToWallet.style';
12
12
  export const SendToWallet = forwardRef((props, ref) => {
13
13
  const { t } = useTranslation();
14
- const { register, unregister, trigger, getValues, clearErrors } = useFormContext();
14
+ const { trigger, getValues, clearErrors } = useFormContext();
15
15
  const { account, provider } = useWallet();
16
16
  const { disabledUI, hiddenUI, requiredUI, toAddress } = useWidgetConfig();
17
17
  const { showSendToWallet, showSendToWalletDirty, setSendToWallet } = useSendToWalletStore();
18
18
  const { showDestinationWallet } = useSettings(['showDestinationWallet']);
19
19
  const hiddenToAddress = hiddenUI?.includes(HiddenUI.ToAddress);
20
20
  const disabledToAddress = disabledUI?.includes(DisabledUI.ToAddress);
21
- const requiredToAddress = requiredUI?.includes(DisabledUI.ToAddress);
21
+ const requiredToAddress = requiredUI?.includes(RequiredUI.ToAddress);
22
+ const requiredToAddressRef = useRef(requiredToAddress);
23
+ const { field: { onChange, onBlur, name, value }, } = useController({
24
+ name: SwapFormKey.ToAddress,
25
+ rules: {
26
+ required: requiredToAddress &&
27
+ t('swap.error.title.walletAddressRequired'),
28
+ validate: async (value) => {
29
+ try {
30
+ if (!value) {
31
+ return true;
32
+ }
33
+ const address = await provider?.resolveName(value);
34
+ return (isAddress(address || value) ||
35
+ t('swap.error.title.walletAddressInvalid'));
36
+ }
37
+ catch {
38
+ return t('swap.error.title.walletEnsAddressInvalid');
39
+ }
40
+ },
41
+ onBlur: () => trigger(SwapFormKey.ToAddress),
42
+ },
43
+ });
22
44
  // We want to show toAddress field if it is set via widget configuration and not hidden
23
45
  const showInstantly = Boolean(!showSendToWalletDirty &&
24
46
  showDestinationWallet &&
@@ -33,33 +55,17 @@ export const SendToWallet = forwardRef((props, ref) => {
33
55
  const value = getValues(SwapFormKey.ToAddress);
34
56
  if (value) {
35
57
  trigger(SwapFormKey.ToAddress);
58
+ // Trigger validation if we change requiredToAddress in the runtime
36
59
  }
37
- }, [account.chainId, getValues, trigger]);
38
- useEffect(() => {
39
- unregister(SwapFormKey.ToAddress);
40
- }, [requiredToAddress, unregister]);
60
+ else if (requiredToAddressRef.current !== requiredToAddress) {
61
+ requiredToAddressRef.current = requiredToAddress;
62
+ trigger(SwapFormKey.ToAddress).then(() => clearErrors(SwapFormKey.ToAddress));
63
+ }
64
+ }, [account.chainId, clearErrors, getValues, requiredToAddress, trigger]);
41
65
  if (hiddenToAddress) {
42
66
  return null;
43
67
  }
44
- const { onChange, onBlur, name, ref: inputRef, } = register(SwapFormKey.ToAddress, {
45
- required: requiredToAddress &&
46
- t('swap.error.title.walletAddressRequired'),
47
- validate: async (value) => {
48
- try {
49
- if (!value) {
50
- return true;
51
- }
52
- const address = await provider?.resolveName(value);
53
- return (isAddress(address || value) ||
54
- t('swap.error.title.walletAddressInvalid'));
55
- }
56
- catch {
57
- return t('swap.error.title.walletEnsAddressInvalid');
58
- }
59
- },
60
- onBlur: () => trigger(SwapFormKey.ToAddress),
61
- });
62
- return (_jsx(Collapse, { timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Card, { ...props, ref: ref, children: [_jsx(CardTitle, { required: requiredToAddress, children: t('swap.sendToWallet') }), _jsxs(FormControl, { fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' }, children: [_jsx(Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns'), disabled: Boolean(toAddress && disabledToAddress) }), _jsx(SendToWalletFormHelperText, {})] })] }) }));
68
+ return (_jsx(Collapse, { timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Card, { ...props, ref: ref, children: [_jsx(CardTitle, { required: requiredToAddress, children: t('swap.sendToWallet') }), _jsxs(FormControl, { fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' }, children: [_jsx(Input, { size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, value: value, placeholder: t('swap.walletAddressOrEns'), disabled: Boolean(toAddress && disabledToAddress) }), _jsx(SendToWalletFormHelperText, {})] })] }) }));
63
69
  });
64
70
  export const SendToWalletFormHelperText = () => {
65
71
  const { errors } = useFormState();
@@ -2,7 +2,7 @@
2
2
  export declare const FormControl: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
5
- color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
5
+ color?: import("@mui/types").OverridableStringUnion<"success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").FormControlPropsColorOverrides> | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  error?: boolean | undefined;
8
8
  fullWidth?: boolean | undefined;
@@ -10,7 +10,7 @@ export declare const FormControl: import("@emotion/styled").StyledComponent<{
10
10
  hiddenLabel?: boolean | undefined;
11
11
  margin?: "normal" | "none" | "dense" | undefined;
12
12
  required?: boolean | undefined;
13
- size?: "small" | "medium" | undefined;
13
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium", import("@mui/material").FormControlPropsSizeOverrides> | undefined;
14
14
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
15
  variant?: "outlined" | "filled" | "standard" | undefined;
16
16
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import WalletOutlinedIcon from '@mui/icons-material/WalletOutlined';
2
+ import WalletIcon from '@mui/icons-material/Wallet';
3
3
  import { Button, Tooltip } from '@mui/material';
4
4
  import { useFormContext } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { SwapFormKey, useWallet, useWidgetConfig } from '../../providers';
7
7
  import { useSendToWalletStore, useSettings } from '../../stores';
8
- import { DisabledUI, HiddenUI } from '../../types';
8
+ import { DisabledUI, HiddenUI, RequiredUI } from '../../types';
9
9
  export const SendToWalletButton = () => {
10
10
  const { t } = useTranslation();
11
11
  const { setValue } = useFormContext();
@@ -16,7 +16,7 @@ export const SendToWalletButton = () => {
16
16
  if (!showDestinationWallet ||
17
17
  !account.isActive ||
18
18
  hiddenUI?.includes(HiddenUI.ToAddress) ||
19
- requiredUI?.includes(HiddenUI.ToAddress)) {
19
+ requiredUI?.includes(RequiredUI.ToAddress)) {
20
20
  return null;
21
21
  }
22
22
  const handleClick = () => {
@@ -28,5 +28,5 @@ export const SendToWalletButton = () => {
28
28
  return (_jsx(Tooltip, { title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
29
29
  minWidth: 48,
30
30
  marginLeft: 1,
31
- }, children: _jsx(WalletOutlinedIcon, {}) }) }));
31
+ }, children: _jsx(WalletIcon, {}) }) }));
32
32
  };
@@ -10,7 +10,7 @@ export declare const SmallAvatar: import("@emotion/styled").StyledComponent<{
10
10
  src?: string | undefined;
11
11
  srcSet?: string | undefined;
12
12
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
13
- variant?: "square" | "circular" | "rounded" | undefined;
13
+ variant?: import("@mui/types").OverridableStringUnion<"square" | "circular" | "rounded", import("@mui/material").AvatarPropsVariantOverrides> | undefined;
14
14
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
15
15
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
16
16
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -20,7 +20,7 @@ export declare const SmallAvatarSkeletonBase: import("@emotion/styled").StyledCo
20
20
  classes?: Partial<import("@mui/material").SkeletonClasses> | undefined;
21
21
  height?: string | number | undefined;
22
22
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
23
- variant?: "text" | "circular" | "rounded" | "rectangular" | undefined;
23
+ variant?: import("@mui/types").OverridableStringUnion<"text" | "circular" | "rounded" | "rectangular", import("@mui/material").SkeletonPropsVariantOverrides> | undefined;
24
24
  width?: string | number | undefined;
25
25
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
26
26
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { Status, Substatus } from '@lifi/sdk';
3
- import { Theme } from '@mui/material';
3
+ import type { Theme } from '@mui/material';
4
4
  export declare const CircularIcon: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
5
5
  children?: import("react").ReactNode;
6
6
  component?: import("react").ElementType<any> | undefined;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import LinkRoundedIcon from '@mui/icons-material/LinkRounded';
3
- import WalletOutlinedIcon from '@mui/icons-material/WalletOutlined';
3
+ import WalletIcon from '@mui/icons-material/Wallet';
4
4
  import { Box, Link, Typography } from '@mui/material';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { CircularIcon } from './CircularProgress.style';
@@ -11,7 +11,7 @@ export const DestinationWalletAddress = ({ step, toAddress, toAddressLink }) =>
11
11
  return (_jsx(Box, { px: 2, py: 1, children: _jsxs(Box, { sx: {
12
12
  display: 'flex',
13
13
  alignItems: 'center',
14
- }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(WalletOutlinedIcon, { color: isDone ? 'success' : 'inherit', sx: {
14
+ }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(WalletIcon, { color: isDone ? 'success' : 'inherit', sx: {
15
15
  position: 'absolute',
16
16
  fontSize: '1rem',
17
17
  } }) }), _jsx(Typography, { ml: 2, fontSize: 14, fontWeight: 400, children: isDone
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import EvStationOutlinedIcon from '@mui/icons-material/EvStationOutlined';
2
+ import EvStationIcon from '@mui/icons-material/EvStation';
3
3
  import { Box, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { CircularIcon } from './CircularProgress.style';
@@ -9,7 +9,7 @@ export const GasStepProcess = ({ step }) => {
9
9
  return (_jsx(Box, { px: 2, py: 1, children: _jsxs(Box, { sx: {
10
10
  display: 'flex',
11
11
  alignItems: 'center',
12
- }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(EvStationOutlinedIcon, { color: isDone ? 'success' : 'inherit', sx: {
12
+ }, children: [_jsx(CircularIcon, { status: isDone ? 'DONE' : 'NOT_STARTED', children: _jsx(EvStationIcon, { color: isDone ? 'success' : 'inherit', sx: {
13
13
  position: 'absolute',
14
14
  fontSize: '1rem',
15
15
  } }) }), _jsxs(Typography, { ml: 2, fontSize: 14, fontWeight: 400, children: [t('format.currency', {
@@ -17,13 +17,15 @@ export const Step = ({ step, fromToken, toToken, toAddress }) => {
17
17
  const getCardTitle = () => {
18
18
  switch (step.type) {
19
19
  case 'lifi':
20
- if (step.includedSteps.every((step) => step.type === 'cross')) {
21
- return t('swap.stepBridge');
20
+ const hasCrossStep = step.includedSteps.some((step) => step.type === 'cross');
21
+ const hasSwapStep = step.includedSteps.some((step) => step.type === 'swap');
22
+ if (hasCrossStep && hasSwapStep) {
23
+ return t('swap.stepSwapAndBridge');
22
24
  }
23
- if (step.includedSteps.every((step) => step.type === 'swap')) {
24
- return t('swap.stepSwap');
25
+ if (hasCrossStep) {
26
+ return t('swap.stepBridge');
25
27
  }
26
- return t('swap.stepSwapAndBridge');
28
+ return t('swap.stepSwap');
27
29
  case 'swap':
28
30
  return t('swap.stepSwap');
29
31
  case 'cross':
@@ -1,2 +1,2 @@
1
- import { Route } from '@lifi/sdk';
1
+ import type { Route } from '@lifi/sdk';
2
2
  export declare const getStepList: (route?: Route) => JSX.Element[] | undefined;
@@ -2,11 +2,11 @@
2
2
  export declare const LinkButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
5
- color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
5
+ color?: import("@mui/types").OverridableStringUnion<"inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").IconButtonPropsColorOverrides> | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
9
- size?: "small" | "medium" | "large" | undefined;
9
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").IconButtonPropsSizeOverrides> | undefined;
10
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
11
  } & Omit<{
12
12
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
@@ -33,7 +33,7 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
33
33
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
34
34
  TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
35
35
  underline?: "none" | "always" | "hover" | undefined;
36
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
36
+ variant?: import("@mui/types").OverridableStringUnion<"inherit" | import("@mui/material").TypographyVariant, import("@mui/material").TypographyPropsVariantOverrides> | undefined;
37
37
  } & Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
38
38
  ref?: ((instance: HTMLAnchorElement | null) => void) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
39
39
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "underline" | "TypographyClasses">, {}, {}>;
@@ -3,6 +3,10 @@ import type { Step } from '@lifi/sdk';
3
3
  import type { WidgetVariant } from '../../types';
4
4
  import type { StepActionsProps, StepDetailsLabelProps } from './types';
5
5
  export declare const StepActions: React.FC<StepActionsProps>;
6
+ export declare const IncludedSteps: React.FC<{
7
+ step: Step;
8
+ variant?: WidgetVariant;
9
+ }>;
6
10
  export declare const StepDetailsContent: React.FC<{
7
11
  step: Step;
8
12
  variant?: WidgetVariant;
@@ -10,3 +14,4 @@ export declare const StepDetailsContent: React.FC<{
10
14
  export declare const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps>;
11
15
  export declare const CrossStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
12
16
  export declare const SwapStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
17
+ export declare const ProtocolStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
@@ -1,26 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
3
- import { Box, Step as MuiStep, Stepper, Typography } from '@mui/material';
3
+ import ExpandLessIcon from '@mui/icons-material/ExpandLess';
4
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
5
+ import { Badge, Box, Collapse, Step as MuiStep, Stepper, Typography, } from '@mui/material';
6
+ import Big from 'big.js';
7
+ import { useState } from 'react';
4
8
  import { useTranslation } from 'react-i18next';
5
9
  import { useChains } from '../../hooks';
6
10
  import { LiFiToolLogo } from '../../icons';
7
11
  import { useWidgetConfig } from '../../providers';
8
12
  import { formatTokenAmount } from '../../utils';
13
+ import { CardIconButton } from '../Card';
9
14
  import { SmallAvatar } from '../SmallAvatar';
10
15
  import { StepAvatar, StepConnector, StepContent, StepLabel, } from './StepActions.style';
11
16
  export const StepActions = ({ step, dense, ...other }) => {
17
+ const { t } = useTranslation();
12
18
  const { variant, contractTool } = useWidgetConfig();
13
- const StepDetailsLabel = step.tool === 'custom' && variant === 'nft'
14
- ? CustomStepDetailsLabel
15
- : step.type === 'cross' ||
16
- (step.type === 'lifi' &&
17
- step.includedSteps.some((step) => step.type === 'cross'))
18
- ? CrossStepDetailsLabel
19
- : SwapStepDetailsLabel;
20
- const isFullView = !dense && step.includedSteps?.length > 1;
19
+ const [cardExpanded, setCardExpanded] = useState(false);
20
+ const handleExpand = (e) => {
21
+ e.stopPropagation();
22
+ setCardExpanded((expanded) => !expanded);
23
+ };
21
24
  const customStep = variant === 'nft'
22
25
  ? step.includedSteps?.find((step) => step.type === 'custom')
23
26
  : undefined;
27
+ const hasCollapsedSteps = dense && step.includedSteps?.length > 1;
24
28
  if (customStep && contractTool) {
25
29
  const toolDetails = {
26
30
  key: contractTool.name,
@@ -28,10 +32,15 @@ export const StepActions = ({ step, dense, ...other }) => {
28
32
  logoURI: contractTool.logoURI,
29
33
  };
30
34
  customStep.toolDetails = toolDetails;
31
- if (!isFullView) {
35
+ if (dense) {
32
36
  step.toolDetails = toolDetails;
33
37
  }
34
38
  }
39
+ return (_jsxs(Box, { ...other, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(SmallAvatar, { children: _jsx(LiFiToolLogo, {}) }), children: _jsx(StepAvatar, { variant: "circular", src: step.toolDetails.logoURI, alt: step.toolDetails.name, children: step.toolDetails.name[0] }) }), _jsx(Typography, { ml: 2, fontSize: 18, fontWeight: "500", flex: 1, children: t(`swap.stepDetails`, {
40
+ tool: step.toolDetails.name,
41
+ }) }), hasCollapsedSteps ? (_jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), hasCollapsedSteps ? (_jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(IncludedSteps, { step: step, variant: variant }) })) : (_jsx(IncludedSteps, { step: step, variant: variant }))] }));
42
+ };
43
+ export const IncludedSteps = ({ step, variant }) => {
35
44
  // eslint-disable-next-line react/no-unstable-nested-components
36
45
  const StepIconComponent = ({ icon }) => {
37
46
  const tool = step.includedSteps?.[Number(icon) - 1];
@@ -39,16 +48,35 @@ export const StepActions = ({ step, dense, ...other }) => {
39
48
  boxSizing: 'content-box',
40
49
  }, children: tool.toolDetails.name[0] })) : null;
41
50
  };
42
- return (_jsxs(Box, { ...other, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1.5 : 0, children: [_jsx(StepAvatar, { variant: "circular", src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name, children: step.type === 'lifi' ? _jsx(LiFiToolLogo, {}) : step.toolDetails.name[0] }), _jsx(Typography, { ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize", children: step.type === 'lifi'
43
- ? 'LI.FI Smart Contract'
44
- : step.toolDetails.name })] }), isFullView ? (_jsx(Stepper, { orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => (_jsxs(MuiStep, { expanded: true, children: [_jsx(StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' && variant === 'nft' ? (_jsx(CustomStepDetailsLabel, { step: step, variant: variant })) : step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) }), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step, variant: variant }) })] }, step.id))) })) : (_jsxs(Box, { ml: 6, children: [_jsx(StepDetailsLabel, { step: step, variant: variant === 'nft' ? variant : undefined }), _jsx(StepDetailsContent, { step: step, variant: variant })] }))] }));
51
+ const StepDetailsLabel = step.tool === 'custom' && variant === 'nft'
52
+ ? CustomStepDetailsLabel
53
+ : step.type === 'cross' ||
54
+ (step.type === 'lifi' &&
55
+ step.includedSteps.some((step) => step.type === 'cross'))
56
+ ? CrossStepDetailsLabel
57
+ : SwapStepDetailsLabel;
58
+ return step.includedSteps.length > 1 ? (_jsx(Box, { mt: 1.5, children: _jsx(Stepper, { orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => (_jsxs(MuiStep, { expanded: true, children: [_jsx(StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' && variant === 'nft' ? (_jsx(CustomStepDetailsLabel, { step: step, variant: variant })) : step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : step.type === 'protocol' ? (_jsx(ProtocolStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) }), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step, variant: variant }) })] }, step.id))) }) })) : (_jsxs(Box, { ml: 6, children: [_jsx(StepDetailsLabel, { step: step, variant: variant === 'nft' ? variant : undefined }), _jsx(StepDetailsContent, { step: step, variant: variant })] }));
45
59
  };
46
60
  export const StepDetailsContent = ({ step, variant }) => {
47
61
  const { t } = useTranslation();
62
+ const sameTokenProtocolStep = step.action.fromToken.chainId === step.action.toToken.chainId &&
63
+ step.action.fromToken.address === step.action.toToken.address;
64
+ let fromAmount;
65
+ if (sameTokenProtocolStep) {
66
+ fromAmount = Big(step.estimate.fromAmount)
67
+ .div(10 ** step.action.fromToken.decimals)
68
+ .minus(Big(step.estimate.toAmount).div(10 ** step.action.toToken.decimals));
69
+ }
70
+ else {
71
+ fromAmount = formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals);
72
+ }
73
+ const showToAmount = step.type !== 'custom' &&
74
+ step.tool !== 'custom' &&
75
+ variant !== 'nft' &&
76
+ !sameTokenProtocolStep;
48
77
  return (_jsxs(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex", children: [t('format.number', {
49
- value: formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals),
50
- }), ' ', step.action.fromToken.symbol, !((step.type === 'custom' || step.tool === 'custom') &&
51
- variant === 'nft') ? (_jsxs(_Fragment, { children: [_jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
78
+ value: fromAmount,
79
+ }), ' ', step.action.fromToken.symbol, showToAmount ? (_jsxs(_Fragment, { children: [_jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
52
80
  value: formatTokenAmount(step.execution?.toAmount ?? step.estimate.toAmount, step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
53
81
  }), ' ', step.execution?.toToken?.symbol ?? step.action.toToken.symbol] })) : null] }));
54
82
  };
@@ -78,3 +106,11 @@ export const SwapStepDetailsLabel = ({ step }) => {
78
106
  tool: step.toolDetails.name,
79
107
  }) }));
80
108
  };
109
+ export const ProtocolStepDetailsLabel = ({ step }) => {
110
+ const { t } = useTranslation();
111
+ return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: step.toolDetails.key === 'lifuelProtocol'
112
+ ? t('swap.refuelStepDetails', {
113
+ tool: step.toolDetails.name,
114
+ })
115
+ : step.toolDetails.name }));
116
+ };
@@ -14,7 +14,7 @@ export declare const StepAvatar: import("@emotion/styled").StyledComponent<{
14
14
  src?: string | undefined;
15
15
  srcSet?: string | undefined;
16
16
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
- variant?: "square" | "circular" | "rounded" | undefined;
17
+ variant?: import("@mui/types").OverridableStringUnion<"square" | "circular" | "rounded", import("@mui/material").AvatarPropsVariantOverrides> | undefined;
18
18
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
20
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { useNavigate } from 'react-router-dom';
5
5
  import { useWallet, useWidgetConfig } from '../../providers';
6
6
  import { navigationRoutes } from '../../utils';
7
- export const SwapButton = ({ onClick, currentRoute, text, disabled, loading, }) => {
7
+ export const SwapButton = ({ onClick, hasRoute, text, disabled, loading, }) => {
8
8
  const { t } = useTranslation();
9
9
  const navigate = useNavigate();
10
10
  const { variant, walletManagement } = useWidgetConfig();
@@ -24,7 +24,7 @@ export const SwapButton = ({ onClick, currentRoute, text, disabled, loading, })
24
24
  };
25
25
  const getButtonText = () => {
26
26
  if (account.isActive) {
27
- if (!currentRoute) {
27
+ if (!hasRoute) {
28
28
  return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
29
29
  }
30
30
  if (text) {
@@ -1,7 +1,6 @@
1
- import type { Route } from '@lifi/sdk';
2
1
  export interface SwapButtonProps {
3
2
  onClick?(): void;
4
- currentRoute?: Route;
3
+ hasRoute?: boolean;
5
4
  text?: string;
6
5
  disabled?: boolean;
7
6
  loading?: boolean;
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
4
4
  export declare const FormControl: import("@emotion/styled").StyledComponent<{
5
5
  children?: import("react").ReactNode;
6
6
  classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
7
- color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
7
+ color?: import("@mui/types").OverridableStringUnion<"success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").FormControlPropsColorOverrides> | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  error?: boolean | undefined;
10
10
  fullWidth?: boolean | undefined;
@@ -12,7 +12,7 @@ export declare const FormControl: import("@emotion/styled").StyledComponent<{
12
12
  hiddenLabel?: boolean | undefined;
13
13
  margin?: "normal" | "none" | "dense" | undefined;
14
14
  required?: boolean | undefined;
15
- size?: "small" | "medium" | undefined;
15
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium", import("@mui/material").FormControlPropsSizeOverrides> | undefined;
16
16
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
17
  variant?: "outlined" | "filled" | "standard" | undefined;
18
18
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -2,17 +2,17 @@
2
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
5
- color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
5
+ color?: import("@mui/types").OverridableStringUnion<"inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info", import("@mui/material").ButtonPropsColorOverrides> | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableElevation?: boolean | undefined;
8
8
  disableFocusRipple?: boolean | undefined;
9
9
  endIcon?: import("react").ReactNode;
10
10
  fullWidth?: boolean | undefined;
11
11
  href?: string | undefined;
12
- size?: "small" | "medium" | "large" | undefined;
12
+ size?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "large", import("@mui/material").ButtonPropsSizeOverrides> | undefined;
13
13
  startIcon?: import("react").ReactNode;
14
14
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
- variant?: "text" | "outlined" | "contained" | undefined;
15
+ variant?: import("@mui/types").OverridableStringUnion<"text" | "outlined" | "contained", import("@mui/material").ButtonPropsVariantOverrides> | undefined;
16
16
  } & Omit<{
17
17
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
18
18
  centerRipple?: boolean | undefined;
@@ -1,22 +1,39 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InputAdornment, Skeleton } from '@mui/material';
3
+ import Big from 'big.js';
3
4
  import { useFormContext, useWatch } from 'react-hook-form';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { useTokenAddressBalance } from '../../hooks';
6
+ import { useChains, useGasRecommendation, useTokenAddressBalance, } from '../../hooks';
6
7
  import { SwapFormKeyHelper } from '../../providers';
8
+ import { formatTokenAmount } from '../../utils';
7
9
  import { Button } from './SwapInputAdornment.style';
8
10
  export const SwapInputEndAdornment = ({ formType }) => {
9
11
  const { t } = useTranslation();
10
12
  const { setValue } = useFormContext();
13
+ const { getChainById } = useChains();
11
14
  const [chainId, tokenAddress] = useWatch({
12
15
  name: [
13
16
  SwapFormKeyHelper.getChainKey(formType),
14
17
  SwapFormKeyHelper.getTokenKey(formType),
15
18
  ],
16
19
  });
20
+ const { data } = useGasRecommendation(chainId);
17
21
  const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
18
22
  const handleMax = () => {
19
- setValue(SwapFormKeyHelper.getAmountKey(formType), token?.amount ?? '', {
23
+ const chain = getChainById(chainId);
24
+ let maxAmount;
25
+ if (chain?.nativeToken.address === tokenAddress &&
26
+ data?.available &&
27
+ data?.recommended) {
28
+ const tokenAmount = Big(token?.amount ?? 0);
29
+ const recommendedAmount = Big(data.recommended.amount)
30
+ .div(10 ** data.recommended.token.decimals)
31
+ .div(2);
32
+ if (tokenAmount.gt(recommendedAmount)) {
33
+ maxAmount = formatTokenAmount(tokenAmount.minus(recommendedAmount).toString());
34
+ }
35
+ }
36
+ setValue(SwapFormKeyHelper.getAmountKey(formType), maxAmount || token?.amount || '', {
20
37
  shouldTouch: true,
21
38
  });
22
39
  };
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { CardProps } from '../Card';
3
- import type { SwapRouteCardEssentialsProps, SwapRouteCardProps } from './types';
3
+ import type { SwapRouteCardProps } from './types';
4
4
  export declare const SwapRouteCard: React.FC<SwapRouteCardProps & Omit<CardProps, 'variant'>>;
5
- export declare const SwapRouteCardEssentials: React.FC<SwapRouteCardEssentialsProps>;