@lifi/widget 3.7.0-beta.6 → 3.7.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 (327) hide show
  1. package/AppProvider.tsx +6 -4
  2. package/AppRoutes.tsx +14 -2
  3. package/CHANGELOG.md +22 -0
  4. package/_esm/AppProvider.js +3 -2
  5. package/_esm/AppProvider.js.map +1 -1
  6. package/_esm/AppRoutes.js +9 -2
  7. package/_esm/AppRoutes.js.map +1 -1
  8. package/_esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
  9. package/_esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
  10. package/_esm/components/AmountInput/AmountInputEndAdornment.js +3 -1
  11. package/_esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
  12. package/_esm/components/AppContainer.js +10 -5
  13. package/_esm/components/AppContainer.js.map +1 -1
  14. package/_esm/components/Avatar/AccountAvatar.d.ts +1 -1
  15. package/_esm/components/Avatar/AccountAvatar.js +1 -1
  16. package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
  17. package/_esm/components/Avatar/Avatar.d.ts +0 -1
  18. package/_esm/components/Avatar/Avatar.js +4 -7
  19. package/_esm/components/Avatar/Avatar.js.map +1 -1
  20. package/_esm/components/Avatar/Avatar.style.d.ts +3 -6
  21. package/_esm/components/Avatar/Avatar.style.js +6 -19
  22. package/_esm/components/Avatar/Avatar.style.js.map +1 -1
  23. package/_esm/components/Avatar/TokenAvatar.js +1 -1
  24. package/_esm/components/Avatar/TokenAvatar.js.map +1 -1
  25. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +5 -3
  26. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
  27. package/_esm/components/Card/InputCard.d.ts +1 -1
  28. package/_esm/components/ChainSelect/useChainSelect.js +1 -5
  29. package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
  30. package/_esm/components/FeeBreakdownTooltip.js +1 -4
  31. package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
  32. package/_esm/components/FullPageContainer.d.ts +2 -0
  33. package/_esm/components/FullPageContainer.js +9 -0
  34. package/_esm/components/FullPageContainer.js.map +1 -0
  35. package/_esm/components/Header/EVMDisconnectIconButton.d.ts +4 -0
  36. package/_esm/components/Header/EVMDisconnectIconButton.js +12 -0
  37. package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -0
  38. package/_esm/components/Header/Header.js +23 -3
  39. package/_esm/components/Header/Header.js.map +1 -1
  40. package/_esm/components/Header/NavigationHeader.js +1 -1
  41. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  42. package/_esm/components/Header/SVMDisconnectIconButton.d.ts +1 -0
  43. package/_esm/components/Header/SVMDisconnectIconButton.js +12 -0
  44. package/_esm/components/Header/SVMDisconnectIconButton.js.map +1 -0
  45. package/_esm/components/Header/WalletHeader.js +9 -5
  46. package/_esm/components/Header/WalletHeader.js.map +1 -1
  47. package/_esm/components/Header/WalletMenu.js +18 -10
  48. package/_esm/components/Header/WalletMenu.js.map +1 -1
  49. package/_esm/components/Header/WalletMenu.style.js +1 -5
  50. package/_esm/components/Header/WalletMenu.style.js.map +1 -1
  51. package/_esm/components/PageContainer.d.ts +2 -1
  52. package/_esm/components/PageContainer.js.map +1 -1
  53. package/_esm/components/PageEntered.d.ts +1 -0
  54. package/_esm/components/PageEntered.js +13 -0
  55. package/_esm/components/PageEntered.js.map +1 -0
  56. package/_esm/components/Routes/RoutesExpanded.js +1 -1
  57. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  58. package/_esm/components/Search/SearchInput.d.ts +11 -0
  59. package/_esm/components/Search/SearchInput.js +21 -0
  60. package/_esm/components/Search/SearchInput.js.map +1 -0
  61. package/_esm/components/Search/SearchInput.style.d.ts +12 -0
  62. package/_esm/components/Search/SearchInput.style.js +38 -0
  63. package/_esm/components/Search/SearchInput.style.js.map +1 -0
  64. package/_esm/components/Search/SearchNotFound.d.ts +6 -0
  65. package/_esm/components/Search/SearchNotFound.js +5 -0
  66. package/_esm/components/Search/SearchNotFound.js.map +1 -0
  67. package/_esm/components/Search/SearchNotFound.style.d.ts +14 -0
  68. package/_esm/components/Search/SearchNotFound.style.js +29 -0
  69. package/_esm/components/Search/SearchNotFound.style.js.map +1 -0
  70. package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
  71. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  72. package/_esm/components/Skeleton/WidgetSkeleton.js +3 -4
  73. package/_esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
  74. package/_esm/components/Skeleton/WidgetSkeleton.style.d.ts +4 -1
  75. package/_esm/components/Skeleton/WidgetSkeleton.style.js +20 -1
  76. package/_esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
  77. package/_esm/components/SmallAvatar.d.ts +10 -0
  78. package/_esm/components/SmallAvatar.js +19 -0
  79. package/_esm/components/SmallAvatar.js.map +1 -0
  80. package/_esm/components/StepActions/StepActions.js +1 -1
  81. package/_esm/components/StepActions/StepActions.js.map +1 -1
  82. package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
  83. package/_esm/components/Token/Token.js +1 -1
  84. package/_esm/components/Token/Token.js.map +1 -1
  85. package/_esm/components/TokenList/TokenList.js +2 -5
  86. package/_esm/components/TokenList/TokenList.js.map +1 -1
  87. package/_esm/components/TokenList/TokenListItem.js +5 -11
  88. package/_esm/components/TokenList/TokenListItem.js.map +1 -1
  89. package/_esm/components/TokenList/TokenNotFound.js +5 -13
  90. package/_esm/components/TokenList/TokenNotFound.js.map +1 -1
  91. package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
  92. package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  93. package/_esm/components/TokenList/types.d.ts +3 -3
  94. package/_esm/components/TokenRate/TokenRate.js +2 -2
  95. package/_esm/components/TokenRate/TokenRate.js.map +1 -1
  96. package/_esm/config/version.d.ts +1 -1
  97. package/_esm/config/version.js +1 -1
  98. package/_esm/config/version.js.map +1 -1
  99. package/_esm/hooks/useAccount.d.ts +45 -0
  100. package/_esm/hooks/useAccount.js +56 -0
  101. package/_esm/hooks/useAccount.js.map +1 -0
  102. package/_esm/hooks/useAvailableChains.d.ts +1 -2
  103. package/_esm/hooks/useAvailableChains.js +8 -9
  104. package/_esm/hooks/useAvailableChains.js.map +1 -1
  105. package/_esm/hooks/useChains.d.ts +3 -4
  106. package/_esm/hooks/useChains.js +3 -5
  107. package/_esm/hooks/useChains.js.map +1 -1
  108. package/_esm/hooks/useFromTokenSufficiency.js +1 -1
  109. package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
  110. package/_esm/hooks/useGasSufficiency.js +3 -3
  111. package/_esm/hooks/useGasSufficiency.js.map +1 -1
  112. package/_esm/hooks/useProcessMessage.js +0 -4
  113. package/_esm/hooks/useProcessMessage.js.map +1 -1
  114. package/_esm/hooks/useRouteExecution.js +1 -1
  115. package/_esm/hooks/useRouteExecution.js.map +1 -1
  116. package/_esm/hooks/useRoutes.js +1 -1
  117. package/_esm/hooks/useRoutes.js.map +1 -1
  118. package/_esm/hooks/useScrollableContainer.d.ts +0 -1
  119. package/_esm/hooks/useScrollableContainer.js +1 -2
  120. package/_esm/hooks/useScrollableContainer.js.map +1 -1
  121. package/_esm/hooks/useSetContentHeight.js +9 -6
  122. package/_esm/hooks/useSetContentHeight.js.map +1 -1
  123. package/_esm/hooks/useTokenBalance.js +1 -1
  124. package/_esm/hooks/useTokenBalance.js.map +1 -1
  125. package/_esm/hooks/useTokenBalances.js +1 -1
  126. package/_esm/hooks/useTokenBalances.js.map +1 -1
  127. package/_esm/hooks/useTokens.js +1 -1
  128. package/_esm/hooks/useTokens.js.map +1 -1
  129. package/_esm/hooks/useTransactionDetails.js +1 -1
  130. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  131. package/_esm/hooks/useTransactionHistory.js +1 -1
  132. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  133. package/_esm/hooks/useWallets.d.ts +6 -0
  134. package/_esm/hooks/useWallets.js +80 -0
  135. package/_esm/hooks/useWallets.js.map +1 -0
  136. package/_esm/i18n/en.json +11 -4
  137. package/_esm/index.d.ts +2 -0
  138. package/_esm/index.js +2 -0
  139. package/_esm/index.js.map +1 -1
  140. package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
  141. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  142. package/_esm/pages/SelectChainPage/SelectChainPage.js +27 -8
  143. package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
  144. package/_esm/pages/SelectEnabledToolsPage.js +38 -16
  145. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  146. package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -12
  147. package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  148. package/_esm/pages/SelectTokenPage/SelectTokenPage.js +2 -2
  149. package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
  150. package/_esm/pages/SelectTokenPage/useTokenListHeight.js +8 -14
  151. package/_esm/pages/SelectTokenPage/useTokenListHeight.js.map +1 -1
  152. package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +9 -0
  153. package/_esm/pages/SelectWalletPage/EVMListItemButton.js +39 -0
  154. package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +1 -0
  155. package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
  156. package/_esm/pages/SelectWalletPage/SVMListItemButton.js +32 -0
  157. package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +1 -0
  158. package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  159. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +41 -0
  160. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -0
  161. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
  162. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  163. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  164. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  165. package/_esm/pages/SendToWallet/SendToWalletPage.style.d.ts +1 -1
  166. package/_esm/pages/TransactionPage/StatusBottomSheet.js +5 -5
  167. package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
  168. package/_esm/providers/I18nProvider/types.d.ts +2 -2
  169. package/_esm/providers/WalletProvider/SDKProviders.js +7 -15
  170. package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  171. package/_esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
  172. package/_esm/providers/WalletProvider/WalletProvider.js +1 -14
  173. package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
  174. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
  175. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +3 -8
  176. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
  177. package/_esm/providers/WidgetProvider/WidgetProvider.js +1 -2
  178. package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  179. package/_esm/providers/WidgetProvider/types.d.ts +2 -0
  180. package/_esm/stores/form/FormUpdater.js +1 -1
  181. package/_esm/stores/form/FormUpdater.js.map +1 -1
  182. package/_esm/stores/form/types.d.ts +4 -4
  183. package/_esm/stores/header/types.d.ts +2 -0
  184. package/_esm/stores/header/useHeaderStore.d.ts +7 -1
  185. package/_esm/stores/header/useHeaderStore.js +26 -2
  186. package/_esm/stores/header/useHeaderStore.js.map +1 -1
  187. package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
  188. package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
  189. package/_esm/stores/settings/types.d.ts +1 -1
  190. package/_esm/stores/settings/useSettingsStore.js +22 -9
  191. package/_esm/stores/settings/useSettingsStore.js.map +1 -1
  192. package/_esm/themes/createTheme.js +1 -2
  193. package/_esm/themes/createTheme.js.map +1 -1
  194. package/_esm/types/events.d.ts +6 -6
  195. package/_esm/types/events.js +3 -2
  196. package/_esm/types/events.js.map +1 -1
  197. package/_esm/utils/chainType.js +3 -2
  198. package/_esm/utils/chainType.js.map +1 -1
  199. package/_esm/utils/elements.d.ts +5 -2
  200. package/_esm/utils/elements.js +6 -1
  201. package/_esm/utils/elements.js.map +1 -1
  202. package/_esm/utils/fees.js +5 -9
  203. package/_esm/utils/fees.js.map +1 -1
  204. package/_esm/utils/format.js +1 -1
  205. package/_esm/utils/format.js.map +1 -1
  206. package/_esm/utils/navigationRoutes.d.ts +3 -1
  207. package/_esm/utils/navigationRoutes.js +3 -0
  208. package/_esm/utils/navigationRoutes.js.map +1 -1
  209. package/_esm/utils/svm.d.ts +1 -0
  210. package/_esm/utils/svm.js +11 -0
  211. package/_esm/utils/svm.js.map +1 -0
  212. package/_esm/utils/wallet.js +1 -1
  213. package/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
  214. package/components/AmountInput/AmountInputEndAdornment.tsx +5 -1
  215. package/components/AppContainer.tsx +15 -10
  216. package/components/Avatar/AccountAvatar.tsx +2 -2
  217. package/components/Avatar/Avatar.style.tsx +7 -20
  218. package/components/Avatar/Avatar.tsx +4 -12
  219. package/components/Avatar/TokenAvatar.tsx +1 -1
  220. package/components/BaseTransactionButton/BaseTransactionButton.tsx +5 -3
  221. package/components/ChainSelect/useChainSelect.ts +1 -10
  222. package/components/FeeBreakdownTooltip.tsx +1 -4
  223. package/components/FullPageContainer.tsx +14 -0
  224. package/components/Header/EVMDisconnectIconButton.tsx +24 -0
  225. package/components/Header/Header.tsx +28 -3
  226. package/components/Header/NavigationHeader.tsx +1 -1
  227. package/components/Header/SVMDisconnectIconButton.tsx +19 -0
  228. package/components/Header/WalletHeader.tsx +12 -11
  229. package/components/Header/WalletMenu.style.tsx +1 -5
  230. package/components/Header/WalletMenu.tsx +32 -22
  231. package/components/PageContainer.ts +2 -1
  232. package/components/PageEntered.ts +14 -0
  233. package/components/Routes/RoutesExpanded.tsx +2 -1
  234. package/components/Search/SearchInput.style.tsx +46 -0
  235. package/components/Search/SearchInput.tsx +57 -0
  236. package/components/Search/SearchNotFound.style.tsx +36 -0
  237. package/components/Search/SearchNotFound.tsx +23 -0
  238. package/components/SendToWallet/SendToWalletButton.tsx +1 -1
  239. package/components/Skeleton/WidgetSkeleton.style.tsx +21 -1
  240. package/components/Skeleton/WidgetSkeleton.tsx +10 -9
  241. package/components/SmallAvatar.tsx +25 -0
  242. package/components/StepActions/StepActions.tsx +1 -1
  243. package/components/Token/Token.tsx +1 -1
  244. package/components/TokenList/TokenList.tsx +2 -9
  245. package/components/TokenList/TokenListItem.tsx +7 -15
  246. package/components/TokenList/TokenNotFound.tsx +7 -27
  247. package/components/TokenList/VirtualizedTokenList.tsx +1 -1
  248. package/components/TokenList/types.ts +3 -3
  249. package/components/TokenRate/TokenRate.tsx +2 -2
  250. package/config/version.ts +1 -1
  251. package/hooks/useAccount.ts +109 -0
  252. package/hooks/useAvailableChains.ts +10 -9
  253. package/hooks/useChains.ts +3 -6
  254. package/hooks/useFromTokenSufficiency.ts +1 -1
  255. package/hooks/useGasSufficiency.ts +3 -5
  256. package/hooks/useProcessMessage.ts +0 -4
  257. package/hooks/useRouteExecution.ts +1 -1
  258. package/hooks/useRoutes.ts +1 -1
  259. package/hooks/useScrollableContainer.ts +1 -6
  260. package/hooks/useSetContentHeight.ts +10 -6
  261. package/hooks/useTokenBalance.ts +1 -1
  262. package/hooks/useTokenBalances.ts +1 -1
  263. package/hooks/useTokens.ts +1 -2
  264. package/hooks/useTransactionDetails.ts +1 -1
  265. package/hooks/useTransactionHistory.ts +1 -1
  266. package/hooks/useWallets.ts +147 -0
  267. package/i18n/en.json +11 -4
  268. package/index.ts +2 -0
  269. package/package.json +6 -6
  270. package/pages/RoutesPage/RoutesPage.tsx +1 -1
  271. package/pages/SelectChainPage/SelectChainPage.tsx +62 -23
  272. package/pages/SelectEnabledToolsPage.tsx +94 -37
  273. package/pages/SelectTokenPage/SearchTokenInput.tsx +8 -26
  274. package/pages/SelectTokenPage/SelectTokenPage.tsx +3 -3
  275. package/pages/SelectTokenPage/useTokenListHeight.ts +14 -21
  276. package/pages/SelectWalletPage/EVMListItemButton.tsx +74 -0
  277. package/pages/SelectWalletPage/SVMListItemButton.tsx +47 -0
  278. package/pages/SelectWalletPage/SelectWalletPage.tsx +90 -0
  279. package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -2
  280. package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
  281. package/pages/TransactionPage/StatusBottomSheet.tsx +6 -8
  282. package/providers/I18nProvider/types.ts +2 -2
  283. package/providers/WalletProvider/SDKProviders.tsx +7 -25
  284. package/providers/WalletProvider/WalletProvider.tsx +3 -24
  285. package/providers/WalletProvider/useHasExternalWalletProvider.ts +5 -11
  286. package/providers/WidgetProvider/WidgetProvider.tsx +1 -2
  287. package/providers/WidgetProvider/types.ts +2 -0
  288. package/stores/form/FormUpdater.tsx +1 -1
  289. package/stores/form/types.ts +4 -4
  290. package/stores/header/types.ts +2 -0
  291. package/stores/header/useHeaderStore.tsx +40 -2
  292. package/stores/routes/useExecutingRoutesIds.ts +1 -1
  293. package/stores/settings/types.ts +1 -1
  294. package/stores/settings/useSettingsStore.ts +30 -9
  295. package/themes/createTheme.ts +1 -3
  296. package/types/events.ts +5 -5
  297. package/utils/chainType.ts +3 -2
  298. package/utils/elements.ts +21 -1
  299. package/utils/fees.ts +13 -15
  300. package/utils/format.ts +1 -1
  301. package/utils/navigationRoutes.ts +7 -1
  302. package/utils/svm.ts +10 -0
  303. package/utils/wallet.ts +1 -1
  304. package/_esm/components/Avatar/SmallAvatar.d.ts +0 -4
  305. package/_esm/components/Avatar/SmallAvatar.js +0 -12
  306. package/_esm/components/Avatar/SmallAvatar.js.map +0 -1
  307. package/_esm/components/Header/DisconnectIconButton.d.ts +0 -4
  308. package/_esm/components/Header/DisconnectIconButton.js +0 -12
  309. package/_esm/components/Header/DisconnectIconButton.js.map +0 -1
  310. package/_esm/hooks/useHeaderHeight.d.ts +0 -6
  311. package/_esm/hooks/useHeaderHeight.js +0 -23
  312. package/_esm/hooks/useHeaderHeight.js.map +0 -1
  313. package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
  314. package/_esm/providers/WalletProvider/UTXOBaseProvider.js +0 -17
  315. package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
  316. package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
  317. package/_esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
  318. package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
  319. package/_esm/providers/WalletProvider/UTXOProvider.d.ts +0 -3
  320. package/_esm/providers/WalletProvider/UTXOProvider.js +0 -18
  321. package/_esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
  322. package/components/Avatar/SmallAvatar.tsx +0 -16
  323. package/components/Header/DisconnectIconButton.tsx +0 -18
  324. package/hooks/useHeaderHeight.ts +0 -27
  325. package/providers/WalletProvider/UTXOBaseProvider.tsx +0 -28
  326. package/providers/WalletProvider/UTXOExternalContext.ts +0 -3
  327. package/providers/WalletProvider/UTXOProvider.tsx +0 -26
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
  import type { ExchangeRateUpdateParams, Route } from '@lifi/sdk';
