@lifi/widget 2.0.0-beta.8 → 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/GasMessage.js +1 -6
- 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 +8 -10
- 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 +19 -14
- 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/useGasSufficiency.js +10 -1
- package/cjs/hooks/useProcessMessage.d.ts +2 -2
- package/cjs/hooks/useProcessMessage.js +48 -44
- package/cjs/hooks/useRouteExecution.js +3 -4
- package/cjs/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -3
- package/cjs/hooks/{useSwapRoutes.js → useRoutes.js} +24 -25
- 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 -129
- 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/SDKProvider/SDKProvider.js +2 -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/GasMessage.js +2 -7
- 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 +9 -11
- 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 +19 -14
- 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/useGasSufficiency.js +11 -2
- package/hooks/useProcessMessage.d.ts +2 -2
- package/hooks/useProcessMessage.js +48 -44
- package/hooks/useRouteExecution.js +3 -4
- package/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -3
- package/hooks/{useSwapRoutes.js → useRoutes.js} +23 -24
- 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 -129
- 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 +32 -18
- 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/SDKProvider/SDKProvider.js +2 -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
package/types/events.d.ts
CHANGED
|
@@ -3,14 +3,22 @@ export declare enum WidgetEvent {
|
|
|
3
3
|
RouteExecutionStarted = "routeExecutionStarted",
|
|
4
4
|
RouteExecutionUpdated = "routeExecutionUpdated",
|
|
5
5
|
RouteExecutionCompleted = "routeExecutionCompleted",
|
|
6
|
-
RouteExecutionFailed = "routeExecutionFailed"
|
|
6
|
+
RouteExecutionFailed = "routeExecutionFailed",
|
|
7
|
+
RouteHighValueLoss = "routeHighValueLoss"
|
|
7
8
|
}
|
|
8
9
|
export type WidgetEvents = {
|
|
9
10
|
routeExecutionStarted: Route;
|
|
10
11
|
routeExecutionUpdated: RouteExecutionUpdate;
|
|
11
12
|
routeExecutionCompleted: Route;
|
|
12
13
|
routeExecutionFailed: RouteExecutionUpdate;
|
|
14
|
+
routeHighValueLoss: RouteHighValueLossUpdate;
|
|
13
15
|
};
|
|
16
|
+
export interface RouteHighValueLossUpdate {
|
|
17
|
+
fromAmountUsd: string;
|
|
18
|
+
gasCostUSD?: string;
|
|
19
|
+
toAmountUSD: string;
|
|
20
|
+
valueLoss: string;
|
|
21
|
+
}
|
|
14
22
|
export interface RouteExecutionUpdate {
|
|
15
23
|
route: Route;
|
|
16
24
|
process: Process;
|
package/types/events.js
CHANGED
|
@@ -4,4 +4,5 @@ export var WidgetEvent;
|
|
|
4
4
|
WidgetEvent["RouteExecutionUpdated"] = "routeExecutionUpdated";
|
|
5
5
|
WidgetEvent["RouteExecutionCompleted"] = "routeExecutionCompleted";
|
|
6
6
|
WidgetEvent["RouteExecutionFailed"] = "routeExecutionFailed";
|
|
7
|
+
WidgetEvent["RouteHighValueLoss"] = "routeHighValueLoss";
|
|
7
8
|
})(WidgetEvent || (WidgetEvent = {}));
|
package/types/widget.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Signer } from '@ethersproject/abstract-signer';
|
|
2
|
-
import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken } from '@lifi/sdk';
|
|
2
|
+
import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken, Token } from '@lifi/sdk';
|
|
3
3
|
import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
|
|
4
4
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
5
5
|
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
6
6
|
import type { LanguageKey, LanguageResources } from '../providers';
|
|
7
|
-
export type WidgetVariant = 'default' | 'expandable' | 'drawer'
|
|
8
|
-
export type WidgetSubvariant = 'default' | 'split';
|
|
7
|
+
export type WidgetVariant = 'default' | 'expandable' | 'drawer';
|
|
8
|
+
export type WidgetSubvariant = 'default' | 'split' | 'nft' | 'refuel';
|
|
9
9
|
export declare enum DisabledUI {
|
|
10
10
|
FromAmount = "fromAmount",
|
|
11
11
|
FromToken = "fromToken",
|
|
@@ -68,6 +68,7 @@ export interface WidgetConfig {
|
|
|
68
68
|
toAmount?: number | string;
|
|
69
69
|
contract?: WidgetContract;
|
|
70
70
|
contractComponent?: ReactNode;
|
|
71
|
+
contractSecondaryComponent?: ReactNode;
|
|
71
72
|
contractCompactComponent?: ReactNode;
|
|
72
73
|
contractTool?: WidgetContractTool;
|
|
73
74
|
fee?: number;
|
|
@@ -87,7 +88,7 @@ export interface WidgetConfig {
|
|
|
87
88
|
useRecommendedRoute?: boolean;
|
|
88
89
|
walletManagement?: WidgetWalletManagement;
|
|
89
90
|
sdkConfig?: SDKConfig;
|
|
90
|
-
|
|
91
|
+
buildUrl?: boolean;
|
|
91
92
|
localStorageKeyPrefix?: string;
|
|
92
93
|
bridges?: {
|
|
93
94
|
allow?: string[];
|
|
@@ -103,6 +104,7 @@ export interface WidgetConfig {
|
|
|
103
104
|
};
|
|
104
105
|
tokens?: {
|
|
105
106
|
featured?: StaticToken[];
|
|
107
|
+
include?: Token[];
|
|
106
108
|
allow?: BaseToken[];
|
|
107
109
|
deny?: BaseToken[];
|
|
108
110
|
};
|
package/utils/format.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const formatTokenAmount: (amount?: string, decimals?: number, decimalPlaces?: number) => string;
|
|
7
7
|
export declare const formatSlippage: (slippage?: string, defaultValue?: string, returnInitial?: boolean) => string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const formatInputAmount: (amount: string, decimals?: number | null, returnInitial?: boolean) => string;
|
|
9
9
|
export declare const formatTokenPrice: (amount?: string, price?: string) => number;
|
package/utils/format.js
CHANGED
|
@@ -21,7 +21,7 @@ export const formatTokenAmount = (amount = '0', decimals = 0, decimalPlaces = 3)
|
|
|
21
21
|
while (absAmount < 1 / 10 ** decimalPlaces) {
|
|
22
22
|
decimalPlaces++;
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return parsedAmount.toFixed(decimalPlaces + 1);
|
|
25
25
|
};
|
|
26
26
|
export const formatSlippage = (slippage = '', defaultValue = '', returnInitial = false) => {
|
|
27
27
|
if (!slippage) {
|
|
@@ -45,7 +45,7 @@ export const formatSlippage = (slippage = '', defaultValue = '', returnInitial =
|
|
|
45
45
|
}
|
|
46
46
|
return parsedSlippage.toString();
|
|
47
47
|
};
|
|
48
|
-
export const
|
|
48
|
+
export const formatInputAmount = (amount, decimals = null, returnInitial = false) => {
|
|
49
49
|
if (!amount) {
|
|
50
50
|
return amount;
|
|
51
51
|
}
|
|
@@ -57,21 +57,19 @@ export const formatAmount = (amount = '', returnInitial = false) => {
|
|
|
57
57
|
if (isNaN(Number(formattedAmount)) && !isNaN(parsedAmount)) {
|
|
58
58
|
return parsedAmount.toString();
|
|
59
59
|
}
|
|
60
|
-
if (isNaN(
|
|
60
|
+
if (isNaN(Math.abs(Number(formattedAmount)))) {
|
|
61
61
|
return '';
|
|
62
62
|
}
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
if (returnInitial && Big(formattedAmount)) {
|
|
68
|
-
return formattedAmount;
|
|
69
|
-
}
|
|
63
|
+
if (returnInitial) {
|
|
64
|
+
return formattedAmount;
|
|
70
65
|
}
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
let [integer, fraction = ''] = formattedAmount.split('.');
|
|
67
|
+
if (decimals !== null && fraction.length > decimals) {
|
|
68
|
+
fraction = fraction.slice(0, decimals);
|
|
73
69
|
}
|
|
74
|
-
|
|
70
|
+
integer = integer.replace(/^0+|-/, '');
|
|
71
|
+
fraction = fraction.replace(/(0+)$/, '');
|
|
72
|
+
return `${integer || (fraction ? '0' : '')}${fraction ? `.${fraction}` : ''}`;
|
|
75
73
|
};
|
|
76
74
|
export const formatTokenPrice = (amount, price) => {
|
|
77
75
|
if (!amount || !price) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export declare const navigationRoutes: {
|
|
2
2
|
home: string;
|
|
3
|
-
|
|
3
|
+
activeTransactions: string;
|
|
4
4
|
bridges: string;
|
|
5
5
|
exchanges: string;
|
|
6
6
|
fromChain: string;
|
|
7
7
|
fromToken: string;
|
|
8
|
+
routes: string;
|
|
8
9
|
selectWallet: string;
|
|
9
10
|
settings: string;
|
|
10
|
-
swapDetails: string;
|
|
11
|
-
swapExecution: string;
|
|
12
|
-
swapHistory: string;
|
|
13
|
-
swapRoutes: string;
|
|
14
11
|
toChain: string;
|
|
15
12
|
toToken: string;
|
|
16
13
|
toTokenNative: string;
|
|
14
|
+
transactionDetails: string;
|
|
15
|
+
transactionExecution: string;
|
|
16
|
+
transactionHistory: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const navigationRoutesValues: string[];
|
|
19
19
|
export declare const stickyHeaderRoutes: string[];
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
export const navigationRoutes = {
|
|
2
2
|
home: '/',
|
|
3
|
-
|
|
3
|
+
activeTransactions: 'active-transactions',
|
|
4
4
|
bridges: 'bridges',
|
|
5
5
|
exchanges: 'exchanges',
|
|
6
6
|
fromChain: 'from-chain',
|
|
7
7
|
fromToken: 'from-token',
|
|
8
|
+
routes: 'routes',
|
|
8
9
|
selectWallet: 'wallet',
|
|
9
10
|
settings: 'settings',
|
|
10
|
-
swapDetails: 'swap-details',
|
|
11
|
-
swapExecution: 'swap-execution',
|
|
12
|
-
swapHistory: 'swap-history',
|
|
13
|
-
swapRoutes: 'swap-routes',
|
|
14
11
|
toChain: 'to-chain',
|
|
15
12
|
toToken: 'to-token',
|
|
16
13
|
toTokenNative: 'to-token-native',
|
|
14
|
+
transactionDetails: 'transaction-details',
|
|
15
|
+
transactionExecution: 'transaction-execution',
|
|
16
|
+
transactionHistory: 'transaction-history',
|
|
17
17
|
};
|
|
18
18
|
export const navigationRoutesValues = Object.values(navigationRoutes);
|
|
19
19
|
export const stickyHeaderRoutes = [
|
|
20
|
-
navigationRoutes.
|
|
20
|
+
navigationRoutes.activeTransactions,
|
|
21
21
|
navigationRoutes.bridges,
|
|
22
22
|
navigationRoutes.exchanges,
|
|
23
23
|
navigationRoutes.fromChain,
|
|
24
24
|
navigationRoutes.home,
|
|
25
|
+
navigationRoutes.routes,
|
|
25
26
|
navigationRoutes.selectWallet,
|
|
26
27
|
navigationRoutes.settings,
|
|
27
|
-
navigationRoutes.swapDetails,
|
|
28
|
-
navigationRoutes.swapExecution,
|
|
29
|
-
navigationRoutes.swapHistory,
|
|
30
|
-
navigationRoutes.swapRoutes,
|
|
31
28
|
navigationRoutes.toChain,
|
|
32
29
|
navigationRoutes.toTokenNative,
|
|
30
|
+
navigationRoutes.transactionDetails,
|
|
31
|
+
navigationRoutes.transactionExecution,
|
|
32
|
+
navigationRoutes.transactionHistory,
|
|
33
33
|
];
|
|
34
34
|
export const backButtonRoutes = [
|
|
35
|
-
navigationRoutes.
|
|
35
|
+
navigationRoutes.activeTransactions,
|
|
36
36
|
navigationRoutes.bridges,
|
|
37
37
|
navigationRoutes.exchanges,
|
|
38
38
|
navigationRoutes.fromChain,
|
|
39
39
|
navigationRoutes.fromToken,
|
|
40
|
+
navigationRoutes.routes,
|
|
40
41
|
navigationRoutes.selectWallet,
|
|
41
42
|
navigationRoutes.settings,
|
|
42
|
-
navigationRoutes.swapDetails,
|
|
43
|
-
navigationRoutes.swapExecution,
|
|
44
|
-
navigationRoutes.swapHistory,
|
|
45
|
-
navigationRoutes.swapRoutes,
|
|
46
43
|
navigationRoutes.toChain,
|
|
47
44
|
navigationRoutes.toToken,
|
|
48
45
|
navigationRoutes.toTokenNative,
|
|
46
|
+
navigationRoutes.transactionDetails,
|
|
47
|
+
navigationRoutes.transactionExecution,
|
|
48
|
+
navigationRoutes.transactionHistory,
|
|
49
49
|
];
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapButton = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const lab_1 = require("@mui/lab");
|
|
6
|
-
const react_i18next_1 = require("react-i18next");
|
|
7
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
-
const providers_1 = require("../../providers");
|
|
9
|
-
const utils_1 = require("../../utils");
|
|
10
|
-
const SwapButton = ({ onClick, hasRoute, text, disabled, loading, }) => {
|
|
11
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
12
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
13
|
-
const { variant, walletManagement } = (0, providers_1.useWidgetConfig)();
|
|
14
|
-
const { account, connect } = (0, providers_1.useWallet)();
|
|
15
|
-
const handleSwapButtonClick = async () => {
|
|
16
|
-
if (!account.isActive) {
|
|
17
|
-
if (walletManagement) {
|
|
18
|
-
await connect();
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
navigate(utils_1.navigationRoutes.selectWallet);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
onClick?.();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const getButtonText = () => {
|
|
29
|
-
if (account.isActive) {
|
|
30
|
-
if (!hasRoute) {
|
|
31
|
-
switch (variant) {
|
|
32
|
-
case 'nft':
|
|
33
|
-
return t(`button.buy`);
|
|
34
|
-
case 'refuel':
|
|
35
|
-
return t(`button.getGas`);
|
|
36
|
-
default:
|
|
37
|
-
return t(`button.swap`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (text) {
|
|
41
|
-
return text;
|
|
42
|
-
}
|
|
43
|
-
switch (variant) {
|
|
44
|
-
case 'nft':
|
|
45
|
-
return t(`button.reviewPurchase`);
|
|
46
|
-
case 'refuel':
|
|
47
|
-
return t(`button.reviewGasSwap`);
|
|
48
|
-
default:
|
|
49
|
-
return t(`button.reviewSwap`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return t(`button.connectWallet`);
|
|
53
|
-
};
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(lab_1.LoadingButton, { variant: "contained", color: "primary", onClick: handleSwapButtonClick, disabled: disabled, loading: loading, loadingPosition: "center", fullWidth: true, children: getButtonText() }));
|
|
55
|
-
};
|
|
56
|
-
exports.SwapButton = SwapButton;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FitInputText = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
-
const providers_1 = require("../../providers");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const SwapInput_style_1 = require("./SwapInput.style");
|
|
9
|
-
exports.FitInputText = (0, react_1.forwardRef)(({ formType }, ref) => {
|
|
10
|
-
const amountKey = providers_1.SwapFormKeyHelper.getAmountKey(formType);
|
|
11
|
-
const [amount] = (0, react_hook_form_1.useWatch)({
|
|
12
|
-
name: [amountKey],
|
|
13
|
-
});
|
|
14
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
15
|
-
(0, utils_1.fitInputText)(SwapInput_style_1.maxInputFontSize, SwapInput_style_1.minInputFontSize, ref
|
|
16
|
-
.current);
|
|
17
|
-
}, [amount, ref]);
|
|
18
|
-
return null;
|
|
19
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapInput = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
-
const react_i18next_1 = require("react-i18next");
|
|
8
|
-
const providers_1 = require("../../providers");
|
|
9
|
-
const types_1 = require("../../types");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
const Card_1 = require("../Card");
|
|
12
|
-
const FitInputText_1 = require("./FitInputText");
|
|
13
|
-
const FormPriceHelperText_1 = require("./FormPriceHelperText");
|
|
14
|
-
const SwapInput_style_1 = require("./SwapInput.style");
|
|
15
|
-
const SwapInputEndAdornment_1 = require("./SwapInputEndAdornment");
|
|
16
|
-
const SwapInputStartAdornment_1 = require("./SwapInputStartAdornment");
|
|
17
|
-
const SwapInput = ({ formType, ...props }) => {
|
|
18
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
|
-
const amountKey = providers_1.SwapFormKeyHelper.getAmountKey(formType);
|
|
20
|
-
const { field: { onChange, onBlur, value }, } = (0, react_hook_form_1.useController)({
|
|
21
|
-
name: amountKey,
|
|
22
|
-
});
|
|
23
|
-
const { disabledUI } = (0, providers_1.useWidgetConfig)();
|
|
24
|
-
const ref = (0, react_1.useRef)(null);
|
|
25
|
-
const handleChange = (event) => {
|
|
26
|
-
const { value } = event.target;
|
|
27
|
-
const formattedAmount = (0, utils_1.formatAmount)(value, true);
|
|
28
|
-
onChange(formattedAmount);
|
|
29
|
-
};
|
|
30
|
-
const handleBlur = (event) => {
|
|
31
|
-
const { value } = event.target;
|
|
32
|
-
const formattedAmount = (0, utils_1.formatAmount)(value);
|
|
33
|
-
onChange(formattedAmount);
|
|
34
|
-
onBlur();
|
|
35
|
-
};
|
|
36
|
-
const disabled = disabledUI?.includes(types_1.DisabledUI.FromAmount);
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { ...props, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.fromAmount') }), (0, jsx_runtime_1.jsxs)(SwapInput_style_1.FormControl, { fullWidth: true, children: [(0, jsx_runtime_1.jsx)(SwapInput_style_1.Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: (0, jsx_runtime_1.jsx)(SwapInputStartAdornment_1.SwapInputStartAdornment, { formType: formType }), endAdornment: !disabled ? ((0, jsx_runtime_1.jsx)(SwapInputEndAdornment_1.SwapInputEndAdornment, { formType: formType })) : undefined, inputProps: {
|
|
38
|
-
inputMode: 'decimal',
|
|
39
|
-
}, onChange: handleChange, onBlur: handleBlur, value: value, name: amountKey, disabled: disabled, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { formType: formType })] }), (0, jsx_runtime_1.jsx)(FitInputText_1.FitInputText, { ref: ref, formType: formType })] }));
|
|
40
|
-
};
|
|
41
|
-
exports.SwapInput = SwapInput;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SwapInput';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./SwapRouteCard"), exports);
|
|
18
|
-
__exportStar(require("./SwapRouteCardSkeleton"), exports);
|
|
19
|
-
__exportStar(require("./SwapRouteNotFoundCard"), exports);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapRoutes = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
-
const react_i18next_1 = require("react-i18next");
|
|
8
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
9
|
-
const Card_1 = require("../../components/Card");
|
|
10
|
-
const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
|
|
11
|
-
const SwapRouteCard_1 = require("../../components/SwapRouteCard");
|
|
12
|
-
const hooks_1 = require("../../hooks");
|
|
13
|
-
const providers_1 = require("../../providers");
|
|
14
|
-
const utils_1 = require("../../utils");
|
|
15
|
-
const SwapRoutes = (props) => {
|
|
16
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
17
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
18
|
-
const { variant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
|
|
19
|
-
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
20
|
-
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
21
|
-
const currentRoute = routes?.[0];
|
|
22
|
-
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const handleCardClick = () => {
|
|
26
|
-
navigate(utils_1.navigationRoutes.swapRoutes);
|
|
27
|
-
};
|
|
28
|
-
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
29
|
-
const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
|
|
30
|
-
const showAll = !onlyRecommendedRoute && !routeNotFound && (routes?.length ?? 0) > 1;
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { ...props, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: variant === 'nft' ? t('swap.fromAmount') : t('header.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
32
|
-
position: 'absolute',
|
|
33
|
-
top: 8,
|
|
34
|
-
right: 8,
|
|
35
|
-
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { p: 2, children: [isLoading ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "cardless" })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: currentRoute, variant: "cardless", active: true })), (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: showAll, unmountOnExit: true, mountOnEnter: true, appear: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleCardClick, disabled: isValidating || !isValid, fullWidth: true, children: t('button.showAll') }) }) })] })] }));
|
|
36
|
-
};
|
|
37
|
-
exports.SwapRoutes = SwapRoutes;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapRoutesExpandedElement = exports.SwapRoutesExpanded = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
-
const react_i18next_1 = require("react-i18next");
|
|
8
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
9
|
-
const hooks_1 = require("../../hooks");
|
|
10
|
-
const providers_1 = require("../../providers");
|
|
11
|
-
const stores_1 = require("../../stores");
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
const ProgressToNextUpdate_1 = require("../ProgressToNextUpdate");
|
|
14
|
-
const SwapRouteCard_1 = require("../SwapRouteCard");
|
|
15
|
-
const SwapRoutesExpanded_style_1 = require("./SwapRoutesExpanded.style");
|
|
16
|
-
const timeout = { enter: 225, exit: 225, appear: 0 };
|
|
17
|
-
const SwapRoutesExpanded = () => {
|
|
18
|
-
const element = (0, react_router_dom_1.useMatch)('/');
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(SwapRoutesExpanded_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: timeout, in: !!element, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(material_1.Grow, { timeout: timeout, in: !!element, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(exports.SwapRoutesExpandedElement, {}) }) }) }) }));
|
|
20
|
-
};
|
|
21
|
-
exports.SwapRoutesExpanded = SwapRoutesExpanded;
|
|
22
|
-
const SwapRoutesExpandedElement = () => {
|
|
23
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
24
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
25
|
-
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
26
|
-
const { variant, containerStyle } = (0, providers_1.useWidgetConfig)();
|
|
27
|
-
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
28
|
-
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
29
|
-
const currentRoute = routes?.[0];
|
|
30
|
-
const handleRouteClick = (route) => {
|
|
31
|
-
if (isValid && !isValidating) {
|
|
32
|
-
setExecutableRoute(route);
|
|
33
|
-
navigate(utils_1.navigationRoutes.swapExecution, {
|
|
34
|
-
state: { routeId: route.id },
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched);
|
|
39
|
-
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: timeout.enter, in: expanded, orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(material_1.Grow, { timeout: timeout.enter, in: expanded, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(SwapRoutesExpanded_style_1.Container, { sx: containerStyle, enableColorScheme: true, children: (0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutesExpanded_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 18, fontWeight: "700", flex: 1, noWrap: true, children: variant === 'nft' ? t('swap.fromAmount') : t('header.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3, children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || (isFetching && !routes?.length) ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (routes?.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, expanded: routes?.length <= 2 }, route.id)))) })] }) }) }) }));
|
|
41
|
-
};
|
|
42
|
-
exports.SwapRoutesExpandedElement = SwapRoutesExpandedElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ActiveSwapsPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ActiveSwapsPage';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MainSwapButton = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
7
|
-
const SwapButton_1 = require("../../components/SwapButton");
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
9
|
-
const stores_1 = require("../../stores");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
const MainSwapButton = () => {
|
|
12
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
13
|
-
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
14
|
-
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
15
|
-
const { routes: swapRoutes, isLoading, isFetching } = (0, hooks_1.useSwapRoutes)();
|
|
16
|
-
const currentRoute = swapRoutes?.[0];
|
|
17
|
-
const handleClick = async () => {
|
|
18
|
-
if (currentRoute) {
|
|
19
|
-
setExecutableRoute(currentRoute);
|
|
20
|
-
navigate(utils_1.navigationRoutes.swapExecution, {
|
|
21
|
-
state: { routeId: currentRoute.id },
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, hasRoute: Boolean(currentRoute), disabled: currentRoute && (isLoading || isFetching || isValidating || !isValid) }));
|
|
26
|
-
};
|
|
27
|
-
exports.MainSwapButton = MainSwapButton;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SwapDetailsPage';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapHistoryPage = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const DeleteOutline_1 = require("@mui/icons-material/DeleteOutline");
|
|
6
|
-
const material_1 = require("@mui/material");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const react_i18next_1 = require("react-i18next");
|
|
9
|
-
const Dialog_1 = require("../../components/Dialog");
|
|
10
|
-
const Header_1 = require("../../components/Header");
|
|
11
|
-
const providers_1 = require("../../providers");
|
|
12
|
-
const stores_1 = require("../../stores");
|
|
13
|
-
const routes_1 = require("../../stores/routes");
|
|
14
|
-
const SwapHistoryEmpty_1 = require("./SwapHistoryEmpty");
|
|
15
|
-
const SwapHistoryItem_1 = require("./SwapHistoryItem");
|
|
16
|
-
const SwapHistoryPage = () => {
|
|
17
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
|
-
const { account } = (0, providers_1.useWallet)();
|
|
19
|
-
const swaps = (0, routes_1.useSwapHistory)(account.address);
|
|
20
|
-
const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
|
|
21
|
-
const [open, setOpen] = (0, react_1.useState)(false);
|
|
22
|
-
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
23
|
-
setOpen((open) => !open);
|
|
24
|
-
}, []);
|
|
25
|
-
(0, react_1.useEffect)(() => {
|
|
26
|
-
if (swaps.length) {
|
|
27
|
-
return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
|
|
28
|
-
}
|
|
29
|
-
}, [swaps.length, toggleDialog]);
|
|
30
|
-
if (!swaps.length) {
|
|
31
|
-
return (0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {});
|
|
32
|
-
}
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: 2, mt: 1, children: swaps.length ? (swaps.map(({ route }) => ((0, jsx_runtime_1.jsx)(SwapHistoryItem_1.SwapHistoryItem, { route: route }, route.id)))) : ((0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {})) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
34
|
-
};
|
|
35
|
-
exports.SwapHistoryPage = SwapHistoryPage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SwapHistoryPage';
|