@lifi/widget 2.0.0-beta.9 → 2.0.1
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/StepList.d.ts +2 -1
- package/cjs/components/Step/StepList.js +4 -2
- package/cjs/components/Step/StepTimer.js +2 -2
- package/cjs/components/StepActions/StepActions.d.ts +3 -3
- package/cjs/components/StepActions/StepActions.js +31 -18
- 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} +22 -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 +145 -127
- package/cjs/i18n/it.json +154 -125
- package/cjs/i18n/ko.json +102 -85
- package/cjs/i18n/pt.json +133 -130
- package/cjs/i18n/th.json +102 -85
- package/cjs/i18n/tr.json +72 -72
- package/cjs/i18n/uk.json +131 -128
- 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 +5 -4
- 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/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +5 -1
- package/cjs/pages/TransactionPage/TokenValueBottomSheet.js +38 -0
- package/cjs/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/cjs/pages/TransactionPage/TransactionPage.js +129 -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/stores/routes/utils.d.ts +1 -0
- package/cjs/stores/routes/utils.js +5 -1
- 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/StepList.d.ts +2 -1
- package/components/Step/StepList.js +4 -2
- package/components/Step/StepTimer.js +2 -2
- package/components/StepActions/StepActions.d.ts +3 -3
- package/components/StepActions/StepActions.js +31 -18
- 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} +21 -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 +145 -127
- package/i18n/it.json +154 -125
- package/i18n/ko.json +102 -85
- package/i18n/pt.json +133 -130
- package/i18n/th.json +102 -85
- package/i18n/tr.json +72 -72
- package/i18n/uk.json +131 -128
- 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 +13 -13
- 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 +5 -4
- 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/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +5 -1
- package/pages/TransactionPage/TokenValueBottomSheet.js +34 -0
- package/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/pages/TransactionPage/TransactionPage.js +125 -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/stores/routes/utils.d.ts +1 -0
- package/stores/routes/utils.js +3 -0
- 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}/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}/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
package/components/{SwapInput/SwapInputEndAdornment.js → AmountInput/AmountInputEndAdornment.js}
RENAMED
|
@@ -4,24 +4,24 @@ import Big from 'big.js';
|
|
|
4
4
|
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useChains, useGasRecommendation, useTokenAddressBalance, } from '../../hooks';
|
|
7
|
-
import {
|
|
7
|
+
import { FormKeyHelper } from '../../providers';
|
|
8
8
|
import { formatTokenAmount } from '../../utils';
|
|
9
|
-
import { Button } from './
|
|
10
|
-
export const
|
|
9
|
+
import { Button } from './AmountInputAdornment.style';
|
|
10
|
+
export const AmountInputEndAdornment = ({ formType }) => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
const { setValue } = useFormContext();
|
|
13
13
|
const { getChainById } = useChains();
|
|
14
14
|
const [chainId, tokenAddress] = useWatch({
|
|
15
15
|
name: [
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
FormKeyHelper.getChainKey(formType),
|
|
17
|
+
FormKeyHelper.getTokenKey(formType),
|
|
18
18
|
],
|
|
19
19
|
});
|
|
20
20
|
const { data } = useGasRecommendation(chainId);
|
|
21
21
|
const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
|
|
22
22
|
const handleMax = () => {
|
|
23
23
|
const chain = getChainById(chainId);
|
|
24
|
-
let maxAmount;
|
|
24
|
+
let maxAmount = token?.amount;
|
|
25
25
|
if (chain?.nativeToken.address === tokenAddress &&
|
|
26
26
|
data?.available &&
|
|
27
27
|
data?.recommended) {
|
|
@@ -33,7 +33,7 @@ export const SwapInputEndAdornment = ({ formType }) => {
|
|
|
33
33
|
maxAmount = formatTokenAmount(tokenAmount.minus(recommendedAmount).toString());
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
setValue(
|
|
36
|
+
setValue(FormKeyHelper.getAmountKey(formType), maxAmount || '', {
|
|
37
37
|
shouldTouch: true,
|
|
38
38
|
});
|
|
39
39
|
};
|
package/components/{SwapInput/SwapInputStartAdornment.js → AmountInput/AmountInputStartAdornment.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useWatch } from 'react-hook-form';
|
|
3
3
|
import { useChain, useToken } from '../../hooks';
|
|
4
|
-
import {
|
|
4
|
+
import { FormKeyHelper } from '../../providers';
|
|
5
5
|
import { TokenAvatar, TokenAvatarDefault } from '../TokenAvatar';
|
|
6
|
-
export const
|
|
6
|
+
export const AmountInputStartAdornment = ({ formType, }) => {
|
|
7
7
|
const [chainId, tokenAddress] = useWatch({
|
|
8
8
|
name: [
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
FormKeyHelper.getChainKey(formType),
|
|
10
|
+
FormKeyHelper.getTokenKey(formType),
|
|
11
11
|
],
|
|
12
12
|
});
|
|
13
13
|
const { chain } = useChain(chainId);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TokenAmount } from '@lifi/sdk';
|
|
3
|
+
import type { FormTypeProps } from '../../providers';
|
|
4
|
+
export declare const FormPriceHelperText: React.FC<FormTypeProps>;
|
|
5
|
+
export declare const FormPriceHelperTextBase: React.FC<FormTypeProps & {
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
tokenAddress?: string;
|
|
8
|
+
token?: TokenAmount;
|
|
9
|
+
}>;
|
|
@@ -3,18 +3,23 @@ import { FormHelperText, Skeleton, Typography } from '@mui/material';
|
|
|
3
3
|
import { useWatch } from 'react-hook-form';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useTokenAddressBalance } from '../../hooks';
|
|
6
|
-
import {
|
|
7
|
-
import { formatTokenPrice } from '../../utils';
|
|
8
|
-
export const FormPriceHelperText = ({ formType
|
|
9
|
-
const
|
|
10
|
-
const [amount, chainId, tokenAddress] = useWatch({
|
|
6
|
+
import { FormKeyHelper } from '../../providers';
|
|
7
|
+
import { formatTokenAmount, formatTokenPrice } from '../../utils';
|
|
8
|
+
export const FormPriceHelperText = ({ formType }) => {
|
|
9
|
+
const [chainId, tokenAddress] = useWatch({
|
|
11
10
|
name: [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
SwapFormKeyHelper.getTokenKey(formType),
|
|
11
|
+
FormKeyHelper.getChainKey(formType),
|
|
12
|
+
FormKeyHelper.getTokenKey(formType),
|
|
15
13
|
],
|
|
16
14
|
});
|
|
17
15
|
const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
|
|
16
|
+
return (_jsx(FormPriceHelperTextBase, { formType: formType, isLoading: isLoading, tokenAddress: tokenAddress, token: token }));
|
|
17
|
+
};
|
|
18
|
+
export const FormPriceHelperTextBase = ({ formType, isLoading, tokenAddress, token }) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const amount = useWatch({
|
|
21
|
+
name: FormKeyHelper.getAmountKey(formType),
|
|
22
|
+
});
|
|
18
23
|
const fromAmountTokenPrice = formatTokenPrice(amount, token?.priceUSD);
|
|
19
24
|
return (_jsxs(FormHelperText, { component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 }, children: [_jsx(Typography, { color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: 8, lineHeight: 1.3334, flex: 1, sx: {
|
|
20
25
|
wordBreak: 'break-word',
|
|
@@ -22,6 +27,6 @@ export const FormPriceHelperText = ({ formType, }) => {
|
|
|
22
27
|
}, children: t(`format.currency`, {
|
|
23
28
|
value: fromAmountTokenPrice,
|
|
24
29
|
}) }), isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : token?.amount ? (_jsx(Typography, { fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25, children: `/ ${t(`format.number`, {
|
|
25
|
-
value: token?.amount,
|
|
30
|
+
value: formatTokenAmount(token?.amount),
|
|
26
31
|
})}` })) : null] }));
|
|
27
32
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AmountInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AmountInput';
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
export declare const CardIconButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: import("@mui/types").OverridableStringUnion<"inherit" | "default" | "
|
|
5
|
+
color?: import("@mui/types").OverridableStringUnion<"inherit" | "default" | "primary" | "secondary" | "error" | "warning" | "info" | "success", import("@mui/material").IconButtonPropsColorOverrides> | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
9
|
-
size?: import("@mui/types").OverridableStringUnion<"small" | "
|
|
9
|
+
size?: import("@mui/types").OverridableStringUnion<"small" | "large" | "medium", import("@mui/material").IconButtonPropsSizeOverrides> | undefined;
|
|
10
10
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
11
11
|
} & Omit<{
|
|
12
12
|
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
@@ -7,7 +7,7 @@ export declare const CardLabel: import("@emotion/styled").StyledComponent<import
|
|
|
7
7
|
} & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
9
|
}, "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
-
type?: "
|
|
10
|
+
type?: "insurance" | "active" | "insurance-icon" | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
12
12
|
export declare const CardLabelTypography: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
13
|
align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const ChainSelect: ({ formType }:
|
|
1
|
+
import type { FormTypeProps } from '../../providers';
|
|
2
|
+
export declare const ChainSelect: ({ formType }: FormTypeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Avatar, Box, Skeleton, Tooltip, Typography } from '@mui/material';
|
|
3
3
|
import { useWatch } from 'react-hook-form';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import {
|
|
5
|
+
import { FormKeyHelper } from '../../providers';
|
|
6
6
|
import { maxChainToOrder } from '../../stores';
|
|
7
7
|
import { navigationRoutes } from '../../utils';
|
|
8
8
|
import { ChainCard, ChainContainer } from './ChainSelect.style';
|
|
@@ -11,7 +11,7 @@ export const ChainSelect = ({ formType }) => {
|
|
|
11
11
|
const navigate = useNavigate();
|
|
12
12
|
const { chainOrder, chains, getChains, isLoading, setChainOrder, setCurrentChain, } = useChainSelect(formType);
|
|
13
13
|
const [chainId] = useWatch({
|
|
14
|
-
name: [
|
|
14
|
+
name: [FormKeyHelper.getChainKey(formType)],
|
|
15
15
|
});
|
|
16
16
|
const hasChainInOrderedList = chainOrder.includes(chainId);
|
|
17
17
|
// If we don't have a chain in the ordered chain list we should add it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EVMChain } from '@lifi/sdk';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const useChainSelect: (formType:
|
|
2
|
+
import type { FormType } from '../../providers';
|
|
3
|
+
export declare const useChainSelect: (formType: FormType) => {
|
|
4
4
|
chainOrder: number[];
|
|
5
5
|
chains: import("@lifi/sdk").ExtendedChain[] | undefined;
|
|
6
6
|
getChains: () => EVMChain[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useController, useFormContext } from 'react-hook-form';
|
|
2
2
|
import { useChains, useSwapOnly } from '../../hooks';
|
|
3
|
-
import {
|
|
3
|
+
import { FormKey, FormKeyHelper } from '../../providers';
|
|
4
4
|
import { useChainOrder } from '../../stores';
|
|
5
5
|
export const useChainSelect = (formType) => {
|
|
6
|
-
const chainKey =
|
|
6
|
+
const chainKey = FormKeyHelper.getChainKey(formType);
|
|
7
7
|
const { field: { onChange, onBlur }, } = useController({ name: chainKey });
|
|
8
8
|
const { setValue } = useFormContext();
|
|
9
9
|
const { chains, isLoading } = useChains();
|
|
@@ -22,13 +22,13 @@ export const useChainSelect = (formType) => {
|
|
|
22
22
|
onChange(chainId);
|
|
23
23
|
onBlur();
|
|
24
24
|
if (swapOnly) {
|
|
25
|
-
setValue(
|
|
25
|
+
setValue(FormKeyHelper.getChainKey('to'), chainId, {
|
|
26
26
|
shouldTouch: true,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
setValue(
|
|
30
|
-
setValue(
|
|
31
|
-
setValue(
|
|
29
|
+
setValue(FormKeyHelper.getTokenKey(formType), '');
|
|
30
|
+
setValue(FormKeyHelper.getAmountKey(formType), '');
|
|
31
|
+
setValue(FormKey.TokenSearchFilter, '');
|
|
32
32
|
setChainOrder(chainId);
|
|
33
33
|
};
|
|
34
34
|
return {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { BoxProps } from '@mui/material';
|
|
3
|
-
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
export declare const ContractComponent: React.FC<PropsWithChildren<BoxProps>>;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useWidgetConfig } from '../../providers';
|
|
3
2
|
import { Card } from '../Card';
|
|
4
|
-
export const ContractComponent = (props) => {
|
|
5
|
-
|
|
6
|
-
if (!contractComponent) {
|
|
3
|
+
export const ContractComponent = ({ children, ...props }) => {
|
|
4
|
+
if (!children) {
|
|
7
5
|
return null;
|
|
8
6
|
}
|
|
9
|
-
return
|
|
7
|
+
return _jsx(Card, { ...props, children: children });
|
|
10
8
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingButton } from '@mui/lab';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import { useWallet, useWidgetConfig } from '../../providers';
|
|
6
|
+
import { navigationRoutes } from '../../utils';
|
|
7
|
+
export const DefaultTransactionButton = ({ onClick, text, disabled, loading }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
const { walletManagement } = useWidgetConfig();
|
|
11
|
+
const { account, connect } = useWallet();
|
|
12
|
+
const handleClick = async () => {
|
|
13
|
+
if (account.isActive) {
|
|
14
|
+
onClick?.();
|
|
15
|
+
}
|
|
16
|
+
else if (walletManagement) {
|
|
17
|
+
await connect();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
navigate(navigationRoutes.selectWallet);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const getButtonText = () => {
|
|
24
|
+
if (account.isActive) {
|
|
25
|
+
if (text) {
|
|
26
|
+
return text;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return t(`button.connectWallet`);
|
|
30
|
+
};
|
|
31
|
+
return (_jsx(LoadingButton, { variant: "contained", color: "primary", onClick: handleClick, disabled: disabled, loading: loading, loadingPosition: "center", fullWidth: true, children: getButtonText() }));
|
|
32
|
+
};
|
|
@@ -8,5 +8,5 @@ export const FundsSufficiencyMessage = () => {
|
|
|
8
8
|
return (_jsxs(WarningMessageCard, { display: "flex", children: [_jsx(WarningMessageCardTitle, { children: _jsx(WarningRoundedIcon, { sx: {
|
|
9
9
|
marginTop: 2,
|
|
10
10
|
marginLeft: 2,
|
|
11
|
-
} }) }), _jsx(Typography, { variant: "body2", px: 2, pb: 2, pt: 2, children: t(`
|
|
11
|
+
} }) }), _jsx(Typography, { variant: "body2", px: 2, pb: 2, pt: 2, children: t(`warning.message.insufficientFunds`) })] }));
|
|
12
12
|
};
|
|
@@ -16,7 +16,7 @@ export const GasRefuelMessage = (props) => {
|
|
|
16
16
|
const showGasRefuelMessage = chain && enabled && !isRefuelLoading;
|
|
17
17
|
return (_jsx(Collapse, { timeout: 225, in: showGasRefuelMessage, unmountOnExit: true, mountOnEnter: true, children: _jsxs(InfoMessageCard, { ...props, children: [_jsxs(InfoMessageCardTitle, { display: "flex", alignItems: "center", justifyContent: "space-between", p: 2, children: [_jsxs(Box, { display: "flex", alignItems: "center", children: [_jsx(EvStationIcon, { sx: {
|
|
18
18
|
marginRight: 1,
|
|
19
|
-
} }), _jsx(Typography, { variant: "body2", fontWeight: 700, children: t(`
|
|
19
|
+
} }), _jsx(Typography, { variant: "body2", fontWeight: 700, children: t(`info.title.autoRefuel`) })] }), _jsx(InfoMessageSwitch, { checked: enabledAutoRefuel, onChange: onChange })] }), _jsx(Collapse, { timeout: 225, in: enabledAutoRefuel, unmountOnExit: true, mountOnEnter: true, children: _jsx(Typography, { variant: "body2", px: 2, pb: 2, children: t(`info.message.autoRefuel`, {
|
|
20
20
|
chainName: chain?.name,
|
|
21
21
|
}) }) })] }) }));
|
|
22
22
|
};
|
|
@@ -7,9 +7,9 @@ export const GasSufficiencyMessage = ({ insufficientGas, }) => {
|
|
|
7
7
|
const { t } = useTranslation();
|
|
8
8
|
return (_jsxs(WarningMessageCard, { children: [_jsxs(WarningMessageCardTitle, { display: "flex", alignItems: "center", px: 2, pt: 2, children: [_jsx(EvStationIcon, { sx: {
|
|
9
9
|
marginRight: 1,
|
|
10
|
-
} }), _jsx(Typography, { variant: "body2", fontWeight: 700, children: t(`
|
|
10
|
+
} }), _jsx(Typography, { variant: "body2", fontWeight: 700, children: t(`warning.title.insufficientGas`) })] }), _jsx(Typography, { variant: "body2", px: 2, pt: 1, children: t(`warning.message.insufficientGas`) }), insufficientGas?.map((item, index) => (_jsx(Typography
|
|
11
11
|
// eslint-disable-next-line react/no-array-index-key
|
|
12
|
-
, { variant: "body2", px: 2, pb: insufficientGas?.length - 1 === index ? 2 : 0, pt: 0.5, children: t(`
|
|
12
|
+
, { variant: "body2", px: 2, pb: insufficientGas?.length - 1 === index ? 2 : 0, pt: 0.5, children: t(`main.tokenOnChainAmount`, {
|
|
13
13
|
amount: item.insufficientAmount?.toString(),
|
|
14
14
|
tokenSymbol: item.token.symbol,
|
|
15
15
|
chainName: item.chain?.name,
|
|
@@ -28,14 +28,14 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
|
|
|
28
28
|
export declare const WalletButton: import("@emotion/styled").StyledComponent<{
|
|
29
29
|
children?: import("react").ReactNode;
|
|
30
30
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
31
|
-
color?: import("@mui/types").OverridableStringUnion<"inherit" | "
|
|
31
|
+
color?: import("@mui/types").OverridableStringUnion<"inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success", import("@mui/material").ButtonPropsColorOverrides> | undefined;
|
|
32
32
|
disabled?: boolean | undefined;
|
|
33
33
|
disableElevation?: boolean | undefined;
|
|
34
34
|
disableFocusRipple?: boolean | undefined;
|
|
35
35
|
endIcon?: import("react").ReactNode;
|
|
36
36
|
fullWidth?: boolean | undefined;
|
|
37
37
|
href?: string | undefined;
|
|
38
|
-
size?: import("@mui/types").OverridableStringUnion<"small" | "
|
|
38
|
+
size?: import("@mui/types").OverridableStringUnion<"small" | "large" | "medium", import("@mui/material").ButtonPropsSizeOverrides> | undefined;
|
|
39
39
|
startIcon?: import("react").ReactNode;
|
|
40
40
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
41
41
|
variant?: import("@mui/types").OverridableStringUnion<"text" | "outlined" | "contained", import("@mui/material").ButtonPropsVariantOverrides> | undefined;
|
|
@@ -12,13 +12,13 @@ import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../
|
|
|
12
12
|
import { HeaderAppBar } from './Header.style';
|
|
13
13
|
import { NavigationTabs } from './NavigationTabs';
|
|
14
14
|
import { WalletMenuButton } from './WalletHeader';
|
|
15
|
-
import {
|
|
15
|
+
import { useHeaderStore } from './useHeaderStore';
|
|
16
16
|
export const NavigationHeader = () => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
|
-
const {
|
|
18
|
+
const { subvariant, hiddenUI } = useWidgetConfig();
|
|
19
19
|
const { navigate, navigateBack } = useNavigateBack();
|
|
20
20
|
const { account } = useWallet();
|
|
21
|
-
const { element } =
|
|
21
|
+
const { element, title } = useHeaderStore();
|
|
22
22
|
const { pathname } = useLocation();
|
|
23
23
|
const cleanedPathname = pathname.endsWith('/')
|
|
24
24
|
? pathname.slice(0, -1)
|
|
@@ -36,10 +36,10 @@ export const NavigationHeader = () => {
|
|
|
36
36
|
return t(`settings.enabledBridges`);
|
|
37
37
|
case navigationRoutes.exchanges:
|
|
38
38
|
return t(`settings.enabledExchanges`);
|
|
39
|
-
case navigationRoutes.
|
|
40
|
-
return t(`header.
|
|
39
|
+
case navigationRoutes.transactionHistory:
|
|
40
|
+
return t(`header.transactionHistory`);
|
|
41
41
|
case navigationRoutes.fromToken: {
|
|
42
|
-
if (
|
|
42
|
+
if (subvariant === 'nft') {
|
|
43
43
|
return t(`header.payWith`);
|
|
44
44
|
}
|
|
45
45
|
return t(`header.from`);
|
|
@@ -50,35 +50,35 @@ export const NavigationHeader = () => {
|
|
|
50
50
|
case navigationRoutes.toChain:
|
|
51
51
|
case navigationRoutes.toTokenNative:
|
|
52
52
|
return t(`header.selectChain`);
|
|
53
|
-
case navigationRoutes.
|
|
54
|
-
return t(`header.
|
|
55
|
-
case navigationRoutes.
|
|
56
|
-
return t(`header.
|
|
57
|
-
case navigationRoutes.
|
|
58
|
-
if (
|
|
53
|
+
case navigationRoutes.routes:
|
|
54
|
+
return t(`header.youGet`);
|
|
55
|
+
case navigationRoutes.activeTransactions:
|
|
56
|
+
return t(`header.activeTransactions`);
|
|
57
|
+
case navigationRoutes.transactionExecution: {
|
|
58
|
+
if (subvariant === 'nft') {
|
|
59
59
|
return t(`header.purchase`);
|
|
60
60
|
}
|
|
61
|
-
return t(`header.
|
|
61
|
+
return t(`header.exchange`);
|
|
62
62
|
}
|
|
63
|
-
case navigationRoutes.
|
|
64
|
-
if (
|
|
63
|
+
case navigationRoutes.transactionDetails: {
|
|
64
|
+
if (subvariant === 'nft') {
|
|
65
65
|
return t(`header.purchaseDetails`);
|
|
66
66
|
}
|
|
67
|
-
return t(`header.
|
|
67
|
+
return t(`header.transactionDetails`);
|
|
68
68
|
}
|
|
69
69
|
default: {
|
|
70
|
-
switch (
|
|
70
|
+
switch (subvariant) {
|
|
71
71
|
case 'nft':
|
|
72
72
|
return t(`header.checkout`);
|
|
73
73
|
case 'refuel':
|
|
74
74
|
return t(`header.gas`);
|
|
75
75
|
default:
|
|
76
|
-
return t(`header.
|
|
76
|
+
return t(`header.exchange`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, splitSubvariant ? (_jsx(Box, { flex: 1, children: !hiddenUI?.includes(HiddenUI.WalletMenu) ? (_jsx(WalletMenuButton, {})) : null })) : (_jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive && !hiddenUI?.includes(HiddenUI.History) ? (_jsx(Tooltip, { title: t(`header.
|
|
81
|
+
return (_jsxs(_Fragment, { children: [_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, splitSubvariant ? (_jsx(Box, { flex: 1, children: !hiddenUI?.includes(HiddenUI.WalletMenu) ? (_jsx(WalletMenuButton, {})) : null })) : (_jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: title || handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive && !hiddenUI?.includes(HiddenUI.History) ? (_jsx(Tooltip, { title: t(`header.transactionHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.transactionHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
|
|
82
82
|
marginRight: -1.25,
|
|
83
83
|
}, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }), splitSubvariant ? _jsx(NavigationTabs, {}) : null] }));
|
|
84
84
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useFormContext } from 'react-hook-form';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import {
|
|
4
|
+
import { FormKey } from '../../providers';
|
|
5
5
|
import { useSplitSubvariantStore } from '../../stores';
|
|
6
6
|
import { HeaderAppBar } from './Header.style';
|
|
7
7
|
import { NavbarTab, NavbarTabs } from './NavigationTabs.style';
|
|
@@ -13,9 +13,9 @@ export const NavigationTabs = () => {
|
|
|
13
13
|
]);
|
|
14
14
|
const { setValue } = useFormContext();
|
|
15
15
|
const handleChange = (_, value) => {
|
|
16
|
-
setValue(
|
|
17
|
-
setValue(
|
|
18
|
-
setValue(
|
|
16
|
+
setValue(FormKey.FromAmount, '');
|
|
17
|
+
setValue(FormKey.FromToken, '');
|
|
18
|
+
setValue(FormKey.ToToken, '');
|
|
19
19
|
setState(value === 0 ? 'swap' : 'bridge');
|
|
20
20
|
};
|
|
21
21
|
return (_jsx(HeaderAppBar, { elevation: 0, sx: { py: 1 }, children: _jsxs(NavbarTabs, { value: state === 'swap' ? 0 : 1, onChange: handleChange, "aria-label": "tabs", indicatorColor: "primary", children: [_jsx(NavbarTab, { label: t('header.swap'), disableRipple: true }), _jsx(NavbarTab, { label: t('header.bridge'), disableRipple: true })] }) }));
|
|
@@ -2,9 +2,9 @@ import { Tab, Tabs, tabClasses, tabsClasses } from '@mui/material';
|
|
|
2
2
|
import { alpha, styled } from '@mui/material/styles';
|
|
3
3
|
export const NavbarTabs = styled(Tabs)(({ theme }) => ({
|
|
4
4
|
backgroundColor: theme.palette.mode === 'dark'
|
|
5
|
-
? theme.palette.
|
|
5
|
+
? theme.palette.background.paper
|
|
6
6
|
: alpha(theme.palette.common.black, 0.04),
|
|
7
|
-
borderRadius: theme.shape.borderRadius,
|
|
7
|
+
borderRadius: Math.max(theme.shape.borderRadius, theme.shape.borderRadiusSecondary),
|
|
8
8
|
padding: theme.spacing(0.5),
|
|
9
9
|
flex: 1,
|
|
10
10
|
display: 'flex',
|
|
@@ -22,7 +22,7 @@ export const NavbarTabs = styled(Tabs)(({ theme }) => ({
|
|
|
22
22
|
transform: 'translateY(-50%)',
|
|
23
23
|
height: 48,
|
|
24
24
|
backgroundColor: theme.palette.mode === 'dark'
|
|
25
|
-
? theme.palette.
|
|
25
|
+
? theme.palette.background.default
|
|
26
26
|
: theme.palette.common.white,
|
|
27
27
|
borderRadius: theme.shape.borderRadiusSecondary,
|
|
28
28
|
boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Header';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './useHeaderStore';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Header';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './useHeaderStore';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export interface
|
|
2
|
+
export interface HeaderState {
|
|
3
3
|
element?: React.ReactNode | null;
|
|
4
|
+
title?: string;
|
|
4
5
|
}
|
|
5
|
-
export interface
|
|
6
|
+
export interface HeaderStore extends HeaderState {
|
|
6
7
|
setAction(element?: React.ReactNode | null): () => void;
|
|
8
|
+
setTitle(title?: string): () => void;
|
|
7
9
|
removeAction(): void;
|
|
10
|
+
removeTitle(): void;
|
|
8
11
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
export const useHeaderStore = create((set, get) => ({
|
|
3
|
+
setAction: (element) => {
|
|
4
|
+
set(() => ({
|
|
5
|
+
element,
|
|
6
|
+
}));
|
|
7
|
+
return get().removeAction;
|
|
8
|
+
},
|
|
9
|
+
setTitle: (title) => {
|
|
10
|
+
set(() => ({
|
|
11
|
+
title,
|
|
12
|
+
}));
|
|
13
|
+
return get().removeTitle;
|
|
14
|
+
},
|
|
15
|
+
removeAction: () => {
|
|
16
|
+
set(() => ({
|
|
17
|
+
element: null,
|
|
18
|
+
}));
|
|
19
|
+
},
|
|
20
|
+
removeTitle: () => {
|
|
21
|
+
set(() => ({
|
|
22
|
+
title: undefined,
|
|
23
|
+
}));
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { RouteExecutionStatus } from '../../stores';
|
|
3
3
|
import { InsuranceCard } from './InsuranceCard';
|
|
4
4
|
import { InsuranceCollapsed } from './InsuranceCollapsed';
|
|
5
|
-
export const Insurance = ({ status, insurableRouteId,
|
|
6
|
-
return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, {
|
|
5
|
+
export const Insurance = ({ status, insurableRouteId, onChange, ...props }) => {
|
|
6
|
+
return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, { status: status, insurableRouteId: insurableRouteId, onChange: onChange, ...props })) : (_jsx(InsuranceCard, { status: status, ...props }));
|
|
7
7
|
};
|
|
@@ -4,12 +4,12 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
4
4
|
import VerifiedUserIcon from '@mui/icons-material/VerifiedUser';
|
|
5
5
|
import { Box, Collapse, Link, Typography } from '@mui/material';
|
|
6
6
|
import { useState } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
8
8
|
import { InsuraceLogo } from '../../icons';
|
|
9
9
|
import { RouteExecutionStatus } from '../../stores';
|
|
10
10
|
import { Card, CardIconButton, CardLabel, CardLabelTypography } from '../Card';
|
|
11
11
|
import { Switch } from '../Switch';
|
|
12
|
-
export const InsuranceCard = ({ status, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
|
|
12
|
+
export const InsuranceCard = ({ status, feeAmountUsd, insuredAmount, insuredTokenSymbol, insuranceCoverageId, onChange, ...props }) => {
|
|
13
13
|
const { t } = useTranslation();
|
|
14
14
|
const [enabled, setEnabled] = useState(false);
|
|
15
15
|
const [cardExpanded, setCardExpanded] = useState(status === RouteExecutionStatus.Idle);
|
|
@@ -22,15 +22,18 @@ export const InsuranceCard = ({ status, feeAmountUsd, insuranceCoverageId, onCha
|
|
|
22
22
|
onChange?.(checked);
|
|
23
23
|
};
|
|
24
24
|
return (_jsxs(Card, { selectionColor: "secondary", indented: true, ...props, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [_jsxs(CardLabel, { type: 'insurance', children: [_jsx(VerifiedUserIcon, { fontSize: "inherit" }), _jsx(CardLabelTypography, { type: "icon", children: status === RouteExecutionStatus.Idle
|
|
25
|
-
? t('
|
|
26
|
-
: t('
|
|
25
|
+
? t('main.tags.insurance')
|
|
26
|
+
: t('main.tags.insured') })] }), status === RouteExecutionStatus.Idle ? (_jsx(Switch, { onChange: handleSwitch, value: enabled })) : (_jsx(Box, { my: -0.5, children: _jsx(CardIconButton, { onClick: handleExpand, size: "small", children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }) }))] }), _jsx(Collapse, { timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Box, { mt: 2, children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2, children: [_jsx(Typography, { fontSize: 24, fontWeight: 700, lineHeight: 1, children: t('format.currency', {
|
|
27
27
|
value: feeAmountUsd,
|
|
28
|
-
}) }), _jsx(InsuraceLogo, {})] }), _jsxs(Box, { children: [_jsx(Typography, { fontSize: 14, children: status === RouteExecutionStatus.Idle
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
}) }), _jsx(InsuraceLogo, {})] }), _jsxs(Box, { children: [_jsx(Typography, { fontSize: 14, children: _jsx(Trans, { i18nKey: status === RouteExecutionStatus.Idle
|
|
29
|
+
? 'insurance.insure'
|
|
30
|
+
: 'insurance.insured', values: {
|
|
31
|
+
amount: insuredAmount,
|
|
32
|
+
tokenSymbol: insuredTokenSymbol,
|
|
33
|
+
}, components: [_jsx("strong", {})] }) }), _jsx(Collapse, { timeout: 225, in: enabled || status !== RouteExecutionStatus.Idle, mountOnEnter: true, unmountOnExit: true, children: _jsxs(Box, { sx: {
|
|
31
34
|
listStyleType: 'disc',
|
|
32
35
|
pl: 2,
|
|
33
|
-
}, children: [_jsx(Typography, { fontSize: 14, display: "list-item", children: t('
|
|
36
|
+
}, children: [_jsx(Typography, { fontSize: 14, display: "list-item", children: t('insurance.bridgeExploits') }), _jsx(Typography, { fontSize: 14, display: "list-item", children: t('insurance.slippageError') })] }) }), _jsx(Link, { href: status === RouteExecutionStatus.Idle
|
|
34
37
|
? 'https://docs.insurace.io/landing-page/documentation/cover-products/bridge-cover/li.fi'
|
|
35
38
|
: `https://app.insurace.io/bridge-cover?search=${insuranceCoverageId}`, target: "_blank", underline: "none", color: "text.primary", children: _jsx(Typography, { pt: 0.5, color: "primary", fontSize: 14, fontWeight: 600, children: status === RouteExecutionStatus.Idle
|
|
36
39
|
? t('button.learnMore')
|