@lifi/widget 1.5.0 → 1.6.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/AppDrawer.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +8 -20
- package/components/SwapButton/SwapButton.style.d.ts +1 -1
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/config/sentry.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useRouteExecution.js +9 -3
- package/hooks/useSwapRoutes.js +1 -1
- package/hooks/useTelemetry.js +1 -1
- package/i18n/en/translation.json +16 -6
- package/i18n/index.d.ts +14 -4
- package/package.json +8 -8
- package/pages/MainPage/InsufficientGasOrFundsMessage.d.ts +2 -0
- package/pages/MainPage/InsufficientGasOrFundsMessage.js +28 -0
- package/pages/MainPage/InsufficientGasOrFundsMessage.style.d.ts +9 -0
- package/pages/MainPage/InsufficientGasOrFundsMessage.style.js +9 -0
- package/pages/MainPage/MainPage.js +2 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SwapPage/ExecutionItem.style.d.ts +1 -1
- package/pages/SwapPage/SwapPage.style.d.ts +1 -1
- package/pages/SwapPage/utils.js +4 -0
package/AppDrawer.style.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const DrawerButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "success" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -18,7 +18,6 @@ import { useWallet } from '../../providers/WalletProvider';
|
|
|
18
18
|
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
19
19
|
import { useCurrentRoute, useSetExecutableRoute } from '../../stores';
|
|
20
20
|
import { routes } from '../../utils/routes';
|
|
21
|
-
import { ButtonTooltip } from './ButtonTooltip';
|
|
22
21
|
import { Button } from './SwapButton.style';
|
|
23
22
|
export const SwapButton = () => {
|
|
24
23
|
var _a;
|
|
@@ -61,27 +60,16 @@ export const SwapButton = () => {
|
|
|
61
60
|
if (!isCurrentChainMatch) {
|
|
62
61
|
return t(`button.switchChain`);
|
|
63
62
|
}
|
|
64
|
-
if (!hasSufficientBalance) {
|
|
65
|
-
return t(`swap.insufficientFunds`);
|
|
66
|
-
}
|
|
67
|
-
if (!hasGasBalanceOnStartChain) {
|
|
68
|
-
return t(`swap.insufficientGasOnStartChain`);
|
|
69
|
-
}
|
|
70
|
-
if (!hasGasOnCrossChain) {
|
|
71
|
-
return t(`swap.insufficientGasOnDestinationChain`);
|
|
72
|
-
}
|
|
73
63
|
return t(`button.swap`);
|
|
74
64
|
}
|
|
75
65
|
return t(`button.connectWallet`);
|
|
76
66
|
};
|
|
77
|
-
return (_jsx(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
isFetching) &&
|
|
86
|
-
isCurrentChainMatch }, { children: getButtonText() })) })));
|
|
67
|
+
return (_jsx(Button, Object.assign({ variant: "contained", disableElevation: true, fullWidth: true, color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
|
|
68
|
+
// loading={isLoading || isFetching}
|
|
69
|
+
disabled: (!hasSufficientBalance ||
|
|
70
|
+
!hasGasBalanceOnStartChain ||
|
|
71
|
+
!hasGasOnCrossChain ||
|
|
72
|
+
isLoading ||
|
|
73
|
+
isFetching) &&
|
|
74
|
+
isCurrentChainMatch }, { children: getButtonText() })));
|
|
87
75
|
};
|
|
@@ -17,7 +17,7 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
|
17
17
|
} & Omit<{
|
|
18
18
|
children?: import("react").ReactNode;
|
|
19
19
|
classes?: Partial<import("@mui/material/Button").ButtonClasses> | undefined;
|
|
20
|
-
color?: "inherit" | "success" | "
|
|
20
|
+
color?: "inherit" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
22
22
|
disableElevation?: boolean | undefined;
|
|
23
23
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
|
|
|
4
4
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
6
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
-
color?: "success" | "
|
|
7
|
+
color?: "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "success" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
package/config/sentry.js
CHANGED
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.6.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.6.0';
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { useCallback, useEffect } from 'react';
|
|
10
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
11
11
|
import { useMutation } from 'react-query';
|
|
12
12
|
import shallow from 'zustand/shallow';
|
|
13
13
|
import { LiFi } from '../lifi';
|
|
@@ -16,6 +16,7 @@ import { useRouteStore } from '../stores';
|
|
|
16
16
|
import { deepClone } from '../utils/deepClone';
|
|
17
17
|
export const useRouteExecution = (routeId) => {
|
|
18
18
|
const { account, switchChain } = useWallet();
|
|
19
|
+
const resumedAfterMount = useRef(false);
|
|
19
20
|
const { route, status } = useRouteStore((state) => { var _a; return (_a = state.routes[routeId]) !== null && _a !== void 0 ? _a : {}; });
|
|
20
21
|
const [updateRoute, restartRoute, removeRoute] = useRouteStore((state) => [state.updateRoute, state.restartRoute, state.removeRoute], shallow);
|
|
21
22
|
const updateCallback = (updatedRoute) => {
|
|
@@ -116,12 +117,17 @@ export const useRouteExecution = (routeId) => {
|
|
|
116
117
|
const isDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
|
|
117
118
|
const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
|
|
118
119
|
const alreadyStarted = route.steps.some((step) => step.execution);
|
|
119
|
-
if (!isDone &&
|
|
120
|
+
if (!isDone &&
|
|
121
|
+
!isFailed &&
|
|
122
|
+
alreadyStarted &&
|
|
123
|
+
account.signer &&
|
|
124
|
+
!resumedAfterMount.current) {
|
|
125
|
+
resumedAfterMount.current = true;
|
|
120
126
|
resumeRoute();
|
|
121
127
|
}
|
|
122
128
|
return () => LiFi.moveExecutionToBackground(route);
|
|
123
129
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
124
|
-
}, []);
|
|
130
|
+
}, [account.signer]);
|
|
125
131
|
return {
|
|
126
132
|
executeRoute,
|
|
127
133
|
restartRoute: restartRouteMutation,
|
package/hooks/useSwapRoutes.js
CHANGED
|
@@ -35,7 +35,7 @@ export const useSwapRoutes = () => {
|
|
|
35
35
|
SwapFormKey.ToToken,
|
|
36
36
|
],
|
|
37
37
|
});
|
|
38
|
-
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount],
|
|
38
|
+
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount], 250);
|
|
39
39
|
const { token } = useToken(fromChainId, fromTokenAddress);
|
|
40
40
|
const isEnabled = Boolean(account.address) &&
|
|
41
41
|
!isNaN(fromChainId) &&
|
package/hooks/useTelemetry.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
|
|
|
2
2
|
import { initSentry } from '../config/sentry';
|
|
3
3
|
export const useTelemetry = (disabled) => {
|
|
4
4
|
useEffect(() => {
|
|
5
|
-
if (disabled) {
|
|
5
|
+
if (process.env.NODE_ENV === 'production' && disabled) {
|
|
6
6
|
console.warn('Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.');
|
|
7
7
|
initSentry(false);
|
|
8
8
|
}
|
package/i18n/en/translation.json
CHANGED
|
@@ -46,10 +46,6 @@
|
|
|
46
46
|
"selectChainAndToken": "Select chain and token",
|
|
47
47
|
"inProgress": "In progress",
|
|
48
48
|
"couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
|
|
49
|
-
"insufficientFunds": "Insufficient funds",
|
|
50
|
-
"insufficientGasOnStartChain": "Insufficient gas on start chain",
|
|
51
|
-
"insufficientGasOnDestinationChain": "Insufficient gas on destination chain",
|
|
52
|
-
"insufficientGasOnDestinationChainTooltip": "The selected route requires a swap on the chain you are transferring to. You need to have gas on that chain to pay for the transaction there.",
|
|
53
49
|
"stepSwap": "Swap",
|
|
54
50
|
"stepBridge": "Bridge",
|
|
55
51
|
"stepSwapAndBridge": "Swap and bridge",
|
|
@@ -72,6 +68,18 @@
|
|
|
72
68
|
"fundsReceived": "You now have {{amount}} {{tokenSymbol}} in your wallet on {{chainName}} chain."
|
|
73
69
|
}
|
|
74
70
|
},
|
|
71
|
+
"warning": {
|
|
72
|
+
"title": {
|
|
73
|
+
"insufficientFunds": "Insufficient funds",
|
|
74
|
+
"insufficientGasOnStartChain": "Insufficient gas on start chain",
|
|
75
|
+
"insufficientGasOnDestinationChain": "Insufficient gas on destination chain"
|
|
76
|
+
},
|
|
77
|
+
"message": {
|
|
78
|
+
"insufficientFunds": "You don't have enough funds in this account.",
|
|
79
|
+
"insufficientGasOnStartChain": "The selected route requires a swap on the chain you are transferring from. You need to have gas on that chain to pay for the transaction there.",
|
|
80
|
+
"insufficientGasOnDestinationChain": "The selected route requires a swap on the chain you are transferring to. You need to have gas on that chain to pay for the transaction there."
|
|
81
|
+
}
|
|
82
|
+
},
|
|
75
83
|
"error": {
|
|
76
84
|
"title": {
|
|
77
85
|
"chainSwitch": "Chain switch required.",
|
|
@@ -79,12 +87,14 @@
|
|
|
79
87
|
"transactionUnderpriced": "Transaction is underpriced.",
|
|
80
88
|
"transactionUnprepared": "Unable to prepare transaction.",
|
|
81
89
|
"unknown": "Something went wrong.",
|
|
82
|
-
"userRejectedSignatureRequest": "Signature required."
|
|
90
|
+
"userRejectedSignatureRequest": "Signature required.",
|
|
91
|
+
"slippageTooLarge": "Slippage too large."
|
|
83
92
|
},
|
|
84
93
|
"message": {
|
|
85
94
|
"signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
86
95
|
"transactionFailed": "Please check the block explorer for more information.",
|
|
87
|
-
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}})."
|
|
96
|
+
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
|
|
97
|
+
"slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
|
|
88
98
|
}
|
|
89
99
|
},
|
|
90
100
|
"process": {
|
package/i18n/index.d.ts
CHANGED
|
@@ -49,10 +49,6 @@ export declare const resources: {
|
|
|
49
49
|
selectChainAndToken: string;
|
|
50
50
|
inProgress: string;
|
|
51
51
|
couldntFindTokens: string;
|
|
52
|
-
insufficientFunds: string;
|
|
53
|
-
insufficientGasOnStartChain: string;
|
|
54
|
-
insufficientGasOnDestinationChain: string;
|
|
55
|
-
insufficientGasOnDestinationChainTooltip: string;
|
|
56
52
|
stepSwap: string;
|
|
57
53
|
stepBridge: string;
|
|
58
54
|
stepSwapAndBridge: string;
|
|
@@ -75,6 +71,18 @@ export declare const resources: {
|
|
|
75
71
|
fundsReceived: string;
|
|
76
72
|
};
|
|
77
73
|
};
|
|
74
|
+
warning: {
|
|
75
|
+
title: {
|
|
76
|
+
insufficientFunds: string;
|
|
77
|
+
insufficientGasOnStartChain: string;
|
|
78
|
+
insufficientGasOnDestinationChain: string;
|
|
79
|
+
};
|
|
80
|
+
message: {
|
|
81
|
+
insufficientFunds: string;
|
|
82
|
+
insufficientGasOnStartChain: string;
|
|
83
|
+
insufficientGasOnDestinationChain: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
78
86
|
error: {
|
|
79
87
|
title: {
|
|
80
88
|
chainSwitch: string;
|
|
@@ -83,11 +91,13 @@ export declare const resources: {
|
|
|
83
91
|
transactionUnprepared: string;
|
|
84
92
|
unknown: string;
|
|
85
93
|
userRejectedSignatureRequest: string;
|
|
94
|
+
slippageTooLarge: string;
|
|
86
95
|
};
|
|
87
96
|
message: {
|
|
88
97
|
signatureRequired: string;
|
|
89
98
|
transactionFailed: string;
|
|
90
99
|
transactionNotSent: string;
|
|
100
|
+
slippageTooLarge: string;
|
|
91
101
|
};
|
|
92
102
|
};
|
|
93
103
|
process: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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
|
"sideEffects": false,
|
|
6
6
|
"main": "./index.js",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"@ethersproject/experimental": "^5.6.3",
|
|
43
43
|
"@ethersproject/providers": "^5.6.8",
|
|
44
44
|
"@lifi/wallet-management": "^1.0.4",
|
|
45
|
-
"@lifinance/sdk": "^1.0.0-beta.
|
|
45
|
+
"@lifinance/sdk": "^1.0.0-beta.13",
|
|
46
46
|
"@mui/icons-material": "^5.8.4",
|
|
47
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
48
|
-
"@mui/material": "^5.8.
|
|
49
|
-
"@sentry/integrations": "^7.
|
|
50
|
-
"@sentry/react": "^7.
|
|
51
|
-
"@sentry/tracing": "^7.
|
|
47
|
+
"@mui/lab": "^5.0.0-alpha.89",
|
|
48
|
+
"@mui/material": "^5.8.7",
|
|
49
|
+
"@sentry/integrations": "^7.5.0",
|
|
50
|
+
"@sentry/react": "^7.5.0",
|
|
51
|
+
"@sentry/tracing": "^7.5.0",
|
|
52
52
|
"big.js": "^6.2.0",
|
|
53
|
-
"i18next": "^21.8.
|
|
53
|
+
"i18next": "^21.8.12",
|
|
54
54
|
"immer": "^9.0.15",
|
|
55
55
|
"react": "^18.2.0",
|
|
56
56
|
"react-dom": "^18.2.0",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { CardTitle } from '../../components/Card';
|
|
5
|
+
import { useHasSufficientBalance } from '../../hooks';
|
|
6
|
+
import { MessageCard } from './InsufficientGasOrFundsMessage.style';
|
|
7
|
+
export const InsufficientGasOrFundsMessage = () => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const { hasGasBalanceOnStartChain, hasGasOnCrossChain, hasSufficientBalance, } = useHasSufficientBalance();
|
|
10
|
+
if (hasSufficientBalance && hasGasBalanceOnStartChain && hasGasOnCrossChain) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
let title;
|
|
14
|
+
let message;
|
|
15
|
+
if (!hasSufficientBalance) {
|
|
16
|
+
title = t(`swap.warning.title.insufficientFunds`);
|
|
17
|
+
message = t(`swap.warning.message.insufficientFunds`);
|
|
18
|
+
}
|
|
19
|
+
if (!hasGasBalanceOnStartChain) {
|
|
20
|
+
title = t(`swap.warning.title.insufficientGasOnStartChain`);
|
|
21
|
+
message = t(`swap.warning.message.insufficientGasOnStartChain`);
|
|
22
|
+
}
|
|
23
|
+
if (!hasGasOnCrossChain) {
|
|
24
|
+
title = t(`swap.warning.title.insufficientGasOnDestinationChain`);
|
|
25
|
+
message = t(`swap.warning.message.insufficientGasOnDestinationChain`);
|
|
26
|
+
}
|
|
27
|
+
return (_jsxs(MessageCard, Object.assign({ mx: 3, mb: 3 }, { children: [_jsx(CardTitle, { children: title }), _jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: 2, pt: 1 }, { children: message }))] })));
|
|
28
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MessageCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
component?: import("react").ElementType<any> | undefined;
|
|
5
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
3
|
+
export const MessageCard = styled(Box)(({ theme }) => ({
|
|
4
|
+
backgroundColor: theme.palette.mode === 'light'
|
|
5
|
+
? theme.palette.warning.light
|
|
6
|
+
: alpha(theme.palette.warning.dark, 0.69),
|
|
7
|
+
borderRadius: theme.shape.borderRadius,
|
|
8
|
+
position: 'relative',
|
|
9
|
+
}));
|
|
@@ -5,7 +5,8 @@ import { SwapButton } from '../../components/SwapButton';
|
|
|
5
5
|
import { SwapInProgress } from '../../components/SwapInProgress';
|
|
6
6
|
import { SwapInput } from '../../components/SwapInput';
|
|
7
7
|
import { SwapRoutes } from '../../components/SwapRoutes';
|
|
8
|
+
import { InsufficientGasOrFundsMessage } from './InsufficientGasOrFundsMessage';
|
|
8
9
|
import { FormContainer } from './MainPage.style';
|
|
9
10
|
export const MainPage = () => {
|
|
10
|
-
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 2, mb: 1 }), _jsx(SelectChainAndToken, { mt: 2, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(SwapButton, {}) }))] })));
|
|
11
|
+
return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 2, mb: 1 }), _jsx(SelectChainAndToken, { mt: 2, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(InsufficientGasOrFundsMessage, {}), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(SwapButton, {}) }))] })));
|
|
11
12
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
|
|
5
|
-
color?: "success" | "
|
|
5
|
+
color?: "success" | "warning" | "error" | "info" | "primary" | "secondary" | "standard" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -12,7 +12,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
|
12
12
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
13
13
|
children?: import("react").ReactNode;
|
|
14
14
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
15
|
-
color?: "inherit" | "success" | "
|
|
15
|
+
color?: "inherit" | "success" | "warning" | "error" | "info" | "primary" | "secondary" | undefined;
|
|
16
16
|
disabled?: boolean | undefined;
|
|
17
17
|
disableElevation?: boolean | undefined;
|
|
18
18
|
disableFocusRipple?: boolean | undefined;
|
package/pages/SwapPage/utils.js
CHANGED
|
@@ -63,6 +63,10 @@ export function getProcessMessage(t, getChainById, step, process) {
|
|
|
63
63
|
title = t(`swap.error.title.transactionUnprepared`);
|
|
64
64
|
message = getTransactionNotSentMessage();
|
|
65
65
|
break;
|
|
66
|
+
case LifiErrorCode.SlippageError:
|
|
67
|
+
title = t(`swap.error.title.slippageTooLarge`);
|
|
68
|
+
message = t(`swap.error.message.slippageTooLarge`);
|
|
69
|
+
break;
|
|
66
70
|
case MetaMaskProviderErrorCode.userRejectedRequest:
|
|
67
71
|
title = t(`swap.error.title.userRejectedSignatureRequest`);
|
|
68
72
|
message = t(`swap.error.message.signatureRequired`, {
|