@lifi/widget 3.7.0-beta.7 → 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 (328) 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/ChainSelect/useChainSelect.js +1 -5
  28. package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
  29. package/_esm/components/FeeBreakdownTooltip.js +1 -4
  30. package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
  31. package/_esm/components/FullPageContainer.d.ts +2 -0
  32. package/_esm/components/FullPageContainer.js +9 -0
  33. package/_esm/components/FullPageContainer.js.map +1 -0
  34. package/_esm/components/Header/EVMDisconnectIconButton.d.ts +4 -0
  35. package/_esm/components/Header/EVMDisconnectIconButton.js +12 -0
  36. package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -0
  37. package/_esm/components/Header/Header.js +23 -3
  38. package/_esm/components/Header/Header.js.map +1 -1
  39. package/_esm/components/Header/NavigationHeader.js +1 -1
  40. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  41. package/_esm/components/Header/SVMDisconnectIconButton.d.ts +1 -0
  42. package/_esm/components/Header/SVMDisconnectIconButton.js +12 -0
  43. package/_esm/components/Header/SVMDisconnectIconButton.js.map +1 -0
  44. package/_esm/components/Header/WalletHeader.js +9 -5
  45. package/_esm/components/Header/WalletHeader.js.map +1 -1
  46. package/_esm/components/Header/WalletMenu.js +18 -10
  47. package/_esm/components/Header/WalletMenu.js.map +1 -1
  48. package/_esm/components/Header/WalletMenu.style.js +1 -5
  49. package/_esm/components/Header/WalletMenu.style.js.map +1 -1
  50. package/_esm/components/PageContainer.d.ts +2 -1
  51. package/_esm/components/PageContainer.js.map +1 -1
  52. package/_esm/components/PageEntered.d.ts +1 -0
  53. package/_esm/components/PageEntered.js +13 -0
  54. package/_esm/components/PageEntered.js.map +1 -0
  55. package/_esm/components/Routes/RoutesExpanded.js +1 -1
  56. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  57. package/_esm/components/Search/SearchInput.d.ts +11 -0
  58. package/_esm/components/Search/SearchInput.js +21 -0
  59. package/_esm/components/Search/SearchInput.js.map +1 -0
  60. package/_esm/components/Search/SearchInput.style.d.ts +12 -0
  61. package/_esm/components/Search/SearchInput.style.js +38 -0
  62. package/_esm/components/Search/SearchInput.style.js.map +1 -0
  63. package/_esm/components/Search/SearchNotFound.d.ts +6 -0
  64. package/_esm/components/Search/SearchNotFound.js +5 -0
  65. package/_esm/components/Search/SearchNotFound.js.map +1 -0
  66. package/_esm/components/Search/SearchNotFound.style.d.ts +14 -0
  67. package/_esm/components/Search/SearchNotFound.style.js +29 -0
  68. package/_esm/components/Search/SearchNotFound.style.js.map +1 -0
  69. package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
  70. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  71. package/_esm/components/Skeleton/WidgetSkeleton.js +3 -4
  72. package/_esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
  73. package/_esm/components/Skeleton/WidgetSkeleton.style.d.ts +3 -0
  74. package/_esm/components/Skeleton/WidgetSkeleton.style.js +20 -1
  75. package/_esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
  76. package/_esm/components/SmallAvatar.d.ts +10 -0
  77. package/_esm/components/SmallAvatar.js +19 -0
  78. package/_esm/components/SmallAvatar.js.map +1 -0
  79. package/_esm/components/StepActions/StepActions.js +1 -1
  80. package/_esm/components/StepActions/StepActions.js.map +1 -1
  81. package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
  82. package/_esm/components/Token/Token.js +1 -1
  83. package/_esm/components/Token/Token.js.map +1 -1
  84. package/_esm/components/TokenList/TokenList.js +2 -5
  85. package/_esm/components/TokenList/TokenList.js.map +1 -1
  86. package/_esm/components/TokenList/TokenListItem.js +5 -11
  87. package/_esm/components/TokenList/TokenListItem.js.map +1 -1
  88. package/_esm/components/TokenList/TokenNotFound.js +5 -13
  89. package/_esm/components/TokenList/TokenNotFound.js.map +1 -1
  90. package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
  91. package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  92. package/_esm/components/TokenList/types.d.ts +3 -3
  93. package/_esm/components/TokenRate/TokenRate.js +2 -2
  94. package/_esm/components/TokenRate/TokenRate.js.map +1 -1
  95. package/_esm/config/version.d.ts +1 -1
  96. package/_esm/config/version.js +1 -1
  97. package/_esm/config/version.js.map +1 -1
  98. package/_esm/hooks/useAccount.d.ts +45 -0
  99. package/_esm/hooks/useAccount.js +56 -0
  100. package/_esm/hooks/useAccount.js.map +1 -0
  101. package/_esm/hooks/useAvailableChains.d.ts +1 -2
  102. package/_esm/hooks/useAvailableChains.js +8 -9
  103. package/_esm/hooks/useAvailableChains.js.map +1 -1
  104. package/_esm/hooks/useChains.d.ts +3 -4
  105. package/_esm/hooks/useChains.js +3 -5
  106. package/_esm/hooks/useChains.js.map +1 -1
  107. package/_esm/hooks/useFromTokenSufficiency.js +1 -1
  108. package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
  109. package/_esm/hooks/useGasSufficiency.js +3 -3
  110. package/_esm/hooks/useGasSufficiency.js.map +1 -1
  111. package/_esm/hooks/useProcessMessage.js +0 -4
  112. package/_esm/hooks/useProcessMessage.js.map +1 -1
  113. package/_esm/hooks/useRouteExecution.js +1 -1
  114. package/_esm/hooks/useRouteExecution.js.map +1 -1
  115. package/_esm/hooks/useRoutes.js +3 -2
  116. package/_esm/hooks/useRoutes.js.map +1 -1
  117. package/_esm/hooks/useScrollableContainer.d.ts +0 -1
  118. package/_esm/hooks/useScrollableContainer.js +1 -2
  119. package/_esm/hooks/useScrollableContainer.js.map +1 -1
  120. package/_esm/hooks/useSetContentHeight.js +9 -6
  121. package/_esm/hooks/useSetContentHeight.js.map +1 -1
  122. package/_esm/hooks/useTokenBalance.js +1 -1
  123. package/_esm/hooks/useTokenBalance.js.map +1 -1
  124. package/_esm/hooks/useTokenBalances.js +1 -1
  125. package/_esm/hooks/useTokenBalances.js.map +1 -1
  126. package/_esm/hooks/useTokens.js +1 -1
  127. package/_esm/hooks/useTokens.js.map +1 -1
  128. package/_esm/hooks/useTransactionDetails.js +1 -1
  129. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  130. package/_esm/hooks/useTransactionHistory.js +1 -1
  131. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  132. package/_esm/hooks/useWallets.d.ts +6 -0
  133. package/_esm/hooks/useWallets.js +80 -0
  134. package/_esm/hooks/useWallets.js.map +1 -0
  135. package/_esm/i18n/en.json +11 -4
  136. package/_esm/index.d.ts +2 -0
  137. package/_esm/index.js +2 -0
  138. package/_esm/index.js.map +1 -1
  139. package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
  140. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  141. package/_esm/pages/SelectChainPage/SelectChainPage.js +27 -8
  142. package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
  143. package/_esm/pages/SelectEnabledToolsPage.js +38 -16
  144. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  145. package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -12
  146. package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  147. package/_esm/pages/SelectTokenPage/SelectTokenPage.js +2 -2
  148. package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
  149. package/_esm/pages/SelectTokenPage/useTokenListHeight.js +8 -14
  150. package/_esm/pages/SelectTokenPage/useTokenListHeight.js.map +1 -1
  151. package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +9 -0
  152. package/_esm/pages/SelectWalletPage/EVMListItemButton.js +39 -0
  153. package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +1 -0
  154. package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
  155. package/_esm/pages/SelectWalletPage/SVMListItemButton.js +32 -0
  156. package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +1 -0
  157. package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  158. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +41 -0
  159. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -0
  160. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
  161. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  162. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  163. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  164. package/_esm/pages/TransactionPage/StatusBottomSheet.js +5 -5
  165. package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
  166. package/_esm/providers/I18nProvider/types.d.ts +2 -2
  167. package/_esm/providers/WalletProvider/SDKProviders.js +7 -15
  168. package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  169. package/_esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
  170. package/_esm/providers/WalletProvider/WalletProvider.js +1 -14
  171. package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
  172. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
  173. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +3 -8
  174. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
  175. package/_esm/providers/WidgetProvider/WidgetProvider.js +1 -2
  176. package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  177. package/_esm/providers/WidgetProvider/types.d.ts +2 -0
  178. package/_esm/stores/form/FormUpdater.js +1 -1
  179. package/_esm/stores/form/FormUpdater.js.map +1 -1
  180. package/_esm/stores/form/types.d.ts +4 -4
  181. package/_esm/stores/header/types.d.ts +2 -0
  182. package/_esm/stores/header/useHeaderStore.d.ts +7 -1
  183. package/_esm/stores/header/useHeaderStore.js +26 -2
  184. package/_esm/stores/header/useHeaderStore.js.map +1 -1
  185. package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
  186. package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
  187. package/_esm/stores/settings/types.d.ts +1 -1
  188. package/_esm/stores/settings/useSettingsStore.js +22 -9
  189. package/_esm/stores/settings/useSettingsStore.js.map +1 -1
  190. package/_esm/themes/createTheme.js +1 -2
  191. package/_esm/themes/createTheme.js.map +1 -1
  192. package/_esm/types/events.d.ts +6 -6
  193. package/_esm/types/events.js +3 -2
  194. package/_esm/types/events.js.map +1 -1
  195. package/_esm/utils/chainType.js +3 -2
  196. package/_esm/utils/chainType.js.map +1 -1
  197. package/_esm/utils/converters.js +2 -1
  198. package/_esm/utils/converters.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 +3 -2
  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 +4 -3
  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/converters.ts +2 -1
  299. package/utils/elements.ts +21 -1
  300. package/utils/fees.ts +13 -15
  301. package/utils/format.ts +1 -1
  302. package/utils/navigationRoutes.ts +7 -1
  303. package/utils/svm.ts +10 -0
  304. package/utils/wallet.ts +1 -1
  305. package/_esm/components/Avatar/SmallAvatar.d.ts +0 -4
  306. package/_esm/components/Avatar/SmallAvatar.js +0 -12
  307. package/_esm/components/Avatar/SmallAvatar.js.map +0 -1
  308. package/_esm/components/Header/DisconnectIconButton.d.ts +0 -4
  309. package/_esm/components/Header/DisconnectIconButton.js +0 -12
  310. package/_esm/components/Header/DisconnectIconButton.js.map +0 -1
  311. package/_esm/hooks/useHeaderHeight.d.ts +0 -6
  312. package/_esm/hooks/useHeaderHeight.js +0 -23
  313. package/_esm/hooks/useHeaderHeight.js.map +0 -1
  314. package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
  315. package/_esm/providers/WalletProvider/UTXOBaseProvider.js +0 -17
  316. package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
  317. package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
  318. package/_esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
  319. package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
  320. package/_esm/providers/WalletProvider/UTXOProvider.d.ts +0 -3
  321. package/_esm/providers/WalletProvider/UTXOProvider.js +0 -18
  322. package/_esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
  323. package/components/Avatar/SmallAvatar.tsx +0 -16
  324. package/components/Header/DisconnectIconButton.tsx +0 -18
  325. package/hooks/useHeaderHeight.ts +0 -27
  326. package/providers/WalletProvider/UTXOBaseProvider.tsx +0 -28
  327. package/providers/WalletProvider/UTXOExternalContext.ts +0 -3
  328. package/providers/WalletProvider/UTXOProvider.tsx +0 -26
