@lifi/widget 1.4.0 → 1.6.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/AppDrawer.style.d.ts +1 -1
- package/AppProvider.js +2 -0
- package/components/AppContainer.js +5 -1
- package/components/Header/Header.style.js +1 -1
- package/components/LiFiLogo.js +1 -1
- package/components/{PoweredBy.d.ts → PoweredBy/PoweredBy.d.ts} +0 -0
- package/components/PoweredBy/PoweredBy.js +12 -0
- package/components/PoweredBy/PoweredBy.style.d.ts +12 -0
- package/components/PoweredBy/PoweredBy.style.js +9 -0
- package/components/PoweredBy/index.d.ts +1 -0
- package/components/PoweredBy/index.js +1 -0
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/components/SwapButton/ButtonTooltip.d.ts +0 -1
- package/components/SwapButton/SwapButton.js +8 -20
- package/components/SwapButton/SwapButton.style.d.ts +1 -1
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/TokenList/TokenList.js +5 -2
- package/config/sentry.d.ts +1 -0
- package/config/sentry.js +20 -0
- package/config/version.d.ts +2 -0
- package/config/version.js +2 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useRouteExecution.js +9 -3
- package/hooks/useSwapRoutes.js +1 -1
- package/hooks/useTelemetry.d.ts +1 -0
- package/hooks/useTelemetry.js +10 -0
- package/i18n/en/translation.json +16 -6
- package/i18n/index.d.ts +14 -4
- package/index.js +2 -0
- package/package.json +10 -7
- 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/SelectTokenPage/ChainSelect.d.ts +0 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SwapPage/CircularProgress.d.ts +0 -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/pages/SwapRoutesPage/SwapRoutesPage.js +3 -0
- package/providers/WalletProvider/WalletProvider.js +5 -13
- package/types/widget.d.ts +1 -0
- package/components/PoweredBy.js +0 -14
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;
|
package/AppProvider.js
CHANGED
|
@@ -5,12 +5,14 @@ import { Fragment } from 'react';
|
|
|
5
5
|
import { QueryClientProvider } from 'react-query';
|
|
6
6
|
import { MemoryRouter, useInRouterContext } from 'react-router-dom';
|
|
7
7
|
import { queryClient } from './config/queryClient';
|
|
8
|
+
import { useTelemetry } from './hooks';
|
|
8
9
|
import { SwapFormProvider } from './providers/SwapFormProvider';
|
|
9
10
|
import { ThemeProvider } from './providers/ThemeProvider';
|
|
10
11
|
import { WalletProvider } from './providers/WalletProvider';
|
|
11
12
|
import { WidgetProvider } from './providers/WidgetProvider';
|
|
12
13
|
const QueryProvider = QueryClientProvider;
|
|
13
14
|
export const AppProvider = ({ children, config, }) => {
|
|
15
|
+
useTelemetry(config === null || config === void 0 ? void 0 : config.disableTelemetry);
|
|
14
16
|
const inRouterContext = useInRouterContext();
|
|
15
17
|
const Router = inRouterContext ? Fragment : MemoryRouter;
|
|
16
18
|
return (_jsx(WidgetProvider, Object.assign({ config: config }, { children: _jsx(ThemeProvider, { children: _jsx(QueryProvider, Object.assign({ client: queryClient }, { children: _jsx(Router, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: children }) }) }) })) }) })));
|
|
@@ -19,10 +19,13 @@ const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
|
|
|
19
19
|
}));
|
|
20
20
|
const RelativeContainer = styled(Box)(({ theme }) => ({
|
|
21
21
|
position: 'relative',
|
|
22
|
-
width:
|
|
22
|
+
width: '100%',
|
|
23
|
+
minWidth: 375,
|
|
24
|
+
maxWidth: 392,
|
|
23
25
|
background: theme.palette.background.default,
|
|
24
26
|
overflow: 'auto',
|
|
25
27
|
flex: 1,
|
|
28
|
+
boxSizing: 'content-box',
|
|
26
29
|
}));
|
|
27
30
|
const ScrollableContainer = styled(Box)({
|
|
28
31
|
// position: 'fixed',
|
|
@@ -30,6 +33,7 @@ const ScrollableContainer = styled(Box)({
|
|
|
30
33
|
height: '100%',
|
|
31
34
|
flex: 1,
|
|
32
35
|
display: 'flex',
|
|
36
|
+
zIndex: 0,
|
|
33
37
|
});
|
|
34
38
|
const FlexContainer = styled(Container)({
|
|
35
39
|
display: 'flex',
|
package/components/LiFiLogo.js
CHANGED
|
@@ -3,5 +3,5 @@ import { ReactComponent as LiFiFullLogo } from '../icons/LiFiFullLogo.svg';
|
|
|
3
3
|
import { ReactComponent as LiFiIconLogo } from '../icons/LiFiLogo.svg';
|
|
4
4
|
export const LiFiLogo = ({ variant = 'icon', style }) => {
|
|
5
5
|
const Component = variant === 'icon' ? LiFiIconLogo : LiFiFullLogo;
|
|
6
|
-
return _jsx(Component, { style: style, fill: "currentColor" });
|
|
6
|
+
return _jsx(Component, { style: style, fill: "currentColor", color: "currentColor" });
|
|
7
7
|
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from '@mui/material';
|
|
3
|
+
import { LiFiLogo } from '../LiFiLogo';
|
|
4
|
+
import { Link } from './PoweredBy.style';
|
|
5
|
+
export const PoweredBy = () => {
|
|
6
|
+
return (_jsx(Box, Object.assign({ px: 3, pt: 2, pb: 2, sx: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
alignItems: 'flex-end',
|
|
9
|
+
justifyContent: 'flex-end',
|
|
10
|
+
flex: 1,
|
|
11
|
+
} }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })));
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Link: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").LinkBaseProps, "classes"> & {
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").LinkClasses> | undefined;
|
|
5
|
+
color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined>);
|
|
6
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
7
|
+
TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
|
|
8
|
+
underline?: "none" | "always" | "hover" | undefined;
|
|
9
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
|
|
10
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof import("react").AnchorHTMLAttributes<HTMLAnchorElement>> & {
|
|
11
|
+
ref?: ((instance: HTMLAnchorElement | null) => void) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
|
|
12
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "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" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "underline" | "TypographyClasses"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PoweredBy } from './PoweredBy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PoweredBy } from './PoweredBy';
|
|
@@ -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;
|
|
@@ -19,13 +19,13 @@ export const SelectTokenCardHeader = styled(CardHeader, {
|
|
|
19
19
|
textOverflow: 'ellipsis',
|
|
20
20
|
whiteSpace: 'nowrap',
|
|
21
21
|
overflow: 'hidden',
|
|
22
|
-
width: compact ? 92 :
|
|
22
|
+
width: compact ? 92 : 224,
|
|
23
23
|
fontWeight: selected ? 500 : 400,
|
|
24
24
|
},
|
|
25
25
|
[`.${cardHeaderClasses.subheader}`]: {
|
|
26
26
|
textOverflow: 'ellipsis',
|
|
27
27
|
whiteSpace: 'nowrap',
|
|
28
28
|
overflow: 'hidden',
|
|
29
|
-
width: compact ? 92 :
|
|
29
|
+
width: compact ? 92 : 224,
|
|
30
30
|
},
|
|
31
31
|
}));
|
|
@@ -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;
|
|
@@ -21,7 +21,7 @@ export const FormPriceHelperText = ({ formType, selected }) => {
|
|
|
21
21
|
overflowWrap: 'break-word',
|
|
22
22
|
} }, { children: t(`swap.currency`, {
|
|
23
23
|
value: fromAmountTokenPrice,
|
|
24
|
-
}) })), isLoading && isFetching ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : token ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`swap.maxAmount`, {
|
|
24
|
+
}) })), isLoading && isFetching ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`swap.maxAmount`, {
|
|
25
25
|
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
26
26
|
}) }))) : null] })));
|
|
27
27
|
};
|
|
@@ -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;
|
|
@@ -47,10 +47,13 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
47
47
|
setValue(SwapFormKeyHelper.getTokenKey(formType), tokenAddress);
|
|
48
48
|
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
49
49
|
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
50
|
-
const [selectedOppositeToken] = getValues([
|
|
50
|
+
const [selectedOppositeToken, selectedOppositeChain, selectedChain] = getValues([
|
|
51
51
|
SwapFormKeyHelper.getTokenKey(oppositeFormType),
|
|
52
|
+
SwapFormKeyHelper.getChainKey(oppositeFormType),
|
|
53
|
+
SwapFormKeyHelper.getChainKey(formType),
|
|
52
54
|
]);
|
|
53
|
-
if (selectedOppositeToken === tokenAddress
|
|
55
|
+
if (selectedOppositeToken === tokenAddress &&
|
|
56
|
+
selectedOppositeChain === selectedChain) {
|
|
54
57
|
setValue(SwapFormKeyHelper.getTokenKey(oppositeFormType), '');
|
|
55
58
|
}
|
|
56
59
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initSentry: (enabled?: boolean) => void;
|
package/config/sentry.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CaptureConsole } from '@sentry/integrations';
|
|
2
|
+
import * as Sentry from '@sentry/react';
|
|
3
|
+
import { BrowserTracing } from '@sentry/tracing';
|
|
4
|
+
import { version } from './version';
|
|
5
|
+
export const initSentry = (enabled) => {
|
|
6
|
+
Sentry.init({
|
|
7
|
+
dsn: 'https://bc1312161bf948db9b9c82618035ec22@o1302189.ingest.sentry.io/6539228',
|
|
8
|
+
integrations: [
|
|
9
|
+
new BrowserTracing(),
|
|
10
|
+
new CaptureConsole({
|
|
11
|
+
levels: ['error'],
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
sampleRate: 1,
|
|
15
|
+
tracesSampleRate: 0.2,
|
|
16
|
+
enabled: enabled && process.env.NODE_ENV === 'production',
|
|
17
|
+
environment: process.env.NODE_ENV,
|
|
18
|
+
release: version,
|
|
19
|
+
});
|
|
20
|
+
};
|
package/hooks/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './useHasSufficientBalance';
|
|
|
6
6
|
export * from './useRouteExecution';
|
|
7
7
|
export * from './useScrollableContainer';
|
|
8
8
|
export * from './useSwapRoutes';
|
|
9
|
+
export * from './useTelemetry';
|
|
9
10
|
export * from './useToken';
|
|
10
11
|
export * from './useTokenBalance';
|
|
11
12
|
export * from './useTokenBalances';
|
package/hooks/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './useHasSufficientBalance';
|
|
|
6
6
|
export * from './useRouteExecution';
|
|
7
7
|
export * from './useScrollableContainer';
|
|
8
8
|
export * from './useSwapRoutes';
|
|
9
|
+
export * from './useTelemetry';
|
|
9
10
|
export * from './useToken';
|
|
10
11
|
export * from './useTokenBalance';
|
|
11
12
|
export * from './useTokenBalances';
|
|
@@ -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) &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTelemetry: (disabled?: boolean) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { initSentry } from '../config/sentry';
|
|
3
|
+
export const useTelemetry = (disabled) => {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (process.env.NODE_ENV === 'production' && disabled) {
|
|
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
|
+
initSentry(false);
|
|
8
|
+
}
|
|
9
|
+
}, [disabled]);
|
|
10
|
+
};
|
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/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { App } from './App';
|
|
2
2
|
import { AppDrawer } from './AppDrawer';
|
|
3
|
+
import { initSentry } from './config/sentry';
|
|
3
4
|
import './fonts/inter.css';
|
|
4
5
|
import { configureReactI18next } from './i18n';
|
|
5
6
|
export * from './types';
|
|
7
|
+
initSentry(true);
|
|
6
8
|
configureReactI18next();
|
|
7
9
|
// ClassNameGenerator.configure((componentName) => componentName.replace('Mui', ''));
|
|
8
10
|
export const LiFiWidget = App;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
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,17 +42,20 @@
|
|
|
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.14",
|
|
46
46
|
"@mui/icons-material": "^5.8.4",
|
|
47
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
48
|
-
"@mui/material": "^5.8.
|
|
47
|
+
"@mui/lab": "^5.0.0-alpha.89",
|
|
48
|
+
"@mui/material": "^5.8.7",
|
|
49
|
+
"@sentry/integrations": "^7.5.1",
|
|
50
|
+
"@sentry/react": "^7.5.1",
|
|
51
|
+
"@sentry/tracing": "^7.5.1",
|
|
49
52
|
"big.js": "^6.2.0",
|
|
50
|
-
"i18next": "^21.8.
|
|
53
|
+
"i18next": "^21.8.13",
|
|
51
54
|
"immer": "^9.0.15",
|
|
52
55
|
"react": "^18.2.0",
|
|
53
56
|
"react-dom": "^18.2.0",
|
|
54
|
-
"react-hook-form": "^7.33.
|
|
55
|
-
"react-i18next": "^11.
|
|
57
|
+
"react-hook-form": "^7.33.1",
|
|
58
|
+
"react-i18next": "^11.18.0",
|
|
56
59
|
"react-query": "^4.0.0-beta.23",
|
|
57
60
|
"react-resize-detector": "^7.1.2",
|
|
58
61
|
"react-router-dom": "^6.3.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`, {
|
|
@@ -19,6 +19,9 @@ export const SwapRoutesPage = () => {
|
|
|
19
19
|
setExecutableRoute(route);
|
|
20
20
|
navigate(routes.swap, { state: { routeId: route.id }, replace: true });
|
|
21
21
|
};
|
|
22
|
+
// A route for this transaction does not exist yet possibly due to liquidity issues or because the amount of tokens you are sending is below the bridge minimum amount.
|
|
23
|
+
// Please try again later or change the tokens you intend to swap.
|
|
24
|
+
// If the problem persists, come to our Discord and leave a message in the support channel.
|
|
22
25
|
return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2 }, { children: isLoading || isFetching
|
|
23
26
|
? Array.from({ length: 3 }).map((_, index) => (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 196, sx: { borderRadius: 1 } }, index)))
|
|
24
27
|
: swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => (_jsx(SwapRouteCard, { route: route, active: (currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.id) === route.id, onClick: () => handleRouteClick(route) }, route.id))) })));
|
|
@@ -26,21 +26,9 @@ const initialContext = {
|
|
|
26
26
|
const WalletContext = createContext(initialContext);
|
|
27
27
|
export const useWallet = () => useContext(WalletContext);
|
|
28
28
|
export const WalletProvider = ({ children }) => {
|
|
29
|
-
var _a;
|
|
30
29
|
const config = useWidgetConfig();
|
|
31
30
|
const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, } = useLifiWalletManagement();
|
|
32
31
|
const [account, setAccount] = useState({});
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
var _a;
|
|
35
|
-
console.log('WalletProvider: signer changed.', (_a = config.walletManagement) === null || _a === void 0 ? void 0 : _a.signer);
|
|
36
|
-
const updateSigner = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
var _b;
|
|
38
|
-
const account = yield extractAccountFromSigner((_b = config.walletManagement) === null || _b === void 0 ? void 0 : _b.signer);
|
|
39
|
-
setAccount(account);
|
|
40
|
-
console.log('WalletProvider: signer changed account.', account);
|
|
41
|
-
});
|
|
42
|
-
updateSigner();
|
|
43
|
-
}, [(_a = config.walletManagement) === null || _a === void 0 ? void 0 : _a.signer]);
|
|
44
32
|
const connect = useCallback((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
33
|
if (config.walletManagement) {
|
|
46
34
|
const signer = yield config.walletManagement.connect();
|
|
@@ -94,7 +82,11 @@ export const WalletProvider = ({ children }) => {
|
|
|
94
82
|
// keep account information up to date
|
|
95
83
|
useEffect(() => {
|
|
96
84
|
const updateAccount = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
-
if (
|
|
85
|
+
if (config.walletManagement) {
|
|
86
|
+
const account = yield extractAccountFromSigner(config.walletManagement.signer);
|
|
87
|
+
setAccount(account);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
98
90
|
const account = yield extractAccountFromSigner(signer);
|
|
99
91
|
setAccount(account);
|
|
100
92
|
}
|
package/types/widget.d.ts
CHANGED
package/components/PoweredBy.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Link, Typography } from '@mui/material';
|
|
3
|
-
import { LiFiLogo } from './LiFiLogo';
|
|
4
|
-
export const PoweredBy = () => {
|
|
5
|
-
return (_jsx(Box, Object.assign({ px: 3, pt: 2, pb: 2, sx: {
|
|
6
|
-
display: 'flex',
|
|
7
|
-
alignItems: 'flex-end',
|
|
8
|
-
justifyContent: 'flex-end',
|
|
9
|
-
flex: 1,
|
|
10
|
-
} }, { children: _jsxs(Link, Object.assign({ sx: {
|
|
11
|
-
display: 'flex',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
}, href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })));
|
|
14
|
-
};
|