@lifi/widget 3.6.2 → 3.7.0-beta.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 (253) hide show
  1. package/AppProvider.tsx +4 -4
  2. package/AppRoutes.tsx +2 -14
  3. package/CHANGELOG.md +0 -14
  4. package/_esm/AppProvider.js +1 -1
  5. package/_esm/AppProvider.js.map +1 -1
  6. package/_esm/AppRoutes.js +2 -9
  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 +1 -3
  11. package/_esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
  12. package/_esm/components/AppContainer.js +0 -7
  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 +1 -0
  18. package/_esm/components/Avatar/Avatar.js +7 -4
  19. package/_esm/components/Avatar/Avatar.js.map +1 -1
  20. package/_esm/components/Avatar/Avatar.style.d.ts +6 -3
  21. package/_esm/components/Avatar/Avatar.style.js +19 -6
  22. package/_esm/components/Avatar/Avatar.style.js.map +1 -1
  23. package/_esm/components/Avatar/SmallAvatar.d.ts +4 -0
  24. package/_esm/components/Avatar/SmallAvatar.js +12 -0
  25. package/_esm/components/Avatar/SmallAvatar.js.map +1 -0
  26. package/_esm/components/Avatar/TokenAvatar.js +1 -1
  27. package/_esm/components/Avatar/TokenAvatar.js.map +1 -1
  28. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +3 -5
  29. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
  30. package/_esm/components/ChainSelect/useChainSelect.js +5 -1
  31. package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
  32. package/_esm/components/FeeBreakdownTooltip.js +4 -1
  33. package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
  34. package/_esm/components/Header/EVMDisconnectIconButton.js +5 -4
  35. package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -1
  36. package/_esm/components/Header/NavigationHeader.js +1 -1
  37. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  38. package/_esm/components/Header/UTXODisconnectIconButton.d.ts +4 -0
  39. package/_esm/components/Header/UTXODisconnectIconButton.js +13 -0
  40. package/_esm/components/Header/UTXODisconnectIconButton.js.map +1 -0
  41. package/_esm/components/Header/WalletHeader.js +5 -9
  42. package/_esm/components/Header/WalletHeader.js.map +1 -1
  43. package/_esm/components/Header/WalletMenu.js +10 -15
  44. package/_esm/components/Header/WalletMenu.js.map +1 -1
  45. package/_esm/components/Header/WalletMenu.style.js +5 -1
  46. package/_esm/components/Header/WalletMenu.style.js.map +1 -1
  47. package/_esm/components/Routes/RoutesExpanded.js +1 -1
  48. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  49. package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
  50. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  51. package/_esm/components/StepActions/StepActions.js +1 -1
  52. package/_esm/components/StepActions/StepActions.js.map +1 -1
  53. package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
  54. package/_esm/components/Token/Token.js +1 -1
  55. package/_esm/components/Token/Token.js.map +1 -1
  56. package/_esm/components/TokenList/TokenList.js +1 -1
  57. package/_esm/components/TokenList/TokenList.js.map +1 -1
  58. package/_esm/components/TokenList/TokenListItem.js +11 -5
  59. package/_esm/components/TokenList/TokenListItem.js.map +1 -1
  60. package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
  61. package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  62. package/_esm/components/TokenList/types.d.ts +3 -3
  63. package/_esm/components/TokenRate/TokenRate.js +2 -2
  64. package/_esm/components/TokenRate/TokenRate.js.map +1 -1
  65. package/_esm/config/version.d.ts +1 -1
  66. package/_esm/config/version.js +1 -1
  67. package/_esm/config/version.js.map +1 -1
  68. package/_esm/hooks/useAvailableChains.d.ts +2 -1
  69. package/_esm/hooks/useAvailableChains.js +9 -8
  70. package/_esm/hooks/useAvailableChains.js.map +1 -1
  71. package/_esm/hooks/useChains.d.ts +4 -3
  72. package/_esm/hooks/useChains.js +5 -3
  73. package/_esm/hooks/useChains.js.map +1 -1
  74. package/_esm/hooks/useFromTokenSufficiency.js +1 -1
  75. package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
  76. package/_esm/hooks/useGasSufficiency.js +3 -3
  77. package/_esm/hooks/useGasSufficiency.js.map +1 -1
  78. package/_esm/hooks/useProcessMessage.js +4 -0
  79. package/_esm/hooks/useProcessMessage.js.map +1 -1
  80. package/_esm/hooks/useRouteExecution.js +1 -1
  81. package/_esm/hooks/useRouteExecution.js.map +1 -1
  82. package/_esm/hooks/useRoutes.js +1 -1
  83. package/_esm/hooks/useRoutes.js.map +1 -1
  84. package/_esm/hooks/useScrollableContainer.d.ts +1 -0
  85. package/_esm/hooks/useScrollableContainer.js +2 -1
  86. package/_esm/hooks/useScrollableContainer.js.map +1 -1
  87. package/_esm/hooks/useSetContentHeight.js +6 -9
  88. package/_esm/hooks/useSetContentHeight.js.map +1 -1
  89. package/_esm/hooks/useTokenBalance.js +1 -1
  90. package/_esm/hooks/useTokenBalance.js.map +1 -1
  91. package/_esm/hooks/useTokenBalances.js +1 -1
  92. package/_esm/hooks/useTokenBalances.js.map +1 -1
  93. package/_esm/hooks/useTokens.js +1 -1
  94. package/_esm/hooks/useTokens.js.map +1 -1
  95. package/_esm/hooks/useTransactionDetails.js +1 -1
  96. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  97. package/_esm/hooks/useTransactionHistory.js +1 -1
  98. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  99. package/_esm/i18n/en.json +3 -4
  100. package/_esm/index.d.ts +0 -2
  101. package/_esm/index.js +0 -2
  102. package/_esm/index.js.map +1 -1
  103. package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
  104. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  105. package/_esm/pages/SelectTokenPage/useTokenListHeight.js +4 -7
  106. package/_esm/pages/SelectTokenPage/useTokenListHeight.js.map +1 -1
  107. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
  108. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  109. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  110. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  111. package/_esm/pages/TransactionPage/StatusBottomSheet.js +5 -5
  112. package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
  113. package/_esm/providers/I18nProvider/types.d.ts +2 -2
  114. package/_esm/providers/WalletProvider/SDKProviders.js +15 -7
  115. package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  116. package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +2 -0
  117. package/_esm/providers/WalletProvider/UTXOBaseProvider.js +17 -0
  118. package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +1 -0
  119. package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +1 -0
  120. package/_esm/providers/WalletProvider/UTXOExternalContext.js +3 -0
  121. package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +1 -0
  122. package/_esm/providers/WalletProvider/UTXOProvider.d.ts +3 -0
  123. package/_esm/providers/WalletProvider/UTXOProvider.js +18 -0
  124. package/_esm/providers/WalletProvider/UTXOProvider.js.map +1 -0
  125. package/_esm/providers/WalletProvider/WalletProvider.d.ts +1 -0
  126. package/_esm/providers/WalletProvider/WalletProvider.js +14 -1
  127. package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
  128. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
  129. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +8 -3
  130. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
  131. package/_esm/providers/WidgetProvider/WidgetProvider.js +2 -1
  132. package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  133. package/_esm/providers/WidgetProvider/types.d.ts +0 -2
  134. package/_esm/stores/form/FormUpdater.js +1 -1
  135. package/_esm/stores/form/FormUpdater.js.map +1 -1
  136. package/_esm/stores/form/types.d.ts +4 -4
  137. package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
  138. package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
  139. package/_esm/themes/createTheme.js +2 -1
  140. package/_esm/themes/createTheme.js.map +1 -1
  141. package/_esm/types/events.d.ts +6 -0
  142. package/_esm/types/events.js +3 -0
  143. package/_esm/types/events.js.map +1 -1
  144. package/_esm/utils/chainType.js +2 -3
  145. package/_esm/utils/chainType.js.map +1 -1
  146. package/_esm/utils/elements.d.ts +0 -4
  147. package/_esm/utils/elements.js +0 -6
  148. package/_esm/utils/elements.js.map +1 -1
  149. package/_esm/utils/fees.js +9 -5
  150. package/_esm/utils/fees.js.map +1 -1
  151. package/_esm/utils/format.js +1 -1
  152. package/_esm/utils/format.js.map +1 -1
  153. package/_esm/utils/navigationRoutes.d.ts +0 -1
  154. package/_esm/utils/navigationRoutes.js +0 -3
  155. package/_esm/utils/navigationRoutes.js.map +1 -1
  156. package/_esm/utils/wallet.js +1 -1
  157. package/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
  158. package/components/AmountInput/AmountInputEndAdornment.tsx +1 -5
  159. package/components/AppContainer.tsx +0 -8
  160. package/components/Avatar/AccountAvatar.tsx +2 -2
  161. package/components/Avatar/Avatar.style.tsx +20 -7
  162. package/components/Avatar/Avatar.tsx +12 -4
  163. package/components/Avatar/SmallAvatar.tsx +16 -0
  164. package/components/Avatar/TokenAvatar.tsx +1 -1
  165. package/components/BaseTransactionButton/BaseTransactionButton.tsx +3 -5
  166. package/components/ChainSelect/useChainSelect.ts +10 -1
  167. package/components/FeeBreakdownTooltip.tsx +4 -1
  168. package/components/Header/EVMDisconnectIconButton.tsx +5 -5
  169. package/components/Header/NavigationHeader.tsx +1 -1
  170. package/components/Header/UTXODisconnectIconButton.tsx +24 -0
  171. package/components/Header/WalletHeader.tsx +11 -12
  172. package/components/Header/WalletMenu.style.tsx +5 -1
  173. package/components/Header/WalletMenu.tsx +23 -24
  174. package/components/Routes/RoutesExpanded.tsx +1 -2
  175. package/components/SendToWallet/SendToWalletButton.tsx +1 -1
  176. package/components/StepActions/StepActions.tsx +1 -1
  177. package/components/Token/Token.tsx +1 -1
  178. package/components/TokenList/TokenList.tsx +1 -1
  179. package/components/TokenList/TokenListItem.tsx +15 -7
  180. package/components/TokenList/VirtualizedTokenList.tsx +1 -1
  181. package/components/TokenList/types.ts +3 -3
  182. package/components/TokenRate/TokenRate.tsx +2 -2
  183. package/config/version.ts +1 -1
  184. package/hooks/useAvailableChains.ts +9 -10
  185. package/hooks/useChains.ts +6 -3
  186. package/hooks/useFromTokenSufficiency.ts +1 -1
  187. package/hooks/useGasSufficiency.ts +5 -3
  188. package/hooks/useProcessMessage.ts +4 -0
  189. package/hooks/useRouteExecution.ts +1 -1
  190. package/hooks/useRoutes.ts +1 -1
  191. package/hooks/useScrollableContainer.ts +6 -1
  192. package/hooks/useSetContentHeight.ts +6 -10
  193. package/hooks/useTokenBalance.ts +1 -1
  194. package/hooks/useTokenBalances.ts +1 -1
  195. package/hooks/useTokens.ts +2 -1
  196. package/hooks/useTransactionDetails.ts +1 -1
  197. package/hooks/useTransactionHistory.ts +1 -1
  198. package/i18n/en.json +3 -4
  199. package/index.ts +0 -2
  200. package/package.json +5 -5
  201. package/pages/RoutesPage/RoutesPage.tsx +1 -1
  202. package/pages/SelectTokenPage/useTokenListHeight.ts +10 -13
  203. package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -2
  204. package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
  205. package/pages/TransactionPage/StatusBottomSheet.tsx +8 -6
  206. package/providers/I18nProvider/types.ts +2 -2
  207. package/providers/WalletProvider/SDKProviders.tsx +25 -7
  208. package/providers/WalletProvider/UTXOBaseProvider.tsx +28 -0
  209. package/providers/WalletProvider/UTXOExternalContext.ts +3 -0
  210. package/providers/WalletProvider/UTXOProvider.tsx +26 -0
  211. package/providers/WalletProvider/WalletProvider.tsx +24 -3
  212. package/providers/WalletProvider/useHasExternalWalletProvider.ts +11 -5
  213. package/providers/WidgetProvider/WidgetProvider.tsx +2 -1
  214. package/providers/WidgetProvider/types.ts +0 -2
  215. package/stores/form/FormUpdater.tsx +1 -1
  216. package/stores/form/types.ts +4 -4
  217. package/stores/routes/useExecutingRoutesIds.ts +1 -1
  218. package/themes/createTheme.ts +3 -1
  219. package/types/events.ts +6 -0
  220. package/utils/chainType.ts +2 -3
  221. package/utils/elements.ts +0 -21
  222. package/utils/fees.ts +15 -13
  223. package/utils/format.ts +1 -1
  224. package/utils/navigationRoutes.ts +0 -3
  225. package/utils/wallet.ts +1 -1
  226. package/_esm/components/SmallAvatar.d.ts +0 -10
  227. package/_esm/components/SmallAvatar.js +0 -19
  228. package/_esm/components/SmallAvatar.js.map +0 -1
  229. package/_esm/hooks/useAccount.d.ts +0 -45
  230. package/_esm/hooks/useAccount.js +0 -56
  231. package/_esm/hooks/useAccount.js.map +0 -1
  232. package/_esm/hooks/useWallets.d.ts +0 -6
  233. package/_esm/hooks/useWallets.js +0 -80
  234. package/_esm/hooks/useWallets.js.map +0 -1
  235. package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +0 -9
  236. package/_esm/pages/SelectWalletPage/EVMListItemButton.js +0 -39
  237. package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +0 -1
  238. package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +0 -6
  239. package/_esm/pages/SelectWalletPage/SVMListItemButton.js +0 -32
  240. package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +0 -1
  241. package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  242. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +0 -41
  243. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +0 -1
  244. package/_esm/utils/svm.d.ts +0 -1
  245. package/_esm/utils/svm.js +0 -11
  246. package/_esm/utils/svm.js.map +0 -1
  247. package/components/SmallAvatar.tsx +0 -25
  248. package/hooks/useAccount.ts +0 -109
  249. package/hooks/useWallets.ts +0 -147
  250. package/pages/SelectWalletPage/EVMListItemButton.tsx +0 -74
  251. package/pages/SelectWalletPage/SVMListItemButton.tsx +0 -47
  252. package/pages/SelectWalletPage/SelectWalletPage.tsx +0 -90
  253. package/utils/svm.ts +0 -10
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",
20
19
  "checkoutReview": "Review purchase",