@@ -1,4 +1,5 @@
1
1
  import { createContext, useContext, useRef } from 'react';
2
+ import { shallow } from 'zustand/shallow';
2
3
  import { createWithEqualityFn } from 'zustand/traditional';
3
4
  import type { PersistStoreProps, PersistStoreProviderProps } from '../types.js';
4
5
  import type { HeaderState, HeaderStore } from './types.js';
@@ -30,13 +31,45 @@ export function useHeaderStoreContext() {
30
31
  return useStore;
31
32
  }
32
33
 
33
- export function useHeaderStore<T>(selector: (state: HeaderState) => T): T {
34
+ export function useHeaderStore<T>(
35
+ selector: (state: HeaderState) => T,
36
+ equalityCheck?: (objA: T, objB: T) => boolean,
37
+ ): T {
34
38
  const useStore = useHeaderStoreContext();
35
- return useStore(selector);
39
+ return useStore(selector, equalityCheck);
36
40
  }
41
+
42
+ // We use fixed position on the header when Widget is in Full Height layout.
43
+ // We do this to get it to work like the sticky header does in the other layout modes.
44
+ // As the header is position fixed its not in the document flow anymore.
45
+ // To prevent the remaining page content from appearing behind the header we need to
46
+ // pass the headers height so that the position of the page content can be adjusted
47
+ export function useHeaderHeight() {
48
+ const [headerHeight] = useHeaderStore(
49
+ (state) => [state.headerHeight],
50
+ shallow,
51
+ );
52
+
53
+ return {
54
+ headerHeight,
55
+ };
56
+ }
57
+
58
+ export function useSetHeaderHeight() {
59
+ const [setHeaderHeight] = useHeaderStore(
60
+ (state) => [state.setHeaderHeight],
61
+ shallow,
62
+ );
63
+
64
+ return {
65
+ setHeaderHeight,
66
+ };
67
+ }
68
+
37
69
  export const createHeaderStore = ({ namePrefix }: PersistStoreProps) =>
38
70
  createWithEqualityFn<HeaderState>(
39
71
  (set, get) => ({
72
+ headerHeight: 108, // a basic default height
40
73
  setAction: (element) => {
41
74
  set(() => ({
42
75
  element,
@@ -59,6 +92,11 @@ export const createHeaderStore = ({ namePrefix }: PersistStoreProps) =>
59
92
  title: undefined,
60
93
  }));
61
94
  },
95
+ setHeaderHeight: (headerHeight) => {
96
+ set(() => ({
97
+ headerHeight,
98
+ }));
99
+ },
62
100
  }),
63
101
  Object.is,
64
102
  );
@@ -1,5 +1,5 @@
1
- import { useAccount } from '@lifi/wallet-management';
2
1
  import { shallow } from 'zustand/shallow';
2
+ import { useAccount } from '../../hooks/useAccount.js';
3
3
  import { useRouteExecutionStore } from './RouteExecutionStore.js';
4
4
  import type { RouteExecution } from './types.js';
5
5
  import { RouteExecutionStatus } from './types.js';
@@ -40,7 +40,7 @@ export interface SettingsState extends SettingsProps {
40
40
  reset?: boolean,
41
41
  ): void;
42
42
  setToolValue(toolType: SettingsToolType, tool: string, value: boolean): void;
43
- toggleTools(toolType: SettingsToolType): void;
43
+ toggleToolKeys(toolType: SettingsToolType, toolKeys: string[]): void;
44
44
  reset(bridges: string[], exchanges: string[]): void;
45
45
  }
