@lifi/widget 4.0.0 → 4.2.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/dist/esm/App.d.ts +4 -2
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/App.js +4 -4
- package/dist/esm/App.js.map +1 -1
- package/dist/esm/AppDefault.js +14 -0
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -1
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/AppDrawer.js +5 -6
- package/dist/esm/AppDrawer.js.map +1 -1
- package/dist/esm/AppDrawerContext.js +2 -2
- package/dist/esm/AppDrawerContext.js.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js +2 -1
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +4 -2
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.style.js +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.style.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.js +4 -2
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.js.map +1 -1
- package/dist/esm/components/AmountInputCard/AmountInputCard.style.js +98 -0
- package/dist/esm/components/AmountInputCard/AmountInputCard.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/AmountInputCardPair.js +25 -0
- package/dist/esm/components/AmountInputCard/AmountInputCardPair.js.map +1 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.js +35 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.js.map +1 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.style.js +11 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/FiatValueToggle.js +41 -0
- package/dist/esm/components/AmountInputCard/FiatValueToggle.js.map +1 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.js +80 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.js.map +1 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js +43 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js +137 -0
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js.map +1 -0
- package/dist/esm/components/AmountInputCard/SendAmountCard.js +102 -0
- package/dist/esm/components/AmountInputCard/SendAmountCard.js.map +1 -0
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js +12 -3
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.js.map +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js +1 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +3 -3
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.js.map +1 -1
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.js.map +1 -1
- package/dist/esm/components/Card/CardLabel.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/Card/InputCard.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.style.js.map +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +2 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/ContextMenu.style.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.style.js.map +1 -1
- package/dist/esm/components/EmptyListIndicator/EmptyListIndicator.style.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.style.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/iconKey.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.style.js.map +1 -1
- package/dist/esm/components/Header/ActivitiesButton.style.js.map +1 -1
- package/dist/esm/components/Header/CloseDrawerButton.js +1 -0
- package/dist/esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js +7 -10
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/HeaderNavigationTabs.js +39 -0
- package/dist/esm/components/Header/HeaderNavigationTabs.js.map +1 -0
- package/dist/esm/components/Header/HeaderTabs.js +33 -0
- package/dist/esm/components/Header/HeaderTabs.js.map +1 -0
- package/dist/esm/components/Header/NavigationHeader.js +7 -5
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/Header/WalletMenu.style.js.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.style.js +1 -1
- package/dist/esm/components/IconCircle/IconCircle.style.js.map +1 -1
- package/dist/esm/components/IconTypography.js.map +1 -1
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.js +99 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.js.map +1 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.style.js +52 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.style.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.js +115 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.style.js +89 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.style.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPricePresets.js +91 -0
- package/dist/esm/components/LimitPriceCard/LimitPricePresets.js.map +1 -0
- package/dist/esm/components/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/ListItem/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemText.js.map +1 -1
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Messages/AlertMessage.style.js.map +1 -1
- package/dist/esm/components/Messages/GasRefuelMessage.style.js.map +1 -1
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/PageContainer.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js +1 -0
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.style.js +2 -2
- package/dist/esm/components/RouteCard/RouteDetails.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteProviderCard.js +118 -0
- package/dist/esm/components/RouteCard/RouteProviderCard.js.map +1 -0
- package/dist/esm/components/RouteCard/RouteToken.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteTokens.js.map +1 -1
- package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
- package/dist/esm/components/Routes/LimitOrderRoutes.js +34 -0
- package/dist/esm/components/Routes/LimitOrderRoutes.js.map +1 -0
- package/dist/esm/components/Routes/Routes.js +2 -2
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.style.js.map +1 -1
- package/dist/esm/components/SettingsListItemButton.js.map +1 -1
- package/dist/esm/components/SettingsPanel/SettingsPanel.js +51 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.js.map +1 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.style.js +33 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.style.js.map +1 -0
- package/dist/esm/components/SettingsPanel/utils.js +14 -0
- package/dist/esm/components/SettingsPanel/utils.js.map +1 -0
- package/dist/esm/components/Skeleton/WidgetSkeleton.js +50 -47
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js.map +1 -1
- package/dist/esm/components/Step/StepActions.style.js.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.style.js.map +1 -1
- package/dist/esm/components/StepActions/StepActionRow.style.js.map +1 -1
- package/dist/esm/components/SwapButton/SwapButton.js +50 -0
- package/dist/esm/components/SwapButton/SwapButton.js.map +1 -0
- package/dist/esm/components/SwapButton/SwapButton.style.js +24 -0
- package/dist/esm/components/SwapButton/SwapButton.style.js.map +1 -0
- package/dist/esm/components/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/NavigationTabs.js +3 -0
- package/dist/esm/components/Tabs/NavigationTabs.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/Timer/StepStatusTimer.style.js.map +1 -1
- package/dist/esm/components/Token/Token.style.js.map +1 -1
- package/dist/esm/components/TokenList/PinTokenButton.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.js +4 -4
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +4 -4
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +2 -2
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js +3 -3
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenPillButton/TokenPillButton.js +52 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.js.map +1 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.style.js +39 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.style.js.map +1 -0
- package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/timer/validate.js.map +1 -1
- package/dist/esm/hooks/useAccountsBalancesData.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +1 -1
- package/dist/esm/hooks/useChainSearch.js +2 -1
- package/dist/esm/hooks/useChainSearch.js.map +1 -1
- package/dist/esm/hooks/useChains.js +1 -1
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useLanguages.js +2 -2
- package/dist/esm/hooks/useLanguages.js.map +1 -1
- package/dist/esm/hooks/useLimitMarketRate.js +24 -0
- package/dist/esm/hooks/useLimitMarketRate.js.map +1 -0
- package/dist/esm/hooks/useLinkedLimitFields.js +49 -0
- package/dist/esm/hooks/useLinkedLimitFields.js.map +1 -0
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/hooks/useRouteRequiredAccountConnection.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +23 -6
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useSwapOnly.js +2 -4
- package/dist/esm/hooks/useSwapOnly.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +2 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +1 -1
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +17 -15
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +1 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/hooks/useWideVariant.js +5 -2
- package/dist/esm/hooks/useWideVariant.js.map +1 -1
- package/dist/esm/i18n/en.json +25 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/LimitPageContent.js +23 -0
- package/dist/esm/pages/MainPage/LimitPageContent.js.map +1 -0
- package/dist/esm/pages/MainPage/MainPage.js +19 -22
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPageActions.js +28 -0
- package/dist/esm/pages/MainPage/MainPageActions.js.map +1 -0
- package/dist/esm/pages/MainPage/ReviewButton.js +11 -4
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutePriorityPage.js +48 -0
- package/dist/esm/pages/RoutePriorityPage.js.map +1 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.style.js.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js +3 -3
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js +3 -3
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +2 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/GasPriceSettings.js +1 -1
- package/dist/esm/pages/SettingsPage/ResetSettingsButton.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js +12 -27
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +3 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js +3 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippagePage.js +133 -0
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippagePage.js.map +1 -0
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +14 -72
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +26 -14
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ThemeSettings.js +4 -0
- package/dist/esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.style.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js +3 -3
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js +16 -15
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +3 -3
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js +27 -31
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js +4 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/I18nProvider/enResource.d.ts +1 -1
- package/dist/esm/providers/I18nProvider/enResource.js +1 -1
- package/dist/esm/providers/I18nProvider/i18n.js.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +2 -2
- package/dist/esm/providers/QueryClientProvider.js +2 -2
- package/dist/esm/providers/QueryClientProvider.js.map +1 -1
- package/dist/esm/providers/SDKClientProvider.js +3 -3
- package/dist/esm/providers/SDKClientProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js +4 -5
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/stores/StoreProvider.js +3 -4
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.js +3 -3
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/bookmarks/createBookmarkStore.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +4 -4
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js +1 -1
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js +14 -3
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/createFormStore.js +6 -2
- package/dist/esm/stores/form/createFormStore.js.map +1 -1
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js +3 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js.map +1 -1
- package/dist/esm/stores/form/types.d.ts +9 -1
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/form/useClearAmountFields.js +1 -0
- package/dist/esm/stores/form/useClearAmountFields.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.js.map +1 -1
- package/dist/esm/stores/form/useFieldValues.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/form/useFormStore.js +2 -2
- package/dist/esm/stores/form/useFormStore.js.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.js +3 -3
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.js.map +1 -1
- package/dist/esm/stores/navigationTabs/useNavigationTabLabel.js +22 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabLabel.js.map +1 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabsStore.js +64 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabsStore.js.map +1 -0
- package/dist/esm/stores/navigationTabs/utils.js +122 -0
- package/dist/esm/stores/navigationTabs/utils.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js +3 -3
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js +3 -3
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useIntermediateRoutesStore.js.map +1 -1
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.js +3 -3
- package/dist/esm/stores/settings/SettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.js +122 -96
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +0 -2
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/themes/utils.js.map +1 -1
- package/dist/esm/types/events.d.ts +10 -1
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/events.js +2 -0
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/widget.d.ts +28 -2
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.js.map +1 -1
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/fees.js.map +1 -1
- package/dist/esm/utils/format.d.ts +1 -1
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/format.js +2 -2
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getActionMessage.js.map +1 -1
- package/dist/esm/utils/getErrorMessage.js.map +1 -1
- package/dist/esm/utils/item.js.map +1 -1
- package/dist/esm/utils/limitOrder.js +61 -0
- package/dist/esm/utils/limitOrder.js.map +1 -0
- package/dist/esm/utils/{variant.js → mode.js} +2 -2
- package/dist/esm/utils/mode.js.map +1 -0
- package/dist/esm/utils/navigationRoutes.d.ts +2 -0
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/navigationRoutes.js +6 -0
- package/dist/esm/utils/navigationRoutes.js.map +1 -1
- package/dist/esm/utils/prepareActions.js +1 -1
- package/dist/esm/utils/prepareActions.js.map +1 -1
- package/dist/esm/utils/timer.js.map +1 -1
- package/dist/esm/utils/token.js +1 -1
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/package.json +13 -13
- package/src/App.tsx +7 -7
- package/src/AppDefault.tsx +16 -0
- package/src/AppDrawer.tsx +77 -78
- package/src/AppDrawerContext.ts +2 -2
- package/src/components/AmountInput/AmountInputEndAdornment.style.ts +1 -1
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +5 -2
- package/src/components/AmountInputCard/AmountInputCard.style.tsx +157 -0
- package/src/components/AmountInputCard/AmountInputCardPair.tsx +25 -0
- package/src/components/AmountInputCard/BalanceDisplay.style.tsx +9 -0
- package/src/components/AmountInputCard/BalanceDisplay.tsx +46 -0
- package/src/components/AmountInputCard/FiatValueToggle.tsx +55 -0
- package/src/components/AmountInputCard/PercentageChips.style.tsx +60 -0
- package/src/components/AmountInputCard/PercentageChips.tsx +100 -0
- package/src/components/AmountInputCard/ReceiveAmountCard.tsx +219 -0
- package/src/components/AmountInputCard/SendAmountCard.tsx +179 -0
- package/src/components/Avatar/Avatar.tsx +8 -3
- package/src/components/BaseTransactionButton/BaseTransactionButton.tsx +1 -0
- package/src/components/BottomSheet/BottomSheet.tsx +56 -52
- package/src/components/Header/CloseDrawerButton.tsx +5 -1
- package/src/components/Header/Header.tsx +20 -18
- package/src/components/Header/HeaderNavigationTabs.tsx +42 -0
- package/src/components/Header/HeaderTabs.tsx +48 -0
- package/src/components/Header/NavigationHeader.tsx +11 -8
- package/src/components/LimitOrderSettings/LimitOrderSettings.style.tsx +69 -0
- package/src/components/LimitOrderSettings/LimitOrderSettings.tsx +124 -0
- package/src/components/LimitPriceCard/LimitPriceCard.style.tsx +103 -0
- package/src/components/LimitPriceCard/LimitPriceCard.tsx +153 -0
- package/src/components/LimitPriceCard/LimitPricePresets.tsx +139 -0
- package/src/components/ReverseTokensButton/ReverseTokensButton.tsx +4 -1
- package/src/components/RouteCard/RouteProviderCard.tsx +113 -0
- package/src/components/Routes/LimitOrderRoutes.tsx +64 -0
- package/src/components/Routes/Routes.tsx +3 -2
- package/src/components/SettingsPanel/SettingsPanel.style.tsx +41 -0
- package/src/components/SettingsPanel/SettingsPanel.tsx +73 -0
- package/src/components/SettingsPanel/utils.ts +27 -0
- package/src/components/Skeleton/WidgetSkeleton.tsx +1 -1
- package/src/components/SwapButton/SwapButton.style.tsx +28 -0
- package/src/components/SwapButton/SwapButton.tsx +71 -0
- package/src/components/Tabs/NavigationTabs.tsx +3 -0
- package/src/components/TokenList/TokenDetailsSheet.tsx +9 -7
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +176 -177
- package/src/components/TokenList/useTokenSelect.ts +2 -2
- package/src/components/TokenPillButton/TokenPillButton.style.tsx +50 -0
- package/src/components/TokenPillButton/TokenPillButton.tsx +81 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useLimitMarketRate.ts +39 -0
- package/src/hooks/useLinkedLimitFields.ts +74 -0
- package/src/hooks/useRoutes.ts +45 -4
- package/src/hooks/useSwapOnly.ts +2 -5
- package/src/hooks/useToAddressRequirements.ts +2 -2
- package/src/hooks/useWideVariant.ts +8 -2
- package/src/pages/MainPage/LimitPageContent.tsx +18 -0
- package/src/pages/MainPage/MainPage.tsx +43 -30
- package/src/pages/MainPage/MainPageActions.tsx +35 -0
- package/src/pages/MainPage/ReviewButton.tsx +15 -3
- package/src/pages/RoutePriorityPage.tsx +55 -0
- package/src/pages/SendToWallet/BookmarkAddressSheet.tsx +176 -185
- package/src/pages/SendToWallet/ConfirmAddressSheet.tsx +9 -6
- package/src/pages/SettingsPage/RoutePrioritySettings.tsx +14 -38
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +58 -65
- package/src/pages/SettingsPage/SettingsCard/SettingsAccordian.tsx +4 -4
- package/src/pages/SettingsPage/SlippageSettings/SlippagePage.tsx +176 -0
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +32 -25
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +14 -128
- package/src/pages/SettingsPage/ThemeSettings.tsx +4 -0
- package/src/pages/TransactionPage/ConfirmToAddressSheet.tsx +9 -6
- package/src/pages/TransactionPage/ExchangeRateBottomSheet.tsx +53 -58
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +24 -21
- package/src/pages/TransactionPage/TransactionExecutionContent.tsx +8 -6
- package/src/providers/QueryClientProvider.tsx +2 -2
- package/src/providers/SDKClientProvider.tsx +3 -7
- package/src/providers/WidgetProvider/WidgetProvider.tsx +6 -7
- package/src/stores/StoreProvider.tsx +3 -10
- package/src/stores/bookmarks/BookmarkStore.tsx +4 -4
- package/src/stores/chains/ChainOrderStore.tsx +4 -4
- package/src/stores/form/FormStore.tsx +2 -2
- package/src/stores/form/URLSearchParamsBuilder.tsx +25 -3
- package/src/stores/form/createFormStore.ts +7 -3
- package/src/stores/form/getDefaultValuesFromQueryString.ts +11 -0
- package/src/stores/form/types.ts +14 -1
- package/src/stores/form/useClearAmountFields.ts +1 -0
- package/src/stores/form/useFormStore.ts +2 -2
- package/src/stores/header/useHeaderStore.tsx +3 -5
- package/src/stores/navigationTabs/types.ts +33 -0
- package/src/stores/navigationTabs/useNavigationTabLabel.ts +28 -0
- package/src/stores/navigationTabs/useNavigationTabsStore.tsx +113 -0
- package/src/stores/navigationTabs/utils.ts +196 -0
- package/src/stores/pinnedTokens/PinnedTokensStore.tsx +4 -4
- package/src/stores/routes/RouteExecutionStore.tsx +4 -4
- package/src/stores/settings/SettingsStore.tsx +4 -4
- package/src/stores/settings/createSettingsStore.ts +48 -12
- package/src/stores/settings/types.ts +1 -16
- package/src/types/events.ts +12 -0
- package/src/types/widget.ts +40 -1
- package/src/utils/format.ts +6 -2
- package/src/utils/limitOrder.ts +88 -0
- package/src/utils/navigationRoutes.ts +6 -0
- package/dist/esm/components/Header/SplitNavigationTabs.js +0 -33
- package/dist/esm/components/Header/SplitNavigationTabs.js.map +0 -1
- package/dist/esm/stores/settings/useSplitModeStore.js +0 -36
- package/dist/esm/stores/settings/useSplitModeStore.js.map +0 -1
- package/dist/esm/utils/variant.js.map +0 -1
- package/src/components/Header/SplitNavigationTabs.tsx +0 -32
- package/src/stores/settings/useSplitModeStore.tsx +0 -58
- /package/src/utils/{variant.ts → mode.ts} +0 -0
|
@@ -3,7 +3,7 @@ import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'
|
|
|
3
3
|
import OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'
|
|
4
4
|
import { Box, IconButton, Link, Skeleton, Typography } from '@mui/material'
|
|
5
5
|
import type React from 'react'
|
|
6
|
-
import {
|
|
6
|
+
import { type JSX, type PropsWithChildren, useMemo } from 'react'
|
|
7
7
|
import { useTranslation } from 'react-i18next'
|
|
8
8
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
9
9
|
import { useExplorer } from '../../hooks/useExplorer.js'
|
|
@@ -17,208 +17,207 @@ import {
|
|
|
17
17
|
TokenDetailsSheetContainer,
|
|
18
18
|
TokenDetailsSheetHeader,
|
|
19
19
|
} from './TokenDetailsSheetContent.style.js'
|
|
20
|
-
import type { TokenDetailsSheetBase } from './types.js'
|
|
21
20
|
|
|
22
21
|
interface TokenDetailsSheetContentProps {
|
|
23
22
|
tokenAddress: string | undefined
|
|
24
23
|
chainId: number | undefined
|
|
25
24
|
withoutContractAddress: boolean
|
|
25
|
+
onClose: () => void
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const noDataLabel = '-'
|
|
29
29
|
|
|
30
|
-
export const TokenDetailsSheetContent
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
export const TokenDetailsSheetContent = ({
|
|
31
|
+
tokenAddress,
|
|
32
|
+
chainId,
|
|
33
|
+
withoutContractAddress,
|
|
34
|
+
onClose,
|
|
35
|
+
}: TokenDetailsSheetContentProps): JSX.Element => {
|
|
36
|
+
const { t } = useTranslation()
|
|
37
|
+
const { getAddressLink } = useExplorer()
|
|
38
|
+
const { getChainById } = useAvailableChains()
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const { token, isLoading } = useToken(chainId, tokenAddress, true)
|
|
41
|
+
const chain = useMemo(() => getChainById(chainId), [chainId, getChainById])
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
43
|
+
const copyContractAddress = async (e: React.MouseEvent) => {
|
|
44
|
+
e.stopPropagation()
|
|
45
|
+
try {
|
|
46
|
+
// Clipboard API may throw if access is denied (e.g., in insecure contexts or older browsers)
|
|
47
|
+
await navigator.clipboard.writeText(tokenAddress || '')
|
|
48
|
+
} catch {
|
|
49
|
+
// Silently fail to avoid crashing the UI if clipboard write fails
|
|
49
50
|
}
|
|
51
|
+
}
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
>
|
|
62
|
-
<TokenAvatar
|
|
63
|
-
token={token}
|
|
64
|
-
chain={chain}
|
|
65
|
-
tokenAvatarSize={72}
|
|
66
|
-
chainAvatarSize={28}
|
|
67
|
-
isLoading={isLoading}
|
|
68
|
-
/>
|
|
69
|
-
<MetricContainer>
|
|
70
|
-
{isLoading ? (
|
|
71
|
-
<>
|
|
72
|
-
<Skeleton variant="rounded" width={80} height={24} />
|
|
73
|
-
<Skeleton variant="rounded" width={80} height={16} />
|
|
74
|
-
</>
|
|
75
|
-
) : (
|
|
76
|
-
<>
|
|
77
|
-
<Typography
|
|
78
|
-
sx={{
|
|
79
|
-
fontWeight: 700,
|
|
80
|
-
fontSize: '24px',
|
|
81
|
-
lineHeight: '24px',
|
|
82
|
-
color: 'text.primary',
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{token?.symbol || noDataLabel}
|
|
86
|
-
</Typography>
|
|
87
|
-
<Label>{token?.name || noDataLabel}</Label>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</MetricContainer>
|
|
91
|
-
</Box>
|
|
92
|
-
<IconButton
|
|
93
|
-
onClick={(e) => {
|
|
94
|
-
e.stopPropagation()
|
|
95
|
-
if (ref && typeof ref !== 'function') {
|
|
96
|
-
ref.current?.close()
|
|
97
|
-
}
|
|
98
|
-
}}
|
|
99
|
-
sx={{ mt: '-8px', mr: '-8px' }}
|
|
100
|
-
>
|
|
101
|
-
<Close />
|
|
102
|
-
</IconButton>
|
|
103
|
-
</TokenDetailsSheetHeader>
|
|
104
|
-
<MetricWithSkeleton
|
|
105
|
-
isLoading={isLoading}
|
|
106
|
-
label={t('tokenMetric.currentPrice')}
|
|
107
|
-
width={200}
|
|
108
|
-
height={40}
|
|
53
|
+
return (
|
|
54
|
+
<TokenDetailsSheetContainer>
|
|
55
|
+
<TokenDetailsSheetHeader>
|
|
56
|
+
<Box
|
|
57
|
+
sx={{
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
gap: 3,
|
|
62
|
+
}}
|
|
109
63
|
>
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
color: 'text.primary',
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
{token?.priceUSD
|
|
119
|
-
? t('format.currency', {
|
|
120
|
-
value: token.priceUSD,
|
|
121
|
-
})
|
|
122
|
-
: noDataLabel}
|
|
123
|
-
</Typography>
|
|
124
|
-
</MetricWithSkeleton>
|
|
125
|
-
{!withoutContractAddress && (
|
|
126
|
-
<MetricWithSkeleton
|
|
64
|
+
<TokenAvatar
|
|
65
|
+
token={token}
|
|
66
|
+
chain={chain}
|
|
67
|
+
tokenAvatarSize={72}
|
|
68
|
+
chainAvatarSize={28}
|
|
127
69
|
isLoading={isLoading}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
lineHeight: '24px',
|
|
145
|
-
color: 'text.primary',
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
{shortenAddress(tokenAddress)}
|
|
149
|
-
</Typography>
|
|
150
|
-
{tokenAddress && (
|
|
151
|
-
<CardIconButton size="small" onClick={copyContractAddress}>
|
|
152
|
-
<ContentCopyRounded fontSize="inherit" />
|
|
153
|
-
</CardIconButton>
|
|
154
|
-
)}
|
|
155
|
-
{tokenAddress && (
|
|
156
|
-
<CardIconButton
|
|
157
|
-
size="small"
|
|
158
|
-
LinkComponent={Link}
|
|
159
|
-
href={getAddressLink(tokenAddress, chainId)}
|
|
160
|
-
target="_blank"
|
|
161
|
-
rel="nofollow noreferrer"
|
|
162
|
-
onClick={(e) => e.stopPropagation()}
|
|
70
|
+
/>
|
|
71
|
+
<MetricContainer>
|
|
72
|
+
{isLoading ? (
|
|
73
|
+
<>
|
|
74
|
+
<Skeleton variant="rounded" width={80} height={24} />
|
|
75
|
+
<Skeleton variant="rounded" width={80} height={16} />
|
|
76
|
+
</>
|
|
77
|
+
) : (
|
|
78
|
+
<>
|
|
79
|
+
<Typography
|
|
80
|
+
sx={{
|
|
81
|
+
fontWeight: 700,
|
|
82
|
+
fontSize: '24px',
|
|
83
|
+
lineHeight: '24px',
|
|
84
|
+
color: 'text.primary',
|
|
85
|
+
}}
|
|
163
86
|
>
|
|
164
|
-
|
|
165
|
-
</
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
87
|
+
{token?.symbol || noDataLabel}
|
|
88
|
+
</Typography>
|
|
89
|
+
<Label>{token?.name || noDataLabel}</Label>
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
92
|
+
</MetricContainer>
|
|
93
|
+
</Box>
|
|
94
|
+
<IconButton
|
|
95
|
+
onClick={(e) => {
|
|
96
|
+
e.stopPropagation()
|
|
97
|
+
onClose()
|
|
98
|
+
}}
|
|
99
|
+
sx={{ mt: '-8px', mr: '-8px' }}
|
|
175
100
|
>
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
101
|
+
<Close />
|
|
102
|
+
</IconButton>
|
|
103
|
+
</TokenDetailsSheetHeader>
|
|
104
|
+
<MetricWithSkeleton
|
|
105
|
+
isLoading={isLoading}
|
|
106
|
+
label={t('tokenMetric.currentPrice')}
|
|
107
|
+
width={200}
|
|
108
|
+
height={40}
|
|
109
|
+
>
|
|
110
|
+
<Typography
|
|
111
|
+
sx={{
|
|
112
|
+
fontWeight: 700,
|
|
113
|
+
fontSize: '32px',
|
|
114
|
+
lineHeight: '40px',
|
|
115
|
+
color: 'text.primary',
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{token?.priceUSD
|
|
119
|
+
? t('format.currency', {
|
|
120
|
+
value: token.priceUSD,
|
|
121
|
+
})
|
|
122
|
+
: noDataLabel}
|
|
123
|
+
</Typography>
|
|
124
|
+
</MetricWithSkeleton>
|
|
125
|
+
{!withoutContractAddress && (
|
|
194
126
|
<MetricWithSkeleton
|
|
195
127
|
isLoading={isLoading}
|
|
196
|
-
label={t('tokenMetric.
|
|
128
|
+
label={t('tokenMetric.contractAddress')}
|
|
197
129
|
width={200}
|
|
198
130
|
height={24}
|
|
199
131
|
>
|
|
200
|
-
<
|
|
132
|
+
<Box
|
|
201
133
|
sx={{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
134
|
+
display: 'flex',
|
|
135
|
+
flexDirection: 'row',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: 1,
|
|
206
138
|
}}
|
|
207
139
|
>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
140
|
+
<Typography
|
|
141
|
+
sx={{
|
|
142
|
+
fontWeight: 700,
|
|
143
|
+
fontSize: '18px',
|
|
144
|
+
lineHeight: '24px',
|
|
145
|
+
color: 'text.primary',
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
{shortenAddress(tokenAddress)}
|
|
149
|
+
</Typography>
|
|
150
|
+
{tokenAddress && (
|
|
151
|
+
<CardIconButton size="small" onClick={copyContractAddress}>
|
|
152
|
+
<ContentCopyRounded fontSize="inherit" />
|
|
153
|
+
</CardIconButton>
|
|
154
|
+
)}
|
|
155
|
+
{tokenAddress && (
|
|
156
|
+
<CardIconButton
|
|
157
|
+
size="small"
|
|
158
|
+
LinkComponent={Link}
|
|
159
|
+
href={getAddressLink(tokenAddress, chainId)}
|
|
160
|
+
target="_blank"
|
|
161
|
+
rel="nofollow noreferrer"
|
|
162
|
+
onClick={(e) => e.stopPropagation()}
|
|
163
|
+
>
|
|
164
|
+
<OpenInNewRounded fontSize="inherit" />
|
|
165
|
+
</CardIconButton>
|
|
166
|
+
)}
|
|
167
|
+
</Box>
|
|
217
168
|
</MetricWithSkeleton>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)
|
|
169
|
+
)}
|
|
170
|
+
<MetricWithSkeleton
|
|
171
|
+
isLoading={isLoading}
|
|
172
|
+
label={t('tokenMetric.marketCap')}
|
|
173
|
+
width={200}
|
|
174
|
+
height={24}
|
|
175
|
+
>
|
|
176
|
+
<Typography
|
|
177
|
+
sx={{
|
|
178
|
+
fontWeight: 700,
|
|
179
|
+
fontSize: '18px',
|
|
180
|
+
lineHeight: '24px',
|
|
181
|
+
color: 'text.primary',
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
{token?.marketCapUSD
|
|
185
|
+
? t('format.currency', {
|
|
186
|
+
value: token.marketCapUSD,
|
|
187
|
+
notation: 'compact',
|
|
188
|
+
compactDisplay: 'short',
|
|
189
|
+
maximumFractionDigits: 2,
|
|
190
|
+
})
|
|
191
|
+
: noDataLabel}
|
|
192
|
+
</Typography>
|
|
193
|
+
</MetricWithSkeleton>
|
|
194
|
+
<MetricWithSkeleton
|
|
195
|
+
isLoading={isLoading}
|
|
196
|
+
label={t('tokenMetric.volume24h')}
|
|
197
|
+
width={200}
|
|
198
|
+
height={24}
|
|
199
|
+
>
|
|
200
|
+
<Typography
|
|
201
|
+
sx={{
|
|
202
|
+
fontWeight: 700,
|
|
203
|
+
fontSize: '18px',
|
|
204
|
+
lineHeight: '24px',
|
|
205
|
+
color: 'text.primary',
|
|
206
|
+
}}
|
|
207
|
+
>
|
|
208
|
+
{token?.volumeUSD24H
|
|
209
|
+
? t('format.currency', {
|
|
210
|
+
value: token.volumeUSD24H,
|
|
211
|
+
notation: 'compact',
|
|
212
|
+
compactDisplay: 'short',
|
|
213
|
+
maximumFractionDigits: 2,
|
|
214
|
+
})
|
|
215
|
+
: noDataLabel}
|
|
216
|
+
</Typography>
|
|
217
|
+
</MetricWithSkeleton>
|
|
218
|
+
</TokenDetailsSheetContainer>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
222
221
|
|
|
223
222
|
interface MetricWithSkeletonProps {
|
|
224
223
|
label: string
|
|
@@ -6,7 +6,7 @@ import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
|
6
6
|
import type { FormType } from '../../stores/form/types.js'
|
|
7
7
|
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
8
8
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
9
|
-
import {
|
|
9
|
+
import { useSplitMode } from '../../stores/navigationTabs/useNavigationTabsStore.js'
|
|
10
10
|
import { WidgetEvent } from '../../types/events.js'
|
|
11
11
|
import type { DisabledUIConfig } from '../../types/widget.js'
|
|
12
12
|
import { isItemAllowed } from '../../utils/item.js'
|
|
@@ -16,7 +16,7 @@ export const useTokenSelect = (
|
|
|
16
16
|
onClick?: () => void
|
|
17
17
|
): ((tokenAddress: string, chainId?: number) => void) => {
|
|
18
18
|
const { mode, disabledUI, chains: chainsConfig } = useWidgetConfig()
|
|
19
|
-
const splitMode =
|
|
19
|
+
const splitMode = useSplitMode()
|
|
20
20
|
const emitter = useWidgetEvents()
|
|
21
21
|
const { setFieldValue, getFieldValues } = useFieldActions()
|
|
22
22
|
const autoPopulateToAddress = useToAddressAutoPopulate()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Button, styled, type Theme, Typography } from '@mui/material'
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
const pillLayout = (theme: Theme) => ({
|
|
5
|
+
height: 36,
|
|
6
|
+
borderRadius: theme.vars.shape.borderRadiusSecondary,
|
|
7
|
+
padding: theme.spacing(0.5, 1),
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
gap: theme.spacing(1),
|
|
11
|
+
whiteSpace: 'nowrap',
|
|
12
|
+
flexShrink: 0,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const TokenPill: React.FC<React.ComponentProps<typeof Button>> = styled(
|
|
16
|
+
Button
|
|
17
|
+
)(({ theme }) => ({
|
|
18
|
+
...pillLayout(theme),
|
|
19
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,
|
|
20
|
+
border: '1px solid transparent',
|
|
21
|
+
transition: theme.transitions.create(['background-color'], {
|
|
22
|
+
duration: theme.transitions.duration.short,
|
|
23
|
+
}),
|
|
24
|
+
'&:hover': {
|
|
25
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,
|
|
26
|
+
},
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
export const TokenSelectPill: React.FC<React.ComponentProps<typeof Button>> =
|
|
30
|
+
styled(TokenPill)({ minWidth: 0 })
|
|
31
|
+
|
|
32
|
+
export const TokenPillSymbol: React.FC<
|
|
33
|
+
React.ComponentProps<typeof Typography>
|
|
34
|
+
> = styled(Typography)(({ theme }) => ({
|
|
35
|
+
fontSize: 14,
|
|
36
|
+
fontWeight: 700,
|
|
37
|
+
lineHeight: '18px',
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
textOverflow: 'ellipsis',
|
|
40
|
+
whiteSpace: 'nowrap',
|
|
41
|
+
color: theme.vars.palette.text.primary,
|
|
42
|
+
}))
|
|
43
|
+
|
|
44
|
+
export const TokenPillLabel: React.FC<React.ComponentProps<typeof Typography>> =
|
|
45
|
+
styled(Typography)(({ theme }) => ({
|
|
46
|
+
fontSize: 16,
|
|
47
|
+
fontWeight: 700,
|
|
48
|
+
lineHeight: '20px',
|
|
49
|
+
color: theme.vars.palette.text.secondary,
|
|
50
|
+
}))
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useNavigate } from '@tanstack/react-router'
|
|
2
|
+
import type { JSX } from 'react'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import { useChain } from '../../hooks/useChain.js'
|
|
5
|
+
import { useToken } from '../../hooks/useToken.js'
|
|
6
|
+
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
7
|
+
import type { FormTypeProps } from '../../stores/form/types.js'
|
|
8
|
+
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
9
|
+
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
10
|
+
import type { DisabledUIConfig } from '../../types/widget.js'
|
|
11
|
+
import { navigationRoutes } from '../../utils/navigationRoutes.js'
|
|
12
|
+
import { AvatarBadgedDefault } from '../Avatar/Avatar.js'
|
|
13
|
+
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
14
|
+
import {
|
|
15
|
+
TokenPill,
|
|
16
|
+
TokenPillLabel,
|
|
17
|
+
TokenPillSymbol,
|
|
18
|
+
TokenSelectPill,
|
|
19
|
+
} from './TokenPillButton.style.js'
|
|
20
|
+
|
|
21
|
+
export const TokenPillButton: React.FC<FormTypeProps> = ({
|
|
22
|
+
formType,
|
|
23
|
+
}): JSX.Element => {
|
|
24
|
+
const { t } = useTranslation()
|
|
25
|
+
const navigate = useNavigate()
|
|
26
|
+
const { disabledUI, mode } = useWidgetConfig()
|
|
27
|
+
|
|
28
|
+
const tokenKey = FormKeyHelper.getTokenKey(formType)
|
|
29
|
+
const [chainId, tokenAddress] = useFieldValues(
|
|
30
|
+
FormKeyHelper.getChainKey(formType),
|
|
31
|
+
tokenKey
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const { chain } = useChain(chainId)
|
|
35
|
+
const { token } = useToken(chainId, tokenAddress)
|
|
36
|
+
|
|
37
|
+
const isSelected = !!(chain && token)
|
|
38
|
+
|
|
39
|
+
const handleClick = (): void => {
|
|
40
|
+
navigate({
|
|
41
|
+
to:
|
|
42
|
+
formType === 'from'
|
|
43
|
+
? navigationRoutes.fromToken
|
|
44
|
+
: mode === 'refuel'
|
|
45
|
+
? navigationRoutes.toTokenNative
|
|
46
|
+
: navigationRoutes.toToken,
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isDisabled = !!disabledUI?.[tokenKey as keyof DisabledUIConfig]
|
|
51
|
+
|
|
52
|
+
const testId = `widget-${formType}-token-button`
|
|
53
|
+
|
|
54
|
+
if (isSelected) {
|
|
55
|
+
return (
|
|
56
|
+
<TokenPill
|
|
57
|
+
onClick={isDisabled ? undefined : handleClick}
|
|
58
|
+
disabled={isDisabled}
|
|
59
|
+
data-testid={testId}
|
|
60
|
+
>
|
|
61
|
+
<TokenAvatar
|
|
62
|
+
token={token}
|
|
63
|
+
chain={chain}
|
|
64
|
+
tokenAvatarSize={24}
|
|
65
|
+
chainAvatarSize={12}
|
|
66
|
+
/>
|
|
67
|
+
<TokenPillSymbol>{token.symbol}</TokenPillSymbol>
|
|
68
|
+
</TokenPill>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<TokenSelectPill
|
|
74
|
+
onClick={isDisabled ? undefined : handleClick}
|
|
75
|
+
data-testid={testId}
|
|
76
|
+
>
|
|
77
|
+
<AvatarBadgedDefault chain={chain} avatarSize={24} badgeSize={12} />
|
|
78
|
+
<TokenPillLabel>{t('main.select')}</TokenPillLabel>
|
|
79
|
+
</TokenSelectPill>
|
|
80
|
+
)
|
|
81
|
+
}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '4.
|
|
2
|
+
export const version = '4.2.0'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FormKeyHelper } from '../stores/form/types.js'
|
|
2
|
+
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
3
|
+
import { useToken } from './useToken.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Canonical limit-order market rate (receive token per send token), derived
|
|
7
|
+
* from the tokens' USD prices: 1 send token ≈ sendPrice / receivePrice receive
|
|
8
|
+
* tokens. This is the spot ratio — what the price card's "Market" reference and
|
|
9
|
+
* proximity indicator compare against. Returns `undefined` until both token
|
|
10
|
+
* prices are known.
|
|
11
|
+
*/
|
|
12
|
+
export const useLimitMarketRate = (): number | undefined => {
|
|
13
|
+
const [fromChainId, fromTokenAddress, toChainId, toTokenAddress] =
|
|
14
|
+
useFieldValues(
|
|
15
|
+
FormKeyHelper.getChainKey('from'),
|
|
16
|
+
FormKeyHelper.getTokenKey('from'),
|
|
17
|
+
FormKeyHelper.getChainKey('to'),
|
|
18
|
+
FormKeyHelper.getTokenKey('to')
|
|
19
|
+
)
|
|
20
|
+
const { token: fromToken } = useToken(fromChainId, fromTokenAddress)
|
|
21
|
+
const { token: toToken } = useToken(toChainId, toTokenAddress)
|
|
22
|
+
|
|
23
|
+
const fromPrice = Number(fromToken?.priceUSD)
|
|
24
|
+
const toPrice = Number(toToken?.priceUSD)
|
|
25
|
+
|
|
26
|
+
// A `priceUSD` of `"0"` (or missing) means the price is unknown — there's no
|
|
27
|
+
// meaningful spot ratio to derive, and dividing by a zero `toPrice` would be
|
|
28
|
+
// `Infinity`, so the falsy guard intentionally suppresses the rate here.
|
|
29
|
+
if (
|
|
30
|
+
!fromPrice ||
|
|
31
|
+
!toPrice ||
|
|
32
|
+
Number.isNaN(fromPrice) ||
|
|
33
|
+
Number.isNaN(toPrice)
|
|
34
|
+
) {
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return fromPrice / toPrice
|
|
39
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { FormKeyHelper } from '../stores/form/types.js'
|
|
2
|
+
import { useFieldActions } from '../stores/form/useFieldActions.js'
|
|
3
|
+
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
4
|
+
import { deriveLimitPrice, deriveReceiveAmount } from '../utils/limitOrder.js'
|
|
5
|
+
import { useToken } from './useToken.js'
|
|
6
|
+
|
|
7
|
+
export interface LinkedLimitFields {
|
|
8
|
+
limitPrice: string
|
|
9
|
+
/** Set the send amount (explicit user edit); derives receiveAmount when a price is set. */
|
|
10
|
+
setSendAmount: (value: string) => void
|
|
11
|
+
/** Set the limit price (canonical: receive per send); derives receiveAmount when a send amount is set. */
|
|
12
|
+
setLimitPrice: (value: string) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Implements the linked-field derivation for limit orders:
|
|
17
|
+
* - `limitPrice = receiveAmount / sendAmount`
|
|
18
|
+
* - editing sendAmount recomputes receiveAmount, holding the current price
|
|
19
|
+
* - editing limitPrice (with a send amount set) recomputes receiveAmount
|
|
20
|
+
* - sendAmount never changes without an explicit user edit
|
|
21
|
+
*
|
|
22
|
+
* The receive amount (`toAmount`) is read-only in the UI — it is derived here
|
|
23
|
+
* from the send amount and limit price, then sent to the routes request; the
|
|
24
|
+
* receive card only displays the resulting quote.
|
|
25
|
+
*
|
|
26
|
+
* The limit price is NOT stored: it is purely a function of the `fromAmount`
|
|
27
|
+
* and `toAmount` form fields (canonical receive-per-send). The UI layer handles
|
|
28
|
+
* base/quote display inversion. Because it's derived, editing the send amount
|
|
29
|
+
* only has to preserve the pre-edit price.
|
|
30
|
+
*/
|
|
31
|
+
export const useLinkedLimitFields = (): LinkedLimitFields => {
|
|
32
|
+
const { setFieldValue } = useFieldActions()
|
|
33
|
+
const [toChainId, toTokenAddress, sendAmount, receiveAmount] = useFieldValues(
|
|
34
|
+
FormKeyHelper.getChainKey('to'),
|
|
35
|
+
FormKeyHelper.getTokenKey('to'),
|
|
36
|
+
FormKeyHelper.getAmountKey('from'),
|
|
37
|
+
FormKeyHelper.getAmountKey('to')
|
|
38
|
+
)
|
|
39
|
+
const { token: toToken } = useToken(toChainId, toTokenAddress)
|
|
40
|
+
|
|
41
|
+
const limitPrice = deriveLimitPrice(sendAmount, receiveAmount)
|
|
42
|
+
|
|
43
|
+
const setSendAmount = (value: string): void => {
|
|
44
|
+
// Hold the pre-edit price (derived from the current fields) so changing the
|
|
45
|
+
// send amount rescales the receive amount instead of moving the price.
|
|
46
|
+
setFieldValue('fromAmount', value, { isDirty: true, isTouched: true })
|
|
47
|
+
const nextReceive = deriveReceiveAmount(
|
|
48
|
+
value,
|
|
49
|
+
limitPrice,
|
|
50
|
+
toToken?.decimals
|
|
51
|
+
)
|
|
52
|
+
if (nextReceive) {
|
|
53
|
+
setFieldValue('toAmount', nextReceive, { isDirty: true })
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const setLimitPrice = (value: string): void => {
|
|
58
|
+
// Write unconditionally (including '') so the receive amount tracks the
|
|
59
|
+
// price both ways — clearing the price clears the derived receive amount
|
|
60
|
+
// instead of leaving a stale value that re-derives the old price.
|
|
61
|
+
const nextReceive = deriveReceiveAmount(
|
|
62
|
+
sendAmount,
|
|
63
|
+
value,
|
|
64
|
+
toToken?.decimals
|
|
65
|
+
)
|
|
66
|
+
setFieldValue('toAmount', nextReceive, { isDirty: true })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
limitPrice,
|
|
71
|
+
setSendAmount,
|
|
72
|
+
setLimitPrice,
|
|
73
|
+
}
|
|
74
|
+
}
|