21
20
  "close": "Close",
22
21
  "confirm": "Confirm",
22
+ "connectAnotherWallet": "Connect another wallet",
23
23
  "connectWallet": "Connect wallet",
24
24
  "contactSupport": "Contact support",
25
25
  "continue": "Continue",
@@ -139,6 +139,7 @@
139
139
  "signatureRejected": "Your signature is required to complete the transaction. {{amount, number(maximumFractionDigits: 9)}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
140
140
  "slippageThreshold": "The slippage is larger than the defined threshold. Please request a new quote.",
141
141
  "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.",
142
143
  "transactionExpired": "The block height has exceeded the maximum allowed limit or blockhash is no longer recent enough.",
143
144
  "transactionFailed": "Please check the block explorer for more information.",
144
145
  "transactionNotSent": "Transaction was not sent.",
@@ -158,6 +159,7 @@
158
159
  "signatureRejected": "Signature required",
159
160
  "slippageNotMet": "Slippage conditions not met",
160
161
  "transactionCanceled": "Transaction canceled",
162
+ "transactionConflict": "Transaction conflict",
161
163
  "transactionExpired": "Transaction expired",
162
164
  "transactionFailed": "Transaction failed",
163
165
  "transactionSimulationFailed": "Transaction simulation failed",
@@ -303,8 +305,5 @@
303
305
  "noBookmarkedWallets": "No bookmarked wallets",