46
46
 
@@ -99,17 +99,38 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
99
99
  ),
100
100
  };
101
101
  }),
102
- toggleTools: (toolType) =>
102
+ toggleToolKeys: (toolType, toolKeys) =>
103
103
  set((state) => {
104
- const enabledTools = { ...state[`_enabled${toolType}`] };
105
- const enableAll = Boolean(state[`disabled${toolType}`].length);
106
- for (const toolKey in enabledTools) {
107
- enabledTools[toolKey] = enableAll;
108
- }
104
+ const allKeysInCollectionEnabled = toolKeys.every(
105
+ (toolKey) => state[`_enabled${toolType}`][toolKey],
106
+ );
107
+
108
+ // then toggle those keys to false
109
+ const updatedTools = toolKeys.reduce(
110
+ (accum, toolKey) => {
111
+ accum[toolKey] = !allKeysInCollectionEnabled;
112
+ return accum;
113
+ },
114
+ {
115
+ ...state[`_enabled${toolType}`],
116
+ },
117
+ );
118
+
119
+ const enableKeys: string[] = [];
120
+ const disabledKeys: string[] = [];
121
+
122
+ Object.entries(updatedTools).forEach(([key, value]) => {
123
+ if (value) {
124
+ enableKeys.push(key);
125
+ } else {
126
+ disabledKeys.push(key);
127
+ }
128
+ });
129
+
109
130
  return {
110
- [`_enabled${toolType}`]: enabledTools,
111
- [`enabled${toolType}`]: enableAll ? Object.keys(enabledTools) : [],
112
- [`disabled${toolType}`]: enableAll ? [] : Object.keys(enabledTools),
131
+ [`_enabled${toolType}`]: updatedTools,
132
+ [`enabled${toolType}`]: enableKeys,
133
+ [`disabled${toolType}`]: disabledKeys,
113
134
  };
114
135
  }),
