@lifi/widget 3.24.3 → 3.25.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/dist/esm/AppDefault.js +3 -3
  2. package/dist/esm/AppDefault.js.map +1 -1
  3. package/dist/esm/AppDrawer.style.d.ts +1 -1
  4. package/dist/esm/AppProvider.js +2 -2
  5. package/dist/esm/AppProvider.js.map +1 -1
  6. package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
  7. package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
  8. package/dist/esm/components/AmountInput/AmountInput.style.js +1 -1
  9. package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
  10. package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
  11. package/dist/esm/components/AppContainer.js +6 -13
  12. package/dist/esm/components/AppContainer.js.map +1 -1
  13. package/dist/esm/components/Avatar/Avatar.style.js +1 -1
  14. package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
  15. package/dist/esm/components/ButtonTertiary.d.ts +1 -1
  16. package/dist/esm/components/Card/CardButton.style.js +1 -1
  17. package/dist/esm/components/Card/CardButton.style.js.map +1 -1
  18. package/dist/esm/components/Card/CardHeader.js +1 -1
  19. package/dist/esm/components/Card/CardHeader.js.map +1 -1
  20. package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
  21. package/dist/esm/components/Card/CardLabel.js +1 -1
  22. package/dist/esm/components/Card/CardLabel.js.map +1 -1
  23. package/dist/esm/components/Card/CardTitle.js +1 -1
  24. package/dist/esm/components/Card/CardTitle.js.map +1 -1
  25. package/dist/esm/components/ChainSelect/ChainSelect.js +1 -1
  26. package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
  27. package/dist/esm/components/ChainSelect/useChainSelect.js +13 -2
  28. package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
  29. package/dist/esm/components/Chains/ChainList.d.ts +13 -0
  30. package/dist/esm/components/Chains/ChainList.js +17 -0
  31. package/dist/esm/components/Chains/ChainList.js.map +1 -0
  32. package/dist/esm/components/Chains/ChainList.style.d.ts +14 -0
  33. package/dist/esm/components/Chains/ChainList.style.js +38 -0
  34. package/dist/esm/components/Chains/ChainList.style.js.map +1 -0
  35. package/dist/esm/components/Chains/ChainListItem.d.ts +11 -0
  36. package/dist/esm/components/Chains/ChainListItem.js +11 -0
  37. package/dist/esm/components/Chains/ChainListItem.js.map +1 -0
  38. package/dist/esm/components/Chains/ChainSearchInput.d.ts +10 -0
  39. package/dist/esm/components/Chains/ChainSearchInput.js +19 -0
  40. package/dist/esm/components/Chains/ChainSearchInput.js.map +1 -0
  41. package/dist/esm/components/Chains/ChainsExpanded.d.ts +7 -0
  42. package/dist/esm/components/Chains/ChainsExpanded.js +11 -0
  43. package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -0
  44. package/dist/esm/components/Chains/ChainsExpanded.style.d.ts +6 -0
  45. package/dist/esm/components/Chains/ChainsExpanded.style.js +16 -0
  46. package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -0
  47. package/dist/esm/components/Chains/SelectChainContent.d.ts +9 -0
  48. package/dist/esm/components/Chains/SelectChainContent.js +60 -0
  49. package/dist/esm/components/Chains/SelectChainContent.js.map +1 -0
  50. package/dist/esm/components/Chains/VirtualizedChainList.d.ts +11 -0
  51. package/dist/esm/components/Chains/VirtualizedChainList.js +40 -0
  52. package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -0
  53. package/dist/esm/components/Expansion/Expansion.d.ts +1 -0
  54. package/dist/esm/components/Expansion/Expansion.js +41 -0
  55. package/dist/esm/components/Expansion/Expansion.js.map +1 -0
  56. package/dist/esm/components/Expansion/ExpansionTransition.d.ts +9 -0
  57. package/dist/esm/components/Expansion/ExpansionTransition.js +45 -0
  58. package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -0
  59. package/dist/esm/components/Header/Header.js +1 -1
  60. package/dist/esm/components/Header/Header.js.map +1 -1
  61. package/dist/esm/components/Header/Header.style.d.ts +1 -1
  62. package/dist/esm/components/Header/Header.style.js +0 -1
  63. package/dist/esm/components/Header/Header.style.js.map +1 -1
  64. package/dist/esm/components/Header/NavigationHeader.js +2 -2
  65. package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
  66. package/dist/esm/components/Header/SettingsButton.style.d.ts +1 -1
  67. package/dist/esm/components/Header/SettingsButton.style.js +1 -1
  68. package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
  69. package/dist/esm/components/ListItem/ListItem.js +1 -1
  70. package/dist/esm/components/ListItem/ListItem.js.map +1 -1
  71. package/dist/esm/components/ListItemButton.js +13 -1
  72. package/dist/esm/components/ListItemButton.js.map +1 -1
  73. package/dist/esm/components/ListItemText.js +1 -1
  74. package/dist/esm/components/ListItemText.js.map +1 -1
  75. package/dist/esm/components/ProgressToNextUpdate.js +1 -1
  76. package/dist/esm/components/ProgressToNextUpdate.js.map +1 -1
  77. package/dist/esm/components/RouteCard/RouteCard.js +4 -4
  78. package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
  79. package/dist/esm/components/RouteCard/RouteCardEssentials.js +5 -5
  80. package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
  81. package/dist/esm/components/RouteCard/RouteNotFoundCard.js +1 -0
  82. package/dist/esm/components/RouteCard/RouteNotFoundCard.js.map +1 -1
  83. package/dist/esm/components/RouteCard/getMatchingLabels.js +5 -3
  84. package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
  85. package/dist/esm/components/Routes/Routes.js +1 -1
  86. package/dist/esm/components/Routes/Routes.js.map +1 -1
  87. package/dist/esm/components/Routes/RoutesContent.d.ts +14 -0
  88. package/dist/esm/components/Routes/RoutesContent.js +55 -0
  89. package/dist/esm/components/Routes/RoutesContent.js.map +1 -0
  90. package/dist/esm/components/Routes/RoutesExpanded.d.ts +7 -2
  91. package/dist/esm/components/Routes/RoutesExpanded.js +12 -70
  92. package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
  93. package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -3
  94. package/dist/esm/components/Routes/RoutesExpanded.style.js +4 -16
  95. package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
  96. package/dist/esm/components/Search/SearchInput.d.ts +5 -2
  97. package/dist/esm/components/Search/SearchInput.js +7 -3
  98. package/dist/esm/components/Search/SearchInput.js.map +1 -1
  99. package/dist/esm/components/Search/SearchInput.style.d.ts +4 -1
  100. package/dist/esm/components/Search/SearchInput.style.js +25 -3
  101. package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
  102. package/dist/esm/components/Search/SearchNotFound.style.js +2 -1
  103. package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
  104. package/dist/esm/components/Select.js +1 -1
  105. package/dist/esm/components/Select.js.map +1 -1
  106. package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js +1 -1
  107. package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
  108. package/dist/esm/components/SendToWallet/SendToWalletButton.js +2 -7
  109. package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  110. package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +2 -2
  111. package/dist/esm/components/Skeleton/WidgetSkeleton.style.js +0 -1
  112. package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
  113. package/dist/esm/components/Step/CircularProgress.style.js +1 -1
  114. package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
  115. package/dist/esm/components/StepActions/StepActions.js +3 -3
  116. package/dist/esm/components/StepActions/StepActions.style.js +1 -1
  117. package/dist/esm/components/StepActions/StepActions.style.js.map +1 -1
  118. package/dist/esm/components/TextFitter/TextFitter.js +1 -1
  119. package/dist/esm/components/TextFitter/TextFitter.js.map +1 -1
  120. package/dist/esm/components/Token/Token.js +2 -2
  121. package/dist/esm/components/Token/Token.js.map +1 -1
  122. package/dist/esm/components/Token/Token.style.js +1 -1
  123. package/dist/esm/components/Token/Token.style.js.map +1 -1
  124. package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
  125. package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
  126. package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js +1 -1
  127. package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js.map +1 -1
  128. package/dist/esm/components/TokenList/TokenList.js +3 -3
  129. package/dist/esm/components/TokenList/TokenList.js.map +1 -1
  130. package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -1
  131. package/dist/esm/components/TokenList/TokenList.style.js +6 -1
  132. package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
  133. package/dist/esm/components/TokenList/TokenListItem.js +16 -7
  134. package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
  135. package/dist/esm/components/TokenList/VirtualizedTokenList.js +13 -7
  136. package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  137. package/dist/esm/components/TokenList/types.d.ts +3 -0
  138. package/dist/esm/components/TokenRate/TokenRate.js +1 -1
  139. package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
  140. package/dist/esm/components/TokenRate/TokenRate.style.js +1 -1
  141. package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
  142. package/dist/esm/components/TransactionDetails.js +7 -9
  143. package/dist/esm/components/TransactionDetails.js.map +1 -1
  144. package/dist/esm/config/version.d.ts +1 -1
  145. package/dist/esm/config/version.js +1 -1
  146. package/dist/esm/config/version.js.map +1 -1
  147. package/dist/esm/hooks/timer/time.js +1 -1
  148. package/dist/esm/hooks/timer/time.js.map +1 -1
  149. package/dist/esm/hooks/timer/useTimer.js.map +1 -1
  150. package/dist/esm/hooks/useAvailableChains.js +3 -2
  151. package/dist/esm/hooks/useAvailableChains.js.map +1 -1
  152. package/dist/esm/hooks/useChains.js +4 -4
  153. package/dist/esm/hooks/useChains.js.map +1 -1
  154. package/dist/esm/hooks/useExpansionRoutes.d.ts +2 -0
  155. package/dist/esm/hooks/useExpansionRoutes.js +26 -0
  156. package/dist/esm/hooks/useExpansionRoutes.js.map +1 -0
  157. package/dist/esm/hooks/useHasChainExpansion.d.ts +2 -0
  158. package/dist/esm/hooks/useHasChainExpansion.js +16 -0
  159. package/dist/esm/hooks/useHasChainExpansion.js.map +1 -0
  160. package/dist/esm/hooks/useIsBatchingSupported.js +4 -1
  161. package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
  162. package/dist/esm/hooks/useListHeight.js +1 -1
  163. package/dist/esm/hooks/useListHeight.js.map +1 -1
  164. package/dist/esm/hooks/useRouteExecution.js +3 -3
  165. package/dist/esm/hooks/useRouteExecution.js.map +1 -1
  166. package/dist/esm/hooks/useRoutes.js +6 -3
  167. package/dist/esm/hooks/useRoutes.js.map +1 -1
  168. package/dist/esm/hooks/useToAddressReset.js +10 -2
  169. package/dist/esm/hooks/useToAddressReset.js.map +1 -1
  170. package/dist/esm/hooks/useTokenBalance.js.map +1 -1
  171. package/dist/esm/hooks/useTokenBalances.js +1 -0
  172. package/dist/esm/hooks/useTokenBalances.js.map +1 -1
  173. package/dist/esm/hooks/useTokenSearch.js +6 -4
  174. package/dist/esm/hooks/useTokenSearch.js.map +1 -1
  175. package/dist/esm/hooks/useTokens.js +5 -3
  176. package/dist/esm/hooks/useTokens.js.map +1 -1
  177. package/dist/esm/hooks/useTools.js +5 -3
  178. package/dist/esm/hooks/useTools.js.map +1 -1
  179. package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
  180. package/dist/esm/hooks/useWidgetEvents.js.map +1 -1
  181. package/dist/esm/i18n/bn.json +2 -1
  182. package/dist/esm/i18n/de.json +2 -1
  183. package/dist/esm/i18n/en.json +2 -1
  184. package/dist/esm/i18n/es.json +2 -1
  185. package/dist/esm/i18n/fr.json +2 -1
  186. package/dist/esm/i18n/hi.json +1 -0
  187. package/dist/esm/i18n/id.json +2 -1
  188. package/dist/esm/i18n/it.json +2 -1
  189. package/dist/esm/i18n/ja.json +2 -1
  190. package/dist/esm/i18n/ko.json +2 -1
  191. package/dist/esm/i18n/pl.json +350 -0
  192. package/dist/esm/i18n/pt.json +2 -1
  193. package/dist/esm/i18n/th.json +2 -1
  194. package/dist/esm/i18n/tr.json +2 -1
  195. package/dist/esm/i18n/uk.json +14 -13
  196. package/dist/esm/i18n/vi.json +2 -1
  197. package/dist/esm/i18n/zh.json +2 -1
  198. package/dist/esm/index.d.ts +8 -8
  199. package/dist/esm/index.js +8 -8
  200. package/dist/esm/index.js.map +1 -1
  201. package/dist/esm/pages/RoutesPage/RoutesPage.js +1 -1
  202. package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  203. package/dist/esm/pages/SelectChainPage/SelectChainPage.js +7 -33
  204. package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
  205. package/dist/esm/pages/SelectEnabledToolsPage.js +1 -1
  206. package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
  207. package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +1 -1
  208. package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  209. package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +20 -11
  210. package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
  211. package/dist/esm/pages/SendToWallet/BookmarksPage.js +1 -1
  212. package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
  213. package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -2
  214. package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js +1 -1
  215. package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
  216. package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js +1 -1
  217. package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
  218. package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +1 -3
  219. package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
  220. package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +1 -1
  221. package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
  222. package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +8 -5
  223. package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
  224. package/dist/esm/pages/TransactionPage/RouteTracker.js +2 -2
  225. package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
  226. package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +4 -4
  227. package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
  228. package/dist/esm/providers/I18nProvider/I18nProvider.js +8 -4
  229. package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
  230. package/dist/esm/providers/QueryClientProvider.js.map +1 -1
  231. package/dist/esm/providers/WalletProvider/SDKProviders.js +1 -1
  232. package/dist/esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  233. package/dist/esm/providers/WalletProvider/SuiBaseProvider.js +1 -1
  234. package/dist/esm/providers/WalletProvider/SuiBaseProvider.js.map +1 -1
  235. package/dist/esm/providers/WalletProvider/WalletProvider.js +1 -1
  236. package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +1 -1
  237. package/dist/esm/stores/chains/ChainOrderStore.js +5 -3
  238. package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
  239. package/dist/esm/stores/form/FormStore.js +1 -1
  240. package/dist/esm/stores/form/FormStore.js.map +1 -1
  241. package/dist/esm/stores/form/FormUpdater.js +21 -5
  242. package/dist/esm/stores/form/FormUpdater.js.map +1 -1
  243. package/dist/esm/stores/form/URLSearchParamsBuilder.js +1 -1
  244. package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
  245. package/dist/esm/stores/form/useFormRef.js.map +1 -1
  246. package/dist/esm/stores/routes/createRouteExecutionStore.js +1 -1
  247. package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
  248. package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
  249. package/dist/esm/types/widget.d.ts +25 -6
  250. package/dist/esm/types/widget.js +6 -0
  251. package/dist/esm/types/widget.js.map +1 -1
  252. package/dist/esm/utils/deepEqual.js +2 -2
  253. package/dist/esm/utils/deepEqual.js.map +1 -1
  254. package/dist/esm/utils/item.d.ts +5 -15
  255. package/dist/esm/utils/item.js +23 -19
  256. package/dist/esm/utils/item.js.map +1 -1
  257. package/dist/esm/utils/widgetSize.d.ts +3 -0
  258. package/dist/esm/utils/widgetSize.js +11 -0
  259. package/dist/esm/utils/widgetSize.js.map +1 -0
  260. package/package.json +7 -6
  261. package/package.json.tmp +12 -6
  262. package/src/AppDefault.tsx +3 -3
  263. package/src/AppProvider.tsx +2 -2
  264. package/src/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
  265. package/src/components/AmountInput/AmountInput.style.tsx +1 -1
  266. package/src/components/AppContainer.tsx +6 -14
  267. package/src/components/Avatar/Avatar.style.tsx +2 -2
  268. package/src/components/Card/CardButton.style.tsx +1 -1
  269. package/src/components/Card/CardHeader.tsx +1 -1
  270. package/src/components/Card/CardLabel.tsx +1 -1
  271. package/src/components/Card/CardTitle.tsx +1 -1
  272. package/src/components/ChainSelect/ChainSelect.tsx +1 -1
  273. package/src/components/ChainSelect/useChainSelect.ts +37 -23
  274. package/src/components/Chains/ChainList.style.tsx +59 -0
  275. package/src/components/Chains/ChainList.tsx +86 -0
  276. package/src/components/Chains/ChainListItem.tsx +52 -0
  277. package/src/components/Chains/ChainSearchInput.tsx +52 -0
  278. package/src/components/Chains/ChainsExpanded.style.tsx +21 -0
  279. package/src/components/Chains/ChainsExpanded.tsx +28 -0
  280. package/src/components/Chains/SelectChainContent.tsx +116 -0
  281. package/src/components/Chains/VirtualizedChainList.tsx +84 -0
  282. package/src/components/Expansion/Expansion.tsx +62 -0
  283. package/src/components/Expansion/ExpansionTransition.tsx +76 -0
  284. package/src/components/Header/Header.style.ts +0 -1
  285. package/src/components/Header/Header.tsx +1 -1
  286. package/src/components/Header/NavigationHeader.tsx +2 -2
  287. package/src/components/Header/SettingsButton.style.tsx +1 -1
  288. package/src/components/ListItem/ListItem.tsx +1 -1
  289. package/src/components/ListItemButton.tsx +17 -1
  290. package/src/components/ListItemText.tsx +1 -1
  291. package/src/components/ProgressToNextUpdate.tsx +1 -1
  292. package/src/components/RouteCard/RouteCard.tsx +4 -4
  293. package/src/components/RouteCard/RouteCardEssentials.tsx +5 -5
  294. package/src/components/RouteCard/RouteNotFoundCard.tsx +1 -0
  295. package/src/components/RouteCard/getMatchingLabels.ts +11 -3
  296. package/src/components/Routes/Routes.tsx +1 -1
  297. package/src/components/Routes/RoutesContent.tsx +137 -0
  298. package/src/components/Routes/RoutesExpanded.style.ts +4 -18
  299. package/src/components/Routes/RoutesExpanded.tsx +33 -158
  300. package/src/components/Search/SearchInput.style.tsx +36 -3
  301. package/src/components/Search/SearchInput.tsx +31 -5
  302. package/src/components/Search/SearchNotFound.style.tsx +2 -1
  303. package/src/components/Select.tsx +1 -1
  304. package/src/components/SelectTokenButton/SelectTokenButton.style.tsx +1 -1
  305. package/src/components/SendToWallet/SendToWalletButton.tsx +2 -3
  306. package/src/components/Skeleton/WidgetSkeleton.style.tsx +0 -1
  307. package/src/components/Step/CircularProgress.style.tsx +1 -1
  308. package/src/components/StepActions/StepActions.style.tsx +1 -1
  309. package/src/components/StepActions/StepActions.tsx +3 -3
  310. package/src/components/TextFitter/TextFitter.tsx +1 -1
  311. package/src/components/Token/Token.style.tsx +1 -1
  312. package/src/components/Token/Token.tsx +2 -2
  313. package/src/components/TokenList/TokenDetailsSheet.tsx +1 -0
  314. package/src/components/TokenList/TokenDetailsSheetContent.style.tsx +1 -1
  315. package/src/components/TokenList/TokenDetailsSheetContent.tsx +1 -1
  316. package/src/components/TokenList/TokenList.style.tsx +11 -1
  317. package/src/components/TokenList/TokenList.tsx +6 -2
  318. package/src/components/TokenList/TokenListItem.tsx +53 -37
  319. package/src/components/TokenList/VirtualizedTokenList.tsx +17 -5
  320. package/src/components/TokenList/types.ts +3 -0
  321. package/src/components/TokenRate/TokenRate.style.ts +1 -1
  322. package/src/components/TokenRate/TokenRate.tsx +1 -1
  323. package/src/components/TransactionDetails.tsx +9 -9
  324. package/src/config/version.ts +1 -1
  325. package/src/hooks/timer/time.ts +1 -1
  326. package/src/hooks/timer/useTimer.ts +1 -1
  327. package/src/hooks/useAvailableChains.ts +8 -2
  328. package/src/hooks/useChains.ts +10 -4
  329. package/src/hooks/useExpansionRoutes.ts +29 -0
  330. package/src/hooks/useHasChainExpansion.ts +19 -0
  331. package/src/hooks/useIsBatchingSupported.ts +5 -2
  332. package/src/hooks/useListHeight.ts +1 -1
  333. package/src/hooks/useRouteExecution.ts +3 -3
  334. package/src/hooks/useRoutes.ts +8 -2
  335. package/src/hooks/useToAddressReset.ts +32 -21
  336. package/src/hooks/useTokenBalance.ts +1 -1
  337. package/src/hooks/useTokenBalances.ts +1 -0
  338. package/src/hooks/useTokenSearch.ts +23 -6
  339. package/src/hooks/useTokens.ts +16 -6
  340. package/src/hooks/useTools.ts +12 -4
  341. package/src/hooks/useTransactionDetails.ts +1 -1
  342. package/src/hooks/useWidgetEvents.ts +1 -0
  343. package/src/i18n/bn.json +2 -1
  344. package/src/i18n/de.json +2 -1
  345. package/src/i18n/en.json +2 -1
  346. package/src/i18n/es.json +2 -1
  347. package/src/i18n/fr.json +2 -1
  348. package/src/i18n/hi.json +1 -0
  349. package/src/i18n/id.json +2 -1
  350. package/src/i18n/it.json +2 -1
  351. package/src/i18n/ja.json +2 -1
  352. package/src/i18n/ko.json +2 -1
  353. package/src/i18n/pl.json +350 -0
  354. package/src/i18n/pt.json +2 -1
  355. package/src/i18n/th.json +2 -1
  356. package/src/i18n/tr.json +2 -1
  357. package/src/i18n/uk.json +14 -13
  358. package/src/i18n/vi.json +2 -1
  359. package/src/i18n/zh.json +2 -1
  360. package/src/index.ts +8 -8
  361. package/src/pages/RoutesPage/RoutesPage.tsx +1 -1
  362. package/src/pages/SelectChainPage/SelectChainPage.tsx +18 -71
  363. package/src/pages/SelectEnabledToolsPage.tsx +1 -1
  364. package/src/pages/SelectTokenPage/SearchTokenInput.tsx +2 -0
  365. package/src/pages/SelectTokenPage/SelectTokenPage.tsx +44 -22
  366. package/src/pages/SendToWallet/BookmarksPage.tsx +1 -1
  367. package/src/pages/SendToWallet/SendToWalletPage.style.tsx +3 -3
  368. package/src/pages/SettingsPage/SettingsCard/SettingCard.style.tsx +1 -1
  369. package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +1 -1
  370. package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +1 -1
  371. package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +12 -7
  372. package/src/pages/TransactionPage/RouteTracker.tsx +2 -2
  373. package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +4 -4
  374. package/src/providers/I18nProvider/I18nProvider.tsx +10 -4
  375. package/src/providers/QueryClientProvider.tsx +1 -1
  376. package/src/providers/WalletProvider/SDKProviders.tsx +1 -1
  377. package/src/providers/WalletProvider/SuiBaseProvider.tsx +1 -1
  378. package/src/providers/WalletProvider/WalletProvider.tsx +1 -1
  379. package/src/providers/WalletProvider/useExternalWalletProvider.ts +1 -1
  380. package/src/stores/chains/ChainOrderStore.tsx +8 -3
  381. package/src/stores/form/FormStore.tsx +1 -1
  382. package/src/stores/form/FormUpdater.tsx +40 -6
  383. package/src/stores/form/URLSearchParamsBuilder.tsx +1 -1
  384. package/src/stores/form/useFormRef.ts +50 -54
  385. package/src/stores/routes/createRouteExecutionStore.ts +1 -1
  386. package/src/stores/settings/useSettingsStore.ts +1 -0
  387. package/src/types/widget.ts +29 -6
  388. package/src/utils/deepEqual.ts +2 -2
  389. package/src/utils/item.ts +46 -40
  390. package/src/utils/widgetSize.ts +17 -0
