@lifi/widget 1.0.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/App.d.ts +4 -0
- package/App.js +18 -0
- package/AppDrawer.d.ts +14 -0
- package/AppDrawer.js +34 -0
- package/AppDrawer.style.d.ts +49 -0
- package/AppDrawer.style.js +52 -0
- package/AppProvider.d.ts +6 -0
- package/AppProvider.js +12 -0
- package/LICENSE.md +21 -0
- package/components/AppContainer.d.ts +5 -0
- package/components/AppContainer.js +53 -0
- package/components/BottomSheet/BottomSheet.d.ts +3 -0
- package/components/BottomSheet/BottomSheet.js +42 -0
- package/components/BottomSheet/index.d.ts +2 -0
- package/components/BottomSheet/index.js +2 -0
- package/components/BottomSheet/types.d.ts +10 -0
- package/components/BottomSheet/types.js +1 -0
- package/components/Card/Card.d.ts +8 -0
- package/components/Card/Card.js +8 -0
- package/components/Card/CardContainer.d.ts +11 -0
- package/components/Card/CardContainer.js +16 -0
- package/components/Card/CardHeader.d.ts +18 -0
- package/components/Card/CardHeader.js +20 -0
- package/components/Card/CardTitle.d.ts +14 -0
- package/components/Card/CardTitle.js +9 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.js +4 -0
- package/components/Header/Header.d.ts +2 -0
- package/components/Header/Header.js +17 -0
- package/components/Header/Header.style.d.ts +22 -0
- package/components/Header/Header.style.js +21 -0
- package/components/Header/NavigationHeader.d.ts +2 -0
- package/components/Header/NavigationHeader.js +46 -0
- package/components/Header/WalletHeader.d.ts +2 -0
- package/components/Header/WalletHeader.js +28 -0
- package/components/Header/index.d.ts +1 -0
- package/components/Header/index.js +1 -0
- package/components/Input.d.ts +1 -0
- package/components/Input.js +14 -0
- package/components/LiFiLogo.d.ts +5 -0
- package/components/LiFiLogo.js +7 -0
- package/components/PoweredBy.d.ts +2 -0
- package/components/PoweredBy.js +14 -0
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.d.ts +7 -0
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +49 -0
- package/components/ProgressToNextUpdate/index.d.ts +1 -0
- package/components/ProgressToNextUpdate/index.js +1 -0
- package/components/ReverseTokensButton/ReverseTokensButton.d.ts +4 -0
- package/components/ReverseTokensButton/ReverseTokensButton.js +24 -0
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +29 -0
- package/components/ReverseTokensButton/ReverseTokensButton.style.js +14 -0
- package/components/ReverseTokensButton/index.d.ts +1 -0
- package/components/ReverseTokensButton/index.js +1 -0
- package/components/Select.d.ts +3 -0
- package/components/Select.js +27 -0
- package/components/SelectChainAndToken.d.ts +3 -0
- package/components/SelectChainAndToken.js +19 -0
- package/components/SelectTokenButton/SelectTokenButton.d.ts +5 -0
- package/components/SelectTokenButton/SelectTokenButton.js +29 -0
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +28 -0
- package/components/SelectTokenButton/SelectTokenButton.style.js +31 -0
- package/components/SelectTokenButton/index.d.ts +1 -0
- package/components/SelectTokenButton/index.js +1 -0
- package/components/StepActions/StepActions.d.ts +13 -0
- package/components/StepActions/StepActions.js +49 -0
- package/components/StepActions/StepActions.style.d.ts +20 -0
- package/components/StepActions/StepActions.style.js +56 -0
- package/components/StepActions/index.d.ts +1 -0
- package/components/StepActions/index.js +1 -0
- package/components/StepActions/types.d.ts +6 -0
- package/components/StepActions/types.js +1 -0
- package/components/StepToken.d.ts +6 -0
- package/components/StepToken.js +21 -0
- package/components/SwapButton/ButtonTooltip.d.ts +4 -0
- package/components/SwapButton/ButtonTooltip.js +3 -0
- package/components/SwapButton/SwapButton.d.ts +2 -0
- package/components/SwapButton/SwapButton.js +77 -0
- package/components/SwapButton/SwapButton.style.d.ts +65 -0
- package/components/SwapButton/SwapButton.style.js +20 -0
- package/components/SwapButton/index.d.ts +1 -0
- package/components/SwapButton/index.js +1 -0
- package/components/SwapInProgress/SwapInProgress.d.ts +3 -0
- package/components/SwapInProgress/SwapInProgress.js +22 -0
- package/components/SwapInProgress/SwapInProgress.style.d.ts +43 -0
- package/components/SwapInProgress/SwapInProgress.style.js +15 -0
- package/components/SwapInProgress/index.d.ts +1 -0
- package/components/SwapInProgress/index.js +1 -0
- package/components/SwapInput/FormPriceHelperText.d.ts +5 -0
- package/components/SwapInput/FormPriceHelperText.js +27 -0
- package/components/SwapInput/SwapInput.d.ts +3 -0
- package/components/SwapInput/SwapInput.js +43 -0
- package/components/SwapInput/SwapInput.style.d.ts +21 -0
- package/components/SwapInput/SwapInput.style.js +30 -0
- package/components/SwapInput/SwapInputAdornment.d.ts +2 -0
- package/components/SwapInput/SwapInputAdornment.js +23 -0
- package/components/SwapInput/SwapInputAdornment.style.d.ts +34 -0
- package/components/SwapInput/SwapInputAdornment.style.js +22 -0
- package/components/SwapInput/index.d.ts +1 -0
- package/components/SwapInput/index.js +1 -0
- package/components/SwapRouteCard/SwapRouteCard.d.ts +4 -0
- package/components/SwapRouteCard/SwapRouteCard.js +34 -0
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +36 -0
- package/components/SwapRouteCard/SwapRouteCard.style.js +71 -0
- package/components/SwapRouteCard/index.d.ts +1 -0
- package/components/SwapRouteCard/index.js +1 -0
- package/components/SwapRouteCard/types.d.ts +7 -0
- package/components/SwapRouteCard/types.js +1 -0
- package/components/SwapRoutes/SwapRoutes.d.ts +3 -0
- package/components/SwapRoutes/SwapRoutes.js +33 -0
- package/components/SwapRoutes/SwapRoutes.style.d.ts +11 -0
- package/components/SwapRoutes/SwapRoutes.style.js +9 -0
- package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +3 -0
- package/components/SwapRoutes/SwapRoutesUpdateProgress.js +24 -0
- package/components/SwapRoutes/index.d.ts +1 -0
- package/components/SwapRoutes/index.js +1 -0
- package/components/Switch.d.ts +1 -0
- package/components/Switch.js +53 -0
- package/components/TextFitter/TextFitter.d.ts +3 -0
- package/components/TextFitter/TextFitter.js +44 -0
- package/components/TextFitter/index.d.ts +1 -0
- package/components/TextFitter/index.js +1 -0
- package/components/TextFitter/types.d.ts +12 -0
- package/components/TextFitter/types.js +1 -0
- package/components/TokenList/TokenList.d.ts +3 -0
- package/components/TokenList/TokenList.js +58 -0
- package/components/TokenList/TokenList.style.d.ts +32 -0
- package/components/TokenList/TokenList.style.js +22 -0
- package/components/TokenList/TokenListItem.d.ts +4 -0
- package/components/TokenList/TokenListItem.js +24 -0
- package/components/TokenList/index.d.ts +1 -0
- package/components/TokenList/index.js +1 -0
- package/components/TokenList/types.d.ts +16 -0
- package/components/TokenList/types.js +1 -0
- package/components/TokenList/utils.d.ts +15 -0
- package/components/TokenList/utils.js +10 -0
- package/config/env.d.ts +12 -0
- package/config/env.js +19 -0
- package/config/queryClient.d.ts +2 -0
- package/config/queryClient.js +25 -0
- package/config/rpcs.d.ts +1 -0
- package/config/rpcs.js +20 -0
- package/config/theme.d.ts +27 -0
- package/config/theme.js +126 -0
- package/hooks/index.d.ts +15 -0
- package/hooks/index.js +15 -0
- package/hooks/useBridges.d.ts +1 -0
- package/hooks/useBridges.js +12 -0
- package/hooks/useChain.d.ts +4 -0
- package/hooks/useChain.js +13 -0
- package/hooks/useChains.d.ts +101 -0
- package/hooks/useChains.js +39 -0
- package/hooks/useContentHeight.d.ts +1 -0
- package/hooks/useContentHeight.js +15 -0
- package/hooks/useDebouncedWatch.d.ts +1 -0
- package/hooks/useDebouncedWatch.js +27 -0
- package/hooks/useExchanges.d.ts +1 -0
- package/hooks/useExchanges.js +12 -0
- package/hooks/useHasSufficientBalance.d.ts +5 -0
- package/hooks/useHasSufficientBalance.js +59 -0
- package/hooks/useRouteExecution/index.d.ts +3 -0
- package/hooks/useRouteExecution/index.js +3 -0
- package/hooks/useRouteExecution/types.d.ts +15 -0
- package/hooks/useRouteExecution/types.js +1 -0
- package/hooks/useRouteExecution/useRouteExecution.d.ts +8 -0
- package/hooks/useRouteExecution/useRouteExecution.js +132 -0
- package/hooks/useRouteExecution/useRouteStore.d.ts +17 -0
- package/hooks/useRouteExecution/useRouteStore.js +71 -0
- package/hooks/useScrollableContainer.d.ts +2 -0
- package/hooks/useScrollableContainer.js +24 -0
- package/hooks/useSettings/index.d.ts +2 -0
- package/hooks/useSettings/index.js +2 -0
- package/hooks/useSettings/types.d.ts +5 -0
- package/hooks/useSettings/types.js +1 -0
- package/hooks/useSettings/useSettingsStore.d.ts +13 -0
- package/hooks/useSettings/useSettingsStore.js +22 -0
- package/hooks/useSwapRoutes.d.ts +8 -0
- package/hooks/useSwapRoutes.js +101 -0
- package/hooks/useToken.d.ts +4 -0
- package/hooks/useToken.js +13 -0
- package/hooks/useTokenBalance.d.ts +7 -0
- package/hooks/useTokenBalance.js +46 -0
- package/hooks/useTokenBalances.d.ts +7 -0
- package/hooks/useTokenBalances.js +54 -0
- package/hooks/useTokens.d.ts +5 -0
- package/hooks/useTokens.js +24 -0
- package/i18n/en/translation.json +138 -0
- package/i18n/index.d.ts +144 -0
- package/i18n/index.js +20 -0
- package/i18n/react-i18next.d.ts +9 -0
- package/index.d.ts +5 -0
- package/index.js +9 -0
- package/lifi.d.ts +2 -0
- package/lifi.js +10 -0
- package/package.json +55 -0
- package/pages/MainPage/MainPage.d.ts +2 -0
- package/pages/MainPage/MainPage.js +11 -0
- package/pages/MainPage/MainPage.style.d.ts +11 -0
- package/pages/MainPage/MainPage.style.js +8 -0
- package/pages/MainPage/SendToRecipientForm.d.ts +2 -0
- package/pages/MainPage/SendToRecipientForm.js +20 -0
- package/pages/MainPage/index.d.ts +1 -0
- package/pages/MainPage/index.js +1 -0
- package/pages/SelectTokenPage/ChainSelect.d.ts +2 -0
- package/pages/SelectTokenPage/ChainSelect.js +25 -0
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.js +17 -0
- package/pages/SelectTokenPage/SearchTokenInput.style.d.ts +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.style.js +5 -0
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +5 -0
- package/pages/SelectTokenPage/SelectTokenPage.js +16 -0
- package/pages/SelectTokenPage/index.d.ts +2 -0
- package/pages/SelectTokenPage/index.js +2 -0
- package/pages/SelectTokenPage/types.d.ts +4 -0
- package/pages/SelectTokenPage/types.js +5 -0
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.js +68 -0
- package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +46 -0
- package/pages/SelectWalletPage/SelectWalletPage.style.js +27 -0
- package/pages/SelectWalletPage/index.d.ts +1 -0
- package/pages/SelectWalletPage/index.js +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.js +19 -0
- package/pages/SettingsPage/ColorSchemeButtonGroup.d.ts +2 -0
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +20 -0
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +33 -0
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.js +16 -0
- package/pages/SettingsPage/EnabledBridgesSelect.d.ts +2 -0
- package/pages/SettingsPage/EnabledBridgesSelect.js +15 -0
- package/pages/SettingsPage/EnabledExchangesSelect.d.ts +2 -0
- package/pages/SettingsPage/EnabledExchangesSelect.js +15 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.js +13 -0
- package/pages/SettingsPage/RoutePrioritySelect.d.ts +2 -0
- package/pages/SettingsPage/RoutePrioritySelect.js +13 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.js +10 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.js +28 -0
- package/pages/SettingsPage/index.d.ts +1 -0
- package/pages/SettingsPage/index.js +1 -0
- package/pages/SwapPage/CircularProgress.d.ts +4 -0
- package/pages/SwapPage/CircularProgress.js +20 -0
- package/pages/SwapPage/CircularProgress.style.d.ts +6 -0
- package/pages/SwapPage/CircularProgress.style.js +51 -0
- package/pages/SwapPage/ExecutionItem.d.ts +6 -0
- package/pages/SwapPage/ExecutionItem.js +21 -0
- package/pages/SwapPage/ExecutionItem.style.d.ts +39 -0
- package/pages/SwapPage/ExecutionItem.style.js +5 -0
- package/pages/SwapPage/StatusBottomSheet.d.ts +3 -0
- package/pages/SwapPage/StatusBottomSheet.js +79 -0
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +25 -0
- package/pages/SwapPage/StatusBottomSheet.style.js +32 -0
- package/pages/SwapPage/StepDivider.d.ts +2 -0
- package/pages/SwapPage/StepDivider.js +6 -0
- package/pages/SwapPage/StepDivider.style.d.ts +11 -0
- package/pages/SwapPage/StepDivider.style.js +8 -0
- package/pages/SwapPage/StepItem.d.ts +7 -0
- package/pages/SwapPage/StepItem.js +29 -0
- package/pages/SwapPage/StepTimer.d.ts +5 -0
- package/pages/SwapPage/StepTimer.js +59 -0
- package/pages/SwapPage/SwapPage.d.ts +2 -0
- package/pages/SwapPage/SwapPage.js +22 -0
- package/pages/SwapPage/SwapPage.style.d.ts +44 -0
- package/pages/SwapPage/SwapPage.style.js +12 -0
- package/pages/SwapPage/index.d.ts +1 -0
- package/pages/SwapPage/index.js +1 -0
- package/pages/SwapPage/utils.d.ts +6 -0
- package/pages/SwapPage/utils.js +85 -0
- package/pages/SwapRoutesPage/SwapRoutesPage.d.ts +3 -0
- package/pages/SwapRoutesPage/SwapRoutesPage.js +24 -0
- package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +11 -0
- package/pages/SwapRoutesPage/SwapRoutesPage.style.js +6 -0
- package/pages/SwapRoutesPage/index.d.ts +1 -0
- package/pages/SwapRoutesPage/index.js +1 -0
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +2 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +20 -0
- package/providers/SwapFormProvider/index.d.ts +2 -0
- package/providers/SwapFormProvider/index.js +2 -0
- package/providers/SwapFormProvider/types.d.ts +44 -0
- package/providers/SwapFormProvider/types.js +24 -0
- package/providers/ThemeProvider/ThemeProvider.d.ts +2 -0
- package/providers/ThemeProvider/ThemeProvider.js +33 -0
- package/providers/ThemeProvider/index.d.ts +1 -0
- package/providers/ThemeProvider/index.js +1 -0
- package/providers/WalletProvider/WalletProvider.d.ts +4 -0
- package/providers/WalletProvider/WalletProvider.js +89 -0
- package/providers/WalletProvider/index.d.ts +2 -0
- package/providers/WalletProvider/index.js +2 -0
- package/providers/WalletProvider/types.d.ts +17 -0
- package/providers/WalletProvider/types.js +1 -0
- package/providers/WidgetProvider/WidgetProvider.d.ts +4 -0
- package/providers/WidgetProvider/WidgetProvider.js +44 -0
- package/providers/WidgetProvider/index.d.ts +2 -0
- package/providers/WidgetProvider/index.js +2 -0
- package/providers/WidgetProvider/types.d.ts +8 -0
- package/providers/WidgetProvider/types.js +1 -0
- package/react-app-env.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/widget.d.ts +41 -0
- package/types/widget.js +1 -0
- package/utils/colors.d.ts +2 -0
- package/utils/colors.js +3 -0
- package/utils/deepClone.d.ts +1 -0
- package/utils/deepClone.js +3 -0
- package/utils/elements.d.ts +4 -0
- package/utils/elements.js +5 -0
- package/utils/format.d.ts +9 -0
- package/utils/format.js +76 -0
- package/utils/input.d.ts +1 -0
- package/utils/input.js +24 -0
- package/utils/routes.d.ts +10 -0
- package/utils/routes.js +9 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes" | "color" | "position"> & {
|
|
3
|
+
classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
|
|
4
|
+
color?: "inherit" | "transparent" | "default" | "primary" | "secondary" | undefined;
|
|
5
|
+
enableColorOnDark?: boolean | undefined;
|
|
6
|
+
position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | 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<HTMLElement>, HTMLElement>, keyof import("react").HTMLAttributes<HTMLElement> | "key"> & {
|
|
9
|
+
ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
10
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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" | "ref" | "key" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
11
|
+
pt?: number | undefined;
|
|
12
|
+
}, {}, {}>;
|
|
13
|
+
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
component?: import("react").ElementType<any> | undefined;
|
|
16
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
17
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
18
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
19
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
|
+
}, 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> & {
|
|
21
|
+
sticky?: boolean | undefined;
|
|
22
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppBar, Box } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
export const HeaderAppBar = styled(AppBar, {
|
|
4
|
+
shouldForwardProp: (prop) => prop !== 'pt',
|
|
5
|
+
})(({ theme, pt }) => ({
|
|
6
|
+
backgroundColor: theme.palette.background.default,
|
|
7
|
+
color: theme.palette.text.primary,
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
position: 'relative',
|
|
11
|
+
minHeight: 48,
|
|
12
|
+
padding: theme.spacing(pt !== null && pt !== void 0 ? pt : 0, 3, 0, 3),
|
|
13
|
+
}));
|
|
14
|
+
export const Container = styled(Box, {
|
|
15
|
+
shouldForwardProp: (prop) => prop !== 'sticky',
|
|
16
|
+
})(({ theme, sticky }) => ({
|
|
17
|
+
backgroundColor: theme.palette.background.default,
|
|
18
|
+
position: sticky ? 'sticky' : 'relative',
|
|
19
|
+
top: 0,
|
|
20
|
+
zIndex: 1200,
|
|
21
|
+
}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowBack as ArrowBackIcon, Settings as SettingsIcon, } from '@mui/icons-material';
|
|
3
|
+
import { Box, IconButton, Typography } from '@mui/material';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
|
6
|
+
import { routes } from '../../utils/routes';
|
|
7
|
+
import { SwapRoutesUpdateProgress } from '../SwapRoutes/SwapRoutesUpdateProgress';
|
|
8
|
+
import { HeaderAppBar } from './Header.style';
|
|
9
|
+
const backButtonRoutes = [
|
|
10
|
+
routes.selectWallet,
|
|
11
|
+
routes.settings,
|
|
12
|
+
routes.fromToken,
|
|
13
|
+
routes.toToken,
|
|
14
|
+
routes.swapRoutes,
|
|
15
|
+
routes.swap,
|
|
16
|
+
];
|
|
17
|
+
export const NavigationHeader = () => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const { pathname } = useLocation();
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const handleSettings = () => {
|
|
22
|
+
navigate(routes.settings);
|
|
23
|
+
};
|
|
24
|
+
const handleBack = () => {
|
|
25
|
+
navigate(-1);
|
|
26
|
+
};
|
|
27
|
+
const handleHeaderTitle = () => {
|
|
28
|
+
switch (pathname) {
|
|
29
|
+
case routes.selectWallet:
|
|
30
|
+
return t(`header.selectWallet`);
|
|
31
|
+
case routes.settings:
|
|
32
|
+
return t(`header.settings`);
|
|
33
|
+
case routes.fromToken:
|
|
34
|
+
return t(`header.from`);
|
|
35
|
+
case routes.toToken:
|
|
36
|
+
return t(`header.to`);
|
|
37
|
+
case routes.swapRoutes:
|
|
38
|
+
return t(`header.routes`);
|
|
39
|
+
case routes.swap:
|
|
40
|
+
return t(`header.swap`);
|
|
41
|
+
default:
|
|
42
|
+
return t(`header.swap`);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(pathname) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: pathname === '/' ? 32 : 24, align: pathname === '/' ? 'left' : 'center', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: routes.swapRoutes, element: _jsx(SwapRoutesUpdateProgress, { size: "medium", edge: "end", sx: { marginRight: -1 } }) }), _jsx(Route, { path: routes.home, element: _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: handleSettings }, { children: _jsx(SettingsIcon, {}) })) }), _jsx(Route, { path: "/:empty", element: _jsx(Box, { width: 36, height: 48 }) })] })] })));
|
|
46
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { AccountBalanceWallet as AccountBalanceWalletIcon, Logout as LogoutIcon, } from '@mui/icons-material';
|
|
3
|
+
import { Box, IconButton, Typography } from '@mui/material';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
6
|
+
import { useWallet } from '../../providers/WalletProvider';
|
|
7
|
+
import { routes } from '../../utils/routes';
|
|
8
|
+
import { HeaderAppBar } from './Header.style';
|
|
9
|
+
export const WalletHeader = () => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const { account, disconnect } = useWallet();
|
|
12
|
+
const walletAddress = account.address
|
|
13
|
+
? `${account.address.substring(0, 7)}...${account.address.substring(account.address.length - 7)}`
|
|
14
|
+
: null;
|
|
15
|
+
return (_jsx(HeaderAppBar, Object.assign({ elevation: 0, pt: 1.5 }, { children: walletAddress ? (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flex: 1,
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
}, mr: 0.5 }, { children: [_jsx(Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), _jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: disconnect }, { children: _jsx(LogoutIcon, {}) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), _jsx(ConnectButton, {})] })) })));
|
|
20
|
+
};
|
|
21
|
+
const ConnectButton = () => {
|
|
22
|
+
const { pathname } = useLocation();
|
|
23
|
+
const navigate = useNavigate();
|
|
24
|
+
const connect = () => {
|
|
25
|
+
navigate(routes.selectWallet);
|
|
26
|
+
};
|
|
27
|
+
return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: pathname !== routes.selectWallet ? connect : undefined }, { children: _jsx(AccountBalanceWalletIcon, {}) })));
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Header';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Header';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Input: import("@emotion/styled").StyledComponent<import("@mui/material").InputBaseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputBase } from '@mui/material';
|
|
2
|
+
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
export const Input = styled(InputBase)(({ theme }) => ({
|
|
5
|
+
backgroundColor: theme.palette.mode === 'light'
|
|
6
|
+
? theme.palette.common.white
|
|
7
|
+
: theme.palette.background.paper,
|
|
8
|
+
paddingRight: theme.spacing(2),
|
|
9
|
+
[`.${inputBaseClasses.input}`]: {
|
|
10
|
+
padding: theme.spacing(1.5, 1, 1.5, 2),
|
|
11
|
+
height: '2.875em',
|
|
12
|
+
boxSizing: 'inherit',
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ReactComponent as LiFiFullLogo } from '../icons/LiFiFullLogo.svg';
|
|
3
|
+
import { ReactComponent as LiFiIconLogo } from '../icons/LiFiLogo.svg';
|
|
4
|
+
export const LiFiLogo = ({ variant = 'icon', style }) => {
|
|
5
|
+
const Component = variant === 'icon' ? LiFiIconLogo : LiFiFullLogo;
|
|
6
|
+
return _jsx(Component, { style: style, fill: "currentColor" });
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Link, Typography } from '@mui/material';
|
|
3
|
+
import { LiFiLogo } from './LiFiLogo';
|
|
4
|
+
export const PoweredBy = () => {
|
|
5
|
+
return (_jsx(Box, Object.assign({ px: 3, pt: 2, pb: 2, sx: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'flex-end',
|
|
8
|
+
justifyContent: 'flex-end',
|
|
9
|
+
flex: 1,
|
|
10
|
+
} }, { children: _jsxs(Link, Object.assign({ sx: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
}, href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })));
|
|
14
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, CircularProgress, IconButton, Tooltip, } from '@mui/material';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
const calculateTime = (updatedAt, timeToUpdate) => {
|
|
6
|
+
if (updatedAt === 0) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
const progress = ((Date.now() - updatedAt) / timeToUpdate) * 100;
|
|
10
|
+
return Math.min(100, progress);
|
|
11
|
+
};
|
|
12
|
+
export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onClick, sx }) => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const [value, setValue] = useState(() => calculateTime(updatedAt, timeToUpdate));
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const id = setInterval(() => {
|
|
17
|
+
const time = calculateTime(updatedAt, timeToUpdate);
|
|
18
|
+
setValue(calculateTime(updatedAt, timeToUpdate));
|
|
19
|
+
if (time >= 100) {
|
|
20
|
+
clearInterval(id);
|
|
21
|
+
}
|
|
22
|
+
}, 1000);
|
|
23
|
+
return () => clearInterval(id);
|
|
24
|
+
}, [timeToUpdate, updatedAt]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (isLoading) {
|
|
27
|
+
setValue(0);
|
|
28
|
+
}
|
|
29
|
+
}, [isLoading]);
|
|
30
|
+
return (_jsx(IconButton, Object.assign({ onClick: onClick, sx: sx, disabled: isLoading }, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
|
|
31
|
+
value: Math.round((timeToUpdate - (Date.now() - updatedAt)) / 1000),
|
|
32
|
+
}), placement: "top", enterDelay: 250, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
|
|
33
|
+
display: 'grid',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
placeItems: 'center',
|
|
36
|
+
width: 24,
|
|
37
|
+
height: 24,
|
|
38
|
+
} }, { children: [_jsx(CircularProgress, { variant: "determinate", size: 24, value: 100, sx: (theme) => ({
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
color: theme.palette.mode === 'light'
|
|
41
|
+
? theme.palette.grey[300]
|
|
42
|
+
: theme.palette.grey[800],
|
|
43
|
+
}) }), _jsx(CircularProgress, { variant: isLoading ? 'indeterminate' : 'determinate', size: 24, value: value, sx: (theme) => ({
|
|
44
|
+
opacity: value === 100 && !isLoading ? 0.5 : 1,
|
|
45
|
+
color: theme.palette.mode === 'light'
|
|
46
|
+
? theme.palette.primary.main
|
|
47
|
+
: theme.palette.primary.light,
|
|
48
|
+
}) })] })) })) })));
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressToNextUpdate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressToNextUpdate';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SwapHoriz as SwapHorizIcon, SwapVert as SwapVertIcon, } from '@mui/icons-material';
|
|
3
|
+
import { useFormContext } from 'react-hook-form';
|
|
4
|
+
import { SwapFormKey } from '../../providers/SwapFormProvider';
|
|
5
|
+
import { IconButton } from './ReverseTokensButton.style';
|
|
6
|
+
export const ReverseTokensButton = ({ vertical, }) => {
|
|
7
|
+
const { setValue, getValues } = useFormContext();
|
|
8
|
+
const handleClick = () => {
|
|
9
|
+
const [fromChain, fromToken, toChain, toToken] = getValues([
|
|
10
|
+
SwapFormKey.FromChain,
|
|
11
|
+
SwapFormKey.FromToken,
|
|
12
|
+
SwapFormKey.ToChain,
|
|
13
|
+
SwapFormKey.ToToken,
|
|
14
|
+
]);
|
|
15
|
+
if (fromChain && fromToken && toChain && toToken) {
|
|
16
|
+
setValue(SwapFormKey.FromAmount, '');
|
|
17
|
+
setValue(SwapFormKey.FromChain, toChain);
|
|
18
|
+
setValue(SwapFormKey.FromToken, toToken);
|
|
19
|
+
setValue(SwapFormKey.ToChain, fromChain);
|
|
20
|
+
setValue(SwapFormKey.ToToken, fromToken);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
|
|
24
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "default" | "success" | "error" | "primary" | "secondary" | "info" | "warning" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableFocusRipple?: boolean | undefined;
|
|
8
|
+
edge?: false | "end" | "start" | undefined;
|
|
9
|
+
size?: "small" | "large" | "medium" | undefined;
|
|
10
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
11
|
+
} & Omit<{
|
|
12
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
13
|
+
centerRipple?: boolean | undefined;
|
|
14
|
+
children?: import("react").ReactNode;
|
|
15
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
disableRipple?: boolean | undefined;
|
|
18
|
+
disableTouchRipple?: boolean | undefined;
|
|
19
|
+
focusRipple?: boolean | undefined;
|
|
20
|
+
focusVisibleClassName?: string | undefined;
|
|
21
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
22
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
23
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
24
|
+
tabIndex?: number | undefined;
|
|
25
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
26
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
27
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
28
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconButton as MuiIconButton } from '@mui/material';
|
|
2
|
+
import { darken, styled } from '@mui/material/styles';
|
|
3
|
+
export const IconButton = styled(MuiIconButton)(({ theme }) => ({
|
|
4
|
+
backgroundColor: theme.palette.background.paper,
|
|
5
|
+
border: `1px solid`,
|
|
6
|
+
borderColor: theme.palette.mode === 'light'
|
|
7
|
+
? theme.palette.grey[300]
|
|
8
|
+
: theme.palette.grey[800],
|
|
9
|
+
zIndex: 1200,
|
|
10
|
+
padding: theme.spacing(0.5),
|
|
11
|
+
'&:hover': {
|
|
12
|
+
backgroundColor: darken(theme.palette.background.paper, 0.04),
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ReverseTokensButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ReverseTokensButton';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Select as MuiSelect } from '@mui/material';
|
|
2
|
+
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
3
|
+
import { listItemIconClasses } from '@mui/material/ListItemIcon';
|
|
4
|
+
import { outlinedInputClasses } from '@mui/material/OutlinedInput';
|
|
5
|
+
import { selectClasses } from '@mui/material/Select';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
export const Select = styled(MuiSelect, {
|
|
8
|
+
shouldForwardProp: (prop) => prop !== 'dense',
|
|
9
|
+
})(({ theme, dense }) => ({
|
|
10
|
+
backgroundColor: theme.palette.mode === 'light'
|
|
11
|
+
? theme.palette.common.white
|
|
12
|
+
: theme.palette.background.paper,
|
|
13
|
+
[`.${inputBaseClasses.input}`]: {
|
|
14
|
+
padding: dense ? theme.spacing(1.625, 2, 1.5, 2) : theme.spacing(2),
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
},
|
|
18
|
+
[`.${selectClasses.icon}`]: {
|
|
19
|
+
right: 10,
|
|
20
|
+
},
|
|
21
|
+
[`.${listItemIconClasses.root}`]: {
|
|
22
|
+
minWidth: 38,
|
|
23
|
+
},
|
|
24
|
+
[`.${outlinedInputClasses.notchedOutline}`]: {
|
|
25
|
+
display: 'none',
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, useMediaQuery } from '@mui/material';
|
|
3
|
+
import { useWatch } from 'react-hook-form';
|
|
4
|
+
import { ReverseTokensButton } from '../components/ReverseTokensButton';
|
|
5
|
+
import { SelectTokenButton } from '../components/SelectTokenButton';
|
|
6
|
+
import { SwapFormKey } from '../providers/SwapFormProvider';
|
|
7
|
+
export const SelectChainAndToken = (props) => {
|
|
8
|
+
const prefersNarrowView = useMediaQuery((theme) => theme.breakpoints.down('sm'));
|
|
9
|
+
const [fromChain, toChain, fromToken, toToken] = useWatch({
|
|
10
|
+
name: [
|
|
11
|
+
SwapFormKey.FromChain,
|
|
12
|
+
SwapFormKey.ToChain,
|
|
13
|
+
SwapFormKey.FromToken,
|
|
14
|
+
SwapFormKey.ToToken,
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
const isCompact = fromChain && toChain && fromToken && toToken && !prefersNarrowView;
|
|
18
|
+
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: -1.25 }, { children: _jsx(ReverseTokensButton, { vertical: !isCompact }) })), _jsx(SelectTokenButton, { formType: "to", compact: isCompact })] })));
|
|
19
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
|
|
3
|
+
import { Avatar, Skeleton } from '@mui/material';
|
|
4
|
+
import { useWatch } from 'react-hook-form';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useNavigate } from 'react-router-dom';
|
|
7
|
+
import { useChain, useToken } from '../../hooks';
|
|
8
|
+
import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
|
|
9
|
+
import { routes } from '../../utils/routes';
|
|
10
|
+
import { CardTitle } from '../Card';
|
|
11
|
+
import { CardContainer } from '../Card/CardContainer';
|
|
12
|
+
import { Card, SelectTokenCardHeader } from './SelectTokenButton.style';
|
|
13
|
+
export const SelectTokenButton = ({ formType, compact }) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
const [chainId, tokenAddress] = useWatch({
|
|
17
|
+
name: [
|
|
18
|
+
SwapFormKeyHelper.getChainKey(formType),
|
|
19
|
+
SwapFormKeyHelper.getTokenKey(formType),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
const { chain, isLoading: isChainLoading } = useChain(chainId);
|
|
23
|
+
const { token, isLoading: isTokenLoading } = useToken(chainId, tokenAddress);
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
navigate(formType === 'from' ? routes.fromToken : routes.toToken);
|
|
26
|
+
};
|
|
27
|
+
const isSelected = !!(chain && token);
|
|
28
|
+
return (_jsx(CardContainer, Object.assign({ flex: 1 }, { children: _jsxs(Card, Object.assign({ onClick: handleClick, elevation: 0 }, { 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(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] }))) : null, action: !compact ? _jsx(KeyboardArrowRightIcon, {}) : null, title: isSelected ? token.symbol : t(`swap.selectChainAndToken`), subheader: isSelected ? `on ${chain.name}` : null, selected: isSelected, compact: compact }))] })) })));
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Card: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes"> & {
|
|
3
|
+
classes?: Partial<import("@mui/material").CardClasses> | undefined;
|
|
4
|
+
raised?: boolean | undefined;
|
|
5
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
6
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
7
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
8
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "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" | "ref" | "key" | "variant" | "square" | "elevation" | "raised"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
9
|
+
export declare const SelectTokenCardHeader: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
action?: import("react").ReactNode;
|
|
11
|
+
avatar?: import("react").ReactNode;
|
|
12
|
+
classes?: Partial<import("@mui/material").CardHeaderClasses> | undefined;
|
|
13
|
+
disableTypography?: boolean | undefined;
|
|
14
|
+
subheader?: import("react").ReactNode;
|
|
15
|
+
subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
16
|
+
component?: "span" | undefined;
|
|
17
|
+
}> | undefined;
|
|
18
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
19
|
+
title?: import("react").ReactNode;
|
|
20
|
+
titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
|
|
21
|
+
component?: "span" | undefined;
|
|
22
|
+
}> | undefined;
|
|
23
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
24
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
25
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
26
|
+
selected?: boolean | undefined;
|
|
27
|
+
compact?: boolean | undefined;
|
|
28
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Card as MuiCard } from '@mui/material';
|
|
2
|
+
import { cardHeaderClasses } from '@mui/material/CardHeader';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { CardHeader } from '../Card';
|
|
5
|
+
export const Card = styled(MuiCard)(({ theme }) => ({
|
|
6
|
+
borderRadius: 0,
|
|
7
|
+
'&:hover': {
|
|
8
|
+
cursor: 'pointer',
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
export const SelectTokenCardHeader = styled(CardHeader, {
|
|
12
|
+
shouldForwardProp: (prop) => !['selected', 'compact'].includes(prop),
|
|
13
|
+
})(({ theme, selected, compact }) => ({
|
|
14
|
+
height: 64,
|
|
15
|
+
[`.${cardHeaderClasses.title}`]: {
|
|
16
|
+
color: selected
|
|
17
|
+
? theme.palette.text.primary
|
|
18
|
+
: theme.palette.text.secondary,
|
|
19
|
+
textOverflow: 'ellipsis',
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
width: compact ? 92 : 244,
|
|
23
|
+
fontWeight: selected ? 500 : 400,
|
|
24
|
+
},
|
|
25
|
+
[`.${cardHeaderClasses.subheader}`]: {
|
|
26
|
+
textOverflow: 'ellipsis',
|
|
27
|
+
whiteSpace: 'nowrap',
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
width: compact ? 92 : 244,
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectTokenButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectTokenButton';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Step } from '@lifinance/sdk';
|
|
3
|
+
import { StepActionsProps } from './types';
|
|
4
|
+
export declare const StepActions: React.FC<StepActionsProps>;
|
|
5
|
+
export declare const StepDetailsContent: React.FC<{
|
|
6
|
+
step: Step;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const CrossStepDetailsLabel: React.FC<{
|
|
9
|
+
step: Step;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const SwapStepDetailsLabel: React.FC<{
|
|
12
|
+
step: Step;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { ArrowForward as ArrowForwardIcon } from '@mui/icons-material';
|
|
14
|
+
import { Box, Step as MuiStep, Stepper, Typography } from '@mui/material';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useChains } from '../../hooks';
|
|
17
|
+
import { formatTokenAmount } from '../../utils/format';
|
|
18
|
+
import { LiFiLogo } from '../LiFiLogo';
|
|
19
|
+
import { StepAvatar, StepConnector, StepContent, StepIcon, StepLabel, } from './StepActions.style';
|
|
20
|
+
export const StepActions = (_a) => {
|
|
21
|
+
var _b;
|
|
22
|
+
var { step, dense } = _a, other = __rest(_a, ["step", "dense"]);
|
|
23
|
+
const StepDetailsLabel = step.type === 'cross' || step.type === 'lifi'
|
|
24
|
+
? CrossStepDetailsLabel
|
|
25
|
+
: SwapStepDetailsLabel;
|
|
26
|
+
const isFullView = !dense && ((_b = step.includedSteps) === null || _b === void 0 ? void 0 : _b.length) > 1;
|
|
27
|
+
return (_jsxs(Box, Object.assign({}, other, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1 : 0 }, { children: [_jsx(StepAvatar, Object.assign({ variant: step.type === 'lifi' ? 'square' : 'circular', src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name }, { children: step.type === 'lifi' ? _jsx(LiFiLogo, {}) : step.toolDetails.name[0] })), _jsx(Typography, Object.assign({ ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize" }, { children: step.type === 'lifi'
|
|
28
|
+
? 'LI.FI Smart Contract'
|
|
29
|
+
: 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: StepIcon }, { children: _jsx(StepDetailsLabel, { 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 })] })))] })));
|
|
30
|
+
};
|
|
31
|
+
export const StepDetailsContent = ({ step }) => {
|
|
32
|
+
return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), formatTokenAmount(step.estimate.toAmount, step.action.toToken.decimals), ' ', step.action.toToken.symbol] })));
|
|
33
|
+
};
|
|
34
|
+
export const CrossStepDetailsLabel = ({ step }) => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
const { getChainById } = useChains();
|
|
38
|
+
return (_jsx(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary" }, { children: t('swap.crossStepDetails', {
|
|
39
|
+
from: (_a = getChainById(step.action.fromChainId)) === null || _a === void 0 ? void 0 : _a.name,
|
|
40
|
+
to: (_b = getChainById(step.action.toChainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
41
|
+
tool: step.toolDetails.name,
|
|
42
|
+
}) })));
|
|
43
|
+
};
|
|
44
|
+
export const SwapStepDetailsLabel = ({ step }) => {
|
|
45
|
+
const { t } = useTranslation();
|
|
46
|
+
return (_jsx(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary" }, { children: t('swap.swapStepDetails', {
|
|
47
|
+
value: step.toolDetails.name,
|
|
48
|
+
}) })));
|
|
49
|
+
};
|