@lifi/widget 4.0.0-beta.14 → 4.0.0-beta.17
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/dist/esm/AppDefault.js +31 -29
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppLayout.js +2 -2
- package/dist/esm/AppLayout.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js +2 -2
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AppContainer.js +3 -3
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js +6 -0
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.js +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.js +4 -4
- package/dist/esm/components/Expansion/Expansion.js.map +1 -1
- package/dist/esm/components/Header/ActivitiesButton.js +1 -1
- package/dist/esm/components/Header/ActivitiesButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js +2 -2
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js +3 -3
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.js +3 -3
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/IconTypography.js.map +1 -1
- package/dist/esm/components/Messages/AlertMessage.js +1 -1
- package/dist/esm/components/Messages/AlertMessage.js.map +1 -1
- package/dist/esm/components/PageEntered.js +2 -2
- package/dist/esm/components/PageEntered.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js +2 -2
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js +10 -4
- package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteToken.js +2 -2
- package/dist/esm/components/RouteCard/RouteToken.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.js +3 -3
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/SelectChainAndToken.js +8 -5
- package/dist/esm/components/SelectChainAndToken.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js +1 -2
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +3 -3
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js +3 -3
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
- package/dist/esm/components/Step/Step.js +20 -9
- package/dist/esm/components/Step/Step.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js +2 -2
- package/dist/esm/components/Step/StepActions.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.js +2 -2
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/Timer/TimerContent.js +1 -0
- package/dist/esm/components/Timer/TimerContent.js.map +1 -1
- package/dist/esm/components/Token/Token.js +2 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +6 -4
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +2 -2
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js +2 -2
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js +2 -3
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js +5 -2
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useAddressValidation.js +3 -8
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +2 -1
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useContactSupport.js +3 -3
- package/dist/esm/hooks/useContactSupport.js.map +1 -1
- package/dist/esm/hooks/useExplorer.js +15 -4
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useGasRecommendation.js +2 -2
- package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
- package/dist/esm/hooks/useGasRefuel.js +2 -2
- package/dist/esm/hooks/useGasRefuel.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js +2 -2
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useHasChainExpansion.js +3 -3
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -1
- package/dist/esm/hooks/useListHeight.js +2 -2
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +5 -5
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +4 -4
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +2 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToAddressReset.js +2 -2
- package/dist/esm/hooks/useToAddressReset.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +2 -2
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +4 -2
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js +2 -3
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/i18n/en.json +3 -0
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js +1 -2
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/ActivitiesPageMenuButton.js +1 -1
- package/dist/esm/pages/ActivitiesPage/ActivitiesPageMenuButton.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js +6 -6
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +2 -2
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js +3 -3
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +3 -3
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js +6 -6
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +2 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/LanguageSetting.js +2 -2
- package/dist/esm/pages/SettingsPage/LanguageSetting.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js +2 -2
- package/dist/esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ThemeSettings.js +2 -2
- package/dist/esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js +2 -2
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js +2 -2
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +20 -21
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.style.js +5 -6
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +14 -4
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +15 -19
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +7 -3
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +2 -2
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.js +2 -2
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.js +3 -3
- package/dist/esm/stores/form/useFieldActions.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js +2 -2
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js +8 -9
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js +2 -3
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.js +1 -5
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsActions.js +2 -2
- package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
- package/dist/esm/themes/createTheme.js +4 -4
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/types/events.d.ts +0 -5
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/events.js +0 -4
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/widget.d.ts +1 -5
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/elements.js +5 -12
- package/dist/esm/utils/elements.js.map +1 -1
- package/package.json +7 -7
- package/src/AppDefault.tsx +9 -11
- package/src/components/Chains/AllChainsAvatar.tsx +6 -0
- package/src/components/ContractComponent/ItemPrice.tsx +1 -1
- package/src/components/ContractComponent/NFT/NFTBase.tsx +1 -1
- package/src/components/Header/ActivitiesButton.tsx +1 -1
- package/src/components/IconTypography.ts +8 -8
- package/src/components/Messages/AlertMessage.tsx +1 -1
- package/src/components/RouteCard/RouteCardEssentials.tsx +2 -2
- package/src/components/SelectChainAndToken.tsx +1 -1
- package/src/components/Step/Step.tsx +6 -7
- package/src/components/Timer/TimerContent.tsx +1 -0
- package/src/components/Token/Token.tsx +2 -2
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +6 -4
- package/src/components/TransactionCard/ActiveTransactionCard.tsx +1 -1
- package/src/components/TransactionDetails.tsx +1 -1
- package/src/config/version.ts +1 -1
- package/src/hooks/useAvailableChains.ts +1 -0
- package/src/hooks/useExplorer.ts +16 -5
- package/src/hooks/useTokens.ts +2 -0
- package/src/pages/ActivitiesPage/ActivitiesPageMenuButton.tsx +1 -1
- package/src/pages/MainPage/MainPage.tsx +3 -3
- package/src/pages/RoutesPage/RoutesPage.tsx +6 -1
- package/src/pages/SendToWallet/BookmarksPage.tsx +1 -1
- package/src/pages/SendToWallet/RecentWalletsPage.tsx +1 -1
- package/src/pages/TransactionPage/ExchangeRateBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +27 -5
- package/src/pages/TransactionPage/TransactionPage.tsx +2 -9
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +9 -1
- package/src/stores/settings/createSettingsStore.ts +1 -9
- package/src/themes/createTheme.ts +4 -6
- package/src/types/events.ts +0 -5
- package/src/types/widget.ts +1 -4
- package/dist/esm/stores/routes/types.js +0 -14
- package/dist/esm/stores/routes/types.js.map +0 -1
package/src/hooks/useExplorer.ts
CHANGED
|
@@ -6,6 +6,13 @@ import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
|
6
6
|
|
|
7
7
|
const sanitiseBaseUrl = (baseUrl: string) => baseUrl.trim().replace(/\/+$/, '')
|
|
8
8
|
|
|
9
|
+
const explorerPathOverrides: Partial<
|
|
10
|
+
Record<ChainType | ChainId, { txPath: string; addressPath: string }>
|
|
11
|
+
> = {
|
|
12
|
+
[ChainId.SUI]: { txPath: 'txblock', addressPath: 'coin' },
|
|
13
|
+
[ChainType.TVM]: { txPath: '#/transaction', addressPath: '#/address' },
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
type TransactionLinkProps = { chain?: Chain | number } & (
|
|
10
17
|
| {
|
|
11
18
|
txHash: string
|
|
@@ -35,11 +42,15 @@ export const useExplorer = (): {
|
|
|
35
42
|
resolvedChain.metamask.blockExplorerUrls[0])
|
|
36
43
|
: explorerUrls?.internal?.[0]) || internalExplorerUrl
|
|
37
44
|
|
|
38
|
-
const
|
|
45
|
+
const baseUrl =
|
|
46
|
+
typeof explorerUrl === 'string' ? explorerUrl : explorerUrl.url
|
|
47
|
+
|
|
48
|
+
const overrides =
|
|
49
|
+
explorerPathOverrides[resolvedChain?.id as ChainId] ??
|
|
50
|
+
explorerPathOverrides[resolvedChain?.chainType as ChainType]
|
|
39
51
|
|
|
40
|
-
const defaultTxPath =
|
|
41
|
-
const defaultAddressPath =
|
|
42
|
-
resolvedChain?.id === ChainId.SUI ? 'coin' : 'address'
|
|
52
|
+
const defaultTxPath = overrides?.txPath ?? 'tx'
|
|
53
|
+
const defaultAddressPath = overrides?.addressPath ?? 'address'
|
|
43
54
|
const txPath =
|
|
44
55
|
typeof explorerUrl === 'string'
|
|
45
56
|
? defaultTxPath
|
|
@@ -50,7 +61,7 @@ export const useExplorer = (): {
|
|
|
50
61
|
: explorerUrl.addressPath || defaultAddressPath
|
|
51
62
|
|
|
52
63
|
return {
|
|
53
|
-
url: sanitiseBaseUrl(
|
|
64
|
+
url: sanitiseBaseUrl(baseUrl),
|
|
54
65
|
txPath,
|
|
55
66
|
addressPath,
|
|
56
67
|
resolvedChain,
|
package/src/hooks/useTokens.ts
CHANGED
|
@@ -48,6 +48,7 @@ export const useTokens = (
|
|
|
48
48
|
ChainType.SVM,
|
|
49
49
|
ChainType.UTXO,
|
|
50
50
|
ChainType.MVM,
|
|
51
|
+
ChainType.TVM,
|
|
51
52
|
].filter((chainType) => isItemAllowed(chainType, chainsConfig?.types))
|
|
52
53
|
|
|
53
54
|
const tokensResponse: TokensExtendedResponse = await getTokens(
|
|
@@ -90,6 +91,7 @@ export const useTokens = (
|
|
|
90
91
|
ChainType.SVM,
|
|
91
92
|
ChainType.UTXO,
|
|
92
93
|
ChainType.MVM,
|
|
94
|
+
ChainType.TVM,
|
|
93
95
|
].filter((chainType) => isItemAllowed(chainType, chainsConfig?.types))
|
|
94
96
|
|
|
95
97
|
const tokensResponse: TokensExtendedResponse = await getTokens(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useAccount } from '@lifi/wallet-management'
|
|
2
|
-
import DeleteOutlineIcon from '@mui/icons-material/
|
|
2
|
+
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutlined'
|
|
3
3
|
import { Button } from '@mui/material'
|
|
4
4
|
import { useMemo, useState } from 'react'
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
@@ -49,14 +49,14 @@ export const MainPage: React.FC = () => {
|
|
|
49
49
|
{custom ? (
|
|
50
50
|
<ContractComponent sx={marginSx}>{contractComponent}</ContractComponent>
|
|
51
51
|
) : null}
|
|
52
|
-
<SelectChainAndToken
|
|
52
|
+
<SelectChainAndToken sx={marginSx} />
|
|
53
53
|
{!custom || subvariantOptions?.custom === 'deposit' ? (
|
|
54
54
|
<AmountInput formType="from" sx={marginSx} />
|
|
55
55
|
) : null}
|
|
56
56
|
{!wideVariant ? <Routes sx={marginSx} /> : null}
|
|
57
57
|
<SendToWalletButton sx={marginSx} />
|
|
58
|
-
{showGasRefuelMessage ? <GasRefuelMessage
|
|
59
|
-
<MainWarningMessages
|
|
58
|
+
{showGasRefuelMessage ? <GasRefuelMessage sx={marginSx} /> : null}
|
|
59
|
+
<MainWarningMessages sx={marginSx} />
|
|
60
60
|
<Box
|
|
61
61
|
sx={{
|
|
62
62
|
display: 'flex',
|
|
@@ -69,7 +69,12 @@ export const RoutesPage = (): JSX.Element => {
|
|
|
69
69
|
const allowInteraction = account.isConnected && !toAddressUnsatisfied
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
|
-
<Stack
|
|
72
|
+
<Stack
|
|
73
|
+
className="long-list"
|
|
74
|
+
direction="column"
|
|
75
|
+
spacing={2}
|
|
76
|
+
sx={{ flex: 1 }}
|
|
77
|
+
>
|
|
73
78
|
{routeNotFound ? (
|
|
74
79
|
<RouteNotFoundCard />
|
|
75
80
|
) : isLoading && !routes?.length ? (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'
|
|
2
|
-
import DeleteOutline from '@mui/icons-material/
|
|
2
|
+
import DeleteOutline from '@mui/icons-material/DeleteOutlined'
|
|
3
3
|
import OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'
|
|
4
4
|
import TurnedIn from '@mui/icons-material/TurnedIn'
|
|
5
5
|
import { Button, ListItemAvatar, ListItemText } from '@mui/material'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'
|
|
2
|
-
import DeleteOutline from '@mui/icons-material/
|
|
2
|
+
import DeleteOutline from '@mui/icons-material/DeleteOutlined'
|
|
3
3
|
import History from '@mui/icons-material/History'
|
|
4
4
|
import OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'
|
|
5
5
|
import TurnedInNot from '@mui/icons-material/TurnedInNot'
|
|
@@ -219,7 +219,7 @@ const StatusBottomSheetContent: React.FC<StatusBottomSheetContentProps> = ({
|
|
|
219
219
|
>
|
|
220
220
|
{!showContractComponent ? (
|
|
221
221
|
<CenterContainer>
|
|
222
|
-
<IconCircle status={status}
|
|
222
|
+
<IconCircle status={status} sx={{ mb: 1 }}>
|
|
223
223
|
{status === RouteExecutionStatus.Idle ? (
|
|
224
224
|
<InfoRounded color="primary" />
|
|
225
225
|
) : null}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk'
|
|
2
2
|
import WarningRounded from '@mui/icons-material/WarningRounded'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Button,
|
|
6
|
+
Checkbox,
|
|
7
|
+
FormControlLabel,
|
|
8
|
+
Typography,
|
|
9
|
+
} from '@mui/material'
|
|
4
10
|
import type { ForwardRefExoticComponent, RefAttributes, RefObject } from 'react'
|
|
5
|
-
import { forwardRef, useRef } from 'react'
|
|
11
|
+
import { forwardRef, useRef, useState } from 'react'
|
|
6
12
|
import { useTranslation } from 'react-i18next'
|
|
7
13
|
import { BottomSheet } from '../../components/BottomSheet/BottomSheet.js'
|
|
8
14
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
@@ -44,6 +50,7 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
44
50
|
onCancel,
|
|
45
51
|
onContinue,
|
|
46
52
|
}) => {
|
|
53
|
+
const [accepted, setAccepted] = useState(false)
|
|
47
54
|
const { t } = useTranslation()
|
|
48
55
|
const ref = useRef<HTMLElement>(null)
|
|
49
56
|
useSetContentHeight(ref)
|
|
@@ -59,7 +66,7 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
59
66
|
}}
|
|
60
67
|
>
|
|
61
68
|
<CenterContainer>
|
|
62
|
-
<IconCircle status="warning"
|
|
69
|
+
<IconCircle status="warning" sx={{ mb: 1 }}>
|
|
63
70
|
<WarningRounded color="warning" />
|
|
64
71
|
</IconCircle>
|
|
65
72
|
<Typography
|
|
@@ -173,10 +180,20 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
173
180
|
%
|
|
174
181
|
</Typography>
|
|
175
182
|
</Box>
|
|
183
|
+
<FormControlLabel
|
|
184
|
+
control={
|
|
185
|
+
<Checkbox
|
|
186
|
+
checked={accepted}
|
|
187
|
+
onChange={(_, checked) => setAccepted(checked)}
|
|
188
|
+
/>
|
|
189
|
+
}
|
|
190
|
+
label={t('warning.checkbox.highValueLoss')}
|
|
191
|
+
sx={{ mt: 1 }}
|
|
192
|
+
/>
|
|
176
193
|
<Box
|
|
177
194
|
sx={{
|
|
178
195
|
display: 'flex',
|
|
179
|
-
mt:
|
|
196
|
+
mt: 1,
|
|
180
197
|
}}
|
|
181
198
|
>
|
|
182
199
|
<Button variant="text" onClick={onCancel} fullWidth>
|
|
@@ -188,7 +205,12 @@ const TokenValueBottomSheetContent: React.FC<TokenValueBottomSheetProps> = ({
|
|
|
188
205
|
p: 1,
|
|
189
206
|
}}
|
|
190
207
|
/>
|
|
191
|
-
<Button
|
|
208
|
+
<Button
|
|
209
|
+
variant="contained"
|
|
210
|
+
onClick={onContinue}
|
|
211
|
+
disabled={!accepted}
|
|
212
|
+
fullWidth
|
|
213
|
+
>
|
|
192
214
|
{t('button.continue')}
|
|
193
215
|
</Button>
|
|
194
216
|
</Box>
|
|
@@ -2,7 +2,7 @@ import type { ExchangeRateUpdateParams } from '@lifi/sdk'
|
|
|
2
2
|
import Delete from '@mui/icons-material/Delete'
|
|
3
3
|
import { Box, Button, Tooltip } from '@mui/material'
|
|
4
4
|
import { useLocation, useNavigate } from '@tanstack/react-router'
|
|
5
|
-
import { type JSX,
|
|
5
|
+
import { type JSX, useMemo, useRef, useState } from 'react'
|
|
6
6
|
import { useTranslation } from 'react-i18next'
|
|
7
7
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
8
8
|
import { ContractComponent } from '../../components/ContractComponent/ContractComponent.js'
|
|
@@ -106,13 +106,6 @@ export const TransactionPage = (): JSX.Element | null => {
|
|
|
106
106
|
|
|
107
107
|
useHeader(getHeaderTitle(), headerAction)
|
|
108
108
|
|
|
109
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: We want to emit event only when the page is mounted
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (status === RouteExecutionStatus.Idle) {
|
|
112
|
-
emitter.emit(WidgetEvent.ReviewTransactionPageEntered, route)
|
|
113
|
-
}
|
|
114
|
-
}, [])
|
|
115
|
-
|
|
116
109
|
if (!route) {
|
|
117
110
|
return null
|
|
118
111
|
}
|
|
@@ -221,7 +214,7 @@ export const TransactionPage = (): JSX.Element | null => {
|
|
|
221
214
|
{status === RouteExecutionStatus.Idle ||
|
|
222
215
|
status === RouteExecutionStatus.Failed ? (
|
|
223
216
|
<>
|
|
224
|
-
<WarningMessages
|
|
217
|
+
<WarningMessages sx={{ mt: 2 }} route={route} allowInteraction />
|
|
225
218
|
<Box
|
|
226
219
|
sx={{
|
|
227
220
|
mt: 2,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useEthereumContext,
|
|
5
5
|
useSolanaContext,
|
|
6
6
|
useSuiContext,
|
|
7
|
+
useTronContext,
|
|
7
8
|
} from '@lifi/widget-provider'
|
|
8
9
|
import { useMemo } from 'react'
|
|
9
10
|
import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
@@ -19,6 +20,7 @@ const internalChainTypes = [
|
|
|
19
20
|
ChainType.SVM,
|
|
20
21
|
ChainType.UTXO,
|
|
21
22
|
ChainType.MVM,
|
|
23
|
+
ChainType.TVM,
|
|
22
24
|
]
|
|
23
25
|
|
|
24
26
|
export function useExternalWalletProvider(): ExternalWalletProvider {
|
|
@@ -27,6 +29,7 @@ export function useExternalWalletProvider(): ExternalWalletProvider {
|
|
|
27
29
|
const { isExternalContext: hasExternalSolanaContext } = useSolanaContext()
|
|
28
30
|
const { isExternalContext: hasExternalBitcoinContext } = useBitcoinContext()
|
|
29
31
|
const { isExternalContext: hasExternalSuiContext } = useSuiContext()
|
|
32
|
+
const { isExternalContext: hasExternalTronContext } = useTronContext()
|
|
30
33
|
const data = useMemo(() => {
|
|
31
34
|
const providers: ChainType[] = []
|
|
32
35
|
if (hasExternalEthereumContext) {
|
|
@@ -41,11 +44,15 @@ export function useExternalWalletProvider(): ExternalWalletProvider {
|
|
|
41
44
|
if (hasExternalSuiContext) {
|
|
42
45
|
providers.push(ChainType.MVM)
|
|
43
46
|
}
|
|
47
|
+
if (hasExternalTronContext) {
|
|
48
|
+
providers.push(ChainType.TVM)
|
|
49
|
+
}
|
|
44
50
|
const hasExternalProvider =
|
|
45
51
|
hasExternalEthereumContext ||
|
|
46
52
|
hasExternalSolanaContext ||
|
|
47
53
|
hasExternalBitcoinContext ||
|
|
48
|
-
hasExternalSuiContext
|
|
54
|
+
hasExternalSuiContext ||
|
|
55
|
+
hasExternalTronContext
|
|
49
56
|
|
|
50
57
|
const useExternalWalletProvidersOnly =
|
|
51
58
|
hasExternalProvider &&
|
|
@@ -63,6 +70,7 @@ export function useExternalWalletProvider(): ExternalWalletProvider {
|
|
|
63
70
|
hasExternalSolanaContext,
|
|
64
71
|
hasExternalBitcoinContext,
|
|
65
72
|
hasExternalSuiContext,
|
|
73
|
+
hasExternalTronContext,
|
|
66
74
|
walletConfig?.usePartialWalletManagement,
|
|
67
75
|
walletConfig?.forceInternalWalletManagement,
|
|
68
76
|
])
|
|
@@ -177,15 +177,7 @@ export const createSettingsStore = (
|
|
|
177
177
|
})
|
|
178
178
|
return state
|
|
179
179
|
},
|
|
180
|
-
migrate: (
|
|
181
|
-
if (version === 1) {
|
|
182
|
-
persistedState.slippage = defaultConfigurableSettings.slippage
|
|
183
|
-
}
|
|
184
|
-
if (version <= 3) {
|
|
185
|
-
persistedState.routePriority = 'CHEAPEST'
|
|
186
|
-
}
|
|
187
|
-
return persistedState as SettingsState
|
|
188
|
-
},
|
|
180
|
+
migrate: () => ({}),
|
|
189
181
|
onRehydrateStorage: () => {
|
|
190
182
|
const initializeLanguageSettings = async (
|
|
191
183
|
state: SettingsState,
|
|
@@ -38,10 +38,8 @@ const enterKeyframe = keyframes`
|
|
|
38
38
|
`
|
|
39
39
|
|
|
40
40
|
export const createTheme = (widgetTheme: WidgetTheme = {}): Theme => {
|
|
41
|
-
const configuredPaletteLight =
|
|
42
|
-
|
|
43
|
-
const configuredPaletteDark =
|
|
44
|
-
widgetTheme.colorSchemes?.dark?.palette ?? widgetTheme.palette
|
|
41
|
+
const configuredPaletteLight = widgetTheme.colorSchemes?.light?.palette
|
|
42
|
+
const configuredPaletteDark = widgetTheme.colorSchemes?.dark?.palette
|
|
45
43
|
|
|
46
44
|
const primaryMainColorLight =
|
|
47
45
|
(configuredPaletteLight?.primary as SimplePaletteColorOptions)?.main ??
|
|
@@ -90,7 +88,7 @@ export const createTheme = (widgetTheme: WidgetTheme = {}): Theme => {
|
|
|
90
88
|
palette: {
|
|
91
89
|
...palette,
|
|
92
90
|
...paletteLight,
|
|
93
|
-
...
|
|
91
|
+
...widgetTheme.colorSchemes?.light?.palette,
|
|
94
92
|
primary: {
|
|
95
93
|
main: primaryMainColorLight,
|
|
96
94
|
light: primaryLightenColorLight,
|
|
@@ -107,7 +105,7 @@ export const createTheme = (widgetTheme: WidgetTheme = {}): Theme => {
|
|
|
107
105
|
palette: {
|
|
108
106
|
...palette,
|
|
109
107
|
...paletteDark,
|
|
110
|
-
...
|
|
108
|
+
...widgetTheme.colorSchemes?.dark?.palette,
|
|
111
109
|
primary: {
|
|
112
110
|
main: primaryMainColorDark,
|
|
113
111
|
light: primaryLightenColorDark,
|
package/src/types/events.ts
CHANGED
|
@@ -12,10 +12,6 @@ export enum WidgetEvent {
|
|
|
12
12
|
FormFieldChanged = 'formFieldChanged',
|
|
13
13
|
LowAddressActivityConfirmed = 'lowAddressActivityConfirmed',
|
|
14
14
|
PageEntered = 'pageEntered',
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `PageEntered` event instead.
|
|
17
|
-
*/
|
|
18
|
-
ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
|
|
19
15
|
RouteExecutionCompleted = 'routeExecutionCompleted',
|
|
20
16
|
RouteExecutionFailed = 'routeExecutionFailed',
|
|
21
17
|
RouteExecutionStarted = 'routeExecutionStarted',
|
|
@@ -37,7 +33,6 @@ export type WidgetEvents = {
|
|
|
37
33
|
formFieldChanged: FormFieldChanged
|
|
38
34
|
lowAddressActivityConfirmed: LowAddressActivityConfirmed
|
|
39
35
|
pageEntered: NavigationRouteType
|
|
40
|
-
reviewTransactionPageEntered?: Route
|
|
41
36
|
routeExecutionCompleted: Route
|
|
42
37
|
routeExecutionFailed: RouteExecutionUpdate
|
|
43
38
|
routeExecutionStarted: Route
|
package/src/types/widget.ts
CHANGED
|
@@ -81,10 +81,6 @@ export type WidgetThemeComponents = Partial<
|
|
|
81
81
|
>
|
|
82
82
|
|
|
83
83
|
export type WidgetTheme = {
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Use `colorScheme` instead.
|
|
86
|
-
*/
|
|
87
|
-
palette?: PaletteOptions
|
|
88
84
|
colorSchemes?: {
|
|
89
85
|
light?: {
|
|
90
86
|
palette: PaletteOptions
|
|
@@ -174,6 +170,7 @@ export interface WidgetSDKConfig
|
|
|
174
170
|
| 'apiKey'
|
|
175
171
|
| 'disableVersionCheck'
|
|
176
172
|
| 'integrator'
|
|
173
|
+
| 'providers'
|
|
177
174
|
| 'routeOptions'
|
|
178
175
|
| 'widgetVersion'
|
|
179
176
|
> {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/stores/routes/types.ts
|
|
2
|
-
let RouteExecutionStatus = /* @__PURE__ */ function(RouteExecutionStatus) {
|
|
3
|
-
RouteExecutionStatus[RouteExecutionStatus["Idle"] = 1] = "Idle";
|
|
4
|
-
RouteExecutionStatus[RouteExecutionStatus["Pending"] = 2] = "Pending";
|
|
5
|
-
RouteExecutionStatus[RouteExecutionStatus["Done"] = 4] = "Done";
|
|
6
|
-
RouteExecutionStatus[RouteExecutionStatus["Failed"] = 8] = "Failed";
|
|
7
|
-
RouteExecutionStatus[RouteExecutionStatus["Partial"] = 16] = "Partial";
|
|
8
|
-
RouteExecutionStatus[RouteExecutionStatus["Refunded"] = 32] = "Refunded";
|
|
9
|
-
return RouteExecutionStatus;
|
|
10
|
-
}({});
|
|
11
|
-
//#endregion
|
|
12
|
-
export { RouteExecutionStatus };
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/stores/routes/types.ts"],"sourcesContent":["import type { Route, RouteExtended } from '@lifi/sdk'\n\nexport interface RouteExecution {\n route: RouteExtended\n status: RouteExecutionStatus\n}\n\nexport interface RouteExecutionState {\n routes: Partial<Record<string, RouteExecution>>\n setExecutableRoute: (route: Route, observableRouteIds?: string[]) => void\n updateRoute: (route: Route) => void\n deleteRoute: (routeId: string) => void\n deleteRoutes: (\n type: 'completed' | 'active' | 'failed',\n accountAddresses?: string[]\n ) => void\n}\n\nexport enum RouteExecutionStatus {\n Idle = 1 << 0,\n Pending = 1 << 1,\n Done = 1 << 2,\n Failed = 1 << 3,\n Partial = 1 << 4,\n Refunded = 1 << 5,\n}\n"],"mappings":";AAkBA,IAAY,uBAAL,yBAAA,sBAAA;AACL,sBAAA,qBAAA,UAAA,KAAA;AACA,sBAAA,qBAAA,aAAA,KAAA;AACA,sBAAA,qBAAA,UAAA,KAAA;AACA,sBAAA,qBAAA,YAAA,KAAA;AACA,sBAAA,qBAAA,aAAA,MAAA;AACA,sBAAA,qBAAA,cAAA,MAAA;;KACD"}
|