@@ -5,10 +5,10 @@ import CheckBoxOutlined from '@mui/icons-material/CheckBoxOutlined'
5
5
  import IndeterminateCheckBoxOutlined from '@mui/icons-material/IndeterminateCheckBoxOutlined'
6
6
  import {
7
7
  Avatar,
8
+ debounce,
8
9
  IconButton,
9
10
  ListItemAvatar,
10
11
  Tooltip,
11
- debounce,
12
12
  useTheme,
13
13
  } from '@mui/material'
14
14
  import type { MouseEventHandler } from 'react'
@@ -24,7 +24,9 @@ export const SearchTokenInput = () => {
24
24
  placeholder={t('main.tokenSearch')}
25
25
  onChange={(e) => onChange((e.target as HTMLInputElement).value)}
26
26
  onBlur={onBlur}
27
+ onClear={() => setFieldValue('tokenSearchFilter', '')}
27
28
  value={value as string | undefined}
29
+ autoFocus
28
30
  />
29
31
  )
30
32
  }
@@ -1,5 +1,5 @@
1
1
  import { Box } from '@mui/material'
2
- import type { FC } from 'react'
2
+ import type { FC, RefObject } from 'react'
3
3
  import { useRef } from 'react'
4
4
  import { useTranslation } from 'react-i18next'
