@lifi/widget 3.6.1 → 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.
- package/AppProvider.tsx +4 -4
- package/AppRoutes.tsx +2 -14
- package/CHANGELOG.md +0 -7
- package/_esm/AppProvider.js +1 -1
- package/_esm/AppProvider.js.map +1 -1
- package/_esm/AppRoutes.js +2 -9
- package/_esm/AppRoutes.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
- package/_esm/components/AmountInput/AmountInputEndAdornment.js +1 -3
- package/_esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/_esm/components/Avatar/AccountAvatar.d.ts +1 -1
- package/_esm/components/Avatar/AccountAvatar.js +1 -1
- package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/_esm/components/Avatar/Avatar.d.ts +1 -0
- package/_esm/components/Avatar/Avatar.js +7 -4
- package/_esm/components/Avatar/Avatar.js.map +1 -1
- package/_esm/components/Avatar/Avatar.style.d.ts +6 -3
- package/_esm/components/Avatar/Avatar.style.js +19 -6
- package/_esm/components/Avatar/Avatar.style.js.map +1 -1
- package/_esm/components/Avatar/SmallAvatar.d.ts +4 -0
- package/_esm/components/Avatar/SmallAvatar.js +12 -0
- package/_esm/components/Avatar/SmallAvatar.js.map +1 -0
- package/_esm/components/Avatar/TokenAvatar.js +1 -1
- package/_esm/components/Avatar/TokenAvatar.js.map +1 -1
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +3 -5
- package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/_esm/components/ChainSelect/useChainSelect.js +5 -1
- package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/_esm/components/FeeBreakdownTooltip.js +4 -1
- package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
- package/_esm/components/Header/EVMDisconnectIconButton.js +5 -4
- package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.js +1 -1
- package/_esm/components/Header/NavigationHeader.js.map +1 -1
- package/_esm/components/Header/UTXODisconnectIconButton.d.ts +4 -0
- package/_esm/components/Header/UTXODisconnectIconButton.js +13 -0
- package/_esm/components/Header/UTXODisconnectIconButton.js.map +1 -0
- package/_esm/components/Header/WalletHeader.js +5 -9
- package/_esm/components/Header/WalletHeader.js.map +1 -1
- package/_esm/components/Header/WalletMenu.js +10 -15
- package/_esm/components/Header/WalletMenu.js.map +1 -1
- package/_esm/components/Header/WalletMenu.style.js +5 -1
- package/_esm/components/Header/WalletMenu.style.js.map +1 -1
- package/_esm/components/Routes/RoutesExpanded.js +1 -1
- package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
- package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/_esm/components/StepActions/StepActions.js +1 -1
- package/_esm/components/StepActions/StepActions.js.map +1 -1
- package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
- package/_esm/components/Token/Token.js +1 -1
- package/_esm/components/Token/Token.js.map +1 -1
- package/_esm/components/TokenList/TokenList.js +1 -1
- package/_esm/components/TokenList/TokenList.js.map +1 -1
- package/_esm/components/TokenList/TokenListItem.js +11 -5
- package/_esm/components/TokenList/TokenListItem.js.map +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_esm/components/TokenList/types.d.ts +3 -3
- package/_esm/components/TokenRate/TokenRate.js +2 -2
- package/_esm/components/TokenRate/TokenRate.js.map +1 -1
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/config/version.js.map +1 -1
- package/_esm/hooks/useAvailableChains.d.ts +2 -1
- package/_esm/hooks/useAvailableChains.js +9 -8
- package/_esm/hooks/useAvailableChains.js.map +1 -1
- package/_esm/hooks/useChains.d.ts +4 -3
- package/_esm/hooks/useChains.js +5 -3
- package/_esm/hooks/useChains.js.map +1 -1
- package/_esm/hooks/useFromTokenSufficiency.js +1 -1
- package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/_esm/hooks/useGasSufficiency.js +3 -3
- package/_esm/hooks/useGasSufficiency.js.map +1 -1
- package/_esm/hooks/useProcessMessage.js +4 -0
- package/_esm/hooks/useProcessMessage.js.map +1 -1
- package/_esm/hooks/useRouteExecution.js +1 -1
- package/_esm/hooks/useRouteExecution.js.map +1 -1
- package/_esm/hooks/useRoutes.js +1 -1
- package/_esm/hooks/useRoutes.js.map +1 -1
- package/_esm/hooks/useTokenBalance.js +1 -1
- package/_esm/hooks/useTokenBalance.js.map +1 -1
- package/_esm/hooks/useTokenBalances.js +1 -1
- package/_esm/hooks/useTokenBalances.js.map +1 -1
- package/_esm/hooks/useTokens.js +1 -1
- package/_esm/hooks/useTokens.js.map +1 -1
- package/_esm/hooks/useTransactionDetails.js +1 -1
- package/_esm/hooks/useTransactionDetails.js.map +1 -1
- package/_esm/hooks/useTransactionHistory.js +1 -1
- package/_esm/hooks/useTransactionHistory.js.map +1 -1
- package/_esm/i18n/en.json +3 -4
- package/_esm/index.d.ts +0 -2
- package/_esm/index.js +0 -2
- package/_esm/index.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
- package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/_esm/providers/I18nProvider/types.d.ts +2 -2
- package/_esm/providers/WalletProvider/SDKProviders.js +15 -7
- package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +2 -0
- package/_esm/providers/WalletProvider/UTXOBaseProvider.js +17 -0
- package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +1 -0
- package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +1 -0
- package/_esm/providers/WalletProvider/UTXOExternalContext.js +3 -0
- package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +1 -0
- package/_esm/providers/WalletProvider/UTXOProvider.d.ts +3 -0
- package/_esm/providers/WalletProvider/UTXOProvider.js +18 -0
- package/_esm/providers/WalletProvider/UTXOProvider.js.map +1 -0
- package/_esm/providers/WalletProvider/WalletProvider.d.ts +1 -0
- package/_esm/providers/WalletProvider/WalletProvider.js +14 -1
- package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +8 -3
- package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
- package/_esm/providers/WidgetProvider/WidgetProvider.js +2 -1
- package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/_esm/providers/WidgetProvider/types.d.ts +0 -2
- package/_esm/stores/form/FormUpdater.js +1 -1
- package/_esm/stores/form/FormUpdater.js.map +1 -1
- package/_esm/stores/form/types.d.ts +4 -4
- package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
- package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/_esm/themes/createTheme.js +2 -1
- package/_esm/themes/createTheme.js.map +1 -1
- package/_esm/types/events.d.ts +6 -0
- package/_esm/types/events.js +3 -0
- package/_esm/types/events.js.map +1 -1
- package/_esm/utils/chainType.js +2 -3
- package/_esm/utils/chainType.js.map +1 -1
- package/_esm/utils/fees.js +9 -5
- package/_esm/utils/fees.js.map +1 -1
- package/_esm/utils/format.js +1 -1
- package/_esm/utils/format.js.map +1 -1
- package/_esm/utils/navigationRoutes.d.ts +0 -1
- package/_esm/utils/navigationRoutes.js +0 -3
- package/_esm/utils/navigationRoutes.js.map +1 -1
- package/_esm/utils/wallet.js +1 -1
- package/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
- package/components/AmountInput/AmountInputEndAdornment.tsx +1 -5
- package/components/Avatar/AccountAvatar.tsx +2 -2
- package/components/Avatar/Avatar.style.tsx +20 -7
- package/components/Avatar/Avatar.tsx +12 -4
- package/components/Avatar/SmallAvatar.tsx +16 -0
- package/components/Avatar/TokenAvatar.tsx +1 -1
- package/components/BaseTransactionButton/BaseTransactionButton.tsx +3 -5
- package/components/ChainSelect/useChainSelect.ts +10 -1
- package/components/FeeBreakdownTooltip.tsx +4 -1
- package/components/Header/EVMDisconnectIconButton.tsx +5 -5
- package/components/Header/NavigationHeader.tsx +1 -1
- package/components/Header/UTXODisconnectIconButton.tsx +24 -0
- package/components/Header/WalletHeader.tsx +11 -12
- package/components/Header/WalletMenu.style.tsx +5 -1
- package/components/Header/WalletMenu.tsx +23 -24
- package/components/Routes/RoutesExpanded.tsx +1 -2
- package/components/SendToWallet/SendToWalletButton.tsx +1 -1
- package/components/StepActions/StepActions.tsx +1 -1
- package/components/Token/Token.tsx +1 -1
- package/components/TokenList/TokenList.tsx +1 -1
- package/components/TokenList/TokenListItem.tsx +15 -7
- package/components/TokenList/VirtualizedTokenList.tsx +1 -1
- package/components/TokenList/types.ts +3 -3
- package/components/TokenRate/TokenRate.tsx +2 -2
- package/config/version.ts +1 -1
- package/hooks/useAvailableChains.ts +9 -10
- package/hooks/useChains.ts +6 -3
- package/hooks/useFromTokenSufficiency.ts +1 -1
- package/hooks/useGasSufficiency.ts +5 -3
- package/hooks/useProcessMessage.ts +4 -0
- package/hooks/useRouteExecution.ts +1 -1
- package/hooks/useRoutes.ts +1 -1
- package/hooks/useTokenBalance.ts +1 -1
- package/hooks/useTokenBalances.ts +1 -1
- package/hooks/useTokens.ts +2 -1
- package/hooks/useTransactionDetails.ts +1 -1
- package/hooks/useTransactionHistory.ts +1 -1
- package/i18n/en.json +3 -4
- package/index.ts +0 -2
- package/package.json +5 -5
- package/pages/RoutesPage/RoutesPage.tsx +1 -1
- package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -2
- package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
- package/providers/I18nProvider/types.ts +2 -2
- package/providers/WalletProvider/SDKProviders.tsx +25 -7
- package/providers/WalletProvider/UTXOBaseProvider.tsx +28 -0
- package/providers/WalletProvider/UTXOExternalContext.ts +3 -0
- package/providers/WalletProvider/UTXOProvider.tsx +26 -0
- package/providers/WalletProvider/WalletProvider.tsx +24 -3
- package/providers/WalletProvider/useHasExternalWalletProvider.ts +11 -5
- package/providers/WidgetProvider/WidgetProvider.tsx +2 -1
- package/providers/WidgetProvider/types.ts +0 -2
- package/stores/form/FormUpdater.tsx +1 -1
- package/stores/form/types.ts +4 -4
- package/stores/routes/useExecutingRoutesIds.ts +1 -1
- package/themes/createTheme.ts +3 -1
- package/types/events.ts +6 -0
- package/utils/chainType.ts +2 -3
- package/utils/fees.ts +15 -13
- package/utils/format.ts +1 -1
- package/utils/navigationRoutes.ts +0 -3
- package/utils/wallet.ts +1 -1
- package/_esm/components/SmallAvatar.d.ts +0 -10
- package/_esm/components/SmallAvatar.js +0 -19
- package/_esm/components/SmallAvatar.js.map +0 -1
- package/_esm/hooks/useAccount.d.ts +0 -45
- package/_esm/hooks/useAccount.js +0 -56
- package/_esm/hooks/useAccount.js.map +0 -1
- package/_esm/hooks/useWallets.d.ts +0 -6
- package/_esm/hooks/useWallets.js +0 -80
- package/_esm/hooks/useWallets.js.map +0 -1
- package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +0 -9
- package/_esm/pages/SelectWalletPage/EVMListItemButton.js +0 -39
- package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +0 -1
- package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +0 -6
- package/_esm/pages/SelectWalletPage/SVMListItemButton.js +0 -32
- package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +0 -1
- package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js +0 -41
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +0 -1
- package/_esm/utils/svm.d.ts +0 -1
- package/_esm/utils/svm.js +0 -11
- package/_esm/utils/svm.js.map +0 -1
- package/components/SmallAvatar.tsx +0 -25
- package/hooks/useAccount.ts +0 -109
- package/hooks/useWallets.ts +0 -147
- package/pages/SelectWalletPage/EVMListItemButton.tsx +0 -74
- package/pages/SelectWalletPage/SVMListItemButton.tsx +0 -47
- package/pages/SelectWalletPage/SelectWalletPage.tsx +0 -90
- package/utils/svm.ts +0 -10
|
@@ -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',
|
|
@@ -29,7 +28,6 @@ export const stickyHeaderRoutes = [
|
|
|
29
28
|
navigationRoutes.fromChain,
|
|
30
29
|
navigationRoutes.home,
|
|
31
30
|
navigationRoutes.routes,
|
|
32
|
-
navigationRoutes.selectWallet,
|
|
33
31
|
navigationRoutes.settings,
|
|
34
32
|
navigationRoutes.toChain,
|
|
35
33
|
navigationRoutes.toTokenNative,
|
|
@@ -50,7 +48,6 @@ export const backButtonRoutes = [
|
|
|
50
48
|
navigationRoutes.fromChain,
|
|
51
49
|
navigationRoutes.fromToken,
|
|
52
50
|
navigationRoutes.routes,
|
|
53
|
-
navigationRoutes.selectWallet,
|
|
54
51
|
navigationRoutes.settings,
|
|
55
52
|
navigationRoutes.toChain,
|
|
56
53
|
navigationRoutes.toToken,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationRoutes.js","sourceRoot":"","sources":["../../utils/navigationRoutes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,GAAG;IACT,kBAAkB,EAAE,qBAAqB;IACzC,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,
|
|
1
|
+
{"version":3,"file":"navigationRoutes.js","sourceRoot":"","sources":["../../utils/navigationRoutes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,GAAG;IACT,kBAAkB,EAAE,qBAAqB;IACzC,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,UAAU;IACnB,aAAa,EAAE,iBAAiB;IAChC,kBAAkB,EAAE,qBAAqB;IACzC,oBAAoB,EAAE,uBAAuB;IAC7C,kBAAkB,EAAE,qBAAqB;IACzC,YAAY,EAAE,gBAAgB;IAC9B,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,gBAAgB;IAC/B,gBAAgB,EAAE,mBAAmB;IACrC,iBAAiB,EAAE,oBAAoB;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,IAAI;IACrB,gBAAgB,CAAC,MAAM;IACvB,gBAAgB,CAAC,QAAQ;IACzB,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,oBAAoB;IACrC,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,YAAY;IAC7B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,gBAAgB;IACjC,gBAAgB,CAAC,iBAAiB;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,MAAM;IACvB,gBAAgB,CAAC,QAAQ;IACzB,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,oBAAoB;IACrC,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,YAAY;IAC7B,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,aAAa;IAC9B,gBAAgB,CAAC,gBAAgB;IACjC,gBAAgB,CAAC,iBAAiB;CACnC,CAAC"}
|
package/_esm/utils/wallet.js
CHANGED
|
@@ -20,7 +20,7 @@ export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
|
|
|
20
20
|
export const ListItem = styled(MuiListItem, {
|
|
21
21
|
shouldForwardProp: (prop) => prop !== 'disableRipple',
|
|
22
22
|
})(({ theme }) => ({
|
|
23
|
-
padding: theme.spacing(0,
|
|
23
|
+
padding: theme.spacing(0, 2),
|
|
24
24
|
[`.${listItemSecondaryActionClasses.root}`]: {
|
|
25
25
|
right: theme.spacing(3),
|
|
26
26
|
},
|
|
@@ -32,11 +32,7 @@ export const AmountInputEndAdornment = ({ formType }: FormTypeProps) => {
|
|
|
32
32
|
}
|
|
33
33
|
const chain = getChainById(chainId);
|
|
34
34
|
let maxAmount = token.amount;
|
|
35
|
-
if (
|
|
36
|
-
chain?.nativeToken.address === tokenAddress &&
|
|
37
|
-
data?.available &&
|
|
38
|
-
data?.recommended
|
|
39
|
-
) {
|
|
35
|
+
if (chain?.nativeToken.address === tokenAddress && data?.recommended) {
|
|
40
36
|
const recommendedAmount = BigInt(data.recommended.amount) / 2n;
|
|
41
37
|
if (token.amount > recommendedAmount) {
|
|
42
38
|
maxAmount = token.amount - recommendedAmount;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import type { Account } from '@lifi/wallet-management';
|
|
1
2
|
import { getConnectorIcon } from '@lifi/wallet-management';
|
|
2
3
|
import { Wallet } from '@mui/icons-material';
|
|
3
4
|
import { Badge } from '@mui/material';
|
|
4
|
-
import type { Account } from '../../hooks/useAccount.js';
|
|
5
5
|
import { useChain } from '../../hooks/useChain.js';
|
|
6
6
|
import type { ToAddress } from '../../types/widget.js';
|
|
7
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
8
7
|
import {
|
|
9
8
|
AvatarDefault,
|
|
10
9
|
AvatarDefaultBadge,
|
|
11
10
|
AvatarMasked,
|
|
12
11
|
} from './Avatar.style.js';
|
|
12
|
+
import { SmallAvatar } from './SmallAvatar.js';
|
|
13
13
|
|
|
14
14
|
interface AccountAvatarProps {
|
|
15
15
|
chainId?: number;
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
AvatarGroup,
|
|
4
4
|
Box,
|
|
5
5
|
Avatar as MuiAvatar,
|
|
6
|
-
Skeleton,
|
|
7
6
|
avatarClasses,
|
|
8
7
|
badgeClasses,
|
|
9
8
|
styled,
|
|
@@ -14,17 +13,20 @@ export const AvatarMasked = styled(MuiAvatar)(({ theme }) => ({
|
|
|
14
13
|
mask: avatarMask16,
|
|
15
14
|
}));
|
|
16
15
|
|
|
17
|
-
export const AvatarSkeleton = styled(Skeleton)(({ theme }) => ({
|
|
18
|
-
mask: avatarMask16,
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
16
|
export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
|
|
22
17
|
[`& .${badgeClasses.badge}:last-child .${avatarClasses.root}`]: {
|
|
23
|
-
marginLeft: theme.spacing(-1),
|
|
24
18
|
boxSizing: 'border-box',
|
|
25
19
|
},
|
|
20
|
+
[`& .${avatarClasses.root}`]: {
|
|
21
|
+
border: 'none',
|
|
22
|
+
marginLeft: 0,
|
|
23
|
+
},
|
|
24
|
+
[`& .${badgeClasses.root}:first-child`]: {
|
|
25
|
+
marginLeft: theme.spacing(-1),
|
|
26
|
+
border: 'none',
|
|
27
|
+
},
|
|
26
28
|
[`& .${badgeClasses.root}:last-child`]: {
|
|
27
|
-
|
|
29
|
+
border: 'none',
|
|
28
30
|
},
|
|
29
31
|
}));
|
|
30
32
|
|
|
@@ -57,3 +59,14 @@ export const AvatarDefaultBadge = styled(Box)(({ theme }) => {
|
|
|
57
59
|
width: 16,
|
|
58
60
|
};
|
|
59
61
|
});
|
|
62
|
+
|
|
63
|
+
export const AvatarSkeletonContainer = styled(Box)(({ theme }) => ({
|
|
64
|
+
background: theme.palette.background.paper,
|
|
65
|
+
borderRadius: '50%',
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
export const AvatarSkeletonMaskedContainer = styled(Box)(({ theme }) => ({
|
|
69
|
+
background: theme.palette.background.paper,
|
|
70
|
+
borderRadius: '50%',
|
|
71
|
+
mask: avatarMask16,
|
|
72
|
+
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SxProps, Theme } from '@mui/material';
|
|
2
|
-
import { Badge } from '@mui/material';
|
|
3
|
-
import { SmallAvatarSkeleton } from '../SmallAvatar.js';
|
|
2
|
+
import { Badge, Skeleton } from '@mui/material';
|
|
4
3
|
import {
|
|
5
4
|
AvatarDefault,
|
|
6
5
|
AvatarDefaultBadge,
|
|
7
|
-
|
|
6
|
+
AvatarSkeletonMaskedContainer,
|
|
8
7
|
} from './Avatar.style.js';
|
|
8
|
+
import { SmallAvatarSkeleton } from './SmallAvatar.js';
|
|
9
9
|
|
|
10
10
|
export const AvatarBadgedDefault: React.FC<{
|
|
11
11
|
sx?: SxProps<Theme>;
|
|
@@ -32,7 +32,15 @@ export const AvatarBadgedSkeleton: React.FC<{
|
|
|
32
32
|
badgeContent={<SmallAvatarSkeleton />}
|
|
33
33
|
sx={sx}
|
|
34
34
|
>
|
|
35
|
-
<AvatarSkeleton
|
|
35
|
+
<AvatarSkeleton />
|
|
36
36
|
</Badge>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
|
+
|
|
40
|
+
export const AvatarSkeleton = () => {
|
|
41
|
+
return (
|
|
42
|
+
<AvatarSkeletonMaskedContainer>
|
|
43
|
+
<Skeleton width={40} height={40} variant="circular" />
|
|
44
|
+
</AvatarSkeletonMaskedContainer>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|
|
@@ -3,9 +3,9 @@ import type { SxProps, Theme } from '@mui/material';
|
|
|
3
3
|
import { Badge } from '@mui/material';
|
|
4
4
|
import { useChain } from '../../hooks/useChain.js';
|
|
5
5
|
import { useToken } from '../../hooks/useToken.js';
|
|
6
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
7
6
|
import { AvatarBadgedSkeleton } from './Avatar.js';
|
|
8
7
|
import { AvatarDefaultBadge, AvatarMasked } from './Avatar.style.js';
|
|
8
|
+
import { SmallAvatar } from './SmallAvatar.js';
|
|
9
9
|
|
|
10
10
|
export const TokenAvatar: React.FC<{
|
|
11
11
|
token?: StaticToken;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAccount, useWalletMenu } from '@lifi/wallet-management';
|
|
1
2
|
import { LoadingButton } from '@mui/lab';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { useNavigate } from 'react-router-dom';
|
|
4
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
5
4
|
import { useChain } from '../../hooks/useChain.js';
|
|
6
5
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
7
6
|
import { useFieldValues } from '../../stores/form/useFieldValues.js';
|
|
8
|
-
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
9
7
|
import type { BaseTransactionButtonProps } from './types.js';
|
|
10
8
|
|
|
11
9
|
export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
|
|
@@ -15,8 +13,8 @@ export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
|
|
|
15
13
|
loading,
|
|
16
14
|
}) => {
|
|
17
15
|
const { t } = useTranslation();
|
|
18
|
-
const navigate = useNavigate();
|
|
19
16
|
const { walletConfig } = useWidgetConfig();
|
|
17
|
+
const { openWalletMenu } = useWalletMenu();
|
|
20
18
|
const [fromChainId] = useFieldValues('fromChain');
|
|
21
19
|
const { chain } = useChain(fromChainId);
|
|
22
20
|
const { account } = useAccount({ chainType: chain?.chainType });
|
|
@@ -27,7 +25,7 @@ export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
|
|
|
27
25
|
} else if (walletConfig?.onConnect) {
|
|
28
26
|
walletConfig.onConnect();
|
|
29
27
|
} else {
|
|
30
|
-
|
|
28
|
+
openWalletMenu();
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
31
|
|
|
@@ -2,6 +2,7 @@ import type { EVMChain } from '@lifi/sdk';
|
|
|
2
2
|
import { useChains } from '../../hooks/useChains.js';
|
|
3
3
|
import { useSwapOnly } from '../../hooks/useSwapOnly.js';
|
|
4
4
|
import { useToAddressReset } from '../../hooks/useToAddressReset.js';
|
|
5
|
+
import { useHasExternalWalletProvider } from '../../providers/WalletProvider/useHasExternalWalletProvider.js';
|
|
5
6
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
6
7
|
import { useChainOrder } from '../../stores/chains/useChainOrder.js';
|
|
7
8
|
import type { FormType } from '../../stores/form/types.js';
|
|
@@ -15,7 +16,15 @@ export const useChainSelect = (formType: FormType) => {
|
|
|
15
16
|
const chainKey = FormKeyHelper.getChainKey(formType);
|
|
16
17
|
const { onChange } = useFieldController({ name: chainKey });
|
|
17
18
|
const { setFieldValue, getFieldValues } = useFieldActions();
|
|
18
|
-
const {
|
|
19
|
+
const { hasExternalProvider, availableChainTypes } =
|
|
20
|
+
useHasExternalWalletProvider();
|
|
21
|
+
const { chains, isLoading, getChainById } = useChains(
|
|
22
|
+
formType,
|
|
23
|
+
formType === 'from' && hasExternalProvider
|
|
24
|
+
? availableChainTypes
|
|
25
|
+
: undefined,
|
|
26
|
+
);
|
|
27
|
+
|
|
19
28
|
const [chainOrder, setChainOrder] = useChainOrder(formType);
|
|
20
29
|
const swapOnly = useSwapOnly();
|
|
21
30
|
const { tryResetToAddress } = useToAddressReset();
|
|
@@ -54,7 +54,10 @@ export const getFeeBreakdownTypography = (
|
|
|
54
54
|
key={`${fee.token.address}${index}`}
|
|
55
55
|
>
|
|
56
56
|
{t(`format.currency`, { value: fee.amountUSD })} (
|
|
57
|
-
{
|
|
57
|
+
{t(`format.number`, {
|
|
58
|
+
value: parseFloat(formatUnits(fee.amount, fee.token.decimals)),
|
|
59
|
+
maximumFractionDigits: Math.min(fee.token.decimals, 9),
|
|
60
|
+
})}{' '}
|
|
58
61
|
{fee.token.symbol})
|
|
59
62
|
</Typography>
|
|
60
63
|
));
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { PowerSettingsNewRounded } from '@mui/icons-material';
|
|
2
2
|
import { IconButton } from '@mui/material';
|
|
3
3
|
import type { Connector } from 'wagmi';
|
|
4
|
-
import {
|
|
4
|
+
import { useConfig } from 'wagmi';
|
|
5
|
+
import { disconnect } from 'wagmi/actions';
|
|
5
6
|
|
|
6
7
|
export const EVMDisconnectIconButton = ({
|
|
7
8
|
connector,
|
|
8
9
|
}: {
|
|
9
10
|
connector?: Connector;
|
|
10
11
|
}) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const config = useConfig();
|
|
13
13
|
return (
|
|
14
14
|
<IconButton
|
|
15
15
|
size="medium"
|
|
16
|
-
onClick={(e) => {
|
|
16
|
+
onClick={async (e) => {
|
|
17
17
|
e.stopPropagation();
|
|
18
|
-
disconnect({ connector });
|
|
18
|
+
await disconnect(config, { connector });
|
|
19
19
|
}}
|
|
20
20
|
>
|
|
21
21
|
<PowerSettingsNewRounded />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useAccount } from '@lifi/wallet-management';
|
|
1
2
|
import { Box, Typography } from '@mui/material';
|
|
2
3
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
3
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
4
4
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
5
5
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
6
6
|
import { useHeaderStore } from '../../stores/header/useHeaderStore.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useConfig } from '@lifi/wallet-management';
|
|
2
|
+
import { PowerSettingsNewRounded } from '@mui/icons-material';
|
|
3
|
+
import { IconButton } from '@mui/material';
|
|
4
|
+
import type { Connector } from 'wagmi';
|
|
5
|
+
import { disconnect } from 'wagmi/actions';
|
|
6
|
+
|
|
7
|
+
export const UTXODisconnectIconButton = ({
|
|
8
|
+
connector,
|
|
9
|
+
}: {
|
|
10
|
+
connector?: Connector;
|
|
11
|
+
}) => {
|
|
12
|
+
const config = useConfig();
|
|
13
|
+
return (
|
|
14
|
+
<IconButton
|
|
15
|
+
size="medium"
|
|
16
|
+
onClick={async (e) => {
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
await disconnect(config, { connector });
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<PowerSettingsNewRounded />
|
|
22
|
+
</IconButton>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Account } from '@lifi/wallet-management';
|
|
2
|
+
import {
|
|
3
|
+
getConnectorIcon,
|
|
4
|
+
useAccount,
|
|
5
|
+
useWalletMenu,
|
|
6
|
+
} from '@lifi/wallet-management';
|
|
2
7
|
import { ExpandMore, Wallet } from '@mui/icons-material';
|
|
3
8
|
import { Avatar, Badge } from '@mui/material';
|
|
4
9
|
import { useState } from 'react';
|
|
5
10
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useLocation, useNavigate } from 'react-router-dom';
|
|
7
|
-
import type { Account } from '../../hooks/useAccount.js';
|
|
8
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
9
11
|
import { useChain } from '../../hooks/useChain.js';
|
|
10
12
|
import { useHasExternalWalletProvider } from '../../providers/WalletProvider/useHasExternalWalletProvider.js';
|
|
11
13
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
12
14
|
import { HiddenUI } from '../../types/widget.js';
|
|
13
|
-
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
14
15
|
import { shortenAddress } from '../../utils/wallet.js';
|
|
15
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
16
|
+
import { SmallAvatar } from '../Avatar/SmallAvatar.js';
|
|
16
17
|
import { CloseDrawerButton } from './CloseDrawerButton.js';
|
|
17
18
|
import {
|
|
18
19
|
DrawerWalletContainer,
|
|
@@ -70,16 +71,16 @@ export const WalletMenuButton: React.FC = () => {
|
|
|
70
71
|
|
|
71
72
|
const ConnectButton = () => {
|
|
72
73
|
const { t } = useTranslation();
|
|
73
|
-
const { pathname } = useLocation();
|
|
74
74
|
const { walletConfig, subvariant, variant } = useWidgetConfig();
|
|
75
|
-
const
|
|
75
|
+
const { openWalletMenu } = useWalletMenu();
|
|
76
76
|
const connect = async () => {
|
|
77
77
|
if (walletConfig?.onConnect) {
|
|
78
78
|
walletConfig.onConnect();
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
openWalletMenu();
|
|
82
82
|
};
|
|
83
|
+
|
|
83
84
|
return (
|
|
84
85
|
<WalletButton
|
|
85
86
|
subvariant={subvariant}
|
|
@@ -91,9 +92,7 @@ const ConnectButton = () => {
|
|
|
91
92
|
<Wallet sx={{ marginLeft: -0.25 }} />
|
|
92
93
|
) : undefined
|
|
93
94
|
}
|
|
94
|
-
onClick={
|
|
95
|
-
!pathname.includes(navigationRoutes.selectWallet) ? connect : undefined
|
|
96
|
-
}
|
|
95
|
+
onClick={connect}
|
|
97
96
|
>
|
|
98
97
|
{t(`button.connectWallet`)}
|
|
99
98
|
</WalletButton>
|
|
@@ -17,11 +17,15 @@ export const WalletMenuContainer = styled(MuiMenu)(({ theme }) => ({
|
|
|
17
17
|
},
|
|
18
18
|
[`& .${menuItemClasses.root}`]: {
|
|
19
19
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
20
|
-
padding: theme.spacing(1,
|
|
20
|
+
padding: theme.spacing(1, 0, 1, 1),
|
|
21
21
|
[`& .${svgIconClasses.root}`]: {
|
|
22
22
|
fontSize: 20,
|
|
23
23
|
color: theme.palette.text.primary,
|
|
24
24
|
},
|
|
25
|
+
':hover': {
|
|
26
|
+
background: 'none',
|
|
27
|
+
cursor: 'default',
|
|
28
|
+
},
|
|
25
29
|
},
|
|
26
30
|
},
|
|
27
31
|
}));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ChainType } from '@lifi/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getConnectorIcon,
|
|
4
|
+
useAccount,
|
|
5
|
+
useWalletMenu,
|
|
6
|
+
} from '@lifi/wallet-management';
|
|
3
7
|
import {
|
|
4
8
|
ContentCopyRounded,
|
|
5
9
|
OpenInNewRounded,
|
|
@@ -14,25 +18,22 @@ import {
|
|
|
14
18
|
MenuItem,
|
|
15
19
|
} from '@mui/material';
|
|
16
20
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { useLocation, useNavigate } from 'react-router-dom';
|
|
18
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
19
21
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js';
|
|
20
22
|
import { useExplorer } from '../../hooks/useExplorer.js';
|
|
21
|
-
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
22
23
|
import { shortenAddress } from '../../utils/wallet.js';
|
|
23
24
|
import { AvatarMasked } from '../Avatar/Avatar.style.js';
|
|
24
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
25
|
+
import { SmallAvatar } from '../Avatar/SmallAvatar.js';
|
|
25
26
|
import { EVMDisconnectIconButton } from './EVMDisconnectIconButton.js';
|
|
26
27
|
import { SVMDisconnectIconButton } from './SVMDisconnectIconButton.js';
|
|
28
|
+
import { UTXODisconnectIconButton } from './UTXODisconnectIconButton.js';
|
|
27
29
|
|
|
28
30
|
export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
29
31
|
const { t } = useTranslation();
|
|
30
|
-
const navigate = useNavigate();
|
|
31
|
-
const { pathname } = useLocation();
|
|
32
32
|
const { accounts } = useAccount();
|
|
33
33
|
const { getChainById } = useAvailableChains();
|
|
34
|
+
const { openWalletMenu } = useWalletMenu();
|
|
34
35
|
const connect = async () => {
|
|
35
|
-
|
|
36
|
+
openWalletMenu();
|
|
36
37
|
onClose();
|
|
37
38
|
};
|
|
38
39
|
const { getAddressLink } = useExplorer();
|
|
@@ -49,7 +50,7 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
return (
|
|
52
|
-
<MenuItem key={account.address}>
|
|
53
|
+
<MenuItem key={account.address} disableTouchRipple>
|
|
53
54
|
<Box flex={1} display="flex" alignItems="center">
|
|
54
55
|
{chain?.logoURI ? (
|
|
55
56
|
<Badge
|
|
@@ -82,7 +83,7 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
82
83
|
)}
|
|
83
84
|
{walletAddress}
|
|
84
85
|
</Box>
|
|
85
|
-
<Box ml={
|
|
86
|
+
<Box ml={2}>
|
|
86
87
|
<IconButton size="medium" onClick={handleCopyAddress}>
|
|
87
88
|
<ContentCopyRounded />
|
|
88
89
|
</IconButton>
|
|
@@ -103,26 +104,24 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
|
|
|
103
104
|
<EVMDisconnectIconButton connector={account.connector} />
|
|
104
105
|
) : account.chainType === ChainType.SVM ? (
|
|
105
106
|
<SVMDisconnectIconButton />
|
|
107
|
+
) : account.chainType === ChainType.UTXO ? (
|
|
108
|
+
<UTXODisconnectIconButton connector={account.connector} />
|
|
106
109
|
) : null}
|
|
107
110
|
</Box>
|
|
108
111
|
</MenuItem>
|
|
109
112
|
);
|
|
110
113
|
})}
|
|
111
114
|
</Box>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
? t(`button.changeWallet`)
|
|
123
|
-
: t(`button.connectWallet`)}
|
|
124
|
-
</Button>
|
|
125
|
-
) : null}
|
|
115
|
+
<Button
|
|
116
|
+
onClick={connect}
|
|
117
|
+
fullWidth
|
|
118
|
+
startIcon={<PowerSettingsNewRounded />}
|
|
119
|
+
sx={{
|
|
120
|
+
marginTop: 1,
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
{t(`button.connectAnotherWallet`)}
|
|
124
|
+
</Button>
|
|
126
125
|
</>
|
|
127
126
|
);
|
|
128
127
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
1
|
import type { Route } from '@lifi/sdk';
|
|
2
|
+
import { useAccount } from '@lifi/wallet-management';
|
|
3
3
|
import { Collapse, Grow, Stack, Typography } from '@mui/material';
|
|
4
4
|
import { useEffect, useRef } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import type { RouteObject } from 'react-router-dom';
|
|
7
7
|
import { useRoutes as useDOMRoutes, useNavigate } from 'react-router-dom';
|
|
8
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
9
8
|
import { useRoutes } from '../../hooks/useRoutes.js';
|
|
10
9
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
11
10
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { useAccount } from '@lifi/wallet-management';
|
|
1
2
|
import { CloseRounded } from '@mui/icons-material';
|
|
2
3
|
import { Box, Collapse } from '@mui/material';
|
|
3
4
|
import { useEffect, useRef, type MouseEventHandler } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
6
|
import { useNavigate } from 'react-router-dom';
|
|
6
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
7
7
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
8
8
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
9
9
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js';
|
|
@@ -18,8 +18,8 @@ import { LiFiToolLogo } from '../../icons/lifi.js';
|
|
|
18
18
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
19
19
|
import { HiddenUI } from '../../types/widget.js';
|
|
20
20
|
import { formatTokenAmount } from '../../utils/format.js';
|
|
21
|
+
import { SmallAvatar } from '../Avatar/SmallAvatar.js';
|
|
21
22
|
import { CardIconButton } from '../Card/CardIconButton.js';
|
|
22
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
23
23
|
import {
|
|
24
24
|
StepAvatar,
|
|
25
25
|
StepConnector,
|
|
@@ -8,8 +8,8 @@ import { useChain } from '../../hooks/useChain.js';
|
|
|
8
8
|
import { useToken } from '../../hooks/useToken.js';
|
|
9
9
|
import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js';
|
|
10
10
|
import { AvatarBadgedSkeleton } from '../Avatar/Avatar.js';
|
|
11
|
+
import { SmallAvatar } from '../Avatar/SmallAvatar.js';
|
|
11
12
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js';
|
|
12
|
-
import { SmallAvatar } from '../SmallAvatar.js';
|
|
13
13
|
import { TextFitter } from '../TextFitter/TextFitter.js';
|
|
14
14
|
import { TextSecondary, TextSecondaryContainer } from './Token.style.js';
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { useAccount } from '@lifi/wallet-management';
|
|
1
2
|
import { Box } from '@mui/material';
|
|
2
3
|
import type { FC } from 'react';
|
|
3
|
-
import { useAccount } from '../../hooks/useAccount.js';
|
|
4
4
|
import { useChain } from '../../hooks/useChain.js';
|
|
5
5
|
import { useDebouncedWatch } from '../../hooks/useDebouncedWatch.js';
|
|
6
6
|
import { useTokenBalances } from '../../hooks/useTokenBalances.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainType } from '@lifi/sdk';
|
|
1
2
|
import { OpenInNewRounded } from '@mui/icons-material';
|
|
2
3
|
import {
|
|
3
4
|
Avatar,
|
|
@@ -26,7 +27,7 @@ export const TokenListItem: React.FC<TokenListItemProps> = ({
|
|
|
26
27
|
start,
|
|
27
28
|
token,
|
|
28
29
|
chain,
|
|
29
|
-
|
|
30
|
+
accountAddress,
|
|
30
31
|
isBalanceLoading,
|
|
31
32
|
startAdornment,
|
|
32
33
|
endAdornment,
|
|
@@ -46,7 +47,7 @@ export const TokenListItem: React.FC<TokenListItemProps> = ({
|
|
|
46
47
|
<TokenListItemButton
|
|
47
48
|
token={token}
|
|
48
49
|
chain={chain}
|
|
49
|
-
|
|
50
|
+
accountAddress={accountAddress}
|
|
50
51
|
isBalanceLoading={isBalanceLoading}
|
|
51
52
|
onClick={handleClick}
|
|
52
53
|
/>
|
|
@@ -59,7 +60,7 @@ export const TokenListItemButton: React.FC<TokenListItemButtonProps> = ({
|
|
|
59
60
|
onClick,
|
|
60
61
|
token,
|
|
61
62
|
chain,
|
|
62
|
-
|
|
63
|
+
accountAddress,
|
|
63
64
|
isBalanceLoading,
|
|
64
65
|
}) => {
|
|
65
66
|
const { t } = useTranslation();
|
|
@@ -75,8 +76,15 @@ export const TokenListItemButton: React.FC<TokenListItemButtonProps> = ({
|
|
|
75
76
|
const timeoutId = useRef<ReturnType<typeof setTimeout>>();
|
|
76
77
|
const [showAddress, setShowAddress] = useState(false);
|
|
77
78
|
|
|
79
|
+
const tokenAddress =
|
|
80
|
+
chain?.chainType === ChainType.UTXO ? accountAddress : token.address;
|
|
81
|
+
|
|
78
82
|
const onMouseEnter = () => {
|
|
79
|
-
timeoutId.current = setTimeout(() =>
|
|
83
|
+
timeoutId.current = setTimeout(() => {
|
|
84
|
+
if (tokenAddress) {
|
|
85
|
+
setShowAddress(true);
|
|
86
|
+
}
|
|
87
|
+
}, 350);
|
|
80
88
|
};
|
|
81
89
|
|
|
82
90
|
const onMouseLeave = () => {
|
|
@@ -128,12 +136,12 @@ export const TokenListItemButton: React.FC<TokenListItemButtonProps> = ({
|
|
|
128
136
|
>
|
|
129
137
|
<Box display="flex">
|
|
130
138
|
<Box display="flex" alignItems="center" pt={0.125}>
|
|
131
|
-
{shortenAddress(
|
|
139
|
+
{shortenAddress(tokenAddress)}
|
|
132
140
|
</Box>
|
|
133
141
|
<IconButton
|
|
134
142
|
size="small"
|
|
135
143
|
LinkComponent={Link}
|
|
136
|
-
href={getAddressLink(
|
|
144
|
+
href={getAddressLink(tokenAddress!, chain)}
|
|
137
145
|
target="_blank"
|
|
138
146
|
rel="nofollow noreferrer"
|
|
139
147
|
onClick={(e) => e.stopPropagation()}
|
|
@@ -145,7 +153,7 @@ export const TokenListItemButton: React.FC<TokenListItemButtonProps> = ({
|
|
|
145
153
|
</Box>
|
|
146
154
|
}
|
|
147
155
|
/>
|
|
148
|
-
{
|
|
156
|
+
{accountAddress ? (
|
|
149
157
|
isBalanceLoading ? (
|
|
150
158
|
<TokenAmountSkeleton />
|
|
151
159
|
) : (
|
|
@@ -127,7 +127,7 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
127
127
|
token={currentToken}
|
|
128
128
|
chain={chain}
|
|
129
129
|
isBalanceLoading={isBalanceLoading}
|
|
130
|
-
|
|
130
|
+
accountAddress={account.address}
|
|
131
131
|
startAdornment={
|
|
132
132
|
startAdornmentLabel ? (
|
|
133
133
|
<Typography
|