@lifi/widget 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppDrawer.style.d.ts +1 -1
- package/AppProvider.js +2 -4
- package/AppRoutes.js +5 -0
- package/cjs/AppDrawer.style.d.ts +1 -1
- package/cjs/AppProvider.js +1 -3
- package/cjs/AppRoutes.js +5 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/ChainSelect/ChainSelect.js +1 -3
- package/cjs/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/cjs/components/Header/Header.style.d.ts +34 -1
- package/cjs/components/Header/Header.style.js +19 -1
- package/cjs/components/Header/NavigationHeader.js +4 -1
- package/cjs/components/Header/WalletHeader.js +34 -9
- package/cjs/components/Menu.d.ts +1 -0
- package/cjs/components/Menu.js +24 -0
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SelectChainAndToken.js +6 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +8 -6
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
- package/cjs/components/SendToWallet/SendToWallet.js +5 -0
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +5 -1
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/Step/StepProcess.style.d.ts +2 -2
- package/cjs/components/Step/StepTimer.js +1 -1
- package/cjs/components/StepActions/StepActions.js +6 -1
- package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
- package/cjs/components/SwapInput/SwapInput.js +5 -2
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +0 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -3
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +8 -3
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/cjs/components/Token/Token.js +6 -5
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +6 -1
- package/cjs/components/TokenAvatar/TokenAvatar.js +10 -3
- package/cjs/components/TokenList/TokenList.js +2 -23
- package/cjs/components/TokenList/TokenListItem.d.ts +2 -1
- package/cjs/components/TokenList/TokenListItem.js +12 -6
- package/cjs/components/TokenList/index.d.ts +1 -0
- package/cjs/components/TokenList/index.js +1 -0
- package/cjs/components/TokenList/types.d.ts +6 -0
- package/cjs/components/TokenList/useTokenSelect.d.ts +2 -0
- package/cjs/components/TokenList/useTokenSelect.js +33 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChain.d.ts +2 -2
- package/cjs/hooks/useChains.d.ts +2 -2
- package/cjs/hooks/useExpandableVariant.js +3 -5
- package/cjs/hooks/useProcessMessage.d.ts +2 -2
- package/cjs/hooks/useSwapRoutes.js +11 -7
- package/cjs/i18n/de.json +199 -0
- package/cjs/i18n/en.json +157 -151
- package/cjs/i18n/es.json +199 -0
- package/cjs/i18n/fr.json +199 -0
- package/cjs/i18n/index.d.ts +8 -200
- package/cjs/i18n/index.js +15 -19
- package/cjs/i18n/it.json +199 -0
- package/cjs/i18n/uk.json +200 -0
- package/cjs/i18n/zh.json +199 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +1 -1
- package/cjs/pages/SelectChainPage/SelectChainPage.js +2 -5
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +21 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +20 -0
- package/cjs/pages/SelectNativeTokenPage/index.d.ts +1 -0
- package/cjs/pages/SelectNativeTokenPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/LanguageSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/LanguageSelect.js +38 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +6 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
- package/cjs/providers/I18nProvider/I18nProvider.d.ts +2 -0
- package/cjs/providers/I18nProvider/I18nProvider.js +62 -0
- package/cjs/providers/I18nProvider/index.d.ts +2 -0
- package/cjs/providers/I18nProvider/index.js +18 -0
- package/cjs/providers/I18nProvider/types.d.ts +16 -0
- package/cjs/providers/I18nProvider/types.js +2 -0
- package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
- package/cjs/providers/WidgetProvider/utils.js +4 -4
- package/cjs/providers/index.d.ts +1 -0
- package/cjs/providers/index.js +1 -0
- package/cjs/stores/settings/types.d.ts +1 -0
- package/cjs/stores/settings/useSettingsStore.d.ts +2 -0
- package/cjs/types/widget.d.ts +24 -7
- package/cjs/types/widget.js +8 -0
- package/cjs/utils/deepMerge.d.ts +1 -0
- package/cjs/utils/deepMerge.js +18 -0
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/navigationRoutes.d.ts +8 -7
- package/cjs/utils/navigationRoutes.js +10 -7
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/ChainSelect/ChainSelect.js +1 -3
- package/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/components/Header/Header.style.d.ts +34 -1
- package/components/Header/Header.style.js +19 -1
- package/components/Header/NavigationHeader.js +4 -1
- package/components/Header/WalletHeader.js +37 -12
- package/components/Menu.d.ts +1 -0
- package/components/Menu.js +21 -0
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SelectChainAndToken.js +7 -2
- package/components/SelectTokenButton/SelectTokenButton.js +9 -7
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
- package/components/SendToWallet/SendToWallet.js +6 -1
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +6 -2
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/Step/StepProcess.style.d.ts +2 -2
- package/components/Step/StepTimer.js +1 -1
- package/components/StepActions/StepActions.js +6 -1
- package/components/SwapInput/FormPriceHelperText.js +4 -4
- package/components/SwapInput/SwapInput.js +6 -3
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +5 -3
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/components/SwapRoutes/SwapRoutes.js +8 -3
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/components/Token/Token.js +7 -6
- package/components/TokenAvatar/TokenAvatar.d.ts +6 -1
- package/components/TokenAvatar/TokenAvatar.js +8 -2
- package/components/TokenList/TokenList.js +4 -25
- package/components/TokenList/TokenListItem.d.ts +2 -1
- package/components/TokenList/TokenListItem.js +10 -5
- package/components/TokenList/index.d.ts +1 -0
- package/components/TokenList/index.js +1 -0
- package/components/TokenList/types.d.ts +6 -0
- package/components/TokenList/useTokenSelect.d.ts +2 -0
- package/components/TokenList/useTokenSelect.js +29 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChain.d.ts +2 -2
- package/hooks/useChains.d.ts +2 -2
- package/hooks/useExpandableVariant.js +3 -5
- package/hooks/useProcessMessage.d.ts +2 -2
- package/hooks/useSwapRoutes.js +12 -8
- package/i18n/de.json +199 -0
- package/i18n/en.json +157 -151
- package/i18n/es.json +199 -0
- package/i18n/fr.json +199 -0
- package/i18n/index.d.ts +8 -200
- package/i18n/index.js +8 -18
- package/i18n/it.json +199 -0
- package/i18n/uk.json +200 -0
- package/i18n/zh.json +199 -0
- package/package.json +18 -17
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/SelectChainPage/SelectChainPage.d.ts +1 -1
- package/pages/SelectChainPage/SelectChainPage.js +2 -5
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +17 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +17 -0
- package/pages/SelectNativeTokenPage/index.d.ts +1 -0
- package/pages/SelectNativeTokenPage/index.js +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/LanguageSelect.d.ts +2 -0
- package/pages/SettingsPage/LanguageSelect.js +34 -0
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.js +2 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/pages/SettingsPage/ShowDestinationWallet.js +6 -0
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
- package/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/pages/SwapPage/TokenValueBottomSheet.js +1 -1
- package/providers/I18nProvider/I18nProvider.d.ts +2 -0
- package/providers/I18nProvider/I18nProvider.js +58 -0
- package/providers/I18nProvider/index.d.ts +2 -0
- package/providers/I18nProvider/index.js +2 -0
- package/providers/I18nProvider/types.d.ts +16 -0
- package/providers/I18nProvider/types.js +1 -0
- package/providers/WidgetProvider/utils.d.ts +1 -1
- package/providers/WidgetProvider/utils.js +4 -4
- package/providers/index.d.ts +1 -0
- package/providers/index.js +1 -0
- package/stores/settings/types.d.ts +1 -0
- package/stores/settings/useSettingsStore.d.ts +2 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +24 -7
- package/types/widget.js +7 -1
- package/utils/deepMerge.d.ts +1 -0
- package/utils/deepMerge.js +14 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/navigationRoutes.d.ts +8 -7
- package/utils/navigationRoutes.js +10 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "
|
|
5
|
+
color?: "inherit" | "default" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -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" | "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" | "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">, {}, {}>;
|
|
@@ -48,7 +48,7 @@ const StepTimer = ({ step, hideInProgress, }) => {
|
|
|
48
48
|
]);
|
|
49
49
|
if (!isExecutionStarted) {
|
|
50
50
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: t('swap.estimatedTime', {
|
|
51
|
-
value: (step.estimate.executionDuration / 60)
|
|
51
|
+
value: Math.ceil(step.estimate.executionDuration / 60),
|
|
52
52
|
}) }));
|
|
53
53
|
}
|
|
54
54
|
const isTimerExpired = isExpired || (!minutes && !seconds);
|
|
@@ -45,7 +45,12 @@ const StepActions = (_a) => {
|
|
|
45
45
|
exports.StepActions = StepActions;
|
|
46
46
|
const StepDetailsContent = ({ step }) => {
|
|
47
47
|
var _a, _b;
|
|
48
|
-
|
|
48
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
|
|
50
|
+
value: (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals),
|
|
51
|
+
}), ' ', step.action.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
|
|
52
|
+
value: (0, utils_1.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),
|
|
53
|
+
}), ' ', step.action.toToken.symbol] })));
|
|
49
54
|
};
|
|
50
55
|
exports.StepDetailsContent = StepDetailsContent;
|
|
51
56
|
const CrossStepDetailsLabel = ({ step }) => {
|
|
@@ -22,10 +22,10 @@ const FormPriceHelperText = ({ formType, selected }) => {
|
|
|
22
22
|
return ((0, jsx_runtime_1.jsxs)(material_1.FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: selected ? 8 : 2, lineHeight: 1.3334, flex: 1, sx: {
|
|
23
23
|
wordBreak: 'break-word',
|
|
24
24
|
overflowWrap: 'break-word',
|
|
25
|
-
} }, { children: t(`
|
|
25
|
+
} }, { children: t(`format.currency`, {
|
|
26
26
|
value: fromAmountTokenPrice,
|
|
27
|
-
}) })), isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`
|
|
28
|
-
|
|
29
|
-
}) }))) : null] })));
|
|
27
|
+
}) })), isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: `/ ${t(`format.number`, {
|
|
28
|
+
value: token === null || token === void 0 ? void 0 : token.amount,
|
|
29
|
+
})}` }))) : null] })));
|
|
30
30
|
};
|
|
31
31
|
exports.FormPriceHelperText = FormPriceHelperText;
|
|
@@ -7,6 +7,7 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
7
7
|
const react_i18next_1 = require("react-i18next");
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
9
|
const providers_1 = require("../../providers");
|
|
10
|
+
const types_1 = require("../../types");
|
|
10
11
|
const utils_1 = require("../../utils");
|
|
11
12
|
const Card_1 = require("../Card");
|
|
12
13
|
const TokenAvatar_1 = require("../TokenAvatar");
|
|
@@ -16,6 +17,7 @@ const SwapInputAdornment_1 = require("./SwapInputAdornment");
|
|
|
16
17
|
const SwapInput = ({ formType }) => {
|
|
17
18
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
19
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
20
|
+
const { disabledUI } = (0, providers_1.useWidgetConfig)();
|
|
19
21
|
const ref = (0, react_1.useRef)(null);
|
|
20
22
|
const amountKey = providers_1.SwapFormKeyHelper.getAmountKey(formType);
|
|
21
23
|
const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
|
|
@@ -43,8 +45,9 @@ const SwapInput = ({ formType }) => {
|
|
|
43
45
|
(0, react_1.useLayoutEffect)(() => {
|
|
44
46
|
(0, utils_1.fitInputText)(SwapInput_style_1.maxInputFontSize, SwapInput_style_1.minInputFontSize, ref.current);
|
|
45
47
|
}, [amount]);
|
|
46
|
-
|
|
48
|
+
const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(types_1.DisabledUI.FromAmount);
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.fromAmount') }), (0, jsx_runtime_1.jsxs)(SwapInput_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SwapInput_style_1.Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : null, endAdornment: !disabled ? (0, jsx_runtime_1.jsx)(SwapInputAdornment_1.SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
|
|
47
50
|
inputMode: 'decimal',
|
|
48
|
-
}, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
|
|
51
|
+
}, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, disabled: disabled, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
|
|
49
52
|
};
|
|
50
53
|
exports.SwapInput = SwapInput;
|
|
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
|
|
|
4
4
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
6
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
-
color?: "
|
|
7
|
+
color?: "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "
|
|
5
|
+
color?: "inherit" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -17,6 +17,7 @@ const icons_material_1 = require("@mui/icons-material");
|
|
|
17
17
|
const material_1 = require("@mui/material");
|
|
18
18
|
const react_1 = require("react");
|
|
19
19
|
const react_i18next_1 = require("react-i18next");
|
|
20
|
+
const providers_1 = require("../../providers");
|
|
20
21
|
const Card_1 = require("../Card");
|
|
21
22
|
const StepActions_1 = require("../StepActions");
|
|
22
23
|
const Token_1 = require("../Token");
|
|
@@ -26,6 +27,7 @@ const SwapRouteCard = (_a) => {
|
|
|
26
27
|
var _b;
|
|
27
28
|
var { route, active, variant = 'default', expanded } = _a, other = __rest(_a, ["route", "active", "variant", "expanded"]);
|
|
28
29
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
30
|
+
const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
|
|
29
31
|
const [cardExpanded, setCardExpanded] = (0, react_1.useState)(variant === 'default' || expanded);
|
|
30
32
|
const alternativeTag = t(`swap.tags.ALTERNATIVE`);
|
|
31
33
|
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
@@ -35,7 +37,7 @@ const SwapRouteCard = (_a) => {
|
|
|
35
37
|
e.stopPropagation();
|
|
36
38
|
setCardExpanded((expanded) => !expanded);
|
|
37
39
|
};
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] }))) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
39
41
|
};
|
|
40
42
|
exports.SwapRouteCard = SwapRouteCard;
|
|
41
43
|
const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
@@ -48,8 +50,8 @@ const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
|
48
50
|
const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
|
|
49
51
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ component: "span" }, { children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => {
|
|
50
52
|
var _a;
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 11 }, { children: [(_a = gas.amount) === null || _a === void 0 ? void 0 : _a.toFixed(6), " ", gas.token.symbol, " (", t(`
|
|
52
|
-
})] })), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 11 }, { children: [(_a = gas.amount) === null || _a === void 0 ? void 0 : _a.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }), `${gas.token.address}${gas.token.symbol}`));
|
|
54
|
+
})] })), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`format.currency`, { value: gasCostUSD }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.AccessTime, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
|
|
53
55
|
value: executionTimeMinutes,
|
|
54
56
|
}) }))] })) })), !dense ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.LayersOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] })) }))) : null] })));
|
|
55
57
|
};
|
|
@@ -17,7 +17,7 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
|
|
|
17
17
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
18
18
|
children?: import("react").ReactNode;
|
|
19
19
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
20
|
-
color?: "inherit" | "default" | "
|
|
20
|
+
color?: "inherit" | "default" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
22
22
|
disableFocusRipple?: boolean | undefined;
|
|
23
23
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -14,9 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.SwapRouteCardSkeleton = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
const material_1 = require("@mui/material");
|
|
17
|
+
const providers_1 = require("../../providers");
|
|
17
18
|
const Card_1 = require("../Card");
|
|
18
19
|
const SwapRouteCardSkeleton = (_a) => {
|
|
19
20
|
var { variant } = _a, other = __rest(_a, ["variant"]);
|
|
20
|
-
|
|
21
|
+
const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
|
|
21
23
|
};
|
|
22
24
|
exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
|
|
@@ -11,11 +11,13 @@ const Card_1 = require("../../components/Card");
|
|
|
11
11
|
const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
|
|
12
12
|
const SwapRouteCard_1 = require("../../components/SwapRouteCard");
|
|
13
13
|
const hooks_1 = require("../../hooks");
|
|
14
|
+
const providers_1 = require("../../providers");
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
15
16
|
const SwapRoutes_style_1 = require("./SwapRoutes.style");
|
|
16
17
|
const useSetRecommendedRoute_1 = require("./useSetRecommendedRoute");
|
|
17
18
|
const SwapRoutes = (props) => {
|
|
18
19
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
20
|
+
const { variant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
|
|
19
21
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
20
22
|
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
21
23
|
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
@@ -28,14 +30,17 @@ const SwapRoutes = (props) => {
|
|
|
28
30
|
navigate(utils_1.navigationRoutes.swapRoutes);
|
|
29
31
|
};
|
|
30
32
|
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
33
|
+
const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
|
|
31
34
|
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
32
35
|
position: 'absolute',
|
|
33
36
|
top: 8,
|
|
34
37
|
right: 8,
|
|
35
|
-
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
|
|
36
|
-
borderRightWidth: !
|
|
38
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: onlyRecommendedRoute || routeNotFound ? 2 : 1, sx: {
|
|
39
|
+
borderRightWidth: !onlyRecommendedRoute &&
|
|
40
|
+
!routeNotFound &&
|
|
41
|
+
(isFetching || (routes && routes.length > 1))
|
|
37
42
|
? 1
|
|
38
43
|
: 0,
|
|
39
|
-
} }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth:
|
|
44
|
+
} }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !onlyRecommendedRoute && !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })));
|
|
40
45
|
};
|
|
41
46
|
exports.SwapRoutes = SwapRoutes;
|
|
@@ -22,15 +22,16 @@ const TextFitter_1 = require("../TextFitter");
|
|
|
22
22
|
const TokenAvatar_1 = require("../TokenAvatar");
|
|
23
23
|
const Token_style_1 = require("./Token.style");
|
|
24
24
|
const Token = (_a) => {
|
|
25
|
-
var _b;
|
|
26
25
|
var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
|
|
27
26
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
28
|
-
const {
|
|
29
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
|
|
27
|
+
const { chain } = (0, hooks_1.useChain)(token.chainId);
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, chain: chain, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
|
|
30
29
|
fontWeight: 700,
|
|
31
|
-
} }, { children: (
|
|
30
|
+
} }, { children: t('format.number', {
|
|
31
|
+
value: (0, utils_1.formatTokenAmount)(token.amount, token.decimals),
|
|
32
|
+
}) }))] })), (0, jsx_runtime_1.jsxs)(Token_style_1.TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
32
33
|
tokenSymbol: token.symbol,
|
|
33
|
-
chainName:
|
|
34
|
+
chainName: chain === null || chain === void 0 ? void 0 : chain.name,
|
|
34
35
|
}) })), step ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
35
36
|
border: 0,
|
|
36
37
|
marginBottom: -0.25,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { Token } from '@lifi/sdk';
|
|
2
|
+
import type { Chain, Token } from '@lifi/sdk';
|
|
3
3
|
import type { SxProps, Theme } from '@mui/material';
|
|
4
|
+
export declare const TokenAvatarFallback: React.FC<{
|
|
5
|
+
token: Token;
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
}>;
|
|
4
8
|
export declare const TokenAvatar: React.FC<{
|
|
5
9
|
token: Token;
|
|
10
|
+
chain?: Chain;
|
|
6
11
|
sx?: SxProps<Theme>;
|
|
7
12
|
}>;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenAvatar = void 0;
|
|
3
|
+
exports.TokenAvatar = exports.TokenAvatarFallback = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
7
|
const SmallAvatar_1 = require("../SmallAvatar");
|
|
8
|
-
const
|
|
8
|
+
const TokenAvatarFallback = ({ token, sx }) => {
|
|
9
9
|
const { chain } = (0, hooks_1.useChain)(token.chainId);
|
|
10
10
|
const { token: chainToken } = (0, hooks_1.useToken)(token.chainId, token.address);
|
|
11
|
-
return (
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(exports.TokenAvatar, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, chain: chain, sx: sx });
|
|
12
|
+
};
|
|
13
|
+
exports.TokenAvatarFallback = TokenAvatarFallback;
|
|
14
|
+
const TokenAvatar = ({ token, chain, sx }) => {
|
|
15
|
+
if (!chain || !token.logoURI) {
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(exports.TokenAvatarFallback, { token: token, sx: sx });
|
|
17
|
+
}
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? ((0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) })));
|
|
12
19
|
};
|
|
13
20
|
exports.TokenAvatar = TokenAvatar;
|
|
@@ -8,12 +8,12 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
9
|
const providers_1 = require("../../providers");
|
|
10
10
|
const TokenNotFound_1 = require("./TokenNotFound");
|
|
11
|
+
const useTokenSelect_1 = require("./useTokenSelect");
|
|
11
12
|
const VirtualizedTokenList_1 = require("./VirtualizedTokenList");
|
|
12
13
|
const TokenList = ({ formType, height, onClick, }) => {
|
|
13
14
|
var _a, _b;
|
|
14
15
|
const parentRef = (0, react_1.useRef)(null);
|
|
15
16
|
const { account } = (0, providers_1.useWallet)();
|
|
16
|
-
const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
|
|
17
17
|
const [selectedChainId] = (0, react_hook_form_1.useWatch)({
|
|
18
18
|
name: [providers_1.SwapFormKeyHelper.getChainKey(formType)],
|
|
19
19
|
});
|
|
@@ -37,28 +37,7 @@ const TokenList = ({ formType, height, onClick, }) => {
|
|
|
37
37
|
: searchedToken
|
|
38
38
|
? [searchedToken]
|
|
39
39
|
: filteredTokens;
|
|
40
|
-
const handleTokenClick = (0,
|
|
41
|
-
setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
|
|
42
|
-
shouldTouch: true,
|
|
43
|
-
});
|
|
44
|
-
// Set chain again to trigger URL builder update
|
|
45
|
-
setValue(providers_1.SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
|
|
46
|
-
shouldTouch: true,
|
|
47
|
-
});
|
|
48
|
-
setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
|
|
49
|
-
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
50
|
-
const [selectedOppositeToken, selectedOppositeChainId] = getValues([
|
|
51
|
-
providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType),
|
|
52
|
-
providers_1.SwapFormKeyHelper.getChainKey(oppositeFormType),
|
|
53
|
-
]);
|
|
54
|
-
if (selectedOppositeToken === tokenAddress &&
|
|
55
|
-
selectedOppositeChainId === selectedChainId) {
|
|
56
|
-
setValue(providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
57
|
-
shouldTouch: true,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
61
|
-
}, [formType, getValues, onClick, selectedChainId, setValue]);
|
|
40
|
+
const handleTokenClick = (0, useTokenSelect_1.useTokenSelect)(formType, onClick);
|
|
62
41
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ref: parentRef, style: { height, overflow: 'auto' } }, { children: [!tokens.length && !isLoading ? ((0, jsx_runtime_1.jsx)(TokenNotFound_1.TokenNotFound, { formType: formType })) : null, (0, jsx_runtime_1.jsx)(VirtualizedTokenList_1.VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length, scrollElementRef: parentRef, chainId: selectedChainId, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isActive, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] })));
|
|
63
42
|
};
|
|
64
43
|
exports.TokenList = TokenList;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { TokenListItemProps } from './types';
|
|
2
|
+
import type { TokenListItemButtonProps, TokenListItemProps } from './types';
|
|
3
3
|
export declare const TokenListItem: React.FC<TokenListItemProps>;
|
|
4
|
+
export declare const TokenListItemButton: React.FC<TokenListItemButtonProps>;
|
|
4
5
|
export declare const TokenListItemSkeleton: () => JSX.Element;
|
|
5
6
|
export declare const TokenAmountSkeleton: React.FC;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenAmountSkeleton = exports.TokenListItemSkeleton = exports.TokenListItem = void 0;
|
|
3
|
+
exports.TokenAmountSkeleton = exports.TokenListItemSkeleton = exports.TokenListItemButton = exports.TokenListItem = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const react_1 = require("react");
|
|
@@ -8,16 +8,22 @@ const react_i18next_1 = require("react-i18next");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const TokenList_style_1 = require("./TokenList.style");
|
|
10
10
|
exports.TokenListItem = (0, react_1.memo)(({ onClick, size, start, token, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
|
|
11
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
12
11
|
const handleClick = () => onClick === null || onClick === void 0 ? void 0 : onClick(token.address);
|
|
13
|
-
const tokenPrice = (0, utils_1.formatTokenPrice)(token.amount, token.priceUSD);
|
|
14
12
|
return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItem, Object.assign({ disablePadding: true, style: {
|
|
15
13
|
height: `${size}px`,
|
|
16
14
|
transform: `translateY(${start}px)`,
|
|
17
|
-
} }, { children: [startAdornment, (0, jsx_runtime_1.
|
|
18
|
-
value: tokenPrice,
|
|
19
|
-
}) }))) : null] })))) : null] })), endAdornment] })));
|
|
15
|
+
} }, { children: [startAdornment, (0, jsx_runtime_1.jsx)(exports.TokenListItemButton, { token: token, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] })));
|
|
20
16
|
});
|
|
17
|
+
const TokenListItemButton = ({ onClick, token, showBalance, isBalanceLoading, }) => {
|
|
18
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
|
+
const tokenPrice = (0, utils_1.formatTokenPrice)(token.amount, token.priceUSD);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItemButton, Object.assign({ onClick: onClick, dense: true, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? ((0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {})) : ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", noWrap: true }, { children: t('format.number', {
|
|
21
|
+
value: token.amount,
|
|
22
|
+
}) }))) : null, tokenPrice ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`format.currency`, {
|
|
23
|
+
value: tokenPrice,
|
|
24
|
+
}) }))) : null] })))) : null] })));
|
|
25
|
+
};
|
|
26
|
+
exports.TokenListItemButton = TokenListItemButton;
|
|
21
27
|
const TokenListItemSkeleton = () => {
|
|
22
28
|
return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItem, Object.assign({ secondaryAction: (0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {}), disablePadding: true, sx: { position: 'relative', flexDirection: 'row', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32, sx: { marginLeft: 1.5, marginRight: 2 } }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 20 }), secondary: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 20 }) })] })));
|
|
23
29
|
};
|
|
@@ -30,3 +30,9 @@ export interface TokenListItemProps extends TokenListItemBaseProps {
|
|
|
30
30
|
startAdornment?: React.ReactNode;
|
|
31
31
|
endAdornment?: React.ReactNode;
|
|
32
32
|
}
|
|
33
|
+
export interface TokenListItemButtonProps {
|
|
34
|
+
onClick?(): void;
|
|
35
|
+
showBalance?: boolean;
|
|
36
|
+
token: TokenAmount;
|
|
37
|
+
isBalanceLoading?: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTokenSelect = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
+
const providers_1 = require("../../providers");
|
|
7
|
+
const useTokenSelect = (formType, onClick) => {
|
|
8
|
+
const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
|
|
9
|
+
return (0, react_1.useCallback)((tokenAddress, chainId) => {
|
|
10
|
+
const selectedChainId = chainId !== null && chainId !== void 0 ? chainId : getValues(providers_1.SwapFormKeyHelper.getChainKey(formType));
|
|
11
|
+
setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
|
|
12
|
+
shouldTouch: true,
|
|
13
|
+
});
|
|
14
|
+
// Set chain again to trigger URL builder update
|
|
15
|
+
setValue(providers_1.SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
|
|
16
|
+
shouldTouch: true,
|
|
17
|
+
});
|
|
18
|
+
setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
|
|
19
|
+
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
20
|
+
const [selectedOppositeToken, selectedOppositeChainId] = getValues([
|
|
21
|
+
providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType),
|
|
22
|
+
providers_1.SwapFormKeyHelper.getChainKey(oppositeFormType),
|
|
23
|
+
]);
|
|
24
|
+
if (selectedOppositeToken === tokenAddress &&
|
|
25
|
+
selectedOppositeChainId === selectedChainId) {
|
|
26
|
+
setValue(providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
27
|
+
shouldTouch: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
31
|
+
}, [formType, getValues, onClick, setValue]);
|
|
32
|
+
};
|
|
33
|
+
exports.useTokenSelect = useTokenSelect;
|
package/cjs/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.22.0";
|
package/cjs/config/version.js
CHANGED
package/cjs/hooks/useChain.d.ts
CHANGED
package/cjs/hooks/useChains.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const useChains: () => {
|
|
2
|
-
chains: import("@lifi/types").
|
|
3
|
-
getChainById: (chainId: number) => import("@lifi/types").
|
|
2
|
+
chains: import("@lifi/types").ExtendedChain[] | undefined;
|
|
3
|
+
getChainById: (chainId: number) => import("@lifi/types").ExtendedChain | undefined;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
};
|
|
@@ -5,10 +5,8 @@ const material_1 = require("@mui/material");
|
|
|
5
5
|
const providers_1 = require("../providers");
|
|
6
6
|
const defaultExpandableWidth = 852;
|
|
7
7
|
const useExpandableVariant = () => {
|
|
8
|
-
const { variant } = (0, providers_1.useWidgetConfig)();
|
|
9
|
-
const expandableAllowed = (0, material_1.useMediaQuery)((theme) =>
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
return variant === 'expandable' && expandableAllowed;
|
|
8
|
+
const { variant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
|
|
9
|
+
const expandableAllowed = (0, material_1.useMediaQuery)((theme) => theme.breakpoints.up(defaultExpandableWidth));
|
|
10
|
+
return variant === 'expandable' && expandableAllowed && !useRecommendedRoute;
|
|
13
11
|
};
|
|
14
12
|
exports.useExpandableVariant = useExpandableVariant;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { EVMChain, Process, Step } from '@lifi/sdk';
|
|
2
|
-
import type { TFunction } from '
|
|
2
|
+
import type { TFunction } from 'i18next';
|
|
3
3
|
export declare const useProcessMessage: (step?: Step, process?: Process) => {
|
|
4
4
|
title?: string | undefined;
|
|
5
5
|
message?: string | undefined;
|
|
6
6
|
};
|
|
7
|
-
export declare function getProcessMessage(t: TFunction
|
|
7
|
+
export declare function getProcessMessage(t: TFunction, getChainById: (chainId: number) => EVMChain | undefined, step: Step, process: Process): {
|
|
8
8
|
title?: string;
|
|
9
9
|
message?: string;
|
|
10
10
|
};
|