5
5
  import { ChainSelect } from '../../components/ChainSelect/ChainSelect.js'
@@ -10,24 +10,22 @@ import { useListHeight } from '../../hooks/useListHeight.js'
10
10
  import { useNavigateBack } from '../../hooks/useNavigateBack.js'
11
11
  import { useScrollableOverflowHidden } from '../../hooks/useScrollableContainer.js'
12
12
  import { useSwapOnly } from '../../hooks/useSwapOnly.js'
13
+ import { useWideVariant } from '../../hooks/useWideVariant.js'
13
14
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
14
- import type { FormTypeProps } from '../../stores/form/types.js'
15
+ import type { FormType, FormTypeProps } from '../../stores/form/types.js'
15
16
  import { HiddenUI } from '../../types/widget.js'
16
17
  import { SearchTokenInput } from './SearchTokenInput.js'
17
18
 
18
19
  export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
19
20
  useScrollableOverflowHidden()
20
- const { navigateBack } = useNavigateBack()
21
+
21
22
  const headerRef = useRef<HTMLElement>(null)
22
- const listParentRef = useRef<HTMLUListElement | null>(null)
23
- const { listHeight, minListHeight } = useListHeight({
24
- listParentRef,
25
- headerRef,
26
- })
27
23
 
28
24
  const swapOnly = useSwapOnly()
