@lifi/widget 1.22.1 → 1.23.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/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/SelectChainAndToken.js +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/cjs/components/StepActions/StepActions.js +2 -2
- package/cjs/components/SwapButton/SwapButton.js +1 -1
- package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
- package/cjs/components/SwapInput/SwapInput.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/cjs/components/Token/Token.d.ts +5 -2
- package/cjs/components/Token/Token.js +11 -7
- package/cjs/components/Token/Token.style.d.ts +1 -0
- package/cjs/components/Token/Token.style.js +3 -3
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +3 -0
- package/cjs/components/TokenAvatar/TokenAvatar.js +6 -1
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +14 -1
- package/cjs/components/TokenList/TokenList.style.d.ts +7 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useGasSufficiency.js +0 -2
- package/cjs/hooks/useInitializer.js +5 -1
- package/cjs/hooks/useSwapRoutes.js +0 -1
- package/cjs/hooks/useTokenBalance.js +0 -1
- package/cjs/hooks/useTokenBalances.js +0 -1
- package/cjs/hooks/useTools.js +1 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
- package/cjs/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/SwapPage.js +6 -4
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/SelectChainAndToken.js +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +2 -3
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/components/StepActions/StepActions.js +2 -2
- package/components/SwapButton/SwapButton.js +1 -1
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.js +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/components/Token/Token.d.ts +5 -2
- package/components/Token/Token.js +14 -10
- package/components/Token/Token.style.d.ts +1 -0
- package/components/Token/Token.style.js +3 -3
- package/components/TokenAvatar/TokenAvatar.d.ts +3 -0
- package/components/TokenAvatar/TokenAvatar.js +4 -0
- package/components/TokenAvatar/TokenAvatar.style.d.ts +17 -0
- package/components/TokenAvatar/TokenAvatar.style.js +14 -1
- package/components/TokenList/TokenList.style.d.ts +7 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useGasSufficiency.js +0 -2
- package/hooks/useInitializer.js +5 -1
- package/hooks/useSwapRoutes.js +0 -1
- package/hooks/useTokenBalance.js +0 -1
- package/hooks/useTokenBalances.js +0 -1
- package/hooks/useTools.js +1 -1
- package/package.json +8 -8
- package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
- package/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/pages/SwapPage/SwapPage.js +6 -4
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BottomSheetBase, BottomSheetProps } from './types';
|
|
3
|
-
export declare const BottomSheet: import("react").ForwardRefExoticComponent<Pick<BottomSheetProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "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" | "onResize" | "onResizeCapture" | "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" | "transitionDuration" | "variant" | "open" | "anchor" | "components" | "elementRef" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "
|
|
3
|
+
export declare const BottomSheet: import("react").ForwardRefExoticComponent<Pick<BottomSheetProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "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" | "onResize" | "onResizeCapture" | "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" | "transitionDuration" | "variant" | "open" | "anchor" | "components" | "elementRef" | "componentsProps" | "slotProps" | "slots" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "elevation" | "PaperProps" | "ModalProps" | "SlideProps"> & import("react").RefAttributes<BottomSheetBase>>;
|
|
@@ -20,5 +20,5 @@ export const SelectChainAndToken = (props) => {
|
|
|
20
20
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromToken)) ||
|
|
21
21
|
(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.ToToken));
|
|
22
22
|
const isCompact = fromChain && toChain && fromToken && toToken && !prefersNarrowView;
|
|
23
|
-
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.
|
|
23
|
+
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.125 : 1 }, { children: !disabledReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null })), _jsx(SelectTokenButton, { formType: "to", compact: isCompact })] })));
|
|
24
24
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
|
|
3
2
|
import { Skeleton } from '@mui/material';
|
|
4
3
|
import { useWatch } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -8,7 +7,7 @@ import { useChain, useToken } from '../../hooks';
|
|
|
8
7
|
import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
|
|
9
8
|
import { navigationRoutes } from '../../utils';
|
|
10
9
|
import { Card, CardTitle } from '../Card';
|
|
11
|
-
import { TokenAvatar } from '../TokenAvatar';
|
|
10
|
+
import { TokenAvatar, TokenAvatarSkeleton } from '../TokenAvatar';
|
|
12
11
|
import { SelectTokenCardHeader } from './SelectTokenButton.style';
|
|
13
12
|
export const SelectTokenButton = ({ formType, compact }) => {
|
|
14
13
|
const { t } = useTranslation();
|
|
@@ -32,5 +31,5 @@ export const SelectTokenButton = ({ formType, compact }) => {
|
|
|
32
31
|
const defaultTitle = formType === 'to' && variant === 'refuel'
|
|
33
32
|
? t(`header.selectChain`)
|
|
34
33
|
: t(`swap.selectChainAndToken`);
|
|
35
|
-
return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? _jsx(TokenAvatar, { token: token, chain: chain }) :
|
|
34
|
+
return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(TokenAvatarSkeleton, {})), title: isSelected ? token.symbol : defaultTitle, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] })));
|
|
36
35
|
};
|
|
@@ -12,7 +12,7 @@ export const SelectTokenCardHeader = styled(CardHeader, {
|
|
|
12
12
|
textOverflow: 'ellipsis',
|
|
13
13
|
whiteSpace: 'nowrap',
|
|
14
14
|
overflow: 'hidden',
|
|
15
|
-
width: compact ? (selected ? 92 : 142) :
|
|
15
|
+
width: compact ? (selected ? 92 : 142) : 256,
|
|
16
16
|
fontWeight: selected ? 500 : 400,
|
|
17
17
|
fontSize: compact && !selected ? '1rem' : '1.125rem',
|
|
18
18
|
},
|
|
@@ -20,6 +20,6 @@ export const SelectTokenCardHeader = styled(CardHeader, {
|
|
|
20
20
|
textOverflow: 'ellipsis',
|
|
21
21
|
whiteSpace: 'nowrap',
|
|
22
22
|
overflow: 'hidden',
|
|
23
|
-
width: compact ? 92 :
|
|
23
|
+
width: compact ? 92 : 256,
|
|
24
24
|
},
|
|
25
25
|
}));
|
|
@@ -40,12 +40,12 @@ export const StepActions = (_a) => {
|
|
|
40
40
|
: step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
|
|
41
41
|
};
|
|
42
42
|
export const StepDetailsContent = ({ step }) => {
|
|
43
|
-
var _a, _b;
|
|
43
|
+
var _a, _b, _c, _d, _e;
|
|
44
44
|
const { t } = useTranslation();
|
|
45
45
|
return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
|
|
46
46
|
value: formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals),
|
|
47
47
|
}), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
48
|
-
value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, step.action.toToken.decimals),
|
|
48
|
+
value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
|
|
49
49
|
}), ' ', step.action.toToken.symbol] })));
|
|
50
50
|
};
|
|
51
51
|
export const CrossStepDetailsLabel = ({ step }) => {
|
|
@@ -16,7 +16,7 @@ export const FormPriceHelperText = ({ formType, selected }) => {
|
|
|
16
16
|
});
|
|
17
17
|
const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
|
|
18
18
|
const fromAmountTokenPrice = formatTokenPrice(amount, token === null || token === void 0 ? void 0 : token.priceUSD);
|
|
19
|
-
return (_jsxs(FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [_jsx(Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft:
|
|
19
|
+
return (_jsxs(FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [_jsx(Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: 8, lineHeight: 1.3334, flex: 1, sx: {
|
|
20
20
|
wordBreak: 'break-word',
|
|
21
21
|
overflowWrap: 'break-word',
|
|
22
22
|
} }, { children: t(`format.currency`, {
|
|
@@ -7,7 +7,7 @@ import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
|
|
|
7
7
|
import { DisabledUI } from '../../types';
|
|
8
8
|
import { fitInputText, formatAmount } from '../../utils';
|
|
9
9
|
import { Card, CardTitle } from '../Card';
|
|
10
|
-
import { TokenAvatar } from '../TokenAvatar';
|
|
10
|
+
import { TokenAvatar, TokenAvatarSkeleton } from '../TokenAvatar';
|
|
11
11
|
import { FormPriceHelperText } from './FormPriceHelperText';
|
|
12
12
|
import { FormControl, Input, maxInputFontSize, minInputFontSize, } from './SwapInput.style';
|
|
13
13
|
import { SwapInputAdornment } from './SwapInputAdornment';
|
|
@@ -43,7 +43,7 @@ export const SwapInput = ({ formType }) => {
|
|
|
43
43
|
fitInputText(maxInputFontSize, minInputFontSize, ref.current);
|
|
44
44
|
}, [amount]);
|
|
45
45
|
const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromAmount);
|
|
46
|
-
return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) :
|
|
46
|
+
return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : (_jsx(TokenAvatarSkeleton, { sx: { marginLeft: 2 } })), endAdornment: !disabled ? _jsx(SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
|
|
47
47
|
inputMode: 'decimal',
|
|
48
48
|
}, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, disabled: disabled, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
|
|
49
49
|
};
|
|
@@ -34,7 +34,8 @@ export const SwapRouteCard = (_a) => {
|
|
|
34
34
|
e.stopPropagation();
|
|
35
35
|
setCardExpanded((expanded) => !expanded);
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] }))) : null, _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
38
|
+
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: cardContent })));
|
|
38
39
|
};
|
|
39
40
|
export const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
40
41
|
var _a;
|
|
@@ -16,5 +16,6 @@ import { Card } from '../Card';
|
|
|
16
16
|
export const SwapRouteCardSkeleton = (_a) => {
|
|
17
17
|
var { variant } = _a, other = __rest(_a, ["variant"]);
|
|
18
18
|
const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
|
|
19
|
-
|
|
19
|
+
const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, _jsxs(Box, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
|
|
20
|
+
return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: cardContent })));
|
|
20
21
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Step, TokenAmount } from '@lifi/sdk';
|
|
3
3
|
import type { BoxProps } from '@mui/material';
|
|
4
|
-
|
|
4
|
+
interface TokenProps {
|
|
5
5
|
token: TokenAmount;
|
|
6
6
|
connected?: boolean;
|
|
7
7
|
step?: Step;
|
|
8
|
-
|
|
8
|
+
disableDescription?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Token: React.FC<TokenProps & BoxProps>;
|
|
11
|
+
export {};
|
|
@@ -9,28 +9,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
13
|
-
import { Box
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Box } from '@mui/material';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useChain } from '../../hooks';
|
|
16
|
-
import { formatTokenAmount } from '../../utils';
|
|
16
|
+
import { formatTokenAmount, formatTokenPrice } from '../../utils';
|
|
17
17
|
import { SmallAvatar } from '../SmallAvatar';
|
|
18
18
|
import { TextFitter } from '../TextFitter';
|
|
19
19
|
import { TokenAvatar } from '../TokenAvatar';
|
|
20
20
|
import { TextSecondary, TextSecondaryContainer } from './Token.style';
|
|
21
21
|
export const Token = (_a) => {
|
|
22
|
-
var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
|
|
22
|
+
var { token, connected, step, disableDescription } = _a, other = __rest(_a, ["token", "connected", "step", "disableDescription"]);
|
|
23
23
|
const { t } = useTranslation();
|
|
24
24
|
const { chain } = useChain(token.chainId);
|
|
25
|
+
const formattedTokenAmount = formatTokenAmount(token.amount, token.decimals);
|
|
26
|
+
const formattedTokenPrice = formatTokenPrice(formattedTokenAmount, token.priceUSD);
|
|
25
27
|
return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
|
|
26
28
|
fontWeight: 700,
|
|
27
29
|
} }, { children: t('format.number', {
|
|
28
|
-
value:
|
|
29
|
-
}) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`
|
|
30
|
+
value: formattedTokenAmount,
|
|
31
|
+
}) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`format.currency`, {
|
|
32
|
+
value: formattedTokenPrice,
|
|
33
|
+
}) })), !disableDescription ? (_jsx(TextSecondary, Object.assign({ connected: connected, px: 0.5, dot: true }, { children: "\u2022" }))) : null, !step && !disableDescription ? (_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
30
34
|
tokenSymbol: token.symbol,
|
|
31
35
|
chainName: chain === null || chain === void 0 ? void 0 : chain.name,
|
|
32
|
-
}) })), step ? (_jsxs(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
}) }))) : null, step ? (_jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
37
|
+
border: 0,
|
|
38
|
+
marginBottom: -0.25,
|
|
39
|
+
} }, { children: step.toolDetails.name[0] })) })), _jsx(TextSecondary, Object.assign({ connected: true }, { children: step.toolDetails.name }))] }))) : null] }))] })));
|
|
36
40
|
};
|
|
@@ -23,6 +23,7 @@ export declare const TextSecondary: import("@emotion/styled").StyledComponent<im
|
|
|
23
23
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
24
24
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
25
25
|
connected?: boolean | undefined;
|
|
26
|
+
dot?: boolean | undefined;
|
|
26
27
|
}, {}, {}>;
|
|
27
28
|
export declare const TokenDivider: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
28
29
|
children?: import("react").ReactNode;
|
|
@@ -19,12 +19,12 @@ export const TextSecondaryContainer = styled(Box, {
|
|
|
19
19
|
flexWrap: 'wrap',
|
|
20
20
|
}));
|
|
21
21
|
export const TextSecondary = styled(Typography, {
|
|
22
|
-
shouldForwardProp: (prop) =>
|
|
23
|
-
})(({ theme, connected }) => ({
|
|
22
|
+
shouldForwardProp: (prop) => !['connected', 'dot'].includes(prop),
|
|
23
|
+
})(({ theme, connected, dot }) => ({
|
|
24
24
|
fontSize: 12,
|
|
25
25
|
lineHeight: 1,
|
|
26
26
|
fontWeight: 500,
|
|
27
|
-
color: theme.palette.text.secondary,
|
|
27
|
+
color: dot ? theme.palette.grey[400] : theme.palette.text.secondary,
|
|
28
28
|
marginTop: connected ? 0 : theme.spacing(0.5),
|
|
29
29
|
}));
|
|
30
30
|
export const TokenDivider = styled(Box)(({ theme }) => ({
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Avatar, Badge } from '@mui/material';
|
|
3
3
|
import { useChain, useToken } from '../../hooks';
|
|
4
4
|
import { SmallAvatar } from '../SmallAvatar';
|
|
5
|
+
import { AvatarSkeleton, AvatarSkeletonContainer } from './TokenAvatar.style';
|
|
5
6
|
export const TokenAvatarFallback = ({ token, sx }) => {
|
|
6
7
|
const { chain } = useChain(token.chainId);
|
|
7
8
|
const { token: chainToken } = useToken(token.chainId, token.address);
|
|
@@ -16,3 +17,6 @@ export const TokenAvatar = ({ token, chain, sx }) => {
|
|
|
16
17
|
}
|
|
17
18
|
return _jsx(TokenAvatarBase, { token: token, chain: chain, sx: sx });
|
|
18
19
|
};
|
|
20
|
+
export const TokenAvatarSkeleton = ({ sx }) => {
|
|
21
|
+
return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(AvatarSkeleton, { width: 16, height: 16 }), sx: sx }, { children: _jsx(AvatarSkeletonContainer, { children: _jsx(AvatarSkeleton, { width: 28, height: 28 }) }) })));
|
|
22
|
+
};
|
|
@@ -1 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const TokenAvatarGroup: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
3
|
+
export declare const AvatarSkeleton: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
component?: import("react").ElementType<any> | undefined;
|
|
6
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
7
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
9
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
10
|
+
}, 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>, {}, {}>;
|
|
11
|
+
export declare const AvatarSkeletonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
12
|
+
children?: import("react").ReactNode;
|
|
13
|
+
component?: import("react").ElementType<any> | undefined;
|
|
14
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
15
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
16
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
17
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
18
|
+
}, 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>, {}, {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AvatarGroup } from '@mui/material';
|
|
1
|
+
import { AvatarGroup, Box } from '@mui/material';
|
|
2
2
|
import { avatarClasses } from '@mui/material/Avatar';
|
|
3
3
|
import { badgeClasses } from '@mui/material/Badge';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
@@ -11,3 +11,16 @@ export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
|
|
|
11
11
|
marginLeft: theme.spacing(1),
|
|
12
12
|
},
|
|
13
13
|
}));
|
|
14
|
+
export const AvatarSkeleton = styled(Box)(({ theme }) => ({
|
|
15
|
+
background: theme.palette.mode === 'light'
|
|
16
|
+
? theme.palette.grey[300]
|
|
17
|
+
: theme.palette.grey[800],
|
|
18
|
+
border: `2px solid ${theme.palette.background.paper}`,
|
|
19
|
+
borderRadius: '50%',
|
|
20
|
+
}));
|
|
21
|
+
export const AvatarSkeletonContainer = styled(Box)(({ theme }) => ({
|
|
22
|
+
border: `2px solid ${theme.palette.mode === 'light'
|
|
23
|
+
? theme.palette.grey[300]
|
|
24
|
+
: theme.palette.grey[800]}`,
|
|
25
|
+
borderRadius: '50%',
|
|
26
|
+
}));
|
|
@@ -27,6 +27,12 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
|
|
|
27
27
|
componentsProps?: {
|
|
28
28
|
root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
|
|
29
29
|
} | undefined;
|
|
30
|
+
slotProps?: {
|
|
31
|
+
root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
slots?: {
|
|
34
|
+
root?: import("react").ElementType<any> | undefined;
|
|
35
|
+
} | undefined;
|
|
30
36
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
|
|
31
37
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
32
|
-
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
38
|
+
}, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "slotProps" | "slots" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
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.23.1";
|
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.23.1';
|
|
@@ -69,7 +69,6 @@ export const useGasSufficiency = (route) => {
|
|
|
69
69
|
return gasCostResult;
|
|
70
70
|
}), {
|
|
71
71
|
enabled: Boolean(account.address && route),
|
|
72
|
-
refetchIntervalInBackground: true,
|
|
73
72
|
refetchInterval,
|
|
74
73
|
staleTime: refetchInterval,
|
|
75
74
|
cacheTime: refetchInterval,
|
|
@@ -99,7 +98,6 @@ export const useGasSufficiency = (route) => {
|
|
|
99
98
|
return insufficientFunds;
|
|
100
99
|
}), {
|
|
101
100
|
enabled: Boolean(account.address && route && fromToken),
|
|
102
|
-
refetchIntervalInBackground: true,
|
|
103
101
|
refetchInterval,
|
|
104
102
|
staleTime: refetchInterval,
|
|
105
103
|
cacheTime: refetchInterval,
|
package/hooks/useInitializer.js
CHANGED
|
@@ -3,9 +3,13 @@ import { checkPackageUpdates } from '@lifi/sdk';
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { name, version } from '../config/version';
|
|
5
5
|
import { useTools } from './useTools';
|
|
6
|
+
let checkedPackageUpdates = false;
|
|
6
7
|
export const useInitializer = () => {
|
|
7
8
|
useTools();
|
|
8
9
|
useEffect(() => {
|
|
9
|
-
|
|
10
|
+
if (!checkedPackageUpdates) {
|
|
11
|
+
checkedPackageUpdates = true;
|
|
12
|
+
checkPackageUpdates(name, version);
|
|
13
|
+
}
|
|
10
14
|
}, []);
|
|
11
15
|
};
|
package/hooks/useSwapRoutes.js
CHANGED
package/hooks/useTokenBalance.js
CHANGED
|
@@ -70,7 +70,6 @@ export const useTokenBalance = (token, accountAddress) => {
|
|
|
70
70
|
return Object.assign(Object.assign({}, tokenBalances[0]), { amount: formattedAmount });
|
|
71
71
|
}), {
|
|
72
72
|
enabled: Boolean(walletAddress && token),
|
|
73
|
-
refetchIntervalInBackground: true,
|
|
74
73
|
refetchInterval: defaultRefetchInterval,
|
|
75
74
|
staleTime: defaultRefetchInterval,
|
|
76
75
|
});
|
package/hooks/useTools.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useSettingsStore } from '../stores';
|
|
|
5
5
|
export const useTools = () => {
|
|
6
6
|
const lifi = useLiFi();
|
|
7
7
|
const { bridges, exchanges } = useWidgetConfig();
|
|
8
|
-
const { data } = useQuery(['tools'], (
|
|
8
|
+
const { data } = useQuery(['tools'], () => lifi.getTools(), {
|
|
9
9
|
onSuccess(data) {
|
|
10
10
|
const { initializeTools } = useSettingsStore.getState();
|
|
11
11
|
initializeTools('Bridges', data.bridges
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.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
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@ethersproject/experimental": "^5.7.0",
|
|
44
44
|
"@ethersproject/providers": "^5.7.2",
|
|
45
45
|
"@lifi/sdk": "^1.6.3",
|
|
46
|
-
"@lifi/wallet-management": "^1.1.
|
|
46
|
+
"@lifi/wallet-management": "^1.1.13",
|
|
47
47
|
"@mui/icons-material": "^5.10.9",
|
|
48
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
49
|
-
"@mui/material": "^5.10.
|
|
50
|
-
"@sentry/integrations": "^7.
|
|
51
|
-
"@sentry/react": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.
|
|
48
|
+
"@mui/lab": "^5.0.0-alpha.107",
|
|
49
|
+
"@mui/material": "^5.10.13",
|
|
50
|
+
"@sentry/integrations": "^7.18.0",
|
|
51
|
+
"@sentry/react": "^7.18.0",
|
|
52
|
+
"@sentry/tracing": "^7.18.0",
|
|
53
53
|
"@tanstack/react-query": "^4.14.5",
|
|
54
|
-
"@tanstack/react-virtual": "^3.0.0-beta.
|
|
54
|
+
"@tanstack/react-virtual": "^3.0.0-beta.22",
|
|
55
55
|
"big.js": "^6.2.1",
|
|
56
56
|
"i18next": "^22.0.4",
|
|
57
57
|
"i18next-browser-languagedetector": "^7.0.1",
|
|
@@ -53,10 +53,12 @@ export const SwapDetailsPage = () => {
|
|
|
53
53
|
}, pb: 1 }, { children: [_jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), _jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
|
|
54
54
|
timeStyle: 'short',
|
|
55
55
|
}).format(startedAt) }))] })), routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.map((step, index, steps) => {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
var _a, _b, _c, _d, _e;
|
|
57
|
+
const fromToken = index === 0
|
|
58
|
+
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
|
|
59
|
+
const toToken = index === steps.length - 1
|
|
60
|
+
? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
|
|
61
|
+
return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
|
|
60
62
|
}), _jsxs(Card, Object.assign({ mt: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
61
63
|
display: 'flex',
|
|
62
64
|
flex: 1,
|
|
@@ -76,5 +76,5 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
76
76
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
|
|
77
77
|
}
|
|
78
78
|
}, [refetch, refetchNewBalance, status]);
|
|
79
|
-
return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
79
|
+
return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? _jsx(InfoIcon, { color: "primary" }) : null, status === 'success' ? _jsx(DoneIcon, { color: "success" }) : null, status === 'error' ? _jsx(WarningIcon, { color: "error" }) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? (_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1, disableDescription: true })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: message })), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
80
80
|
};
|
|
@@ -68,10 +68,12 @@ export const SwapPage = () => {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
return (_jsxs(Container, { children: [route === null || route === void 0 ? void 0 : route.steps.map((step, index, steps) => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
var _a, _b, _c, _d, _e;
|
|
72
|
+
const fromToken = index === 0
|
|
73
|
+
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined;
|
|
74
|
+
const toToken = index === steps.length - 1
|
|
75
|
+
? Object.assign(Object.assign({}, ((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toToken) !== null && _b !== void 0 ? _b : (_c = step.action) === null || _c === void 0 ? void 0 : _c.toToken)), { amount: (_e = (_d = step.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : step.estimate.toAmount }) : undefined;
|
|
76
|
+
return (_jsxs(Fragment, { children: [_jsx(Step, { step: step, fromToken: fromToken, toToken: toToken }), steps.length > 1 && index !== steps.length - 1 ? (_jsx(StepDivider, {})) : null] }, step.id));
|
|
75
77
|
}), status === 'idle' || status === 'error' ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, Object.assign({ mt: 2, display: "flex" }, { children: [_jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route,
|
|
76
78
|
// disable={status === 'idle' && (isValidating || !isValid)}
|
|
77
79
|
enableLoading: true }), status === 'error' ? (_jsx(Tooltip, Object.assign({ title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ onClick: handleRemoveRoute, sx: {
|