@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import DeleteIcon from '@mui/icons-material/DeleteOutline';
|
|
3
|
+
import { Button, Container, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Stack, } from '@mui/material';
|
|
4
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Dialog } from '../../components/Dialog';
|
|
7
|
+
import { useHeaderStore } from '../../components/Header';
|
|
8
|
+
import { useWallet } from '../../providers';
|
|
9
|
+
import { useRouteExecutionStore } from '../../stores';
|
|
10
|
+
import { useTransactionHistory } from '../../stores/routes';
|
|
11
|
+
import { TransactionHistoryEmpty } from './TransactionHistoryEmpty';
|
|
12
|
+
import { TransactionHistoryItem } from './TransactionHistoryItem';
|
|
13
|
+
export const TransactionHistoryPage = () => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const { account } = useWallet();
|
|
16
|
+
const transactions = useTransactionHistory(account.address);
|
|
17
|
+
const deleteRoutes = useRouteExecutionStore((store) => store.deleteRoutes);
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const toggleDialog = useCallback(() => {
|
|
20
|
+
setOpen((open) => !open);
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (transactions.length) {
|
|
24
|
+
return useHeaderStore.getState().setAction(_jsx(IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: _jsx(DeleteIcon, {}) }));
|
|
25
|
+
}
|
|
26
|
+
}, [transactions.length, toggleDialog]);
|
|
27
|
+
if (!transactions.length) {
|
|
28
|
+
return _jsx(TransactionHistoryEmpty, {});
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs(Container, { children: [_jsx(Stack, { spacing: 2, mt: 1, children: transactions.length ? (transactions.map(({ route }) => (_jsx(TransactionHistoryItem, { route: route }, route.id)))) : (_jsx(TransactionHistoryEmpty, {})) }), _jsxs(Dialog, { open: open, onClose: toggleDialog, children: [_jsx(DialogTitle, { children: t('warning.title.deleteTransactionHistory') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('warning.message.deleteTransactionHistory') }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: toggleDialog, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionHistoryPage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionHistoryPage';
|
|
@@ -44,11 +44,11 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
|
44
44
|
const { t } = useTranslation();
|
|
45
45
|
const ref = useRef();
|
|
46
46
|
useSetContentHeight(ref);
|
|
47
|
-
return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(CenterContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('
|
|
47
|
+
return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(CenterContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('warning.title.rateChanged') })] }), _jsx(Typography, { py: 1, children: t('warning.message.rateChanged') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('main.quotedAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
|
|
48
48
|
value: formatTokenAmount(data?.oldToAmount, data?.toToken.decimals, 5),
|
|
49
|
-
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('
|
|
49
|
+
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('main.currentAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
|
|
50
50
|
value: formatTokenAmount(data?.newToAmount, data?.toToken.decimals, 5),
|
|
51
|
-
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('
|
|
51
|
+
}), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('main.rateChange') }), _jsxs(Typography, { fontWeight: 600, children: [Big(data?.newToAmount || 0)
|
|
52
52
|
.div(Big(data?.oldToAmount || 0))
|
|
53
53
|
.minus(1)
|
|
54
54
|
.mul(100)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StartTransactionButtonProps } from './types';
|
|
3
|
+
export declare const StartTransactionButton: React.FC<StartTransactionButtonProps>;
|
|
4
|
+
export declare const StartInsurableTransactionButton: React.FC<StartTransactionButtonProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DefaultTransactionButton } from '../../components/DefaultTransactionButton';
|
|
3
|
+
import { useFundsSufficiency, useGasSufficiency, useRoutes } from '../../hooks';
|
|
4
|
+
import { useRouteExecutionStore } from '../../stores';
|
|
5
|
+
export const StartTransactionButton = ({ onClick, route, text, loading, }) => {
|
|
6
|
+
const { insufficientGas, isInitialLoading: isGasSufficiencyLoading } = useGasSufficiency(route);
|
|
7
|
+
const { insufficientFunds, isInitialLoading: isFundsSufficiencyLoading } = useFundsSufficiency(route);
|
|
8
|
+
return (_jsx(DefaultTransactionButton, { onClick: onClick, text: text, disabled: insufficientFunds || !!insufficientGas?.length, loading: isFundsSufficiencyLoading || isGasSufficiencyLoading || loading }));
|
|
9
|
+
};
|
|
10
|
+
export const StartInsurableTransactionButton = ({ onClick, text, route, loading, disabled, insurableRouteId }) => {
|
|
11
|
+
const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
|
|
12
|
+
const { isFetching } = useRoutes({
|
|
13
|
+
insurableRoute: routeExecution?.route,
|
|
14
|
+
});
|
|
15
|
+
return (_jsx(StartTransactionButton, { onClick: onClick, text: text, route: route, disabled: disabled, loading: loading || isFetching, insurableRouteId: insurableRouteId }));
|
|
16
|
+
};
|
|
@@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
10
10
|
import { BottomSheet } from '../../components/BottomSheet';
|
|
11
11
|
import { Token } from '../../components/Token';
|
|
12
12
|
import { getProcessMessage, useChains, useNavigateBack, useTokenBalance, } from '../../hooks';
|
|
13
|
-
import {
|
|
13
|
+
import { FormKey, useWidgetConfig } from '../../providers';
|
|
14
14
|
import { RouteExecutionStatus } from '../../stores';
|
|
15
15
|
import { formatTokenAmount, hasEnumFlag, navigationRoutes, shortenAddress, } from '../../utils';
|
|
16
16
|
import { CenterContainer, IconCircle } from './StatusBottomSheet.style';
|
|
@@ -20,7 +20,7 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
20
20
|
const ref = useRef(null);
|
|
21
21
|
const { getChainById } = useChains();
|
|
22
22
|
const { setValue } = useFormContext();
|
|
23
|
-
const {
|
|
23
|
+
const { subvariant, contractComponent, contractSecondaryComponent, contractCompactComponent, } = useWidgetConfig();
|
|
24
24
|
const toToken = {
|
|
25
25
|
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
26
26
|
amount: route.steps.at(-1)?.execution?.toAmount ??
|
|
@@ -30,8 +30,8 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
30
30
|
const { token, refetch, refetchNewBalance, refetchAllBalances } = useTokenBalance(toToken, route.toAddress);
|
|
31
31
|
const clearFromAmount = () => {
|
|
32
32
|
refetchAllBalances();
|
|
33
|
-
setValue(
|
|
34
|
-
setValue(
|
|
33
|
+
setValue(FormKey.FromAmount, '');
|
|
34
|
+
setValue(FormKey.ToAmount, '');
|
|
35
35
|
};
|
|
36
36
|
const handleDone = () => {
|
|
37
37
|
clearFromAmount();
|
|
@@ -41,13 +41,13 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
41
41
|
clearFromAmount();
|
|
42
42
|
if (toToken.chainId !== route.toToken.chainId &&
|
|
43
43
|
toToken.address !== route.toToken.address) {
|
|
44
|
-
setValue(
|
|
45
|
-
setValue(
|
|
46
|
-
setValue(
|
|
47
|
-
setValue(
|
|
44
|
+
setValue(FormKey.FromAmount, formatTokenAmount(toToken.amount, toToken.decimals), { shouldTouch: true });
|
|
45
|
+
setValue(FormKey.FromChain, toToken.chainId, { shouldTouch: true });
|
|
46
|
+
setValue(FormKey.FromToken, toToken.address, { shouldTouch: true });
|
|
47
|
+
setValue(FormKey.ToChain, route.toToken.chainId, {
|
|
48
48
|
shouldTouch: true,
|
|
49
49
|
});
|
|
50
|
-
setValue(
|
|
50
|
+
setValue(FormKey.ToToken, route.toToken.address, {
|
|
51
51
|
shouldTouch: true,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -59,11 +59,12 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
59
59
|
};
|
|
60
60
|
const handleSeeDetails = () => {
|
|
61
61
|
handleClose();
|
|
62
|
-
navigate(navigationRoutes.
|
|
62
|
+
navigate(navigationRoutes.transactionDetails, {
|
|
63
63
|
state: { routeId: route.id },
|
|
64
64
|
replace: true,
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
+
const transactionType = route.fromChainId === route.toChainId ? 'swap' : 'bridge';
|
|
67
68
|
let title;
|
|
68
69
|
let primaryMessage;
|
|
69
70
|
let secondaryMessage;
|
|
@@ -71,12 +72,12 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
71
72
|
switch (status) {
|
|
72
73
|
case RouteExecutionStatus.Done: {
|
|
73
74
|
title =
|
|
74
|
-
|
|
75
|
-
? t('
|
|
76
|
-
: t(
|
|
75
|
+
subvariant === 'nft'
|
|
76
|
+
? t('success.title.purchaseSuccessful')
|
|
77
|
+
: t(`success.title.${transactionType}Successful`);
|
|
77
78
|
if (token) {
|
|
78
|
-
primaryMessage = t('
|
|
79
|
-
amount: token.amount,
|
|
79
|
+
primaryMessage = t('success.message.exchangeSuccessful', {
|
|
80
|
+
amount: formatTokenAmount(token.amount),
|
|
80
81
|
tokenSymbol: token.symbol,
|
|
81
82
|
chainName: getChainById(token.chainId)?.name,
|
|
82
83
|
walletAddress: shortenAddress(route.toAddress),
|
|
@@ -86,14 +87,14 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
86
87
|
break;
|
|
87
88
|
}
|
|
88
89
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Partial: {
|
|
89
|
-
title = t(
|
|
90
|
-
primaryMessage = t('
|
|
90
|
+
title = t(`success.title.${transactionType}PartiallySuccessful`);
|
|
91
|
+
primaryMessage = t('success.message.exchangePartiallySuccessful', {
|
|
91
92
|
tool: route.steps.at(-1)?.toolDetails.name,
|
|
92
93
|
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
93
94
|
});
|
|
94
95
|
if (token) {
|
|
95
|
-
secondaryMessage = t('
|
|
96
|
-
amount: token.amount,
|
|
96
|
+
secondaryMessage = t('success.message.exchangeSuccessful', {
|
|
97
|
+
amount: formatTokenAmount(token.amount),
|
|
97
98
|
tokenSymbol: token.symbol,
|
|
98
99
|
chainName: getChainById(token.chainId)?.name,
|
|
99
100
|
walletAddress: shortenAddress(route.toAddress),
|
|
@@ -103,14 +104,14 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
103
104
|
break;
|
|
104
105
|
}
|
|
105
106
|
case RouteExecutionStatus.Done | RouteExecutionStatus.Refunded: {
|
|
106
|
-
title = t('
|
|
107
|
-
primaryMessage = t('
|
|
107
|
+
title = t('success.title.refundIssued');
|
|
108
|
+
primaryMessage = t('success.message.exchangePartiallySuccessful', {
|
|
108
109
|
tool: route.steps.at(-1)?.toolDetails.name,
|
|
109
110
|
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
110
111
|
});
|
|
111
112
|
if (token) {
|
|
112
|
-
secondaryMessage = t('
|
|
113
|
-
amount: token.amount,
|
|
113
|
+
secondaryMessage = t('success.message.exchangeSuccessful', {
|
|
114
|
+
amount: formatTokenAmount(token.amount),
|
|
114
115
|
tokenSymbol: token.symbol,
|
|
115
116
|
chainName: getChainById(token.chainId)?.name,
|
|
116
117
|
walletAddress: shortenAddress(route.toAddress),
|
|
@@ -144,9 +145,11 @@ export const StatusBottomSheet = ({ status, route, }) => {
|
|
|
144
145
|
ref.current?.open();
|
|
145
146
|
}
|
|
146
147
|
}, [refetch, refetchNewBalance, status]);
|
|
147
|
-
const showContractComponent =
|
|
148
|
+
const showContractComponent = subvariant === 'nft' && hasEnumFlag(status, RouteExecutionStatus.Done);
|
|
148
149
|
return (_jsx(BottomSheet, { ref: ref, children: _jsxs(Box, { p: 3, children: [!showContractComponent ? (_jsx(CenterContainer, { children: _jsxs(IconCircle, { status: status, mb: 1, children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoRoundedIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
|
|
149
|
-
hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningRoundedIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorRoundedIcon, { color: "error" })) : null] }) })) : null, _jsx(CenterContainer, { children: _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent ||
|
|
150
|
+
hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningRoundedIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorRoundedIcon, { color: "error" })) : null] }) })) : null, _jsx(CenterContainer, { children: _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent ||
|
|
151
|
+
contractSecondaryComponent ||
|
|
152
|
+
contractComponent) : (_jsx(CenterContainer, { children: hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null })), !showContractComponent ? (_jsx(Typography, { py: 1, children: primaryMessage })) : null, secondaryMessage ? (_jsx(Typography, { py: 1, children: secondaryMessage })) : null, _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
|
|
150
153
|
? t('button.done')
|
|
151
154
|
: null, status === RouteExecutionStatus.Failed
|
|
152
155
|
? t('button.seeDetails')
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
|
|
3
|
+
import { Box, Button, Typography } from '@mui/material';
|
|
4
|
+
import { forwardRef, useRef } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { BottomSheet } from '../../components/BottomSheet';
|
|
7
|
+
import { useSetContentHeight } from '../../hooks';
|
|
8
|
+
import { CenterContainer, IconCircle } from './StatusBottomSheet.style';
|
|
9
|
+
import { calcValueLoss } from './utils';
|
|
10
|
+
export const TokenValueBottomSheet = forwardRef(({ route, onContinue, onCancel }, ref) => {
|
|
11
|
+
const handleCancel = () => {
|
|
12
|
+
ref.current?.close();
|
|
13
|
+
onCancel?.();
|
|
14
|
+
};
|
|
15
|
+
return (_jsx(BottomSheet, { ref: ref, onClose: onCancel, children: _jsx(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) }));
|
|
16
|
+
});
|
|
17
|
+
const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const ref = useRef();
|
|
20
|
+
useSetContentHeight(ref);
|
|
21
|
+
return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(CenterContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('warning.title.highValueLoss') })] }), _jsx(Typography, { py: 1, children: t('warning.message.highValueLoss') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('main.sending') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('main.gasCost') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('main.receiving') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('main.valueLoss') }), _jsx(Typography, { fontWeight: 600, children: calcValueLoss(route) })] }), _jsxs(Box, { display: "flex", mt: 3, children: [_jsx(Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
22
|
+
};
|
|
23
|
+
export const getTokenValueLossThreshold = (route) => {
|
|
24
|
+
if (!route) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const fromAmountUSD = Number(route.fromAmountUSD || 0);
|
|
28
|
+
const toAmountUSD = Number(route.toAmountUSD || 0);
|
|
29
|
+
const gasCostUSD = Number(route.gasCostUSD || 0);
|
|
30
|
+
if (!fromAmountUSD && !toAmountUSD) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return toAmountUSD / (fromAmountUSD + gasCostUSD) < 0.9;
|
|
34
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
3
|
+
import { Box, Button, Tooltip } from '@mui/material';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useFormContext } from 'react-hook-form';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useLocation } from 'react-router-dom';
|
|
8
|
+
import { ContractComponent } from '../../components/ContractComponent';
|
|
9
|
+
import { GasMessage } from '../../components/GasMessage';
|
|
10
|
+
import { useHeaderStore } from '../../components/Header';
|
|
11
|
+
import { Insurance } from '../../components/Insurance';
|
|
12
|
+
import { getStepList } from '../../components/Step';
|
|
13
|
+
import { useNavigateBack, useRouteExecution, useWidgetEvents, } from '../../hooks';
|
|
14
|
+
import { FormKey, useWidgetConfig } from '../../providers';
|
|
15
|
+
import { RouteExecutionStatus } from '../../stores';
|
|
16
|
+
import { WidgetEvent } from '../../types/events';
|
|
17
|
+
import { formatTokenAmount } from '../../utils';
|
|
18
|
+
import { ExchangeRateBottomSheet } from './ExchangeRateBottomSheet';
|
|
19
|
+
import { StartInsurableTransactionButton, StartTransactionButton, } from './StartTransactionButton';
|
|
20
|
+
import { StatusBottomSheet } from './StatusBottomSheet';
|
|
21
|
+
import { TokenValueBottomSheet, getTokenValueLossThreshold, } from './TokenValueBottomSheet';
|
|
22
|
+
import { Container } from './TransactionPage.style';
|
|
23
|
+
import { calcValueLoss } from './utils';
|
|
24
|
+
export const TransactionPage = () => {
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const { setValue } = useFormContext();
|
|
27
|
+
const emitter = useWidgetEvents();
|
|
28
|
+
const { navigateBack } = useNavigateBack();
|
|
29
|
+
const { subvariant, insurance, contractComponent, contractSecondaryComponent, } = useWidgetConfig();
|
|
30
|
+
const { state } = useLocation();
|
|
31
|
+
const stateRouteId = state?.routeId;
|
|
32
|
+
const [routeId, setRouteId] = useState(stateRouteId);
|
|
33
|
+
const tokenValueBottomSheetRef = useRef(null);
|
|
34
|
+
const exchangeRateBottomSheetRef = useRef(null);
|
|
35
|
+
const onAcceptExchangeRateUpdate = (resolver, data) => {
|
|
36
|
+
exchangeRateBottomSheetRef.current?.open(resolver, data);
|
|
37
|
+
};
|
|
38
|
+
const { route, status, executeRoute, restartRoute, deleteRoute } = useRouteExecution({
|
|
39
|
+
routeId: routeId,
|
|
40
|
+
onAcceptExchangeRateUpdate,
|
|
41
|
+
});
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (route && subvariant !== 'nft') {
|
|
44
|
+
const transactionType = route.fromChainId === route.toChainId ? 'Swap' : 'Bridge';
|
|
45
|
+
return useHeaderStore
|
|
46
|
+
.getState()
|
|
47
|
+
.setTitle(status === RouteExecutionStatus.Idle
|
|
48
|
+
? t(`button.review${transactionType}`)
|
|
49
|
+
: t(`header.${transactionType.toLowerCase()}`));
|
|
50
|
+
}
|
|
51
|
+
}, [route, status, subvariant, t]);
|
|
52
|
+
if (!route) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const tokenValueLossThresholdExceeded = getTokenValueLossThreshold(route);
|
|
56
|
+
const handleExecuteRoute = () => {
|
|
57
|
+
if (tokenValueBottomSheetRef.current?.isOpen()) {
|
|
58
|
+
emitter.emit(WidgetEvent.RouteHighValueLoss, {
|
|
59
|
+
fromAmountUsd: route.fromAmountUSD,
|
|
60
|
+
gasCostUSD: route.gasCostUSD,
|
|
61
|
+
toAmountUSD: route.toAmountUSD,
|
|
62
|
+
valueLoss: calcValueLoss(route),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
tokenValueBottomSheetRef.current?.close();
|
|
66
|
+
executeRoute();
|
|
67
|
+
setValue(FormKey.FromAmount, '');
|
|
68
|
+
};
|
|
69
|
+
const handleStartClick = async () => {
|
|
70
|
+
if (status === RouteExecutionStatus.Idle) {
|
|
71
|
+
if (tokenValueLossThresholdExceeded && subvariant !== 'nft') {
|
|
72
|
+
tokenValueBottomSheetRef.current?.open();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
handleExecuteRoute();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (status === RouteExecutionStatus.Failed) {
|
|
79
|
+
restartRoute();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const handleRemoveRoute = () => {
|
|
83
|
+
navigateBack();
|
|
84
|
+
deleteRoute();
|
|
85
|
+
};
|
|
86
|
+
const getButtonText = () => {
|
|
87
|
+
switch (status) {
|
|
88
|
+
case RouteExecutionStatus.Idle:
|
|
89
|
+
switch (subvariant) {
|
|
90
|
+
case 'nft':
|
|
91
|
+
return t('button.buyNow');
|
|
92
|
+
case 'refuel':
|
|
93
|
+
return t('button.startBridging');
|
|
94
|
+
default:
|
|
95
|
+
const transactionType = route.fromChainId === route.toChainId ? 'Swapping' : 'Bridging';
|
|
96
|
+
return t(`button.start${transactionType}`);
|
|
97
|
+
}
|
|
98
|
+
case RouteExecutionStatus.Failed:
|
|
99
|
+
return t('button.tryAgain');
|
|
100
|
+
default:
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const insuredRoute = route.insurance?.state === 'INSURED';
|
|
105
|
+
const insurableRoute = insurance &&
|
|
106
|
+
subvariant !== 'refuel' &&
|
|
107
|
+
status === RouteExecutionStatus.Idle &&
|
|
108
|
+
route.insurance?.state === 'INSURABLE';
|
|
109
|
+
const insuranceAvailable = insuredRoute || insurableRoute;
|
|
110
|
+
const StartButton = insurableRoute
|
|
111
|
+
? StartInsurableTransactionButton
|
|
112
|
+
: StartTransactionButton;
|
|
113
|
+
const getInsuranceCoverageId = () => route.steps[0].execution?.process
|
|
114
|
+
.filter((process) => process.type !== 'TOKEN_ALLOWANCE')
|
|
115
|
+
.find((process) => process.txHash)?.txHash ?? route.fromAddress;
|
|
116
|
+
return (_jsxs(Container, { children: [getStepList(route), subvariant === 'nft' ? (_jsx(ContractComponent, { mt: 2, children: contractSecondaryComponent || contractComponent })) : null, insuranceAvailable ? (_jsx(Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route.insurance.feeAmountUsd, insuredAmount: formatTokenAmount(route.toAmountMin, route.toToken.decimals), insuredTokenSymbol: route.toToken.symbol, insuranceCoverageId: getInsuranceCoverageId(), onChange: setRouteId })) : null, status === RouteExecutionStatus.Idle ||
|
|
117
|
+
status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasMessage, { mt: 2, route: route }), _jsxs(Box, { mt: 2, display: "flex", children: [_jsx(StartButton, { text: getButtonText(), onClick: handleStartClick, route: route, insurableRouteId: stateRouteId }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeTransaction'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
|
|
118
|
+
minWidth: 48,
|
|
119
|
+
marginLeft: 1,
|
|
120
|
+
}, children: _jsx(DeleteIcon, {}) }) })) : null] })] })) : null, status ? _jsx(StatusBottomSheet, { status: status, route: route }) : null, tokenValueLossThresholdExceeded && subvariant !== 'nft' ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, _jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })] }));
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionPage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionPage';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Route } from '@lifi/sdk';
|
|
2
|
+
import type { DefaultTransactionButtonProps } from '../../components/DefaultTransactionButton';
|
|
3
|
+
export interface StartTransactionButtonProps extends DefaultTransactionButtonProps {
|
|
4
|
+
route?: Route;
|
|
5
|
+
insurableRouteId: string;
|
|
6
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
3
|
+
import { FormProvider as ReactHookFormProvider, useForm, } from 'react-hook-form';
|
|
4
4
|
import { useWidgetConfig } from '../WidgetProvider';
|
|
5
5
|
import { FormUpdater } from './FormUpdater';
|
|
6
|
-
import {
|
|
6
|
+
import { FormKey } from './types';
|
|
7
7
|
export const formDefaultValues = {
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
8
|
+
[FormKey.FromAmount]: '',
|
|
9
|
+
[FormKey.ToAddress]: '',
|
|
10
|
+
[FormKey.TokenSearchFilter]: '',
|
|
11
|
+
[FormKey.ContractOutputsToken]: '',
|
|
12
|
+
[FormKey.ToContractAddress]: '',
|
|
13
|
+
[FormKey.ToContractCallData]: '',
|
|
14
|
+
[FormKey.ToContractGasLimit]: '',
|
|
15
|
+
[FormKey.ToAmount]: '',
|
|
16
16
|
};
|
|
17
|
-
export const
|
|
17
|
+
export const FormProvider = ({ children, }) => {
|
|
18
18
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = useWidgetConfig();
|
|
19
19
|
const defaultValues = useMemo(() => ({
|
|
20
20
|
...formDefaultValues,
|
|
@@ -31,5 +31,5 @@ export const SwapFormProvider = ({ children, }) => {
|
|
|
31
31
|
// values,
|
|
32
32
|
defaultValues,
|
|
33
33
|
});
|
|
34
|
-
return (_jsxs(
|
|
34
|
+
return (_jsxs(ReactHookFormProvider, { ...methods, children: [_jsx(FormUpdater, { defaultValues: defaultValues }), children] }));
|
|
35
35
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { useFormContext } from 'react-hook-form';
|
|
4
|
-
import {
|
|
4
|
+
import { FormKey } from '.';
|
|
5
5
|
import { useWallet } from '../WalletProvider';
|
|
6
6
|
import { isItemAllowed, useWidgetConfig } from '../WidgetProvider';
|
|
7
7
|
export const FormUpdater = ({ defaultValues }) => {
|
|
@@ -17,23 +17,23 @@ export const FormUpdater = ({ defaultValues }) => {
|
|
|
17
17
|
if (!account.isActive || !account.chainId || !chainAllowed) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const { isTouched: isFromChainTouched } = getFieldState(
|
|
21
|
-
const { isTouched: isToChainTouched } = getFieldState(
|
|
22
|
-
const { isTouched: isFromTokenTouched } = getFieldState(
|
|
23
|
-
const { isTouched: isToTokenTouched } = getFieldState(
|
|
24
|
-
const { isTouched: isFromAmountTouched } = getFieldState(
|
|
20
|
+
const { isTouched: isFromChainTouched } = getFieldState(FormKey.FromChain);
|
|
21
|
+
const { isTouched: isToChainTouched } = getFieldState(FormKey.ToChain);
|
|
22
|
+
const { isTouched: isFromTokenTouched } = getFieldState(FormKey.FromToken);
|
|
23
|
+
const { isTouched: isToTokenTouched } = getFieldState(FormKey.ToToken);
|
|
24
|
+
const { isTouched: isFromAmountTouched } = getFieldState(FormKey.FromAmount);
|
|
25
25
|
if (!fromChain && !isFromChainTouched && !isFromTokenTouched) {
|
|
26
|
-
resetField(
|
|
27
|
-
setValue(
|
|
28
|
-
setValue(
|
|
26
|
+
resetField(FormKey.FromChain, { defaultValue: account.chainId });
|
|
27
|
+
setValue(FormKey.FromChain, account.chainId);
|
|
28
|
+
setValue(FormKey.FromToken, '');
|
|
29
29
|
if (isFromAmountTouched) {
|
|
30
|
-
setValue(
|
|
30
|
+
setValue(FormKey.FromAmount, '');
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
if (!toChain && !isToChainTouched && !isToTokenTouched) {
|
|
34
|
-
resetField(
|
|
35
|
-
setValue(
|
|
36
|
-
setValue(
|
|
34
|
+
resetField(FormKey.ToChain, { defaultValue: account.chainId });
|
|
35
|
+
setValue(FormKey.ToChain, account.chainId);
|
|
36
|
+
setValue(FormKey.ToToken, '');
|
|
37
37
|
}
|
|
38
38
|
}, [
|
|
39
39
|
account.chainId,
|
|
@@ -53,7 +53,7 @@ export const FormUpdater = ({ defaultValues }) => {
|
|
|
53
53
|
if (previousDefaultValues.current[key] !== defaultValues[key]) {
|
|
54
54
|
const value = defaultValues[key] ||
|
|
55
55
|
// set the chain to the current user one if it is not present in the config
|
|
56
|
-
(key ===
|
|
56
|
+
(key === FormKey.FromChain || key === FormKey.ToChain
|
|
57
57
|
? account.chainId || ''
|
|
58
58
|
: '');
|
|
59
59
|
setValue(key, value);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useFormState, useWatch } from 'react-hook-form';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import { FormKey } from './types';
|
|
5
5
|
const formValueKeys = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
FormKey.FromAmount,
|
|
7
|
+
FormKey.FromChain,
|
|
8
|
+
FormKey.FromToken,
|
|
9
|
+
FormKey.ToAddress,
|
|
10
|
+
FormKey.ToChain,
|
|
11
|
+
FormKey.ToToken,
|
|
12
12
|
];
|
|
13
13
|
export const URLSearchParamsBuilder = () => {
|
|
14
14
|
const { pathname } = useLocation();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum FormKey {
|
|
2
|
+
ContractOutputsToken = "contractOutputsToken",
|
|
3
|
+
FromAmount = "fromAmount",
|
|
4
|
+
FromChain = "fromChain",
|
|
5
|
+
FromToken = "fromToken",
|
|
6
|
+
ToAddress = "toAddress",
|
|
7
|
+
ToAmount = "toAmount",
|
|
8
|
+
ToChain = "toChain",
|
|
9
|
+
ToContractAddress = "toContractAddress",
|
|
10
|
+
ToContractCallData = "toContractCallData",
|
|
11
|
+
ToContractGasLimit = "ToContractGasLimit",
|
|
12
|
+
ToToken = "toToken",
|
|
13
|
+
TokenSearchFilter = "tokenSearchFilter"
|
|
14
|
+
}
|
|
15
|
+
export type FormValues = {
|
|
16
|
+
[FormKey.ContractOutputsToken]: string;
|
|
17
|
+
[FormKey.FromAmount]: string;
|
|
18
|
+
[FormKey.FromChain]: number;
|
|
19
|
+
[FormKey.FromToken]: string;
|
|
20
|
+
[FormKey.ToAddress]: string;
|
|
21
|
+
[FormKey.ToAmount]: string;
|
|
22
|
+
[FormKey.ToChain]: number;
|
|
23
|
+
[FormKey.ToContractAddress]: string;
|
|
24
|
+
[FormKey.ToContractCallData]: string;
|
|
25
|
+
[FormKey.ToContractGasLimit]: string;
|
|
26
|
+
[FormKey.ToToken]: string;
|
|
27
|
+
[FormKey.TokenSearchFilter]: string;
|
|
28
|
+
};
|
|
29
|
+
export type FormType = 'from' | 'to';
|
|
30
|
+
export declare const FormKeyHelper: {
|
|
31
|
+
getChainKey: (formType: FormType) => 'fromChain' | 'toChain';
|
|
32
|
+
getTokenKey: (formType: FormType) => 'fromToken' | 'toToken';
|
|
33
|
+
getAmountKey: (formType: FormType) => 'fromAmount' | 'toAmount';
|
|
34
|
+
};
|
|
35
|
+
export interface FormTypeProps {
|
|
36
|
+
formType: FormType;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var FormKey;
|
|
2
|
+
(function (FormKey) {
|
|
3
|
+
FormKey["ContractOutputsToken"] = "contractOutputsToken";
|
|
4
|
+
FormKey["FromAmount"] = "fromAmount";
|
|
5
|
+
FormKey["FromChain"] = "fromChain";
|
|
6
|
+
FormKey["FromToken"] = "fromToken";
|
|
7
|
+
FormKey["ToAddress"] = "toAddress";
|
|
8
|
+
FormKey["ToAmount"] = "toAmount";
|
|
9
|
+
FormKey["ToChain"] = "toChain";
|
|
10
|
+
FormKey["ToContractAddress"] = "toContractAddress";
|
|
11
|
+
FormKey["ToContractCallData"] = "toContractCallData";
|
|
12
|
+
FormKey["ToContractGasLimit"] = "ToContractGasLimit";
|
|
13
|
+
FormKey["ToToken"] = "toToken";
|
|
14
|
+
FormKey["TokenSearchFilter"] = "tokenSearchFilter";
|
|
15
|
+
})(FormKey || (FormKey = {}));
|
|
16
|
+
export const FormKeyHelper = {
|
|
17
|
+
getChainKey: (formType) => `${formType}Chain`,
|
|
18
|
+
getTokenKey: (formType) => `${formType}Token`,
|
|
19
|
+
getAmountKey: (formType) => `${formType}Amount`,
|
|
20
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LiFi } from '@lifi/sdk';
|
|
3
3
|
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
+
import { version } from '../../config/version';
|
|
4
5
|
import { useWidgetConfig } from '../WidgetProvider';
|
|
5
6
|
let lifi;
|
|
6
7
|
const SDKContext = createContext(null);
|
|
@@ -23,6 +24,7 @@ export const SDKProvider = ({ children, }) => {
|
|
|
23
24
|
if (!lifi) {
|
|
24
25
|
lifi = new LiFi({
|
|
25
26
|
disableVersionCheck: true,
|
|
27
|
+
widgetVersion: version,
|
|
26
28
|
...config,
|
|
27
29
|
});
|
|
28
30
|
}
|