304
306
  "noConnectedWallets": "No connected wallets",
305
307
  "noRecentWallets": "No recent wallets"
306
- },
307
- "wallet": {
308
- "extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
309
308
  }
310
309
  }
package/index.ts CHANGED
@@ -8,9 +8,7 @@ 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';
12
11
  export { useAvailableChains } from './hooks/useAvailableChains.js';
13
- export { useWallets, walletComparator } from './hooks/useWallets.js';
14
12
  export { useWidgetEvents, widgetEvents } from './hooks/useWidgetEvents.js';
15
13
  export * from './stores/form/types.js';
16
14
  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.6.2",
3
+ "version": "3.7.0-beta.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,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@emotion/react": "^11.13.3",
36
36
  "@emotion/styled": "^11.13.0",
37
- "@lifi/sdk": "^3.2.3",
38
- "@lifi/wallet-management": "^3.1.6",
37
+ "@lifi/sdk": "^3.3.0-beta.0",
38
+ "@lifi/wallet-management": "^3.3.0-beta.0",
39
39
  "@mui/icons-material": "^5.16.7",
40
40
  "@mui/lab": "^5.0.0-alpha.173",
41
41
  "@mui/material": "^5.16.7",
@@ -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.9",
57
- "wagmi": "^2.12.12",
56
+ "viem": "^2.21.14",
57
+ "wagmi": "^2.12.14",
58
58
  "zustand": "^4.5.5"
