@lifi/widget 4.3.1 → 4.4.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/dist/esm/App.d.ts +0 -1
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -1
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.d.ts +13 -0
- package/dist/esm/components/ActionRow/ActionRow.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +9 -0
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts +7 -0
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +7 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts.map +1 -0
- package/dist/esm/components/Avatar/Avatar.d.ts +12 -0
- package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +14 -0
- package/dist/esm/components/Avatar/TokenAvatar.d.ts.map +1 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts +6 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts.map +1 -0
- package/dist/esm/components/BaseTransactionButton/types.d.ts +14 -0
- package/dist/esm/components/BaseTransactionButton/types.d.ts.map +1 -0
- package/dist/esm/components/BottomSheet/types.d.ts +11 -0
- package/dist/esm/components/BottomSheet/types.d.ts.map +1 -0
- package/dist/esm/components/ButtonTertiary.d.ts +7 -0
- package/dist/esm/components/ButtonTertiary.d.ts.map +1 -0
- package/dist/esm/components/Card/Card.d.ts +12 -0
- package/dist/esm/components/Card/Card.d.ts.map +1 -0
- package/dist/esm/components/Card/CardIconButton.d.ts +7 -0
- package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -0
- package/dist/esm/components/Card/CardTitle.d.ts +9 -0
- package/dist/esm/components/Card/CardTitle.d.ts.map +1 -0
- package/dist/esm/components/Card/InputCard.d.ts +7 -0
- package/dist/esm/components/Card/InputCard.d.ts.map +1 -0
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts +7 -0
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts.map +1 -0
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +10 -0
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts.map +1 -0
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts +7 -0
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts.map +1 -0
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +0 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts +21 -0
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts.map +1 -0
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts +16 -0
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts.map +1 -0
- package/dist/esm/components/ExecutionStatusCard/iconKey.js +1 -0
- package/dist/esm/components/ExecutionStatusCard/iconKey.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +13 -0
- package/dist/esm/components/FeeBreakdownTooltip.d.ts.map +1 -0
- package/dist/esm/components/IconCircle/IconCircle.d.ts +11 -0
- package/dist/esm/components/IconCircle/IconCircle.d.ts.map +1 -0
- package/dist/esm/components/IconCircle/statusIcons.d.ts +6 -0
- package/dist/esm/components/IconCircle/statusIcons.d.ts.map +1 -0
- package/dist/esm/components/IconTypography.d.ts +7 -0
- package/dist/esm/components/IconTypography.d.ts.map +1 -0
- package/dist/esm/components/ListItem/ListItemButton.d.ts +7 -0
- package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -0
- package/dist/esm/components/ListItemButton.d.ts +7 -0
- package/dist/esm/components/ListItemButton.d.ts.map +1 -0
- package/dist/esm/components/Messages/WarningMessages.d.ts +11 -0
- package/dist/esm/components/Messages/WarningMessages.d.ts.map +1 -0
- package/dist/esm/components/PageContainer.d.ts +12 -0
- package/dist/esm/components/PageContainer.d.ts.map +1 -0
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts +5 -0
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts.map +1 -0
- package/dist/esm/components/ProgressToNextUpdate.d.ts +10 -0
- package/dist/esm/components/ProgressToNextUpdate.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteCard.d.ts +7 -0
- package/dist/esm/components/RouteCard/RouteCard.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts +7 -0
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteDetails.d.ts +10 -0
- package/dist/esm/components/RouteCard/RouteDetails.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts +12 -0
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts +5 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteTokens.d.ts +11 -0
- package/dist/esm/components/RouteCard/RouteTokens.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteTokens.js +2 -2
- package/dist/esm/components/RouteCard/RouteTokens.js.map +1 -1
- package/dist/esm/components/RouteCard/types.d.ts +14 -0
- package/dist/esm/components/RouteCard/types.d.ts.map +1 -0
- package/dist/esm/components/Search/SearchInput.d.ts +17 -0
- package/dist/esm/components/Search/SearchInput.d.ts.map +1 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts +10 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts.map +1 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +15 -6
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts +1 -4
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts +9 -0
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts.map +1 -0
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts +7 -0
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts.map +1 -0
- package/dist/esm/components/StepActions/StepActionsList.d.ts +12 -0
- package/dist/esm/components/StepActions/StepActionsList.d.ts.map +1 -0
- package/dist/esm/components/StepActions/executionRows.d.ts +26 -0
- package/dist/esm/components/StepActions/executionRows.d.ts.map +1 -0
- package/dist/esm/components/Token/Token.d.ts +17 -0
- package/dist/esm/components/Token/Token.d.ts.map +1 -0
- package/dist/esm/components/TokenList/TokenNotFound.d.ts +6 -0
- package/dist/esm/components/TokenList/TokenNotFound.d.ts.map +1 -0
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts +7 -0
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts.map +1 -0
- package/dist/esm/components/TokenList/types.d.ts +20 -0
- package/dist/esm/components/TokenList/types.d.ts.map +1 -0
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +6 -0
- package/dist/esm/components/TokenList/useTokenSelect.d.ts.map +1 -0
- package/dist/esm/components/TokenRate/TokenRate.d.ts +10 -0
- package/dist/esm/components/TokenRate/TokenRate.d.ts.map +1 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js +1 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js +9 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts +8 -0
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts.map +1 -0
- package/dist/esm/config/constants.d.ts.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.d.ts.map +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useAddressActivity.d.ts +11 -0
- package/dist/esm/hooks/useAddressActivity.d.ts.map +1 -0
- package/dist/esm/hooks/useAddressValidation.d.ts +28 -0
- package/dist/esm/hooks/useAddressValidation.d.ts.map +1 -0
- package/dist/esm/hooks/useAddressValidation.js +6 -1
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +12 -0
- package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -0
- package/dist/esm/hooks/useChain.d.ts +10 -0
- package/dist/esm/hooks/useChain.d.ts.map +1 -0
- package/dist/esm/hooks/useContactSupport.d.ts +5 -0
- package/dist/esm/hooks/useContactSupport.d.ts.map +1 -0
- package/dist/esm/hooks/useDebouncedWatch.d.ts +6 -0
- package/dist/esm/hooks/useDebouncedWatch.d.ts.map +1 -0
- package/dist/esm/hooks/useDisplayedTokens.js +48 -0
- package/dist/esm/hooks/useDisplayedTokens.js.map +1 -0
- package/dist/esm/hooks/useExplorer.d.ts +14 -0
- package/dist/esm/hooks/useExplorer.d.ts.map +1 -0
- package/dist/esm/hooks/useHeader.d.ts +6 -0
- package/dist/esm/hooks/useHeader.d.ts.map +1 -0
- package/dist/esm/hooks/useListHeight.d.ts +12 -0
- package/dist/esm/hooks/useListHeight.d.ts.map +1 -0
- package/dist/esm/hooks/useListHeight.js +1 -0
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +5 -0
- package/dist/esm/hooks/useNavigateBack.d.ts.map +1 -0
- package/dist/esm/hooks/usePacedRouteExecution.js +1 -0
- package/dist/esm/hooks/usePacedRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.d.ts +18 -0
- package/dist/esm/hooks/useRouteExecution.d.ts.map +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts +10 -0
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts.map +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.js +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/hooks/useRoutes.d.ts +32 -0
- package/dist/esm/hooks/useRoutes.d.ts.map +1 -0
- package/dist/esm/hooks/useRoutes.js +12 -8
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +16 -0
- package/dist/esm/hooks/useToAddressRequirements.d.ts.map +1 -0
- package/dist/esm/hooks/useToken.d.ts +9 -0
- package/dist/esm/hooks/useToken.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +11 -0
- package/dist/esm/hooks/useTokenAddressBalance.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenBalances.d.ts +14 -0
- package/dist/esm/hooks/useTokenBalances.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenBalances.js +5 -45
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenList.d.ts +16 -0
- package/dist/esm/hooks/useTokenList.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenList.js +31 -0
- package/dist/esm/hooks/useTokenList.js.map +1 -0
- package/dist/esm/hooks/useTools.d.ts +8 -0
- package/dist/esm/hooks/useTools.d.ts.map +1 -0
- package/dist/esm/hooks/useTransactionDetails.js +1 -3
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js +1 -0
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +0 -1
- package/dist/esm/hooks/useWidgetChains.d.ts.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts +0 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts.map +1 -1
- package/dist/esm/i18n/en.json +321 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js +1 -0
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts +10 -0
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts.map +1 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts +7 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts.map +1 -0
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts +6 -0
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts.map +1 -0
- package/dist/esm/pages/SelectChainPage/types.d.ts +8 -0
- package/dist/esm/pages/SelectChainPage/types.d.ts.map +1 -0
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts +10 -0
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts.map +1 -0
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts +9 -0
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts +14 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts +19 -0
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts +12 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.js +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +11 -0
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts +6 -0
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts +15 -0
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionContent.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts +12 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/types.d.ts +9 -0
- package/dist/esm/pages/TransactionPage/types.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/utils.d.ts +6 -0
- package/dist/esm/pages/TransactionPage/utils.d.ts.map +1 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts +5 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts.map +1 -0
- package/dist/esm/providers/I18nProvider/types.d.ts +2 -3
- package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
- package/dist/esm/providers/QueryClientProvider.d.ts +6 -0
- package/dist/esm/providers/QueryClientProvider.d.ts.map +1 -0
- package/dist/esm/providers/SDKClientProvider.d.ts +8 -0
- package/dist/esm/providers/SDKClientProvider.d.ts.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +10 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.js +8 -3
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts +8 -0
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
- package/dist/esm/providers/WidgetProvider/types.d.ts +11 -0
- package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -0
- package/dist/esm/shared.d.ts +107 -0
- package/dist/esm/shared.js +105 -0
- package/dist/esm/stores/StoreProvider.d.ts +7 -0
- package/dist/esm/stores/StoreProvider.d.ts.map +1 -0
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +7 -0
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts.map +1 -0
- package/dist/esm/stores/bookmarks/types.d.ts +0 -1
- package/dist/esm/stores/bookmarks/types.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +8 -0
- package/dist/esm/stores/chains/ChainOrderStore.d.ts.map +1 -0
- package/dist/esm/stores/chains/types.d.ts +27 -0
- package/dist/esm/stores/chains/types.d.ts.map +1 -0
- package/dist/esm/stores/form/createFormStore.js +1 -0
- package/dist/esm/stores/form/createFormStore.js.map +1 -1
- package/dist/esm/stores/form/types.d.ts +7 -7
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.d.ts +0 -1
- package/dist/esm/stores/form/useFieldActions.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldValues.d.ts +0 -1
- package/dist/esm/stores/form/useFieldValues.d.ts.map +1 -1
- package/dist/esm/stores/header/types.d.ts +20 -0
- package/dist/esm/stores/header/types.d.ts.map +1 -0
- package/dist/esm/stores/header/useHeaderStore.d.ts +8 -0
- package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -0
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +13 -0
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +9 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts.map +1 -0
- package/dist/esm/stores/routes/createRouteExecutionStore.js +1 -0
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/types.d.ts +24 -0
- package/dist/esm/stores/routes/types.d.ts.map +1 -0
- package/dist/esm/stores/routes/types.js +14 -0
- package/dist/esm/stores/routes/types.js.map +1 -0
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js +1 -0
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +9 -0
- package/dist/esm/stores/routes/utils.d.ts.map +1 -0
- package/dist/esm/stores/settings/SettingsStore.d.ts +8 -0
- package/dist/esm/stores/settings/SettingsStore.d.ts.map +1 -0
- package/dist/esm/stores/settings/types.d.ts +5 -2
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/types.d.ts +9 -0
- package/dist/esm/stores/types.d.ts.map +1 -0
- package/dist/esm/themes/azureLight.d.ts +0 -1
- package/dist/esm/themes/azureLight.d.ts.map +1 -1
- package/dist/esm/themes/createTheme.d.ts +0 -1
- package/dist/esm/themes/createTheme.d.ts.map +1 -1
- package/dist/esm/themes/jumper.d.ts +0 -1
- package/dist/esm/themes/jumper.d.ts.map +1 -1
- package/dist/esm/themes/palettes.d.ts.map +1 -1
- package/dist/esm/themes/types.d.ts +0 -1
- package/dist/esm/themes/types.d.ts.map +1 -1
- package/dist/esm/themes/watermelonLight.d.ts +0 -1
- package/dist/esm/themes/watermelonLight.d.ts.map +1 -1
- package/dist/esm/themes/windows95.d.ts +0 -1
- package/dist/esm/themes/windows95.d.ts.map +1 -1
- package/dist/esm/types/events.d.ts +4 -3
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/token.d.ts +1 -2
- package/dist/esm/types/token.d.ts.map +1 -1
- package/dist/esm/types/widget.d.ts +72 -73
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.d.ts +8 -8
- package/dist/esm/utils/compactNumberFormatter.d.ts.map +1 -1
- package/dist/esm/utils/converters.d.ts +7 -0
- package/dist/esm/utils/converters.d.ts.map +1 -0
- package/dist/esm/utils/currencyExtendedFormatter.d.ts.map +1 -1
- package/dist/esm/utils/elements.d.ts +11 -0
- package/dist/esm/utils/elements.d.ts.map +1 -0
- package/dist/esm/utils/elements.js +8 -1
- package/dist/esm/utils/elements.js.map +1 -1
- package/dist/esm/utils/enum.d.ts +5 -0
- package/dist/esm/utils/enum.d.ts.map +1 -0
- package/dist/esm/utils/fees.d.ts +17 -0
- package/dist/esm/utils/fees.d.ts.map +1 -0
- package/dist/esm/utils/format.d.ts +14 -14
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/getPriceImpact.d.ts +1 -7
- package/dist/esm/utils/getPriceImpact.d.ts.map +1 -1
- package/dist/esm/utils/input.d.ts +5 -0
- package/dist/esm/utils/input.d.ts.map +1 -0
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/percentFormatter.d.ts +5 -5
- package/dist/esm/utils/percentFormatter.d.ts.map +1 -1
- package/dist/esm/utils/tokenList.js +3 -3
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/dist/esm/utils/wallet.d.ts +5 -0
- package/dist/esm/utils/wallet.d.ts.map +1 -0
- package/package.json +28 -20
- package/src/components/RouteCard/RouteTokens.tsx +3 -2
- package/src/components/SendToWallet/SendToWalletButton.tsx +27 -5
- package/src/components/TransactionCard/ActiveTransactionCard.style.tsx +11 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useDisplayedTokens.ts +70 -0
- package/src/hooks/useListHeight.ts +4 -0
- package/src/hooks/useRoutes.ts +360 -325
- package/src/hooks/useTokenBalances.ts +8 -53
- package/src/hooks/useTokenList.ts +59 -0
- package/src/hooks/useTransactionDetails.ts +1 -3
- package/src/providers/WalletProvider/WalletProvider.tsx +15 -3
- package/src/shared.ts +191 -0
- package/src/stores/form/createFormStore.ts +1 -0
- package/src/stores/form/types.ts +1 -0
- package/src/utils/tokenList.ts +3 -3
package/src/hooks/useRoutes.ts
CHANGED
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
useChainTypeFromAddress,
|
|
14
14
|
useEthereumContext,
|
|
15
15
|
} from '@lifi/widget-provider'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
keepPreviousData,
|
|
18
|
+
useQuery,
|
|
19
|
+
useQueryClient,
|
|
20
|
+
} from '@tanstack/react-query'
|
|
17
21
|
import { useCallback, useMemo } from 'react'
|
|
18
22
|
import { useSDKClient } from '../providers/SDKClientProvider.js'
|
|
19
23
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
@@ -39,15 +43,28 @@ const refetchTime = 60_000
|
|
|
39
43
|
|
|
40
44
|
interface RoutesProps {
|
|
41
45
|
observableRoute?: Route
|
|
46
|
+
/**
|
|
47
|
+
* Address to quote from when no wallet is connected. Treated as a non-signing
|
|
48
|
+
* placeholder, so signer-dependent (relayer/permit2) quotes are skipped.
|
|
49
|
+
*/
|
|
50
|
+
quoteFromAddress?: string
|
|
51
|
+
/**
|
|
52
|
+
* Keep showing the previous result while a new query (e.g. a token/amount
|
|
53
|
+
* change) is fetching, instead of clearing to a loading state.
|
|
54
|
+
*/
|
|
55
|
+
keepPreviousData?: boolean
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
export const useRoutes = ({
|
|
45
59
|
observableRoute,
|
|
60
|
+
quoteFromAddress,
|
|
61
|
+
keepPreviousData: keepPreviousDataEnabled,
|
|
46
62
|
}: RoutesProps = {}): {
|
|
47
63
|
routes: Route[] | undefined
|
|
48
64
|
isLoading: boolean
|
|
49
65
|
isFetching: boolean
|
|
50
66
|
isFetched: boolean
|
|
67
|
+
isError: boolean
|
|
51
68
|
dataUpdatedAt: number
|
|
52
69
|
refetchTime: number
|
|
53
70
|
refetch: () => void
|
|
@@ -136,8 +153,18 @@ export const useRoutes = ({
|
|
|
136
153
|
? Number(fromTokenAmount) > 0 && Number(toTokenAmount) > 0
|
|
137
154
|
: Number(fromTokenAmount) > 0 || Number(toTokenAmount) > 0
|
|
138
155
|
|
|
139
|
-
const
|
|
140
|
-
|
|
156
|
+
const customType = mode === 'custom' ? modeOptions?.custom?.type : undefined
|
|
157
|
+
const isContractCallQuote =
|
|
158
|
+
mode === 'custom' && Boolean(contractCalls?.length)
|
|
159
|
+
// A contract-call quote needs a connected wallet to resolve fromAddress.
|
|
160
|
+
// Deposit funding quotes a plain route with no contract calls and no wallet
|
|
161
|
+
// (a placeholder fromAddress arrives via quoteFromAddress); every other custom
|
|
162
|
+
// flow stays gated on a real wallet, as before.
|
|
163
|
+
const contractCallQuoteEnabled: boolean = isContractCallQuote
|
|
164
|
+
? Boolean(account.address)
|
|
165
|
+
: mode !== 'custom' || customType === 'deposit'
|
|
166
|
+
|
|
167
|
+
const effectiveFromAddress = account.address ?? quoteFromAddress
|
|
141
168
|
|
|
142
169
|
// When we bridge between ecosystems we need to be sure toAddress is set and has the same chainType as toChain
|
|
143
170
|
// If toAddress is set, it must have the same chainType as toChain
|
|
@@ -178,7 +205,7 @@ export const useRoutes = ({
|
|
|
178
205
|
() =>
|
|
179
206
|
[
|
|
180
207
|
getQueryKey('routes', keyPrefix),
|
|
181
|
-
|
|
208
|
+
effectiveFromAddress,
|
|
182
209
|
fromChain?.id as number,
|
|
183
210
|
fromToken?.address as string,
|
|
184
211
|
fromTokenAmount,
|
|
@@ -208,7 +235,7 @@ export const useRoutes = ({
|
|
|
208
235
|
] as const,
|
|
209
236
|
[
|
|
210
237
|
keyPrefix,
|
|
211
|
-
|
|
238
|
+
effectiveFromAddress,
|
|
212
239
|
fromChain?.id,
|
|
213
240
|
fromToken?.address,
|
|
214
241
|
fromTokenAmount,
|
|
@@ -242,355 +269,362 @@ export const useRoutes = ({
|
|
|
242
269
|
const { getIntermediateRoutes, setIntermediateRoutes } =
|
|
243
270
|
useIntermediateRoutesStore()
|
|
244
271
|
|
|
245
|
-
const {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
)
|
|
301
|
-
: allowedBridges
|
|
302
|
-
const allowExchanges = observableRoute
|
|
272
|
+
const {
|
|
273
|
+
data,
|
|
274
|
+
isLoading,
|
|
275
|
+
isFetching,
|
|
276
|
+
isFetched,
|
|
277
|
+
isError,
|
|
278
|
+
dataUpdatedAt,
|
|
279
|
+
refetch,
|
|
280
|
+
} = useQuery({
|
|
281
|
+
queryKey,
|
|
282
|
+
queryFn: async ({
|
|
283
|
+
queryKey: [
|
|
284
|
+
_,
|
|
285
|
+
fromAddress,
|
|
286
|
+
fromChainId,
|
|
287
|
+
fromTokenAddress,
|
|
288
|
+
fromTokenAmount,
|
|
289
|
+
toAddress,
|
|
290
|
+
toChainId,
|
|
291
|
+
toTokenAddress,
|
|
292
|
+
toTokenAmount,
|
|
293
|
+
validUntilDuration,
|
|
294
|
+
partiallyFillable,
|
|
295
|
+
contractCalls,
|
|
296
|
+
slippage = defaultSlippage,
|
|
297
|
+
swapOnly,
|
|
298
|
+
disabledBridges,
|
|
299
|
+
disabledExchanges,
|
|
300
|
+
allowedBridges,
|
|
301
|
+
allowedExchanges,
|
|
302
|
+
routePriority,
|
|
303
|
+
mode,
|
|
304
|
+
allowSwitchChain,
|
|
305
|
+
enabledRefuel,
|
|
306
|
+
gasRecommendationFromAmount,
|
|
307
|
+
configuredFee,
|
|
308
|
+
disableMessageSigning,
|
|
309
|
+
isBatchingSupported,
|
|
310
|
+
isPrivate,
|
|
311
|
+
// _observableRouteId must be the last element in the query key
|
|
312
|
+
_observableRouteId,
|
|
313
|
+
],
|
|
314
|
+
signal,
|
|
315
|
+
}) => {
|
|
316
|
+
const fromAmount = parseUnits(fromTokenAmount, fromToken!.decimals)
|
|
317
|
+
const toAmount = toTokenAmount
|
|
318
|
+
? parseUnits(toTokenAmount, toToken!.decimals)
|
|
319
|
+
: undefined
|
|
320
|
+
const formattedSlippage = slippage
|
|
321
|
+
? Number.parseFloat(slippage) / 100
|
|
322
|
+
: defaultSlippage
|
|
323
|
+
|
|
324
|
+
const allowBridges = swapOnly
|
|
325
|
+
? []
|
|
326
|
+
: observableRoute
|
|
303
327
|
? observableRoute.steps.flatMap((step) =>
|
|
304
328
|
step.includedSteps.reduce((toolKeys, includedStep) => {
|
|
305
|
-
if (includedStep.type === '
|
|
329
|
+
if (includedStep.type === 'cross') {
|
|
306
330
|
toolKeys.push(includedStep.toolDetails.key)
|
|
307
331
|
}
|
|
308
332
|
return toolKeys
|
|
309
333
|
}, [] as string[])
|
|
310
334
|
)
|
|
311
|
-
:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
fromAmount,
|
|
321
|
-
toAmount,
|
|
322
|
-
slippage: formattedSlippage,
|
|
323
|
-
})
|
|
324
|
-
|
|
325
|
-
if (mode === 'custom' && contractCalls && toAmount) {
|
|
326
|
-
const contractCallQuote = await getContractCallsQuote(
|
|
327
|
-
sdkClient,
|
|
328
|
-
{
|
|
329
|
-
// Contract calls are enabled only when fromAddress is set
|
|
330
|
-
fromAddress: fromAddress as string,
|
|
331
|
-
fromChain: fromChainId,
|
|
332
|
-
fromToken: fromTokenAddress,
|
|
333
|
-
toAmount: toAmount.toString(),
|
|
334
|
-
toChain: toChainId,
|
|
335
|
-
toToken: toTokenAddress,
|
|
336
|
-
contractCalls,
|
|
337
|
-
denyBridges: disabledBridges.length ? disabledBridges : undefined,
|
|
338
|
-
denyExchanges: disabledExchanges.length
|
|
339
|
-
? disabledExchanges
|
|
340
|
-
: undefined,
|
|
341
|
-
allowBridges,
|
|
342
|
-
allowExchanges,
|
|
343
|
-
toFallbackAddress: toAddress,
|
|
344
|
-
slippage: formattedSlippage,
|
|
345
|
-
fee: calculatedFee || configuredFee,
|
|
346
|
-
},
|
|
347
|
-
{ signal }
|
|
335
|
+
: allowedBridges
|
|
336
|
+
const allowExchanges = observableRoute
|
|
337
|
+
? observableRoute.steps.flatMap((step) =>
|
|
338
|
+
step.includedSteps.reduce((toolKeys, includedStep) => {
|
|
339
|
+
if (includedStep.type === 'swap') {
|
|
340
|
+
toolKeys.push(includedStep.toolDetails.key)
|
|
341
|
+
}
|
|
342
|
+
return toolKeys
|
|
343
|
+
}, [] as string[])
|
|
348
344
|
)
|
|
345
|
+
: allowedExchanges
|
|
346
|
+
|
|
347
|
+
const calculatedFee = await feeConfig?.calculateFee?.({
|
|
348
|
+
fromChain: fromChain!,
|
|
349
|
+
toChain: toChain!,
|
|
350
|
+
fromToken: fromToken!,
|
|
351
|
+
toToken: toToken!,
|
|
352
|
+
fromAddress,
|
|
353
|
+
toAddress,
|
|
354
|
+
fromAmount,
|
|
355
|
+
toAmount,
|
|
356
|
+
slippage: formattedSlippage,
|
|
357
|
+
})
|
|
349
358
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
359
|
+
if (mode === 'custom' && contractCalls?.length && toAmount) {
|
|
360
|
+
const contractCallQuote = await getContractCallsQuote(
|
|
361
|
+
sdkClient,
|
|
362
|
+
{
|
|
363
|
+
// Contract calls are enabled only when fromAddress is set
|
|
364
|
+
fromAddress: fromAddress as string,
|
|
365
|
+
fromChain: fromChainId,
|
|
366
|
+
fromToken: fromTokenAddress,
|
|
367
|
+
toAmount: toAmount.toString(),
|
|
368
|
+
toChain: toChainId,
|
|
369
|
+
toToken: toTokenAddress,
|
|
370
|
+
contractCalls,
|
|
371
|
+
denyBridges: disabledBridges.length ? disabledBridges : undefined,
|
|
372
|
+
denyExchanges: disabledExchanges.length
|
|
373
|
+
? disabledExchanges
|
|
374
|
+
: undefined,
|
|
375
|
+
allowBridges,
|
|
376
|
+
allowExchanges,
|
|
377
|
+
toFallbackAddress: toAddress,
|
|
378
|
+
slippage: formattedSlippage,
|
|
379
|
+
fee: calculatedFee || configuredFee,
|
|
380
|
+
},
|
|
381
|
+
{ signal }
|
|
382
|
+
)
|
|
368
383
|
|
|
369
|
-
|
|
384
|
+
contractCallQuote.action.toToken = toToken!
|
|
370
385
|
|
|
371
|
-
|
|
372
|
-
|
|
386
|
+
const customStep =
|
|
387
|
+
mode === 'custom'
|
|
388
|
+
? contractCallQuote.includedSteps?.find(
|
|
389
|
+
(step) => step.type === 'custom'
|
|
390
|
+
)
|
|
391
|
+
: undefined
|
|
373
392
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
393
|
+
if (customStep && contractTool) {
|
|
394
|
+
const toolDetails = {
|
|
395
|
+
key: contractTool.name,
|
|
396
|
+
name: contractTool.name,
|
|
397
|
+
logoURI: contractTool.logoURI,
|
|
398
|
+
}
|
|
399
|
+
customStep.toolDetails = toolDetails
|
|
400
|
+
contractCallQuote.toolDetails = toolDetails
|
|
382
401
|
}
|
|
383
402
|
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
403
|
+
const route: Route = convertQuoteToRoute(contractCallQuote)
|
|
404
|
+
|
|
405
|
+
return [route]
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Prevent sending a request for the same chain token combinations.
|
|
409
|
+
// Exception: proceed anyway if mode is custom and modeOptions custom type is deposit
|
|
410
|
+
if (
|
|
411
|
+
fromChainId === toChainId &&
|
|
412
|
+
fromTokenAddress === toTokenAddress &&
|
|
413
|
+
!(mode === 'custom' && modeOptions?.custom?.type === 'deposit')
|
|
414
|
+
) {
|
|
415
|
+
return
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const isObservableRelayerRoute = observableRoute?.steps?.some(
|
|
419
|
+
(step) => !!isGaslessStep?.(step, fromChain)
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
const shouldUseMainRoutes = !observableRoute || !isObservableRelayerRoute
|
|
423
|
+
const shouldUseRelayerQuote =
|
|
424
|
+
// Relayer quotes don't support limit-order params
|
|
425
|
+
mode !== 'limit' &&
|
|
426
|
+
account.address &&
|
|
427
|
+
fromAddress &&
|
|
428
|
+
fromChain?.chainType === ChainType.EVM &&
|
|
429
|
+
fromChain.permit2 &&
|
|
430
|
+
fromChain.permit2Proxy &&
|
|
431
|
+
fromChain.relayerSupported &&
|
|
432
|
+
fromChain.nativeToken.address !== fromTokenAddress &&
|
|
433
|
+
useRelayerRoutes &&
|
|
434
|
+
!isBatchingSupported &&
|
|
435
|
+
(!observableRoute || isObservableRelayerRoute)
|
|
436
|
+
|
|
437
|
+
const limitOrderRouteParams =
|
|
438
|
+
mode === 'limit'
|
|
439
|
+
? {
|
|
440
|
+
toAmount: toAmount?.toString(),
|
|
441
|
+
validUntil: Math.floor(Date.now() / 1000) + validUntilDuration,
|
|
442
|
+
partiallyFillable: partiallyFillable,
|
|
443
|
+
}
|
|
444
|
+
: undefined
|
|
411
445
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
446
|
+
const mainRoutesPromise = shouldUseMainRoutes
|
|
447
|
+
? getRoutes(
|
|
448
|
+
sdkClient,
|
|
449
|
+
{
|
|
450
|
+
fromAddress,
|
|
451
|
+
fromAmount: fromAmount.toString(),
|
|
452
|
+
fromChainId,
|
|
453
|
+
fromTokenAddress,
|
|
454
|
+
toAddress,
|
|
455
|
+
toChainId,
|
|
456
|
+
toTokenAddress,
|
|
457
|
+
fromAmountForGas:
|
|
458
|
+
enabledRefuel && gasRecommendationFromAmount
|
|
459
|
+
? gasRecommendationFromAmount
|
|
460
|
+
: undefined,
|
|
461
|
+
...limitOrderRouteParams,
|
|
462
|
+
options: {
|
|
463
|
+
allowSwitchChain: mode === 'refuel' ? false : allowSwitchChain,
|
|
464
|
+
bridges:
|
|
465
|
+
allowBridges?.length || disabledBridges.length
|
|
466
|
+
? {
|
|
467
|
+
allow: allowBridges,
|
|
468
|
+
deny: disabledBridges.length
|
|
469
|
+
? disabledBridges
|
|
470
|
+
: undefined,
|
|
471
|
+
}
|
|
426
472
|
: undefined,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
deny: disabledBridges.length
|
|
436
|
-
? disabledBridges
|
|
437
|
-
: undefined,
|
|
438
|
-
}
|
|
439
|
-
: undefined,
|
|
440
|
-
exchanges:
|
|
441
|
-
allowExchanges?.length || disabledExchanges.length
|
|
442
|
-
? {
|
|
443
|
-
allow: allowExchanges,
|
|
444
|
-
deny: disabledExchanges.length
|
|
445
|
-
? disabledExchanges
|
|
446
|
-
: undefined,
|
|
447
|
-
}
|
|
448
|
-
: undefined,
|
|
449
|
-
order: routePriority,
|
|
450
|
-
slippage: formattedSlippage,
|
|
451
|
-
fee: calculatedFee || configuredFee,
|
|
452
|
-
executionType: disableMessageSigning ? 'transaction' : 'all',
|
|
453
|
-
...(isPrivate && { private: true }),
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
{ signal }
|
|
457
|
-
)
|
|
458
|
-
: Promise.resolve(null)
|
|
459
|
-
|
|
460
|
-
const relayerQuotePromise = shouldUseRelayerQuote
|
|
461
|
-
? getRelayerQuote(
|
|
462
|
-
sdkClient,
|
|
463
|
-
{
|
|
464
|
-
fromAddress,
|
|
465
|
-
fromAmount: fromAmount.toString(),
|
|
466
|
-
fromChain: fromChainId,
|
|
467
|
-
fromToken: fromTokenAddress,
|
|
468
|
-
toAddress,
|
|
469
|
-
toChain: toChainId,
|
|
470
|
-
toToken: toTokenAddress,
|
|
471
|
-
fromAmountForGas:
|
|
472
|
-
enabledRefuel && gasRecommendationFromAmount
|
|
473
|
-
? gasRecommendationFromAmount
|
|
473
|
+
exchanges:
|
|
474
|
+
allowExchanges?.length || disabledExchanges.length
|
|
475
|
+
? {
|
|
476
|
+
allow: allowExchanges,
|
|
477
|
+
deny: disabledExchanges.length
|
|
478
|
+
? disabledExchanges
|
|
479
|
+
: undefined,
|
|
480
|
+
}
|
|
474
481
|
: undefined,
|
|
475
482
|
order: routePriority,
|
|
476
483
|
slippage: formattedSlippage,
|
|
477
484
|
fee: calculatedFee || configuredFee,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
allowBridges: allowBridges,
|
|
481
|
-
denyBridges: disabledBridges.length
|
|
482
|
-
? disabledBridges
|
|
483
|
-
: undefined,
|
|
484
|
-
}
|
|
485
|
-
: undefined),
|
|
486
|
-
...(allowExchanges?.length || disabledExchanges.length
|
|
487
|
-
? {
|
|
488
|
-
allowExchanges: allowExchanges,
|
|
489
|
-
denyExchanges: disabledExchanges.length
|
|
490
|
-
? disabledExchanges
|
|
491
|
-
: undefined,
|
|
492
|
-
}
|
|
493
|
-
: undefined),
|
|
485
|
+
executionType: disableMessageSigning ? 'transaction' : 'all',
|
|
486
|
+
...(isPrivate && { private: true }),
|
|
494
487
|
},
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
: Promise.resolve(null)
|
|
500
|
-
|
|
501
|
-
// Wait for the main routes to complete first
|
|
502
|
-
const routesResult = await mainRoutesPromise
|
|
503
|
-
|
|
504
|
-
if (routesResult?.routes[0] && fromAddress) {
|
|
505
|
-
// Update local tokens cache to keep priceUSD in sync
|
|
506
|
-
const { fromToken, toToken } = routesResult.routes[0]
|
|
507
|
-
;[fromToken, toToken].forEach((token) => {
|
|
508
|
-
// Update main tokens cache (verified)
|
|
509
|
-
queryClient.setQueriesData<TokensByChain>(
|
|
510
|
-
{ queryKey: [getQueryKey('tokens', keyPrefix)] },
|
|
511
|
-
(data) => updateTokenInCache(data, token)
|
|
512
|
-
)
|
|
488
|
+
},
|
|
489
|
+
{ signal }
|
|
490
|
+
)
|
|
491
|
+
: Promise.resolve(null)
|
|
513
492
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
493
|
+
const relayerQuotePromise = shouldUseRelayerQuote
|
|
494
|
+
? getRelayerQuote(
|
|
495
|
+
sdkClient,
|
|
496
|
+
{
|
|
497
|
+
fromAddress,
|
|
498
|
+
fromAmount: fromAmount.toString(),
|
|
499
|
+
fromChain: fromChainId,
|
|
500
|
+
fromToken: fromTokenAddress,
|
|
501
|
+
toAddress,
|
|
502
|
+
toChain: toChainId,
|
|
503
|
+
toToken: toTokenAddress,
|
|
504
|
+
fromAmountForGas:
|
|
505
|
+
enabledRefuel && gasRecommendationFromAmount
|
|
506
|
+
? gasRecommendationFromAmount
|
|
507
|
+
: undefined,
|
|
508
|
+
order: routePriority,
|
|
509
|
+
slippage: formattedSlippage,
|
|
510
|
+
fee: calculatedFee || configuredFee,
|
|
511
|
+
...(allowBridges?.length || disabledBridges.length
|
|
512
|
+
? {
|
|
513
|
+
allowBridges: allowBridges,
|
|
514
|
+
denyBridges: disabledBridges.length
|
|
515
|
+
? disabledBridges
|
|
516
|
+
: undefined,
|
|
517
|
+
}
|
|
518
|
+
: undefined),
|
|
519
|
+
...(allowExchanges?.length || disabledExchanges.length
|
|
520
|
+
? {
|
|
521
|
+
allowExchanges: allowExchanges,
|
|
522
|
+
denyExchanges: disabledExchanges.length
|
|
523
|
+
? disabledExchanges
|
|
524
|
+
: undefined,
|
|
525
|
+
}
|
|
526
|
+
: undefined),
|
|
527
|
+
},
|
|
528
|
+
{ signal }
|
|
529
|
+
)
|
|
530
|
+
.then(convertQuoteToRoute)
|
|
531
|
+
.catch(() => null)
|
|
532
|
+
: Promise.resolve(null)
|
|
533
|
+
|
|
534
|
+
// Wait for the main routes to complete first
|
|
535
|
+
const routesResult = await mainRoutesPromise
|
|
536
|
+
|
|
537
|
+
if (routesResult?.routes[0] && fromAddress) {
|
|
538
|
+
// Update local tokens cache to keep priceUSD in sync
|
|
539
|
+
const { fromToken, toToken } = routesResult.routes[0]
|
|
540
|
+
;[fromToken, toToken].forEach((token) => {
|
|
541
|
+
// Update main tokens cache (verified)
|
|
542
|
+
queryClient.setQueriesData<TokensByChain>(
|
|
543
|
+
{ queryKey: [getQueryKey('tokens', keyPrefix)] },
|
|
544
|
+
(data) => updateTokenInCache(data, token)
|
|
545
|
+
)
|
|
522
546
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
547
|
+
// Update search tokens cache (unverified) - matches any search query
|
|
548
|
+
queryClient.setQueriesData<TokensByChain>(
|
|
549
|
+
{
|
|
550
|
+
queryKey: [getQueryKey('tokens-search', keyPrefix)],
|
|
551
|
+
exact: false,
|
|
552
|
+
},
|
|
553
|
+
(data) => updateTokenInCache(data, token)
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
queryClient.setQueriesData<Token[]>(
|
|
557
|
+
{
|
|
558
|
+
queryKey: [
|
|
559
|
+
getQueryKey('token-balances', keyPrefix),
|
|
560
|
+
fromAddress,
|
|
561
|
+
token.chainId,
|
|
562
|
+
],
|
|
563
|
+
},
|
|
564
|
+
(data) => {
|
|
565
|
+
if (data) {
|
|
566
|
+
const clonedData = [...data]
|
|
567
|
+
const index = clonedData.findIndex(
|
|
568
|
+
(dataToken) => dataToken.address === token.address
|
|
569
|
+
)
|
|
570
|
+
if (index >= 0) {
|
|
571
|
+
clonedData[index] = {
|
|
572
|
+
...clonedData[index],
|
|
573
|
+
...token,
|
|
542
574
|
}
|
|
543
|
-
return clonedData
|
|
544
575
|
}
|
|
576
|
+
return clonedData
|
|
545
577
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
const initialRoutes = routesResult?.routes ?? []
|
|
551
|
-
|
|
552
|
-
if (shouldUseRelayerQuote && initialRoutes.length) {
|
|
553
|
-
setIntermediateRoutes(queryKey, initialRoutes)
|
|
554
|
-
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
555
|
-
// Return early if we're only using main routes
|
|
556
|
-
} else if (shouldUseMainRoutes) {
|
|
557
|
-
// If we don't need relayer quote, return the initial routes
|
|
558
|
-
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
559
|
-
return initialRoutes
|
|
560
|
-
}
|
|
578
|
+
}
|
|
579
|
+
)
|
|
580
|
+
})
|
|
581
|
+
}
|
|
561
582
|
|
|
562
|
-
|
|
563
|
-
// If we have a relayer route, add it to the routes array
|
|
564
|
-
if (relayerRouteResult) {
|
|
565
|
-
// Insert the relayer route at position 1 (after the first route)
|
|
566
|
-
initialRoutes.splice(1, 0, relayerRouteResult)
|
|
567
|
-
// Emit the updated routes
|
|
568
|
-
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
569
|
-
}
|
|
583
|
+
const initialRoutes = routesResult?.routes ?? []
|
|
570
584
|
|
|
585
|
+
if (shouldUseRelayerQuote && initialRoutes.length) {
|
|
586
|
+
setIntermediateRoutes(queryKey, initialRoutes)
|
|
587
|
+
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
588
|
+
// Return early if we're only using main routes
|
|
589
|
+
} else if (shouldUseMainRoutes) {
|
|
590
|
+
// If we don't need relayer quote, return the initial routes
|
|
591
|
+
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
571
592
|
return initialRoutes
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const relayerRouteResult = await relayerQuotePromise
|
|
596
|
+
// If we have a relayer route, add it to the routes array
|
|
597
|
+
if (relayerRouteResult) {
|
|
598
|
+
// Insert the relayer route at position 1 (after the first route)
|
|
599
|
+
initialRoutes.splice(1, 0, relayerRouteResult)
|
|
600
|
+
// Emit the updated routes
|
|
601
|
+
emitter.emit(WidgetEvent.AvailableRoutes, initialRoutes)
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return initialRoutes
|
|
605
|
+
},
|
|
606
|
+
enabled: isEnabled,
|
|
607
|
+
staleTime: refetchTime,
|
|
608
|
+
placeholderData: keepPreviousDataEnabled ? keepPreviousData : undefined,
|
|
609
|
+
refetchInterval(query) {
|
|
610
|
+
return Math.min(
|
|
611
|
+
Math.abs(refetchTime - (Date.now() - query.state.dataUpdatedAt)),
|
|
612
|
+
refetchTime
|
|
613
|
+
)
|
|
614
|
+
},
|
|
615
|
+
retry(failureCount, error: any) {
|
|
616
|
+
if (process.env.NODE_ENV === 'development') {
|
|
617
|
+
console.warn('Route query failed:', { failureCount, error })
|
|
618
|
+
}
|
|
619
|
+
if (failureCount >= 3) {
|
|
620
|
+
return false
|
|
621
|
+
}
|
|
622
|
+
if (error?.code === LiFiErrorCode.NotFound) {
|
|
623
|
+
return false
|
|
624
|
+
}
|
|
625
|
+
return true
|
|
626
|
+
},
|
|
627
|
+
})
|
|
594
628
|
|
|
595
629
|
const setReviewableRoute = useCallback(
|
|
596
630
|
(route: Route) => {
|
|
@@ -608,6 +642,7 @@ export const useRoutes = ({
|
|
|
608
642
|
isLoading: isEnabled && isLoading,
|
|
609
643
|
isFetching,
|
|
610
644
|
isFetched,
|
|
645
|
+
isError,
|
|
611
646
|
dataUpdatedAt,
|
|
612
647
|
refetchTime,
|
|
613
648
|
refetch,
|