@lifi/widget 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppRoutes.js +1 -2
- package/cjs/AppRoutes.js +1 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/Header/Header.style.d.ts +1 -1
- package/cjs/components/Header/NavigationHeader.js +3 -2
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +4 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/StepActions/StepActions.js +2 -2
- package/cjs/components/SwapButton/SwapButton.js +9 -4
- package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
- package/cjs/components/SwapInput/SwapInput.js +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- 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 +8 -0
- package/cjs/components/TokenAvatar/TokenAvatar.js +12 -3
- 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/useSwapRoutes.js +0 -1
- package/cjs/hooks/useTokenBalance.js +0 -1
- package/cjs/hooks/useTokenBalances.js +0 -1
- package/cjs/i18n/en.json +5 -0
- package/cjs/i18n/es.json +1 -0
- package/cjs/i18n/fr.json +2 -2
- package/cjs/i18n/uk.json +5 -5
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/cjs/pages/SelectChainPage/SelectChainPage.js +12 -5
- package/cjs/pages/SelectChainPage/types.d.ts +4 -0
- package/cjs/pages/SelectChainPage/types.js +2 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
- package/cjs/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/SwapPage.js +7 -7
- package/cjs/utils/input.js +3 -1
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +7 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/Header/Header.style.d.ts +1 -1
- package/components/Header/NavigationHeader.js +4 -3
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +5 -3
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -2
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/StepActions/StepActions.js +2 -2
- package/components/SwapButton/SwapButton.js +9 -4
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.js +2 -2
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
- package/components/SwapRouteCard/SwapRouteCard.js +2 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- 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 +8 -0
- package/components/TokenAvatar/TokenAvatar.js +9 -2
- 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/useSwapRoutes.js +0 -1
- package/hooks/useTokenBalance.js +0 -1
- package/hooks/useTokenBalances.js +0 -1
- package/i18n/en.json +5 -0
- package/i18n/es.json +1 -0
- package/i18n/fr.json +2 -2
- package/i18n/uk.json +5 -5
- package/package.json +14 -14
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/pages/SelectChainPage/SelectChainPage.js +12 -5
- package/pages/SelectChainPage/types.d.ts +4 -0
- package/pages/SelectChainPage/types.js +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -4
- package/pages/SwapPage/StatusBottomSheet.js +1 -1
- package/pages/SwapPage/SwapPage.js +7 -7
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/input.js +3 -1
|
@@ -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();
|
|
@@ -29,5 +28,8 @@ export const SelectTokenButton = ({ formType, compact }) => {
|
|
|
29
28
|
};
|
|
30
29
|
const isSelected = !!(chain && token);
|
|
31
30
|
const onClick = !(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(tokenKey)) ? handleClick : undefined;
|
|
32
|
-
|
|
31
|
+
const defaultTitle = formType === 'to' && variant === 'refuel'
|
|
32
|
+
? t(`header.selectChain`)
|
|
33
|
+
: t(`swap.selectChainAndToken`);
|
|
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 }))] })));
|
|
33
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
|
}));
|
|
@@ -36,4 +36,4 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
|
36
36
|
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
|
|
37
37
|
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof import("react").AnchorHTMLAttributes<HTMLAnchorElement>> & {
|
|
38
38
|
ref?: ((instance: HTMLAnchorElement | null) => void) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
|
|
39
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "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" | "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">, {}, {}>;
|
|
39
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "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" | "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">, {}, {}>;
|
|
@@ -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 }) => {
|
|
@@ -18,12 +18,12 @@ import { navigationRoutes } from '../../utils';
|
|
|
18
18
|
export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
const navigate = useNavigate();
|
|
21
|
-
const
|
|
21
|
+
const { variant, walletManagement } = useWidgetConfig();
|
|
22
22
|
const { account, connect } = useWallet();
|
|
23
23
|
const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
|
|
24
24
|
const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
if (!account.isActive) {
|
|
26
|
-
if (
|
|
26
|
+
if (walletManagement) {
|
|
27
27
|
yield connect();
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -37,9 +37,14 @@ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, en
|
|
|
37
37
|
const getButtonText = () => {
|
|
38
38
|
if (account.isActive) {
|
|
39
39
|
if (!currentRoute) {
|
|
40
|
-
return t(`button.swap`);
|
|
40
|
+
return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
if (text) {
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
return variant !== 'refuel'
|
|
46
|
+
? t(`button.reviewSwap`)
|
|
47
|
+
: t(`button.startSwap`);
|
|
43
48
|
}
|
|
44
49
|
return t(`button.connectWallet`);
|
|
45
50
|
};
|
|
@@ -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 }) => ({
|
|
@@ -5,8 +5,16 @@ export declare const TokenAvatarFallback: React.FC<{
|
|
|
5
5
|
token: Token;
|
|
6
6
|
sx?: SxProps<Theme>;
|
|
7
7
|
}>;
|
|
8
|
+
export declare const TokenAvatarBase: React.FC<{
|
|
9
|
+
token: Token;
|
|
10
|
+
chain?: Chain;
|
|
11
|
+
sx?: SxProps<Theme>;
|
|
12
|
+
}>;
|
|
8
13
|
export declare const TokenAvatar: React.FC<{
|
|
9
14
|
token: Token;
|
|
10
15
|
chain?: Chain;
|
|
11
16
|
sx?: SxProps<Theme>;
|
|
12
17
|
}>;
|
|
18
|
+
export declare const TokenAvatarSkeleton: React.FC<{
|
|
19
|
+
sx?: SxProps<Theme>;
|
|
20
|
+
}>;
|
|
@@ -2,14 +2,21 @@ 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);
|
|
8
|
-
return _jsx(
|
|
9
|
+
return _jsx(TokenAvatarBase, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, chain: chain, sx: sx });
|
|
10
|
+
};
|
|
11
|
+
export const TokenAvatarBase = ({ token, chain, sx }) => {
|
|
12
|
+
return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? (_jsx(SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) })));
|
|
9
13
|
};
|
|
10
14
|
export const TokenAvatar = ({ token, chain, sx }) => {
|
|
11
15
|
if (!chain || !token.logoURI) {
|
|
12
16
|
return _jsx(TokenAvatarFallback, { token: token, sx: sx });
|
|
13
17
|
}
|
|
14
|
-
return
|
|
18
|
+
return _jsx(TokenAvatarBase, { token: token, chain: chain, sx: sx });
|
|
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 }) }) })));
|
|
15
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.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.23.0';
|
|
@@ -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/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/i18n/en.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"delete": "Delete",
|
|
11
11
|
"disconnectWallet": "Disconnect wallet",
|
|
12
12
|
"done": "Done",
|
|
13
|
+
"getGas": "Get gas",
|
|
13
14
|
"hide": "Hide",
|
|
14
15
|
"lifiSwap": "LI.FI Swap",
|
|
15
16
|
"light": "Light",
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"reviewSwap": "Review swap",
|
|
22
23
|
"seeDetails": "See details",
|
|
23
24
|
"showAll": "Show all",
|
|
25
|
+
"startGasSwap": "Start gas swap",
|
|
24
26
|
"startSwap": "Start swap",
|
|
25
27
|
"swap": "Swap",
|
|
26
28
|
"tryAgain": "Try again"
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
"header": {
|
|
33
35
|
"activeSwaps": "Active swaps",
|
|
34
36
|
"from": "Swap from",
|
|
37
|
+
"gas": "Gas",
|
|
38
|
+
"gasSwap": "Gas swap",
|
|
35
39
|
"routes": "You get",
|
|
36
40
|
"selectChain": "Select chain",
|
|
37
41
|
"selectWallet": "Select your wallet",
|
|
@@ -147,6 +151,7 @@
|
|
|
147
151
|
"swapSuccessful": "There are now {{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}} in wallet {{walletAddress}} on {{chainName}} chain."
|
|
148
152
|
},
|
|
149
153
|
"title": {
|
|
154
|
+
"gasSwapSuccessful": "Gas swap successful",
|
|
150
155
|
"swapSuccessful": "Swap successful"
|
|
151
156
|
}
|
|
152
157
|
},
|
package/i18n/es.json
CHANGED
package/i18n/fr.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"slippage": "Effet de glissement"
|
|
65
65
|
},
|
|
66
66
|
"swap": {
|
|
67
|
-
"crossStepDetails": "Passer de {{
|
|
67
|
+
"crossStepDetails": "Passer de {{from}} à {{to}} via {{tool}}",
|
|
68
68
|
"error": {
|
|
69
69
|
"message": {
|
|
70
70
|
"slippageTooLarge": "Le glissement est plus important que le seuil défini. Veuillez demander un nouvel itinéraire pour obtenir un nouveau devis.",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
"supportId": "ID de support",
|
|
153
|
-
"swapStepDetails": "Echanger sur {{
|
|
153
|
+
"swapStepDetails": "Echanger sur {{chain}} via {{tool}}",
|
|
154
154
|
"swapping": "Échanger",
|
|
155
155
|
"tags": {
|
|
156
156
|
"ALTERNATIVE": "ALTERNATIVE",
|
package/i18n/uk.json
CHANGED
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"message": {
|
|
70
70
|
"slippageTooLarge": "Прослизання більше визначеного порогу. Будь ласка, оберіть новий маршрут, щоб отримати свіжу пропозицію.",
|
|
71
71
|
"transactionFailed": "Будь ласка, перевірте провідник блоків для отримання додаткової інформації.",
|
|
72
|
-
"transactionNotSent": "Транзакція не була відправлена, ваші кошти все ще знаходяться у вашому гаманці ({{amount}}{{tokenSymbol}} на {{chainName}}).",
|
|
73
|
-
"transactionRejected": "Для завершення транзакції потрібен ваш підпис. {{amount}} {{tokenSymbol}} на {{chainName}} залишаються у вашому гаманці."
|
|
72
|
+
"transactionNotSent": "Транзакція не була відправлена, ваші кошти все ще знаходяться у вашому гаманці ({{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}} на {{chainName}}).",
|
|
73
|
+
"transactionRejected": "Для завершення транзакції потрібен ваш підпис. {{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}} на {{chainName}} залишаються у вашому гаманці."
|
|
74
74
|
},
|
|
75
75
|
"title": {
|
|
76
76
|
"chainSwitch": "Потрібно переключити чейн.",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"stepSwapAndBridge": "Своп і міст",
|
|
145
145
|
"success": {
|
|
146
146
|
"message": {
|
|
147
|
-
"swapSuccessful": "Зараз у гаманці {{walletAddress}} на чейні {{chainName}} є {{amount}} {{tokenSymbol}}."
|
|
147
|
+
"swapSuccessful": "Зараз у гаманці {{walletAddress}} на чейні {{chainName}} є {{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}}."
|
|
148
148
|
},
|
|
149
149
|
"title": {
|
|
150
150
|
"swapSuccessful": "Своп успішний"
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
},
|
|
163
163
|
"to": "До",
|
|
164
164
|
"tokenOnChain": "{{tokenSymbol}} на {{chainName}}",
|
|
165
|
-
"tokenOnChainAmount": "{{amount}}{{tokenSymbol}} на {{chainName}}",
|
|
165
|
+
"tokenOnChainAmount": "{{amount, number(maximumFractionDigits: 4)}} {{tokenSymbol}} на {{chainName}}",
|
|
166
166
|
"tokenSearch": "Знайдіть свій токен",
|
|
167
167
|
"valueLoss": "Втрата вартості",
|
|
168
168
|
"walletAddressOrEns": "Адреса гаманця або ім’я ENS",
|
|
@@ -195,6 +195,6 @@
|
|
|
195
195
|
"settingsModified": "Налаштування (змінено)"
|
|
196
196
|
},
|
|
197
197
|
"wallet": {
|
|
198
|
-
"extensionNotFound": "Перш ніж вибрати цей гаманець, переконайтеся, що в браузері активне лише розширення {{name}}
|
|
198
|
+
"extensionNotFound": "Перш ніж вибрати цей гаманець, переконайтеся, що в браузері активне лише розширення {{name}}."
|
|
199
199
|
}
|
|
200
200
|
}
|