@lifi/widget 2.0.0-beta.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +2 -2
- package/AppDrawer.d.ts +3 -2
- package/AppDrawer.js +7 -3
- package/AppDrawer.style.d.ts +2 -2
- package/AppDrawer.style.js +5 -0
- package/AppProvider.js +4 -4
- package/AppRoutes.js +16 -16
- package/cjs/App.js +2 -2
- package/cjs/AppDrawer.d.ts +3 -2
- package/cjs/AppDrawer.js +7 -3
- package/cjs/AppDrawer.style.d.ts +2 -2
- package/cjs/AppDrawer.style.js +5 -0
- package/cjs/AppProvider.js +3 -3
- package/cjs/AppRoutes.js +16 -16
- package/cjs/components/{ActiveSwaps/ActiveSwapItem.d.ts → ActiveTransactions/ActiveTransactionItem.d.ts} +1 -1
- package/cjs/components/{ActiveSwaps/ActiveSwapItem.js → ActiveTransactions/ActiveTransactionItem.js} +6 -6
- package/cjs/{pages/SwapRoutesPage/SwapRoutesPage.d.ts → components/ActiveTransactions/ActiveTransactions.d.ts} +1 -1
- package/cjs/components/{ActiveSwaps/ActiveSwaps.js → ActiveTransactions/ActiveTransactions.js} +7 -7
- package/cjs/components/{ActiveSwaps/ActiveSwaps.style.d.ts → ActiveTransactions/ActiveTransactions.style.d.ts} +4 -4
- package/cjs/components/ActiveTransactions/index.d.ts +2 -0
- package/cjs/components/{ActiveSwaps → ActiveTransactions}/index.js +2 -2
- package/cjs/components/AmountInput/AmountInput.d.ts +12 -0
- package/cjs/components/AmountInput/AmountInput.js +57 -0
- package/{components/SwapInput/SwapInput.style.d.ts → cjs/components/AmountInput/AmountInput.style.d.ts} +1 -1
- package/{components/SwapInput/SwapInputAdornment.style.d.ts → cjs/components/AmountInput/AmountInputAdornment.style.d.ts} +2 -2
- package/cjs/components/AmountInput/AmountInputEndAdornment.d.ts +2 -0
- package/cjs/components/{SwapInput/SwapInputEndAdornment.js → AmountInput/AmountInputEndAdornment.js} +9 -9
- package/cjs/components/AmountInput/AmountInputStartAdornment.d.ts +3 -0
- package/cjs/components/{SwapInput/SwapInputStartAdornment.js → AmountInput/AmountInputStartAdornment.js} +5 -5
- package/cjs/components/AmountInput/FormPriceHelperText.d.ts +9 -0
- package/cjs/components/{SwapInput → AmountInput}/FormPriceHelperText.js +15 -9
- package/cjs/components/AmountInput/index.d.ts +1 -0
- package/cjs/{pages/SwapPage → components/AmountInput}/index.js +1 -1
- package/cjs/components/Card/CardIconButton.d.ts +2 -2
- package/cjs/components/Card/CardLabel.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +2 -2
- package/cjs/components/ChainSelect/ChainSelect.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +5 -5
- package/cjs/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/cjs/components/ContractComponent/ContractComponent.js +3 -5
- package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +3 -0
- package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.js +36 -0
- package/cjs/components/DefaultTransactionButton/index.d.ts +2 -0
- package/cjs/components/{SwapButton → DefaultTransactionButton}/index.js +3 -3
- package/cjs/components/{SwapButton → DefaultTransactionButton}/types.d.ts +1 -2
- package/cjs/components/GasMessage/FundsSufficiencyMessage.js +1 -1
- package/cjs/components/GasMessage/GasRefuelMessage.js +1 -1
- package/cjs/components/GasMessage/GasSufficiencyMessage.js +2 -2
- package/cjs/components/Header/Header.style.d.ts +2 -2
- package/cjs/components/Header/NavigationHeader.js +19 -19
- package/cjs/components/Header/NavigationTabs.js +3 -3
- package/cjs/components/Header/NavigationTabs.style.js +3 -3
- package/cjs/components/Header/index.d.ts +1 -1
- package/cjs/components/Header/index.js +1 -1
- package/cjs/components/Header/types.d.ts +5 -2
- package/cjs/components/Header/useHeaderStore.d.ts +2 -0
- package/cjs/components/Header/{useHeaderActionStore.js → useHeaderStore.js} +13 -2
- package/cjs/components/Insurance/Insurance.js +2 -2
- package/cjs/components/Insurance/InsuranceCard.js +10 -7
- package/cjs/components/Insurance/InsuranceCollapsed.js +7 -3
- package/cjs/components/Insurance/index.d.ts +1 -0
- package/cjs/components/Insurance/index.js +1 -0
- package/cjs/components/Insurance/types.d.ts +11 -7
- package/cjs/components/ListItemButton.d.ts +1 -1
- package/cjs/components/NFT/NFT.d.ts +1 -2
- package/cjs/components/NFT/NFT.js +15 -13
- package/cjs/components/NFT/NFT.style.d.ts +1 -1
- package/cjs/components/NFT/NFTBase.d.ts +3 -0
- package/cjs/components/NFT/NFTBase.js +13 -0
- package/cjs/components/NFT/index.d.ts +1 -0
- package/cjs/components/NFT/index.js +1 -0
- package/cjs/components/NFT/types.d.ts +3 -1
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +3 -3
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +9 -9
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/cjs/components/RouteCard/RouteCard.d.ts +4 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCard.js → RouteCard/RouteCard.js} +16 -12
- package/cjs/components/RouteCard/RouteCardEssentials.d.ts +3 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCardEssentials.js → RouteCard/RouteCardEssentials.js} +7 -7
- package/cjs/components/RouteCard/RouteCardSkeleton.d.ts +4 -0
- package/cjs/components/{SwapRouteCard/SwapRouteCardSkeleton.js → RouteCard/RouteCardSkeleton.js} +6 -6
- package/cjs/components/RouteCard/RouteNotFoundCard.d.ts +2 -0
- package/cjs/components/{SwapRouteCard/SwapRouteNotFoundCard.js → RouteCard/RouteNotFoundCard.js} +4 -4
- package/cjs/components/RouteCard/index.d.ts +3 -0
- package/cjs/components/{SwapRoutes → RouteCard}/index.js +3 -2
- package/cjs/components/{SwapRouteCard → RouteCard}/types.d.ts +3 -3
- package/cjs/components/{SwapRoutes/SwapRoutes.d.ts → Routes/Routes.d.ts} +1 -1
- package/cjs/components/Routes/Routes.js +37 -0
- package/cjs/components/Routes/RoutesExpanded.d.ts +2 -0
- package/cjs/components/Routes/RoutesExpanded.js +44 -0
- package/cjs/components/Routes/index.d.ts +2 -0
- package/cjs/components/Routes/index.js +18 -0
- package/cjs/components/SelectChainAndToken.js +7 -7
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +2 -2
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +11 -11
- package/cjs/components/SendToWallet/SendToWallet.js +9 -10
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
- package/cjs/components/SmallAvatar.d.ts +1 -1
- package/cjs/components/Step/DestinationWalletAddress.js +2 -2
- package/cjs/components/Step/GasStepProcess.js +1 -1
- package/cjs/components/Step/Step.js +13 -13
- package/cjs/components/Step/StepTimer.js +2 -2
- package/cjs/components/StepActions/StepActions.d.ts +3 -3
- package/cjs/components/StepActions/StepActions.js +20 -16
- package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
- package/cjs/components/StepActions/types.d.ts +2 -2
- package/cjs/components/Token/Token.js +1 -1
- package/cjs/components/TokenList/TokenList.js +2 -2
- package/cjs/components/TokenList/TokenList.style.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.style.js +11 -8
- package/cjs/components/TokenList/TokenListItem.js +5 -9
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -2
- package/cjs/components/TokenList/TokenNotFound.js +2 -2
- package/cjs/components/TokenList/VirtualizedTokenList.js +2 -2
- package/cjs/components/TokenList/types.d.ts +2 -2
- package/cjs/components/TokenList/useTokenSelect.d.ts +2 -2
- package/cjs/components/TokenList/useTokenSelect.js +11 -9
- package/cjs/config/theme.js +1 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +1 -1
- package/cjs/hooks/index.js +1 -1
- package/cjs/hooks/useChains.js +4 -4
- package/cjs/hooks/useFundsSufficiency.js +1 -5
- package/cjs/hooks/useGasRecommendation.d.ts +1 -1
- package/cjs/hooks/useGasRecommendation.js +5 -0
- package/cjs/hooks/useGasRefuel.js +4 -4
- package/cjs/hooks/useProcessMessage.d.ts +2 -2
- package/cjs/hooks/useProcessMessage.js +46 -46
- package/cjs/hooks/useRouteExecution.js +3 -4
- package/cjs/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -2
- package/cjs/hooks/{useSwapRoutes.js → useRoutes.js} +24 -24
- package/cjs/hooks/useTokenBalance.js +4 -5
- package/cjs/hooks/useTokenBalances.js +1 -5
- package/cjs/hooks/useTokens.js +21 -9
- package/cjs/i18n/bn.json +80 -80
- package/cjs/i18n/de.json +74 -74
- package/cjs/i18n/en.json +132 -131
- package/cjs/i18n/es.json +72 -72
- package/cjs/i18n/fr.json +102 -85
- package/cjs/i18n/id.json +102 -85
- package/cjs/i18n/it.json +112 -84
- package/cjs/i18n/ko.json +102 -85
- package/cjs/i18n/pt.json +89 -87
- package/cjs/i18n/th.json +102 -85
- package/cjs/i18n/tr.json +72 -72
- package/cjs/i18n/uk.json +98 -96
- package/cjs/i18n/vi.json +104 -79
- package/cjs/i18n/zh.json +104 -87
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +5 -1
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsEmpty.d.ts +2 -0
- package/cjs/pages/{ActiveSwapsPage/ActiveSwapsEmpty.js → ActiveTransactionsPage/ActiveTransactionsEmpty.js} +4 -4
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.d.ts +1 -0
- package/cjs/pages/{ActiveSwapsPage/ActiveSwapsPage.js → ActiveTransactionsPage/ActiveTransactionsPage.js} +8 -8
- package/cjs/pages/ActiveTransactionsPage/index.d.ts +1 -0
- package/cjs/pages/{ActiveSwapsPage → ActiveTransactionsPage}/index.js +1 -1
- package/cjs/pages/MainPage/MainGasMessage.js +1 -1
- package/cjs/pages/MainPage/MainPage.js +7 -7
- package/cjs/pages/MainPage/ReviewButton.d.ts +2 -0
- package/cjs/pages/MainPage/ReviewButton.js +62 -0
- package/{components/SwapRoutes/SwapRoutes.d.ts → cjs/pages/RoutesPage/RoutesPage.d.ts} +1 -1
- package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.js → RoutesPage/RoutesPage.js} +11 -11
- package/cjs/pages/RoutesPage/index.d.ts +1 -0
- package/cjs/{components/SwapInput → pages/RoutesPage}/index.js +1 -1
- package/cjs/pages/SelectChainPage/types.d.ts +2 -2
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +1 -1
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +2 -2
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -2
- package/cjs/pages/SelectTokenPage/types.js +1 -1
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/cjs/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
- package/cjs/pages/SettingsPage/ResetSettingsButton.js +1 -1
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsPage.d.ts +2 -0
- package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.js → TransactionDetailsPage/TransactionDetailsPage.js} +10 -9
- package/cjs/pages/TransactionDetailsPage/index.d.ts +1 -0
- package/cjs/pages/{SwapDetailsPage → TransactionDetailsPage}/index.js +1 -1
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryEmpty.d.ts +2 -0
- package/cjs/pages/{SwapHistoryPage/SwapHistoryEmpty.js → TransactionHistoryPage/TransactionHistoryEmpty.js} +4 -4
- package/cjs/pages/{SwapHistoryPage/SwapHistoryItem.d.ts → TransactionHistoryPage/TransactionHistoryItem.d.ts} +1 -1
- package/cjs/pages/{SwapHistoryPage/SwapHistoryItem.js → TransactionHistoryPage/TransactionHistoryItem.js} +4 -4
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +2 -0
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.js +35 -0
- package/cjs/pages/TransactionHistoryPage/index.d.ts +1 -0
- package/cjs/pages/TransactionHistoryPage/index.js +17 -0
- package/cjs/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.js +3 -3
- package/cjs/pages/TransactionPage/StartTransactionButton.d.ts +4 -0
- package/cjs/pages/TransactionPage/StartTransactionButton.js +21 -0
- package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.js +27 -24
- package/cjs/pages/TransactionPage/TokenValueBottomSheet.js +38 -0
- package/cjs/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/cjs/pages/TransactionPage/TransactionPage.js +125 -0
- package/cjs/pages/TransactionPage/index.d.ts +1 -0
- package/cjs/pages/{SwapHistoryPage → TransactionPage}/index.js +1 -1
- package/cjs/pages/TransactionPage/types.d.ts +6 -0
- package/cjs/pages/TransactionPage/utils.d.ts +2 -0
- package/cjs/pages/TransactionPage/utils.js +10 -0
- package/cjs/providers/{SwapFormProvider/SwapFormProvider.d.ts → FormProvider/FormProvider.d.ts} +1 -1
- package/cjs/providers/{SwapFormProvider/SwapFormProvider.js → FormProvider/FormProvider.js} +11 -11
- package/cjs/providers/FormProvider/FormUpdater.d.ts +5 -0
- package/cjs/providers/{SwapFormProvider → FormProvider}/FormUpdater.js +14 -14
- package/cjs/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.js +6 -6
- package/cjs/providers/{SwapFormProvider → FormProvider}/index.d.ts +1 -1
- package/cjs/providers/{SwapFormProvider → FormProvider}/index.js +1 -1
- package/cjs/providers/FormProvider/types.d.ts +37 -0
- package/cjs/providers/FormProvider/types.js +23 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +5 -3
- package/cjs/providers/WalletProvider/types.d.ts +1 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/cjs/providers/index.d.ts +1 -1
- package/cjs/providers/index.js +1 -1
- package/cjs/stores/routes/createRouteExecutionStore.js +1 -1
- package/cjs/stores/routes/index.d.ts +1 -1
- package/cjs/stores/routes/index.js +1 -1
- package/cjs/stores/routes/types.js +1 -1
- package/cjs/stores/routes/useTransactionHistory.d.ts +2 -0
- package/cjs/stores/routes/{useSwapHistory.js → useTransactionHistory.js} +3 -3
- package/cjs/types/events.d.ts +9 -1
- package/cjs/types/events.js +2 -1
- package/cjs/types/widget.d.ts +6 -4
- package/cjs/types/widget.js +3 -3
- package/cjs/utils/elements.js +1 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +13 -15
- package/cjs/utils/navigationRoutes.d.ts +5 -5
- package/cjs/utils/navigationRoutes.js +15 -15
- package/components/{ActiveSwaps/ActiveSwapItem.d.ts → ActiveTransactions/ActiveTransactionItem.d.ts} +1 -1
- package/components/{ActiveSwaps/ActiveSwapItem.js → ActiveTransactions/ActiveTransactionItem.js} +3 -3
- package/components/ActiveTransactions/ActiveTransactions.d.ts +3 -0
- package/components/{ActiveSwaps/ActiveSwaps.js → ActiveTransactions/ActiveTransactions.js} +5 -5
- package/components/{ActiveSwaps/ActiveSwaps.style.d.ts → ActiveTransactions/ActiveTransactions.style.d.ts} +4 -4
- package/components/ActiveTransactions/index.d.ts +2 -0
- package/components/ActiveTransactions/index.js +2 -0
- package/components/AmountInput/AmountInput.d.ts +12 -0
- package/components/AmountInput/AmountInput.js +52 -0
- package/{cjs/components/SwapInput/SwapInput.style.d.ts → components/AmountInput/AmountInput.style.d.ts} +1 -1
- package/{cjs/components/SwapInput/SwapInputAdornment.style.d.ts → components/AmountInput/AmountInputAdornment.style.d.ts} +2 -2
- package/components/AmountInput/AmountInputEndAdornment.d.ts +2 -0
- package/components/{SwapInput/SwapInputEndAdornment.js → AmountInput/AmountInputEndAdornment.js} +7 -7
- package/components/AmountInput/AmountInputStartAdornment.d.ts +3 -0
- package/components/{SwapInput/SwapInputStartAdornment.js → AmountInput/AmountInputStartAdornment.js} +4 -4
- package/components/AmountInput/FormPriceHelperText.d.ts +9 -0
- package/components/{SwapInput → AmountInput}/FormPriceHelperText.js +14 -9
- package/components/AmountInput/index.d.ts +1 -0
- package/components/AmountInput/index.js +1 -0
- package/components/Card/CardIconButton.d.ts +2 -2
- package/components/Card/CardLabel.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.d.ts +2 -2
- package/components/ChainSelect/ChainSelect.js +2 -2
- package/components/ChainSelect/useChainSelect.d.ts +2 -2
- package/components/ChainSelect/useChainSelect.js +6 -6
- package/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/components/ContractComponent/ContractComponent.js +3 -5
- package/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +3 -0
- package/components/DefaultTransactionButton/DefaultTransactionButton.js +32 -0
- package/components/DefaultTransactionButton/index.d.ts +2 -0
- package/components/DefaultTransactionButton/index.js +2 -0
- package/components/{SwapButton → DefaultTransactionButton}/types.d.ts +1 -2
- package/components/GasMessage/FundsSufficiencyMessage.js +1 -1
- package/components/GasMessage/GasRefuelMessage.js +1 -1
- package/components/GasMessage/GasSufficiencyMessage.js +2 -2
- package/components/Header/Header.style.d.ts +2 -2
- package/components/Header/NavigationHeader.js +19 -19
- package/components/Header/NavigationTabs.js +4 -4
- package/components/Header/NavigationTabs.style.js +3 -3
- package/components/Header/index.d.ts +1 -1
- package/components/Header/index.js +1 -1
- package/components/Header/types.d.ts +5 -2
- package/components/Header/useHeaderStore.d.ts +2 -0
- package/components/Header/useHeaderStore.js +25 -0
- package/components/Insurance/Insurance.js +2 -2
- package/components/Insurance/InsuranceCard.js +11 -8
- package/components/Insurance/InsuranceCollapsed.js +8 -4
- package/components/Insurance/index.d.ts +1 -0
- package/components/Insurance/index.js +1 -0
- package/components/Insurance/types.d.ts +11 -7
- package/components/ListItemButton.d.ts +1 -1
- package/components/NFT/NFT.d.ts +1 -2
- package/components/NFT/NFT.js +17 -15
- package/components/NFT/NFT.style.d.ts +1 -1
- package/components/NFT/NFTBase.d.ts +3 -0
- package/components/NFT/NFTBase.js +9 -0
- package/components/NFT/index.d.ts +1 -0
- package/components/NFT/index.js +1 -0
- package/components/NFT/types.d.ts +3 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +4 -4
- package/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +2 -2
- package/components/RouteCard/RouteCard.d.ts +4 -0
- package/components/{SwapRouteCard/SwapRouteCard.js → RouteCard/RouteCard.js} +15 -11
- package/components/RouteCard/RouteCardEssentials.d.ts +3 -0
- package/components/{SwapRouteCard/SwapRouteCardEssentials.js → RouteCard/RouteCardEssentials.js} +3 -3
- package/components/RouteCard/RouteCardSkeleton.d.ts +4 -0
- package/components/{SwapRouteCard/SwapRouteCardSkeleton.js → RouteCard/RouteCardSkeleton.js} +4 -4
- package/components/RouteCard/RouteNotFoundCard.d.ts +2 -0
- package/components/{SwapRouteCard/SwapRouteNotFoundCard.js → RouteCard/RouteNotFoundCard.js} +2 -2
- package/components/RouteCard/index.d.ts +3 -0
- package/components/RouteCard/index.js +3 -0
- package/components/{SwapRouteCard → RouteCard}/types.d.ts +3 -3
- package/{cjs/components/ActiveSwaps/ActiveSwaps.d.ts → components/Routes/Routes.d.ts} +1 -1
- package/components/Routes/Routes.js +33 -0
- package/components/Routes/RoutesExpanded.d.ts +2 -0
- package/components/{SwapRoutes/SwapRoutesExpanded.js → Routes/RoutesExpanded.js} +12 -10
- package/components/Routes/index.d.ts +2 -0
- package/components/Routes/index.js +2 -0
- package/components/SelectChainAndToken.js +8 -8
- package/components/SelectTokenButton/SelectTokenButton.d.ts +2 -2
- package/components/SelectTokenButton/SelectTokenButton.js +12 -12
- package/components/SendToWallet/SendToWallet.js +10 -11
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +3 -3
- package/components/SmallAvatar.d.ts +1 -1
- package/components/Step/DestinationWalletAddress.js +2 -2
- package/components/Step/GasStepProcess.js +1 -1
- package/components/Step/Step.js +13 -13
- package/components/Step/StepTimer.js +2 -2
- package/components/StepActions/StepActions.d.ts +3 -3
- package/components/StepActions/StepActions.js +20 -16
- package/components/StepActions/StepActions.style.d.ts +1 -1
- package/components/StepActions/types.d.ts +2 -2
- package/components/Token/Token.js +1 -1
- package/components/TokenList/TokenList.js +3 -3
- package/components/TokenList/TokenList.style.d.ts +4 -4
- package/components/TokenList/TokenList.style.js +11 -8
- package/components/TokenList/TokenListItem.js +7 -11
- package/components/TokenList/TokenNotFound.d.ts +2 -2
- package/components/TokenList/TokenNotFound.js +3 -3
- package/components/TokenList/VirtualizedTokenList.js +2 -2
- package/components/TokenList/types.d.ts +2 -2
- package/components/TokenList/useTokenSelect.d.ts +2 -2
- package/components/TokenList/useTokenSelect.js +12 -10
- package/config/theme.js +1 -2
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useChains.js +5 -5
- package/hooks/useFundsSufficiency.js +2 -6
- package/hooks/useGasRecommendation.d.ts +1 -1
- package/hooks/useGasRecommendation.js +5 -0
- package/hooks/useGasRefuel.js +5 -5
- package/hooks/useProcessMessage.d.ts +2 -2
- package/hooks/useProcessMessage.js +46 -46
- package/hooks/useRouteExecution.js +3 -4
- package/hooks/{useSwapRoutes.d.ts → useRoutes.d.ts} +2 -2
- package/hooks/{useSwapRoutes.js → useRoutes.js} +23 -23
- package/hooks/useTokenBalance.js +4 -5
- package/hooks/useTokenBalances.js +1 -5
- package/hooks/useTokens.js +21 -9
- package/i18n/bn.json +80 -80
- package/i18n/de.json +74 -74
- package/i18n/en.json +132 -131
- package/i18n/es.json +72 -72
- package/i18n/fr.json +102 -85
- package/i18n/id.json +102 -85
- package/i18n/it.json +112 -84
- package/i18n/ko.json +102 -85
- package/i18n/pt.json +89 -87
- package/i18n/th.json +102 -85
- package/i18n/tr.json +72 -72
- package/i18n/uk.json +98 -96
- package/i18n/vi.json +104 -79
- package/i18n/zh.json +104 -87
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +31 -17
- package/pages/ActiveTransactionsPage/ActiveTransactionsEmpty.d.ts +2 -0
- package/pages/{ActiveSwapsPage/ActiveSwapsEmpty.js → ActiveTransactionsPage/ActiveTransactionsEmpty.js} +2 -2
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.d.ts +1 -0
- package/pages/{ActiveSwapsPage/ActiveSwapsPage.js → ActiveTransactionsPage/ActiveTransactionsPage.js} +7 -7
- package/pages/ActiveTransactionsPage/index.d.ts +1 -0
- package/pages/ActiveTransactionsPage/index.js +1 -0
- package/pages/MainPage/MainGasMessage.js +2 -2
- package/pages/MainPage/MainPage.js +7 -7
- package/pages/MainPage/ReviewButton.d.ts +2 -0
- package/pages/MainPage/ReviewButton.js +58 -0
- package/{components/ActiveSwaps/ActiveSwaps.d.ts → pages/RoutesPage/RoutesPage.d.ts} +1 -1
- package/pages/{SwapRoutesPage/SwapRoutesPage.js → RoutesPage/RoutesPage.js} +11 -11
- package/pages/RoutesPage/index.d.ts +1 -0
- package/pages/RoutesPage/index.js +1 -0
- package/pages/SelectChainPage/types.d.ts +2 -2
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +2 -2
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +1 -1
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +2 -2
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.js +4 -4
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +2 -2
- package/pages/SettingsPage/EnabledToolsButton.style.d.ts +1 -1
- package/pages/SettingsPage/LanguageSelect.js +1 -1
- package/pages/SettingsPage/ResetSettingsButton.js +1 -1
- package/pages/SettingsPage/RoutePrioritySelect.js +1 -1
- package/pages/TransactionDetailsPage/TransactionDetailsPage.d.ts +2 -0
- package/pages/{SwapDetailsPage/SwapDetailsPage.js → TransactionDetailsPage/TransactionDetailsPage.js} +8 -7
- package/pages/TransactionDetailsPage/index.d.ts +1 -0
- package/pages/TransactionDetailsPage/index.js +1 -0
- package/pages/TransactionHistoryPage/TransactionHistoryEmpty.d.ts +2 -0
- package/pages/{SwapHistoryPage/SwapHistoryEmpty.js → TransactionHistoryPage/TransactionHistoryEmpty.js} +2 -2
- package/pages/{SwapHistoryPage/SwapHistoryItem.d.ts → TransactionHistoryPage/TransactionHistoryItem.d.ts} +1 -1
- package/pages/{SwapHistoryPage/SwapHistoryItem.js → TransactionHistoryPage/TransactionHistoryItem.js} +2 -2
- package/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +2 -0
- package/pages/TransactionHistoryPage/TransactionHistoryPage.js +31 -0
- package/pages/TransactionHistoryPage/index.d.ts +1 -0
- package/pages/TransactionHistoryPage/index.js +1 -0
- package/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.js +3 -3
- package/pages/TransactionPage/StartTransactionButton.d.ts +4 -0
- package/pages/TransactionPage/StartTransactionButton.js +16 -0
- package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.js +28 -25
- package/pages/TransactionPage/TokenValueBottomSheet.js +34 -0
- package/pages/TransactionPage/TransactionPage.d.ts +2 -0
- package/pages/TransactionPage/TransactionPage.js +121 -0
- package/pages/TransactionPage/index.d.ts +1 -0
- package/pages/TransactionPage/index.js +1 -0
- package/pages/TransactionPage/types.d.ts +6 -0
- package/pages/TransactionPage/utils.d.ts +2 -0
- package/pages/TransactionPage/utils.js +6 -0
- package/providers/{SwapFormProvider/SwapFormProvider.d.ts → FormProvider/FormProvider.d.ts} +1 -1
- package/providers/{SwapFormProvider/SwapFormProvider.js → FormProvider/FormProvider.js} +12 -12
- package/providers/FormProvider/FormUpdater.d.ts +5 -0
- package/providers/{SwapFormProvider → FormProvider}/FormUpdater.js +14 -14
- package/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.js +7 -7
- package/providers/{SwapFormProvider → FormProvider}/index.d.ts +1 -1
- package/providers/{SwapFormProvider → FormProvider}/index.js +1 -1
- package/providers/FormProvider/types.d.ts +37 -0
- package/providers/FormProvider/types.js +20 -0
- package/providers/WalletProvider/WalletProvider.js +5 -3
- package/providers/WalletProvider/types.d.ts +1 -1
- package/providers/WidgetProvider/WidgetProvider.js +2 -2
- package/providers/index.d.ts +1 -1
- package/providers/index.js +1 -1
- package/stores/routes/createRouteExecutionStore.js +1 -1
- package/stores/routes/index.d.ts +1 -1
- package/stores/routes/index.js +1 -1
- package/stores/routes/useTransactionHistory.d.ts +2 -0
- package/stores/routes/{useSwapHistory.js → useTransactionHistory.js} +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +9 -1
- package/types/events.js +1 -0
- package/types/widget.d.ts +6 -4
- package/utils/format.d.ts +1 -1
- package/utils/format.js +11 -13
- package/utils/navigationRoutes.d.ts +5 -5
- package/utils/navigationRoutes.js +15 -15
- package/cjs/components/ActiveSwaps/index.d.ts +0 -2
- package/cjs/components/Header/useHeaderActionStore.d.ts +0 -2
- package/cjs/components/SwapButton/SwapButton.d.ts +0 -3
- package/cjs/components/SwapButton/SwapButton.js +0 -56
- package/cjs/components/SwapButton/index.d.ts +0 -2
- package/cjs/components/SwapInput/FitInputText.d.ts +0 -3
- package/cjs/components/SwapInput/FitInputText.js +0 -19
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +0 -3
- package/cjs/components/SwapInput/SwapInput.d.ts +0 -4
- package/cjs/components/SwapInput/SwapInput.js +0 -41
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -2
- package/cjs/components/SwapInput/SwapInputStartAdornment.d.ts +0 -3
- package/cjs/components/SwapInput/index.d.ts +0 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +0 -4
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +0 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +0 -4
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +0 -2
- package/cjs/components/SwapRouteCard/index.d.ts +0 -3
- package/cjs/components/SwapRouteCard/index.js +0 -19
- package/cjs/components/SwapRoutes/SwapRoutes.js +0 -37
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -2
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +0 -42
- package/cjs/components/SwapRoutes/index.d.ts +0 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +0 -2
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/ActiveSwapsPage/index.d.ts +0 -1
- package/cjs/pages/MainPage/MainSwapButton.d.ts +0 -2
- package/cjs/pages/MainPage/MainSwapButton.js +0 -27
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.d.ts +0 -2
- package/cjs/pages/SwapDetailsPage/index.d.ts +0 -1
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +0 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.d.ts +0 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +0 -35
- package/cjs/pages/SwapHistoryPage/index.d.ts +0 -1
- package/cjs/pages/SwapPage/StartSwapButton.d.ts +0 -4
- package/cjs/pages/SwapPage/StartSwapButton.js +0 -21
- package/cjs/pages/SwapPage/SwapPage.d.ts +0 -2
- package/cjs/pages/SwapPage/SwapPage.js +0 -99
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +0 -43
- package/cjs/pages/SwapPage/index.d.ts +0 -1
- package/cjs/pages/SwapPage/types.d.ts +0 -9
- package/cjs/pages/SwapRoutesPage/index.d.ts +0 -1
- package/cjs/pages/SwapRoutesPage/index.js +0 -17
- package/cjs/providers/SwapFormProvider/FormUpdater.d.ts +0 -5
- package/cjs/providers/SwapFormProvider/types.d.ts +0 -37
- package/cjs/providers/SwapFormProvider/types.js +0 -23
- package/cjs/stores/routes/useSwapHistory.d.ts +0 -2
- package/components/ActiveSwaps/index.d.ts +0 -2
- package/components/ActiveSwaps/index.js +0 -2
- package/components/Header/useHeaderActionStore.d.ts +0 -2
- package/components/Header/useHeaderActionStore.js +0 -14
- package/components/SwapButton/SwapButton.d.ts +0 -3
- package/components/SwapButton/SwapButton.js +0 -52
- package/components/SwapButton/index.d.ts +0 -2
- package/components/SwapButton/index.js +0 -2
- package/components/SwapInput/FitInputText.d.ts +0 -3
- package/components/SwapInput/FitInputText.js +0 -16
- package/components/SwapInput/FormPriceHelperText.d.ts +0 -3
- package/components/SwapInput/SwapInput.d.ts +0 -4
- package/components/SwapInput/SwapInput.js +0 -37
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -2
- package/components/SwapInput/SwapInputStartAdornment.d.ts +0 -3
- package/components/SwapInput/index.d.ts +0 -1
- package/components/SwapInput/index.js +0 -1
- package/components/SwapRouteCard/SwapRouteCard.d.ts +0 -4
- package/components/SwapRouteCard/SwapRouteCardEssentials.d.ts +0 -3
- package/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +0 -4
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +0 -2
- package/components/SwapRouteCard/index.d.ts +0 -3
- package/components/SwapRouteCard/index.js +0 -3
- package/components/SwapRoutes/SwapRoutes.js +0 -33
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -2
- package/components/SwapRoutes/index.d.ts +0 -2
- package/components/SwapRoutes/index.js +0 -2
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +0 -2
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/ActiveSwapsPage/index.d.ts +0 -1
- package/pages/ActiveSwapsPage/index.js +0 -1
- package/pages/MainPage/MainSwapButton.d.ts +0 -2
- package/pages/MainPage/MainSwapButton.js +0 -23
- package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +0 -2
- package/pages/SwapDetailsPage/index.d.ts +0 -1
- package/pages/SwapDetailsPage/index.js +0 -1
- package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +0 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +0 -2
- package/pages/SwapHistoryPage/SwapHistoryPage.js +0 -31
- package/pages/SwapHistoryPage/index.d.ts +0 -1
- package/pages/SwapHistoryPage/index.js +0 -1
- package/pages/SwapPage/StartSwapButton.d.ts +0 -4
- package/pages/SwapPage/StartSwapButton.js +0 -16
- package/pages/SwapPage/SwapPage.d.ts +0 -2
- package/pages/SwapPage/SwapPage.js +0 -95
- package/pages/SwapPage/TokenValueBottomSheet.js +0 -39
- package/pages/SwapPage/index.d.ts +0 -1
- package/pages/SwapPage/index.js +0 -1
- package/pages/SwapPage/types.d.ts +0 -9
- package/pages/SwapRoutesPage/SwapRoutesPage.d.ts +0 -3
- package/pages/SwapRoutesPage/index.d.ts +0 -1
- package/pages/SwapRoutesPage/index.js +0 -1
- package/providers/SwapFormProvider/FormUpdater.d.ts +0 -5
- package/providers/SwapFormProvider/types.d.ts +0 -37
- package/providers/SwapFormProvider/types.js +0 -20
- package/stores/routes/useSwapHistory.d.ts +0 -2
- /package/cjs/components/{ActiveSwaps/ActiveSwaps.style.js → ActiveTransactions/ActiveTransactions.style.js} +0 -0
- /package/cjs/components/{SwapInput/SwapInput.style.js → AmountInput/AmountInput.style.js} +0 -0
- /package/cjs/components/{SwapInput/SwapInputAdornment.style.js → AmountInput/AmountInputAdornment.style.js} +0 -0
- /package/cjs/components/{SwapButton → DefaultTransactionButton}/types.js +0 -0
- /package/cjs/components/{SwapRouteCard/SwapRouteCard.style.d.ts → RouteCard/RouteCard.style.d.ts} +0 -0
- /package/cjs/components/{SwapRouteCard/SwapRouteCard.style.js → RouteCard/RouteCard.style.js} +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/types.js +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/utils.d.ts +0 -0
- /package/cjs/components/{SwapRouteCard → RouteCard}/utils.js +0 -0
- /package/cjs/components/{SwapRoutes/SwapRoutesExpanded.style.d.ts → Routes/RoutesExpanded.style.d.ts} +0 -0
- /package/cjs/components/{SwapRoutes/SwapRoutesExpanded.style.js → Routes/RoutesExpanded.style.js} +0 -0
- /package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.style.d.ts → RoutesPage/RoutesPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapRoutesPage/SwapRoutesPage.style.js → RoutesPage/RoutesPage.style.js} +0 -0
- /package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.style.d.ts → TransactionDetailsPage/TransactionDetailsPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapDetailsPage/SwapDetailsPage.style.js → TransactionDetailsPage/TransactionDetailsPage.style.js} +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.d.ts +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/TokenValueBottomSheet.d.ts +0 -0
- /package/cjs/pages/{SwapPage/SwapPage.style.d.ts → TransactionPage/TransactionPage.style.d.ts} +0 -0
- /package/cjs/pages/{SwapPage/SwapPage.style.js → TransactionPage/TransactionPage.style.js} +0 -0
- /package/cjs/pages/{SwapPage → TransactionPage}/types.js +0 -0
- /package/cjs/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.d.ts +0 -0
- /package/components/{ActiveSwaps/ActiveSwaps.style.js → ActiveTransactions/ActiveTransactions.style.js} +0 -0
- /package/components/{SwapInput/SwapInput.style.js → AmountInput/AmountInput.style.js} +0 -0
- /package/components/{SwapInput/SwapInputAdornment.style.js → AmountInput/AmountInputAdornment.style.js} +0 -0
- /package/components/{SwapButton → DefaultTransactionButton}/types.js +0 -0
- /package/components/{SwapRouteCard/SwapRouteCard.style.d.ts → RouteCard/RouteCard.style.d.ts} +0 -0
- /package/components/{SwapRouteCard/SwapRouteCard.style.js → RouteCard/RouteCard.style.js} +0 -0
- /package/components/{SwapRouteCard → RouteCard}/types.js +0 -0
- /package/components/{SwapRouteCard → RouteCard}/utils.d.ts +0 -0
- /package/components/{SwapRouteCard → RouteCard}/utils.js +0 -0
- /package/components/{SwapRoutes/SwapRoutesExpanded.style.d.ts → Routes/RoutesExpanded.style.d.ts} +0 -0
- /package/components/{SwapRoutes/SwapRoutesExpanded.style.js → Routes/RoutesExpanded.style.js} +0 -0
- /package/pages/{SwapRoutesPage/SwapRoutesPage.style.d.ts → RoutesPage/RoutesPage.style.d.ts} +0 -0
- /package/pages/{SwapRoutesPage/SwapRoutesPage.style.js → RoutesPage/RoutesPage.style.js} +0 -0
- /package/pages/{SwapDetailsPage/SwapDetailsPage.style.d.ts → TransactionDetailsPage/TransactionDetailsPage.style.d.ts} +0 -0
- /package/pages/{SwapDetailsPage/SwapDetailsPage.style.js → TransactionDetailsPage/TransactionDetailsPage.style.js} +0 -0
- /package/pages/{SwapPage → TransactionPage}/ExchangeRateBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.d.ts +0 -0
- /package/pages/{SwapPage → TransactionPage}/StatusBottomSheet.style.js +0 -0
- /package/pages/{SwapPage → TransactionPage}/TokenValueBottomSheet.d.ts +0 -0
- /package/pages/{SwapPage/SwapPage.style.d.ts → TransactionPage/TransactionPage.style.d.ts} +0 -0
- /package/pages/{SwapPage/SwapPage.style.js → TransactionPage/TransactionPage.style.js} +0 -0
- /package/pages/{SwapPage → TransactionPage}/types.js +0 -0
- /package/providers/{SwapFormProvider → FormProvider}/URLSearchParamsBuilder.d.ts +0 -0
|
@@ -47,11 +47,11 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
|
47
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
48
48
|
const ref = (0, react_1.useRef)();
|
|
49
49
|
(0, hooks_1.useSetContentHeight)(ref);
|
|
50
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.CenterContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.CenterContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('warning.title.rateChanged') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: t('warning.message.rateChanged') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.quotedAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
51
51
|
value: (0, utils_1.formatTokenAmount)(data?.oldToAmount, data?.toToken.decimals, 5),
|
|
52
|
-
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('
|
|
52
|
+
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.currentAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
53
53
|
value: (0, utils_1.formatTokenAmount)(data?.newToAmount, data?.toToken.decimals, 5),
|
|
54
|
-
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('
|
|
54
|
+
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.rateChange') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [(0, big_js_1.default)(data?.newToAmount || 0)
|
|
55
55
|
.div((0, big_js_1.default)(data?.oldToAmount || 0))
|
|
56
56
|
.minus(1)
|
|
57
57
|
.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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartInsurableTransactionButton = exports.StartTransactionButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const DefaultTransactionButton_1 = require("../../components/DefaultTransactionButton");
|
|
6
|
+
const hooks_1 = require("../../hooks");
|
|
7
|
+
const stores_1 = require("../../stores");
|
|
8
|
+
const StartTransactionButton = ({ onClick, route, text, loading, }) => {
|
|
9
|
+
const { insufficientGas, isInitialLoading: isGasSufficiencyLoading } = (0, hooks_1.useGasSufficiency)(route);
|
|
10
|
+
const { insufficientFunds, isInitialLoading: isFundsSufficiencyLoading } = (0, hooks_1.useFundsSufficiency)(route);
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(DefaultTransactionButton_1.DefaultTransactionButton, { onClick: onClick, text: text, disabled: insufficientFunds || !!insufficientGas?.length, loading: isFundsSufficiencyLoading || isGasSufficiencyLoading || loading }));
|
|
12
|
+
};
|
|
13
|
+
exports.StartTransactionButton = StartTransactionButton;
|
|
14
|
+
const StartInsurableTransactionButton = ({ onClick, text, route, loading, disabled, insurableRouteId }) => {
|
|
15
|
+
const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[insurableRouteId]);
|
|
16
|
+
const { isFetching } = (0, hooks_1.useRoutes)({
|
|
17
|
+
insurableRoute: routeExecution?.route,
|
|
18
|
+
});
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(exports.StartTransactionButton, { onClick: onClick, text: text, route: route, disabled: disabled, loading: loading || isFetching, insurableRouteId: insurableRouteId }));
|
|
20
|
+
};
|
|
21
|
+
exports.StartInsurableTransactionButton = StartInsurableTransactionButton;
|
|
@@ -23,7 +23,7 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
23
23
|
const ref = (0, react_1.useRef)(null);
|
|
24
24
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
25
25
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
26
|
-
const {
|
|
26
|
+
const { subvariant, contractComponent, contractSecondaryComponent, contractCompactComponent, } = (0, providers_1.useWidgetConfig)();
|
|
27
27
|
const toToken = {
|
|
28
28
|
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
29
29
|
amount: route.steps.at(-1)?.execution?.toAmount ??
|
|
@@ -33,8 +33,8 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
33
33
|
const { token, refetch, refetchNewBalance, refetchAllBalances } = (0, hooks_1.useTokenBalance)(toToken, route.toAddress);
|
|
34
34
|
const clearFromAmount = () => {
|
|
35
35
|
refetchAllBalances();
|
|
36
|
-
setValue(providers_1.
|
|
37
|
-
setValue(providers_1.
|
|
36
|
+
setValue(providers_1.FormKey.FromAmount, '');
|
|
37
|
+
setValue(providers_1.FormKey.ToAmount, '');
|
|
38
38
|
};
|
|
39
39
|
const handleDone = () => {
|
|
40
40
|
clearFromAmount();
|
|
@@ -44,13 +44,13 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
44
44
|
clearFromAmount();
|
|
45
45
|
if (toToken.chainId !== route.toToken.chainId &&
|
|
46
46
|
toToken.address !== route.toToken.address) {
|
|
47
|
-
setValue(providers_1.
|
|
48
|
-
setValue(providers_1.
|
|
49
|
-
setValue(providers_1.
|
|
50
|
-
setValue(providers_1.
|
|
47
|
+
setValue(providers_1.FormKey.FromAmount, (0, utils_1.formatTokenAmount)(toToken.amount, toToken.decimals), { shouldTouch: true });
|
|
48
|
+
setValue(providers_1.FormKey.FromChain, toToken.chainId, { shouldTouch: true });
|
|
49
|
+
setValue(providers_1.FormKey.FromToken, toToken.address, { shouldTouch: true });
|
|
50
|
+
setValue(providers_1.FormKey.ToChain, route.toToken.chainId, {
|
|
51
51
|
shouldTouch: true,
|
|
52
52
|
});
|
|
53
|
-
setValue(providers_1.
|
|
53
|
+
setValue(providers_1.FormKey.ToToken, route.toToken.address, {
|
|
54
54
|
shouldTouch: true,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -62,11 +62,12 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
62
62
|
};
|
|
63
63
|
const handleSeeDetails = () => {
|
|
64
64
|
handleClose();
|
|
65
|
-
navigate(utils_1.navigationRoutes.
|
|
65
|
+
navigate(utils_1.navigationRoutes.transactionDetails, {
|
|
66
66
|
state: { routeId: route.id },
|
|
67
67
|
replace: true,
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
|
+
const transactionType = route.fromChainId === route.toChainId ? 'swap' : 'bridge';
|
|
70
71
|
let title;
|
|
71
72
|
let primaryMessage;
|
|
72
73
|
let secondaryMessage;
|
|
@@ -74,12 +75,12 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
74
75
|
switch (status) {
|
|
75
76
|
case stores_1.RouteExecutionStatus.Done: {
|
|
76
77
|
title =
|
|
77
|
-
|
|
78
|
-
? t('
|
|
79
|
-
: t(
|
|
78
|
+
subvariant === 'nft'
|
|
79
|
+
? t('success.title.purchaseSuccessful')
|
|
80
|
+
: t(`success.title.${transactionType}Successful`);
|
|
80
81
|
if (token) {
|
|
81
|
-
primaryMessage = t('
|
|
82
|
-
amount: token.amount,
|
|
82
|
+
primaryMessage = t('success.message.exchangeSuccessful', {
|
|
83
|
+
amount: (0, utils_1.formatTokenAmount)(token.amount),
|
|
83
84
|
tokenSymbol: token.symbol,
|
|
84
85
|
chainName: getChainById(token.chainId)?.name,
|
|
85
86
|
walletAddress: (0, utils_1.shortenAddress)(route.toAddress),
|
|
@@ -89,14 +90,14 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
89
90
|
break;
|
|
90
91
|
}
|
|
91
92
|
case stores_1.RouteExecutionStatus.Done | stores_1.RouteExecutionStatus.Partial: {
|
|
92
|
-
title = t(
|
|
93
|
-
primaryMessage = t('
|
|
93
|
+
title = t(`success.title.${transactionType}PartiallySuccessful`);
|
|
94
|
+
primaryMessage = t('success.message.exchangePartiallySuccessful', {
|
|
94
95
|
tool: route.steps.at(-1)?.toolDetails.name,
|
|
95
96
|
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
96
97
|
});
|
|
97
98
|
if (token) {
|
|
98
|
-
secondaryMessage = t('
|
|
99
|
-
amount: token.amount,
|
|
99
|
+
secondaryMessage = t('success.message.exchangeSuccessful', {
|
|
100
|
+
amount: (0, utils_1.formatTokenAmount)(token.amount),
|
|
100
101
|
tokenSymbol: token.symbol,
|
|
101
102
|
chainName: getChainById(token.chainId)?.name,
|
|
102
103
|
walletAddress: (0, utils_1.shortenAddress)(route.toAddress),
|
|
@@ -106,14 +107,14 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
106
107
|
break;
|
|
107
108
|
}
|
|
108
109
|
case stores_1.RouteExecutionStatus.Done | stores_1.RouteExecutionStatus.Refunded: {
|
|
109
|
-
title = t('
|
|
110
|
-
primaryMessage = t('
|
|
110
|
+
title = t('success.title.refundIssued');
|
|
111
|
+
primaryMessage = t('success.message.exchangePartiallySuccessful', {
|
|
111
112
|
tool: route.steps.at(-1)?.toolDetails.name,
|
|
112
113
|
tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
|
|
113
114
|
});
|
|
114
115
|
if (token) {
|
|
115
|
-
secondaryMessage = t('
|
|
116
|
-
amount: token.amount,
|
|
116
|
+
secondaryMessage = t('success.message.exchangeSuccessful', {
|
|
117
|
+
amount: (0, utils_1.formatTokenAmount)(token.amount),
|
|
117
118
|
tokenSymbol: token.symbol,
|
|
118
119
|
chainName: getChainById(token.chainId)?.name,
|
|
119
120
|
walletAddress: (0, utils_1.shortenAddress)(route.toAddress),
|
|
@@ -147,9 +148,11 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
147
148
|
ref.current?.open();
|
|
148
149
|
}
|
|
149
150
|
}, [refetch, refetchNewBalance, status]);
|
|
150
|
-
const showContractComponent =
|
|
151
|
+
const showContractComponent = subvariant === 'nft' && (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done);
|
|
151
152
|
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, { ref: ref, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, children: [!showContractComponent ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, { status: status, mb: 1, children: [status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InfoRounded_1.default, { color: "primary" })) : null, status === stores_1.RouteExecutionStatus.Done ? ((0, jsx_runtime_1.jsx)(Done_1.default, { color: "success" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Partial) ||
|
|
152
|
-
(0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Refunded) ? ((0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed) ? ((0, jsx_runtime_1.jsx)(ErrorRounded_1.default, { color: "error" })) : null] }) })) : null, (0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent ||
|
|
153
|
+
(0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Refunded) ? ((0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed) ? ((0, jsx_runtime_1.jsx)(ErrorRounded_1.default, { color: "error" })) : null] }) })) : null, (0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent ||
|
|
154
|
+
contractSecondaryComponent ||
|
|
155
|
+
contractComponent) : ((0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done) ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, py: 1, disableDescription: true })) : null })), !showContractComponent ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: primaryMessage })) : null, secondaryMessage ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: secondaryMessage })) : null, (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsxs)(material_1.Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === stores_1.RouteExecutionStatus.Idle ? t('button.ok') : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done)
|
|
153
156
|
? t('button.done')
|
|
154
157
|
: null, status === stores_1.RouteExecutionStatus.Failed
|
|
155
158
|
? t('button.seeDetails')
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTokenValueLossThreshold = exports.TokenValueBottomSheet = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const WarningRounded_1 = require("@mui/icons-material/WarningRounded");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_i18next_1 = require("react-i18next");
|
|
9
|
+
const BottomSheet_1 = require("../../components/BottomSheet");
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
11
|
+
const StatusBottomSheet_style_1 = require("./StatusBottomSheet.style");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
exports.TokenValueBottomSheet = (0, react_1.forwardRef)(({ route, onContinue, onCancel }, ref) => {
|
|
14
|
+
const handleCancel = () => {
|
|
15
|
+
ref.current?.close();
|
|
16
|
+
onCancel?.();
|
|
17
|
+
};
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, { ref: ref, onClose: onCancel, children: (0, jsx_runtime_1.jsx)(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) }));
|
|
19
|
+
});
|
|
20
|
+
const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
21
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
|
+
const ref = (0, react_1.useRef)();
|
|
23
|
+
(0, hooks_1.useSetContentHeight)(ref);
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.CenterContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('warning.title.highValueLoss') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: t('warning.message.highValueLoss') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.sending') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.gasCost') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.receiving') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('main.valueLoss') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: (0, utils_1.calcValueLoss)(route) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", mt: 3, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", p: 1 }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
|
|
25
|
+
};
|
|
26
|
+
const getTokenValueLossThreshold = (route) => {
|
|
27
|
+
if (!route) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const fromAmountUSD = Number(route.fromAmountUSD || 0);
|
|
31
|
+
const toAmountUSD = Number(route.toAmountUSD || 0);
|
|
32
|
+
const gasCostUSD = Number(route.gasCostUSD || 0);
|
|
33
|
+
if (!fromAmountUSD && !toAmountUSD) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return toAmountUSD / (fromAmountUSD + gasCostUSD) < 0.9;
|
|
37
|
+
};
|
|
38
|
+
exports.getTokenValueLossThreshold = getTokenValueLossThreshold;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionPage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Delete_1 = require("@mui/icons-material/Delete");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
9
|
+
const react_i18next_1 = require("react-i18next");
|
|
10
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
11
|
+
const ContractComponent_1 = require("../../components/ContractComponent");
|
|
12
|
+
const GasMessage_1 = require("../../components/GasMessage");
|
|
13
|
+
const Header_1 = require("../../components/Header");
|
|
14
|
+
const Insurance_1 = require("../../components/Insurance");
|
|
15
|
+
const Step_1 = require("../../components/Step");
|
|
16
|
+
const hooks_1 = require("../../hooks");
|
|
17
|
+
const providers_1 = require("../../providers");
|
|
18
|
+
const stores_1 = require("../../stores");
|
|
19
|
+
const events_1 = require("../../types/events");
|
|
20
|
+
const utils_1 = require("../../utils");
|
|
21
|
+
const ExchangeRateBottomSheet_1 = require("./ExchangeRateBottomSheet");
|
|
22
|
+
const StartTransactionButton_1 = require("./StartTransactionButton");
|
|
23
|
+
const StatusBottomSheet_1 = require("./StatusBottomSheet");
|
|
24
|
+
const TokenValueBottomSheet_1 = require("./TokenValueBottomSheet");
|
|
25
|
+
const TransactionPage_style_1 = require("./TransactionPage.style");
|
|
26
|
+
const utils_2 = require("./utils");
|
|
27
|
+
const TransactionPage = () => {
|
|
28
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
29
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
30
|
+
const emitter = (0, hooks_1.useWidgetEvents)();
|
|
31
|
+
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
32
|
+
const { subvariant, insurance, contractComponent, contractSecondaryComponent, } = (0, providers_1.useWidgetConfig)();
|
|
33
|
+
const { state } = (0, react_router_dom_1.useLocation)();
|
|
34
|
+
const stateRouteId = state?.routeId;
|
|
35
|
+
const [routeId, setRouteId] = (0, react_1.useState)(stateRouteId);
|
|
36
|
+
const tokenValueBottomSheetRef = (0, react_1.useRef)(null);
|
|
37
|
+
const exchangeRateBottomSheetRef = (0, react_1.useRef)(null);
|
|
38
|
+
const onAcceptExchangeRateUpdate = (resolver, data) => {
|
|
39
|
+
exchangeRateBottomSheetRef.current?.open(resolver, data);
|
|
40
|
+
};
|
|
41
|
+
const { route, status, executeRoute, restartRoute, deleteRoute } = (0, hooks_1.useRouteExecution)({
|
|
42
|
+
routeId: routeId,
|
|
43
|
+
onAcceptExchangeRateUpdate,
|
|
44
|
+
});
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (route && subvariant !== 'nft') {
|
|
47
|
+
const transactionType = route.fromChainId === route.toChainId ? 'Swap' : 'Bridge';
|
|
48
|
+
return Header_1.useHeaderStore
|
|
49
|
+
.getState()
|
|
50
|
+
.setTitle(status === stores_1.RouteExecutionStatus.Idle
|
|
51
|
+
? t(`button.review${transactionType}`)
|
|
52
|
+
: t(`header.${transactionType.toLowerCase()}`));
|
|
53
|
+
}
|
|
54
|
+
}, [route, status, subvariant, t]);
|
|
55
|
+
if (!route) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const tokenValueLossThresholdExceeded = (0, TokenValueBottomSheet_1.getTokenValueLossThreshold)(route);
|
|
59
|
+
const handleExecuteRoute = () => {
|
|
60
|
+
if (tokenValueBottomSheetRef.current?.isOpen()) {
|
|
61
|
+
emitter.emit(events_1.WidgetEvent.RouteHighValueLoss, {
|
|
62
|
+
fromAmountUsd: route.fromAmountUSD,
|
|
63
|
+
gasCostUSD: route.gasCostUSD,
|
|
64
|
+
toAmountUSD: route.toAmountUSD,
|
|
65
|
+
valueLoss: (0, utils_2.calcValueLoss)(route),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
tokenValueBottomSheetRef.current?.close();
|
|
69
|
+
executeRoute();
|
|
70
|
+
setValue(providers_1.FormKey.FromAmount, '');
|
|
71
|
+
};
|
|
72
|
+
const handleStartClick = async () => {
|
|
73
|
+
if (status === stores_1.RouteExecutionStatus.Idle) {
|
|
74
|
+
if (tokenValueLossThresholdExceeded && subvariant !== 'nft') {
|
|
75
|
+
tokenValueBottomSheetRef.current?.open();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
handleExecuteRoute();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (status === stores_1.RouteExecutionStatus.Failed) {
|
|
82
|
+
restartRoute();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const handleRemoveRoute = () => {
|
|
86
|
+
navigateBack();
|
|
87
|
+
deleteRoute();
|
|
88
|
+
};
|
|
89
|
+
const getButtonText = () => {
|
|
90
|
+
switch (status) {
|
|
91
|
+
case stores_1.RouteExecutionStatus.Idle:
|
|
92
|
+
switch (subvariant) {
|
|
93
|
+
case 'nft':
|
|
94
|
+
return t('button.buyNow');
|
|
95
|
+
case 'refuel':
|
|
96
|
+
return t('button.startBridging');
|
|
97
|
+
default:
|
|
98
|
+
const transactionType = route.fromChainId === route.toChainId ? 'Swapping' : 'Bridging';
|
|
99
|
+
return t(`button.start${transactionType}`);
|
|
100
|
+
}
|
|
101
|
+
case stores_1.RouteExecutionStatus.Failed:
|
|
102
|
+
return t('button.tryAgain');
|
|
103
|
+
default:
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const insuredRoute = route.insurance?.state === 'INSURED';
|
|
108
|
+
const insurableRoute = insurance &&
|
|
109
|
+
subvariant !== 'refuel' &&
|
|
110
|
+
status === stores_1.RouteExecutionStatus.Idle &&
|
|
111
|
+
route.insurance?.state === 'INSURABLE';
|
|
112
|
+
const insuranceAvailable = insuredRoute || insurableRoute;
|
|
113
|
+
const StartButton = insurableRoute
|
|
114
|
+
? StartTransactionButton_1.StartInsurableTransactionButton
|
|
115
|
+
: StartTransactionButton_1.StartTransactionButton;
|
|
116
|
+
const getInsuranceCoverageId = () => route.steps[0].execution?.process
|
|
117
|
+
.filter((process) => process.type !== 'TOKEN_ALLOWANCE')
|
|
118
|
+
.find((process) => process.txHash)?.txHash ?? route.fromAddress;
|
|
119
|
+
return ((0, jsx_runtime_1.jsxs)(TransactionPage_style_1.Container, { children: [(0, Step_1.getStepList)(route), subvariant === 'nft' ? ((0, jsx_runtime_1.jsx)(ContractComponent_1.ContractComponent, { mt: 2, children: contractSecondaryComponent || contractComponent })) : null, insuranceAvailable ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route.insurance.feeAmountUsd, insuredAmount: (0, utils_1.formatTokenAmount)(route.toAmountMin, route.toToken.decimals), insuredTokenSymbol: route.toToken.symbol, insuranceCoverageId: getInsuranceCoverageId(), onChange: setRouteId })) : null, status === stores_1.RouteExecutionStatus.Idle ||
|
|
120
|
+
status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GasMessage_1.GasMessage, { mt: 2, route: route }), (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, display: "flex", children: [(0, jsx_runtime_1.jsx)(StartButton, { text: getButtonText(), onClick: handleStartClick, route: route, insurableRouteId: stateRouteId }), status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('button.removeTransaction'), placement: "bottom-end", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleRemoveRoute, sx: {
|
|
121
|
+
minWidth: 48,
|
|
122
|
+
marginLeft: 1,
|
|
123
|
+
}, children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }) })) : null] })] })) : null, status ? (0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route }) : null, tokenValueLossThresholdExceeded && subvariant !== 'nft' ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, (0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })] }));
|
|
124
|
+
};
|
|
125
|
+
exports.TransactionPage = TransactionPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionPage';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./TransactionPage"), exports);
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calcValueLoss = void 0;
|
|
4
|
+
const calcValueLoss = (route) => {
|
|
5
|
+
return `${((Number(route.toAmountUSD || 0) /
|
|
6
|
+
(Number(route.fromAmountUSD || 0) + Number(route.gasCostUSD || 0)) -
|
|
7
|
+
1) *
|
|
8
|
+
100).toFixed(2)}%`;
|
|
9
|
+
};
|
|
10
|
+
exports.calcValueLoss = calcValueLoss;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormProvider = exports.formDefaultValues = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_hook_form_1 = require("react-hook-form");
|
|
@@ -8,16 +8,16 @@ const WidgetProvider_1 = require("../WidgetProvider");
|
|
|
8
8
|
const FormUpdater_1 = require("./FormUpdater");
|
|
9
9
|
const types_1 = require("./types");
|
|
10
10
|
exports.formDefaultValues = {
|
|
11
|
-
[types_1.
|
|
12
|
-
[types_1.
|
|
13
|
-
[types_1.
|
|
14
|
-
[types_1.
|
|
15
|
-
[types_1.
|
|
16
|
-
[types_1.
|
|
17
|
-
[types_1.
|
|
18
|
-
[types_1.
|
|
11
|
+
[types_1.FormKey.FromAmount]: '',
|
|
12
|
+
[types_1.FormKey.ToAddress]: '',
|
|
13
|
+
[types_1.FormKey.TokenSearchFilter]: '',
|
|
14
|
+
[types_1.FormKey.ContractOutputsToken]: '',
|
|
15
|
+
[types_1.FormKey.ToContractAddress]: '',
|
|
16
|
+
[types_1.FormKey.ToContractCallData]: '',
|
|
17
|
+
[types_1.FormKey.ToContractGasLimit]: '',
|
|
18
|
+
[types_1.FormKey.ToAmount]: '',
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const FormProvider = ({ children, }) => {
|
|
21
21
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
22
22
|
const defaultValues = (0, react_1.useMemo)(() => ({
|
|
23
23
|
...exports.formDefaultValues,
|
|
@@ -36,4 +36,4 @@ const SwapFormProvider = ({ children, }) => {
|
|
|
36
36
|
});
|
|
37
37
|
return ((0, jsx_runtime_1.jsxs)(react_hook_form_1.FormProvider, { ...methods, children: [(0, jsx_runtime_1.jsx)(FormUpdater_1.FormUpdater, { defaultValues: defaultValues }), children] }));
|
|
38
38
|
};
|
|
39
|
-
exports.
|
|
39
|
+
exports.FormProvider = FormProvider;
|
|
@@ -4,7 +4,7 @@ exports.FormUpdater = void 0;
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_hook_form_1 = require("react-hook-form");
|
|
7
|
-
const
|
|
7
|
+
const _1 = require(".");
|
|
8
8
|
const WalletProvider_1 = require("../WalletProvider");
|
|
9
9
|
const WidgetProvider_1 = require("../WidgetProvider");
|
|
10
10
|
const FormUpdater = ({ defaultValues }) => {
|
|
@@ -20,23 +20,23 @@ const FormUpdater = ({ defaultValues }) => {
|
|
|
20
20
|
if (!account.isActive || !account.chainId || !chainAllowed) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
const { isTouched: isFromChainTouched } = getFieldState(
|
|
24
|
-
const { isTouched: isToChainTouched } = getFieldState(
|
|
25
|
-
const { isTouched: isFromTokenTouched } = getFieldState(
|
|
26
|
-
const { isTouched: isToTokenTouched } = getFieldState(
|
|
27
|
-
const { isTouched: isFromAmountTouched } = getFieldState(
|
|
23
|
+
const { isTouched: isFromChainTouched } = getFieldState(_1.FormKey.FromChain);
|
|
24
|
+
const { isTouched: isToChainTouched } = getFieldState(_1.FormKey.ToChain);
|
|
25
|
+
const { isTouched: isFromTokenTouched } = getFieldState(_1.FormKey.FromToken);
|
|
26
|
+
const { isTouched: isToTokenTouched } = getFieldState(_1.FormKey.ToToken);
|
|
27
|
+
const { isTouched: isFromAmountTouched } = getFieldState(_1.FormKey.FromAmount);
|
|
28
28
|
if (!fromChain && !isFromChainTouched && !isFromTokenTouched) {
|
|
29
|
-
resetField(
|
|
30
|
-
setValue(
|
|
31
|
-
setValue(
|
|
29
|
+
resetField(_1.FormKey.FromChain, { defaultValue: account.chainId });
|
|
30
|
+
setValue(_1.FormKey.FromChain, account.chainId);
|
|
31
|
+
setValue(_1.FormKey.FromToken, '');
|
|
32
32
|
if (isFromAmountTouched) {
|
|
33
|
-
setValue(
|
|
33
|
+
setValue(_1.FormKey.FromAmount, '');
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
if (!toChain && !isToChainTouched && !isToTokenTouched) {
|
|
37
|
-
resetField(
|
|
38
|
-
setValue(
|
|
39
|
-
setValue(
|
|
37
|
+
resetField(_1.FormKey.ToChain, { defaultValue: account.chainId });
|
|
38
|
+
setValue(_1.FormKey.ToChain, account.chainId);
|
|
39
|
+
setValue(_1.FormKey.ToToken, '');
|
|
40
40
|
}
|
|
41
41
|
}, [
|
|
42
42
|
account.chainId,
|
|
@@ -56,7 +56,7 @@ const FormUpdater = ({ defaultValues }) => {
|
|
|
56
56
|
if (previousDefaultValues.current[key] !== defaultValues[key]) {
|
|
57
57
|
const value = defaultValues[key] ||
|
|
58
58
|
// set the chain to the current user one if it is not present in the config
|
|
59
|
-
(key ===
|
|
59
|
+
(key === _1.FormKey.FromChain || key === _1.FormKey.ToChain
|
|
60
60
|
? account.chainId || ''
|
|
61
61
|
: '');
|
|
62
62
|
setValue(key, value);
|
|
@@ -6,12 +6,12 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
6
6
|
const react_router_dom_1 = require("react-router-dom");
|
|
7
7
|
const types_1 = require("./types");
|
|
8
8
|
const formValueKeys = [
|
|
9
|
-
types_1.
|
|
10
|
-
types_1.
|
|
11
|
-
types_1.
|
|
12
|
-
types_1.
|
|
13
|
-
types_1.
|
|
14
|
-
types_1.
|
|
9
|
+
types_1.FormKey.FromAmount,
|
|
10
|
+
types_1.FormKey.FromChain,
|
|
11
|
+
types_1.FormKey.FromToken,
|
|
12
|
+
types_1.FormKey.ToAddress,
|
|
13
|
+
types_1.FormKey.ToChain,
|
|
14
|
+
types_1.FormKey.ToToken,
|
|
15
15
|
];
|
|
16
16
|
const URLSearchParamsBuilder = () => {
|
|
17
17
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./FormProvider"), exports);
|
|
18
18
|
__exportStar(require("./URLSearchParamsBuilder"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
@@ -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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormKeyHelper = exports.FormKey = void 0;
|
|
4
|
+
var FormKey;
|
|
5
|
+
(function (FormKey) {
|
|
6
|
+
FormKey["ContractOutputsToken"] = "contractOutputsToken";
|
|
7
|
+
FormKey["FromAmount"] = "fromAmount";
|
|
8
|
+
FormKey["FromChain"] = "fromChain";
|
|
9
|
+
FormKey["FromToken"] = "fromToken";
|
|
10
|
+
FormKey["ToAddress"] = "toAddress";
|
|
11
|
+
FormKey["ToAmount"] = "toAmount";
|
|
12
|
+
FormKey["ToChain"] = "toChain";
|
|
13
|
+
FormKey["ToContractAddress"] = "toContractAddress";
|
|
14
|
+
FormKey["ToContractCallData"] = "toContractCallData";
|
|
15
|
+
FormKey["ToContractGasLimit"] = "ToContractGasLimit";
|
|
16
|
+
FormKey["ToToken"] = "toToken";
|
|
17
|
+
FormKey["TokenSearchFilter"] = "tokenSearchFilter";
|
|
18
|
+
})(FormKey || (exports.FormKey = FormKey = {}));
|
|
19
|
+
exports.FormKeyHelper = {
|
|
20
|
+
getChainKey: (formType) => `${formType}Chain`,
|
|
21
|
+
getTokenKey: (formType) => `${formType}Token`,
|
|
22
|
+
getAmountKey: (formType) => `${formType}Amount`,
|
|
23
|
+
};
|
|
@@ -58,6 +58,7 @@ const WalletProvider = ({ children }) => {
|
|
|
58
58
|
const signer = await walletManagement.switchChain(chainId);
|
|
59
59
|
const account = await (0, exports.extractAccountFromSigner)(signer);
|
|
60
60
|
setAccount(account);
|
|
61
|
+
return signer;
|
|
61
62
|
}
|
|
62
63
|
else if (!currentWallet) {
|
|
63
64
|
const provider = account.signer?.provider;
|
|
@@ -70,12 +71,13 @@ const WalletProvider = ({ children }) => {
|
|
|
70
71
|
await currentWallet?.switchChain(chainId);
|
|
71
72
|
handleWalletUpdate(currentWallet);
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
+
// TODO: this will fail if it's not created with ethers 'any' network, replace with the new signer when possible
|
|
75
|
+
return account.signer;
|
|
74
76
|
}
|
|
75
77
|
catch {
|
|
76
|
-
return
|
|
78
|
+
return account.signer;
|
|
77
79
|
}
|
|
78
|
-
}, [account.signer
|
|
80
|
+
}, [account.signer, currentWallet, walletManagement]);
|
|
79
81
|
const addChain = (0, react_1.useCallback)(async (chainId) => {
|
|
80
82
|
try {
|
|
81
83
|
if (walletManagement?.addChain) {
|
|
@@ -6,7 +6,7 @@ export interface WalletContextProps {
|
|
|
6
6
|
addChain(chainId: number): Promise<boolean>;
|
|
7
7
|
addToken(chainId: number, token: StaticToken): Promise<void>;
|
|
8
8
|
disconnect(wallet?: Wallet): void;
|
|
9
|
-
switchChain(chainId: number): Promise<
|
|
9
|
+
switchChain(chainId: number): Promise<Signer | undefined>;
|
|
10
10
|
connect(wallet?: Wallet | undefined): Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
export interface WalletAccount {
|