@lifi/widget 2.0.0-beta.9 → 2.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.js +2 -2
- package/AppDrawer.d.ts +3 -2
- package/AppDrawer.js +7 -3
- package/AppDrawer.style.d.ts +2 -2
- package/AppDrawer.style.js +5 -0
- package/AppProvider.js +4 -4
- package/AppRoutes.js +16 -16
- package/cjs/App.js +2 -2
- package/cjs/AppDrawer.d.ts +3 -2
- package/cjs/AppDrawer.js +7 -3
- package/cjs/AppDrawer.style.d.ts +2 -2
- package/cjs/AppDrawer.style.js +5 -0
- package/cjs/AppProvider.js +3 -3
- package/cjs/AppRoutes.js +16 -16
- package/cjs/components/{ActiveSwaps/ActiveSwapItem.d.ts → ActiveTransactions/ActiveTransactionItem.d.ts} +1 -1
- package/cjs/components/{ActiveSwaps/ActiveSwapItem.js → ActiveTransactions/ActiveTransactionItem.js} +6 -6
- package/cjs/{pages/SwapRoutesPage/SwapRoutesPage.d.ts → components/ActiveTransactions/ActiveTransactions.d.ts} +1 -1
- package/cjs/components/{ActiveSwaps/ActiveSwaps.js → ActiveTransactions/ActiveTransactions.js} +7 -7
- package/cjs/components/{ActiveSwaps/ActiveSwaps.style.d.ts → ActiveTransactions/ActiveTransactions.style.d.ts} +4 -4
- package/cjs/components/ActiveTransactions/index.d.ts +2 -0
- package/cjs/components/{ActiveSwaps → ActiveTransactions}/index.js +2 -2
- package/cjs/components/AmountInput/AmountInput.d.ts +12 -0
- package/cjs/components/AmountInput/AmountInput.js +57 -0
- package/{components/SwapInput/SwapInput.style.d.ts → cjs/components/AmountInput/AmountInput.style.d.ts} +1 -1
- package/{components/SwapInput/SwapInputAdornment.style.d.ts → cjs/components/AmountInput/AmountInputAdornment.style.d.ts} +2 -2
- package/cjs/components/AmountInput/AmountInputEndAdornment.d.ts +2 -0
- package/cjs/components/{SwapInput/SwapInputEndAdornment.js → AmountInput/AmountInputEndAdornment.js} +9 -9
- package/cjs/components/AmountInput/AmountInputStartAdornment.d.ts +3 -0
- package/cjs/components/{SwapInput/SwapInputStartAdornment.js → AmountInput/AmountInputStartAdornment.js} +5 -5
- package/cjs/components/AmountInput/FormPriceHelperText.d.ts +9 -0
- package/cjs/components/{SwapInput → AmountInput}/FormPriceHelperText.js +15 -9
- package/cjs/components/AmountInput/index.d.ts +1 -0
- package/cjs/{pages/SwapPage → components/AmountInput}/index.js +1 -1
- package/cjs/components/Card/CardIconButton.d.ts +2 -2
- package/cjs/components/Card/CardLabel.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +2 -2
- package/cjs/components/ChainSelect/ChainSelect.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +5 -5
- package/cjs/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/cjs/components/ContractComponent/ContractComponent.js +3 -5
- package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +3 -0
- package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.js +36 -0
- package/cjs/components/DefaultTransactionButton/index.d.ts +2 -0
- package/cjs/components/{SwapButton → DefaultTransactionButton}/index.js +3 -3
- package/cjs/components/{SwapButton → DefaultTransactionButton}/types.d.ts +1 -2
- package/cjs/components/GasMessage/FundsSufficiencyMessage.js +1 -1
- package/cjs/components/GasMessage/GasRefuelMessage.js +1 -1
- package/cjs/components/GasMessage/GasSufficiencyMessage.js +2 -2
- package/cjs/components/Header/Header.style.d.ts +2 -2
- package/cjs/components/Header/NavigationHeader.js +19 -19
- package/cjs/components/Header/NavigationTabs.js +3 -3
- package/cjs/components/Header/NavigationTabs.style.js +3 -3
- package/cjs/components/Header/index.d.ts +1 -1
- package/cjs/components/Header/index.js +1 -1
- package/cjs/components/Header/types.d.ts +5 -2
- package/cjs/components/Header/useHeaderStore.d.ts +2 -0
- package/cjs/components/Header/{useHeaderActionStore.js → useHeaderStore.js} +13 -2
- package/cjs/components/Insurance/Insurance.js +2 -2
- package/cjs/components/Insurance/InsuranceCard.js +10 -7
- package/cjs/components/Insurance/InsuranceCollapsed.js +7 -3
- package/cjs/components/Insurance/index.d.ts +1 -0
- package/cjs/components/Insurance/index.js +1 -0
- package/cjs/components/Insurance/types.d.ts +11 -7
- package/cjs/components/ListItemButton.d.ts +1 -1
- package/cjs/components/NFT/NFT.d.ts +1 -2
- package/cjs/components/NFT/NFT.js +15 -13
- package/cjs/components/NFT/NFT.style.d.ts +1 -1
- package/cjs/components/NFT/NFTBase.d.ts +3 -0
- package/cjs/components/NFT/NFTBase.js +13 -0
- package/cjs/components/NFT/index.d.ts +1 -0
- package/cjs/components/NFT/index.js +1 -0
- package/cjs/components/NFT/types.d.ts +3 -1
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +3 -3
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +9 -9
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/cjs/components/RouteCard/RouteCard.d.ts +4 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCard.js → RouteCard/RouteCard.js} +16 -12
- package/cjs/components/RouteCard/RouteCardEssentials.d.ts +3 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCardEssentials.js → RouteCard/RouteCardEssentials.js} +7 -7
- package/cjs/components/RouteCard/RouteCardSkeleton.d.ts +4 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCardSkeleton.js → RouteCard/RouteCardSkeleton.js} +6 -6
- package/cjs/components/RouteCard/RouteNotFoundCard.d.ts +2 -0
- package/cjs/components/{SwapRouteCard/SwapRouteNotFoundCard.js → RouteCard/RouteNotFoundCard.js} +4 -4
- package/cjs/components/RouteCard/index.d.ts +3 -0
- package/cjs/components/{SwapRoutes → RouteCard}/index.js +3 -2
- package/cjs/components/{SwapRouteCard → RouteCard}/types.d.ts +3 -3
- package/cjs/components/{SwapRoutes/SwapRoutes.d.ts → Routes/Routes.d.ts} +1 -1
- package/cjs/components/Routes/Routes.js +37 -0
- package/cjs/components/Routes/RoutesExpanded.d.ts +2 -0
- package/cjs/components/Routes/RoutesExpanded.js +44 -0
- package/cjs/components/Routes/index.d.ts +2 -0
- package/cjs/components/Routes/index.js +18 -0
- package/cjs/components/SelectChainAndToken.js +7 -7
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +2 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +11 -11
- package/cjs/components/SendToWallet/SendToWallet.js +9 -10
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
- package/cjs/components/SmallAvatar.d.ts +1 -1
- package/cjs/components/Step/DestinationWalletAddress.js +2 -2
- package/cjs/components/Step/GasStepProcess.js +1 -1
- package/cjs/components/Step/Step.js +13 -13
- package/cjs/components/Step/StepTimer.js +2 -2
- package/cjs/components/StepActions/StepActions.d.ts +3 -3
- package/cjs/components/StepActions/StepActions.js +20 -16
- package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
- package/cjs/components/StepActions/types.d.ts +2 -2
- package/cjs/components/Token/Token.js +1 -1
- package/cjs/components/TokenList/TokenList.js +2 -2
- package/cjs/components/TokenList/TokenList.style.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.style.js +11 -8
- package/cjs/components/TokenList/TokenListItem.js +5 -9
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -2
- package/cjs/components/TokenList/TokenNotFound.js +2 -2
- package/cjs/components/TokenList/VirtualizedTokenList.js +2 -2
- package/cjs/components/TokenList/types.d.ts +2 -2
- package/cjs/components/TokenList/useTokenSelect.d.ts +2 -2
- package/cjs/components/TokenList/useTokenSelect.js +11 -9
- package/cjs/config/theme.js +1 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +1 -1
- package/cjs/hooks/index.js +1 -1
- package/cjs/hooks/useChains.js +4 -4
- package/cjs/hooks/useFundsSufficiency.js +1 -5
- package/cjs/hooks/useGasRecommendation.d.ts +1 -1
- package/cjs/hooks/useGasRecommendation.js +5 -0
- package/cjs/hooks/useGasRefuel.js +4 -4
- package/cjs/hooks/useProcessMessage.d.ts +2 -2
- package/cjs/hooks/useProcessMessage.js +46 -46
- package/cjs/hooks/useRouteExecution.js +3 -4
- package/cjs/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -2
- package/cjs/hooks/{useSwapRoutes.js → useRoutes.js} +24 -24
- package/cjs/hooks/useTokenBalance.js +4 -5
- package/cjs/hooks/useTokenBalances.js +1 -5
- package/cjs/hooks/useTokens.js +21 -9
- package/cjs/i18n/bn.json +80 -80
- package/cjs/i18n/de.json +74 -74
- package/cjs/i18n/en.json +132 -131
- package/cjs/i18n/es.json +72 -72
- package/cjs/i18n/fr.json +102 -85
- package/cjs/i18n/id.json +102 -85
- package/cjs/i18n/it.json +112 -84
- package/cjs/i18n/ko.json +102 -85
- package/cjs/i18n/pt.json +89 -87
- package/cjs/i18n/th.json +102 -85
- package/cjs/i18n/tr.json +72 -72
- package/cjs/i18n/uk.json +98 -96
- package/cjs/i18n/vi.json +104 -79
- package/cjs/i18n/zh.json +104 -87
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +5 -1
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsEmpty.d.ts +2 -0
- package/cjs/pages/{ActiveSwapsPage/ActiveSwapsEmpty.js → ActiveTransactionsPage/ActiveTransactionsEmpty.js} +4 -4
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.d.ts +1 -0
- package/cjs/pages/{ActiveSwapsPage/ActiveSwapsPage.js → ActiveTransactionsPage/ActiveTransactionsPage.js} +8 -8
- package/cjs/pages/ActiveTransactionsPage/index.d.ts +1 -0
- package/cjs/pages/{ActiveSwapsPage → ActiveTransactionsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainGasMessage.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +7 -7
- package/cjs/pages/MainPage/ReviewButton.d.ts +2 -0
- package/cjs/pages/MainPage/ReviewButton.js +62 -0
- package/{components/SwapRoutes/SwapRoutes.d.ts → cjs/pages/RoutesPage/RoutesPage.d.ts} +1 -1
- package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.js → RoutesPage/RoutesPage.js} +11 -11
- package/cjs/pages/RoutesPage/index.d.ts +1 -0
- package/cjs/{components/SwapInput → pages/RoutesPage}/index.js +1 -1
- package/cjs/pages/SelectChainPage/types.d.ts +2 -2
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +1 -1
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +2 -2
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -2
- package/cjs/pages/SelectTokenPage/types.js +1 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/cjs/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
- package/cjs/pages/SettingsPage/ResetSettingsButton.js +1 -1
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsPage.d.ts +2 -0
- package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.js → TransactionDetailsPage/TransactionDetailsPage.js} +10 -9
- package/cjs/pages/TransactionDetailsPage/index.d.ts +1 -0
- package/cjs/pages/{SwapDetailsPage → TransactionDetailsPage}/index.js +1 -1
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryEmpty.d.ts +2 -0
- package/cjs/pages/{SwapHistoryPage/SwapHistoryEmpty.js → TransactionHistoryPage/TransactionHistoryEmpty.js} +4 -4
- package/cjs/pages/{SwapHistoryPage/SwapHistoryItem.d.ts → TransactionHistoryPage/TransactionHistoryItem.d.ts} +1 -1
- package/cjs/pages/{SwapHistoryPage/SwapHistoryItem.js → TransactionHistoryPage/TransactionHistoryItem.js} +4 -4
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +2 -0
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.js +35 -0
- package/cjs/pages/TransactionHistoryPage/index.d.ts +1 -0
- package/cjs/pages/TransactionHistoryPage/index.js +17 -0
- package/cjs/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.js +3 -3
- package/cjs/pages/TransactionPage/StartTransactionButton.d.ts +4 -0
- package/cjs/pages/TransactionPage/StartTransactionButton.js +21 -0
- package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.js +27 -24
- package/cjs/pages/TransactionPage/TokenValueBottomSheet.js +38 -0
- package/cjs/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/cjs/pages/TransactionPage/TransactionPage.js +125 -0
- package/cjs/pages/TransactionPage/index.d.ts +1 -0
- package/cjs/pages/{SwapHistoryPage → TransactionPage}/index.js +1 -1
- package/cjs/pages/TransactionPage/types.d.ts +6 -0
- package/cjs/pages/TransactionPage/utils.d.ts +2 -0
- package/cjs/pages/TransactionPage/utils.js +10 -0
- package/cjs/providers/{SwapFormProvider/SwapFormProvider.d.ts → FormProvider/FormProvider.d.ts} +1 -1
- package/cjs/providers/{SwapFormProvider/SwapFormProvider.js → FormProvider/FormProvider.js} +11 -11
- package/cjs/providers/FormProvider/FormUpdater.d.ts +5 -0
- package/cjs/providers/{SwapFormProvider → FormProvider}/FormUpdater.js +14 -14
- package/cjs/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.js +6 -6
- package/cjs/providers/{SwapFormProvider → FormProvider}/index.d.ts +1 -1
- package/cjs/providers/{SwapFormProvider → FormProvider}/index.js +1 -1
- package/cjs/providers/FormProvider/types.d.ts +37 -0
- package/cjs/providers/FormProvider/types.js +23 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +5 -3
- package/cjs/providers/WalletProvider/types.d.ts +1 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/cjs/providers/index.d.ts +1 -1
- package/cjs/providers/index.js +1 -1
- package/cjs/stores/routes/createRouteExecutionStore.js +1 -1
- package/cjs/stores/routes/index.d.ts +1 -1
- package/cjs/stores/routes/index.js +1 -1
- package/cjs/stores/routes/types.js +1 -1
- package/cjs/stores/routes/useTransactionHistory.d.ts +2 -0
- package/cjs/stores/routes/{useSwapHistory.js → useTransactionHistory.js} +3 -3
- package/cjs/types/events.d.ts +9 -1
- package/cjs/types/events.js +2 -1
- package/cjs/types/widget.d.ts +6 -4
- package/cjs/types/widget.js +3 -3
- package/cjs/utils/elements.js +1 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +13 -15
- package/cjs/utils/navigationRoutes.d.ts +5 -5
- package/cjs/utils/navigationRoutes.js +15 -15
- package/components/{ActiveSwaps/ActiveSwapItem.d.ts → ActiveTransactions/ActiveTransactionItem.d.ts} +1 -1
- package/components/{ActiveSwaps/ActiveSwapItem.js → ActiveTransactions/ActiveTransactionItem.js} +3 -3
- package/components/ActiveTransactions/ActiveTransactions.d.ts +3 -0
- package/components/{ActiveSwaps/ActiveSwaps.js → ActiveTransactions/ActiveTransactions.js} +5 -5
- package/components/{ActiveSwaps/ActiveSwaps.style.d.ts → ActiveTransactions/ActiveTransactions.style.d.ts} +4 -4
- package/components/ActiveTransactions/index.d.ts +2 -0
- package/components/ActiveTransactions/index.js +2 -0
- package/components/AmountInput/AmountInput.d.ts +12 -0
- package/components/AmountInput/AmountInput.js +52 -0
- package/{cjs/components/SwapInput/SwapInput.style.d.ts → components/AmountInput/AmountInput.style.d.ts} +1 -1
- package/{cjs/components/SwapInput/SwapInputAdornment.style.d.ts → components/AmountInput/AmountInputAdornment.style.d.ts} +2 -2
- package/components/AmountInput/AmountInputEndAdornment.d.ts +2 -0
- package/components/{SwapInput/SwapInputEndAdornment.js → AmountInput/AmountInputEndAdornment.js} +7 -7
- package/components/AmountInput/AmountInputStartAdornment.d.ts +3 -0
- package/components/{SwapInput/SwapInputStartAdornment.js → AmountInput/AmountInputStartAdornment.js} +4 -4
- package/components/AmountInput/FormPriceHelperText.d.ts +9 -0
- package/components/{SwapInput → AmountInput}/FormPriceHelperText.js +14 -9
- package/components/AmountInput/index.d.ts +1 -0
- package/components/AmountInput/index.js +1 -0
- package/components/Card/CardIconButton.d.ts +2 -2
- package/components/Card/CardLabel.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +2 -2
- package/components/ChainSelect/ChainSelect.js +2 -2
- package/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/components/ChainSelect/useChainSelect.js +6 -6
- package/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/components/ContractComponent/ContractComponent.js +3 -5
- package/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +3 -0
- package/components/DefaultTransactionButton/DefaultTransactionButton.js +32 -0
- package/components/DefaultTransactionButton/index.d.ts +2 -0
- package/components/DefaultTransactionButton/index.js +2 -0
- package/components/{SwapButton → DefaultTransactionButton}/types.d.ts +1 -2
- package/components/GasMessage/FundsSufficiencyMessage.js +1 -1
- package/components/GasMessage/GasRefuelMessage.js +1 -1
- package/components/GasMessage/GasSufficiencyMessage.js +2 -2
- package/components/Header/Header.style.d.ts +2 -2
- package/components/Header/NavigationHeader.js +19 -19
- package/components/Header/NavigationTabs.js +4 -4
- package/components/Header/NavigationTabs.style.js +3 -3
- package/components/Header/index.d.ts +1 -1
- package/components/Header/index.js +1 -1
- package/components/Header/types.d.ts +5 -2
- package/components/Header/useHeaderStore.d.ts +2 -0
- package/components/Header/useHeaderStore.js +25 -0
- package/components/Insurance/Insurance.js +2 -2
- package/components/Insurance/InsuranceCard.js +11 -8
- package/components/Insurance/InsuranceCollapsed.js +8 -4
- package/components/Insurance/index.d.ts +1 -0
- package/components/Insurance/index.js +1 -0
- package/components/Insurance/types.d.ts +11 -7
- package/components/ListItemButton.d.ts +1 -1
- package/components/NFT/NFT.d.ts +1 -2
- package/components/NFT/NFT.js +17 -15
- package/components/NFT/NFT.style.d.ts +1 -1
- package/components/NFT/NFTBase.d.ts +3 -0
- package/components/NFT/NFTBase.js +9 -0
- package/components/NFT/index.d.ts +1 -0
- package/components/NFT/index.js +1 -0
- package/components/NFT/types.d.ts +3 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +4 -4
- package/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/components/RouteCard/RouteCard.d.ts +4 -0
- package/components/{SwapRouteCard/SwapRouteCard.js → RouteCard/RouteCard.js} +15 -11
- package/components/RouteCard/RouteCardEssentials.d.ts +3 -0
- package/components/{SwapRouteCard/SwapRouteCardEssentials.js → RouteCard/RouteCardEssentials.js} +3 -3
- package/components/RouteCard/RouteCardSkeleton.d.ts +4 -0
- package/components/{SwapRouteCard/SwapRouteCardSkeleton.js → RouteCard/RouteCardSkeleton.js} +4 -4
- package/components/RouteCard/RouteNotFoundCard.d.ts +2 -0
- package/components/{SwapRouteCard/SwapRouteNotFoundCard.js → RouteCard/RouteNotFoundCard.js} +2 -2
- package/components/RouteCard/index.d.ts +3 -0
- package/components/RouteCard/index.js +3 -0
- package/components/{SwapRouteCard → RouteCard}/types.d.ts +3 -3
- package/{cjs/components/ActiveSwaps/ActiveSwaps.d.ts → components/Routes/Routes.d.ts} +1 -1
- package/components/Routes/Routes.js +33 -0
- package/components/Routes/RoutesExpanded.d.ts +2 -0
- package/components/{SwapRoutes/SwapRoutesExpanded.js → Routes/RoutesExpanded.js} +12 -10
- package/components/Routes/index.d.ts +2 -0
- package/components/Routes/index.js +2 -0
- package/components/SelectChainAndToken.js +8 -8
- package/components/SelectTokenButton/SelectTokenButton.d.ts +2 -2
- package/components/SelectTokenButton/SelectTokenButton.js +12 -12
- package/components/SendToWallet/SendToWallet.js +10 -11
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +3 -3
- package/components/SmallAvatar.d.ts +1 -1
- package/components/Step/DestinationWalletAddress.js +2 -2
- package/components/Step/GasStepProcess.js +1 -1
- package/components/Step/Step.js +13 -13
- package/components/Step/StepTimer.js +2 -2
- package/components/StepActions/StepActions.d.ts +3 -3
- package/components/StepActions/StepActions.js +20 -16
- package/components/StepActions/StepActions.style.d.ts +1 -1
- package/components/StepActions/types.d.ts +2 -2
- package/components/Token/Token.js +1 -1
- package/components/TokenList/TokenList.js +3 -3
- package/components/TokenList/TokenList.style.d.ts +4 -4
- package/components/TokenList/TokenList.style.js +11 -8
- package/components/TokenList/TokenListItem.js +7 -11
- package/components/TokenList/TokenNotFound.d.ts +2 -2
- package/components/TokenList/TokenNotFound.js +3 -3
- package/components/TokenList/VirtualizedTokenList.js +2 -2
- package/components/TokenList/types.d.ts +2 -2
- package/components/TokenList/useTokenSelect.d.ts +2 -2
- package/components/TokenList/useTokenSelect.js +12 -10
- package/config/theme.js +1 -2
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useChains.js +5 -5
- package/hooks/useFundsSufficiency.js +2 -6
- package/hooks/useGasRecommendation.d.ts +1 -1
- package/hooks/useGasRecommendation.js +5 -0
- package/hooks/useGasRefuel.js +5 -5
- package/hooks/useProcessMessage.d.ts +2 -2
- package/hooks/useProcessMessage.js +46 -46
- package/hooks/useRouteExecution.js +3 -4
- package/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -2
- package/hooks/{useSwapRoutes.js → useRoutes.js} +23 -23
- package/hooks/useTokenBalance.js +4 -5
- package/hooks/useTokenBalances.js +1 -5
- package/hooks/useTokens.js +21 -9
- package/i18n/bn.json +80 -80
- package/i18n/de.json +74 -74
- package/i18n/en.json +132 -131
- package/i18n/es.json +72 -72
- package/i18n/fr.json +102 -85
- package/i18n/id.json +102 -85
- package/i18n/it.json +112 -84
- package/i18n/ko.json +102 -85
- package/i18n/pt.json +89 -87
- package/i18n/th.json +102 -85
- package/i18n/tr.json +72 -72
- package/i18n/uk.json +98 -96
- package/i18n/vi.json +104 -79
- package/i18n/zh.json +104 -87
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +31 -17
- package/pages/ActiveTransactionsPage/ActiveTransactionsEmpty.d.ts +2 -0
- package/pages/{ActiveSwapsPage/ActiveSwapsEmpty.js → ActiveTransactionsPage/ActiveTransactionsEmpty.js} +2 -2
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.d.ts +1 -0
- package/pages/{ActiveSwapsPage/ActiveSwapsPage.js → ActiveTransactionsPage/ActiveTransactionsPage.js} +7 -7
- package/pages/ActiveTransactionsPage/index.d.ts +1 -0
- package/pages/ActiveTransactionsPage/index.js +1 -0
- package/pages/MainPage/MainGasMessage.js +2 -2
- package/pages/MainPage/MainPage.js +7 -7
- package/pages/MainPage/ReviewButton.d.ts +2 -0
- package/pages/MainPage/ReviewButton.js +58 -0
- package/{components/ActiveSwaps/ActiveSwaps.d.ts → pages/RoutesPage/RoutesPage.d.ts} +1 -1
- package/pages/{SwapRoutesPage/SwapRoutesPage.js → RoutesPage/RoutesPage.js} +11 -11
- package/pages/RoutesPage/index.d.ts +1 -0
- package/pages/RoutesPage/index.js +1 -0
- package/pages/SelectChainPage/types.d.ts +2 -2
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +2 -2
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +2 -2
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.js +4 -4
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/pages/SettingsPage/LanguageSelect.js +1 -1
- package/pages/SettingsPage/ResetSettingsButton.js +1 -1
- package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/pages/TransactionDetailsPage/TransactionDetailsPage.d.ts +2 -0
- package/pages/{SwapDetailsPage/SwapDetailsPage.js → TransactionDetailsPage/TransactionDetailsPage.js} +8 -7
- package/pages/TransactionDetailsPage/index.d.ts +1 -0
- package/pages/TransactionDetailsPage/index.js +1 -0
- package/pages/TransactionHistoryPage/TransactionHistoryEmpty.d.ts +2 -0
- package/pages/{SwapHistoryPage/SwapHistoryEmpty.js → TransactionHistoryPage/TransactionHistoryEmpty.js} +2 -2
- package/pages/{SwapHistoryPage/SwapHistoryItem.d.ts → TransactionHistoryPage/TransactionHistoryItem.d.ts} +1 -1
- package/pages/{SwapHistoryPage/SwapHistoryItem.js → TransactionHistoryPage/TransactionHistoryItem.js} +2 -2
- package/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +2 -0
- package/pages/TransactionHistoryPage/TransactionHistoryPage.js +31 -0
- package/pages/TransactionHistoryPage/index.d.ts +1 -0
- package/pages/TransactionHistoryPage/index.js +1 -0
- package/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.js +3 -3
- package/pages/TransactionPage/StartTransactionButton.d.ts +4 -0
- package/pages/TransactionPage/StartTransactionButton.js +16 -0
- package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.js +28 -25
- package/pages/TransactionPage/TokenValueBottomSheet.js +34 -0
- package/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/pages/TransactionPage/TransactionPage.js +121 -0
- package/pages/TransactionPage/index.d.ts +1 -0
- package/pages/TransactionPage/index.js +1 -0
- package/pages/TransactionPage/types.d.ts +6 -0
- package/pages/TransactionPage/utils.d.ts +2 -0
- package/pages/TransactionPage/utils.js +6 -0
- package/providers/{SwapFormProvider/SwapFormProvider.d.ts → FormProvider/FormProvider.d.ts} +1 -1
- package/providers/{SwapFormProvider/SwapFormProvider.js → FormProvider/FormProvider.js} +12 -12
- package/providers/FormProvider/FormUpdater.d.ts +5 -0
- package/providers/{SwapFormProvider → FormProvider}/FormUpdater.js +14 -14
- package/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.js +7 -7
- package/providers/{SwapFormProvider → FormProvider}/index.d.ts +1 -1
- package/providers/{SwapFormProvider → FormProvider}/index.js +1 -1
- package/providers/FormProvider/types.d.ts +37 -0
- package/providers/FormProvider/types.js +20 -0
- package/providers/WalletProvider/WalletProvider.js +5 -3
- package/providers/WalletProvider/types.d.ts +1 -1
- package/providers/WidgetProvider/WidgetProvider.js +2 -2
- package/providers/index.d.ts +1 -1
- package/providers/index.js +1 -1
- package/stores/routes/createRouteExecutionStore.js +1 -1
- package/stores/routes/index.d.ts +1 -1
- package/stores/routes/index.js +1 -1
- package/stores/routes/useTransactionHistory.d.ts +2 -0
- package/stores/routes/{useSwapHistory.js → useTransactionHistory.js} +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +9 -1
- package/types/events.js +1 -0
- package/types/widget.d.ts +6 -4
- package/utils/format.d.ts +1 -1
- package/utils/format.js +11 -13
- package/utils/navigationRoutes.d.ts +5 -5
- package/utils/navigationRoutes.js +15 -15
- package/cjs/components/ActiveSwaps/index.d.ts +0 -2
- package/cjs/components/Header/useHeaderActionStore.d.ts +0 -2
- package/cjs/components/SwapButton/SwapButton.d.ts +0 -3
- package/cjs/components/SwapButton/SwapButton.js +0 -56
- package/cjs/components/SwapButton/index.d.ts +0 -2
- package/cjs/components/SwapInput/FitInputText.d.ts +0 -3
- package/cjs/components/SwapInput/FitInputText.js +0 -19
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +0 -3
- package/cjs/components/SwapInput/SwapInput.d.ts +0 -4
- package/cjs/components/SwapInput/SwapInput.js +0 -41
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -2
- package/cjs/components/SwapInput/SwapInputStartAdornment.d.ts +0 -3
- package/cjs/components/SwapInput/index.d.ts +0 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +0 -4
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +0 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +0 -4
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +0 -2
- package/cjs/components/SwapRouteCard/index.d.ts +0 -3
- package/cjs/components/SwapRouteCard/index.js +0 -19
- package/cjs/components/SwapRoutes/SwapRoutes.js +0 -37
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -2
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +0 -42
- package/cjs/components/SwapRoutes/index.d.ts +0 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +0 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/ActiveSwapsPage/index.d.ts +0 -1
- package/cjs/pages/MainPage/MainSwapButton.d.ts +0 -2
- package/cjs/pages/MainPage/MainSwapButton.js +0 -27
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.d.ts +0 -2
- package/cjs/pages/SwapDetailsPage/index.d.ts +0 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +0 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.d.ts +0 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +0 -35
- package/cjs/pages/SwapHistoryPage/index.d.ts +0 -1
- package/cjs/pages/SwapPage/StartSwapButton.d.ts +0 -4
- package/cjs/pages/SwapPage/StartSwapButton.js +0 -21
- package/cjs/pages/SwapPage/SwapPage.d.ts +0 -2
- package/cjs/pages/SwapPage/SwapPage.js +0 -99
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +0 -43
- package/cjs/pages/SwapPage/index.d.ts +0 -1
- package/cjs/pages/SwapPage/types.d.ts +0 -9
- package/cjs/pages/SwapRoutesPage/index.d.ts +0 -1
- package/cjs/pages/SwapRoutesPage/index.js +0 -17
- package/cjs/providers/SwapFormProvider/FormUpdater.d.ts +0 -5
- package/cjs/providers/SwapFormProvider/types.d.ts +0 -37
- package/cjs/providers/SwapFormProvider/types.js +0 -23
- package/cjs/stores/routes/useSwapHistory.d.ts +0 -2
- package/components/ActiveSwaps/index.d.ts +0 -2
- package/components/ActiveSwaps/index.js +0 -2
- package/components/Header/useHeaderActionStore.d.ts +0 -2
- package/components/Header/useHeaderActionStore.js +0 -14
- package/components/SwapButton/SwapButton.d.ts +0 -3
- package/components/SwapButton/SwapButton.js +0 -52
- package/components/SwapButton/index.d.ts +0 -2
- package/components/SwapButton/index.js +0 -2
- package/components/SwapInput/FitInputText.d.ts +0 -3
- package/components/SwapInput/FitInputText.js +0 -16
- package/components/SwapInput/FormPriceHelperText.d.ts +0 -3
- package/components/SwapInput/SwapInput.d.ts +0 -4
- package/components/SwapInput/SwapInput.js +0 -37
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -2
- package/components/SwapInput/SwapInputStartAdornment.d.ts +0 -3
- package/components/SwapInput/index.d.ts +0 -1
- package/components/SwapInput/index.js +0 -1
- package/components/SwapRouteCard/SwapRouteCard.d.ts +0 -4
- package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +0 -3
- package/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +0 -4
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +0 -2
- package/components/SwapRouteCard/index.d.ts +0 -3
- package/components/SwapRouteCard/index.js +0 -3
- package/components/SwapRoutes/SwapRoutes.js +0 -33
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -2
- package/components/SwapRoutes/index.d.ts +0 -2
- package/components/SwapRoutes/index.js +0 -2
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +0 -2
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/ActiveSwapsPage/index.d.ts +0 -1
- package/pages/ActiveSwapsPage/index.js +0 -1
- package/pages/MainPage/MainSwapButton.d.ts +0 -2
- package/pages/MainPage/MainSwapButton.js +0 -23
- package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +0 -2
- package/pages/SwapDetailsPage/index.d.ts +0 -1
- package/pages/SwapDetailsPage/index.js +0 -1
- package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +0 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +0 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.js +0 -31
- package/pages/SwapHistoryPage/index.d.ts +0 -1
- package/pages/SwapHistoryPage/index.js +0 -1
- package/pages/SwapPage/StartSwapButton.d.ts +0 -4
- package/pages/SwapPage/StartSwapButton.js +0 -16
- package/pages/SwapPage/SwapPage.d.ts +0 -2
- package/pages/SwapPage/SwapPage.js +0 -95
- package/pages/SwapPage/TokenValueBottomSheet.js +0 -39
- package/pages/SwapPage/index.d.ts +0 -1
- package/pages/SwapPage/index.js +0 -1
- package/pages/SwapPage/types.d.ts +0 -9
- package/pages/SwapRoutesPage/SwapRoutesPage.d.ts +0 -3
- package/pages/SwapRoutesPage/index.d.ts +0 -1
- package/pages/SwapRoutesPage/index.js +0 -1
- package/providers/SwapFormProvider/FormUpdater.d.ts +0 -5
- package/providers/SwapFormProvider/types.d.ts +0 -37
- package/providers/SwapFormProvider/types.js +0 -20
- package/stores/routes/useSwapHistory.d.ts +0 -2
- /package/cjs/components/{ActiveSwaps/ActiveSwaps.style.js → ActiveTransactions/ActiveTransactions.style.js} +0 -0
- /package/cjs/components/{SwapInput/SwapInput.style.js → AmountInput/AmountInput.style.js} +0 -0
- /package/cjs/components/{SwapInput/SwapInputAdornment.style.js → AmountInput/AmountInputAdornment.style.js} +0 -0
- /package/cjs/components/{SwapButton → DefaultTransactionButton}/types.js +0 -0
- /package/cjs/components/{SwapRouteCard/SwapRouteCard.style.d.ts → RouteCard/RouteCard.style.d.ts} +0 -0
- /package/cjs/components/{SwapRouteCard/SwapRouteCard.style.js → RouteCard/RouteCard.style.js} +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/types.js +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/utils.d.ts +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/utils.js +0 -0
- /package/cjs/components/{SwapRoutes/SwapRoutesExpanded.style.d.ts → Routes/RoutesExpanded.style.d.ts} +0 -0
- /package/cjs/components/{SwapRoutes/SwapRoutesExpanded.style.js → Routes/RoutesExpanded.style.js} +0 -0
- /package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.style.d.ts → RoutesPage/RoutesPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.style.js → RoutesPage/RoutesPage.style.js} +0 -0
- /package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.style.d.ts → TransactionDetailsPage/TransactionDetailsPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.style.js → TransactionDetailsPage/TransactionDetailsPage.style.js} +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/TokenValueBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage/SwapPage.style.d.ts → TransactionPage/TransactionPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapPage/SwapPage.style.js → TransactionPage/TransactionPage.style.js} +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/types.js +0 -0
- /package/cjs/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.d.ts +0 -0
- /package/components/{ActiveSwaps/ActiveSwaps.style.js → ActiveTransactions/ActiveTransactions.style.js} +0 -0
- /package/components/{SwapInput/SwapInput.style.js → AmountInput/AmountInput.style.js} +0 -0
- /package/components/{SwapInput/SwapInputAdornment.style.js → AmountInput/AmountInputAdornment.style.js} +0 -0
- /package/components/{SwapButton → DefaultTransactionButton}/types.js +0 -0
- /package/components/{SwapRouteCard/SwapRouteCard.style.d.ts → RouteCard/RouteCard.style.d.ts} +0 -0
- /package/components/{SwapRouteCard/SwapRouteCard.style.js → RouteCard/RouteCard.style.js} +0 -0
- /package/components/{SwapRouteCard → RouteCard}/types.js +0 -0
- /package/components/{SwapRouteCard → RouteCard}/utils.d.ts +0 -0
- /package/components/{SwapRouteCard → RouteCard}/utils.js +0 -0
- /package/components/{SwapRoutes/SwapRoutesExpanded.style.d.ts → Routes/RoutesExpanded.style.d.ts} +0 -0
- /package/components/{SwapRoutes/SwapRoutesExpanded.style.js → Routes/RoutesExpanded.style.js} +0 -0
- /package/pages/{SwapRoutesPage/SwapRoutesPage.style.d.ts → RoutesPage/RoutesPage.style.d.ts} +0 -0
- /package/pages/{SwapRoutesPage/SwapRoutesPage.style.js → RoutesPage/RoutesPage.style.js} +0 -0
- /package/pages/{SwapDetailsPage/SwapDetailsPage.style.d.ts → TransactionDetailsPage/TransactionDetailsPage.style.d.ts} +0 -0
- /package/pages/{SwapDetailsPage/SwapDetailsPage.style.js → TransactionDetailsPage/TransactionDetailsPage.style.js} +0 -0
- /package/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +0 -0
- /package/pages/{SwapPage → TransactionPage}/TokenValueBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage/SwapPage.style.d.ts → TransactionPage/TransactionPage.style.d.ts} +0 -0
- /package/pages/{SwapPage/SwapPage.style.js → TransactionPage/TransactionPage.style.js} +0 -0
- /package/pages/{SwapPage → TransactionPage}/types.js +0 -0
- /package/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.d.ts +0 -0
|
@@ -4,7 +4,7 @@ import { Collapse, FormHelperText } from '@mui/material';
|
|
|
4
4
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
5
5
|
import { useController, useFormContext, useFormState } from 'react-hook-form';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import {
|
|
7
|
+
import { FormKey, useWallet, useWidgetConfig } from '../../providers';
|
|
8
8
|
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
9
9
|
import { DisabledUI, HiddenUI, RequiredUI } from '../../types';
|
|
10
10
|
import { Card, CardTitle } from '../Card';
|
|
@@ -21,10 +21,9 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
21
21
|
const requiredToAddress = requiredUI?.includes(RequiredUI.ToAddress);
|
|
22
22
|
const requiredToAddressRef = useRef(requiredToAddress);
|
|
23
23
|
const { field: { onChange, onBlur, name, value }, } = useController({
|
|
24
|
-
name:
|
|
24
|
+
name: FormKey.ToAddress,
|
|
25
25
|
rules: {
|
|
26
|
-
required: requiredToAddress &&
|
|
27
|
-
t('swap.error.title.walletAddressRequired'),
|
|
26
|
+
required: requiredToAddress && t('error.title.walletAddressRequired'),
|
|
28
27
|
validate: async (value) => {
|
|
29
28
|
try {
|
|
30
29
|
if (!value) {
|
|
@@ -32,13 +31,13 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
32
31
|
}
|
|
33
32
|
const address = await account.signer?.provider?.resolveName(value);
|
|
34
33
|
return (isAddress(address || value) ||
|
|
35
|
-
t('
|
|
34
|
+
t('error.title.walletAddressInvalid'));
|
|
36
35
|
}
|
|
37
36
|
catch {
|
|
38
|
-
return t('
|
|
37
|
+
return t('error.title.walletEnsAddressInvalid');
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
|
-
onBlur: () => trigger(
|
|
40
|
+
onBlur: () => trigger(FormKey.ToAddress),
|
|
42
41
|
},
|
|
43
42
|
});
|
|
44
43
|
// We want to show toAddress field if it is set via widget configuration and not hidden
|
|
@@ -52,20 +51,20 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
52
51
|
}
|
|
53
52
|
}, [showInstantly, setSendToWallet]);
|
|
54
53
|
useEffect(() => {
|
|
55
|
-
const value = getValues(
|
|
54
|
+
const value = getValues(FormKey.ToAddress);
|
|
56
55
|
if (value) {
|
|
57
|
-
trigger(
|
|
56
|
+
trigger(FormKey.ToAddress);
|
|
58
57
|
// Trigger validation if we change requiredToAddress in the runtime
|
|
59
58
|
}
|
|
60
59
|
else if (requiredToAddressRef.current !== requiredToAddress) {
|
|
61
60
|
requiredToAddressRef.current = requiredToAddress;
|
|
62
|
-
trigger(
|
|
61
|
+
trigger(FormKey.ToAddress).then(() => clearErrors(FormKey.ToAddress));
|
|
63
62
|
}
|
|
64
63
|
}, [account.chainId, clearErrors, getValues, requiredToAddress, trigger]);
|
|
65
64
|
if (hiddenToAddress) {
|
|
66
65
|
return null;
|
|
67
66
|
}
|
|
68
|
-
return (_jsx(Collapse, { timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Card, { ...props, ref: ref, children: [_jsx(CardTitle, { required: requiredToAddress, children: t('
|
|
67
|
+
return (_jsx(Collapse, { timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Card, { ...props, ref: ref, children: [_jsx(CardTitle, { required: requiredToAddress, children: t('main.sendToWallet') }), _jsxs(FormControl, { fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' }, children: [_jsx(Input, { size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, value: value, placeholder: t('main.walletAddressOrEns'), disabled: Boolean(toAddress && disabledToAddress) }), _jsx(SendToWalletFormHelperText, {})] })] }) }));
|
|
69
68
|
});
|
|
70
69
|
export const SendToWalletFormHelperText = () => {
|
|
71
70
|
const { errors } = useFormState();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
5
|
-
color?: import("@mui/types").OverridableStringUnion<"
|
|
5
|
+
color?: import("@mui/types").OverridableStringUnion<"primary" | "secondary" | "error" | "warning" | "info" | "success", import("@mui/material").FormControlPropsColorOverrides> | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
error?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -3,7 +3,7 @@ import WalletIcon from '@mui/icons-material/Wallet';
|
|
|
3
3
|
import { Button, Tooltip } from '@mui/material';
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import {
|
|
6
|
+
import { FormKey, useWallet, useWidgetConfig } from '../../providers';
|
|
7
7
|
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
8
8
|
import { DisabledUI, HiddenUI, RequiredUI } from '../../types';
|
|
9
9
|
export const SendToWalletButton = () => {
|
|
@@ -21,11 +21,11 @@ export const SendToWalletButton = () => {
|
|
|
21
21
|
}
|
|
22
22
|
const handleClick = () => {
|
|
23
23
|
if (showSendToWallet && !disabledUI?.includes(DisabledUI.ToAddress)) {
|
|
24
|
-
setValue(
|
|
24
|
+
setValue(FormKey.ToAddress, '', { shouldTouch: true });
|
|
25
25
|
}
|
|
26
26
|
toggleSendToWallet();
|
|
27
27
|
};
|
|
28
|
-
return (_jsx(Tooltip, { title: t('
|
|
28
|
+
return (_jsx(Tooltip, { title: t('main.sendToWallet'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
|
|
29
29
|
minWidth: 48,
|
|
30
30
|
marginLeft: 1,
|
|
31
31
|
}, children: _jsx(WalletIcon, {}) }) }));
|
|
@@ -10,7 +10,7 @@ export declare const SmallAvatar: import("@emotion/styled").StyledComponent<{
|
|
|
10
10
|
src?: string | undefined;
|
|
11
11
|
srcSet?: string | undefined;
|
|
12
12
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
13
|
-
variant?: import("@mui/types").OverridableStringUnion<"
|
|
13
|
+
variant?: import("@mui/types").OverridableStringUnion<"circular" | "rounded" | "square", import("@mui/material").AvatarPropsVariantOverrides> | undefined;
|
|
14
14
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
15
15
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
16
16
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -15,10 +15,10 @@ export const DestinationWalletAddress = ({ step, toAddress, toAddressLink }) =>
|
|
|
15
15
|
position: 'absolute',
|
|
16
16
|
fontSize: '1rem',
|
|
17
17
|
} }) }), _jsx(Typography, { mx: 2, flex: 1, fontSize: 14, fontWeight: 400, children: isDone
|
|
18
|
-
? t('
|
|
18
|
+
? t('main.sentToAddress', {
|
|
19
19
|
address: toAddress,
|
|
20
20
|
})
|
|
21
|
-
: t('
|
|
21
|
+
: t('main.sendToAddress', {
|
|
22
22
|
address: toAddress,
|
|
23
23
|
}) }), _jsx(LinkButton, { size: "small", edge: "end", LinkComponent: Link, href: toAddressLink, target: "_blank", rel: "nofollow noreferrer", children: _jsx(LinkRoundedIcon, {}) })] }) }));
|
|
24
24
|
};
|
|
@@ -16,5 +16,5 @@ export const GasStepProcess = ({ step }) => {
|
|
|
16
16
|
value: (step.execution?.gasAmountUSD ||
|
|
17
17
|
step.estimate.gasCosts?.reduce((amount, gasCost) => amount + parseFloat(gasCost.amountUSD || '0'), 0)) ??
|
|
18
18
|
0,
|
|
19
|
-
}), ' ', isDone ? t('
|
|
19
|
+
}), ' ', isDone ? t('main.gasFeePaid') : t('main.gasFeeEstimated')] })] }) }));
|
|
20
20
|
};
|
package/components/Step/Step.js
CHANGED
|
@@ -14,7 +14,7 @@ import { StepTimer } from './StepTimer';
|
|
|
14
14
|
export const Step = ({ step, fromToken, toToken, toAddress }) => {
|
|
15
15
|
const { t } = useTranslation();
|
|
16
16
|
const { getChainById } = useChains();
|
|
17
|
-
const {
|
|
17
|
+
const { subvariant } = useWidgetConfig();
|
|
18
18
|
const stepHasError = step.execution?.process.some((process) => process.status === 'FAILED');
|
|
19
19
|
const getCardTitle = () => {
|
|
20
20
|
switch (step.type) {
|
|
@@ -22,22 +22,22 @@ export const Step = ({ step, fromToken, toToken, toAddress }) => {
|
|
|
22
22
|
const hasCrossStep = step.includedSteps.some((step) => step.type === 'cross');
|
|
23
23
|
const hasSwapStep = step.includedSteps.some((step) => step.type === 'swap');
|
|
24
24
|
if (hasCrossStep && hasSwapStep) {
|
|
25
|
-
return
|
|
26
|
-
? t('
|
|
27
|
-
: t('
|
|
25
|
+
return subvariant === 'nft'
|
|
26
|
+
? t('main.stepBridgeAndBuy')
|
|
27
|
+
: t('main.stepSwapAndBridge');
|
|
28
28
|
}
|
|
29
29
|
if (hasCrossStep) {
|
|
30
|
-
return
|
|
31
|
-
? t('
|
|
32
|
-
: t('
|
|
30
|
+
return subvariant === 'nft'
|
|
31
|
+
? t('main.stepBridgeAndBuy')
|
|
32
|
+
: t('main.stepBridge');
|
|
33
33
|
}
|
|
34
|
-
return
|
|
35
|
-
? t('
|
|
36
|
-
: t('
|
|
34
|
+
return subvariant === 'nft'
|
|
35
|
+
? t('main.stepSwapAndBuy')
|
|
36
|
+
: t('main.stepSwap');
|
|
37
37
|
default:
|
|
38
|
-
return
|
|
39
|
-
? t('
|
|
40
|
-
: t('
|
|
38
|
+
return subvariant === 'nft'
|
|
39
|
+
? t('main.stepSwapAndBuy')
|
|
40
|
+
: t('main.stepSwap');
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const formattedToAddress = shortenAddress(toAddress);
|
|
@@ -40,7 +40,7 @@ export const StepTimer = ({ step, hideInProgress }) => {
|
|
|
40
40
|
step,
|
|
41
41
|
]);
|
|
42
42
|
if (!isExecutionStarted) {
|
|
43
|
-
return (_jsx(_Fragment, { children: t('
|
|
43
|
+
return (_jsx(_Fragment, { children: t('main.estimatedTime', {
|
|
44
44
|
value: Math.ceil(step.estimate.executionDuration / 60),
|
|
45
45
|
}) }));
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ export const StepTimer = ({ step, hideInProgress }) => {
|
|
|
50
50
|
(isTimerExpired && hideInProgress)) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
return isTimerExpired ? (_jsx(_Fragment, { children: t('
|
|
53
|
+
return isTimerExpired ? (_jsx(_Fragment, { children: t('main.inProgress') })) : (
|
|
54
54
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
55
55
|
_jsx(_Fragment, { children: `${minutes}:${seconds < 10 ? `0${seconds}` : seconds}` }));
|
|
56
56
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { LifiStep, Step } from '@lifi/sdk';
|
|
3
|
-
import type {
|
|
3
|
+
import type { WidgetSubvariant } from '../../types';
|
|
4
4
|
import type { StepActionsProps, StepDetailsLabelProps } from './types';
|
|
5
5
|
export declare const StepActions: React.FC<StepActionsProps>;
|
|
6
6
|
export declare const IncludedSteps: React.FC<{
|
|
7
7
|
step: LifiStep;
|
|
8
|
-
|
|
8
|
+
subvariant?: WidgetSubvariant;
|
|
9
9
|
}>;
|
|
10
10
|
export declare const StepDetailsContent: React.FC<{
|
|
11
11
|
step: Step;
|
|
12
|
-
|
|
12
|
+
subvariant?: WidgetSubvariant;
|
|
13
13
|
}>;
|
|
14
14
|
export declare const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps>;
|
|
15
15
|
export declare const CrossStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
|
|
@@ -15,18 +15,18 @@ import { SmallAvatar } from '../SmallAvatar';
|
|
|
15
15
|
import { StepAvatar, StepConnector, StepContent, StepLabel, } from './StepActions.style';
|
|
16
16
|
export const StepActions = ({ step, dense, ...other }) => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
|
-
const {
|
|
18
|
+
const { subvariant } = useWidgetConfig();
|
|
19
19
|
const [cardExpanded, setCardExpanded] = useState(false);
|
|
20
20
|
const handleExpand = (e) => {
|
|
21
21
|
e.stopPropagation();
|
|
22
22
|
setCardExpanded((expanded) => !expanded);
|
|
23
23
|
};
|
|
24
24
|
const hasCollapsedSteps = dense && step.includedSteps?.length > 1;
|
|
25
|
-
return (_jsxs(Box, { ...other, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(SmallAvatar, { children: _jsx(LiFiToolLogo, {}) }), children: _jsx(StepAvatar, { variant: "circular", src: step.toolDetails.logoURI, alt: step.toolDetails.name, children: step.toolDetails.name[0] }) }), _jsx(Typography, { ml: 2, fontSize: 18, fontWeight: "500", flex: 1, children: t(`
|
|
25
|
+
return (_jsxs(Box, { ...other, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(Badge, { overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(SmallAvatar, { children: _jsx(LiFiToolLogo, {}) }), children: _jsx(StepAvatar, { variant: "circular", src: step.toolDetails.logoURI, alt: step.toolDetails.name, children: step.toolDetails.name[0] }) }), _jsx(Typography, { ml: 2, fontSize: 18, fontWeight: "500", flex: 1, children: t(`main.stepDetails`, {
|
|
26
26
|
tool: step.toolDetails.name,
|
|
27
|
-
}) }), hasCollapsedSteps ? (_jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), hasCollapsedSteps ? (_jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(IncludedSteps, { step: step,
|
|
27
|
+
}) }), hasCollapsedSteps ? (_jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) })) : null] }), hasCollapsedSteps ? (_jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsx(IncludedSteps, { step: step, subvariant: subvariant }) })) : (_jsx(IncludedSteps, { step: step, subvariant: subvariant }))] }));
|
|
28
28
|
};
|
|
29
|
-
export const IncludedSteps = ({ step,
|
|
29
|
+
export const IncludedSteps = ({ step, subvariant }) => {
|
|
30
30
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
31
31
|
const StepIconComponent = ({ icon }) => {
|
|
32
32
|
const tool = step.includedSteps?.[Number(icon) - 1];
|
|
@@ -34,24 +34,28 @@ export const IncludedSteps = ({ step, variant }) => {
|
|
|
34
34
|
boxSizing: 'content-box',
|
|
35
35
|
}, children: tool.toolDetails.name[0] })) : null;
|
|
36
36
|
};
|
|
37
|
-
const StepDetailsLabel = step.tool === 'custom' &&
|
|
37
|
+
const StepDetailsLabel = step.tool === 'custom' && subvariant === 'nft'
|
|
38
38
|
? CustomStepDetailsLabel
|
|
39
39
|
: step.type === 'lifi' &&
|
|
40
40
|
step.includedSteps.some((step) => step.type === 'cross')
|
|
41
41
|
? CrossStepDetailsLabel
|
|
42
42
|
: SwapStepDetailsLabel;
|
|
43
|
-
return step.includedSteps.length > 1 ? (_jsx(Box, { mt: 1.5, children: _jsx(Stepper, { orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => (_jsxs(MuiStep, { expanded: true, children: [_jsx(StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' &&
|
|
43
|
+
return step.includedSteps.length > 1 ? (_jsx(Box, { mt: 1.5, children: _jsx(Stepper, { orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1, children: step.includedSteps.map((step, i) => (_jsxs(MuiStep, { expanded: true, children: [_jsx(StepLabel, { StepIconComponent: StepIconComponent, children: step.type === 'custom' && subvariant === 'nft' ? (_jsx(CustomStepDetailsLabel, { step: step, subvariant: subvariant })) : step.type === 'cross' ? (_jsx(CrossStepDetailsLabel, { step: step })) : step.type === 'protocol' ? (_jsx(ProtocolStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) }), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step, subvariant: subvariant }) })] }, step.id))) }) })) : (_jsxs(Box, { ml: 6, children: [_jsx(StepDetailsLabel, { step: step, subvariant: subvariant === 'nft' ? subvariant : undefined }), _jsx(StepDetailsContent, { step: step, subvariant: subvariant })] }));
|
|
44
44
|
};
|
|
45
|
-
export const StepDetailsContent = ({ step,
|
|
45
|
+
export const StepDetailsContent = ({ step, subvariant }) => {
|
|
46
46
|
const { t } = useTranslation();
|
|
47
47
|
const sameTokenProtocolStep = step.action.fromToken.chainId === step.action.toToken.chainId &&
|
|
48
48
|
step.action.fromToken.address === step.action.toToken.address;
|
|
49
49
|
let fromAmount;
|
|
50
50
|
if (sameTokenProtocolStep) {
|
|
51
|
-
|
|
51
|
+
const estimatedFromAmount = Big(step.estimate.fromAmount)
|
|
52
52
|
.div(10 ** step.action.fromToken.decimals)
|
|
53
|
-
.minus(Big(step.estimate.toAmount).div(10 ** step.action.toToken.decimals))
|
|
54
|
-
|
|
53
|
+
.minus(Big(step.estimate.toAmount).div(10 ** step.action.toToken.decimals));
|
|
54
|
+
fromAmount = estimatedFromAmount.gt(0)
|
|
55
|
+
? estimatedFromAmount.toString()
|
|
56
|
+
: Big(step.estimate.fromAmount)
|
|
57
|
+
.div(10 ** step.action.fromToken.decimals)
|
|
58
|
+
.toString();
|
|
55
59
|
}
|
|
56
60
|
else {
|
|
57
61
|
fromAmount = formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals);
|
|
@@ -63,19 +67,19 @@ export const StepDetailsContent = ({ step, variant }) => {
|
|
|
63
67
|
value: formatTokenAmount(step.execution?.toAmount ?? step.estimate.toAmount, step.execution?.toToken?.decimals ?? step.action.toToken.decimals),
|
|
64
68
|
}), ' ', step.execution?.toToken?.symbol ?? step.action.toToken.symbol] })) : null] }));
|
|
65
69
|
};
|
|
66
|
-
export const CustomStepDetailsLabel = ({ step,
|
|
70
|
+
export const CustomStepDetailsLabel = ({ step, subvariant, }) => {
|
|
67
71
|
const { t } = useTranslation();
|
|
68
|
-
if (!
|
|
72
|
+
if (!subvariant) {
|
|
69
73
|
return null;
|
|
70
74
|
}
|
|
71
|
-
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t(`
|
|
75
|
+
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t(`main.${subvariant}StepDetails`, {
|
|
72
76
|
tool: step.toolDetails.name,
|
|
73
77
|
}) }));
|
|
74
78
|
};
|
|
75
79
|
export const CrossStepDetailsLabel = ({ step }) => {
|
|
76
80
|
const { t } = useTranslation();
|
|
77
81
|
const { getChainById } = useChains();
|
|
78
|
-
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('
|
|
82
|
+
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('main.crossStepDetails', {
|
|
79
83
|
from: getChainById(step.action.fromChainId)?.name,
|
|
80
84
|
to: getChainById(step.action.toChainId)?.name,
|
|
81
85
|
tool: step.toolDetails.name,
|
|
@@ -84,7 +88,7 @@ export const CrossStepDetailsLabel = ({ step }) => {
|
|
|
84
88
|
export const SwapStepDetailsLabel = ({ step }) => {
|
|
85
89
|
const { t } = useTranslation();
|
|
86
90
|
const { getChainById } = useChains();
|
|
87
|
-
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('
|
|
91
|
+
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: t('main.swapStepDetails', {
|
|
88
92
|
chain: getChainById(step.action.fromChainId)?.name,
|
|
89
93
|
tool: step.toolDetails.name,
|
|
90
94
|
}) }));
|
|
@@ -92,7 +96,7 @@ export const SwapStepDetailsLabel = ({ step }) => {
|
|
|
92
96
|
export const ProtocolStepDetailsLabel = ({ step }) => {
|
|
93
97
|
const { t } = useTranslation();
|
|
94
98
|
return (_jsx(Typography, { fontSize: 12, fontWeight: "500", color: "text.secondary", children: step.toolDetails.key === 'lifuelProtocol'
|
|
95
|
-
? t('
|
|
99
|
+
? t('main.refuelStepDetails', {
|
|
96
100
|
tool: step.toolDetails.name,
|
|
97
101
|
})
|
|
98
102
|
: step.toolDetails.name }));
|
|
@@ -14,7 +14,7 @@ export declare const StepAvatar: import("@emotion/styled").StyledComponent<{
|
|
|
14
14
|
src?: string | undefined;
|
|
15
15
|
srcSet?: string | undefined;
|
|
16
16
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
17
|
-
variant?: import("@mui/types").OverridableStringUnion<"
|
|
17
|
+
variant?: import("@mui/types").OverridableStringUnion<"circular" | "rounded" | "square", import("@mui/material").AvatarPropsVariantOverrides> | undefined;
|
|
18
18
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
19
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
20
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { LifiStep, Step } from '@lifi/sdk';
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
|
-
import type {
|
|
3
|
+
import type { WidgetSubvariant } from '../../types';
|
|
4
4
|
export interface StepActionsProps extends BoxProps {
|
|
5
5
|
step: LifiStep;
|
|
6
6
|
dense?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface StepDetailsLabelProps {
|
|
9
9
|
step: Step;
|
|
10
|
-
|
|
10
|
+
subvariant?: Extract<WidgetSubvariant, 'nft'>;
|
|
11
11
|
}
|
|
@@ -28,7 +28,7 @@ export const TokenBase = ({ token, connected, step, disableDescription, isLoadin
|
|
|
28
28
|
value: formattedTokenAmount,
|
|
29
29
|
}) }))] }), _jsxs(TextSecondaryContainer, { connected: connected, component: "span", children: [isLoading ? (_jsx(Skeleton, { width: 48, height: 12, variant: "rounded", sx: { marginTop: 0.5 } })) : (_jsx(TextSecondary, { connected: connected, children: t(`format.currency`, {
|
|
30
30
|
value: formattedTokenPrice,
|
|
31
|
-
}) })), !disableDescription ? (_jsx(TextSecondary, { connected: connected, px: 0.5, dot: true, children: "\u2022" })) : null, !step && !disableDescription ? (isLoading ? (_jsx(Skeleton, { width: 96, height: 12, variant: "rounded", sx: { marginTop: 0.5 } })) : (_jsx(TextSecondary, { connected: connected, children: t(`
|
|
31
|
+
}) })), !disableDescription ? (_jsx(TextSecondary, { connected: connected, px: 0.5, dot: true, children: "\u2022" })) : null, !step && !disableDescription ? (isLoading ? (_jsx(Skeleton, { width: 96, height: 12, variant: "rounded", sx: { marginTop: 0.5 } })) : (_jsx(TextSecondary, { connected: connected, children: t(`main.tokenOnChain`, {
|
|
32
32
|
tokenSymbol: token?.symbol,
|
|
33
33
|
chainName: chain?.name,
|
|
34
34
|
}) }))) : null, step ? (_jsxs(Box, { display: "flex", alignItems: "flex-end", height: 12, mt: 0.5, children: [_jsx(Box, { pr: 0.75, children: _jsx(SmallAvatar, { src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
|
|
@@ -3,7 +3,7 @@ import { Box } from '@mui/material';
|
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { useWatch } from 'react-hook-form';
|
|
5
5
|
import { useChain, useDebouncedWatch, useTokenBalances, useTokenSearch, } from '../../hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { FormKey, FormKeyHelper, useWallet } from '../../providers';
|
|
7
7
|
import { TokenNotFound } from './TokenNotFound';
|
|
8
8
|
import { VirtualizedTokenList } from './VirtualizedTokenList';
|
|
9
9
|
import { useTokenSelect } from './useTokenSelect';
|
|
@@ -11,9 +11,9 @@ export const TokenList = ({ formType, height, onClick, }) => {
|
|
|
11
11
|
const parentRef = useRef(null);
|
|
12
12
|
const { account } = useWallet();
|
|
13
13
|
const [selectedChainId] = useWatch({
|
|
14
|
-
name: [
|
|
14
|
+
name: [FormKeyHelper.getChainKey(formType)],
|
|
15
15
|
});
|
|
16
|
-
const [tokenSearchFilter] = useDebouncedWatch([
|
|
16
|
+
const [tokenSearchFilter] = useDebouncedWatch([FormKey.TokenSearchFilter], 320);
|
|
17
17
|
const { chain, isLoading: isChainLoading } = useChain(selectedChainId);
|
|
18
18
|
const { tokens: chainTokens, tokensWithBalance, isLoading: isTokensLoading, isBalanceLoading, featuredTokens, } = useTokenBalances(selectedChainId);
|
|
19
19
|
let filteredTokens = (tokensWithBalance ??
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { StyledComponent } from '@emotion/styled';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IconButtonProps, LinkProps } from '@mui/material';
|
|
4
4
|
export declare const ListItemButton: StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
5
5
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
6
6
|
centerRipple?: boolean | undefined;
|
|
@@ -19,7 +19,7 @@ export declare const ListItemButton: StyledComponent<import("@mui/material").Lis
|
|
|
19
19
|
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
20
20
|
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
21
21
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
22
|
-
}, "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "
|
|
22
|
+
}, "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "divider" | "dense" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
23
23
|
export declare const ListItem: StyledComponent<{
|
|
24
24
|
button?: false | undefined;
|
|
25
25
|
} & import("@mui/material").ListItemBaseProps & {
|
|
@@ -37,5 +37,5 @@ export declare const ListItem: StyledComponent<{
|
|
|
37
37
|
} | undefined;
|
|
38
38
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
39
39
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
40
|
-
}, "button" | "className" | "style" | "classes" | "autoFocus" | "children" | "disabled" | "sx" | "alignItems" | "
|
|
41
|
-
export declare const
|
|
40
|
+
}, "button" | "className" | "style" | "classes" | "autoFocus" | "children" | "disabled" | "sx" | "alignItems" | "divider" | "components" | "dense" | "slotProps" | "slots" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
41
|
+
export declare const IconButton: StyledComponent<IconButtonProps & LinkProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButton as MuiIconButton, ListItem as MuiListItem, } from '@mui/material';
|
|
2
2
|
import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
|
|
3
3
|
import { listItemTextClasses } from '@mui/material/ListItemText';
|
|
4
4
|
import { alpha, styled } from '@mui/material/styles';
|
|
@@ -20,28 +20,31 @@ export const ListItem = styled(MuiListItem)(({ theme }) => ({
|
|
|
20
20
|
[`.${listItemSecondaryActionClasses.root}`]: {
|
|
21
21
|
right: theme.spacing(3),
|
|
22
22
|
},
|
|
23
|
+
[`& .${listItemTextClasses.primary}`]: {
|
|
24
|
+
height: 22,
|
|
25
|
+
},
|
|
23
26
|
[`& .${listItemTextClasses.primary}, & .${listItemTextClasses.secondary}`]: {
|
|
24
27
|
textOverflow: 'ellipsis',
|
|
25
28
|
overflow: 'hidden',
|
|
26
29
|
whiteSpace: 'nowrap',
|
|
27
30
|
},
|
|
28
31
|
}));
|
|
29
|
-
export const
|
|
32
|
+
export const IconButton = styled(MuiIconButton)(({ theme }) => ({
|
|
30
33
|
lineHeight: 1,
|
|
31
34
|
fontSize: '0.75rem',
|
|
32
35
|
fontWeight: 400,
|
|
33
|
-
padding: theme.spacing(0.375, 0.
|
|
36
|
+
padding: theme.spacing(0.375, 0.375),
|
|
37
|
+
marginLeft: theme.spacing(0.25),
|
|
34
38
|
color: 'inherit',
|
|
35
39
|
backgroundColor: 'unset',
|
|
40
|
+
minWidth: 'unset',
|
|
41
|
+
borderRadius: '50%',
|
|
36
42
|
'&:hover': {
|
|
37
43
|
backgroundColor: theme.palette.mode === 'light'
|
|
38
44
|
? alpha(theme.palette.common.black, 0.04)
|
|
39
45
|
: alpha(theme.palette.common.white, 0.08),
|
|
40
46
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
[`.${buttonClasses.endIcon} > *:nth-of-type(1)`]: {
|
|
45
|
-
fontSize: '0.75rem',
|
|
47
|
+
svg: {
|
|
48
|
+
fontSize: '0.875rem',
|
|
46
49
|
},
|
|
47
50
|
}));
|
|
@@ -3,8 +3,8 @@ import OpenInNewIcon from '@mui/icons-material/OpenInNewRounded';
|
|
|
3
3
|
import { Avatar, Box, Link, ListItemAvatar, ListItemText, Skeleton, Slide, Typography, } from '@mui/material';
|
|
4
4
|
import { memo, useRef, useState } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { formatTokenPrice, shortenAddress } from '../../utils';
|
|
7
|
-
import {
|
|
6
|
+
import { formatTokenAmount, formatTokenPrice, shortenAddress, } from '../../utils';
|
|
7
|
+
import { IconButton, ListItem, ListItemButton } from './TokenList.style';
|
|
8
8
|
export const TokenListItem = memo(({ onClick, size, start, token, chain, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
|
|
9
9
|
const handleClick = () => onClick?.(token.address);
|
|
10
10
|
return (_jsxs(ListItem, { disablePadding: true, style: {
|
|
@@ -27,18 +27,14 @@ export const TokenListItemButton = ({ onClick, token, chain, showBalance, isBala
|
|
|
27
27
|
setShowAddress(false);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
return (_jsxs(ListItemButton, { onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, dense: true, children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, { src: token.logoURI, alt: token.symbol, children: token.symbol[0] }) }), _jsx(ListItemText, { primary: token.symbol, secondaryTypographyProps: {
|
|
30
|
+
return (_jsxs(ListItemButton, { onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, dense: true, children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, { src: token.logoURI, alt: token.symbol, children: token.symbol?.[0] }) }), _jsx(ListItemText, { primary: token.symbol, secondaryTypographyProps: {
|
|
31
31
|
component: 'div',
|
|
32
|
-
|
|
33
|
-
overflow: 'auto',
|
|
34
|
-
marginLeft: -0.75,
|
|
35
|
-
},
|
|
36
|
-
}, secondary: _jsxs(Box, { position: "relative", height: 18, ref: container, children: [_jsx(Slide, { direction: "down", in: !showAddress, container: container.current, style: {
|
|
32
|
+
}, secondary: _jsxs(Box, { position: "relative", height: 20, ref: container, children: [_jsx(Slide, { direction: "down", in: !showAddress, container: container.current, style: {
|
|
37
33
|
position: 'absolute',
|
|
38
|
-
}, appear: false, children: _jsx(Box, {
|
|
34
|
+
}, appear: false, children: _jsx(Box, { pt: 0.25, children: token.name }) }), _jsx(Slide, { direction: "up", in: showAddress, container: container.current, style: {
|
|
39
35
|
position: 'absolute',
|
|
40
|
-
}, appear: false, mountOnEnter: true, children: _jsx(
|
|
41
|
-
value: token.amount,
|
|
36
|
+
}, appear: false, mountOnEnter: true, children: _jsxs(Box, { display: "flex", children: [_jsx(Box, { display: "flex", alignItems: "center", pt: 0.125, children: shortenAddress(token.address) }), _jsx(IconButton, { size: "small", LinkComponent: Link, href: `${chain?.metamask.blockExplorerUrls[0]}address/${token.address}`, target: "_blank", rel: "nofollow noreferrer", onClick: (e) => e.stopPropagation(), children: _jsx(OpenInNewIcon, {}) })] }) })] }) }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, { sx: { textAlign: 'right' }, children: [Number(token.amount) ? (_jsx(Typography, { variant: "body1", noWrap: true, children: t('format.number', {
|
|
37
|
+
value: formatTokenAmount(token.amount),
|
|
42
38
|
}) })) : null, tokenPrice ? (_jsx(Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD, children: t(`format.currency`, {
|
|
43
39
|
value: tokenPrice,
|
|
44
40
|
}) })) : null] }))) : null] }));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
export declare const TokenNotFound: React.FC<
|
|
2
|
+
import type { FormTypeProps } from '../../providers';
|
|
3
|
+
export declare const TokenNotFound: React.FC<FormTypeProps>;
|
|
@@ -4,11 +4,11 @@ import { Box, Typography } from '@mui/material';
|
|
|
4
4
|
import { useWatch } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useChains } from '../../hooks';
|
|
7
|
-
import {
|
|
7
|
+
import { FormKeyHelper } from '../../providers';
|
|
8
8
|
export const TokenNotFound = ({ formType }) => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
10
|
const [selectedChainId] = useWatch({
|
|
11
|
-
name: [
|
|
11
|
+
name: [FormKeyHelper.getChainKey(formType)],
|
|
12
12
|
});
|
|
13
13
|
const { getChainById } = useChains();
|
|
14
14
|
return (_jsxs(Box, { sx: {
|
|
@@ -18,7 +18,7 @@ export const TokenNotFound = ({ formType }) => {
|
|
|
18
18
|
flexDirection: 'column',
|
|
19
19
|
flex: 1,
|
|
20
20
|
padding: 3,
|
|
21
|
-
}, children: [_jsx(Typography, { fontSize: 48, lineHeight: 1, children: _jsx(SearchOffIcon, { fontSize: "inherit" }) }), _jsx(Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, px: 2, children: t('
|
|
21
|
+
}, children: [_jsx(Typography, { fontSize: 48, lineHeight: 1, children: _jsx(SearchOffIcon, { fontSize: "inherit" }) }), _jsx(Typography, { fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2, px: 2, children: t('info.message.emptyTokenList', {
|
|
22
22
|
chainName: getChainById(selectedChainId)?.name,
|
|
23
23
|
}) })] }));
|
|
24
24
|
};
|
|
@@ -46,9 +46,9 @@ export const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollEleme
|
|
|
46
46
|
}
|
|
47
47
|
return (_jsx(List, { style: { height: getTotalSize() }, disablePadding: true, children: getVirtualItems().map((item) => {
|
|
48
48
|
const token = tokens[item.index];
|
|
49
|
-
return (_jsx(TokenListItem, { onClick: onClick, size: item.size, start: item.start, token: token, chain: chain, isBalanceLoading: isBalanceLoading, showBalance: showBalance, startAdornment: hasFeaturedTokens && token.featured && item.index === 0 ? (_jsx(Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, pb: 1.25, children: t('
|
|
49
|
+
return (_jsx(TokenListItem, { onClick: onClick, size: item.size, start: item.start, token: token, chain: chain, isBalanceLoading: isBalanceLoading, showBalance: showBalance, startAdornment: hasFeaturedTokens && token.featured && item.index === 0 ? (_jsx(Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, pb: 1.25, children: t('main.featuredTokens') })) : null, endAdornment: hasFeaturedTokens &&
|
|
50
50
|
token.featured &&
|
|
51
51
|
item.index === featuredTokensLastIndex &&
|
|
52
|
-
item.index !== tokensLastIndex ? (_jsx(Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, py: 1.25, children: t('
|
|
52
|
+
item.index !== tokensLastIndex ? (_jsx(Typography, { fontSize: 14, fontWeight: 600, lineHeight: 1, px: 2, py: 1.25, children: t('main.otherTokens') })) : null }, item.key));
|
|
53
53
|
}) }));
|
|
54
54
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtendedChain } from '@lifi/sdk';
|
|
2
2
|
import type { MutableRefObject } from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FormType } from '../../providers';
|
|
4
4
|
import type { TokenAmount } from '../../types';
|
|
5
5
|
export interface TokenListProps {
|
|
6
|
-
formType:
|
|
6
|
+
formType: FormType;
|
|
7
7
|
height: number;
|
|
8
8
|
onClick?(): void;
|
|
9
9
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const useTokenSelect: (formType:
|
|
1
|
+
import type { FormType } from '../../providers';
|
|
2
|
+
export declare const useTokenSelect: (formType: FormType, onClick?: () => void) => (tokenAddress: string, chainId?: number) => void;
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useController, useFormContext } from 'react-hook-form';
|
|
3
|
-
import {
|
|
3
|
+
import { FormKeyHelper, useWidgetConfig } from '../../providers';
|
|
4
4
|
export const useTokenSelect = (formType, onClick) => {
|
|
5
|
-
const tokenKey =
|
|
5
|
+
const tokenKey = FormKeyHelper.getTokenKey(formType);
|
|
6
6
|
const { field: { onChange, onBlur }, } = useController({ name: tokenKey });
|
|
7
7
|
const { setValue, getValues } = useFormContext();
|
|
8
|
+
const { subvariant } = useWidgetConfig();
|
|
8
9
|
return useCallback((tokenAddress, chainId) => {
|
|
9
10
|
onChange(tokenAddress);
|
|
10
11
|
onBlur();
|
|
11
|
-
const selectedChainId = chainId ?? getValues(
|
|
12
|
+
const selectedChainId = chainId ?? getValues(FormKeyHelper.getChainKey(formType));
|
|
12
13
|
// Set chain again to trigger URL builder update
|
|
13
|
-
setValue(
|
|
14
|
+
setValue(FormKeyHelper.getChainKey(formType), selectedChainId, {
|
|
14
15
|
shouldDirty: true,
|
|
15
16
|
shouldTouch: true,
|
|
16
17
|
});
|
|
17
|
-
setValue(
|
|
18
|
+
setValue(FormKeyHelper.getAmountKey(formType), '');
|
|
18
19
|
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
19
20
|
const [selectedOppositeToken, selectedOppositeChainId] = getValues([
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
FormKeyHelper.getTokenKey(oppositeFormType),
|
|
22
|
+
FormKeyHelper.getChainKey(oppositeFormType),
|
|
22
23
|
]);
|
|
23
24
|
if (selectedOppositeToken === tokenAddress &&
|
|
24
|
-
selectedOppositeChainId === selectedChainId
|
|
25
|
-
|
|
25
|
+
selectedOppositeChainId === selectedChainId &&
|
|
26
|
+
subvariant !== 'nft') {
|
|
27
|
+
setValue(FormKeyHelper.getTokenKey(oppositeFormType), '', {
|
|
26
28
|
shouldDirty: true,
|
|
27
29
|
shouldTouch: true,
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
onClick?.();
|
|
31
|
-
}, [formType, getValues, onBlur, onChange, onClick, setValue]);
|
|
33
|
+
}, [formType, getValues, onBlur, onChange, onClick, setValue, subvariant]);
|
|
32
34
|
};
|