3
3
  import { executeRoute, resumeRoute, updateRouteExecution } from '@lifi/sdk';
4
- import { useAccount } from '@lifi/wallet-management';
5
4
  import { useMutation, useQueryClient } from '@tanstack/react-query';
6
5
  import { useCallback, useEffect, useRef } from 'react';
7
6
  import { shallow } from 'zustand/shallow';
@@ -16,6 +15,7 @@ import {
16
15
  isRouteFailed,
17
16
  } from '../stores/routes/utils.js';
18
17
  import { WidgetEvent } from '../types/events.js';
18
+ import { useAccount } from './useAccount.js';
19
19
  import { useWidgetEvents } from './useWidgetEvents.js';
20
20
 
21
21
  interface RouteExecutionProps {
@@ -1,6 +1,5 @@
1
1
  import type { Route, RoutesResponse, Token } from '@lifi/sdk';
2
2
  import { LiFiErrorCode, getContractCallsQuote, getRoutes } from '@lifi/sdk';
3
- import { useAccount } from '@lifi/wallet-management';
4
3
  import { useQuery, useQueryClient } from '@tanstack/react-query';
5
4
  import { v4 as uuidv4 } from 'uuid';
6
5
  import { parseUnits } from 'viem';
@@ -11,6 +10,7 @@ import { useSettings } from '../stores/settings/useSettings.js';
11
10
  import { defaultSlippage } from '../stores/settings/useSettingsStore.js';
12
11
  import { WidgetEvent } from '../types/events.js';
13
12
  import { getChainTypeFromAddress } from '../utils/chainType.js';
13
+ import { useAccount } from './useAccount.js';
14
14
  import { useChain } from './useChain.js';
15
15
  import { useDebouncedWatch } from './useDebouncedWatch.js';
16
16
  import { useGasRefuel } from './useGasRefuel.js';
@@ -1,12 +1,7 @@
1
1
  import { useCallback, useLayoutEffect, useState } from 'react';
2
- import { ElementId, createElementId } from '../utils/elements.js';
2
+ import { getScrollableContainer } from '../utils/elements.js';
3
3
  import { useDefaultElementId } from './useDefaultElementId.js';
4
4
 
5
- export const getScrollableContainer = (elementId: string) =>
6
- document.getElementById(
7
- createElementId(ElementId.ScrollableContainer, elementId),
8
- );
9
-
10
5
  export const useGetScrollableContainer = () => {
11
6
  const elementId = useDefaultElementId();
12
7
  const getContainer = useCallback(
@@ -1,24 +1,28 @@
1
1
  import type { MutableRefObject } from 'react';
2
2
  import { useLayoutEffect } from 'react';
3
+ import { getRelativeContainer } from '../utils/elements.js';
3
4
  import { useDefaultElementId } from './useDefaultElementId.js';
4
- import { getScrollableContainer } from './useScrollableContainer.js';
5
+
6
+ // NOTE: this hook is implicitly tied to the widget height functionality in the
7
+ // AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
8
+ // CSS changes in those components can have implications for the functionality in this hook
5
9
 
6
10
  export const useSetContentHeight = (
7
11
  ref: MutableRefObject<HTMLElement | undefined>,
8
12
  ) => {
9
13
  const elementId = useDefaultElementId();
10
14
  useLayoutEffect(() => {
11
- const scrollableContainer = getScrollableContainer(elementId);
15
+ const relativeContainer = getRelativeContainer(elementId);
12
16
  if (
13
- !scrollableContainer ||
17
+ !relativeContainer ||
14
18
  !ref.current ||
15
- ref.current?.clientHeight <= scrollableContainer?.clientHeight
19
+ ref.current?.clientHeight <= relativeContainer?.clientHeight
16
20
  ) {
17
21
  return;
18
22
  }
19
- scrollableContainer.style.height = `${ref.current.clientHeight}px`;
23
+ relativeContainer.style.minHeight = `${ref.current.clientHeight}px`;
20
24
  return () => {
21
- scrollableContainer.style.removeProperty('height');
25
+ relativeContainer.style.removeProperty('min-height');
22
26
  };
23
27
  }, [elementId, ref]);
24
28
  };
@@ -1,8 +1,8 @@
1
1
  import type { ExtendedChain } from '@lifi/sdk';
2
2
  import { getTokenBalances, type Token, type TokenAmount } from '@lifi/sdk';
3
- import { useAccount } from '@lifi/wallet-management';
4
3
  import { useQuery, useQueryClient } from '@tanstack/react-query';
5
4
  import { useCallback, useMemo } from 'react';
5
+ import { useAccount } from './useAccount.js';
6
6
 
7
7
  const defaultRefetchInterval = 30_000;
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { getTokenBalances } from '@lifi/sdk';
2
- import { useAccount } from '@lifi/wallet-management';
3
2
  import { useQuery } from '@tanstack/react-query';
4
3
  import { formatUnits } from 'viem';
5
4
  import type { TokenAmount } from '../types/token.js';
5
+ import { useAccount } from './useAccount.js';
6
6
  import { useTokens } from './useTokens.js';
7
7
 
8
8
  const defaultRefetchInterval = 32_000;
@@ -9,8 +9,7 @@ export const useTokens = (selectedChainId?: number) => {
9
9
  const { tokens: configTokens } = useWidgetConfig();
10
10
  const { data, isLoading } = useQuery({
11
11
  queryKey: ['tokens'],
12
- queryFn: () =>
13
- getTokens({ chainTypes: [ChainType.EVM, ChainType.SVM, ChainType.UTXO] }),
12
+ queryFn: () => getTokens({ chainTypes: [ChainType.EVM, ChainType.SVM] }),
14
13
  refetchInterval: 3_600_000,
15
14
  staleTime: 3_600_000,
16
15
  });
@@ -1,11 +1,11 @@
1
1
  import type { FullStatusData } from '@lifi/sdk';
2
2
  import { getStatus, type StatusResponse } from '@lifi/sdk';
3
- import { useAccount } from '@lifi/wallet-management';
4
3
  import {
5
4
  keepPreviousData,
6
5
  useQuery,
7
6
  useQueryClient,
8
7
  } from '@tanstack/react-query';
8
+ import { useAccount } from './useAccount.js';
9
9
 
10
10
  export const useTransactionDetails = (transactionHash?: string) => {
11
11
  const { account, accounts } = useAccount();
@@ -1,8 +1,8 @@
1
1
  import type { FullStatusData, StatusResponse } from '@lifi/sdk';
2
2
  import { getTransactionHistory, type ExtendedTransactionInfo } from '@lifi/sdk';
3
- import { useAccount } from '@lifi/wallet-management';
4
3
  import type { QueryFunction } from '@tanstack/react-query';
5
4
  import { useQueries } from '@tanstack/react-query';
5
+ import { useAccount } from './useAccount.js';
6
6
 
7
7
  export const useTransactionHistory = () => {
8
8
  const { accounts } = useAccount();
@@ -0,0 +1,147 @@
1
+ import { ChainType } from '@lifi/sdk';
2
+ import type { CreateConnectorFnExtended } from '@lifi/wallet-management';
3
+ import {
4
+ createCoinbaseConnector,
5
+ createMetaMaskConnector,
6
+ createWalletConnectConnector,
7
+ getWalletPriority,
8
+ isWalletInstalled,
9
+ } from '@lifi/wallet-management';
10
+ import type { Theme } from '@mui/material';
11
+ import { useMediaQuery } from '@mui/material';
12
+ import { WalletReadyState } from '@solana/wallet-adapter-base';
13
+ import type { Wallet } from '@solana/wallet-adapter-react';
14
+ import { useWallet } from '@solana/wallet-adapter-react';
15
+ import { useMemo } from 'react';
16
+ import type { Connector } from 'wagmi';
17
+ import { useConnect, useAccount as useWagmiAccount } from 'wagmi';
18
+ import { defaultCoinbaseConfig } from '../config/coinbase.js';
19
+ import { defaultMetaMaskConfig } from '../config/metaMask.js';
20
+ import { defaultWalletConnectConfig } from '../config/walletConnect.js';
21
+ import type { WidgetChains, WidgetWalletConfig } from '../types/widget.js';
22
+ import { isItemAllowed } from '../utils/item.js';
23
+
24
+ export const useWallets = (
25
+ walletConfig?: WidgetWalletConfig,
26
+ chains?: WidgetChains,
27
+ ) => {
28
+ const account = useWagmiAccount();
29
+ const { connectors } = useConnect();
30
+ const { wallets: solanaWallets } = useWallet();
31
+
32
+ const isDesktopView = useMediaQuery((theme: Theme) =>
33
+ theme.breakpoints.up('sm'),
34
+ );
35
+
36
+ const wallets = useMemo(() => {
37
+ const evmConnectors: (CreateConnectorFnExtended | Connector)[] =
38
+ Array.from(connectors);
39
+ if (
40
+ !connectors.some((connector) =>
41
+ connector.id.toLowerCase().includes('walletconnect'),
42
+ )
43
+ ) {
44
+ evmConnectors.unshift(
45
+ createWalletConnectConnector(
46
+ walletConfig?.walletConnect ?? defaultWalletConnectConfig,
47
+ ),
48
+ );
49
+ }
50
+ if (
51
+ !connectors.some((connector) =>
52
+ connector.id.toLowerCase().includes('coinbase'),
53
+ ) &&
54
+ !isWalletInstalled('coinbase')
55
+ ) {
56
+ evmConnectors.unshift(
57
+ createCoinbaseConnector(
58
+ walletConfig?.coinbase ?? defaultCoinbaseConfig,
59
+ ),
60
+ );
61
+ }
62
+ if (
63
+ !connectors.some((connector) =>
64
+ connector.id.toLowerCase().includes('metamask'),
65
+ ) &&
66
+ !isWalletInstalled('metaMask')
67
+ ) {
68
+ evmConnectors.unshift(
69
+ createMetaMaskConnector(
70
+ walletConfig?.metaMask ?? defaultMetaMaskConfig,
71
+ ),
72
+ );
73
+ }
74
+ const evmInstalled = isItemAllowed(ChainType.EVM, chains?.types)
75
+ ? evmConnectors.filter(
76
+ (connector) =>
77
+ isWalletInstalled(connector.id!) &&
78
+ // We should not show already connected connectors
79
+ account.connector?.id !== connector.id,
80
+ )
81
+ : [];
82
+ const evmNotDetected = isItemAllowed(ChainType.EVM, chains?.types)
83
+ ? evmConnectors.filter((connector) => !isWalletInstalled(connector.id!))
84
+ : [];
85
+ const svmInstalled = isItemAllowed(ChainType.SVM, chains?.types)
86
+ ? solanaWallets?.filter(
87
+ (connector) =>
88
+ connector.adapter.readyState === WalletReadyState.Installed &&
89
+ // We should not show already connected connectors
90
+ !connector.adapter.connected,
91
+ )
92
+ : [];
93
+ const svmNotDetected = isItemAllowed(ChainType.SVM, chains?.types)
94
+ ? solanaWallets?.filter(
95
+ (connector) =>
96
+ connector.adapter.readyState !== WalletReadyState.Installed,
97
+ )
98
+ : [];
99
+
100
+ const installedWallets = [...evmInstalled, ...svmInstalled].sort(
101
+ walletComparator,
102
+ );
103
+
104
+ if (isDesktopView) {
105
+ const notDetectedWallets = [...evmNotDetected, ...svmNotDetected].sort(
106
+ walletComparator,
107
+ );
108
+ installedWallets.push(...notDetectedWallets);
109
+ }
110
+
111
+ return installedWallets;
112
+ }, [
113
+ account.connector?.id,
114
+ chains?.types,
115
+ connectors,
116
+ isDesktopView,
117
+ solanaWallets,
118
+ walletConfig?.coinbase,
119
+ walletConfig?.metaMask,
120
+ walletConfig?.walletConnect,
121
+ ]);
122
+
123
+ return wallets;
124
+ };
125
+
126
+ export const walletComparator = (
127
+ a: CreateConnectorFnExtended | Connector | Wallet,
128
+ b: CreateConnectorFnExtended | Connector | Wallet,
129
+ ) => {
130
+ let aId = (a as Connector).id || (a as Wallet).adapter?.name;
131
+ let bId = (b as Connector).id || (b as Wallet).adapter?.name;
132
+
133
+ const priorityA = getWalletPriority(aId);
134
+ const priorityB = getWalletPriority(bId);
135
+
136
+ if (priorityA !== priorityB) {
137
+ return priorityA - priorityB;
138
+ }
139
+
140
+ if (aId < bId) {
141
+ return -1;
142
+ }
143
+ if (aId > bId) {
144
+ return 1;
145
+ }
146
+ return 0;
147
+ };
package/i18n/en.json CHANGED
@@ -16,10 +16,10 @@
16
16
  "bridgeReview": "Review bridge",
17
17
  "buy": "Buy",
18
18
  "cancel": "Cancel",
19
+ "changeWallet": "Change wallet",
19
20
  "checkoutReview": "Review purchase",
20
21
  "close": "Close",
21
22
  "confirm": "Confirm",
22
- "connectAnotherWallet": "Connect another wallet",
23
23
  "connectWallet": "Connect wallet",
24
24
  "contactSupport": "Contact support",
25
25
  "continue": "Continue",
@@ -82,6 +82,9 @@
82
82
  "autoRefuel": "You're low on {{chainName}} gas. By continuing, you'll get enough gas to complete the transaction.",
83
83
  "emptyActiveTransactions": "Transactions in progress will appear here. Once completed, find them in transaction history.",
84
84
  "emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please search by contract address if your token doesn't appear or choose another chain.",
85
+ "emptyChainList": "We couldn't find any chains that match your search",
86
+ "emptyBridgesList": "We couldn't find any bridges that match your search",
87
+ "emptyExchangesList": "We couldn't find any exchanges that match your search",
85
88
  "emptyTransactionHistory": "Transaction history is only stored locally and will be deleted if you clear your browser data.",
86
89
  "fundsToExchange": "Funds sent to an exchange may be lost",
87
90
  "toAddressIsRequired": "Please provide the destination wallet address to which the funds will be transferred.",
@@ -139,7 +142,6 @@
139
142
  "signatureRejected": "Your signature is required to complete the transaction. {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
140
143
  "slippageThreshold": "The slippage is larger than the defined threshold. Please request a new quote.",
141
144
  "transactionCanceled": "Transaction was canceled.",
142
- "transactionConflict": "Transaction couldn't be processed because it's conflicting with another pending transaction using the same funds. Please wait for the pending transaction to be confirmed or check your transaction history before trying again.",
143
145
  "transactionExpired": "The block height has exceeded the maximum allowed limit or blockhash is no longer recent enough.",
144
146
  "transactionFailed": "Please check the block explorer for more information.",
145
147
  "transactionNotSent": "Transaction was not sent.",
@@ -159,7 +161,6 @@
159
161
  "signatureRejected": "Signature required",
160
162
  "slippageNotMet": "Slippage conditions not met",
161
163
  "transactionCanceled": "Transaction canceled",
162
- "transactionConflict": "Transaction conflict",
163
164
  "transactionExpired": "Transaction expired",
164
165
  "transactionFailed": "Transaction failed",
165
166
  "transactionSimulationFailed": "Transaction simulation failed",
@@ -277,7 +278,10 @@
277
278
  "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
278
279
  "tokenOnChainAmount": "{{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} on {{chainName}}",
279
280
  "tokenSearch": "Search by token name or address",
280
- "valueLoss": "Value loss"
281
+ "valueLoss": "Value loss",
282
+ "searchChains": "Search by chain name",
283
+ "searchBridges": "Search by bridge name",
284
+ "searchExchanges": "Search by exchange name"
281
285
  },
282
286
  "settings": {
283
287
  "theme": "Theme",
@@ -305,5 +309,8 @@
305
309
  "noBookmarkedWallets": "No bookmarked wallets",
306
310
  "noConnectedWallets": "No connected wallets",
307
311
  "noRecentWallets": "No recent wallets"
312
+ },
313
+ "wallet": {
314
+ "extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
308
315
  }
309
316
  }
package/index.ts CHANGED
@@ -8,7 +8,9 @@ export * from './components/ContractComponent/NFT/types.js';
8
8
  export * from './components/Skeleton/WidgetSkeleton.js';
9
9
  export { defaultMaxHeight } from './config/constants.js';
10
10
  export * from './config/version.js';
11
+ export { useAccount } from './hooks/useAccount.js';
11
12
  export { useAvailableChains } from './hooks/useAvailableChains.js';
13
+ export { useWallets, walletComparator } from './hooks/useWallets.js';
12
14
  export { useWidgetEvents, widgetEvents } from './hooks/useWidgetEvents.js';
13
15
  export * from './stores/form/types.js';
14
16
  export { useFieldActions } from './stores/form/useFieldActions.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "3.7.0-beta.6",
3
+ "version": "3.7.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "type": "module",
6
6
  "main": "./_esm/index.js",
@@ -34,15 +34,15 @@
34
34
  "dependencies": {
35
35
  "@emotion/react": "^11.13.3",
36
36
  "@emotion/styled": "^11.13.0",
37
- "@lifi/sdk": "^3.3.0-beta.0",
38
- "@lifi/wallet-management": "^3.3.0-beta.6",
37
+ "@lifi/sdk": "^3.2.3",
38
+ "@lifi/wallet-management": "^3.1.7",
39
39
  "@mui/icons-material": "^5.16.7",
40
40
  "@mui/lab": "^5.0.0-alpha.173",
41
41
  "@mui/material": "^5.16.7",
42
42
  "@solana/wallet-adapter-base": "^0.9.23",
43
43
  "@solana/wallet-adapter-react": "^0.15.35",
44
44
  "@solana/web3.js": "^1.95.3",
45
- "@tanstack/react-query": "^5.56.2",
45
+ "@tanstack/react-query": "^5.59.0",
46
46
  "@tanstack/react-virtual": "^3.10.8",
47
47
  "i18next": "^23.15.1",
48
48
  "microdiff": "^1.4.0",
@@ -53,8 +53,8 @@
53
53
  "react-intersection-observer": "^9.13.1",
54
54
  "react-router-dom": "^6.26.2",
55
55
  "uuid": "^10.0.0",
56
- "viem": "^2.21.14",
57
- "wagmi": "^2.12.14",
56
+ "viem": "^2.21.16",
57
+ "wagmi": "^2.12.16",
58
58
  "zustand": "^4.5.5"
59
59
  },
60
60
  "peerDependencies": {
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import type { Route } from '@lifi/sdk';
3
- import { useAccount } from '@lifi/wallet-management';
4
3
  import type { BoxProps } from '@mui/material';
5
4
  import { useMemo } from 'react';
6
5
  import { useTranslation } from 'react-i18next';
@@ -8,6 +7,7 @@ import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate.js';
8
7
  import { RouteCard } from '../../components/RouteCard/RouteCard.js';
9
8
  import { RouteCardSkeleton } from '../../components/RouteCard/RouteCardSkeleton.js';
10
9
  import { RouteNotFoundCard } from '../../components/RouteCard/RouteNotFoundCard.js';
10
+ import { useAccount } from '../../hooks/useAccount.js';
11
11
  import { useHeader } from '../../hooks/useHeader.js';
12
12
  import { useNavigateBack } from '../../hooks/useNavigateBack.js';
13
13
  import { useRoutes } from '../../hooks/useRoutes.js';
@@ -1,13 +1,19 @@
1
1
  import type { ExtendedChain } from '@lifi/sdk';
2
- import { Avatar, List, ListItemAvatar } from '@mui/material';
2
+ import { Avatar, debounce, ListItemAvatar } from '@mui/material';
3
+ import { type FormEventHandler, useState } from 'react';
3
4
  import { useTranslation } from 'react-i18next';
4
5
  import { useChainSelect } from '../../components/ChainSelect/useChainSelect.js';
6
+ import { FullPageContainer } from '../../components/FullPageContainer.js';
5
7
  import { ListItemButton } from '../../components/ListItemButton.js';
6
8
  import { ListItemText } from '../../components/ListItemText.js';
7
- import { PageContainer } from '../../components/PageContainer.js';
9
+ import { StickySearchInput } from '../../components/Search/SearchInput.js';
10
+ import { SearchList } from '../../components/Search/SearchInput.style.js';
11
+ import { SearchNotFound } from '../../components/Search/SearchNotFound.js';
8
12
  import { useTokenSelect } from '../../components/TokenList/useTokenSelect.js';
13
+ import { useDefaultElementId } from '../../hooks/useDefaultElementId.js';
9
14
  import { useHeader } from '../../hooks/useHeader.js';
10
15
  import { useNavigateBack } from '../../hooks/useNavigateBack.js';
16
+ import { useScrollableContainer } from '../../hooks/useScrollableContainer.js';
11
17
  import type { SelectChainPageProps } from './types.js';
12
18
 
13
19
  export const SelectChainPage: React.FC<SelectChainPageProps> = ({
@@ -17,8 +23,11 @@ export const SelectChainPage: React.FC<SelectChainPageProps> = ({
17
23
  const { navigateBack } = useNavigateBack();
18
24
  const { chains, setCurrentChain } = useChainSelect(formType);
19
25
  const selectToken = useTokenSelect(formType, navigateBack);
26
+ const elementId = useDefaultElementId();
27
+ const scrollableContainer = useScrollableContainer(elementId);
20
28
 
21
29
  const { t } = useTranslation();
30
+
22
31
  useHeader(t('header.selectChain'));
23
32
 
24
33
  const handleClick = async (chain: ExtendedChain) => {
@@ -30,27 +39,57 @@ export const SelectChainPage: React.FC<SelectChainPageProps> = ({
30
39
  }
31
40
  };
32
41
 
42
+ const [filteredChains, setFilteredChains] = useState<ExtendedChain[]>(
43
+ chains ?? [],
44
+ );
45
+
46
+ const handleSearchInputChange: FormEventHandler<HTMLInputElement> = (e) => {
47
+ const value = (e.target as HTMLInputElement).value;
48
+
49
+ if (!value) {
50
+ setFilteredChains(chains ?? []);
51
+ } else {
52
+ setFilteredChains(
53
+ chains
54
+ ? chains.filter((chain) =>
55
+ chain.name.toLowerCase().includes(value.toLowerCase()),
56
+ )
57
+ : [],
58
+ );
59
+ }
60
+
61
+ if (scrollableContainer) {
62
+ scrollableContainer.scrollTop = 0;
63
+ }
64
+ };
65
+
66
+ const debouncedSearchInputChange = debounce(handleSearchInputChange, 250);
67
+
33
68
  return (
34
- <PageContainer disableGutters>
35
- <List
36
- sx={{
37
- paddingTop: 0,
38
- paddingLeft: 1.5,
39
- paddingRight: 1.5,
40
- paddingBottom: 1.5,
41
- }}
42
- >
43
- {chains?.map((chain) => (
44
- <ListItemButton key={chain.id} onClick={() => handleClick(chain)}>
45
- <ListItemAvatar>
46
- <Avatar src={chain.logoURI} alt={chain.name}>
47
- {chain.name[0]}
48
- </Avatar>
49
- </ListItemAvatar>
50
- <ListItemText primary={chain.name} />
51
- </ListItemButton>
52
- ))}
53
- </List>
54
- </PageContainer>
69
+ <FullPageContainer disableGutters>
70
+ <StickySearchInput
71
+ onChange={debouncedSearchInputChange}
72
+ placeholder={t('main.searchChains')}
73
+ />
74
+ {filteredChains.length ? (
75
+ <SearchList>
76
+ {filteredChains.map((chain) => (
77
+ <ListItemButton key={chain.id} onClick={() => handleClick(chain)}>
78
+ <ListItemAvatar>
79
+ <Avatar src={chain.logoURI} alt={chain.name}>
80
+ {chain.name[0]}
81
+ </Avatar>
82
+ </ListItemAvatar>
83
+ <ListItemText primary={chain.name} />
84
+ </ListItemButton>
85
+ ))}
86
+ </SearchList>
87
+ ) : (
88
+ <SearchNotFound
89
+ message={t('info.message.emptyChainList')}
90
+ adjustForStickySearchInput
91
+ />
92
+ )}
93
+ </FullPageContainer>
55
94
  );
56
95
  };