29
25
 
30
- const { subvariant, hiddenUI } = useWidgetConfig()
26
+ const { subvariant, hiddenUI, subvariantOptions } = useWidgetConfig()
27
+ const wideVariant = useWideVariant()
28
+
31
29
  const { t } = useTranslation()
32
30
  const title =
33
31
  formType === 'from'
@@ -39,7 +37,9 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
39
37
  useHeader(title)
40
38
 
41
39
  const hideChainSelect =
42
- (swapOnly && formType === 'to') || hiddenUI?.includes(HiddenUI.ChainSelect)
40
+ (wideVariant && (subvariantOptions?.wide?.enableChainSidebar ?? true)) ||
41
+ (swapOnly && formType === 'to') ||
42
+ hiddenUI?.includes(HiddenUI.ChainSelect)
43
43
 
44
44
  return (
45
45
  <FullPageContainer disableGutters>
@@ -59,18 +59,40 @@ export const SelectTokenPage: FC<FormTypeProps> = ({ formType }) => {
59
59
  <SearchTokenInput />
60
60
  </Box>
61
61
  </Box>
62
- <Box
63
- sx={{
64
- height: minListHeight,
65
- }}
66
- >
67
- <TokenList
68
- parentRef={listParentRef}
69
- height={listHeight}
70
- onClick={navigateBack}
71
- formType={formType}
72
- />
73
- </Box>
62
+ <WrappedTokenList
63
+ // Rerender component if variant changes (since chains tiles change height)
64
+ key={hideChainSelect ? 'without-offset' : 'with-offset'}
65
+ headerRef={headerRef}
66
+ formType={formType}
67
+ />
74
68
  </FullPageContainer>
75
69
  )
76
70
  }
