@lifi/widget 3.15.1 → 3.16.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/CHANGELOG.md +14 -0
- package/dist/esm/components/Messages/useMessageQueue.js +4 -3
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/useAddressActivity.d.ts +8 -0
- package/dist/esm/hooks/useAddressActivity.js +23 -0
- package/dist/esm/hooks/useAddressActivity.js.map +1 -0
- package/dist/esm/hooks/useToAddressRequirements.d.ts +1 -0
- package/dist/esm/hooks/useToAddressRequirements.js +1 -0
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/i18n/en.json +4 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +11 -12
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts +8 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js +35 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionPage.js +13 -2
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/types/events.d.ts +6 -1
- package/dist/esm/types/events.js +1 -0
- package/dist/esm/types/events.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Messages/useMessageQueue.ts +4 -3
- package/src/config/version.ts +1 -1
- package/src/hooks/useAddressActivity.ts +39 -0
- package/src/hooks/useToAddressRequirements.ts +1 -0
- package/src/i18n/en.json +4 -1
- package/src/pages/MainPage/ReviewButton.tsx +12 -12
- package/src/pages/TransactionPage/ConfirmToAddressSheet.tsx +93 -0
- package/src/pages/TransactionPage/TransactionPage.tsx +27 -1
- package/src/types/events.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.16.0](https://github.com/lifinance/widget/compare/v3.15.2...v3.16.0) (2025-02-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add low activity wallet warning ([fb69217](https://github.com/lifinance/widget/commit/fb692176b87666dd37e18a72b11ad7b43901a6bf))
|
|
11
|
+
|
|
12
|
+
### [3.15.2](https://github.com/lifinance/widget/compare/v3.15.1...v3.15.2) (2025-01-31)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* hide required wallet info message when wallet is present ([#345](https://github.com/lifinance/widget/issues/345)) ([88b5e18](https://github.com/lifinance/widget/commit/88b5e189961afaed8e6902f114758886512fd980))
|
|
18
|
+
|
|
5
19
|
### [3.15.1](https://github.com/lifinance/widget/compare/v3.15.0...v3.15.1) (2025-01-31)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -3,7 +3,7 @@ import { useFromTokenSufficiency } from '../../hooks/useFromTokenSufficiency.js'
|
|
|
3
3
|
import { useGasSufficiency } from '../../hooks/useGasSufficiency.js';
|
|
4
4
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
5
5
|
export const useMessageQueue = (route) => {
|
|
6
|
-
const { requiredToAddress, accountNotDeployedAtDestination } = useToAddressRequirements();
|
|
6
|
+
const { requiredToAddress, accountNotDeployedAtDestination, toAddress } = useToAddressRequirements();
|
|
7
7
|
const { insufficientFromToken } = useFromTokenSufficiency(route);
|
|
8
8
|
const { insufficientGas } = useGasSufficiency(route);
|
|
9
9
|
const messageQueue = useMemo(() => {
|
|
@@ -27,7 +27,7 @@ export const useMessageQueue = (route) => {
|
|
|
27
27
|
priority: 3,
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
if (requiredToAddress) {
|
|
30
|
+
if (requiredToAddress && !toAddress) {
|
|
31
31
|
queue.push({
|
|
32
32
|
id: 'TO_ADDRESS_REQUIRED',
|
|
33
33
|
priority: 4,
|
|
@@ -35,10 +35,11 @@ export const useMessageQueue = (route) => {
|
|
|
35
35
|
}
|
|
36
36
|
return queue.sort((a, b) => a.priority - b.priority);
|
|
37
37
|
}, [
|
|
38
|
+
accountNotDeployedAtDestination,
|
|
38
39
|
insufficientFromToken,
|
|
39
40
|
insufficientGas,
|
|
40
|
-
accountNotDeployedAtDestination,
|
|
41
41
|
requiredToAddress,
|
|
42
|
+
toAddress,
|
|
42
43
|
]);
|
|
43
44
|
return {
|
|
44
45
|
currentMessage: messageQueue[0],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageQueue.js","sourceRoot":"","sources":["../../../../src/components/Messages/useMessageQueue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAQlF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/C,MAAM,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,
|
|
1
|
+
{"version":3,"file":"useMessageQueue.js","sourceRoot":"","sources":["../../../../src/components/Messages/useMessageQueue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAQlF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/C,MAAM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CAAC;QAC/B,WAAW,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;KACrC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "3.
|
|
2
|
+
export declare const version = "3.16.0";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isAddress } from 'viem';
|
|
2
|
+
import { useTransactionCount } from 'wagmi';
|
|
3
|
+
import { useFieldValues } from '../stores/form/useFieldValues.js';
|
|
4
|
+
export const useAddressActivity = (chainId) => {
|
|
5
|
+
const [toAddress, toChainId] = useFieldValues('toAddress', 'toChain');
|
|
6
|
+
const destinationChainId = chainId ?? toChainId;
|
|
7
|
+
const { data: transactionCount, isLoading, isFetched, error, } = useTransactionCount({
|
|
8
|
+
address: toAddress,
|
|
9
|
+
chainId: destinationChainId,
|
|
10
|
+
query: {
|
|
11
|
+
enabled: Boolean(toAddress && destinationChainId && isAddress(toAddress)),
|
|
12
|
+
refetchInterval: 300000,
|
|
13
|
+
staleTime: 300000,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
toAddress,
|
|
18
|
+
hasActivity: Boolean(transactionCount && transactionCount > 0),
|
|
19
|
+
isLoading,
|
|
20
|
+
isFetched: isFetched && !error,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useAddressActivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAddressActivity.js","sourceRoot":"","sources":["../../../src/hooks/useAddressActivity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AASjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAmB,EAAE;IACtE,M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IAAI,OAAO,IAAI,SAAS,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS,CAAA;IAEnE,MAAM,2BAA2B,GAC/B,qBAAqB,IAAI,WAAW,KAAK,SAAS,CAAA;IAEpD,MAAM,+BAA+B,GACnC,qBAAqB;QACrB,iFAAiF;QACjF,8DAA8D;QAC9D,CAAC,0BAA0B,CAAC,gBAAgB,CAAC;QAC7C,CAAC,mBAAmB;QACpB,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,CAAA;IAE7D,MAAM,iBAAiB,GACrB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAC1C,oBAAoB;QACpB,2BAA2B,CAAA;IAE7B,OAAO;QACL,iBAAiB;QACjB,mBAAmB,EAAE,OAAO,EAAE,SAAS;QACvC,+BAA+B;QAC/B,SAAS;KACV,CAAA;AACH,CAAC,CAAA"}
|
package/dist/esm/i18n/en.json
CHANGED
|
@@ -118,6 +118,8 @@
|
|
|
118
118
|
"warning": {
|
|
119
119
|
"message": {
|
|
120
120
|
"accountNotDeployedMessage": "Smart contract account is not deployed on the destination chain. Sending funds to a non-existent contract would result in permanent loss.",
|
|
121
|
+
"noAddressActivity": "This address has never been used on this network. Please verify you're sending to the correct address to prevent potential loss of funds.",
|
|
122
|
+
"lowAddressActivity": "This address has low activity on {{chainName}} network. Please verify you're sending to the correct address and network to prevent potential loss of funds.",
|
|
121
123
|
"deleteActiveTransactions": "Active transactions are only stored locally and can't be recovered if you delete them.",
|
|
122
124
|
"deleteTransactionHistory": "Transaction history is only stored locally and can't be recovered if you delete it.",
|
|
123
125
|
"fundsLossPrevention": "Always ensure smart contract accounts are properly set up on the destination chain and avoid direct transfers to exchanges to prevent fund loss.",
|
|
@@ -135,7 +137,8 @@
|
|
|
135
137
|
"highValueLoss": "High value loss",
|
|
136
138
|
"insufficientGas": "Insufficient gas",
|
|
137
139
|
"rateChanged": "Rate changed",
|
|
138
|
-
"resetSettings": "Reset settings?"
|
|
140
|
+
"resetSettings": "Reset settings?",
|
|
141
|
+
"lowAddressActivity": "Low Activity Address"
|
|
139
142
|
}
|
|
140
143
|
},
|
|
141
144
|
"error": {
|
|
@@ -6,7 +6,6 @@ import { useRoutes } from '../../hooks/useRoutes.js';
|
|
|
6
6
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
|
|
7
7
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
8
8
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
|
|
9
|
-
import { useFieldValues } from '../../stores/form/useFieldValues.js';
|
|
10
9
|
import { useSplitSubvariantStore } from '../../stores/settings/useSplitSubvariantStore.js';
|
|
11
10
|
import { WidgetEvent } from '../../types/events.js';
|
|
12
11
|
import { navigationRoutes } from '../../utils/navigationRoutes.js';
|
|
@@ -16,21 +15,21 @@ export const ReviewButton = () => {
|
|
|
16
15
|
const emitter = useWidgetEvents();
|
|
17
16
|
const { subvariant, subvariantOptions } = useWidgetConfig();
|
|
18
17
|
const splitState = useSplitSubvariantStore((state) => state.state);
|
|
19
|
-
const
|
|
20
|
-
const { requiredToAddress, accountNotDeployedAtDestination } = useToAddressRequirements();
|
|
18
|
+
const { toAddress, requiredToAddress, accountNotDeployedAtDestination } = useToAddressRequirements();
|
|
21
19
|
const { routes, setReviewableRoute } = useRoutes();
|
|
22
20
|
const currentRoute = routes?.[0];
|
|
23
21
|
const handleClick = async () => {
|
|
24
|
-
if (currentRoute) {
|
|
25
|
-
|
|
26
|
-
navigate(navigationRoutes.transactionExecution, {
|
|
27
|
-
state: { routeId: currentRoute.id },
|
|
28
|
-
});
|
|
29
|
-
emitter.emit(WidgetEvent.RouteSelected, {
|
|
30
|
-
route: currentRoute,
|
|
31
|
-
routes: routes,
|
|
32
|
-
});
|
|
22
|
+
if (!currentRoute) {
|
|
23
|
+
return;
|
|
33
24
|
}
|
|
25
|
+
setReviewableRoute(currentRoute);
|
|
26
|
+
navigate(navigationRoutes.transactionExecution, {
|
|
27
|
+
state: { routeId: currentRoute.id },
|
|
28
|
+
});
|
|
29
|
+
emitter.emit(WidgetEvent.RouteSelected, {
|
|
30
|
+
route: currentRoute,
|
|
31
|
+
routes: routes,
|
|
32
|
+
});
|
|
34
33
|
};
|
|
35
34
|
const getButtonText = () => {
|
|
36
35
|
if (currentRoute) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewButton.js","sourceRoot":"","sources":["../../../../src/pages/MainPage/ReviewButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAA;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAA;AAClF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ReviewButton.js","sourceRoot":"","sources":["../../../../src/pages/MainPage/ReviewButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAA;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAA;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAA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iBAAiB,EAAE,MAAM,IAAI,UAAU,QAAQ,CAAC,CAAA;gBACrE,KAAK,QAAQ;oBACX,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;gBAC3B,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,eAAe,GACnB,YAAY,CAAC,WAAW,KAAK,YAAY,CAAC,SAAS;wBACjD,CAAC,CAAC,MAAM;wBACR,CAAC,CAAC,QAAQ,CAAA;oBACd,OAAO,CAAC,CAAC,UAAU,eAAe,QAAQ,CAAC,CAAA;gBAC7C,CAAC;YACH,CAAC;QACH,CAAC;QACD,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,iBAAiB,EAAE,MAAM,KAAK,SAAS;oBAC5C,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;oBACrB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;YACrB,KAAK,QAAQ;gBACX,OAAO,CAAC,CAAC,eAAe,CAAC,CAAA;YAC3B,KAAK,OAAO;gBACV,IAAI,UAAU,EAAE,CAAC;oBACf,OAAO,CAAC,CAAC,UAAU,UAAU,EAAE,CAAC,CAAA;gBAClC,CAAC;gBACD,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAA;YAC7B;gBACE,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC,CAAA;IAED,OAAO,CACL,KAAC,qBAAqB,IACpB,IAAI,EAAE,aAAa,EAAE,EACrB,OAAO,EAAE,WAAW,EACpB,QAAQ,EACN,CAAC,YAAY,IAAI,iBAAiB,IAAI,CAAC,SAAS,CAAC;YACjD,+BAA+B,GAEjC,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BottomSheetBase } from '../../components/BottomSheet/types.js';
|
|
2
|
+
interface ConfirmToAddressSheetProps {
|
|
3
|
+
onContinue: () => void;
|
|
4
|
+
toAddress: string;
|
|
5
|
+
toChainId: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const ConfirmToAddressSheet: import("react").ForwardRefExoticComponent<ConfirmToAddressSheetProps & import("react").RefAttributes<BottomSheetBase>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Wallet, WarningRounded } from '@mui/icons-material';
|
|
3
|
+
import { Button, Typography } from '@mui/material';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { BottomSheet } from '../../components/BottomSheet/BottomSheet.js';
|
|
7
|
+
import { AlertMessage } from '../../components/Messages/AlertMessage.js';
|
|
8
|
+
import { useChain } from '../../hooks/useChain.js';
|
|
9
|
+
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
|
|
10
|
+
import { WidgetEvent } from '../../types/events.js';
|
|
11
|
+
import { IconContainer, SendToWalletButtonRow, SendToWalletSheetContainer, SheetAddressContainer, } from '../SendToWallet/SendToWalletPage.style.js';
|
|
12
|
+
export const ConfirmToAddressSheet = forwardRef((props, ref) => {
|
|
13
|
+
const handleClose = () => {
|
|
14
|
+
;
|
|
15
|
+
ref.current?.close();
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(BottomSheet, { ref: ref, children: _jsx(ConfirmToAddressSheetContent, { ...props, onClose: handleClose }) }));
|
|
18
|
+
});
|
|
19
|
+
const ConfirmToAddressSheetContent = ({ onContinue, onClose, toAddress, toChainId }) => {
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const { chain } = useChain(toChainId);
|
|
22
|
+
const emitter = useWidgetEvents();
|
|
23
|
+
const handleContinue = () => {
|
|
24
|
+
emitter.emit(WidgetEvent.LowAddressActivityConfirmed, {
|
|
25
|
+
address: toAddress,
|
|
26
|
+
chainId: toChainId,
|
|
27
|
+
});
|
|
28
|
+
onClose();
|
|
29
|
+
onContinue();
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs(SendToWalletSheetContainer, { children: [_jsx(IconContainer, { children: _jsx(Wallet, { sx: { fontSize: 40 } }) }), _jsx(Typography, { variant: "h6", sx: { textAlign: 'center', mb: 2 }, children: t('warning.title.lowAddressActivity') }), _jsx(SheetAddressContainer, { children: _jsx(Typography, { children: toAddress }) }), _jsx(AlertMessage, { severity: "warning", title: _jsx(Typography, { variant: "body2", sx: { color: 'text.primary' }, children: t('warning.message.lowAddressActivity', {
|
|
32
|
+
chainName: chain?.name,
|
|
33
|
+
}) }), icon: _jsx(WarningRounded, {}), multiline: true }), _jsxs(SendToWalletButtonRow, { children: [_jsx(Button, { variant: "text", onClick: onClose, fullWidth: true, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: handleContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ConfirmToAddressSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmToAddressSheet.js","sourceRoot":"","sources":["../../../../src/pages/TransactionPage/ConfirmToAddressSheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,0BAA0B,EAC1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,KAAC,YAAY,IACX,QAAQ,EAAC,SAAS,EAClB,KAAK,EACH,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,YACtD,CAAC,CAAC,oCAAoC,EAAE;wBACvC,SAAS,EAAE,KAAK,EAAE,IAAI;qBACvB,CAAC,GACS,EAEf,IAAI,EAAE,KAAC,cAAc,KAAG,EACxB,SAAS,SACT,EACF,MAAC,qBAAqB,eACpB,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,SAAS,kBAC/C,CAAC,CAAC,eAAe,CAAC,GACZ,EACT,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,cAAc,EAAE,SAAS,kBAC3D,CAAC,CAAC,iBAAiB,CAAC,GACd,IACa,IACG,CAC9B,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -9,6 +9,7 @@ import { GasMessage } from '../../components/Messages/GasMessage.js';
|
|
|
9
9
|
import { PageContainer } from '../../components/PageContainer.js';
|
|
10
10
|
import { getStepList } from '../../components/Step/StepList.js';
|
|
11
11
|
import { TransactionDetails } from '../../components/TransactionDetails.js';
|
|
12
|
+
import { useAddressActivity } from '../../hooks/useAddressActivity.js';
|
|
12
13
|
import { useHeader } from '../../hooks/useHeader.js';
|
|
13
14
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js';
|
|
14
15
|
import { useRouteExecution } from '../../hooks/useRouteExecution.js';
|
|
@@ -18,6 +19,7 @@ import { useFieldActions } from '../../stores/form/useFieldActions.js';
|
|
|
18
19
|
import { RouteExecutionStatus } from '../../stores/routes/types.js';
|
|
19
20
|
import { WidgetEvent } from '../../types/events.js';
|
|
20
21
|
import { getAccumulatedFeeCostsBreakdown } from '../../utils/fees.js';
|
|
22
|
+
import { ConfirmToAddressSheet } from './ConfirmToAddressSheet.js';
|
|
21
23
|
import { ExchangeRateBottomSheet } from './ExchangeRateBottomSheet.js';
|
|
22
24
|
import { RouteTracker } from './RouteTracker.js';
|
|
23
25
|
import { StartTransactionButton } from './StartTransactionButton.js';
|
|
@@ -36,6 +38,7 @@ export const TransactionPage = () => {
|
|
|
36
38
|
const [routeRefreshing, setRouteRefreshing] = useState(false);
|
|
37
39
|
const tokenValueBottomSheetRef = useRef(null);
|
|
38
40
|
const exchangeRateBottomSheetRef = useRef(null);
|
|
41
|
+
const confirmToAddressSheetRef = useRef(null);
|
|
39
42
|
const onAcceptExchangeRateUpdate = (resolver, data) => {
|
|
40
43
|
exchangeRateBottomSheetRef.current?.open(resolver, data);
|
|
41
44
|
};
|
|
@@ -43,6 +46,7 @@ export const TransactionPage = () => {
|
|
|
43
46
|
routeId: routeId,
|
|
44
47
|
onAcceptExchangeRateUpdate,
|
|
45
48
|
});
|
|
49
|
+
const { toAddress, hasActivity, isLoading: isLoadingAddressActivity, isFetched: isActivityAddressFetched, } = useAddressActivity(route?.toChainId);
|
|
46
50
|
const getHeaderTitle = () => {
|
|
47
51
|
if (subvariant === 'custom') {
|
|
48
52
|
return t(`header.${subvariantOptions?.custom ?? 'checkout'}`);
|
|
@@ -89,6 +93,13 @@ export const TransactionPage = () => {
|
|
|
89
93
|
};
|
|
90
94
|
const handleStartClick = async () => {
|
|
91
95
|
if (status === RouteExecutionStatus.Idle) {
|
|
96
|
+
if (toAddress &&
|
|
97
|
+
!hasActivity &&
|
|
98
|
+
!isLoadingAddressActivity &&
|
|
99
|
+
isActivityAddressFetched) {
|
|
100
|
+
confirmToAddressSheetRef.current?.open();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
92
103
|
const { gasCostUSD, feeCostUSD } = getAccumulatedFeeCostsBreakdown(route);
|
|
93
104
|
const fromAmountUSD = Number.parseFloat(route.fromAmountUSD);
|
|
94
105
|
const toAmountUSD = Number.parseFloat(route.toAmountUSD);
|
|
@@ -133,9 +144,9 @@ export const TransactionPage = () => {
|
|
|
133
144
|
status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasMessage, { mt: 2, route: route }), _jsxs(Box, { sx: {
|
|
134
145
|
mt: 2,
|
|
135
146
|
display: 'flex',
|
|
136
|
-
}, children: [_jsx(StartTransactionButton, { text: getButtonText(), onClick: handleStartClick, route: route, loading: routeRefreshing }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeTransaction'), placement: "bottom-end", children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
|
|
147
|
+
}, children: [_jsx(StartTransactionButton, { text: getButtonText(), onClick: handleStartClick, route: route, loading: routeRefreshing || isLoadingAddressActivity }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeTransaction'), placement: "bottom-end", children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
|
|
137
148
|
minWidth: 48,
|
|
138
149
|
marginLeft: 1,
|
|
139
|
-
}, children: _jsx(Delete, {}) }) })) : null] })] })) : null, status ? _jsx(StatusBottomSheet, { status: status, route: route }) : null, subvariant !== 'custom' ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, _jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })] }));
|
|
150
|
+
}, children: _jsx(Delete, {}) }) })) : null] })] })) : null, status ? _jsx(StatusBottomSheet, { status: status, route: route }) : null, subvariant !== 'custom' ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, _jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef }), _jsx(ConfirmToAddressSheet, { ref: confirmToAddressSheetRef, onContinue: handleExecuteRoute, toAddress: toAddress, toChainId: route.toChainId })] }));
|
|
140
151
|
};
|
|
141
152
|
//# sourceMappingURL=TransactionPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionPage.js","sourceRoot":"","sources":["../../../../src/pages/TransactionPage/TransactionPage.tsx"],"names":[],"mappings":";A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YAED,KAAC,MAAM,KAAG,GACH,GACD,CACX,CAAC,CAAC,CAAC,IAAI,IACJ,IACL,CACJ,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,CAAC,CAAC,CAAC,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,EACnE,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CACzB,KAAC,qBAAqB,IACpB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,wBAAwB,EAC7B,UAAU,EAAE,kBAAkB,GAC9B,CACH,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,uBAAuB,IAAC,GAAG,EAAE,0BAA0B,GAAI,EAC5D,KAAC,qBAAqB,IACpB,GAAG,EAAE,wBAAwB,EAC7B,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,SAAU,EACrB,SAAS,EAAE,KAAK,CAAC,SAAU,GAC3B,IACY,CACjB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -27,7 +27,8 @@ export declare enum WidgetEvent {
|
|
|
27
27
|
PageEntered = "pageEntered",
|
|
28
28
|
FormFieldChanged = "formFieldChanged",
|
|
29
29
|
SettingUpdated = "settingUpdated",
|
|
30
|
-
TokenSearch = "tokenSearch"
|
|
30
|
+
TokenSearch = "tokenSearch",
|
|
31
|
+
LowAddressActivityConfirmed = "lowAddressActivityConfirmed"
|
|
31
32
|
}
|
|
32
33
|
export type WidgetEvents = {
|
|
33
34
|
routeExecutionStarted: Route;
|
|
@@ -48,6 +49,10 @@ export type WidgetEvents = {
|
|
|
48
49
|
pageEntered: NavigationRouteType;
|
|
49
50
|
settingUpdated: SettingUpdated;
|
|
50
51
|
tokenSearch: TokenSearch;
|
|
52
|
+
[WidgetEvent.LowAddressActivityConfirmed]: {
|
|
53
|
+
address: string;
|
|
54
|
+
chainId: number;
|
|
55
|
+
};
|
|
51
56
|
};
|
|
52
57
|
export type ContactSupport = {
|
|
53
58
|
supportId?: string;
|
package/dist/esm/types/events.js
CHANGED
|
@@ -24,5 +24,6 @@ export var WidgetEvent;
|
|
|
24
24
|
WidgetEvent["FormFieldChanged"] = "formFieldChanged";
|
|
25
25
|
WidgetEvent["SettingUpdated"] = "settingUpdated";
|
|
26
26
|
WidgetEvent["TokenSearch"] = "tokenSearch";
|
|
27
|
+
WidgetEvent["LowAddressActivityConfirmed"] = "lowAddressActivityConfirmed";
|
|
27
28
|
})(WidgetEvent || (WidgetEvent = {}));
|
|
28
29
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/events.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/events.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,WA0BX;AA1BD,WAAY,WAAW;IACrB,8DAA+C,CAAA;IAC/C,8DAA+C,CAAA;IAC/C,kEAAmD,CAAA;IACnD,4DAA6C,CAAA;IAC7C,wDAAyC,CAAA;IACzC,8CAA+B,CAAA;IAC/B,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;IACjC,oEAAqD,CAAA;IACrD,8EAA+D,CAAA;IAC/D,0DAA2C,CAAA;IAC3C;;OAEG;IACH,4EAA6D,CAAA;IAC7D;;OAEG;IACH,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;IAC3B,oDAAqC,CAAA;IACrC,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;IAC3B,0EAA2D,CAAA;AAC7D,CAAC,EA1BW,WAAW,KAAX,WAAW,QA0BtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -11,7 +11,7 @@ interface QueuedMessage {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const useMessageQueue = (route?: Route) => {
|
|
14
|
-
const { requiredToAddress, accountNotDeployedAtDestination } =
|
|
14
|
+
const { requiredToAddress, accountNotDeployedAtDestination, toAddress } =
|
|
15
15
|
useToAddressRequirements()
|
|
16
16
|
const { insufficientFromToken } = useFromTokenSufficiency(route)
|
|
17
17
|
const { insufficientGas } = useGasSufficiency(route)
|
|
@@ -41,7 +41,7 @@ export const useMessageQueue = (route?: Route) => {
|
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (requiredToAddress) {
|
|
44
|
+
if (requiredToAddress && !toAddress) {
|
|
45
45
|
queue.push({
|
|
46
46
|
id: 'TO_ADDRESS_REQUIRED',
|
|
47
47
|
priority: 4,
|
|
@@ -50,10 +50,11 @@ export const useMessageQueue = (route?: Route) => {
|
|
|
50
50
|
|
|
51
51
|
return queue.sort((a, b) => a.priority - b.priority)
|
|
52
52
|
}, [
|
|
53
|
+
accountNotDeployedAtDestination,
|
|
53
54
|
insufficientFromToken,
|
|
54
55
|
insufficientGas,
|
|
55
|
-
accountNotDeployedAtDestination,
|
|
56
56
|
requiredToAddress,
|
|
57
|
+
toAddress,
|
|
57
58
|
])
|
|
58
59
|
|
|
59
60
|
return {
|
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.16.0'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Address } from 'viem'
|
|
2
|
+
import { isAddress } from 'viem'
|
|
3
|
+
import { useTransactionCount } from 'wagmi'
|
|
4
|
+
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
5
|
+
|
|
6
|
+
interface AddressActivity {
|
|
7
|
+
hasActivity: boolean
|
|
8
|
+
isLoading: boolean
|
|
9
|
+
isFetched: boolean
|
|
10
|
+
toAddress: string | undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useAddressActivity = (chainId?: number): AddressActivity => {
|
|
14
|
+
const [toAddress, toChainId] = useFieldValues('toAddress', 'toChain')
|
|
15
|
+
|
|
16
|
+
const destinationChainId = chainId ?? toChainId
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
data: transactionCount,
|
|
20
|
+
isLoading,
|
|
21
|
+
isFetched,
|
|
22
|
+
error,
|
|
23
|
+
} = useTransactionCount({
|
|
24
|
+
address: toAddress as Address,
|
|
25
|
+
chainId: destinationChainId,
|
|
26
|
+
query: {
|
|
27
|
+
enabled: Boolean(toAddress && destinationChainId && isAddress(toAddress)),
|
|
28
|
+
refetchInterval: 300_000,
|
|
29
|
+
staleTime: 300_000,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
toAddress,
|
|
35
|
+
hasActivity: Boolean(transactionCount && transactionCount > 0),
|
|
36
|
+
isLoading,
|
|
37
|
+
isFetched: isFetched && !error,
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/i18n/en.json
CHANGED
|
@@ -118,6 +118,8 @@
|
|
|
118
118
|
"warning": {
|
|
119
119
|
"message": {
|
|
120
120
|
"accountNotDeployedMessage": "Smart contract account is not deployed on the destination chain. Sending funds to a non-existent contract would result in permanent loss.",
|
|
121
|
+
"noAddressActivity": "This address has never been used on this network. Please verify you're sending to the correct address to prevent potential loss of funds.",
|
|
122
|
+
"lowAddressActivity": "This address has low activity on {{chainName}} network. Please verify you're sending to the correct address and network to prevent potential loss of funds.",
|
|
121
123
|
"deleteActiveTransactions": "Active transactions are only stored locally and can't be recovered if you delete them.",
|
|
122
124
|
"deleteTransactionHistory": "Transaction history is only stored locally and can't be recovered if you delete it.",
|
|
123
125
|
"fundsLossPrevention": "Always ensure smart contract accounts are properly set up on the destination chain and avoid direct transfers to exchanges to prevent fund loss.",
|
|
@@ -135,7 +137,8 @@
|
|
|
135
137
|
"highValueLoss": "High value loss",
|
|
136
138
|
"insufficientGas": "Insufficient gas",
|
|
137
139
|
"rateChanged": "Rate changed",
|
|
138
|
-
"resetSettings": "Reset settings?"
|
|
140
|
+
"resetSettings": "Reset settings?",
|
|
141
|
+
"lowAddressActivity": "Low Activity Address"
|
|
139
142
|
}
|
|
140
143
|
},
|
|
141
144
|
"error": {
|
|
@@ -5,7 +5,6 @@ import { useRoutes } from '../../hooks/useRoutes.js'
|
|
|
5
5
|
import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'
|
|
6
6
|
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
7
7
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
8
|
-
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
9
8
|
import { useSplitSubvariantStore } from '../../stores/settings/useSplitSubvariantStore.js'
|
|
10
9
|
import { WidgetEvent } from '../../types/events.js'
|
|
11
10
|
import { navigationRoutes } from '../../utils/navigationRoutes.js'
|
|
@@ -16,24 +15,25 @@ export const ReviewButton: React.FC = () => {
|
|
|
16
15
|
const emitter = useWidgetEvents()
|
|
17
16
|
const { subvariant, subvariantOptions } = useWidgetConfig()
|
|
18
17
|
const splitState = useSplitSubvariantStore((state) => state.state)
|
|
19
|
-
const
|
|
20
|
-
const { requiredToAddress, accountNotDeployedAtDestination } =
|
|
18
|
+
const { toAddress, requiredToAddress, accountNotDeployedAtDestination } =
|
|
21
19
|
useToAddressRequirements()
|
|
22
20
|
const { routes, setReviewableRoute } = useRoutes()
|
|
23
21
|
|
|
24
22
|
const currentRoute = routes?.[0]
|
|
25
23
|
|
|
26
24
|
const handleClick = async () => {
|
|
27
|
-
if (currentRoute) {
|
|
28
|
-
|
|
29
|
-
navigate(navigationRoutes.transactionExecution, {
|
|
30
|
-
state: { routeId: currentRoute.id },
|
|
31
|
-
})
|
|
32
|
-
emitter.emit(WidgetEvent.RouteSelected, {
|
|
33
|
-
route: currentRoute,
|
|
34
|
-
routes: routes!,
|
|
35
|
-
})
|
|
25
|
+
if (!currentRoute) {
|
|
26
|
+
return
|
|
36
27
|
}
|
|
28
|
+
|
|
29
|
+
setReviewableRoute(currentRoute)
|
|
30
|
+
navigate(navigationRoutes.transactionExecution, {
|
|
31
|
+
state: { routeId: currentRoute.id },
|
|
32
|
+
})
|
|
33
|
+
emitter.emit(WidgetEvent.RouteSelected, {
|
|
34
|
+
route: currentRoute,
|
|
35
|
+
routes: routes!,
|
|
36
|
+
})
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const getButtonText = (): string => {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Wallet, WarningRounded } from '@mui/icons-material'
|
|
2
|
+
import { Button, Typography } from '@mui/material'
|
|
3
|
+
import type { MutableRefObject } from 'react'
|
|
4
|
+
import { forwardRef } from 'react'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
|
+
import { BottomSheet } from '../../components/BottomSheet/BottomSheet.js'
|
|
7
|
+
import type { BottomSheetBase } from '../../components/BottomSheet/types.js'
|
|
8
|
+
import { AlertMessage } from '../../components/Messages/AlertMessage.js'
|
|
9
|
+
import { useChain } from '../../hooks/useChain.js'
|
|
10
|
+
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
11
|
+
import { WidgetEvent } from '../../types/events.js'
|
|
12
|
+
import {
|
|
13
|
+
IconContainer,
|
|
14
|
+
SendToWalletButtonRow,
|
|
15
|
+
SendToWalletSheetContainer,
|
|
16
|
+
SheetAddressContainer,
|
|
17
|
+
} from '../SendToWallet/SendToWalletPage.style.js'
|
|
18
|
+
|
|
19
|
+
interface ConfirmToAddressSheetProps {
|
|
20
|
+
onContinue: () => void
|
|
21
|
+
toAddress: string
|
|
22
|
+
toChainId: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ConfirmToAddressSheetContentProps extends ConfirmToAddressSheetProps {
|
|
26
|
+
onClose: () => void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const ConfirmToAddressSheet = forwardRef<
|
|
30
|
+
BottomSheetBase,
|
|
31
|
+
ConfirmToAddressSheetProps
|
|
32
|
+
>((props, ref) => {
|
|
33
|
+
const handleClose = () => {
|
|
34
|
+
;(ref as MutableRefObject<BottomSheetBase>).current?.close()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<BottomSheet ref={ref}>
|
|
39
|
+
<ConfirmToAddressSheetContent {...props} onClose={handleClose} />
|
|
40
|
+
</BottomSheet>
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const ConfirmToAddressSheetContent: React.FC<
|
|
45
|
+
ConfirmToAddressSheetContentProps
|
|
46
|
+
> = ({ onContinue, onClose, toAddress, toChainId }) => {
|
|
47
|
+
const { t } = useTranslation()
|
|
48
|
+
const { chain } = useChain(toChainId)
|
|
49
|
+
const emitter = useWidgetEvents()
|
|
50
|
+
|
|
51
|
+
const handleContinue = () => {
|
|
52
|
+
emitter.emit(WidgetEvent.LowAddressActivityConfirmed, {
|
|
53
|
+
address: toAddress,
|
|
54
|
+
chainId: toChainId,
|
|
55
|
+
})
|
|
56
|
+
onClose()
|
|
57
|
+
onContinue()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<SendToWalletSheetContainer>
|
|
62
|
+
<IconContainer>
|
|
63
|
+
<Wallet sx={{ fontSize: 40 }} />
|
|
64
|
+
</IconContainer>
|
|
65
|
+
<Typography variant="h6" sx={{ textAlign: 'center', mb: 2 }}>
|
|
66
|
+
{t('warning.title.lowAddressActivity')}
|
|
67
|
+
</Typography>
|
|
68
|
+
<SheetAddressContainer>
|
|
69
|
+
<Typography>{toAddress}</Typography>
|
|
70
|
+
</SheetAddressContainer>
|
|
71
|
+
<AlertMessage
|
|
72
|
+
severity="warning"
|
|
73
|
+
title={
|
|
74
|
+
<Typography variant="body2" sx={{ color: 'text.primary' }}>
|
|
75
|
+
{t('warning.message.lowAddressActivity', {
|
|
76
|
+
chainName: chain?.name,
|
|
77
|
+
})}
|
|
78
|
+
</Typography>
|
|
79
|
+
}
|
|
80
|
+
icon={<WarningRounded />}
|
|
81
|
+
multiline
|
|
82
|
+
/>
|
|
83
|
+
<SendToWalletButtonRow>
|
|
84
|
+
<Button variant="text" onClick={onClose} fullWidth>
|
|
85
|
+
{t('button.cancel')}
|
|
86
|
+
</Button>
|
|
87
|
+
<Button variant="contained" onClick={handleContinue} fullWidth>
|
|
88
|
+
{t('button.continue')}
|
|
89
|
+
</Button>
|
|
90
|
+
</SendToWalletButtonRow>
|
|
91
|
+
</SendToWalletSheetContainer>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
@@ -10,6 +10,7 @@ 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'
|
|
13
|
+
import { useAddressActivity } from '../../hooks/useAddressActivity.js'
|
|
13
14
|
import { useHeader } from '../../hooks/useHeader.js'
|
|
14
15
|
import { useNavigateBack } from '../../hooks/useNavigateBack.js'
|
|
15
16
|
import { useRouteExecution } from '../../hooks/useRouteExecution.js'
|
|
@@ -19,6 +20,7 @@ import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
|
19
20
|
import { RouteExecutionStatus } from '../../stores/routes/types.js'
|
|
20
21
|
import { WidgetEvent } from '../../types/events.js'
|
|
21
22
|
import { getAccumulatedFeeCostsBreakdown } from '../../utils/fees.js'
|
|
23
|
+
import { ConfirmToAddressSheet } from './ConfirmToAddressSheet.js'
|
|
22
24
|
import type { ExchangeRateBottomSheetBase } from './ExchangeRateBottomSheet.js'
|
|
23
25
|
import { ExchangeRateBottomSheet } from './ExchangeRateBottomSheet.js'
|
|
24
26
|
import { RouteTracker } from './RouteTracker.js'
|
|
@@ -44,6 +46,7 @@ export const TransactionPage: React.FC = () => {
|
|
|
44
46
|
|
|
45
47
|
const tokenValueBottomSheetRef = useRef<BottomSheetBase>(null)
|
|
46
48
|
const exchangeRateBottomSheetRef = useRef<ExchangeRateBottomSheetBase>(null)
|
|
49
|
+
const confirmToAddressSheetRef = useRef<BottomSheetBase>(null)
|
|
47
50
|
|
|
48
51
|
const onAcceptExchangeRateUpdate = (
|
|
49
52
|
resolver: (value: boolean) => void,
|
|
@@ -58,6 +61,13 @@ export const TransactionPage: React.FC = () => {
|
|
|
58
61
|
onAcceptExchangeRateUpdate,
|
|
59
62
|
})
|
|
60
63
|
|
|
64
|
+
const {
|
|
65
|
+
toAddress,
|
|
66
|
+
hasActivity,
|
|
67
|
+
isLoading: isLoadingAddressActivity,
|
|
68
|
+
isFetched: isActivityAddressFetched,
|
|
69
|
+
} = useAddressActivity(route?.toChainId)
|
|
70
|
+
|
|
61
71
|
const getHeaderTitle = () => {
|
|
62
72
|
if (subvariant === 'custom') {
|
|
63
73
|
return t(`header.${subvariantOptions?.custom ?? 'checkout'}`)
|
|
@@ -127,6 +137,16 @@ export const TransactionPage: React.FC = () => {
|
|
|
127
137
|
|
|
128
138
|
const handleStartClick = async () => {
|
|
129
139
|
if (status === RouteExecutionStatus.Idle) {
|
|
140
|
+
if (
|
|
141
|
+
toAddress &&
|
|
142
|
+
!hasActivity &&
|
|
143
|
+
!isLoadingAddressActivity &&
|
|
144
|
+
isActivityAddressFetched
|
|
145
|
+
) {
|
|
146
|
+
confirmToAddressSheetRef.current?.open()
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
|
|
130
150
|
const { gasCostUSD, feeCostUSD } = getAccumulatedFeeCostsBreakdown(route)
|
|
131
151
|
const fromAmountUSD = Number.parseFloat(route.fromAmountUSD)
|
|
132
152
|
const toAmountUSD = Number.parseFloat(route.toAmountUSD)
|
|
@@ -198,7 +218,7 @@ export const TransactionPage: React.FC = () => {
|
|
|
198
218
|
text={getButtonText()}
|
|
199
219
|
onClick={handleStartClick}
|
|
200
220
|
route={route}
|
|
201
|
-
loading={routeRefreshing}
|
|
221
|
+
loading={routeRefreshing || isLoadingAddressActivity}
|
|
202
222
|
/>
|
|
203
223
|
{status === RouteExecutionStatus.Failed ? (
|
|
204
224
|
<Tooltip
|
|
@@ -228,6 +248,12 @@ export const TransactionPage: React.FC = () => {
|
|
|
228
248
|
/>
|
|
229
249
|
) : null}
|
|
230
250
|
<ExchangeRateBottomSheet ref={exchangeRateBottomSheetRef} />
|
|
251
|
+
<ConfirmToAddressSheet
|
|
252
|
+
ref={confirmToAddressSheetRef}
|
|
253
|
+
onContinue={handleExecuteRoute}
|
|
254
|
+
toAddress={toAddress!}
|
|
255
|
+
toChainId={route.toChainId!}
|
|
256
|
+
/>
|
|
231
257
|
</PageContainer>
|
|
232
258
|
)
|
|
233
259
|
}
|
package/src/types/events.ts
CHANGED
|
@@ -29,6 +29,7 @@ export enum WidgetEvent {
|
|
|
29
29
|
FormFieldChanged = 'formFieldChanged',
|
|
30
30
|
SettingUpdated = 'settingUpdated',
|
|
31
31
|
TokenSearch = 'tokenSearch',
|
|
32
|
+
LowAddressActivityConfirmed = 'lowAddressActivityConfirmed',
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export type WidgetEvents = {
|
|
@@ -50,6 +51,10 @@ export type WidgetEvents = {
|
|
|
50
51
|
pageEntered: NavigationRouteType
|
|
51
52
|
settingUpdated: SettingUpdated
|
|
52
53
|
tokenSearch: TokenSearch
|
|
54
|
+
[WidgetEvent.LowAddressActivityConfirmed]: {
|
|
55
|
+
address: string
|
|
56
|
+
chainId: number
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
export type ContactSupport = {
|