115
136
  reset: (bridges, exchanges) => {
@@ -63,7 +63,7 @@ export const createTheme = (
63
63
  const borderRadiusSecondary =
64
64
  widgetTheme.shape?.borderRadiusSecondary ?? shape.borderRadiusSecondary;
65
65
 
66
- const theme = createMuiTheme({
66
+ return createMuiTheme({
67
67
  container: widgetTheme.container,
68
68
  header: widgetTheme.header,
69
69
  navigation: {
@@ -409,6 +409,4 @@ export const createTheme = (
409
409
  },
410
410
  },
411
411
  });
412
-
413
- return theme;
414
412
  };
package/types/events.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ChainId, ChainType, Process, Route } from '@lifi/sdk';
2
+ import type { NavigationRouteType } from '../utils/navigationRoutes.js';
2
3
 
3
4
  export enum WidgetEvent {
4
5
  RouteExecutionStarted = 'routeExecutionStarted',
@@ -11,12 +12,13 @@ export enum WidgetEvent {
11
12
  SourceChainTokenSelected = 'sourceChainTokenSelected',
12
13
  DestinationChainTokenSelected = 'destinationChainTokenSelected',
13
14
  SendToWalletToggled = 'sendToWalletToggled',
14
- ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
15
15
  /**
16
- * @deprecated use useWalletManagementEvents hook.
16
+ * @deprecated Use `PageEntered` event instead.
17
17
  */
18
+ ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
18
19
  WalletConnected = 'walletConnected',
19
20
  WidgetExpanded = 'widgetExpanded',
21
+ PageEntered = 'pageEntered',
20
22
  }
21
23
 
22
24
  export type WidgetEvents = {
@@ -31,11 +33,9 @@ export type WidgetEvents = {
31
33
  destinationChainTokenSelected: ChainTokenSelected;
32
34
  sendToWalletToggled: boolean;
33
35
  reviewTransactionPageEntered?: Route;
34
- /**
35
- * @deprecated use useWalletManagementEvents hook.
36
- */
37
36
  walletConnected: WalletConnected;
38
37
  widgetExpanded: boolean;
38
+ pageEntered: NavigationRouteType;
39
39
  };
40
40
 
41
41
  export interface ContactSupport {
@@ -1,10 +1,11 @@
1
- import { ChainId, ChainType, isSVMAddress, isUTXOAddress } from '@lifi/sdk';
1
+ import { ChainId, ChainType } from '@lifi/sdk';
2
2
  import { isAddress as isEVMAddress } from 'viem';
3
+ import { isSVMAddress } from './svm.js';
3
4
 
4
5
  const chainTypeAddressValidation = {
5
6
  [ChainType.EVM]: isEVMAddress,
6
7
  [ChainType.SVM]: isSVMAddress,
7
- [ChainType.UTXO]: isUTXOAddress,
8
+ [ChainType.UTXO]: () => false,
8
9
  };
9
10
 
10
11
  export const getChainTypeFromAddress = (
@@ -8,6 +8,7 @@ import type {
8
8
  TokenAmount,
9
9
  ToolsResponse,
10
10
  } from '@lifi/sdk';
11
+ import { v4 as uuidv4 } from 'uuid';
11
12
  import { formatUnits } from 'viem';
12
13
  import type { RouteExecution } from '../stores/routes/types.js';
13
14
 
@@ -144,7 +145,7 @@ export const buildRouteFromTxHistory = (
144
145
  gasCostUSD: sending.gasAmountUSD,
145
146
  steps: [
146
147
  {
147
- id: crypto.randomUUID(),
148
+ id: uuidv4(),
148
149
  type: 'lifi',
149
150
  tool: tx.tool,
150
151
  toolDetails: usedTool,
package/utils/elements.ts CHANGED
@@ -3,8 +3,28 @@ export enum ElementId {
3
3
  Header = 'widget-header',
4
4
  RelativeContainer = 'widget-relative-container',
5
5
  ScrollableContainer = 'widget-scrollable-container',
6
- TokenList = 'token-list',
7
6
  }
8
7
 
9
8
  export const createElementId = (ElementId: ElementId, elementId: string) =>
10
9
  elementId ? `${ElementId}-${elementId}` : ElementId;
10
+
11
+ // NOTE: The getter functions here are often used with code that can be effected by css changes in the
12
+ // AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
13
+
14
+ export const getAppContainer = (elementId: string) =>
15
+ document.getElementById(
16
+ createElementId(ElementId.AppExpandedContainer, elementId),
17
+ );
18
+
19
+ export const getRelativeContainer = (elementId: string) =>
20
+ document.getElementById(
21
+ createElementId(ElementId.RelativeContainer, elementId),
22
+ );
23
+
24
+ export const getScrollableContainer = (elementId: string) =>
25
+ document.getElementById(
26
+ createElementId(ElementId.ScrollableContainer, elementId),
27
+ );
28
+
29
+ export const getHeaderElement = (elementId: string) =>
30
+ document.getElementById(createElementId(ElementId.Header, elementId));
package/utils/fees.ts CHANGED
@@ -104,22 +104,20 @@ export const getFeeCostsBreakdown = (
104
104
  export const getStepFeeCostsBreakdown = (
105
105
  feeCosts: FeeCost[] | GasCost[],
106
106
  ): FeesBreakdown => {
107
- const { token } = feeCosts[0];
108
-
109
- const { amount, amountUSD } = feeCosts.reduce(
110
- (acc, feeCost) => {
111
- const feeAmount = BigInt(Number(feeCost.amount).toFixed(0) || 0);
112
- const amountUSD =
113
- parseFloat(feeCost.token.priceUSD || '0') *
114
- parseFloat(formatUnits(feeAmount, feeCost.token.decimals));
115
-
116
- acc.amount += feeAmount;
117
- acc.amountUSD += amountUSD;
118
- return acc;
119
- },
120
- { amount: 0n, amountUSD: 0 },
107
+ const token = feeCosts[0].token;
108
+ const amount = feeCosts.reduce(
109
+ (amount, feeCost) => amount + BigInt(feeCost.amount || 0),
110
+ 0n,
111
+ );
112
+ const amountUSD = feeCosts.reduce(
113
+ (amount, feeCost) =>
114
+ amount +
115
+ parseFloat(feeCost.token.priceUSD || '0') *
116
+ parseFloat(
117
+ formatUnits(BigInt(feeCost.amount || 0), feeCost.token.decimals),
118
+ ),
119
+ 0,
121
120
  );
122
-
123
121
  return {
124
122
  amount,
125
123
  amountUSD,
package/utils/format.ts CHANGED
@@ -60,7 +60,7 @@ export function formatInputAmount(
60
60
  if (!amount) {
61
61
  return amount;
62
62
  }
63
- let formattedAmount = amount.replaceAll(',', '.');
63
+ let formattedAmount = amount.trim().replaceAll(',', '.');
64
64
  if (formattedAmount.startsWith('.')) {
65
65
  formattedAmount = '0' + formattedAmount;
66
66
  }
@@ -7,6 +7,7 @@ export const navigationRoutes = {
7
7
  fromToken: 'from-token',
8
8
  languages: 'languages',
9
9
  routes: 'routes',
10
+ selectWallet: 'select-wallet',
10
11
  settings: 'settings',
11
12
  toChain: 'to-chain',
12
13
  toToken: 'to-token',
@@ -30,6 +31,7 @@ export const stickyHeaderRoutes = [
30
31
  navigationRoutes.fromChain,
31
32
  navigationRoutes.home,
32
33
  navigationRoutes.routes,
34
+ navigationRoutes.selectWallet,
33
35
  navigationRoutes.settings,
34
36
  navigationRoutes.toChain,
35
37
  navigationRoutes.toTokenNative,
@@ -51,6 +53,7 @@ export const backButtonRoutes = [
51
53
  navigationRoutes.fromChain,
52
54
  navigationRoutes.fromToken,
53
55
  navigationRoutes.routes,
56
+ navigationRoutes.selectWallet,
54
57
  navigationRoutes.settings,
55
58
  navigationRoutes.toChain,
56
59
  navigationRoutes.toToken,
@@ -65,4 +68,7 @@ export const backButtonRoutes = [
65
68
  navigationRoutes.configuredWallets,
66
69
  ];
67
70
 
68
- export type NavigationRouteType = keyof typeof navigationRoutes;
71
+ export type NavigationRouteTypeKeys = keyof typeof navigationRoutes;
72
+
73
+ export type NavigationRouteType =
74
+ (typeof navigationRoutes)[NavigationRouteTypeKeys];
package/utils/svm.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+
3
+ export const isSVMAddress = (address: string) => {
4
+ try {
5
+ new PublicKey(address);
6
+ return true;
7
+ } catch {
8
+ return false;
9
+ }
10
+ };
package/utils/wallet.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export const shortenAddress = (address?: string) =>
2
2
  address
3
- ? `${address.substring(0, 7)}...${address.substring(address.length - 5)}`
3
+ ? `${address.substring(0, 5)}...${address.substring(address.length - 4)}`
4
4
  : null;
@@ -1,4 +0,0 @@
1
- export declare const SmallAvatar: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarOwnProps & import("@mui/material").AvatarSlotsAndSlotProps & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
- ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
- }, "children" | "sx" | "style" | "className" | "sizes" | "alt" | "src" | "srcSet" | "classes" | "variant" | "imgProps" | "slots" | "slotProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
- export declare const SmallAvatarSkeleton: () => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Avatar, Skeleton, styled } from '@mui/material';
3
- import { AvatarSkeletonContainer } from './Avatar.style.js';
4
- export const SmallAvatar = styled(Avatar)(({ theme }) => ({
5
- background: theme.palette.background.paper,
6
- width: 16,
7
- height: 16,
8
- }));
9
- export const SmallAvatarSkeleton = () => {
10
- return (_jsx(AvatarSkeletonContainer, { children: _jsx(Skeleton, { width: 16, height: 16, variant: "circular" }) }));
11
- };
12
- //# sourceMappingURL=SmallAvatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmallAvatar.js","sourceRoot":"","sources":["../../../components/Avatar/SmallAvatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACxD,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK;IAC1C,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,KAAC,uBAAuB,cACtB,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAC,UAAU,GAAG,GAC9B,CAC3B,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type Account } from '@lifi/wallet-management';
2
- export declare const DisconnectIconButton: ({ account }: {
3
- account: Account;
4
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAccountDisconnect } from '@lifi/wallet-management';
3
- import { PowerSettingsNewRounded } from '@mui/icons-material';
4
- import { IconButton } from '@mui/material';
5
- export const DisconnectIconButton = ({ account }) => {
6
- const disconnect = useAccountDisconnect();
7
- return (_jsx(IconButton, { size: "medium", onClick: async (e) => {
8
- e.stopPropagation();
9
- await disconnect(account);
10
- }, children: _jsx(PowerSettingsNewRounded, {}) }));
11
- };
12
- //# sourceMappingURL=DisconnectIconButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DisconnectIconButton.js","sourceRoot":"","sources":["../../../components/Header/DisconnectIconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAgB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAwB,EAAE,EAAE;IACxE,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAC1C,OAAO,CACL,KAAC,UAAU,IACT,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,YAED,KAAC,uBAAuB,KAAG,GAChB,CACd,CAAC;AACJ,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const minHeaderHeight = 64;
2
- export declare const maxHeaderHeight = 108;
3
- export declare const maxHeaderHeightSubvariantSplit = 136;
4
- export declare const useHeaderHeight: () => {
5
- headerHeight: number;
6
- };
@@ -1,23 +0,0 @@
1
- import { useHasExternalWalletProvider } from '../providers/WalletProvider/useHasExternalWalletProvider.js';
2
- import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
3
- export const minHeaderHeight = 64;
4
- export const maxHeaderHeight = 108;
5
- export const maxHeaderHeightSubvariantSplit = 136;
6
- // We use fixed position on the header when Widget is in Full Height layout.
7
- // We do this to get it to work like the sticky header does in the other layout modes.
8
- // As the header is position fixed its not in the document flow anymore.
9
- // To prevent the remaining page content from appearing behind the header we need to
10
- // pass the headers height so that the position of the page content can be adjusted
11
- export const useHeaderHeight = () => {
12
- const { hiddenUI, subvariant } = useWidgetConfig();
13
- const { hasExternalProvider } = useHasExternalWalletProvider();
14
- const headerHeight = subvariant === 'split'
15
- ? maxHeaderHeightSubvariantSplit
16
- : hiddenUI?.includes('walletMenu') || hasExternalProvider
17
- ? minHeaderHeight
18
- : maxHeaderHeight;
19
- return {
20
- headerHeight,
21
- };
22
- };
23
- //# sourceMappingURL=useHeaderHeight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useHeaderHeight.js","sourceRoot":"","sources":["../../hooks/useHeaderHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,6DAA6D,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AACnC,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAElD,4EAA4E;AAC5E,sFAAsF;AACtF,wEAAwE;AACxE,oFAAoF;AACpF,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;IACnD,MAAM,EAAE,mBAAmB,EAAE,GAAG,4BAA4B,EAAE,CAAC;IAE/D,MAAM,YAAY,GAChB,UAAU,KAAK,OAAO;QACpB,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,mBAAmB;YACvD,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,eAAe,CAAC;IAExB,OAAO;QACL,YAAY;KACb,CAAC;AACJ,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type FC, type PropsWithChildren } from 'react';
2
- export declare const UTXOBaseProvider: FC<PropsWithChildren>;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BigmiProvider, createDefaultBigmiConfig, useReconnect, } from '@lifi/wallet-management';
3
- import { useRef } from 'react';
4
- export const UTXOBaseProvider = ({ children }) => {
5
- const bigmi = useRef();
6
- if (!bigmi.current) {
7
- bigmi.current = createDefaultBigmiConfig({
8
- bigmiConfig: {
9
- ssr: true,
10
- multiInjectedProviderDiscovery: false,
11
- },
12
- });
13
- }
14
- useReconnect(bigmi.current.config);
15
- return (_jsx(BigmiProvider, { config: bigmi.current.config, reconnectOnMount: false, children: children }));
16
- };
17
- //# sourceMappingURL=UTXOBaseProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UTXOBaseProvider.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOBaseProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAmC,MAAM,OAAO,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtE,MAAM,KAAK,GAAG,MAAM,EAA4B,CAAC;IAEjD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAAC;YACvC,WAAW,EAAE;gBACX,GAAG,EAAE,IAAI;gBACT,8BAA8B,EAAE,KAAK;aACtC;SACF,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,CACL,KAAC,aAAa,IAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,YACjE,QAAQ,GACK,CACjB,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const UTXOExternalContext: import("react").Context<boolean>;
@@ -1,3 +0,0 @@
1
- import { createContext } from 'react';
2
- export const UTXOExternalContext = createContext(false);
3
- //# sourceMappingURL=UTXOExternalContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UTXOExternalContext.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOExternalContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAU,KAAK,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type FC, type PropsWithChildren } from 'react';
2
- export declare function useInBigmiContext(): boolean;
3
- export declare const UTXOProvider: FC<PropsWithChildren>;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ChainType } from '@lifi/sdk';
3
- import { BigmiContext } from '@lifi/wallet-management';
4
- import { useContext } from 'react';
5
- import { isItemAllowed } from '../../utils/item.js';
6
- import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
7
- import { UTXOBaseProvider } from './UTXOBaseProvider.js';
8
- import { UTXOExternalContext } from './UTXOExternalContext.js';
9
- export function useInBigmiContext() {
10
- const { chains } = useWidgetConfig();
11
- const context = useContext(BigmiContext);
12
- return Boolean(context) && isItemAllowed(ChainType.UTXO, chains?.types);
13
- }
14
- export const UTXOProvider = ({ children }) => {
15
- const inBigmiContext = useInBigmiContext();
16
- return inBigmiContext ? (_jsx(UTXOExternalContext.Provider, { value: inBigmiContext, children: children })) : (_jsx(UTXOBaseProvider, { children: children }));
17
- };
18
- //# sourceMappingURL=UTXOProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UTXOProvider.js","sourceRoot":"","sources":["../../../providers/WalletProvider/UTXOProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAmC,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,iBAAiB;IAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAEzC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClE,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,OAAO,cAAc,CAAC,CAAC,CAAC,CACtB,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,YAChD,QAAQ,GACoB,CAChC,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,cAAE,QAAQ,GAAoB,CAChD,CAAC;AACJ,CAAC,CAAC"}
@@ -1,16 +0,0 @@
1
- import { Avatar, Skeleton, styled } from '@mui/material';
2
- import { AvatarSkeletonContainer } from './Avatar.style.js';
3
-
4
- export const SmallAvatar = styled(Avatar)(({ theme }) => ({
5
- background: theme.palette.background.paper,
6
- width: 16,
7
- height: 16,
8
- }));
9
-
10
- export const SmallAvatarSkeleton = () => {
11
- return (
12
- <AvatarSkeletonContainer>
13
- <Skeleton width={16} height={16} variant="circular" />
14
- </AvatarSkeletonContainer>
15
- );
16
- };
@@ -1,18 +0,0 @@
1
- import { useAccountDisconnect, type Account } from '@lifi/wallet-management';
2
- import { PowerSettingsNewRounded } from '@mui/icons-material';
3
- import { IconButton } from '@mui/material';
4
-
5
- export const DisconnectIconButton = ({ account }: { account: Account }) => {
6
- const disconnect = useAccountDisconnect();
7
- return (
8
- <IconButton
9
- size="medium"
10
- onClick={async (e) => {
11
- e.stopPropagation();
12
- await disconnect(account);
13
- }}
14
- >
15
- <PowerSettingsNewRounded />
16
- </IconButton>
17
- );
18
- };
@@ -1,27 +0,0 @@
1
- import { useHasExternalWalletProvider } from '../providers/WalletProvider/useHasExternalWalletProvider.js';
2
- import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
3
-
4
- export const minHeaderHeight = 64;
5
- export const maxHeaderHeight = 108;
6
- export const maxHeaderHeightSubvariantSplit = 136;
7
-
8
- // We use fixed position on the header when Widget is in Full Height layout.
9
- // We do this to get it to work like the sticky header does in the other layout modes.
10
- // As the header is position fixed its not in the document flow anymore.
11
- // To prevent the remaining page content from appearing behind the header we need to
12
- // pass the headers height so that the position of the page content can be adjusted
13
- export const useHeaderHeight = () => {
14
- const { hiddenUI, subvariant } = useWidgetConfig();
15
- const { hasExternalProvider } = useHasExternalWalletProvider();
16
-
17
- const headerHeight =
18
- subvariant === 'split'
19
- ? maxHeaderHeightSubvariantSplit
20
- : hiddenUI?.includes('walletMenu') || hasExternalProvider
21
- ? minHeaderHeight
22
- : maxHeaderHeight;
23
-
24
- return {
25
- headerHeight,
26
- };
27
- };
@@ -1,28 +0,0 @@
1
- import type { DefaultWagmiConfigResult } from '@lifi/wallet-management';
2
- import {
3
- BigmiProvider,
4
- createDefaultBigmiConfig,
5
- useReconnect,
6
- } from '@lifi/wallet-management';
7
- import { useRef, type FC, type PropsWithChildren } from 'react';
8
-
9
- export const UTXOBaseProvider: FC<PropsWithChildren> = ({ children }) => {
10
- const bigmi = useRef<DefaultWagmiConfigResult>();
11
-
12
- if (!bigmi.current) {
13
- bigmi.current = createDefaultBigmiConfig({
14
- bigmiConfig: {
15
- ssr: true,
16
- multiInjectedProviderDiscovery: false,
17
- },
18
- });
19
- }
20
-
21
- useReconnect(bigmi.current.config);
22
-
23
- return (
24
- <BigmiProvider config={bigmi.current.config} reconnectOnMount={false}>
25
- {children}
26
- </BigmiProvider>
27
- );
28
- };
@@ -1,3 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- export const UTXOExternalContext = createContext<boolean>(false);
@@ -1,26 +0,0 @@
1
- import { ChainType } from '@lifi/sdk';
2
- import { BigmiContext } from '@lifi/wallet-management';
3
- import { useContext, type FC, type PropsWithChildren } from 'react';
4
- import { isItemAllowed } from '../../utils/item.js';
5
- import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
6
- import { UTXOBaseProvider } from './UTXOBaseProvider.js';
7
- import { UTXOExternalContext } from './UTXOExternalContext.js';
8
-
9
- export function useInBigmiContext(): boolean {
10
- const { chains } = useWidgetConfig();
11
- const context = useContext(BigmiContext);
12
-
13
- return Boolean(context) && isItemAllowed(ChainType.UTXO, chains?.types);
14
- }
15
-
16
- export const UTXOProvider: FC<PropsWithChildren> = ({ children }) => {
17
- const inBigmiContext = useInBigmiContext();
18
-
19
- return inBigmiContext ? (
20
- <UTXOExternalContext.Provider value={inBigmiContext}>
21
- {children}
22
- </UTXOExternalContext.Provider>
23
- ) : (
24
- <UTXOBaseProvider>{children}</UTXOBaseProvider>
25
- );
26
- };