71
+
72
+ type WrappedTokenListProps = {
73
+ headerRef: RefObject<HTMLElement | null>
74
+ formType: FormType
75
+ }
76
+
77
+ const WrappedTokenList = ({ headerRef, formType }: WrappedTokenListProps) => {
78
+ const { navigateBack } = useNavigateBack()
79
+ const listParentRef = useRef<HTMLUListElement | null>(null)
80
+ const { listHeight, minListHeight } = useListHeight({
81
+ listParentRef,
82
+ headerRef,
83
+ })
84
+ return (
85
+ <Box
86
+ sx={{
87
+ height: minListHeight,
88
+ }}
89
+ >
90
+ <TokenList
91
+ parentRef={listParentRef}
92
+ height={listHeight}
93
+ onClick={navigateBack}
94
+ formType={formType}
95
+ />
96
+ </Box>
97
+ )
98
+ }
@@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next'
9
9
  import { useNavigate } from 'react-router-dom'
10
10
  import { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'
11
11
  import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
12
- import { ListItemButton } from '../../components/ListItem//ListItemButton.js'
13
12
  import { ListItem } from '../../components/ListItem/ListItem.js'
13
+ import { ListItemButton } from '../../components/ListItem//ListItemButton.js'
14
14
  import { Menu } from '../../components/Menu.js'
15
15
  import { useExplorer } from '../../hooks/useExplorer.js'
16
16
  import { useHeader } from '../../hooks/useHeader.js'
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Alert,
3
+ alertClasses,
3
4
  Box,
4
5
  IconButton,
5
- List,
6
- Typography,
7
- alertClasses,
8
6
  inputBaseClasses,
7
+ List,
9
8
  styled,
9
+ Typography,
10
10
  } from '@mui/material'
11
11
  import { ButtonTertiary } from '../../components/ButtonTertiary.js'
12
12
  import { InputCard } from '../../components/Card/InputCard.js'
@@ -1,4 +1,4 @@
1
- import { Box, Badge as MuiBadge, badgeClasses, styled } from '@mui/material'
1
+ import { Box, badgeClasses, Badge as MuiBadge, styled } from '@mui/material'
2
2
 