59
59
  },
60
60
  "peerDependencies": {
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
2
  import type { Route } from '@lifi/sdk';
3
+ import { useAccount } from '@lifi/wallet-management';
3
4
  import type { BoxProps } from '@mui/material';
4
5
  import { useMemo } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
@@ -7,7 +8,6 @@ import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate.js';
7
8
  import { RouteCard } from '../../components/RouteCard/RouteCard.js';
8
9
  import { RouteCardSkeleton } from '../../components/RouteCard/RouteCardSkeleton.js';
9
10
  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';
@@ -2,12 +2,7 @@ import { useTheme } from '@mui/material';
2
2
  import type { MutableRefObject } from 'react';
3
3
  import { useLayoutEffect, useState } from 'react';
4
4
  import { useDefaultElementId } from '../../hooks/useDefaultElementId.js';
5
- import {
6
- ElementId,
7
- getAppContainer,
8
- getHeaderElement,
9
- getScrollableContainer,
10
- } from '../../utils/elements.js';
5
+ import { ElementId, createElementId } from '../../utils/elements.js';
11
6
 
12
7
  const debounce = (func: Function, timeout = 300) => {
13
8
  let timer: ReturnType<typeof setTimeout>;
@@ -23,9 +18,13 @@ const getContentHeight = (
23
18
  elementId: string,
24
19
  listParentRef: MutableRefObject<HTMLUListElement | null>,
25
20
  ) => {
26
- const containerElement = getScrollableContainer(elementId);
21
+ const containerElement = document.getElementById(
22
+ createElementId(ElementId.ScrollableContainer, elementId),
23
+ );
27
24
 
28
- const headerElement = getHeaderElement(elementId);
25
+ const headerElement = document.getElementById(
26
+ createElementId(ElementId.Header, elementId),
27
+ );
29
28
 
30
29
  const listParentElement = listParentRef?.current;
31
30
 
@@ -64,10 +63,6 @@ interface UseContentHeightProps {
64
63
  export const minTokenListHeight = 360;
65
64
  export const minMobileTokenListHeight = 160;
66
65
 
67
- // NOTE: this hook is implicitly tied to the widget height functionality in the
68
- // AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
69
- // CSS changes in those components can have implications for the functionality in this hook
70
-
71
66
  export const useTokenListHeight = ({
72
67
  listParentRef,
73
68
  headerRef,
@@ -86,7 +81,9 @@ export const useTokenListHeight = ({
86
81
  // calling this on initial mount prevents the lists resizing appearing glitchy
87
82
  handleResize();
88
83
 
89
- const appContainer = getAppContainer(elementId);
84
+ const appContainer = document.getElementById(
85
+ createElementId(ElementId.AppExpandedContainer, elementId),
86
+ );
90
87
 
91
88
  let resizeObserver: ResizeObserver;
92
89
  if (appContainer) {
@@ -1,3 +1,5 @@
1
+ import type { Account } from '@lifi/wallet-management';
2
+ import { useAccount } from '@lifi/wallet-management';
1
3
  import {
2
4
  ContentCopyRounded,
3
5
  MoreHoriz,
@@ -12,8 +14,6 @@ import { AccountAvatar } from '../../components/Avatar/AccountAvatar.js';
12
14
  import { ListItem } from '../../components/ListItem/ListItem.js';
13
15
  import { ListItemButton } from '../../components/ListItem/ListItemButton.js';
14
16
  import { Menu } from '../../components/Menu.js';
15
- import type { Account } from '../../hooks/useAccount.js';
16
- import { useAccount } from '../../hooks/useAccount.js';
17
17
  import { useExplorer } from '../../hooks/useExplorer.js';
18
18
  import { useHeader } from '../../hooks/useHeader.js';
19
19
  import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
@@ -1,3 +1,4 @@
1
+ import { useAccount } from '@lifi/wallet-management';
1
2
  import { Error, History, TurnedIn, Wallet } from '@mui/icons-material';
2
3
  import { Box, Tooltip, Typography } from '@mui/material';
3
4
  import type { ChangeEvent } from 'react';
@@ -7,7 +8,6 @@ import { useNavigate } from 'react-router-dom';
7
8
  import type { BottomSheetBase } from '../../components/BottomSheet/types.js';
8
9
  import { ButtonTertiary } from '../../components/ButtonTertiary.js';
9
10
  import { CardButton } from '../../components/Card/CardButton.js';
10
- import { useAccount } from '../../hooks/useAccount.js';
11
11
  import {
12
12
  AddressType,
13
13
  useAddressValidation,
@@ -301,12 +301,7 @@ export const StatusBottomSheetContent: React.FC<
301
301
  <Typography py={1}>{secondaryMessage}</Typography>
302
302
  ) : null}
303
303
  {VcComponent ? <VcComponent route={route} /> : null}
304
- <Box sx={{ display: 'flex', marginTop: 2, gap: 1.5 }}>
305
- {hasEnumFlag(status, RouteExecutionStatus.Done) ? (
306
- <Button variant="text" onClick={handleSeeDetails} fullWidth>
307
- {t('button.seeDetails')}
308
- </Button>
309
- ) : null}
304
+ <Box mt={2}>
310
305
  <Button variant="contained" fullWidth onClick={handlePrimaryButton}>
311
306
  {status === RouteExecutionStatus.Idle ? t('button.ok') : null}
312
307
  {hasEnumFlag(status, RouteExecutionStatus.Done)
@@ -317,6 +312,13 @@ export const StatusBottomSheetContent: React.FC<
317
312
  : null}
318
313
  </Button>
319
314
  </Box>
315
+ {hasEnumFlag(status, RouteExecutionStatus.Done) ? (
316
+ <Box mt={2}>
317
+ <Button variant="text" onClick={handleSeeDetails} fullWidth>
318
+ {t('button.seeDetails')}
319
+ </Button>
320
+ </Box>
321
+ ) : null}
320
322
  </Box>
321
323
  );
322
324
  };
@@ -12,14 +12,14 @@ export type LanguageResource = typeof languages.en;
12
12
 
13
13
  export type LanguageResources =
14
14
  | {
15
- [language in LanguageKey]?: PartialResource<LanguageResource>;
15
+ [K in LanguageKey]?: PartialResource<LanguageResource>;
16
16
  }
17
17
  | {
18
18
  [language: string]: PartialResource<LanguageResource>;
19
19
  };
20
20
 
21
21
  export type LanguageTranslationResource = {
22
- [namespace in 'translation']: PartialResource<LanguageResource>;
22
+ [N in 'translation']: PartialResource<LanguageResource>;
23
23
  };
24
24
 
25
25
  export type LanguageTranslationResources = {
@@ -1,16 +1,24 @@
1
1
  import type { SDKProvider } from '@lifi/sdk';
2
- import { ChainType, EVM, Solana, config } from '@lifi/sdk';
2
+ import { ChainType, EVM, Solana, UTXO, config } from '@lifi/sdk';
3
+ import {
4
+ getConnectorClient as getBigmiConnectorClient,
5
+ useConfig as useBigmiConfig,
6
+ } from '@lifi/wallet-management';
3
7
  import type { SignerWalletAdapter } from '@solana/wallet-adapter-base';
4
8
  import { useWallet } from '@solana/wallet-adapter-react';
5
- import { getWalletClient, switchChain } from '@wagmi/core';
9
+ import {
10
+ getConnectorClient as getWagmiConnectorClient,
11
+ switchChain,
12
+ } from '@wagmi/core';
6
13
  import { useEffect } from 'react';
7
- import { useConfig } from 'wagmi';
14
+ import { useConfig as useWagmiConfig } from 'wagmi';
8
15
  import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
9
16
 
10
17
  export const SDKProviders = () => {
11
18
  const { sdkConfig } = useWidgetConfig();
12
19
  const { wallet } = useWallet();
13
- const wagmiConfig = useConfig();
20
+ const wagmiConfig = useWagmiConfig();
21
+ const bigmiConfig = useBigmiConfig();
14
22
 
15
23
  useEffect(() => {
16
24
  // Configure SDK Providers
@@ -21,13 +29,16 @@ export const SDKProviders = () => {
21
29
  const hasConfiguredSVMProvider = sdkConfig?.providers?.some(
22
30
  (provider) => provider.type === ChainType.SVM,
23
31
  );
32
+ const hasConfiguredUTXOProvider = sdkConfig?.providers?.some(
33
+ (provider) => provider.type === ChainType.UTXO,
34
+ );
24
35
  if (!hasConfiguredEVMProvider) {
25
36
  providers.push(
26
37
  EVM({
27
- getWalletClient: () => getWalletClient(wagmiConfig),
38
+ getWalletClient: () => getWagmiConnectorClient(wagmiConfig),
28
39
  switchChain: async (chainId: number) => {
29
40
  const chain = await switchChain(wagmiConfig, { chainId });
30
- return getWalletClient(wagmiConfig, { chainId: chain.id });
41
+ return getWagmiConnectorClient(wagmiConfig, { chainId: chain.id });
31
42
  },
32
43
  }),
33
44
  );
@@ -41,11 +52,18 @@ export const SDKProviders = () => {
41
52
  }),
42
53
  );
43
54
  }
55
+ if (!hasConfiguredUTXOProvider) {
56
+ providers.push(
57
+ UTXO({
58
+ getWalletClient: () => getBigmiConnectorClient(bigmiConfig),
59
+ }),
60
+ );
61
+ }
44
62
  if (sdkConfig?.providers?.length) {
45
63
  providers.push(...sdkConfig?.providers);
46
64
  }
47
65
  config.setProviders(providers);
48
- }, [sdkConfig?.providers, wagmiConfig, wallet?.adapter]);
66
+ }, [bigmiConfig, sdkConfig?.providers, wagmiConfig, wallet?.adapter]);
49
67
 
50
68
  return null;
51
69
  };
@@ -0,0 +1,28 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+
3
+ export const UTXOExternalContext = createContext<boolean>(false);
@@ -0,0 +1,26 @@
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
+ };
@@ -1,15 +1,36 @@
1
- import { type FC, type PropsWithChildren } from 'react';
1
+ import type { WalletManagementConfig } from '@lifi/wallet-management';
2
+ import { WalletManagementProvider } from '@lifi/wallet-management';
3
+ import { useMemo, type FC, type PropsWithChildren } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js';
2
6
  import { EVMProvider } from './EVMProvider.js';
3
7
  import { SDKProviders } from './SDKProviders.js';
4
8
  import { SVMProvider } from './SVMProvider.js';
9
+ import { UTXOProvider } from './UTXOProvider.js';
5
10
 
6
11
  export const WalletProvider: FC<PropsWithChildren> = ({ children }) => {
7
12
  return (
8
13
  <EVMProvider>
9
14
  <SVMProvider>
10
- <SDKProviders />
11
- {children}
15
+ <UTXOProvider>
16
+ <SDKProviders />
17
+ <WalletMenuProvider>{children}</WalletMenuProvider>
18
+ </UTXOProvider>
12
19
  </SVMProvider>
13
20
  </EVMProvider>
14
21
  );
15
22
  };
23
+
24
+ export const WalletMenuProvider: FC<PropsWithChildren> = ({ children }) => {
25
+ const { walletConfig } = useWidgetConfig();
26
+ const { i18n } = useTranslation();
27
+
28
+ const config: WalletManagementConfig = useMemo(() => {
29
+ return { locale: i18n.resolvedLanguage as never, ...walletConfig };
30
+ }, [i18n.resolvedLanguage, walletConfig]);
31
+ return (
32
+ <WalletManagementProvider config={config}>
33
+ {children}
34
+ </WalletManagementProvider>
35
+ );
36
+ };
@@ -2,29 +2,35 @@ import { ChainType } from '@lifi/sdk';
2
2
  import { useContext, useMemo } from 'react';
3
3
  import { EVMExternalContext } from './EVMExternalContext.js';
4
4
  import { SVMExternalContext } from './SVMExternalContext.js';
5
+ import { UTXOExternalContext } from './UTXOExternalContext.js';
5
6
 
6
7
  interface ExternalWalletProvider {
7
8
  hasExternalProvider: boolean;
8
- providers: ChainType[];
9
+ availableChainTypes: ChainType[];
9
10
  }
10
11
 
11
12
  export function useHasExternalWalletProvider(): ExternalWalletProvider {
12
13
  const hasExternalEVMContext = useContext(EVMExternalContext);
13
14
  const hasExternalSVMContext = useContext(SVMExternalContext);
15
+ const hasExternalUTXOContext = useContext(UTXOExternalContext);
14
16
 
15
17
  const providers = useMemo(() => {
16
- const providers = [];
18
+ const providers: ChainType[] = [];
17
19
  if (hasExternalEVMContext) {
18
20
  providers.push(ChainType.EVM);
19
21
  }
20
22
  if (hasExternalSVMContext) {
21
23
  providers.push(ChainType.SVM);
22
24
  }
25
+ if (hasExternalUTXOContext) {
26
+ providers.push(ChainType.UTXO);
27
+ }
23
28
  return providers;
24
- }, [hasExternalEVMContext, hasExternalSVMContext]);
29
+ }, [hasExternalEVMContext, hasExternalSVMContext, hasExternalUTXOContext]);
25
30
 
26
31
  return {
27
- hasExternalProvider: hasExternalEVMContext || hasExternalSVMContext,
28
- providers,
32
+ hasExternalProvider:
33
+ hasExternalEVMContext || hasExternalSVMContext || hasExternalUTXOContext,
34
+ availableChainTypes: providers,
29
35
  };
30
36
  }
@@ -50,7 +50,8 @@ export const WidgetProvider: React.FC<
50
50
  },
51
51
  disableVersionCheck: true,
52
52
  widgetVersion: version,
53
- preloadChains: false,
53
+ // preloadChains: false,
54
+ // debug: true,
54
55
  };
