@lifi/widget 3.14.2 → 3.15.1
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/CHANGELOG.md +15 -0
- package/dist/esm/AppDrawer.style.d.ts +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +3 -3
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +2 -2
- package/dist/esm/components/AppContainer.d.ts +1 -1
- package/dist/esm/components/Avatar/Avatar.style.d.ts +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.d.ts +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/Card.d.ts +1 -1
- package/dist/esm/components/Card/CardButton.style.d.ts +2 -2
- package/dist/esm/components/Card/CardHeader.d.ts +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
- package/dist/esm/components/Card/CardLabel.d.ts +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.d.ts +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +3 -3
- package/dist/esm/components/Header/SettingsButton.style.d.ts +2 -2
- package/dist/esm/components/ListItem/ListItem.d.ts +1 -1
- package/dist/esm/components/ListItem/ListItemButton.d.ts +1 -1
- package/dist/esm/components/ListItemButton.d.ts +1 -1
- package/dist/esm/components/Messages/AccountNotDeployedMessage.d.ts +2 -0
- package/dist/esm/components/Messages/AccountNotDeployedMessage.js +10 -0
- package/dist/esm/components/Messages/AccountNotDeployedMessage.js.map +1 -0
- package/dist/esm/components/Messages/AlertMessage.js.map +1 -0
- package/dist/esm/components/Messages/AlertMessage.style.js.map +1 -0
- package/dist/esm/components/Messages/FundsSufficiencyMessage.d.ts +2 -0
- package/dist/esm/components/{GasMessage → Messages}/FundsSufficiencyMessage.js +3 -4
- package/dist/esm/components/Messages/FundsSufficiencyMessage.js.map +1 -0
- package/dist/esm/components/Messages/GasMessage.js.map +1 -0
- package/dist/esm/components/{GasMessage → Messages}/GasRefuelMessage.js +2 -2
- package/dist/esm/components/Messages/GasRefuelMessage.js.map +1 -0
- package/dist/esm/components/{GasMessage/GasMessage.style.js → Messages/GasRefuelMessage.style.js} +1 -1
- package/dist/esm/components/Messages/GasRefuelMessage.style.js.map +1 -0
- package/dist/esm/components/{GasMessage → Messages}/GasSufficiencyMessage.d.ts +2 -1
- package/dist/esm/components/{GasMessage → Messages}/GasSufficiencyMessage.js +3 -3
- package/dist/esm/components/Messages/GasSufficiencyMessage.js.map +1 -0
- package/dist/esm/components/Messages/MainMessages.js +29 -0
- package/dist/esm/components/Messages/MainMessages.js.map +1 -0
- package/dist/esm/components/Messages/ToAddressRequiredMessage.d.ts +2 -0
- package/dist/esm/components/Messages/ToAddressRequiredMessage.js +13 -0
- package/dist/esm/components/Messages/ToAddressRequiredMessage.js.map +1 -0
- package/dist/esm/components/Messages/types.js.map +1 -0
- package/dist/esm/components/Messages/useMessageQueue.d.ts +11 -0
- package/dist/esm/components/Messages/useMessageQueue.js +48 -0
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -0
- package/dist/esm/components/PageContainer.d.ts +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.d.ts +2 -2
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -3
- package/dist/esm/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/dist/esm/components/SettingsListItemButton.d.ts +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +4 -4
- package/dist/esm/components/StepActions/StepActions.style.d.ts +2 -2
- package/dist/esm/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/dist/esm/components/Tabs/Tabs.style.d.ts +3 -3
- package/dist/esm/components/Token/Token.style.d.ts +1 -1
- package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -2
- package/dist/esm/components/TokenRate/TokenRate.style.d.ts +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/useGasRefuel.js +1 -1
- package/dist/esm/hooks/useGasRefuel.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js +1 -1
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useIsContractAddress.d.ts +4 -1
- package/dist/esm/hooks/useIsContractAddress.js +1 -2
- package/dist/esm/hooks/useIsContractAddress.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +1 -0
- package/dist/esm/hooks/useToAddressRequirements.js +11 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/i18n/en.json +6 -6
- package/dist/esm/pages/MainPage/MainPage.js +2 -2
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.style.d.ts +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +3 -2
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts +1 -1
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js +3 -3
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.d.ts +0 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js +6 -8
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js +1 -3
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +8 -8
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.d.ts +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/utils/eip7702.d.ts +22 -0
- package/dist/esm/utils/eip7702.js +23 -0
- package/dist/esm/utils/eip7702.js.map +1 -0
- package/package.json +7 -7
- package/src/components/Messages/AccountNotDeployedMessage.tsx +22 -0
- package/src/components/{GasMessage → Messages}/FundsSufficiencyMessage.tsx +4 -4
- package/src/components/{GasMessage → Messages}/GasRefuelMessage.tsx +2 -2
- package/src/components/{GasMessage → Messages}/GasSufficiencyMessage.tsx +5 -3
- package/src/components/Messages/MainMessages.tsx +40 -0
- package/src/components/Messages/ToAddressRequiredMessage.tsx +27 -0
- package/src/components/Messages/useMessageQueue.ts +63 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useGasRefuel.ts +1 -1
- package/src/hooks/useGasSufficiency.ts +1 -1
- package/src/hooks/useIsContractAddress.ts +1 -2
- package/src/hooks/useToAddressRequirements.ts +23 -5
- package/src/i18n/en.json +6 -6
- package/src/pages/MainPage/MainPage.tsx +2 -2
- package/src/pages/MainPage/ReviewButton.tsx +6 -2
- package/src/pages/SendToWallet/BookmarkAddressSheet.tsx +9 -5
- package/src/pages/SendToWallet/ConfirmAddressSheet.tsx +9 -30
- package/src/pages/SendToWallet/SendToWalletPage.tsx +0 -5
- package/src/pages/TransactionPage/TransactionPage.tsx +1 -1
- package/src/utils/eip7702.ts +23 -0
- package/dist/esm/components/AlertMessage/AlertMessage.js.map +0 -1
- package/dist/esm/components/AlertMessage/AlertMessage.style.js.map +0 -1
- package/dist/esm/components/AlertMessage/types.js.map +0 -1
- package/dist/esm/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
- package/dist/esm/components/GasMessage/FundsSufficiencyMessage.js.map +0 -1
- package/dist/esm/components/GasMessage/GasMessage.js.map +0 -1
- package/dist/esm/components/GasMessage/GasMessage.style.js.map +0 -1
- package/dist/esm/components/GasMessage/GasRefuelMessage.js.map +0 -1
- package/dist/esm/components/GasMessage/GasSufficiencyMessage.js.map +0 -1
- package/dist/esm/components/ToAddressRequiredMessage.d.ts +0 -7
- package/dist/esm/components/ToAddressRequiredMessage.js +0 -18
- package/dist/esm/components/ToAddressRequiredMessage.js.map +0 -1
- package/dist/esm/pages/MainPage/MainMessages.js +0 -10
- package/dist/esm/pages/MainPage/MainMessages.js.map +0 -1
- package/src/components/ToAddressRequiredMessage.tsx +0 -44
- package/src/pages/MainPage/MainMessages.tsx +0 -17
- /package/dist/esm/components/{AlertMessage → Messages}/AlertMessage.d.ts +0 -0
- /package/dist/esm/components/{AlertMessage → Messages}/AlertMessage.js +0 -0
- /package/dist/esm/components/{AlertMessage → Messages}/AlertMessage.style.d.ts +0 -0
- /package/dist/esm/components/{AlertMessage → Messages}/AlertMessage.style.js +0 -0
- /package/dist/esm/components/{GasMessage → Messages}/GasMessage.d.ts +0 -0
- /package/dist/esm/components/{GasMessage → Messages}/GasMessage.js +0 -0
- /package/dist/esm/components/{GasMessage → Messages}/GasRefuelMessage.d.ts +0 -0
- /package/dist/esm/components/{GasMessage/GasMessage.style.d.ts → Messages/GasRefuelMessage.style.d.ts} +0 -0
- /package/dist/esm/{pages/MainPage → components/Messages}/MainMessages.d.ts +0 -0
- /package/dist/esm/components/{AlertMessage → Messages}/types.d.ts +0 -0
- /package/dist/esm/components/{AlertMessage → Messages}/types.js +0 -0
- /package/src/components/{AlertMessage → Messages}/AlertMessage.style.tsx +0 -0
- /package/src/components/{AlertMessage → Messages}/AlertMessage.tsx +0 -0
- /package/src/components/{GasMessage → Messages}/GasMessage.tsx +0 -0
- /package/src/components/{GasMessage/GasMessage.style.ts → Messages/GasRefuelMessage.style.ts} +0 -0
- /package/src/components/{AlertMessage → Messages}/types.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WarningRounded } from '@mui/icons-material'
|
|
2
|
+
import { type BoxProps, Typography } from '@mui/material'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import { AlertMessage } from './AlertMessage.js'
|
|
5
|
+
|
|
6
|
+
export const AccountNotDeployedMessage: React.FC<BoxProps> = (props) => {
|
|
7
|
+
const { t } = useTranslation()
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<AlertMessage
|
|
11
|
+
title={
|
|
12
|
+
<Typography variant="body2" sx={{ color: 'text.primary' }}>
|
|
13
|
+
{t('warning.message.accountNotDeployedMessage')}
|
|
14
|
+
</Typography>
|
|
15
|
+
}
|
|
16
|
+
icon={<WarningRounded />}
|
|
17
|
+
severity="warning"
|
|
18
|
+
multiline
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WarningRounded } from '@mui/icons-material'
|
|
2
|
-
import { Typography } from '@mui/material'
|
|
2
|
+
import { type BoxProps, Typography } from '@mui/material'
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { AlertMessage } from '
|
|
4
|
+
import { AlertMessage } from './AlertMessage.js'
|
|
5
5
|
|
|
6
|
-
export const FundsSufficiencyMessage = () => {
|
|
6
|
+
export const FundsSufficiencyMessage: React.FC<BoxProps> = (props) => {
|
|
7
7
|
const { t } = useTranslation()
|
|
8
8
|
return (
|
|
9
9
|
<AlertMessage
|
|
@@ -13,7 +13,6 @@ export const FundsSufficiencyMessage = () => {
|
|
|
13
13
|
<Typography
|
|
14
14
|
variant="body2"
|
|
15
15
|
sx={{
|
|
16
|
-
px: 1,
|
|
17
16
|
color: 'text.primary',
|
|
18
17
|
}}
|
|
19
18
|
>
|
|
@@ -21,6 +20,7 @@ export const FundsSufficiencyMessage = () => {
|
|
|
21
20
|
</Typography>
|
|
22
21
|
}
|
|
23
22
|
multiline
|
|
23
|
+
{...props}
|
|
24
24
|
/>
|
|
25
25
|
)
|
|
26
26
|
}
|
|
@@ -6,8 +6,8 @@ import { useTranslation } from 'react-i18next'
|
|
|
6
6
|
import { useGasRefuel } from '../../hooks/useGasRefuel.js'
|
|
7
7
|
import { useSettings } from '../../stores/settings/useSettings.js'
|
|
8
8
|
import { useSettingsActions } from '../../stores/settings/useSettingsActions.js'
|
|
9
|
-
import { AlertMessage } from '
|
|
10
|
-
import { InfoMessageSwitch } from './
|
|
9
|
+
import { AlertMessage } from './AlertMessage.js'
|
|
10
|
+
import { InfoMessageSwitch } from './GasRefuelMessage.style.js'
|
|
11
11
|
|
|
12
12
|
export const GasRefuelMessage: React.FC<BoxProps> = (props) => {
|
|
13
13
|
const { t } = useTranslation()
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { EvStation } from '@mui/icons-material'
|
|
2
|
-
import { Typography } from '@mui/material'
|
|
2
|
+
import { type BoxProps, Typography } from '@mui/material'
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
4
|
import { formatUnits } from 'viem'
|
|
5
5
|
import type { GasSufficiency } from '../../hooks/useGasSufficiency.js'
|
|
6
|
-
import { AlertMessage } from '
|
|
6
|
+
import { AlertMessage } from './AlertMessage.js'
|
|
7
7
|
|
|
8
|
-
interface GasSufficiencyMessageProps {
|
|
8
|
+
interface GasSufficiencyMessageProps extends BoxProps {
|
|
9
9
|
insufficientGas?: GasSufficiency[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const GasSufficiencyMessage: React.FC<GasSufficiencyMessageProps> = ({
|
|
13
13
|
insufficientGas,
|
|
14
|
+
...props
|
|
14
15
|
}) => {
|
|
15
16
|
const { t } = useTranslation()
|
|
16
17
|
return (
|
|
@@ -27,6 +28,7 @@ export const GasSufficiencyMessage: React.FC<GasSufficiencyMessageProps> = ({
|
|
|
27
28
|
{t('warning.title.insufficientGas')}
|
|
28
29
|
</Typography>
|
|
29
30
|
}
|
|
31
|
+
{...props}
|
|
30
32
|
>
|
|
31
33
|
<Typography
|
|
32
34
|
variant="body2"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BoxProps } from '@mui/material'
|
|
2
|
+
import { Collapse } from '@mui/material'
|
|
3
|
+
import { useRoutes } from '../../hooks/useRoutes.js'
|
|
4
|
+
import { AccountNotDeployedMessage } from './AccountNotDeployedMessage.js'
|
|
5
|
+
import { FundsSufficiencyMessage } from './FundsSufficiencyMessage.js'
|
|
6
|
+
import { GasSufficiencyMessage } from './GasSufficiencyMessage.js'
|
|
7
|
+
import { ToAddressRequiredMessage } from './ToAddressRequiredMessage.js'
|
|
8
|
+
import { useMessageQueue } from './useMessageQueue.js'
|
|
9
|
+
|
|
10
|
+
export const MainMessages: React.FC<BoxProps> = (props) => {
|
|
11
|
+
const { routes } = useRoutes()
|
|
12
|
+
const currentRoute = routes?.[0]
|
|
13
|
+
const { currentMessage, hasMessages } = useMessageQueue(currentRoute)
|
|
14
|
+
|
|
15
|
+
const getMessage = () => {
|
|
16
|
+
switch (currentMessage?.id) {
|
|
17
|
+
case 'INSUFFICIENT_FUNDS':
|
|
18
|
+
return <FundsSufficiencyMessage {...props} />
|
|
19
|
+
case 'INSUFFICIENT_GAS':
|
|
20
|
+
return (
|
|
21
|
+
<GasSufficiencyMessage
|
|
22
|
+
insufficientGas={currentMessage.props?.insufficientGas}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
case 'ACCOUNT_NOT_DEPLOYED':
|
|
27
|
+
return <AccountNotDeployedMessage {...props} />
|
|
28
|
+
case 'TO_ADDRESS_REQUIRED':
|
|
29
|
+
return <ToAddressRequiredMessage {...props} />
|
|
30
|
+
default:
|
|
31
|
+
return null
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Collapse in={hasMessages} timeout={225} unmountOnExit mountOnEnter>
|
|
37
|
+
{getMessage()}
|
|
38
|
+
</Collapse>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Wallet } from '@mui/icons-material'
|
|
2
|
+
import type { BoxProps } from '@mui/material'
|
|
3
|
+
import { Typography } from '@mui/material'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { AlertMessage } from './AlertMessage.js'
|
|
6
|
+
|
|
7
|
+
export const ToAddressRequiredMessage: React.FC<BoxProps> = ({ ...props }) => {
|
|
8
|
+
const { t } = useTranslation()
|
|
9
|
+
return (
|
|
10
|
+
<AlertMessage
|
|
11
|
+
title={
|
|
12
|
+
<Typography
|
|
13
|
+
variant="body2"
|
|
14
|
+
sx={{
|
|
15
|
+
px: 1,
|
|
16
|
+
color: 'text.primary',
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{t('info.message.toAddressIsRequired')}
|
|
20
|
+
</Typography>
|
|
21
|
+
}
|
|
22
|
+
icon={<Wallet />}
|
|
23
|
+
multiline
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Route } from '@lifi/sdk'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
import { useFromTokenSufficiency } from '../../hooks/useFromTokenSufficiency.js'
|
|
4
|
+
import { useGasSufficiency } from '../../hooks/useGasSufficiency.js'
|
|
5
|
+
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'
|
|
6
|
+
|
|
7
|
+
interface QueuedMessage {
|
|
8
|
+
id: string
|
|
9
|
+
priority: number
|
|
10
|
+
props?: Record<string, any>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useMessageQueue = (route?: Route) => {
|
|
14
|
+
const { requiredToAddress, accountNotDeployedAtDestination } =
|
|
15
|
+
useToAddressRequirements()
|
|
16
|
+
const { insufficientFromToken } = useFromTokenSufficiency(route)
|
|
17
|
+
const { insufficientGas } = useGasSufficiency(route)
|
|
18
|
+
|
|
19
|
+
const messageQueue = useMemo(() => {
|
|
20
|
+
const queue: QueuedMessage[] = []
|
|
21
|
+
|
|
22
|
+
if (insufficientFromToken) {
|
|
23
|
+
queue.push({
|
|
24
|
+
id: 'INSUFFICIENT_FUNDS',
|
|
25
|
+
priority: 1,
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (insufficientGas?.length) {
|
|
30
|
+
queue.push({
|
|
31
|
+
id: 'INSUFFICIENT_GAS',
|
|
32
|
+
priority: 2,
|
|
33
|
+
props: { insufficientGas },
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (accountNotDeployedAtDestination) {
|
|
38
|
+
queue.push({
|
|
39
|
+
id: 'ACCOUNT_NOT_DEPLOYED',
|
|
40
|
+
priority: 3,
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (requiredToAddress) {
|
|
45
|
+
queue.push({
|
|
46
|
+
id: 'TO_ADDRESS_REQUIRED',
|
|
47
|
+
priority: 4,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return queue.sort((a, b) => a.priority - b.priority)
|
|
52
|
+
}, [
|
|
53
|
+
insufficientFromToken,
|
|
54
|
+
insufficientGas,
|
|
55
|
+
accountNotDeployedAtDestination,
|
|
56
|
+
requiredToAddress,
|
|
57
|
+
])
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
currentMessage: messageQueue[0],
|
|
61
|
+
hasMessages: messageQueue.length > 0,
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '3.
|
|
2
|
+
export const version = '3.15.1'
|
|
@@ -23,7 +23,7 @@ export const useGasRefuel = () => {
|
|
|
23
23
|
|
|
24
24
|
const effectiveToAddress = toAddress || toAccount?.address
|
|
25
25
|
|
|
26
|
-
const isToContractAddress = useIsContractAddress(
|
|
26
|
+
const { isContractAddress: isToContractAddress } = useIsContractAddress(
|
|
27
27
|
effectiveToAddress,
|
|
28
28
|
toChainId,
|
|
29
29
|
toChain?.chainType
|
|
@@ -22,7 +22,7 @@ export const useGasSufficiency = (route?: RouteExtended) => {
|
|
|
22
22
|
chainType: getChainById(route?.fromChainId)?.chainType,
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
-
const isContractAddress = useIsContractAddress(
|
|
25
|
+
const { isContractAddress } = useIsContractAddress(
|
|
26
26
|
account.address,
|
|
27
27
|
route?.fromChainId,
|
|
28
28
|
account.chainType
|
|
@@ -3,20 +3,29 @@ import { useChain } from '../hooks/useChain.js'
|
|
|
3
3
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
4
4
|
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
5
5
|
import { RequiredUI } from '../types/widget.js'
|
|
6
|
+
import { isDelegationDesignatorCode } from '../utils/eip7702.js'
|
|
6
7
|
import { useIsContractAddress } from './useIsContractAddress.js'
|
|
7
8
|
|
|
8
9
|
export const useToAddressRequirements = () => {
|
|
9
10
|
const { requiredUI } = useWidgetConfig()
|
|
10
|
-
const [fromChainId, toChainId] = useFieldValues(
|
|
11
|
+
const [fromChainId, toChainId, toAddress] = useFieldValues(
|
|
12
|
+
'fromChain',
|
|
13
|
+
'toChain',
|
|
14
|
+
'toAddress'
|
|
15
|
+
)
|
|
11
16
|
const { chain: fromChain } = useChain(fromChainId)
|
|
12
17
|
const { chain: toChain } = useChain(toChainId)
|
|
13
18
|
const { account } = useAccount({
|
|
14
19
|
chainType: fromChain?.chainType,
|
|
15
20
|
})
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const {
|
|
22
|
+
isContractAddress: isFromContractAddress,
|
|
23
|
+
contractCode: fromContractCode,
|
|
24
|
+
} = useIsContractAddress(account.address, fromChainId, account.chainType)
|
|
25
|
+
const { isContractAddress: isToContractAddress } = useIsContractAddress(
|
|
26
|
+
toAddress,
|
|
27
|
+
toChainId,
|
|
28
|
+
toChain?.chainType
|
|
20
29
|
)
|
|
21
30
|
|
|
22
31
|
const isDifferentChainType =
|
|
@@ -25,6 +34,14 @@ export const useToAddressRequirements = () => {
|
|
|
25
34
|
const isCrossChainContractAddress =
|
|
26
35
|
isFromContractAddress && fromChainId !== toChainId
|
|
27
36
|
|
|
37
|
+
const accountNotDeployedAtDestination =
|
|
38
|
+
isFromContractAddress &&
|
|
39
|
+
// We don't want to block transfers for EIP-7702 accounts since they are designed
|
|
40
|
+
// to maintain EOA-like properties while delegating execution.
|
|
41
|
+
!isDelegationDesignatorCode(fromContractCode) &&
|
|
42
|
+
!isToContractAddress &&
|
|
43
|
+
account.address?.toLowerCase() === toAddress?.toLowerCase()
|
|
44
|
+
|
|
28
45
|
const requiredToAddress =
|
|
29
46
|
requiredUI?.includes(RequiredUI.ToAddress) ||
|
|
30
47
|
isDifferentChainType ||
|
|
@@ -33,5 +50,6 @@ export const useToAddressRequirements = () => {
|
|
|
33
50
|
return {
|
|
34
51
|
requiredToAddress,
|
|
35
52
|
requiredToChainType: toChain?.chainType,
|
|
53
|
+
accountNotDeployedAtDestination,
|
|
36
54
|
}
|
|
37
55
|
}
|
package/src/i18n/en.json
CHANGED
|
@@ -84,15 +84,13 @@
|
|
|
84
84
|
"message": {
|
|
85
85
|
"autoRefuel": "You're low on {{chainName}} gas. By continuing, you'll get enough gas to complete the transaction.",
|
|
86
86
|
"emptyActiveTransactions": "Transactions in progress will appear here. Once completed, find them in transaction history.",
|
|
87
|
-
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please search by contract address if your token doesn't appear or choose another chain.",
|
|
88
|
-
"emptyChainList": "We couldn't find any chains that match your search",
|
|
89
87
|
"emptyBridgesList": "We couldn't find any bridges that match your search",
|
|
88
|
+
"emptyChainList": "We couldn't find any chains that match your search",
|
|
90
89
|
"emptyExchangesList": "We couldn't find any exchanges that match your search",
|
|
90
|
+
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please search by contract address if your token doesn't appear or choose another chain.",
|
|
91
91
|
"emptyTransactionHistory": "Transaction history is only stored locally and will be deleted if you clear your browser data.",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"toAddressIsRequired": "Please provide the destination wallet address to which the funds will be transferred.",
|
|
95
|
-
"routeNotFound": "Reasons for that could be: low liquidity, amount selected is too low, gas costs are too high or there are no routes for the selected combination."
|
|
92
|
+
"routeNotFound": "Reasons for that could be: low liquidity, amount selected is too low, gas costs are too high or there are no routes for the selected combination.",
|
|
93
|
+
"toAddressIsRequired": "Please provide the destination wallet address to which the funds will be transferred."
|
|
96
94
|
},
|
|
97
95
|
"title": {
|
|
98
96
|
"autoRefuel": "Get {{chainName}} gas",
|
|
@@ -119,8 +117,10 @@
|
|
|
119
117
|
},
|
|
120
118
|
"warning": {
|
|
121
119
|
"message": {
|
|
120
|
+
"accountNotDeployedMessage": "Smart contract account is not deployed on the destination chain. Sending funds to a non-existent contract would result in permanent loss.",
|
|
122
121
|
"deleteActiveTransactions": "Active transactions are only stored locally and can't be recovered if you delete them.",
|
|
123
122
|
"deleteTransactionHistory": "Transaction history is only stored locally and can't be recovered if you delete it.",
|
|
123
|
+
"fundsLossPrevention": "Always ensure smart contract accounts are properly set up on the destination chain and avoid direct transfers to exchanges to prevent fund loss.",
|
|
124
124
|
"highValueLoss": "The value of the received tokens is significantly lower than the exchanged tokens and transaction cost.",
|
|
125
125
|
"insufficientFunds": "You don't have enough funds to complete the transaction.",
|
|
126
126
|
"insufficientGas": "You don't have enough gas to complete the transaction. You need to add at least:",
|
|
@@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next'
|
|
|
3
3
|
import { ActiveTransactions } from '../../components/ActiveTransactions/ActiveTransactions.js'
|
|
4
4
|
import { AmountInput } from '../../components/AmountInput/AmountInput.js'
|
|
5
5
|
import { ContractComponent } from '../../components/ContractComponent/ContractComponent.js'
|
|
6
|
-
import { GasRefuelMessage } from '../../components/
|
|
6
|
+
import { GasRefuelMessage } from '../../components/Messages/GasRefuelMessage.js'
|
|
7
|
+
import { MainMessages } from '../../components/Messages/MainMessages.js'
|
|
7
8
|
import { PageContainer } from '../../components/PageContainer.js'
|
|
8
9
|
import { PoweredBy } from '../../components/PoweredBy/PoweredBy.js'
|
|
9
10
|
import { Routes } from '../../components/Routes/Routes.js'
|
|
@@ -14,7 +15,6 @@ import { useHeader } from '../../hooks/useHeader.js'
|
|
|
14
15
|
import { useWideVariant } from '../../hooks/useWideVariant.js'
|
|
15
16
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
16
17
|
import { HiddenUI } from '../../types/widget.js'
|
|
17
|
-
import { MainMessages } from './MainMessages.js'
|
|
18
18
|
import { ReviewButton } from './ReviewButton.js'
|
|
19
19
|
|
|
20
20
|
export const MainPage: React.FC = () => {
|
|
@@ -17,7 +17,8 @@ export const ReviewButton: React.FC = () => {
|
|
|
17
17
|
const { subvariant, subvariantOptions } = useWidgetConfig()
|
|
18
18
|
const splitState = useSplitSubvariantStore((state) => state.state)
|
|
19
19
|
const [toAddress] = useFieldValues('toAddress')
|
|
20
|
-
const { requiredToAddress } =
|
|
20
|
+
const { requiredToAddress, accountNotDeployedAtDestination } =
|
|
21
|
+
useToAddressRequirements()
|
|
21
22
|
const { routes, setReviewableRoute } = useRoutes()
|
|
22
23
|
|
|
23
24
|
const currentRoute = routes?.[0]
|
|
@@ -72,7 +73,10 @@ export const ReviewButton: React.FC = () => {
|
|
|
72
73
|
<BaseTransactionButton
|
|
73
74
|
text={getButtonText()}
|
|
74
75
|
onClick={handleClick}
|
|
75
|
-
disabled={
|
|
76
|
+
disabled={
|
|
77
|
+
(currentRoute && requiredToAddress && !toAddress) ||
|
|
78
|
+
accountNotDeployedAtDestination
|
|
79
|
+
}
|
|
76
80
|
/>
|
|
77
81
|
)
|
|
78
82
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Error as ErrorIcon,
|
|
3
|
+
TurnedIn,
|
|
4
|
+
WarningRounded,
|
|
5
|
+
} from '@mui/icons-material'
|
|
2
6
|
import { Button, Typography } from '@mui/material'
|
|
3
7
|
import type { ChangeEvent, MutableRefObject } from 'react'
|
|
4
8
|
import { forwardRef, useState } from 'react'
|
|
5
9
|
import { useTranslation } from 'react-i18next'
|
|
6
|
-
import { AlertMessage } from '../../components/AlertMessage/AlertMessage.js'
|
|
7
10
|
import { BottomSheet } from '../../components/BottomSheet/BottomSheet.js'
|
|
8
11
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
9
12
|
import { Input } from '../../components/Input.js'
|
|
13
|
+
import { AlertMessage } from '../../components/Messages/AlertMessage.js'
|
|
10
14
|
import { useAddressValidation } from '../../hooks/useAddressValidation.js'
|
|
11
15
|
import type { Bookmark } from '../../stores/bookmarks/types.js'
|
|
12
16
|
import { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'
|
|
@@ -206,11 +210,11 @@ export const BookmarkAddressSheet = forwardRef<
|
|
|
206
210
|
</BookmarkInputFields>
|
|
207
211
|
<AlertMessage
|
|
208
212
|
title={
|
|
209
|
-
<Typography variant="body2">
|
|
210
|
-
{t('
|
|
213
|
+
<Typography variant="body2" sx={{ color: 'text.primary' }}>
|
|
214
|
+
{t('warning.message.fundsLossPrevention')}
|
|
211
215
|
</Typography>
|
|
212
216
|
}
|
|
213
|
-
icon={<
|
|
217
|
+
icon={<WarningRounded />}
|
|
214
218
|
/>
|
|
215
219
|
<SendToWalletButtonRow>
|
|
216
220
|
<Button variant="text" onClick={handleCancel} fullWidth>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Wallet, WarningRounded } from '@mui/icons-material'
|
|
2
|
+
import { Button, Typography } from '@mui/material'
|
|
3
3
|
import type { MutableRefObject } from 'react'
|
|
4
4
|
import { forwardRef, useRef } from 'react'
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
|
-
import { AlertMessage } from '../../components/AlertMessage/AlertMessage.js'
|
|
7
6
|
import { BottomSheet } from '../../components/BottomSheet/BottomSheet.js'
|
|
8
7
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
9
|
-
import {
|
|
8
|
+
import { AlertMessage } from '../../components/Messages/AlertMessage.js'
|
|
10
9
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js'
|
|
11
10
|
import { useSetContentHeight } from '../../hooks/useSetContentHeight.js'
|
|
12
11
|
import type { Bookmark } from '../../stores/bookmarks/types.js'
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
interface ConfirmAddressSheetProps {
|
|
24
23
|
onConfirm: (wallet: Bookmark) => void
|
|
25
24
|
validatedBookmark?: Bookmark
|
|
26
|
-
chainId?: number
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
interface ConfirmAddressSheetContentProps extends ConfirmAddressSheetProps {
|
|
@@ -48,21 +46,15 @@ export const ConfirmAddressSheet = forwardRef<
|
|
|
48
46
|
const ConfirmAddressSheetContent: React.FC<ConfirmAddressSheetContentProps> = ({
|
|
49
47
|
validatedBookmark,
|
|
50
48
|
onConfirm,
|
|
51
|
-
chainId,
|
|
52
49
|
onClose,
|
|
53
50
|
}) => {
|
|
54
51
|
const { t } = useTranslation()
|
|
55
52
|
const { navigateBack } = useNavigateBack()
|
|
56
53
|
const { setFieldValue } = useFieldActions()
|
|
57
54
|
const { setSendToWallet } = useSendToWalletActions()
|
|
58
|
-
const isContractAddress = useIsContractAddress(
|
|
59
|
-
validatedBookmark?.address,
|
|
60
|
-
chainId,
|
|
61
|
-
validatedBookmark?.chainType
|
|
62
|
-
)
|
|
63
55
|
|
|
64
56
|
const containerRef = useRef<HTMLElement>(null)
|
|
65
|
-
useSetContentHeight(containerRef
|
|
57
|
+
useSetContentHeight(containerRef)
|
|
66
58
|
|
|
67
59
|
const handleConfirm = () => {
|
|
68
60
|
if (validatedBookmark) {
|
|
@@ -97,28 +89,15 @@ const ConfirmAddressSheetContent: React.FC<ConfirmAddressSheetContentProps> = ({
|
|
|
97
89
|
<Typography>{validatedBookmark?.address}</Typography>
|
|
98
90
|
</SheetAddressContainer>
|
|
99
91
|
<AlertMessage
|
|
92
|
+
severity="warning"
|
|
100
93
|
title={
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</Typography>
|
|
105
|
-
</Box>
|
|
94
|
+
<Typography variant="body2" sx={{ color: 'text.primary' }}>
|
|
95
|
+
{t('warning.message.fundsLossPrevention')}
|
|
96
|
+
</Typography>
|
|
106
97
|
}
|
|
107
|
-
icon={<
|
|
98
|
+
icon={<WarningRounded />}
|
|
108
99
|
multiline
|
|
109
100
|
/>
|
|
110
|
-
{isContractAddress ? (
|
|
111
|
-
<AlertMessage
|
|
112
|
-
title={
|
|
113
|
-
<Typography variant="body2" fontWeight={500}>
|
|
114
|
-
{t('info.message.smartContractAccount')}
|
|
115
|
-
</Typography>
|
|
116
|
-
}
|
|
117
|
-
icon={<Warning />}
|
|
118
|
-
severity="warning"
|
|
119
|
-
multiline
|
|
120
|
-
/>
|
|
121
|
-
) : null}
|
|
122
101
|
<SendToWalletButtonRow>
|
|
123
102
|
<Button variant="text" onClick={onClose} fullWidth>
|
|
124
103
|
{t('button.cancel')}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainType } from '@lifi/sdk'
|
|
2
1
|
import { useAccount } from '@lifi/wallet-management'
|
|
3
2
|
import {
|
|
4
3
|
Error as ErrorIcon,
|
|
@@ -68,9 +67,6 @@ export const SendToWalletPage = () => {
|
|
|
68
67
|
|
|
69
68
|
const { accounts } = useAccount()
|
|
70
69
|
const connectedWallets = accounts.filter((account) => account.isConnected)
|
|
71
|
-
const connectedEVMChainId = connectedWallets.find(
|
|
72
|
-
(account) => account.chainType === ChainType.EVM
|
|
73
|
-
)?.chainId
|
|
74
70
|
|
|
75
71
|
useHeader(t('header.sendToWallet'))
|
|
76
72
|
|
|
@@ -246,7 +242,6 @@ export const SendToWalletPage = () => {
|
|
|
246
242
|
ref={confirmAddressSheetRef}
|
|
247
243
|
validatedBookmark={validatedWallet}
|
|
248
244
|
onConfirm={handleOnConfirm}
|
|
249
|
-
chainId={connectedEVMChainId || toChainId}
|
|
250
245
|
/>
|
|
251
246
|
<BookmarkAddressSheet
|
|
252
247
|
ref={bookmarkAddressSheetRef}
|
|
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
|
|
|
6
6
|
import { useLocation } from 'react-router-dom'
|
|
7
7
|
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
8
8
|
import { ContractComponent } from '../../components/ContractComponent/ContractComponent.js'
|
|
9
|
-
import { GasMessage } from '../../components/
|
|
9
|
+
import { GasMessage } from '../../components/Messages/GasMessage.js'
|
|
10
10
|
import { PageContainer } from '../../components/PageContainer.js'
|
|
11
11
|
import { getStepList } from '../../components/Step/StepList.js'
|
|
12
12
|
import { TransactionDetails } from '../../components/TransactionDetails.js'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-7702 introduces delegation designators that allow EOAs to delegate execution to other contracts.
|
|
3
|
+
* A delegation designator starts with 0xef0100 followed by the target contract address.
|
|
4
|
+
*
|
|
5
|
+
* When an EOA has this code, it means:
|
|
6
|
+
* - The EOA can still send transactions (unlike other contract accounts)
|
|
7
|
+
* - All contract calls are delegated to the target address
|
|
8
|
+
* - The code itself remains as the delegation designator (0xef0100 || address)
|
|
9
|
+
*
|
|
10
|
+
* Delegation Designator Structure:
|
|
11
|
+
*
|
|
12
|
+
* ─────┬───┬──┬───────────────────────────────────────┐
|
|
13
|
+
* │ │ │ │
|
|
14
|
+
* 0x ef 0100 a94f5374fce5edbc8e2a8697c15331677e6ebf0b
|
|
15
|
+
* │ │ └───────────────────────────────────────┘
|
|
16
|
+
* │ │ Target Address
|
|
17
|
+
* │ └── 7702
|
|
18
|
+
* └── 3541
|
|
19
|
+
*
|
|
20
|
+
* @see https://eips.ethereum.org/EIPS/eip-7702
|
|
21
|
+
*/
|
|
22
|
+
export const isDelegationDesignatorCode = (code?: string) =>
|
|
23
|
+
code?.startsWith('0xef0100')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlertMessage.js","sourceRoot":"","sources":["../../../../src/components/AlertMessage/AlertMessage.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,yBAAyB,CAAA;AAUhC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAQ,GAAG,MAAM,EACjB,GAAG,IAAI,EACW,EAAE,EAAE,CAAC,CACvB,MAAC,gBAAgB,IAAC,QAAQ,EAAE,QAAQ,KAAM,IAAI,aAC5C,MAAC,qBAAqB,IACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,aAEzC,IAAI,EACJ,KAAK,IACgB,EACvB,QAAQ,IACQ,CACpB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlertMessage.style.js","sourceRoot":"","sources":["../../../../src/components/AlertMessage/AlertMessage.style.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAA;AAO9B,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,EAAE;IAC1C,iBAAiB,EAAE,CA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,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;oBAC1C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;aAC3C;SACF;KACF;IACD,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE;QAC5B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;KAC/B,CAAC;CACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/AlertMessage/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FundsSufficiencyMessage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FundsSufficiencyMessage.js","sourceRoot":"","sources":["../../../../src/components/GasMessage/FundsSufficiencyMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,OAAO,CACL,KAAC,YAAY,IACX,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAE,KAAC,cAAc,KAAG,EACxB,KAAK,EACH,KAAC,UAAU,IACT,OAAO,EAAC,OAAO,EACf,EAAE,EAAE;gBACF,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,cAAc;aACtB,YAEA,CAAC,CAAC,mCAAmC,CAAC,GAC5B,EAEf,SAAS,SACT,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GasMessage.js","sourceRoot":"","sources":["../../../../src/components/GasMessage/GasMessage.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAMlE,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC3E,MAAM,EAAE,eAAe,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACpD,MAAM,EAAE,qBAAqB,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;IAEhE,MAAM,oBAAoB,GAAG,eAAe,EAAE,MAAM,CAAA;IAEpD,OAAO,CACL,KAAC,QAAQ,IACP,OAAO,EAAE,GAAG,EACZ,EAAE,EAAE,OAAO,CAAC,qBAAqB,IAAI,oBAAoB,CAAC,EAC1D,aAAa,QACb,YAAY,kBAEZ,KAAC,GAAG,OAAK,KAAK,YACX,qBAAqB,CAAC,CAAC,CAAC,CACvB,KAAC,uBAAuB,KAAG,CAC5B,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CACzB,KAAC,qBAAqB,IAAC,eAAe,EAAE,eAAe,GAAI,CAC5D,CAAC,CAAC,CAAC,IAAI,GACJ,GACG,CACZ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GasMessage.style.js","sourceRoot":"","sources":["../../../../src/components/GasMessage/GasMessage.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EA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AAE,SAAS,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,GAClD,EACb,KAAC,iBAAiB,IAChB,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,QAAQ,GAClB,IACE,KAEJ,KAAK,YAET,KAAC,QAAQ,IACP,OAAO,EAAE,GAAG,EACZ,EAAE,EAAE,iBAAiB,EACrB,aAAa,QACb,YAAY,kBAEZ,KAAC,UAAU,IACT,OAAO,EAAC,OAAO,EACf,EAAE,EAAE;wBACF,EAAE,EAAE,CAAC;wBACL,EAAE,EAAE,CAAC;qBACN,YAEA,CAAC,CAAC,yBAAyB,EAAE;wBAC5B,SAAS,EAAE,KAAK,EAAE,IAAI;qBACvB,CAAC,GACS,GACJ,GACE,GACN,CACZ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GasSufficiencyMessage.js","sourceRoot":"","sources":["../../../../src/components/GasMessage/GasSufficiencyMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAM9D,MAAM,CAAC,MAAM,qBAAqB,GAAyC,CAAC,EAC1E,eAAe,GAChB,EAAE,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,OAAO,CACL,MAAC,YAAY,IACX,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAE,KAAC,SAAS,KAAG,EACnB,KAAK,EACH,KAAC,UAAU,IACT,OAAO,EAAC,OAAO,EACf,EAAE,EAAE;gBACF,UAAU,EAAE,GAAG;aAChB,YAEA,CAAC,CAAC,+BAA+B,CAAC,GACxB,aAGf,KAAC,UAAU,IACT,OAAO,EAAC,OAAO,EACf,EAAE,EAAE;oBACF,EAAE,EAAE,CAAC;oBACL,EAAE,EAAE,CAAC;iBACN,YAEA,CAAC,CAAC,iCAAiC,CAAC,GAC1B,EACZ,eAAe,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACrC,KAAC,UAAU,IAET,OAAO,EAAC,OAAO,EACf,EAAE,EAAE;oBACF,EAAE,EAAE,CAAC;oBACL,EAAE,EAAE,GAAG;iBACR,YAEA,CAAC,CAAC,yBAAyB,EAAE;oBAC5B,MAAM,EAAE,WAAW,CACjB,IAAI,CAAC,kBAAkB,IAAI,EAAE,EAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,CACpB;oBACD,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;oBAC9B,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI;iBAC5B,CAAC,IAdG,KAAK,CAeC,CACd,CAAC,IACW,CAChB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Route } from '@lifi/sdk';
|
|
2
|
-
import type { BoxProps } from '@mui/material';
|
|
3
|
-
interface ToAddressRequiredMessageProps extends BoxProps {
|
|
4
|
-
route?: Route;
|
|
5
|
-
}
|
|
6
|
-
export declare const ToAddressRequiredMessage: React.FC<ToAddressRequiredMessageProps>;
|
|
7
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Wallet } from '@mui/icons-material';
|
|
3
|
-
import { Box, Collapse, Typography } from '@mui/material';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useToAddressRequirements } from '../hooks/useToAddressRequirements.js';
|
|
6
|
-
import { useFieldValues } from '../stores/form/useFieldValues.js';
|
|
7
|
-
import { AlertMessage } from './AlertMessage/AlertMessage.js';
|
|
8
|
-
export const ToAddressRequiredMessage = ({ route, ...props }) => {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
const [toAddress] = useFieldValues('toAddress');
|
|
11
|
-
const { requiredToAddress } = useToAddressRequirements();
|
|
12
|
-
const showMessage = route && requiredToAddress && !toAddress;
|
|
13
|
-
return (_jsx(Collapse, { timeout: 225, in: showMessage, unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: _jsx(AlertMessage, { title: _jsx(Typography, { variant: "body2", sx: {
|
|
14
|
-
px: 1,
|
|
15
|
-
color: 'text.primary',
|
|
16
|
-
}, children: t('info.message.toAddressIsRequired') }), icon: _jsx(Wallet, {}), multiline: true }) }) }));
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=ToAddressRequiredMessage.js.map
|