3
3
  export const SettingsList = styled(Box)(({ theme }) => ({
4
4
  display: 'flex',
@@ -37,9 +37,9 @@ export const SettingCardExpandable: React.FC<
37
37
  </CardTitleContainer>
38
38
  {!expanded && value}
39
39
  </CardRowButton>
40
+ {/** biome-ignore lint/a11y/useSemanticElements: allowed in react */}
40
41
  <Collapse
41
42
  id={collapseId}
42
- // biome-ignore lint/a11y/useSemanticElements:
43
43
  role="region"
44
44
  aria-labelledby={buttonId}
45
45
  in={expanded}
@@ -1,6 +1,6 @@
1
1
  import Percent from '@mui/icons-material/Percent'
2
2
  import WarningRounded from '@mui/icons-material/WarningRounded'
3
- import { Box, Typography, debounce } from '@mui/material'
3
+ import { Box, debounce, Typography } from '@mui/material'
4
4
  import type { ChangeEventHandler, FocusEventHandler } from 'react'
5
5
  import { useCallback, useMemo, useRef, useState } from 'react'
6
6
  import { useTranslation } from 'react-i18next'
@@ -2,17 +2,16 @@ import type { FullStatusData } from '@lifi/sdk'
2
2
  import { Box, List } from '@mui/material'
3
3
  import { useVirtualizer } from '@tanstack/react-virtual'
4
4
  import type React from 'react'
5
- import { useRef } from 'react'
5
+ import { useCallback, useRef } from 'react'
6
6
  import { useTranslation } from 'react-i18next'
7
7
  import { PageContainer } from '../../components/PageContainer.js'
8
8
  import { useHeader } from '../../hooks/useHeader.js'
9
- import { useTransactionHistory } from '../../hooks/useTransactionHistory.js'
10
-
11
9
  import { useListHeight } from '../../hooks/useListHeight.js'
10
+ import { useTransactionHistory } from '../../hooks/useTransactionHistory.js'
11
+ import { minTransactionListHeight } from './constants.js'
12
12
  import { TransactionHistoryEmpty } from './TransactionHistoryEmpty.js'
13
13
  import { TransactionHistoryItem } from './TransactionHistoryItem.js'
14
14
  import { TransactionHistoryItemSkeleton } from './TransactionHistorySkeleton.js'
15
- import { minTransactionListHeight } from './constants.js'
16
15
 
17
16
  export const TransactionHistoryPage: React.FC = () => {
18
17
  // Parent ref and useVirtualizer should be in one file to avoid blank page (0 virtual items) issue
@@ -26,14 +25,20 @@ export const TransactionHistoryPage: React.FC = () => {
26
25
  listParentRef: parentRef,
27
26
  })
28
27
 
28
+ const getItemKey = useCallback(
29
+ (index: number) => {
30
+ return `${(transactions[index] as FullStatusData).transactionId}-${index}`
31
+ },
32
+ [transactions]
33
+ )
34
+
29
35
  const { getVirtualItems, getTotalSize } = useVirtualizer({
30
36
  count: transactions.length,
31
- overscan: 5,
37
+ overscan: 3,
32
38
  paddingEnd: 12,
33
39
  getScrollElement: () => parentRef.current,
34
40
  estimateSize: () => 186,
35
- getItemKey: (index) =>
36
- `${(transactions[index] as FullStatusData).transactionId}-${index}`,
41
+ getItemKey,
37
42
  })
38
43
 
39
44
  if (!transactions.length && !isLoading) {
@@ -33,7 +33,7 @@ export const RouteTracker = ({
33
33
  * This allows us to query the route using the same tool each time we refresh.
34
34
  * The observable and reviewable routes can be the same when we first enter the review page.
35
35
  */
36
- // biome-ignore lint/correctness/useExhaustiveDependencies:
36
+ // biome-ignore lint/correctness/useExhaustiveDependencies: run only when currentRoute changes
37
37
  useEffect(() => {
38
38
  if (
39
39
  observableRouteIdRef.current &&
@@ -57,7 +57,7 @@ export const RouteTracker = ({
57
57
 
58
58
  return (
59
59
  <ProgressToNextUpdate
60
- updatedAt={dataUpdatedAt || new Date().getTime()}
60
+ updatedAt={dataUpdatedAt || Date.now()}
61
61
  timeToUpdate={refetchTime}
62
62
  isLoading={isFetching}
63
63
  onClick={handleRefetch}
@@ -1,5 +1,5 @@
1
1
  import type { Route } from '@lifi/sdk'
2
- import { isGaslessStep } from '@lifi/sdk'
2
+ import { isRelayerStep } from '@lifi/sdk'
3
3
  import WarningRounded from '@mui/icons-material/WarningRounded'
4
4
  import { Box, Button, Typography } from '@mui/material'
5
5
  import type { RefObject } from 'react'
@@ -51,7 +51,7 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
51
51
  getAccumulatedFeeCostsBreakdown(route)
52
52
  const fromAmountUSD = Number.parseFloat(route.fromAmountUSD)
53
53
  const toAmountUSD = Number.parseFloat(route.toAmountUSD)
54
- const hasGaslessSupport = route.steps.some(isGaslessStep)
54
+ const hasRelayerSupport = route.steps.every(isRelayerStep)
55
55
  return (
56
56
  <Box
57
57
  ref={ref}
@@ -106,14 +106,14 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
106
106
  <Typography>{t('main.fees.network')}</Typography>
107
107
  <FeeBreakdownTooltip
108
108
  gasCosts={gasCosts}
109
- relayerSupport={hasGaslessSupport}
109
+ relayerSupport={hasRelayerSupport}
110
110
  >
111
111
  <Typography
112
112
  sx={{
113
113
  fontWeight: 600,
114
114
  }}
115
115
  >
116
- {hasGaslessSupport
116
+ {hasRelayerSupport
117
117
  ? t('main.fees.free')
118
118
  : t('format.currency', { value: gasCostUSD })}
119
119
  </Typography>
@@ -7,7 +7,7 @@ import { useSettings } from '../../stores/settings/useSettings.js'
7
7
  import { compactNumberFormatter } from '../../utils/compactNumberFormatter.js'
8
8
  import { currencyExtendedFormatter } from '../../utils/currencyExtendedFormatter.js'
9
9
  import { deepMerge } from '../../utils/deepMerge.js'
10
- import { isItemAllowed } from '../../utils/item.js'
10
+ import { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'
11
11
  import { percentFormatter } from '../../utils/percentFormatter.js'
12
12
  import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
13
13
  import type { LanguageKey, LanguageTranslationResources } from './types.js'
@@ -19,16 +19,22 @@ export const I18nProvider: React.FC<React.PropsWithChildren> = ({
19
19
  const { language } = useSettings(['language'])
20
20
 
21
21
  const i18n = useMemo(() => {
22
+ const languagesConfigSets = getConfigItemSets(
23
+ languages,
24
+ (languages) => new Set(languages)
25
+ )
22
26
  let resources = (Object.keys(supportedLanguages) as LanguageKey[])
23
- .filter((lng) => isItemAllowed(lng, languages))
27
+ .filter((lng) => isItemAllowedForSets(lng, languagesConfigSets))
24
28
  .reduce((resources, lng) => {
25
29
  resources[lng] = {
26
30
  translation: languageResources?.[lng]
27
31
  ? (deepMerge(
32
+ // biome-ignore lint/performance/noDynamicNamespaceImportAccess: TODO: make it dynamic
28
33
  supportedLanguages[lng],
29
34
  languageResources[lng]
30
- ) as any)
31
- : supportedLanguages[lng],
35
+ ) as LanguageTranslationResources)
36
+ : // biome-ignore lint/performance/noDynamicNamespaceImportAccess: TODO: make it dynamic
37
+ supportedLanguages[lng],
32
38
  }
33
39
  return resources
34
40
  }, {} as LanguageTranslationResources)
@@ -2,8 +2,8 @@ import {
2
2
  QueryClientContext as TanstackQueryClientContext,
3
3
  QueryClientProvider as TanstackQueryClientProvider,
4
4
  } from '@tanstack/react-query'
5
- import { useContext } from 'react'
6
5
  import type { PropsWithChildren } from 'react'
6
+ import { useContext } from 'react'
7
7
  import { queryClient } from '../config/queryClient'
8
8
 
9
9
  export const QueryClientProvider: React.FC<PropsWithChildren> = ({
@@ -1,7 +1,7 @@
1
1
  import { getConnectorClient as getBigmiConnectorClient } from '@bigmi/client'
2
2
  import { useConfig as useBigmiConfig } from '@bigmi/react'
3
3
  import type { SDKProvider } from '@lifi/sdk'
4
- import { ChainType, EVM, Solana, Sui, UTXO, config } from '@lifi/sdk'
4
+ import { ChainType, config, EVM, Solana, Sui, UTXO } from '@lifi/sdk'
5
5
  import { useCurrentWallet } from '@mysten/dapp-kit'
6
6
  import type { SignerWalletAdapter } from '@solana/wallet-adapter-base'
7
7
  import { useWallet } from '@solana/wallet-adapter-react'
@@ -1,8 +1,8 @@
1
1
  import { ChainId } from '@lifi/sdk'
2
2
  import {
3
+ createNetworkConfig,
3
4
  SuiClientProvider,
4
5
  WalletProvider,
5
- createNetworkConfig,
6
6
  } from '@mysten/dapp-kit'
7
7
  import { getFullnodeUrl } from '@mysten/sui/client'
8
8
  import { type FC, type PropsWithChildren, useMemo } from 'react'
@@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next'
5
5
  import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
6
6
  import { EVMProvider } from './EVMProvider.js'
7
7
  import { SDKProviders } from './SDKProviders.js'
8
- import { SVMProvider } from './SVMProvider.js'
9
8
  import { SuiProvider } from './SuiProvider.js'
9
+ import { SVMProvider } from './SVMProvider.js'
10
10
  import { UTXOProvider } from './UTXOProvider.js'
11
11
  import { useExternalWalletProvider } from './useExternalWalletProvider.js'
12
12
 
@@ -2,8 +2,8 @@ import { ChainType } from '@lifi/sdk'
2
2
  import { useContext, useMemo } from 'react'
3
3
  import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
4
4
  import { EVMExternalContext } from './EVMExternalContext.js'
5
- import { SVMExternalContext } from './SVMExternalContext.js'
6
5
  import { SuiExternalContext } from './SuiExternalContext.js'
6
+ import { SVMExternalContext } from './SVMExternalContext.js'
7
7
  import { UTXOExternalContext } from './UTXOExternalContext.js'
8
8
 
9
9
  interface ExternalWalletProvider {
@@ -4,7 +4,7 @@ import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
4
4
  import { useChains } from '../../hooks/useChains.js'
5
5
  import { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'
6
6
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
7
- import { isItemAllowed } from '../../utils/item.js'
7
+ import { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'
8
8
  import type { FormType } from '../form/types.js'
9
9
  import { useFieldActions } from '../form/useFieldActions.js'
10
10
  import type { PersistStoreProviderProps } from '../types.js'
@@ -40,9 +40,14 @@ export function ChainOrderStoreProvider({
40
40
  const configChainIds = chainsConfig?.[key]
41
41
  const isFromKey = key === 'from'
42
42
 
43
+ // Convert configChainIds to Sets for O(1) lookup
44
+ const configChainIdsSet = getConfigItemSets(
45
+ configChainIds,
46
+ (chainIds) => new Set(chainIds)
47
+ )
43
48
  const filteredChains = chains.filter((chain) => {
44
- const passesChainsConfigFilter = configChainIds
45
- ? isItemAllowed(chain.id, configChainIds)
49
+ const passesChainsConfigFilter = configChainIdsSet
50
+ ? isItemAllowedForSets(chain.id, configChainIdsSet)
46
51
  : true
47
52
  // If the integrator uses external wallet management and has not opted in for partial wallet management,
48
53
  // restrict the displayed chains to those compatible with external wallet management.
@@ -2,9 +2,9 @@ import type { PropsWithChildren } from 'react'
2
2
  import { useMemo, useRef } from 'react'
3
3
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
4
4
  import type { FormRef, ToAddress } from '../../types/widget.js'
5
+ import { createFormStore, formDefaultValues } from './createFormStore.js'
5
6
  import { FormStoreContext } from './FormStoreContext.js'
6
7
  import { FormUpdater } from './FormUpdater.js'
7
- import { createFormStore, formDefaultValues } from './createFormStore.js'
8
8
  import type { DefaultValues, FormStoreStore } from './types.js'
9
9
  import { useFormRef } from './useFormRef.js'
10
10
 
@@ -5,13 +5,19 @@ import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.j
5
5
  import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'
6
6
  import { formDefaultValues } from '../../stores/form/createFormStore.js'
7
7
  import { useSendToWalletActions } from '../../stores/settings/useSendToWalletStore.js'
8
+ import { isItemAllowed } from '../../utils/item.js'
8
9
  import type { DefaultValues } from './types.js'
9
10
  import { useFieldActions } from './useFieldActions.js'
10
11
 
11
12
  export const FormUpdater: React.FC<{
12
13
  reactiveFormValues: Partial<DefaultValues>
13
14
  }> = ({ reactiveFormValues }) => {
14
- const { fromChain, toChain, toAddress } = useWidgetConfig()
15
+ const {
16
+ fromChain,
17
+ toChain,
18
+ toAddress,
19
+ chains: configChains,
20
+ } = useWidgetConfig()
15
21
  const { account } = useAccount()
16
22
  const { chains } = useChains()
17
23
  const { setSendToWallet } = useSendToWalletActions()
@@ -21,21 +27,47 @@ export const FormUpdater: React.FC<{
21
27
 
22
28
  // Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
23
29
  useEffect(() => {
24
- const chainAllowed =
25
- account.chainId && chains?.some((chain) => chain.id === account.chainId)
30
+ const fromChainAllowed =
31
+ account.chainId &&
32
+ chains?.some(
33
+ (chain) =>
34
+ chain.id === account.chainId &&
35
+ isItemAllowed(chain.id, configChains?.from)
36
+ )
37
+ const toChainAllowed =
38
+ account.chainId &&
39
+ chains?.some(
40
+ (chain) =>
41
+ chain.id === account.chainId &&
42
+ isItemAllowed(chain.id, configChains?.to)
43
+ )
26
44
 
27
- if (!account.isConnected || !account.chainId || !chainAllowed) {
45
+ if (
46
+ !account.isConnected ||
47
+ !account.chainId ||
48
+ (!fromChainAllowed && !toChainAllowed)
49
+ ) {
28
50
  return
29
51
  }
30
52
 
31
- if (!fromChain && !isTouched('fromChain') && !isTouched('fromToken')) {
53
+ if (
54
+ !fromChain &&
55
+ !isTouched('fromChain') &&
56
+ !isTouched('fromToken') &&
57
+ fromChainAllowed
58
+ ) {
32
59
  resetField('fromChain', { defaultValue: account.chainId })
33
60
  setFieldValue('fromToken', '')
34
61
  if (isTouched('fromAmount')) {
35
62
  setFieldValue('fromAmount', '')
36
63
  }
37
64
  }
38
- if (!toChain && !isTouched('toChain') && !isTouched('toToken')) {
65
+ if (
66
+ !toChain &&
67
+ !isTouched('toChain') &&
68
+ !isTouched('toToken') &&
69
+ toChainAllowed
70
+ ) {
39
71
  resetField('toChain', { defaultValue: account.chainId })
40
72
  setFieldValue('toToken', '')
41
73
  }
@@ -48,6 +80,8 @@ export const FormUpdater: React.FC<{
48
80
  isTouched,
49
81
  resetField,
50
82
  setFieldValue,
83
+ configChains?.from,
84
+ configChains?.to,
51
85
  ])
52
86
 
53
87
  // Makes widget config options reactive to changes
@@ -104,7 +104,7 @@ export const URLSearchParamsBuilder = () => {
104
104
  addRecentWallet,
105
105
  ])
106
106
 
107
- // biome-ignore lint/correctness/useExhaustiveDependencies:
107
+ // biome-ignore lint/correctness/useExhaustiveDependencies: run only when pathname changes
108
108
  useEffect(() => {
109
109
  // set the values on the querysting
110
110
  const url = new URL(window.location as any)
@@ -9,58 +9,54 @@ export const useFormRef = (formStore: FormStoreStore, formRef?: FormRef) => {
9
9
  const { setSendToWallet } = useSendToWalletActions()
10
10
  const { setSelectedBookmark } = useBookmarkActions()
11
11
 
12
- useImperativeHandle(
13
- formRef,
14
- () => {
15
- const sanitizeValue: {
16
- [key: string]: (value: any) => GenericFormValue
17
- } = {
18
- fromAmount: (value) =>
19
- (typeof value === 'number' ? value?.toPrecision() : value) ||
20
- formDefaultValues.fromAmount,
21
- toAmount: (value) =>
22
- (typeof value === 'number' ? value?.toPrecision() : value) ||
23
- formDefaultValues.toAmount,
24
- toAddress: (value) => {
25
- const isToAddressObj = typeof value !== 'string'
26
-
27
- const address =
28
- (isToAddressObj ? value?.address : value) ||
29
- formDefaultValues.toAddress
30
-
31
- // sets the send to wallet button state to be open
32
- // if there is an address to display
33
- if (address) {
34
- setSendToWallet(address)
35
- }
36
-
37
- // we can assume that the toAddress has been passed as ToAddress object
38
- // and display it accordingly - this ensures that if a name is included
39
- // that it is displayed in the Send To Wallet form field correctly
40
- if (isToAddressObj) {
41
- setSelectedBookmark(value)
42
- }
43
-
44
- return address
45
- },
46
- }
47
-
48
- return {
49
- setFieldValue: (fieldName, value, options) => {
50
- const sanitizedValue = (
51
- sanitizeValue[fieldName] ? sanitizeValue[fieldName](value) : value
52
- ) as GenericFormValue
53
-
54
- const fieldValueOptions = options?.setUrlSearchParam
55
- ? { isTouched: options?.setUrlSearchParam }
56
- : undefined
57
-
58
- formStore
59
- .getState()
60
- .setFieldValue(fieldName, sanitizedValue, fieldValueOptions)
61
- },
62
- }
63
- },
64
- [formStore, setSendToWallet, setSelectedBookmark]
65
- )
12
+ useImperativeHandle(formRef, () => {
13
+ const sanitizeValue: {
14
+ [key: string]: (value: any) => GenericFormValue
15
+ } = {
16
+ fromAmount: (value) =>
17
+ (typeof value === 'number' ? value?.toPrecision() : value) ||
18
+ formDefaultValues.fromAmount,
19
+ toAmount: (value) =>
20
+ (typeof value === 'number' ? value?.toPrecision() : value) ||
21
+ formDefaultValues.toAmount,
22
+ toAddress: (value) => {
23
+ const isToAddressObj = typeof value !== 'string'
24
+
25
+ const address =
26
+ (isToAddressObj ? value?.address : value) ||
27
+ formDefaultValues.toAddress
28
+
29
+ // sets the send to wallet button state to be open
30
+ // if there is an address to display
31
+ if (address) {
32
+ setSendToWallet(address)
33
+ }
34
+
35
+ // we can assume that the toAddress has been passed as ToAddress object
36
+ // and display it accordingly - this ensures that if a name is included
37
+ // that it is displayed in the Send To Wallet form field correctly
38
+ if (isToAddressObj) {
39
+ setSelectedBookmark(value)
40
+ }
41
+
42
+ return address
43
+ },
44
+ }
45
+
46
+ return {
47
+ setFieldValue: (fieldName, value, options) => {
48
+ const sanitizedValue = (
49
+ sanitizeValue[fieldName] ? sanitizeValue[fieldName](value) : value
50
+ ) as GenericFormValue
51
+
52
+ const fieldValueOptions = options?.setUrlSearchParam
53
+ ? { isTouched: options?.setUrlSearchParam }
54
+ : undefined
55
+
56
+ formStore
57
+ .getState()
58
+ .setFieldValue(fieldName, sanitizedValue, fieldValueOptions)
59
+ },
60
+ }
61
+ }, [formStore, setSendToWallet, setSelectedBookmark])
66
62
  }
@@ -140,7 +140,7 @@ export const createRouteExecutionStore = ({ namePrefix }: PersistStoreProps) =>
140
140
  } as RouteExecutionState
141
141
  try {
142
142
  // Remove failed transactions from history after 1 day
143
- const currentTime = new Date().getTime()
143
+ const currentTime = Date.now()
144
144
  const oneDay = 1000 * 60 * 60 * 24
145
145
  Object.values(state.routes).forEach((routeExecution) => {
146
146
  const startedAt =
@@ -1,3 +1,4 @@
1
+ /** biome-ignore-all lint/correctness/noUnusedVariables: allowed in this store */
1
2
  import type { StateCreator } from 'zustand'
2
3
  import { persist } from 'zustand/middleware'
3
4
  import { createWithEqualityFn } from 'zustand/traditional'