@lifi/widget 3.40.8 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -50
- package/dist/esm/AppDefault.d.ts +8 -0
- package/dist/esm/AppDefault.js +231 -14
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppLayout.d.ts +1 -0
- package/dist/esm/AppLayout.js +19 -0
- package/dist/esm/AppLayout.js.map +1 -0
- package/dist/esm/AppProvider.js +7 -20
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactionItem.js +9 -6
- package/dist/esm/components/ActiveTransactions/ActiveTransactionItem.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.js +2 -2
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInput.js +5 -7
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -1
- package/dist/esm/components/AppContainer.d.ts +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.d.ts +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.d.ts +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.d.ts +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/Card.d.ts +1 -1
- package/dist/esm/components/Card/CardButton.style.d.ts +2 -2
- package/dist/esm/components/Card/CardHeader.d.ts +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +3 -3
- package/dist/esm/components/Card/CardLabel.d.ts +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js +8 -3
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +3 -3
- package/dist/esm/components/Chains/ChainList.style.d.ts +4 -4
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +7 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.js +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.d.ts +1 -1
- package/dist/esm/components/Header/BackButton.d.ts +1 -2
- package/dist/esm/components/Header/BackButton.js +16 -2
- package/dist/esm/components/Header/BackButton.js.map +1 -1
- package/dist/esm/components/Header/DisconnectIconButton.d.ts +1 -1
- package/dist/esm/components/Header/DisconnectIconButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +3 -3
- package/dist/esm/components/Header/NavigationHeader.js +7 -13
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.js +3 -3
- package/dist/esm/components/Header/SettingsButton.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.d.ts +2 -2
- package/dist/esm/components/Header/TransactionHistoryButton.js +3 -3
- package/dist/esm/components/Header/TransactionHistoryButton.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/ListItem/ListItem.d.ts +1 -1
- package/dist/esm/components/ListItem/ListItemButton.d.ts +1 -1
- package/dist/esm/components/ListItemButton.d.ts +1 -1
- package/dist/esm/components/Messages/GasSufficiencyMessage.js +1 -1
- package/dist/esm/components/Messages/GasSufficiencyMessage.js.map +1 -1
- package/dist/esm/components/PageContainer.d.ts +1 -1
- package/dist/esm/components/PageEntered.js +1 -1
- package/dist/esm/components/PageEntered.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js +0 -9
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js +1 -3
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/Routes/Routes.js +3 -4
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js +1 -2
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.js +4 -3
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.d.ts +2 -2
- package/dist/esm/components/SelectChainAndToken.js +2 -3
- package/dist/esm/components/SelectChainAndToken.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.js +10 -10
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -3
- package/dist/esm/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +10 -8
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/SettingsListItemButton.d.ts +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +4 -4
- package/dist/esm/components/Step/CircularProgress.d.ts +3 -3
- package/dist/esm/components/Step/CircularProgress.js +8 -8
- package/dist/esm/components/Step/CircularProgress.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.d.ts +2 -2
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/Step/Step.js +8 -11
- package/dist/esm/components/Step/Step.js.map +1 -1
- package/dist/esm/components/Step/StepAction.d.ts +5 -0
- package/dist/esm/components/Step/{StepProcess.js → StepAction.js} +16 -12
- package/dist/esm/components/Step/StepAction.js.map +1 -0
- package/dist/esm/components/StepActions/StepActions.js +3 -2
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.style.d.ts +2 -2
- package/dist/esm/components/StepDivider/StepDivider.style.d.ts +1 -1
- package/dist/esm/components/Tabs/NavigationTabs.d.ts +4 -4
- package/dist/esm/components/Tabs/Tabs.style.d.ts +3 -3
- package/dist/esm/components/Timer/StepTimer.js +26 -74
- package/dist/esm/components/Timer/StepTimer.js.map +1 -1
- package/dist/esm/components/Token/Token.style.d.ts +1 -1
- package/dist/esm/components/TokenList/PinTokenButton.d.ts +6 -0
- package/dist/esm/components/TokenList/PinTokenButton.js +29 -0
- package/dist/esm/components/TokenList/PinTokenButton.js.map +1 -0
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.d.ts +2 -2
- package/dist/esm/components/TokenList/TokenList.js +13 -5
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.d.ts +6 -6
- package/dist/esm/components/TokenList/TokenListItem.js +5 -4
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +63 -38
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +2 -3
- package/dist/esm/components/TokenList/useTokenSelect.js +2 -3
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.d.ts +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.d.ts +1 -1
- package/dist/esm/components/TransactionDetails.js +3 -2
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useActionMessage.d.ts +5 -0
- package/dist/esm/hooks/useActionMessage.js +18 -0
- package/dist/esm/hooks/useActionMessage.js.map +1 -0
- package/dist/esm/hooks/useAddressActivity.js +18 -9
- package/dist/esm/hooks/useAddressActivity.js.map +1 -1
- package/dist/esm/hooks/useAddressValidation.js +5 -2
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +2 -1
- package/dist/esm/hooks/useAvailableChains.js +32 -11
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useExplorer.js +1 -2
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +3 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.d.ts +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.js +4 -4
- package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/dist/esm/hooks/useGasRecommendation.js +3 -1
- package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js +21 -15
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useHasChainExpansion.d.ts +1 -1
- package/dist/esm/hooks/useHasChainExpansion.js +11 -3
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -1
- package/dist/esm/hooks/useInitializeSDKProviders.d.ts +1 -0
- package/dist/esm/hooks/useInitializeSDKProviders.js +11 -0
- package/dist/esm/hooks/useInitializeSDKProviders.js.map +1 -0
- package/dist/esm/hooks/useIsBatchingSupported.js +7 -3
- package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
- package/dist/esm/hooks/useIsContractAddress.js +12 -9
- package/dist/esm/hooks/useIsContractAddress.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -4
- package/dist/esm/hooks/useNavigateBack.js +9 -23
- package/dist/esm/hooks/useNavigateBack.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +12 -13
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +23 -60
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.js +3 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +3 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.d.ts +3 -3
- package/dist/esm/hooks/useTokenBalance.js +8 -6
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.d.ts +1 -0
- package/dist/esm/hooks/useTokenBalances.js +70 -5
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js +4 -2
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +3 -1
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +11 -5
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +3 -1
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/hooks/useTransactionDetails.js +3 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionHistory.js +3 -1
- package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +6 -0
- package/dist/esm/hooks/useWidgetChains.js +5 -0
- package/dist/esm/hooks/useWidgetChains.js.map +1 -0
- package/dist/esm/i18n/bn.json +4 -1
- package/dist/esm/i18n/de.json +4 -1
- package/dist/esm/i18n/en.json +3 -14
- package/dist/esm/i18n/es.json +4 -1
- package/dist/esm/i18n/fr.json +4 -1
- package/dist/esm/i18n/hi.json +4 -1
- package/dist/esm/i18n/id.json +4 -1
- package/dist/esm/i18n/it.json +4 -1
- package/dist/esm/i18n/ja.json +4 -1
- package/dist/esm/i18n/ko.json +4 -1
- package/dist/esm/i18n/pl.json +4 -1
- package/dist/esm/i18n/pt.json +4 -1
- package/dist/esm/i18n/th.json +4 -1
- package/dist/esm/i18n/tr.json +4 -1
- package/dist/esm/i18n/uk.json +4 -1
- package/dist/esm/i18n/vi.json +4 -1
- package/dist/esm/i18n/zh.json +4 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pages/LanguagesPage.js +7 -6
- package/dist/esm/pages/LanguagesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js +1 -3
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +5 -5
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.d.ts +1 -2
- package/dist/esm/pages/RoutesPage/RoutesPage.js +5 -4
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +2 -13
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +3 -5
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js +4 -3
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +4 -7
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.d.ts +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js +5 -5
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +8 -8
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +4 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/LanguageSetting.js +2 -2
- package/dist/esm/pages/SettingsPage/LanguageSetting.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.d.ts +12 -2
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +10 -4
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.d.ts +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js +2 -2
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js +5 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +3 -3
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.d.ts +3 -3
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +9 -9
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.d.ts +1 -0
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js +58 -0
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js.map +1 -0
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +7 -8
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryItem.js +4 -3
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryItem.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.d.ts +1 -2
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +13 -12
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.d.ts +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +13 -6
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +1 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/SDKClientProvider.d.ts +4 -0
- package/dist/esm/providers/SDKClientProvider.js +29 -0
- package/dist/esm/providers/SDKClientProvider.js.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +7 -2
- package/dist/esm/providers/WalletProvider/WalletProvider.js +27 -11
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +15 -18
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js +0 -27
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/stores/StoreProvider.js +2 -1
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/types.d.ts +2 -3
- package/dist/esm/stores/chains/ChainOrderStore.js +17 -12
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.d.ts +0 -8
- package/dist/esm/stores/chains/createChainOrderStore.js +1 -5
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js +18 -8
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js +5 -50
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js +11 -31
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.d.ts +7 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js +32 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js.map +1 -0
- package/dist/esm/stores/form/types.d.ts +2 -3
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/header/types.d.ts +5 -3
- package/dist/esm/stores/header/useHeaderStore.js +14 -0
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.d.ts +4 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js +20 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.d.ts +19 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js +61 -0
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/types.d.ts +17 -0
- package/dist/esm/stores/pinnedTokens/types.js +2 -0
- package/dist/esm/stores/pinnedTokens/types.js.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -3
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js +2 -5
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useExecutingRoutesIds.js +2 -2
- package/dist/esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +2 -2
- package/dist/esm/stores/routes/utils.js +15 -15
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.d.ts +2 -3
- package/dist/esm/stores/settings/SettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.d.ts +2 -0
- package/dist/esm/stores/settings/createSettingsStore.js +2 -1
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +3 -3
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/types/events.d.ts +2 -10
- package/dist/esm/types/events.js +0 -1
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/token.d.ts +1 -0
- package/dist/esm/types/widget.d.ts +9 -16
- package/dist/esm/types/widget.js +1 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/chainType.d.ts +1 -2
- package/dist/esm/utils/chainType.js +1 -19
- package/dist/esm/utils/chainType.js.map +1 -1
- package/dist/esm/utils/converters.js +11 -18
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/format.d.ts +1 -0
- package/dist/esm/utils/format.js +2 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getActionMessage.d.ts +7 -0
- package/dist/esm/utils/getActionMessage.js +111 -0
- package/dist/esm/utils/getActionMessage.js.map +1 -0
- package/dist/esm/utils/getErrorMessage.d.ts +6 -0
- package/dist/esm/utils/getErrorMessage.js +118 -0
- package/dist/esm/utils/getErrorMessage.js.map +1 -0
- package/dist/esm/utils/prepareActions.d.ts +2 -0
- package/dist/esm/utils/prepareActions.js +24 -0
- package/dist/esm/utils/prepareActions.js.map +1 -0
- package/dist/esm/utils/tokenList.d.ts +3 -2
- package/dist/esm/utils/tokenList.js +104 -8
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/package.json +15 -23
- package/package.json.tmp +16 -28
- package/src/AppDefault.tsx +279 -31
- package/src/AppLayout.tsx +36 -0
- package/src/AppProvider.tsx +12 -40
- package/src/components/ActiveTransactions/ActiveTransactionItem.tsx +9 -6
- package/src/components/ActiveTransactions/ActiveTransactions.tsx +2 -2
- package/src/components/AmountInput/AmountInput.tsx +6 -8
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +1 -1
- package/src/components/Avatar/AccountAvatar.tsx +1 -1
- package/src/components/ChainSelect/ChainSelect.tsx +8 -4
- package/src/components/Chains/VirtualizedChainList.tsx +7 -3
- package/src/components/ContractComponent/ItemPrice.tsx +1 -2
- package/src/components/ContractComponent/NFT/NFT.tsx +1 -1
- package/src/components/Header/BackButton.tsx +15 -3
- package/src/components/Header/DisconnectIconButton.tsx +2 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/NavigationHeader.tsx +23 -46
- package/src/components/Header/SettingsButton.tsx +3 -3
- package/src/components/Header/TransactionHistoryButton.tsx +3 -3
- package/src/components/Header/WalletHeader.tsx +1 -1
- package/src/components/Messages/GasSufficiencyMessage.tsx +1 -1
- package/src/components/PageEntered.ts +1 -1
- package/src/components/ReverseTokensButton/ReverseTokensButton.tsx +0 -10
- package/src/components/RouteCard/RouteCard.tsx +1 -3
- package/src/components/Routes/Routes.tsx +3 -4
- package/src/components/Routes/RoutesContent.tsx +1 -2
- package/src/components/Routes/RoutesExpanded.tsx +4 -3
- package/src/components/SelectChainAndToken.tsx +2 -4
- package/src/components/SelectTokenButton/SelectTokenButton.tsx +11 -13
- package/src/components/SendToWallet/SendToWalletButton.tsx +9 -12
- package/src/components/Step/CircularProgress.style.tsx +3 -3
- package/src/components/Step/CircularProgress.tsx +11 -11
- package/src/components/Step/Step.tsx +13 -14
- package/src/components/Step/{StepProcess.tsx → StepAction.tsx} +20 -15
- package/src/components/StepActions/StepActions.tsx +3 -2
- package/src/components/Timer/StepTimer.tsx +43 -105
- package/src/components/TokenList/PinTokenButton.tsx +50 -0
- package/src/components/TokenList/TokenList.tsx +67 -59
- package/src/components/TokenList/TokenListItem.tsx +20 -11
- package/src/components/TokenList/VirtualizedTokenList.tsx +80 -53
- package/src/components/TokenList/types.ts +2 -3
- package/src/components/TokenList/useTokenSelect.ts +2 -8
- package/src/components/TokenRate/TokenRate.tsx +1 -2
- package/src/components/TransactionDetails.tsx +3 -2
- package/src/config/version.ts +1 -1
- package/src/hooks/useActionMessage.ts +33 -0
- package/src/hooks/useAddressActivity.ts +19 -11
- package/src/hooks/useAddressValidation.ts +9 -2
- package/src/hooks/useAvailableChains.ts +42 -14
- package/src/hooks/useExplorer.ts +1 -2
- package/src/hooks/useFilteredByTokenBalances.ts +3 -1
- package/src/hooks/useFromTokenSufficiency.ts +8 -5
- package/src/hooks/useGasRecommendation.ts +3 -0
- package/src/hooks/useGasSufficiency.ts +23 -13
- package/src/hooks/useHasChainExpansion.ts +13 -3
- package/src/hooks/useInitializeSDKProviders.ts +12 -0
- package/src/hooks/useIsBatchingSupported.ts +11 -5
- package/src/hooks/useIsContractAddress.ts +14 -10
- package/src/hooks/useNavigateBack.ts +11 -29
- package/src/hooks/useRouteExecution.ts +12 -16
- package/src/hooks/useRoutes.ts +26 -74
- package/src/hooks/useToAddressAutoPopulate.ts +3 -1
- package/src/hooks/useToAddressRequirements.ts +3 -2
- package/src/hooks/useTokenBalance.ts +18 -3
- package/src/hooks/useTokenBalances.ts +91 -5
- package/src/hooks/useTokenBalancesQueries.ts +4 -2
- package/src/hooks/useTokenSearch.ts +10 -3
- package/src/hooks/useTokens.ts +11 -6
- package/src/hooks/useTools.ts +3 -1
- package/src/hooks/useTransactionDetails.ts +3 -0
- package/src/hooks/useTransactionHistory.ts +3 -0
- package/src/hooks/useWidgetChains.ts +6 -0
- package/src/i18n/bn.json +4 -1
- package/src/i18n/de.json +4 -1
- package/src/i18n/en.json +3 -14
- package/src/i18n/es.json +4 -1
- package/src/i18n/fr.json +4 -1
- package/src/i18n/hi.json +4 -1
- package/src/i18n/id.json +4 -1
- package/src/i18n/it.json +4 -1
- package/src/i18n/ja.json +4 -1
- package/src/i18n/ko.json +4 -1
- package/src/i18n/pl.json +4 -1
- package/src/i18n/pt.json +4 -1
- package/src/i18n/th.json +4 -1
- package/src/i18n/tr.json +4 -1
- package/src/i18n/uk.json +4 -1
- package/src/i18n/vi.json +4 -1
- package/src/i18n/zh.json +4 -1
- package/src/index.ts +2 -8
- package/src/pages/LanguagesPage.tsx +2 -1
- package/src/pages/MainPage/MainPage.tsx +1 -3
- package/src/pages/MainPage/ReviewButton.tsx +5 -5
- package/src/pages/RoutesPage/RoutesPage.tsx +6 -6
- package/src/pages/SelectChainPage/SelectChainPage.tsx +1 -1
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +4 -28
- package/src/pages/SendToWallet/BookmarksPage.tsx +3 -5
- package/src/pages/SendToWallet/ConfirmAddressSheet.tsx +1 -1
- package/src/pages/SendToWallet/ConnectedWalletsPage.tsx +5 -4
- package/src/pages/SendToWallet/RecentWalletsPage.tsx +4 -7
- package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +1 -1
- package/src/pages/SendToWallet/SendToWalletPage.tsx +6 -6
- package/src/pages/SettingsPage/BridgeAndExchangeSettings.tsx +4 -2
- package/src/pages/SettingsPage/LanguageSetting.tsx +2 -2
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +63 -33
- package/src/pages/SettingsPage/SettingsCard/SettingsAccordian.tsx +3 -2
- package/src/pages/SettingsPage/SettingsPage.tsx +7 -0
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +10 -10
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +5 -5
- package/src/pages/SettingsPage/SmallBalanceFilterSettings.tsx +116 -0
- package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -8
- package/src/pages/TransactionHistoryPage/TransactionHistoryItem.tsx +4 -3
- package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +1 -2
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +15 -14
- package/src/pages/TransactionPage/TransactionPage.tsx +14 -7
- package/src/providers/I18nProvider/I18nProvider.tsx +1 -0
- package/src/providers/SDKClientProvider.tsx +41 -0
- package/src/providers/WalletProvider/WalletProvider.tsx +61 -20
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +20 -18
- package/src/providers/WidgetProvider/WidgetProvider.tsx +0 -29
- package/src/stores/StoreProvider.tsx +10 -7
- package/src/stores/bookmarks/types.ts +2 -3
- package/src/stores/chains/ChainOrderStore.tsx +29 -16
- package/src/stores/chains/createChainOrderStore.ts +1 -5
- package/src/stores/form/FormStore.tsx +19 -18
- package/src/stores/form/FormUpdater.tsx +5 -73
- package/src/stores/form/URLSearchParamsBuilder.tsx +12 -39
- package/src/stores/form/getDefaultValuesFromQueryString.ts +48 -0
- package/src/stores/form/types.ts +2 -5
- package/src/stores/header/types.ts +5 -3
- package/src/stores/header/useHeaderStore.tsx +14 -0
- package/src/stores/pinnedTokens/PinnedTokensStore.tsx +38 -0
- package/src/stores/pinnedTokens/createPinnedTokensStore.ts +71 -0
- package/src/stores/pinnedTokens/types.ts +20 -0
- package/src/stores/routes/RouteExecutionStore.tsx +2 -5
- package/src/stores/routes/createRouteExecutionStore.ts +4 -5
- package/src/stores/routes/useExecutingRoutesIds.ts +2 -2
- package/src/stores/routes/utils.ts +21 -19
- package/src/stores/settings/SettingsStore.tsx +2 -3
- package/src/stores/settings/createSettingsStore.ts +2 -1
- package/src/stores/settings/types.ts +3 -5
- package/src/types/events.ts +2 -11
- package/src/types/token.ts +1 -0
- package/src/types/widget.ts +18 -26
- package/src/utils/chainType.ts +1 -24
- package/src/utils/converters.ts +14 -20
- package/src/utils/format.ts +3 -1
- package/src/utils/getActionMessage.ts +168 -0
- package/src/utils/getErrorMessage.ts +144 -0
- package/src/utils/prepareActions.ts +27 -0
- package/src/utils/tokenList.ts +117 -11
- package/dist/esm/AppRoutes.d.ts +0 -1
- package/dist/esm/AppRoutes.js +0 -111
- package/dist/esm/AppRoutes.js.map +0 -1
- package/dist/esm/components/Step/StepProcess.d.ts +0 -5
- package/dist/esm/components/Step/StepProcess.js.map +0 -1
- package/dist/esm/config/baseAccount.d.ts +0 -2
- package/dist/esm/config/baseAccount.js +0 -6
- package/dist/esm/config/baseAccount.js.map +0 -1
- package/dist/esm/config/coinbase.d.ts +0 -2
- package/dist/esm/config/coinbase.js +0 -6
- package/dist/esm/config/coinbase.js.map +0 -1
- package/dist/esm/config/metaMask.d.ts +0 -2
- package/dist/esm/config/metaMask.js +0 -11
- package/dist/esm/config/metaMask.js.map +0 -1
- package/dist/esm/config/walletConnect.d.ts +0 -2
- package/dist/esm/config/walletConnect.js +0 -4
- package/dist/esm/config/walletConnect.js.map +0 -1
- package/dist/esm/hooks/useExpansionRoutes.d.ts +0 -2
- package/dist/esm/hooks/useExpansionRoutes.js +0 -26
- package/dist/esm/hooks/useExpansionRoutes.js.map +0 -1
- package/dist/esm/hooks/useInternalWalletProvider.d.ts +0 -1
- package/dist/esm/hooks/useInternalWalletProvider.js +0 -6
- package/dist/esm/hooks/useInternalWalletProvider.js.map +0 -1
- package/dist/esm/hooks/useProcessMessage.d.ts +0 -11
- package/dist/esm/hooks/useProcessMessage.js +0 -199
- package/dist/esm/hooks/useProcessMessage.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.js +0 -31
- package/dist/esm/providers/WalletProvider/EVMBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/EVMExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/EVMExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/EVMProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/EVMProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js +0 -62
- package/dist/esm/providers/WalletProvider/SDKProviders.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.js +0 -27
- package/dist/esm/providers/WalletProvider/SVMBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SVMExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/SVMExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SVMProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/SVMProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js +0 -17
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SuiExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/SuiExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/SuiProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/SuiProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.js +0 -18
- package/dist/esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
- package/dist/esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.d.ts +0 -2
- package/dist/esm/providers/WalletProvider/UTXOProvider.js +0 -20
- package/dist/esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
- package/src/AppRoutes.tsx +0 -112
- package/src/config/baseAccount.ts +0 -7
- package/src/config/coinbase.ts +0 -7
- package/src/config/metaMask.ts +0 -13
- package/src/config/walletConnect.ts +0 -5
- package/src/hooks/useExpansionRoutes.ts +0 -29
- package/src/hooks/useInternalWalletProvider.ts +0 -6
- package/src/hooks/useProcessMessage.ts +0 -273
- package/src/providers/WalletProvider/EVMBaseProvider.tsx +0 -41
- package/src/providers/WalletProvider/EVMExternalContext.ts +0 -3
- package/src/providers/WalletProvider/EVMProvider.tsx +0 -28
- package/src/providers/WalletProvider/SDKProviders.tsx +0 -86
- package/src/providers/WalletProvider/SVMBaseProvider.tsx +0 -37
- package/src/providers/WalletProvider/SVMExternalContext.ts +0 -3
- package/src/providers/WalletProvider/SVMProvider.tsx +0 -29
- package/src/providers/WalletProvider/SuiBaseProvider.tsx +0 -31
- package/src/providers/WalletProvider/SuiExternalContext.ts +0 -3
- package/src/providers/WalletProvider/SuiProvider.tsx +0 -28
- package/src/providers/WalletProvider/UTXOBaseProvider.tsx +0 -29
- package/src/providers/WalletProvider/UTXOExternalContext.ts +0 -3
- package/src/providers/WalletProvider/UTXOProvider.tsx +0 -28
package/src/types/widget.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
Token,
|
|
13
13
|
} from '@lifi/sdk'
|
|
14
14
|
import type { WalletMenuOpenArgs } from '@lifi/wallet-management'
|
|
15
|
+
import type { WidgetProviderProps } from '@lifi/widget-provider'
|
|
15
16
|
import type {
|
|
16
17
|
Components,
|
|
17
18
|
PaletteMode,
|
|
@@ -21,14 +22,13 @@ import type {
|
|
|
21
22
|
Theme,
|
|
22
23
|
} from '@mui/material'
|
|
23
24
|
import type { TypographyVariantsOptions } from '@mui/material/styles'
|
|
24
|
-
import type { CSSProperties, FC, ReactNode, RefObject } from 'react'
|
|
25
25
|
import type {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from '
|
|
26
|
+
CSSProperties,
|
|
27
|
+
FC,
|
|
28
|
+
PropsWithChildren,
|
|
29
|
+
ReactNode,
|
|
30
|
+
RefObject,
|
|
31
|
+
} from 'react'
|
|
32
32
|
import type {
|
|
33
33
|
LanguageKey,
|
|
34
34
|
LanguageResources,
|
|
@@ -41,9 +41,9 @@ export type SplitSubvariant = 'bridge' | 'swap'
|
|
|
41
41
|
export type SplitSubvariantOptions = {
|
|
42
42
|
defaultTab: SplitSubvariant
|
|
43
43
|
}
|
|
44
|
-
export type CustomSubvariant = 'checkout' | 'deposit'
|
|
44
|
+
export type CustomSubvariant = 'checkout' | 'deposit'
|
|
45
45
|
export type WideSubvariant = {
|
|
46
|
-
|
|
46
|
+
disableChainSidebar?: boolean
|
|
47
47
|
}
|
|
48
48
|
export interface SubvariantOptions {
|
|
49
49
|
/**
|
|
@@ -133,6 +133,7 @@ export enum HiddenUI {
|
|
|
133
133
|
SearchTokenInput = 'searchTokenInput',
|
|
134
134
|
InsufficientGasMessage = 'insufficientGasMessage',
|
|
135
135
|
ContactSupport = 'contactSupport',
|
|
136
|
+
HideSmallBalances = 'hideSmallBalances',
|
|
136
137
|
AllNetworks = 'allNetworks',
|
|
137
138
|
}
|
|
138
139
|
export type HiddenUIType = `${HiddenUI}`
|
|
@@ -149,12 +150,8 @@ export type DefaultUI = {
|
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
export interface WidgetWalletConfig {
|
|
153
|
+
walletEcosystemsOrder?: Record<string, ChainType[]>
|
|
152
154
|
onConnect?(args?: WalletMenuOpenArgs): void
|
|
153
|
-
walletConnect?: WalletConnectParameters
|
|
154
|
-
coinbase?: CoinbaseWalletParameters
|
|
155
|
-
metaMask?: MetaMaskParameters
|
|
156
|
-
baseAccount?: BaseAccountParameters
|
|
157
|
-
porto?: Partial<PortoParameters>
|
|
158
155
|
/**
|
|
159
156
|
* Determines whether the widget should provide partial wallet management functionality.
|
|
160
157
|
*
|
|
@@ -181,12 +178,7 @@ export interface WidgetSDKConfig
|
|
|
181
178
|
| 'widgetVersion'
|
|
182
179
|
> {
|
|
183
180
|
routeOptions?: Omit<RouteOptions, 'bridges' | 'exchanges'>
|
|
184
|
-
executionOptions?: Pick<
|
|
185
|
-
ExecutionOptions,
|
|
186
|
-
| 'disableMessageSigning'
|
|
187
|
-
| 'updateTransactionRequestHook'
|
|
188
|
-
| 'getContractCalls'
|
|
189
|
-
>
|
|
181
|
+
executionOptions?: Pick<ExecutionOptions, 'updateTransactionRequestHook'>
|
|
190
182
|
}
|
|
191
183
|
|
|
192
184
|
export interface WidgetContractTool {
|
|
@@ -307,6 +299,10 @@ export type ExplorerUrl =
|
|
|
307
299
|
addressPath?: string
|
|
308
300
|
}
|
|
309
301
|
|
|
302
|
+
export type WidgetProvider = (
|
|
303
|
+
props: PropsWithChildren<WidgetProviderProps>
|
|
304
|
+
) => ReactNode
|
|
305
|
+
|
|
310
306
|
export interface WidgetConfig {
|
|
311
307
|
fromChain?: number
|
|
312
308
|
toChain?: number
|
|
@@ -319,16 +315,12 @@ export interface WidgetConfig {
|
|
|
319
315
|
toAmount?: number | string
|
|
320
316
|
formUpdateKey?: string
|
|
321
317
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
*/
|
|
318
|
+
providers?: WidgetProvider[]
|
|
319
|
+
|
|
325
320
|
contractCalls?: ContractCall[]
|
|
326
321
|
contractComponent?: ReactNode
|
|
327
322
|
contractSecondaryComponent?: ReactNode
|
|
328
323
|
contractCompactComponent?: ReactNode
|
|
329
|
-
/**
|
|
330
|
-
* @deprecated Use `getContractCalls` inside the SDK config `executionOptions` instead.
|
|
331
|
-
*/
|
|
332
324
|
contractTool?: WidgetContractTool
|
|
333
325
|
integrator: string
|
|
334
326
|
apiKey?: string
|
package/src/utils/chainType.ts
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChainId, ChainType, isSVMAddress } from '@lifi/sdk'
|
|
3
|
-
import { isValidSuiAddress } from '@mysten/sui/utils'
|
|
4
|
-
import { isAddress as isEVMAddress } from 'viem'
|
|
5
|
-
|
|
6
|
-
const chainTypeAddressValidation = {
|
|
7
|
-
[ChainType.EVM]: isEVMAddress,
|
|
8
|
-
[ChainType.SVM]: isSVMAddress,
|
|
9
|
-
[ChainType.MVM]: isValidSuiAddress,
|
|
10
|
-
[ChainType.UTXO]: isUTXOAddress,
|
|
11
|
-
[ChainType.TVM]: () => false,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const getChainTypeFromAddress = (
|
|
15
|
-
address: string
|
|
16
|
-
): ChainType | undefined => {
|
|
17
|
-
for (const chainType in chainTypeAddressValidation) {
|
|
18
|
-
const isChainType =
|
|
19
|
-
chainTypeAddressValidation[chainType as ChainType](address)
|
|
20
|
-
if (isChainType) {
|
|
21
|
-
return chainType as ChainType
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { ChainId, ChainType } from '@lifi/sdk'
|
|
25
2
|
|
|
26
3
|
export const defaultChainIdsByType = {
|
|
27
4
|
[ChainType.EVM]: ChainId.ETH,
|
package/src/utils/converters.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
ExecutionAction,
|
|
3
|
+
ExecutionActionStatus,
|
|
2
4
|
ExtendedTransactionInfo,
|
|
3
5
|
FeeCost,
|
|
4
6
|
FullStatusData,
|
|
5
|
-
Process,
|
|
6
|
-
ProcessStatus,
|
|
7
7
|
Substatus,
|
|
8
8
|
TokenAmount,
|
|
9
9
|
ToolsResponse,
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
import type { RouteExecution } from '../stores/routes/types.js'
|
|
12
12
|
import { formatTokenPrice } from './format.js'
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const buildActionsFromTxHistory = (tx: FullStatusData): ExecutionAction[] => {
|
|
15
15
|
const sending = tx.sending as ExtendedTransactionInfo
|
|
16
16
|
const receiving = tx.receiving as ExtendedTransactionInfo
|
|
17
17
|
|
|
@@ -19,53 +19,48 @@ const buildProcessFromTxHistory = (tx: FullStatusData): Process[] => {
|
|
|
19
19
|
return []
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const actionStatus: ExecutionActionStatus =
|
|
23
|
+
tx.status === 'DONE' ? 'DONE' : 'FAILED'
|
|
23
24
|
const substatus: Substatus =
|
|
24
|
-
|
|
25
|
+
actionStatus === 'FAILED' ? 'UNKNOWN_ERROR' : 'COMPLETED'
|
|
25
26
|
|
|
26
27
|
if (sending.chainId === receiving.chainId) {
|
|
27
28
|
return [
|
|
28
29
|
{
|
|
29
30
|
type: 'SWAP', // operations on same chain will be swaps
|
|
30
|
-
startedAt: sending.timestamp ?? Date.now(),
|
|
31
31
|
message: '',
|
|
32
|
-
status:
|
|
32
|
+
status: actionStatus,
|
|
33
33
|
chainId: sending.chainId,
|
|
34
34
|
txHash: sending.txHash,
|
|
35
35
|
txLink: sending.txLink,
|
|
36
|
-
doneAt: receiving.timestamp ?? Date.now(),
|
|
37
36
|
substatus,
|
|
38
37
|
substatusMessage: '',
|
|
39
38
|
},
|
|
40
39
|
]
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
const
|
|
42
|
+
const actions: ExecutionAction[] = [
|
|
44
43
|
{
|
|
45
44
|
type: 'CROSS_CHAIN', // first step of bridging, ignoring the approvals
|
|
46
|
-
startedAt: sending.timestamp ?? Date.now(),
|
|
47
45
|
message: '',
|
|
48
|
-
status:
|
|
46
|
+
status: actionStatus, // can be FAILED
|
|
49
47
|
chainId: sending.chainId,
|
|
50
48
|
txHash: sending.txHash,
|
|
51
49
|
txLink: sending.txLink,
|
|
52
|
-
doneAt: sending.timestamp,
|
|
53
50
|
},
|
|
54
51
|
{
|
|
55
52
|
type: 'RECEIVING_CHAIN', // final step of bridging, post swaps
|
|
56
|
-
startedAt: receiving.timestamp ?? Date.now(),
|
|
57
53
|
message: '',
|
|
58
|
-
status:
|
|
54
|
+
status: actionStatus,
|
|
59
55
|
substatus,
|
|
60
56
|
substatusMessage: '',
|
|
61
|
-
doneAt: receiving.timestamp ?? Date.now(),
|
|
62
57
|
chainId: receiving.chainId,
|
|
63
58
|
txHash: receiving.txHash,
|
|
64
59
|
txLink: receiving.txLink,
|
|
65
60
|
},
|
|
66
61
|
]
|
|
67
62
|
|
|
68
|
-
return
|
|
63
|
+
return actions
|
|
69
64
|
}
|
|
70
65
|
|
|
71
66
|
export const buildRouteFromTxHistory = (
|
|
@@ -155,7 +150,7 @@ export const buildRouteFromTxHistory = (
|
|
|
155
150
|
gasCostUSD: sending.gasAmountUSD,
|
|
156
151
|
steps: [
|
|
157
152
|
{
|
|
158
|
-
id:
|
|
153
|
+
id: (tx as FullStatusData).transactionId,
|
|
159
154
|
type: 'lifi',
|
|
160
155
|
tool: tx.tool,
|
|
161
156
|
toolDetails: usedTool,
|
|
@@ -181,7 +176,7 @@ export const buildRouteFromTxHistory = (
|
|
|
181
176
|
},
|
|
182
177
|
includedSteps: [
|
|
183
178
|
{
|
|
184
|
-
id:
|
|
179
|
+
id: (tx as FullStatusData).transactionId,
|
|
185
180
|
type: sending.chainId === receiving.chainId ? 'swap' : 'cross',
|
|
186
181
|
action: {
|
|
187
182
|
fromChainId: sending.chainId,
|
|
@@ -209,8 +204,7 @@ export const buildRouteFromTxHistory = (
|
|
|
209
204
|
execution: {
|
|
210
205
|
status: 'DONE', // can be FAILED
|
|
211
206
|
startedAt: sending.timestamp ?? Date.now(),
|
|
212
|
-
|
|
213
|
-
process: buildProcessFromTxHistory(tx),
|
|
207
|
+
actions: buildActionsFromTxHistory(tx),
|
|
214
208
|
fromAmount: sending.amount,
|
|
215
209
|
toAmount: receiving.amount,
|
|
216
210
|
toToken: receiving.token,
|
package/src/utils/format.ts
CHANGED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExecutionActionStatus,
|
|
3
|
+
ExecutionActionType,
|
|
4
|
+
LiFiStepExtended,
|
|
5
|
+
StatusMessage,
|
|
6
|
+
Substatus,
|
|
7
|
+
} from '@lifi/sdk'
|
|
8
|
+
import type { TFunction } from 'i18next'
|
|
9
|
+
import type { SubvariantOptions, WidgetSubvariant } from '../types/widget'
|
|
10
|
+
|
|
11
|
+
export function getActionMessage(
|
|
12
|
+
t: TFunction,
|
|
13
|
+
step: LiFiStepExtended,
|
|
14
|
+
type: ExecutionActionType,
|
|
15
|
+
status: ExecutionActionStatus,
|
|
16
|
+
substatus?: Substatus,
|
|
17
|
+
subvariant?: WidgetSubvariant,
|
|
18
|
+
subvariantOptions?: SubvariantOptions
|
|
19
|
+
): {
|
|
20
|
+
title?: string
|
|
21
|
+
message?: string
|
|
22
|
+
} {
|
|
23
|
+
const messageWithSubstatus = substatus
|
|
24
|
+
? actionSubstatusMessages[status as StatusMessage]?.[substatus]?.(t)
|
|
25
|
+
: undefined
|
|
26
|
+
const title =
|
|
27
|
+
messageWithSubstatus ??
|
|
28
|
+
actionStatusMessages[type]?.[status]?.(
|
|
29
|
+
t,
|
|
30
|
+
step,
|
|
31
|
+
subvariant,
|
|
32
|
+
subvariantOptions
|
|
33
|
+
)
|
|
34
|
+
return { title }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const actionStatusMessages: Record<
|
|
38
|
+
ExecutionActionType,
|
|
39
|
+
Partial<
|
|
40
|
+
Record<
|
|
41
|
+
ExecutionActionStatus,
|
|
42
|
+
(
|
|
43
|
+
t: TFunction,
|
|
44
|
+
step: LiFiStepExtended,
|
|
45
|
+
subvariant?: WidgetSubvariant,
|
|
46
|
+
subvariantOptions?: SubvariantOptions
|
|
47
|
+
) => string
|
|
48
|
+
>
|
|
49
|
+
>
|
|
50
|
+
> = {
|
|
51
|
+
CHECK_ALLOWANCE: {
|
|
52
|
+
STARTED: (t, step) =>
|
|
53
|
+
t('main.process.tokenAllowance.started', {
|
|
54
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
55
|
+
}),
|
|
56
|
+
PENDING: (t, step) =>
|
|
57
|
+
t('main.process.tokenAllowance.pending', {
|
|
58
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
59
|
+
}),
|
|
60
|
+
DONE: (t, step) =>
|
|
61
|
+
t('main.process.tokenAllowance.pending', {
|
|
62
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
NATIVE_PERMIT: {
|
|
66
|
+
STARTED: (t) => t('main.process.permit.started'),
|
|
67
|
+
ACTION_REQUIRED: (t) => t('main.process.permit.actionRequired'),
|
|
68
|
+
PENDING: (t) => t('main.process.permit.pending'),
|
|
69
|
+
DONE: (t) => t('main.process.permit.done'),
|
|
70
|
+
},
|
|
71
|
+
RESET_ALLOWANCE: {
|
|
72
|
+
STARTED: (t, step) =>
|
|
73
|
+
t('main.process.tokenAllowance.pending', {
|
|
74
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
75
|
+
}),
|
|
76
|
+
RESET_REQUIRED: (t, step) =>
|
|
77
|
+
t('main.process.tokenAllowance.resetRequired', {
|
|
78
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
79
|
+
}),
|
|
80
|
+
PENDING: (t, step) =>
|
|
81
|
+
t('main.process.tokenAllowance.pending', {
|
|
82
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
83
|
+
}),
|
|
84
|
+
DONE: (t, step) =>
|
|
85
|
+
t('main.process.tokenAllowance.pending', {
|
|
86
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
87
|
+
}),
|
|
88
|
+
},
|
|
89
|
+
SET_ALLOWANCE: {
|
|
90
|
+
STARTED: (t, step) =>
|
|
91
|
+
t('main.process.tokenAllowance.pending', {
|
|
92
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
93
|
+
}),
|
|
94
|
+
ACTION_REQUIRED: (t, step) =>
|
|
95
|
+
t('main.process.tokenAllowance.actionRequired', {
|
|
96
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
97
|
+
}),
|
|
98
|
+
PENDING: (t, step) =>
|
|
99
|
+
t('main.process.tokenAllowance.pending', {
|
|
100
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
101
|
+
}),
|
|
102
|
+
DONE: (t, step) =>
|
|
103
|
+
t('main.process.tokenAllowance.done', {
|
|
104
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
PERMIT: {
|
|
108
|
+
STARTED: (t) => t('main.process.permit.started'),
|
|
109
|
+
ACTION_REQUIRED: (t) => t('main.process.permit.actionRequired'),
|
|
110
|
+
PENDING: (t) => t('main.process.permit.pending'),
|
|
111
|
+
DONE: (t) => t('main.process.permit.done'),
|
|
112
|
+
},
|
|
113
|
+
SWAP: {
|
|
114
|
+
STARTED: (t) => t('main.process.swap.started'),
|
|
115
|
+
ACTION_REQUIRED: (t) => t('main.process.swap.actionRequired'),
|
|
116
|
+
MESSAGE_REQUIRED: (t) => t('main.process.swap.messageRequired'),
|
|
117
|
+
PENDING: (t) => t('main.process.swap.pending'),
|
|
118
|
+
DONE: (t, _, subvariant, subvariantOptions) =>
|
|
119
|
+
subvariant === 'custom'
|
|
120
|
+
? t(`main.process.${subvariantOptions?.custom ?? 'checkout'}.done`)
|
|
121
|
+
: t('main.process.swap.done'),
|
|
122
|
+
},
|
|
123
|
+
CROSS_CHAIN: {
|
|
124
|
+
STARTED: (t) => t('main.process.bridge.started'),
|
|
125
|
+
ACTION_REQUIRED: (t) => t('main.process.bridge.actionRequired'),
|
|
126
|
+
MESSAGE_REQUIRED: (t) => t('main.process.bridge.messageRequired'),
|
|
127
|
+
PENDING: (t) => t('main.process.bridge.pending'),
|
|
128
|
+
DONE: (t) => t('main.process.bridge.done'),
|
|
129
|
+
},
|
|
130
|
+
RECEIVING_CHAIN: {
|
|
131
|
+
STARTED: (t) => t('main.process.receivingChain.pending'),
|
|
132
|
+
PENDING: (t) => t('main.process.receivingChain.pending'),
|
|
133
|
+
DONE: (t, _, subvariant, subvariantOptions) =>
|
|
134
|
+
subvariant === 'custom'
|
|
135
|
+
? t(`main.process.${subvariantOptions?.custom ?? 'checkout'}.done`)
|
|
136
|
+
: t('main.process.receivingChain.done'),
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const actionSubstatusMessages: Record<
|
|
141
|
+
StatusMessage,
|
|
142
|
+
Partial<Record<Substatus, (t: TFunction) => string>>
|
|
143
|
+
> = {
|
|
144
|
+
PENDING: {
|
|
145
|
+
// BRIDGE_NOT_AVAILABLE: 'Bridge communication is temporarily unavailable.',
|
|
146
|
+
// CHAIN_NOT_AVAILABLE: 'RPC communication is temporarily unavailable.',
|
|
147
|
+
// REFUND_IN_PROGRESS:
|
|
148
|
+
// "The refund has been requested and it's being processed",
|
|
149
|
+
// WAIT_DESTINATION_TRANSACTION:
|
|
150
|
+
// 'The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain.',
|
|
151
|
+
// WAIT_SOURCE_CONFIRMATIONS:
|
|
152
|
+
// 'The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.',
|
|
153
|
+
},
|
|
154
|
+
DONE: {
|
|
155
|
+
// COMPLETED: 'The transfer is complete.',
|
|
156
|
+
PARTIAL: (t) => t('main.process.receivingChain.partial'),
|
|
157
|
+
REFUNDED: (t) => t('main.process.receivingChain.partial'),
|
|
158
|
+
},
|
|
159
|
+
FAILED: {
|
|
160
|
+
// TODO: should be moved to failed status
|
|
161
|
+
// NOT_PROCESSABLE_REFUND_NEEDED:
|
|
162
|
+
// 'The transfer cannot be completed successfully. A refund operation is required.',
|
|
163
|
+
// UNKNOWN_ERROR:
|
|
164
|
+
// 'An unexpected error occurred. Please seek assistance in the LI.FI discord server.',
|
|
165
|
+
},
|
|
166
|
+
INVALID: {},
|
|
167
|
+
NOT_FOUND: {},
|
|
168
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type EVMChain,
|
|
3
|
+
type ExecutionAction,
|
|
4
|
+
LiFiErrorCode,
|
|
5
|
+
type LiFiStepExtended,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import type { TFunction } from 'i18next'
|
|
8
|
+
import { formatTokenAmount, wrapLongWords } from '../utils/format.js'
|
|
9
|
+
|
|
10
|
+
export function getErrorMessage(
|
|
11
|
+
t: TFunction,
|
|
12
|
+
getChainById: (chainId: number) => EVMChain | undefined,
|
|
13
|
+
step: LiFiStepExtended,
|
|
14
|
+
failedAction?: ExecutionAction
|
|
15
|
+
) {
|
|
16
|
+
const error = failedAction?.error
|
|
17
|
+
if (!error) {
|
|
18
|
+
return {
|
|
19
|
+
title: t('error.title.unknown'),
|
|
20
|
+
message: t('error.message.unknown'),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const getDefaultErrorMessage = (key?: string) =>
|
|
25
|
+
`${t((key as any) ?? 'error.message.transactionNotSent')} ${t(
|
|
26
|
+
'error.message.remainInYourWallet',
|
|
27
|
+
{
|
|
28
|
+
amount: formatTokenAmount(
|
|
29
|
+
BigInt(step.action.fromAmount),
|
|
30
|
+
step.action.fromToken.decimals
|
|
31
|
+
),
|
|
32
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
33
|
+
chainName: getChainById(step.action.fromChainId)?.name ?? '',
|
|
34
|
+
}
|
|
35
|
+
)}`
|
|
36
|
+
|
|
37
|
+
let title = ''
|
|
38
|
+
let message = ''
|
|
39
|
+
switch (error.code) {
|
|
40
|
+
case LiFiErrorCode.AllowanceRequired:
|
|
41
|
+
title = t('error.title.allowanceRequired')
|
|
42
|
+
message = t('error.message.allowanceRequired', {
|
|
43
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
44
|
+
})
|
|
45
|
+
break
|
|
46
|
+
case LiFiErrorCode.BalanceError:
|
|
47
|
+
title = t('error.title.balanceIsTooLow')
|
|
48
|
+
message = getDefaultErrorMessage()
|
|
49
|
+
break
|
|
50
|
+
case LiFiErrorCode.ChainSwitchError:
|
|
51
|
+
title = t('error.title.chainSwitch')
|
|
52
|
+
message = getDefaultErrorMessage()
|
|
53
|
+
break
|
|
54
|
+
case LiFiErrorCode.GasLimitError:
|
|
55
|
+
title = t('error.title.gasLimitIsTooLow')
|
|
56
|
+
message = getDefaultErrorMessage()
|
|
57
|
+
break
|
|
58
|
+
case LiFiErrorCode.InsufficientFunds:
|
|
59
|
+
title = t('error.title.insufficientFunds')
|
|
60
|
+
message = `${t(
|
|
61
|
+
'error.message.insufficientFunds'
|
|
62
|
+
)} ${getDefaultErrorMessage()}`
|
|
63
|
+
break
|
|
64
|
+
case LiFiErrorCode.InsufficientGas:
|
|
65
|
+
title = t('error.title.insufficientGas')
|
|
66
|
+
message = `${t(
|
|
67
|
+
'error.message.insufficientFunds'
|
|
68
|
+
)} ${getDefaultErrorMessage()}`
|
|
69
|
+
break
|
|
70
|
+
case LiFiErrorCode.SlippageError:
|
|
71
|
+
title = t('error.title.slippageNotMet')
|
|
72
|
+
message = t('error.message.slippageThreshold')
|
|
73
|
+
break
|
|
74
|
+
case LiFiErrorCode.TransactionFailed:
|
|
75
|
+
title = t('error.title.transactionFailed')
|
|
76
|
+
message = t('error.message.transactionFailed')
|
|
77
|
+
break
|
|
78
|
+
case LiFiErrorCode.TransactionExpired:
|
|
79
|
+
title = t('error.title.transactionExpired')
|
|
80
|
+
message = t('error.message.transactionExpired')
|
|
81
|
+
break
|
|
82
|
+
case LiFiErrorCode.TransactionSimulationFailed:
|
|
83
|
+
title = t('error.title.transactionSimulationFailed')
|
|
84
|
+
message = t('error.message.transactionSimulationFailed')
|
|
85
|
+
break
|
|
86
|
+
case LiFiErrorCode.WalletChangedDuringExecution:
|
|
87
|
+
title = t('error.title.walletMismatch')
|
|
88
|
+
message = t('error.message.walletChangedDuringExecution')
|
|
89
|
+
break
|
|
90
|
+
case LiFiErrorCode.RateLimitExceeded:
|
|
91
|
+
title = t('error.title.rateLimitExceeded')
|
|
92
|
+
message = t('error.message.rateLimitExceeded')
|
|
93
|
+
break
|
|
94
|
+
case LiFiErrorCode.ThirdPartyError:
|
|
95
|
+
title = t('error.title.thirdPartyError')
|
|
96
|
+
message = t('error.message.thirdPartyError')
|
|
97
|
+
break
|
|
98
|
+
case LiFiErrorCode.TransactionUnderpriced:
|
|
99
|
+
title = t('error.title.transactionUnderpriced')
|
|
100
|
+
message = getDefaultErrorMessage()
|
|
101
|
+
break
|
|
102
|
+
case LiFiErrorCode.TransactionUnprepared:
|
|
103
|
+
title = t('error.title.transactionUnprepared')
|
|
104
|
+
message = getDefaultErrorMessage()
|
|
105
|
+
break
|
|
106
|
+
case LiFiErrorCode.TransactionCanceled:
|
|
107
|
+
title = t('error.title.transactionCanceled')
|
|
108
|
+
message = getDefaultErrorMessage('error.message.transactionCanceled')
|
|
109
|
+
break
|
|
110
|
+
case LiFiErrorCode.TransactionRejected:
|
|
111
|
+
title = t('error.title.transactionRejected')
|
|
112
|
+
message = getDefaultErrorMessage('error.message.transactionRejected')
|
|
113
|
+
break
|
|
114
|
+
case LiFiErrorCode.TransactionConflict:
|
|
115
|
+
title = t('error.title.transactionConflict')
|
|
116
|
+
message = getDefaultErrorMessage('error.message.transactionConflict')
|
|
117
|
+
break
|
|
118
|
+
case LiFiErrorCode.ExchangeRateUpdateCanceled:
|
|
119
|
+
title = t('error.title.exchangeRateUpdateCanceled')
|
|
120
|
+
message = getDefaultErrorMessage()
|
|
121
|
+
break
|
|
122
|
+
case LiFiErrorCode.SignatureRejected:
|
|
123
|
+
title = t('error.title.signatureRejected')
|
|
124
|
+
message = t('error.message.signatureRejected', {
|
|
125
|
+
amount: formatTokenAmount(
|
|
126
|
+
BigInt(step.action.fromAmount),
|
|
127
|
+
step.action.fromToken.decimals
|
|
128
|
+
),
|
|
129
|
+
tokenSymbol: step.action.fromToken.symbol,
|
|
130
|
+
chainName: getChainById(step.action.fromChainId)?.name ?? '',
|
|
131
|
+
})
|
|
132
|
+
break
|
|
133
|
+
default:
|
|
134
|
+
title = t('error.title.unknown')
|
|
135
|
+
if (failedAction?.txHash) {
|
|
136
|
+
message = t('error.message.transactionFailed')
|
|
137
|
+
} else {
|
|
138
|
+
message = error.message || t('error.message.unknown')
|
|
139
|
+
}
|
|
140
|
+
break
|
|
141
|
+
}
|
|
142
|
+
message = wrapLongWords(message)
|
|
143
|
+
return { title, message }
|
|
144
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExecutionAction } from '@lifi/sdk'
|
|
2
|
+
|
|
3
|
+
// NB: New SDK adds new actions - merge them into old TOKEN_ALLOWANCE before UI changes
|
|
4
|
+
const allowanceTypes = new Set([
|
|
5
|
+
'NATIVE_PERMIT',
|
|
6
|
+
'CHECK_ALLOWANCE',
|
|
7
|
+
'RESET_ALLOWANCE',
|
|
8
|
+
'SET_ALLOWANCE',
|
|
9
|
+
])
|
|
10
|
+
|
|
11
|
+
export function prepareActions(
|
|
12
|
+
actions: ExecutionAction[]
|
|
13
|
+
): ExecutionAction[][] {
|
|
14
|
+
const groups = new Map<string | number, ExecutionAction[]>()
|
|
15
|
+
for (const action of actions) {
|
|
16
|
+
const key = allowanceTypes.has(action.type)
|
|
17
|
+
? 'TOKEN_ALLOWANCE'
|
|
18
|
+
: action.type
|
|
19
|
+
const group = groups.get(key)
|
|
20
|
+
if (group) {
|
|
21
|
+
group.push(action)
|
|
22
|
+
} else {
|
|
23
|
+
groups.set(key, [action])
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return [...groups.values()]
|
|
27
|
+
}
|