55
56
  if (!sdkInitialized) {
56
57
  createConfig(_config);
@@ -1,8 +1,6 @@
1
1
  import type { WidgetConfig } from '../../types/widget.js';
2
2
 
3
3
  export type WidgetContextProps = WidgetConfig & {
4
- fromChain?: number;
5
- toChain?: number;
6
4
  elementId: string;
7
5
  };
8
6
 
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { useAccount } from '@lifi/wallet-management';
2
3
  import { useEffect } from 'react';
3
- import { useAccount } from '../../hooks/useAccount.js';
4
4
  import { useChains } from '../../hooks/useChains.js';
5
5
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
6
6
  import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
@@ -35,17 +35,17 @@ export type FormFieldArray<T extends FormFieldNames[]> = {
35
35
  [K in keyof T]: ExtractValueType<FormValues[T[K]]>;
36
36
  };
37
37
 
38
- export type TouchedFields = { [key in FormFieldNames]?: boolean };
38
+ export type TouchedFields = { [K in FormFieldNames]?: boolean };
39
39
 
40
40
  type ValidationFn = (value: any) => Promise<boolean | string>;
41
41
  export interface ValidationProps {
42
42
  isValid: boolean;
43
43
  isValidating: boolean;
44
44
  errors: {
45
- [key in FormFieldNames]?: string;
45
+ [K in FormFieldNames]?: string;
46
46
  };
47
47
  validation: {
48
- [key in FormFieldNames]?: ValidationFn;
48
+ [K in FormFieldNames]?: ValidationFn;
49
49
  };
50
50
  }
51
51
 
@@ -61,7 +61,7 @@ export interface ValidationActions {
61
61
  export interface FormProps {
62
62
  defaultValues: FormValues;
63
63
  userValues: FormValues;
64
- touchedFields: { [key in FormFieldNames]?: boolean };
64
+ touchedFields: { [K in FormFieldNames]?: boolean };
65
65
  }
66
66
 
67
67
  interface ResetOptions {
@@ -1,5 +1,5 @@
1
+ import { useAccount } from '@lifi/wallet-management';
1
2
  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';
@@ -63,7 +63,7 @@ export const createTheme = (
63
63
  const borderRadiusSecondary =
64
64
  widgetTheme.shape?.borderRadiusSecondary ?? shape.borderRadiusSecondary;
65
65
 
66
- return createMuiTheme({
66
+ const theme = createMuiTheme({
67
67
  container: widgetTheme.container,
68
68
  header: widgetTheme.header,
69
69
  navigation: {
@@ -409,4 +409,6 @@ export const createTheme = (
409
409
  },
410
410
  },
411
411
  });
412
+
413
+ return theme;
412
414
  };
package/types/events.ts CHANGED
@@ -12,6 +12,9 @@ export enum WidgetEvent {
12
12
  DestinationChainTokenSelected = 'destinationChainTokenSelected',
13
13
  SendToWalletToggled = 'sendToWalletToggled',
14
14
  ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
15
+ /**
16
+ * @deprecated use useWalletManagementEvents hook.
17
+ */
15
18
  WalletConnected = 'walletConnected',
16
19
  WidgetExpanded = 'widgetExpanded',
17
20
  }
@@ -28,6 +31,9 @@ export type WidgetEvents = {
28
31
  destinationChainTokenSelected: ChainTokenSelected;
29
32
  sendToWalletToggled: boolean;
30
33
  reviewTransactionPageEntered?: Route;
34
+ /**
35
+ * @deprecated use useWalletManagementEvents hook.
36
+ */
31
37
  walletConnected: WalletConnected;
32
38
  widgetExpanded: boolean;
33
39
  };
@@ -1,11 +1,10 @@
1
- import { ChainId, ChainType } from '@lifi/sdk';
1
+ import { ChainId, ChainType, isSVMAddress, isUTXOAddress } from '@lifi/sdk';
2
2
  import { isAddress as isEVMAddress } from 'viem';
3
- import { isSVMAddress } from './svm.js';
4
3
 
5
4
  const chainTypeAddressValidation = {
6
5
  [ChainType.EVM]: isEVMAddress,
7
6
  [ChainType.SVM]: isSVMAddress,
8
- [ChainType.UTXO]: () => false,
7
+ [ChainType.UTXO]: isUTXOAddress,
9
8
  };
10
9
 
11
10
  export const getChainTypeFromAddress = (
package/utils/elements.ts CHANGED
@@ -8,24 +8,3 @@ export enum ElementId {
8
8
 
9
9
  export const createElementId = (ElementId: ElementId, elementId: string) =>
10
10
  elementId ? `${ElementId}-${elementId}` : ElementId;
11
-
12
- // NOTE: The getter functions here are often used with code that can be effected by css changes in the
13
- // AppExpandedContainer, RelativeContainer and CssBaselineContainer components as defined in AppContainer.ts
14
-
15
- export const getAppContainer = (elementId: string) =>
16
- document.getElementById(
17
- createElementId(ElementId.AppExpandedContainer, elementId),
18
- );
19
-
20
- export const getRelativeContainer = (elementId: string) =>
21
- document.getElementById(
22
- createElementId(ElementId.RelativeContainer, elementId),
23
- );
24
-
25
- export const getScrollableContainer = (elementId: string) =>
26
- document.getElementById(
27
- createElementId(ElementId.ScrollableContainer, elementId),
28
- );
29
-
30
- export const getHeaderElement = (elementId: string) =>
31
- document.getElementById(createElementId(ElementId.Header, elementId));
package/utils/fees.ts CHANGED
@@ -104,20 +104,22 @@ export const getFeeCostsBreakdown = (
104
104
  export const getStepFeeCostsBreakdown = (
105
105
  feeCosts: FeeCost[] | GasCost[],
106
106
  ): FeesBreakdown => {
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,
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 },
120
121
  );
122
+
121
123
  return {
122
124
  amount,
123
125
  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.trim().replaceAll(',', '.');
63
+ let formattedAmount = amount.replaceAll(',', '.');
64
64
  if (formattedAmount.startsWith('.')) {
65
65
  formattedAmount = '0' + formattedAmount;
66
66
  }
@@ -7,7 +7,6 @@ export const navigationRoutes = {
7
7
  fromToken: 'from-token',
8
8
  languages: 'languages',
9
9
  routes: 'routes',
10
- selectWallet: 'select-wallet',
11
10
  settings: 'settings',
12
11
  toChain: 'to-chain',
13
12
  toToken: 'to-token',
@@ -31,7 +30,6 @@ export const stickyHeaderRoutes = [
31
30
  navigationRoutes.fromChain,
32
31
  navigationRoutes.home,
33
32
  navigationRoutes.routes,
34
- navigationRoutes.selectWallet,
35
33
  navigationRoutes.settings,
36
34
  navigationRoutes.toChain,
37
35
  navigationRoutes.toTokenNative,
@@ -53,7 +51,6 @@ export const backButtonRoutes = [
53
51
  navigationRoutes.fromChain,
54
52
  navigationRoutes.fromToken,
55
53
  navigationRoutes.routes,
56
- navigationRoutes.selectWallet,
57
54
  navigationRoutes.settings,
58
55
  navigationRoutes.toChain,
59
56
  navigationRoutes.toToken,
package/utils/wallet.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export const shortenAddress = (address?: string) =>
2
2
  address
3
- ? `${address.substring(0, 5)}...${address.substring(address.length - 4)}`
3
+ ? `${address.substring(0, 7)}...${address.substring(address.length - 5)}`
4
4
  : null;