@lifi/widget 4.5.0 → 4.7.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/README.md +26 -3
- package/dist/esm/App.d.ts +1 -2
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -2
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/AppDrawer.js +2 -1
- package/dist/esm/AppDrawer.js.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.d.ts +1 -2
- package/dist/esm/components/ActionRow/ActionRow.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js +13 -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/AmountInput.style.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts +1 -2
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +2 -13
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -2
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts.map +1 -1
- package/dist/esm/components/AmountInputCard/PercentageChips.js +2 -13
- package/dist/esm/components/AmountInputCard/PercentageChips.js.map +1 -1
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js +1 -1
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js.map +1 -1
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js +6 -2
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js.map +1 -1
- package/dist/esm/components/AmountInputCard/SendAmountCard.js +13 -6
- package/dist/esm/components/AmountInputCard/SendAmountCard.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +1 -2
- package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +1 -2
- package/dist/esm/components/Avatar/TokenAvatar.d.ts.map +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts +1 -2
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts.map +1 -1
- package/dist/esm/components/BaseTransactionButton/types.d.ts +1 -2
- package/dist/esm/components/BaseTransactionButton/types.d.ts.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +1 -0
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/BottomSheet/types.d.ts +1 -2
- package/dist/esm/components/BottomSheet/types.d.ts.map +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -2
- package/dist/esm/components/ButtonTertiary.d.ts.map +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -2
- package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts +1 -2
- package/dist/esm/components/Card/CardTitle.d.ts.map +1 -1
- package/dist/esm/components/Card/InputCard.d.ts +1 -2
- package/dist/esm/components/Card/InputCard.d.ts.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +1 -2
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js +7 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -1
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts +1 -2
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +2 -3
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts +1 -2
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts +1 -2
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts +3 -4
- package/dist/esm/components/ContractComponent/NFT/types.d.ts.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +2 -1
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts +1 -2
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts +1 -2
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts.map +1 -1
- package/dist/esm/components/Expansion/Expansion.js +4 -3
- package/dist/esm/components/Expansion/Expansion.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +1 -2
- package/dist/esm/components/FeeBreakdownTooltip.d.ts.map +1 -1
- package/dist/esm/components/Header/SettingsButton.js +2 -1
- package/dist/esm/components/Header/SettingsButton.js.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.d.ts +1 -2
- package/dist/esm/components/IconCircle/IconCircle.d.ts.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.js +2 -1
- package/dist/esm/components/IconCircle/IconCircle.js.map +1 -1
- package/dist/esm/components/IconCircle/statusIcons.d.ts +1 -2
- package/dist/esm/components/IconCircle/statusIcons.d.ts.map +1 -1
- package/dist/esm/components/IconTypography.d.ts +1 -2
- package/dist/esm/components/IconTypography.d.ts.map +1 -1
- package/dist/esm/components/ListItem/ListItemButton.d.ts +1 -2
- package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -1
- package/dist/esm/components/Messages/UnsupportedToAddressMessage.js +27 -0
- package/dist/esm/components/Messages/UnsupportedToAddressMessage.js.map +1 -0
- package/dist/esm/components/Messages/WarningMessages.d.ts +1 -2
- package/dist/esm/components/Messages/WarningMessages.d.ts.map +1 -1
- package/dist/esm/components/Messages/WarningMessages.js +2 -0
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js +6 -1
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
- package/dist/esm/components/PageContainer.d.ts +2 -3
- package/dist/esm/components/PageContainer.d.ts.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts +1 -2
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.d.ts +1 -2
- package/dist/esm/components/ProgressToNextUpdate.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteCard.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteDetails.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.js +2 -1
- package/dist/esm/components/RouteCard/RouteDetails.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts +5 -6
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/RouteTokens.d.ts +1 -2
- package/dist/esm/components/RouteCard/RouteTokens.d.ts.map +1 -1
- package/dist/esm/components/RouteCard/types.d.ts +2 -3
- package/dist/esm/components/RouteCard/types.d.ts.map +1 -1
- package/dist/esm/components/Routes/LimitOrderRoutes.js +2 -2
- package/dist/esm/components/Routes/LimitOrderRoutes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js +2 -2
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.d.ts +1 -2
- package/dist/esm/components/Search/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts +1 -2
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js +2 -2
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts +1 -2
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.js +2 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js +18 -16
- package/dist/esm/components/Step/StepActions.js.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts +1 -2
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts.map +1 -1
- package/dist/esm/components/StepActions/StepActionRow.js +2 -1
- package/dist/esm/components/StepActions/StepActionRow.js.map +1 -1
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts +1 -2
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts.map +1 -1
- package/dist/esm/components/StepActions/StepActionsList.d.ts +1 -2
- package/dist/esm/components/StepActions/StepActionsList.d.ts.map +1 -1
- package/dist/esm/components/StepActions/executionRows.d.ts +2 -3
- package/dist/esm/components/StepActions/executionRows.d.ts.map +1 -1
- package/dist/esm/components/Switch.js +1 -1
- package/dist/esm/components/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js +4 -2
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/Token/Token.d.ts.map +1 -1
- package/dist/esm/components/Token/Token.js +2 -4
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/RecentTokensHeader.js +44 -0
- package/dist/esm/components/TokenList/RecentTokensHeader.js.map +1 -0
- package/dist/esm/components/TokenList/RecentTokensToggle.js +36 -0
- package/dist/esm/components/TokenList/RecentTokensToggle.js.map +1 -0
- package/dist/esm/components/TokenList/RemoveRecentTokenButton.js +32 -0
- package/dist/esm/components/TokenList/RemoveRecentTokenButton.js.map +1 -0
- package/dist/esm/components/TokenList/TokenList.js +55 -5
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +81 -27
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/TokenNotFound.d.ts +1 -2
- package/dist/esm/components/TokenList/TokenNotFound.d.ts.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts +1 -2
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +63 -37
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +9 -2
- package/dist/esm/components/TokenList/types.d.ts.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +1 -2
- package/dist/esm/components/TokenList/useTokenSelect.d.ts.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.d.ts +1 -2
- package/dist/esm/components/TokenRate/TokenRate.d.ts.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js +2 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js +22 -21
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts +2 -3
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts.map +1 -1
- package/dist/esm/config/constants.d.ts +1 -2
- package/dist/esm/config/constants.d.ts.map +1 -1
- package/dist/esm/config/version.d.ts +2 -3
- 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/timer/time.js +2 -2
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/useAddressActivity.d.ts +1 -2
- package/dist/esm/hooks/useAddressActivity.d.ts.map +1 -1
- package/dist/esm/hooks/useAddressValidation.d.ts +2 -3
- package/dist/esm/hooks/useAddressValidation.d.ts.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +1 -2
- package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +2 -1
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useChain.d.ts +1 -2
- package/dist/esm/hooks/useChain.d.ts.map +1 -1
- package/dist/esm/hooks/useContactSupport.d.ts +1 -2
- package/dist/esm/hooks/useContactSupport.d.ts.map +1 -1
- package/dist/esm/hooks/useDebouncedWatch.d.ts +1 -2
- package/dist/esm/hooks/useDebouncedWatch.d.ts.map +1 -1
- package/dist/esm/hooks/useDisplayedTokens.js +6 -4
- package/dist/esm/hooks/useDisplayedTokens.js.map +1 -1
- package/dist/esm/hooks/useExplorer.d.ts +1 -2
- package/dist/esm/hooks/useExplorer.d.ts.map +1 -1
- package/dist/esm/hooks/useExplorer.js +4 -0
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFlaggedTokenGuard.js +28 -0
- package/dist/esm/hooks/useFlaggedTokenGuard.js.map +1 -0
- package/dist/esm/hooks/useGasSufficiency.js +3 -1
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useHeader.d.ts +1 -2
- package/dist/esm/hooks/useHeader.d.ts.map +1 -1
- package/dist/esm/hooks/useListHeight.d.ts +1 -2
- package/dist/esm/hooks/useListHeight.d.ts.map +1 -1
- package/dist/esm/hooks/useMaxSendAmount.js +15 -0
- package/dist/esm/hooks/useMaxSendAmount.js.map +1 -0
- package/dist/esm/hooks/useNavigateBack.d.ts +1 -2
- package/dist/esm/hooks/useNavigateBack.d.ts.map +1 -1
- package/dist/esm/hooks/usePacedRouteExecution.js +3 -2
- package/dist/esm/hooks/usePacedRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRecentTokens.js +46 -0
- package/dist/esm/hooks/useRecentTokens.js.map +1 -0
- package/dist/esm/hooks/useRouteExecution.d.ts +1 -2
- package/dist/esm/hooks/useRouteExecution.d.ts.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts +1 -2
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.js +3 -2
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/hooks/useRoutes.d.ts +1 -2
- package/dist/esm/hooks/useRoutes.d.ts.map +1 -1
- package/dist/esm/hooks/useRoutes.js +8 -1
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +3 -2
- package/dist/esm/hooks/useToAddressRequirements.d.ts.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +13 -1
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToken.d.ts +1 -2
- package/dist/esm/hooks/useToken.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +1 -2
- package/dist/esm/hooks/useTokenAddressBalance.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenBalances.d.ts +3 -2
- package/dist/esm/hooks/useTokenBalances.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +19 -8
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js +29 -28
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenList.d.ts +1 -2
- package/dist/esm/hooks/useTokenList.d.ts.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +5 -6
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +40 -25
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.d.ts +1 -2
- package/dist/esm/hooks/useTools.d.ts.map +1 -1
- package/dist/esm/hooks/useWideVariant.js +2 -1
- package/dist/esm/hooks/useWideVariant.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +1 -2
- package/dist/esm/hooks/useWidgetChains.d.ts.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts +3 -4
- package/dist/esm/hooks/useWidgetEvents.d.ts.map +1 -1
- package/dist/esm/i18n/bn.json +7 -1
- package/dist/esm/i18n/de.json +7 -1
- package/dist/esm/i18n/en.json +16 -3
- package/dist/esm/i18n/es.json +7 -1
- package/dist/esm/i18n/fr.json +7 -1
- package/dist/esm/i18n/hi.json +7 -1
- package/dist/esm/i18n/id.json +7 -1
- package/dist/esm/i18n/it.json +7 -1
- package/dist/esm/i18n/ja.json +7 -1
- package/dist/esm/i18n/ko.json +7 -1
- package/dist/esm/i18n/pl.json +7 -1
- package/dist/esm/i18n/pt.json +7 -1
- package/dist/esm/i18n/th.json +7 -1
- package/dist/esm/i18n/tr.json +7 -1
- package/dist/esm/i18n/uk.json +7 -1
- package/dist/esm/i18n/vi.json +7 -1
- package/dist/esm/i18n/zh.json +7 -1
- package/dist/esm/pages/MainPage/MainPage.js +2 -1
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts +1 -2
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts.map +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js +2 -2
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js +2 -2
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts +1 -2
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js +13 -12
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/types.d.ts +1 -2
- package/dist/esm/pages/SelectChainPage/types.d.ts.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js +8 -5
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +2 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js +2 -1
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts +1 -2
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.js +2 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +2 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts +2 -3
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/StartTransactionButton.js +4 -3
- package/dist/esm/pages/TransactionPage/StartTransactionButton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +0 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenVerificationBottomSheet.js +63 -0
- package/dist/esm/pages/TransactionPage/TokenVerificationBottomSheet.js.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js +19 -16
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js +38 -10
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js +32 -9
- package/dist/esm/pages/TransactionPage/TransactionReview.js.map +1 -1
- package/dist/esm/pages/TransactionPage/types.d.ts +1 -2
- package/dist/esm/pages/TransactionPage/types.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.d.ts +2 -3
- package/dist/esm/pages/TransactionPage/utils.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js +23 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts +1 -2
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +37 -36
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +4 -5
- package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
- package/dist/esm/providers/QueryClientProvider.d.ts +1 -2
- package/dist/esm/providers/QueryClientProvider.d.ts.map +1 -1
- package/dist/esm/providers/SDKClientProvider.d.ts +2 -3
- package/dist/esm/providers/SDKClientProvider.d.ts.map +1 -1
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js +2 -1
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +1 -2
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js +10 -9
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +7 -3
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts +2 -3
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/esm/providers/WidgetProvider/types.d.ts +2 -3
- package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -1
- package/dist/esm/stores/StoreProvider.d.ts +1 -2
- package/dist/esm/stores/StoreProvider.d.ts.map +1 -1
- package/dist/esm/stores/StoreProvider.js +10 -6
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts.map +1 -1
- package/dist/esm/stores/bookmarks/types.d.ts +5 -6
- package/dist/esm/stores/bookmarks/types.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +1 -2
- package/dist/esm/stores/chains/ChainOrderStore.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +11 -5
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/types.d.ts +1 -2
- package/dist/esm/stores/chains/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.d.ts +20 -21
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldActions.d.ts +1 -2
- package/dist/esm/stores/form/useFieldActions.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldValues.d.ts +1 -2
- package/dist/esm/stores/form/useFieldValues.d.ts.map +1 -1
- package/dist/esm/stores/header/types.d.ts +1 -2
- package/dist/esm/stores/header/types.d.ts.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.d.ts +2 -3
- package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +1 -2
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts.map +1 -1
- package/dist/esm/stores/recentTokens/RecentTokensStore.js +23 -0
- package/dist/esm/stores/recentTokens/RecentTokensStore.js.map +1 -0
- package/dist/esm/stores/recentTokens/createRecentTokensStore.js +54 -0
- package/dist/esm/stores/recentTokens/createRecentTokensStore.js.map +1 -0
- package/dist/esm/stores/recentTokens/utils.js +15 -0
- package/dist/esm/stores/recentTokens/utils.js.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -3
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts.map +1 -1
- package/dist/esm/stores/routes/types.d.ts +3 -4
- package/dist/esm/stores/routes/types.d.ts.map +1 -1
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js +4 -3
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +4 -5
- package/dist/esm/stores/routes/utils.d.ts.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.d.ts +2 -3
- package/dist/esm/stores/settings/SettingsStore.d.ts.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +2 -3
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/types.d.ts +2 -3
- package/dist/esm/stores/types.d.ts.map +1 -1
- package/dist/esm/themes/azureLight.d.ts +1 -2
- package/dist/esm/themes/azureLight.d.ts.map +1 -1
- package/dist/esm/themes/jumper.d.ts +1 -2
- package/dist/esm/themes/jumper.d.ts.map +1 -1
- package/dist/esm/themes/palettes.d.ts +3 -4
- package/dist/esm/themes/palettes.d.ts.map +1 -1
- package/dist/esm/themes/types.d.ts +1 -0
- package/dist/esm/themes/watermelonLight.d.ts +1 -2
- package/dist/esm/themes/watermelonLight.d.ts.map +1 -1
- package/dist/esm/themes/windows95.d.ts +1 -2
- package/dist/esm/themes/windows95.d.ts.map +1 -1
- package/dist/esm/types/events.d.ts +13 -14
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/token.d.ts +6 -1
- package/dist/esm/types/token.d.ts.map +1 -1
- package/dist/esm/types/widget.d.ts +55 -51
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/address.js +19 -0
- package/dist/esm/utils/address.js.map +1 -0
- package/dist/esm/utils/compactNumberFormatter.d.ts +1 -2
- package/dist/esm/utils/compactNumberFormatter.d.ts.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.js +1 -3
- package/dist/esm/utils/compactNumberFormatter.js.map +1 -1
- package/dist/esm/utils/converters.d.ts +1 -2
- package/dist/esm/utils/converters.d.ts.map +1 -1
- package/dist/esm/utils/currencyExtendedFormatter.d.ts +1 -2
- package/dist/esm/utils/currencyExtendedFormatter.d.ts.map +1 -1
- package/dist/esm/utils/customReceiver.js +12 -0
- package/dist/esm/utils/customReceiver.js.map +1 -0
- package/dist/esm/utils/elements.d.ts +2 -3
- package/dist/esm/utils/elements.d.ts.map +1 -1
- package/dist/esm/utils/enum.d.ts +1 -2
- package/dist/esm/utils/enum.d.ts.map +1 -1
- package/dist/esm/utils/fees.d.ts +2 -3
- package/dist/esm/utils/fees.d.ts.map +1 -1
- package/dist/esm/utils/format.d.ts +8 -9
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/gas.js +24 -0
- package/dist/esm/utils/gas.js.map +1 -0
- package/dist/esm/utils/getErrorMessage.js +0 -1
- package/dist/esm/utils/getErrorMessage.js.map +1 -1
- package/dist/esm/utils/getPriceImpact.d.ts +1 -2
- package/dist/esm/utils/getPriceImpact.d.ts.map +1 -1
- package/dist/esm/utils/input.d.ts +1 -2
- package/dist/esm/utils/input.d.ts.map +1 -1
- package/dist/esm/utils/limitOrder.js +1 -1
- package/dist/esm/utils/limitOrder.js.map +1 -1
- package/dist/esm/utils/navigationRoutes.d.ts +2 -3
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/percentFormatter.d.ts +1 -2
- package/dist/esm/utils/percentFormatter.d.ts.map +1 -1
- package/dist/esm/utils/recentTokens.js +97 -0
- package/dist/esm/utils/recentTokens.js.map +1 -0
- package/dist/esm/utils/token.js +50 -7
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js +54 -25
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/dist/esm/utils/tokenListBands.js +85 -0
- package/dist/esm/utils/tokenListBands.js.map +1 -0
- package/dist/esm/utils/wallet.d.ts +1 -2
- package/dist/esm/utils/wallet.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +2 -21
- package/src/components/AmountInputCard/PercentageChips.tsx +2 -18
- package/src/components/AmountInputCard/ReceiveAmountCard.tsx +16 -3
- package/src/components/BottomSheet/BottomSheet.tsx +3 -0
- package/src/components/Chains/AllChainsAvatar.tsx +7 -1
- package/src/components/Messages/UnsupportedToAddressMessage.tsx +24 -0
- package/src/components/Messages/WarningMessages.tsx +3 -0
- package/src/components/Messages/useMessageQueue.ts +9 -0
- package/src/components/Routes/LimitOrderRoutes.tsx +5 -2
- package/src/components/Routes/RoutesContent.tsx +5 -2
- package/src/components/SendToWallet/SendToWalletExpandButton.tsx +2 -1
- package/src/components/Token/Token.tsx +2 -1
- package/src/components/TokenList/RecentTokensHeader.tsx +52 -0
- package/src/components/TokenList/RecentTokensToggle.tsx +45 -0
- package/src/components/TokenList/RemoveRecentTokenButton.tsx +38 -0
- package/src/components/TokenList/TokenList.tsx +92 -3
- package/src/components/TokenList/TokenListItem.tsx +83 -9
- package/src/components/TokenList/VirtualizedTokenList.tsx +86 -103
- package/src/components/TokenList/types.ts +13 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useAvailableChains.ts +1 -0
- package/src/hooks/useDisplayedTokens.ts +17 -3
- package/src/hooks/useExplorer.ts +2 -0
- package/src/hooks/useFlaggedTokenGuard.ts +33 -0
- package/src/hooks/useGasSufficiency.ts +9 -1
- package/src/hooks/useMaxSendAmount.ts +21 -0
- package/src/hooks/useRecentTokens.ts +88 -0
- package/src/hooks/useRoutes.ts +10 -0
- package/src/hooks/useToAddressRequirements.ts +23 -1
- package/src/hooks/useTokenBalances.ts +38 -19
- package/src/hooks/useTokenSearch.ts +6 -19
- package/src/hooks/useTokens.ts +97 -40
- package/src/pages/MainPage/ReviewButton.tsx +6 -2
- package/src/pages/RoutesPage/RoutesPage.tsx +5 -2
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +1 -1
- package/src/pages/TransactionPage/TokenVerificationBottomSheet.tsx +93 -0
- package/src/pages/TransactionPage/TransactionFailedButtons.tsx +62 -26
- package/src/pages/TransactionPage/TransactionReview.tsx +51 -25
- package/src/pages/TransactionPage/utils.ts +78 -0
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +9 -1
- package/src/stores/StoreProvider.tsx +10 -7
- package/src/stores/chains/ChainOrderStore.test.tsx +298 -0
- package/src/stores/chains/ChainOrderStore.tsx +25 -6
- package/src/stores/recentTokens/RecentTokensStore.tsx +39 -0
- package/src/stores/recentTokens/createRecentTokensStore.ts +107 -0
- package/src/stores/recentTokens/types.ts +37 -0
- package/src/stores/recentTokens/utils.ts +18 -0
- package/src/types/token.ts +8 -3
- package/src/types/widget.ts +5 -0
- package/src/utils/address.ts +21 -0
- package/src/utils/customReceiver.ts +31 -0
- package/src/utils/gas.ts +41 -0
- package/src/utils/recentTokens.ts +187 -0
- package/src/utils/token.ts +122 -19
- package/src/utils/tokenList.ts +60 -14
- package/src/utils/tokenListBands.ts +181 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ToAddress } from "../../types/widget.js";
|
|
2
2
|
import { StoreApi, UseBoundStore } from "zustand";
|
|
3
3
|
//#region src/stores/bookmarks/types.d.ts
|
|
4
|
-
interface Bookmark extends ToAddress {
|
|
4
|
+
export interface Bookmark extends ToAddress {
|
|
5
5
|
isConnectedAccount?: boolean;
|
|
6
6
|
}
|
|
7
|
-
interface BookmarkProps {
|
|
7
|
+
export interface BookmarkProps {
|
|
8
8
|
selectedBookmark?: Bookmark;
|
|
9
9
|
bookmarks: Bookmark[];
|
|
10
10
|
recentWallets: Bookmark[];
|
|
11
11
|
}
|
|
12
|
-
interface BookmarkActions {
|
|
12
|
+
export interface BookmarkActions {
|
|
13
13
|
getBookmark: (address: string) => Bookmark | undefined;
|
|
14
14
|
addBookmark: (bookmark: Bookmark) => void;
|
|
15
15
|
removeBookmark: (address: string) => void;
|
|
@@ -18,8 +18,7 @@ interface BookmarkActions {
|
|
|
18
18
|
addRecentWallet: (bookmark: Bookmark) => void;
|
|
19
19
|
removeRecentWallet: (address: string) => void;
|
|
20
20
|
}
|
|
21
|
-
type BookmarkState = BookmarkProps & BookmarkActions;
|
|
22
|
-
type BookmarkStore = UseBoundStore<StoreApi<BookmarkState>>;
|
|
21
|
+
export type BookmarkState = BookmarkProps & BookmarkActions;
|
|
22
|
+
export type BookmarkStore = UseBoundStore<StoreApi<BookmarkState>>;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { Bookmark, BookmarkActions, BookmarkProps, BookmarkState, BookmarkStore };
|
|
25
24
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/bookmarks/types.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/bookmarks/types.ts"],"mappings":";;;iBAGiB,iBAAiB;EAChC;;iBAGe;EACf,mBAAmB;EACnB,WAAW;EACX,eAAe;;iBAGA;EACf,cAAc,oBAAoB;EAClC,cAAc,UAAU;EACxB,iBAAiB;EACjB,sBAAsB,WAAW;EACjC,2BAA2B;EAC3B,kBAAkB,UAAU;EAC5B,qBAAqB;;YAGX,gBAAgB,gBAAgB;YAEhC,gBAAgB,cAAc,SAAS"}
|
|
@@ -2,7 +2,6 @@ import "../types.js";
|
|
|
2
2
|
import { ChainOrderState } from "./types.js";
|
|
3
3
|
import { JSX } from "react";
|
|
4
4
|
//#region src/stores/chains/ChainOrderStore.d.ts
|
|
5
|
-
declare function useChainOrderStore<T>(selector: (state: ChainOrderState) => T): T;
|
|
5
|
+
export declare function useChainOrderStore<T>(selector: (state: ChainOrderState) => T): T;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { useChainOrderStore };
|
|
8
7
|
//# sourceMappingURL=ChainOrderStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOrderStore.d.ts","names":[],"sources":["../../../../src/stores/chains/ChainOrderStore.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ChainOrderStore.d.ts","names":[],"sources":["../../../../src/stores/chains/ChainOrderStore.tsx"],"mappings":";;;;wBAkLgB,mBAAmB,GACjC,WAAW,OAAO,oBAAoB,IACrC"}
|
|
@@ -15,7 +15,7 @@ function ChainOrderStoreProvider({ children, ...props }) {
|
|
|
15
15
|
const { chains: chainsConfig, hiddenUI, fromChain: fromChainConfig, toChain: toChainConfig, buildUrl } = useWidgetConfig();
|
|
16
16
|
const storeRef = useRef(null);
|
|
17
17
|
const { chains } = useChains();
|
|
18
|
-
const { setFieldValue, getFieldValues } = useFieldActions();
|
|
18
|
+
const { setFieldValue, getFieldValues, isTouched } = useFieldActions();
|
|
19
19
|
const swapOnly = useSwapOnly();
|
|
20
20
|
const { variant } = useWidgetConfig();
|
|
21
21
|
const { externalChainTypes, useExternalWalletProvidersOnly } = useExternalWalletProvider();
|
|
@@ -35,16 +35,21 @@ function ChainOrderStoreProvider({ children, ...props }) {
|
|
|
35
35
|
const showAllNetworks = filteredChains.length > 1 && !hiddenUI?.allNetworks && !isSwapTo;
|
|
36
36
|
const urlValues = getDefaultValuesFromQueryString({ buildUrl });
|
|
37
37
|
const urlChainValue = key === "from" ? urlValues.fromChain : urlValues.toChain;
|
|
38
|
-
const
|
|
38
|
+
const configChainValue = key === "from" ? fromChainConfig : toChainConfig;
|
|
39
|
+
const [chainValue] = getFieldValues(`${key}Chain`);
|
|
40
|
+
const clearedForAllNetworks = !chainValue && isTouched(`${key}Chain`);
|
|
41
|
+
const initialIsAllNetworks = showAllNetworks && (clearedForAllNetworks || !configChainValue && !urlChainValue);
|
|
39
42
|
storeRef.current?.getState().setIsAllNetworks(initialIsAllNetworks, key);
|
|
40
43
|
storeRef.current?.getState().setShowAllNetworks(showAllNetworks, key);
|
|
41
44
|
if (isSwapTo) {
|
|
42
45
|
const [fromChainValue] = getFieldValues("fromChain");
|
|
43
|
-
|
|
46
|
+
if (fromChainValue) {
|
|
47
|
+
if (fromChainValue !== chainValue) setFieldValue("toChain", fromChainValue);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
51
|
if (initialIsAllNetworks) return;
|
|
46
|
-
|
|
47
|
-
if (chainValue) return;
|
|
52
|
+
if (chainValue && (!isSwapTo || filteredChains.some((chain) => chain.id === chainValue))) return;
|
|
48
53
|
const firstAllowedPinnedChain = storeRef.current?.getState().pinnedChains?.find((chainId) => filteredChains.some((chain) => chain.id === chainId));
|
|
49
54
|
if (variant === "wide" && !hiddenUI?.chainSidebar && firstAllowedPinnedChain) setFieldValue(`${key}Chain`, firstAllowedPinnedChain);
|
|
50
55
|
else if (chainOrder?.length) setFieldValue(`${key}Chain`, chainOrder[0]);
|
|
@@ -54,6 +59,7 @@ function ChainOrderStoreProvider({ children, ...props }) {
|
|
|
54
59
|
chainsConfig,
|
|
55
60
|
externalChainTypes,
|
|
56
61
|
getFieldValues,
|
|
62
|
+
isTouched,
|
|
57
63
|
setFieldValue,
|
|
58
64
|
useExternalWalletProvidersOnly,
|
|
59
65
|
variant,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOrderStore.js","names":[],"sources":["../../../../src/stores/chains/ChainOrderStore.tsx"],"sourcesContent":["import { createContext, type JSX, use, useEffect, useRef } from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport { useChains } from '../../hooks/useChains.js'\nimport { useSwapOnly } from '../../hooks/useSwapOnly.js'\nimport { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'\nimport { getDefaultValuesFromQueryString } from '../form/getDefaultValuesFromQueryString.js'\nimport type { FormType } from '../form/types.js'\nimport { useFieldActions } from '../form/useFieldActions.js'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport { createChainOrderStore } from './createChainOrderStore.js'\nimport type { ChainOrderState } from './types.js'\n\ntype ChainOrderStore = UseBoundStore<StoreApi<ChainOrderState>>\n\nconst ChainOrderStoreContext = createContext<ChainOrderStore | null>(null)\n\nexport function ChainOrderStoreProvider({\n children,\n ...props\n}: PersistStoreProviderProps): JSX.Element {\n const {\n chains: chainsConfig,\n hiddenUI,\n fromChain: fromChainConfig,\n toChain: toChainConfig,\n buildUrl,\n } = useWidgetConfig()\n const storeRef = useRef<ChainOrderStore>(null)\n const { chains } = useChains()\n const { setFieldValue, getFieldValues } = useFieldActions()\n const swapOnly = useSwapOnly()\n const { variant } = useWidgetConfig()\n const { externalChainTypes, useExternalWalletProvidersOnly } =\n useExternalWalletProvider()\n\n if (!storeRef.current) {\n storeRef.current = createChainOrderStore({\n ...props,\n })\n }\n\n useEffect(() => {\n if (chains) {\n ;(['from', 'to'] as FormType[]).forEach((key) => {\n const configChainIds = chainsConfig?.[key]\n const isFromKey = key === 'from'\n\n // Convert configChainIds to Sets for O(1) lookup\n const configChainIdsSet = getConfigItemSets(\n configChainIds,\n (chainIds) => new Set(chainIds)\n )\n const filteredChains = chains.filter((chain) => {\n const passesChainsConfigFilter = configChainIdsSet\n ? isItemAllowedForSets(chain.id, configChainIdsSet)\n : true\n // If the integrator uses external wallet management and has not opted in for partial wallet management,\n // restrict the displayed chains to those compatible with external wallet management.\n // This ensures users only see chains for which they can sign transactions.\n const passesWalletConfigFilter = isFromKey\n ? !useExternalWalletProvidersOnly ||\n externalChainTypes.includes(chain.chainType)\n : true\n return passesChainsConfigFilter && passesWalletConfigFilter\n })\n\n const chainOrder = storeRef.current?.getState().initializeChains(\n filteredChains.map((chain) => chain.id),\n key\n )\n\n const isSwapTo = swapOnly && key === 'to'\n\n // Show \"All networks\" button if there are multiple networks\n const showAllNetworks =\n filteredChains.length > 1 && !hiddenUI?.allNetworks && !isSwapTo\n\n // Initialize the isAllNetworks with true if the tab is shown,\n // there is no config chain value and no url chain value\n const urlValues = getDefaultValuesFromQueryString({ buildUrl })\n const urlChainValue =\n key === 'from' ? urlValues.fromChain : urlValues.toChain\n const configChainValue =\n key === 'from' ? fromChainConfig : toChainConfig\n const initialIsAllNetworks =\n showAllNetworks
|
|
1
|
+
{"version":3,"file":"ChainOrderStore.js","names":[],"sources":["../../../../src/stores/chains/ChainOrderStore.tsx"],"sourcesContent":["import { createContext, type JSX, use, useEffect, useRef } from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport { useChains } from '../../hooks/useChains.js'\nimport { useSwapOnly } from '../../hooks/useSwapOnly.js'\nimport { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { getConfigItemSets, isItemAllowedForSets } from '../../utils/item.js'\nimport { getDefaultValuesFromQueryString } from '../form/getDefaultValuesFromQueryString.js'\nimport type { FormType } from '../form/types.js'\nimport { useFieldActions } from '../form/useFieldActions.js'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport { createChainOrderStore } from './createChainOrderStore.js'\nimport type { ChainOrderState } from './types.js'\n\ntype ChainOrderStore = UseBoundStore<StoreApi<ChainOrderState>>\n\nconst ChainOrderStoreContext = createContext<ChainOrderStore | null>(null)\n\nexport function ChainOrderStoreProvider({\n children,\n ...props\n}: PersistStoreProviderProps): JSX.Element {\n const {\n chains: chainsConfig,\n hiddenUI,\n fromChain: fromChainConfig,\n toChain: toChainConfig,\n buildUrl,\n } = useWidgetConfig()\n const storeRef = useRef<ChainOrderStore>(null)\n const { chains } = useChains()\n const { setFieldValue, getFieldValues, isTouched } = useFieldActions()\n const swapOnly = useSwapOnly()\n const { variant } = useWidgetConfig()\n const { externalChainTypes, useExternalWalletProvidersOnly } =\n useExternalWalletProvider()\n\n if (!storeRef.current) {\n storeRef.current = createChainOrderStore({\n ...props,\n })\n }\n\n useEffect(() => {\n if (chains) {\n ;(['from', 'to'] as FormType[]).forEach((key) => {\n const configChainIds = chainsConfig?.[key]\n const isFromKey = key === 'from'\n\n // Convert configChainIds to Sets for O(1) lookup\n const configChainIdsSet = getConfigItemSets(\n configChainIds,\n (chainIds) => new Set(chainIds)\n )\n const filteredChains = chains.filter((chain) => {\n const passesChainsConfigFilter = configChainIdsSet\n ? isItemAllowedForSets(chain.id, configChainIdsSet)\n : true\n // If the integrator uses external wallet management and has not opted in for partial wallet management,\n // restrict the displayed chains to those compatible with external wallet management.\n // This ensures users only see chains for which they can sign transactions.\n const passesWalletConfigFilter = isFromKey\n ? !useExternalWalletProvidersOnly ||\n externalChainTypes.includes(chain.chainType)\n : true\n return passesChainsConfigFilter && passesWalletConfigFilter\n })\n\n const chainOrder = storeRef.current?.getState().initializeChains(\n filteredChains.map((chain) => chain.id),\n key\n )\n\n const isSwapTo = swapOnly && key === 'to'\n\n // Show \"All networks\" button if there are multiple networks\n const showAllNetworks =\n filteredChains.length > 1 && !hiddenUI?.allNetworks && !isSwapTo\n\n // Initialize the isAllNetworks with true if the tab is shown,\n // there is no config chain value and no url chain value\n const urlValues = getDefaultValuesFromQueryString({ buildUrl })\n const urlChainValue =\n key === 'from' ? urlValues.fromChain : urlValues.toChain\n const configChainValue =\n key === 'from' ? fromChainConfig : toChainConfig\n\n // A touched, empty chain field was cleared deliberately — \"All\n // networks\". It has to outrank the two values above, because both\n // still name the chain the page was opened on at that moment: the\n // query string is rewritten a commit later, and an integrator that\n // seeds its config from the URL never rewrites it.\n const [chainValue] = getFieldValues(`${key}Chain`)\n const clearedForAllNetworks = !chainValue && isTouched(`${key}Chain`)\n\n const initialIsAllNetworks =\n showAllNetworks &&\n (clearedForAllNetworks || (!configChainValue && !urlChainValue))\n storeRef.current?.getState().setIsAllNetworks(initialIsAllNetworks, key)\n storeRef.current?.getState().setShowAllNetworks(showAllNetworks, key)\n\n // Copying an empty source would alternate with the fallback below.\n if (isSwapTo) {\n const [fromChainValue] = getFieldValues('fromChain')\n if (fromChainValue) {\n if (fromChainValue !== chainValue) {\n setFieldValue('toChain', fromChainValue)\n }\n return\n }\n }\n\n // When \"All Networks\" is active, don't auto-select a chain from the\n // persisted chain order. This prevents stale cross-ecosystem selections\n // (e.g. EVM from + Solana to) from triggering the \"destination wallet\n // address required\" message after a page refresh.\n if (initialIsAllNetworks) {\n return\n }\n\n // With no source to follow, drop a destination the list no longer offers.\n const keepsChain =\n chainValue &&\n (!isSwapTo || filteredChains.some((chain) => chain.id === chainValue))\n if (keepsChain) {\n return\n }\n\n const firstAllowedPinnedChain = storeRef.current\n ?.getState()\n .pinnedChains?.find((chainId) =>\n filteredChains.some((chain) => chain.id === chainId)\n )\n if (\n variant === 'wide' &&\n !hiddenUI?.chainSidebar &&\n firstAllowedPinnedChain\n ) {\n setFieldValue(`${key}Chain`, firstAllowedPinnedChain)\n } else if (chainOrder?.length) {\n setFieldValue(`${key}Chain`, chainOrder[0])\n }\n })\n }\n }, [\n chains,\n chainsConfig,\n externalChainTypes,\n getFieldValues,\n isTouched,\n setFieldValue,\n useExternalWalletProvidersOnly,\n variant,\n hiddenUI,\n swapOnly,\n fromChainConfig,\n toChainConfig,\n buildUrl,\n ])\n\n return (\n <ChainOrderStoreContext value={storeRef.current}>\n {children}\n </ChainOrderStoreContext>\n )\n}\n\nfunction useChainOrderStoreContext() {\n const useStore = use(ChainOrderStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useChainOrderStore<T>(\n selector: (state: ChainOrderState) => T\n): T {\n const useStore = useChainOrderStoreContext()\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,yBAAyB,cAAsC,IAAI;AAEzE,SAAgB,wBAAwB,EACtC,UACA,GAAG,SACsC;CACzC,MAAM,EACJ,QAAQ,cACR,UACA,WAAW,iBACX,SAAS,eACT,aACE,gBAAgB;CACpB,MAAM,WAAW,OAAwB,IAAI;CAC7C,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,EAAE,eAAe,gBAAgB,cAAc,gBAAgB;CACrE,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,YAAY,gBAAgB;CACpC,MAAM,EAAE,oBAAoB,mCAC1B,0BAA0B;CAE5B,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,sBAAsB,EACvC,GAAG,MACL,CAAC;CAGH,gBAAgB;EACd,IAAI,QACD,CAAE,QAAQ,IAAI,CAAC,CAAgB,SAAS,QAAQ;GAC/C,MAAM,iBAAiB,eAAe;GACtC,MAAM,YAAY,QAAQ;GAG1B,MAAM,oBAAoB,kBACxB,iBACC,aAAa,IAAI,IAAI,QAAQ,CAChC;GACA,MAAM,iBAAiB,OAAO,QAAQ,UAAU;IAC9C,MAAM,2BAA2B,oBAC7B,qBAAqB,MAAM,IAAI,iBAAiB,IAChD;IAIJ,MAAM,2BAA2B,YAC7B,CAAC,kCACD,mBAAmB,SAAS,MAAM,SAAS,IAC3C;IACJ,OAAO,4BAA4B;GACrC,CAAC;GAED,MAAM,aAAa,SAAS,SAAS,SAAS,CAAC,CAAC,iBAC9C,eAAe,KAAK,UAAU,MAAM,EAAE,GACtC,GACF;GAEA,MAAM,WAAW,YAAY,QAAQ;GAGrC,MAAM,kBACJ,eAAe,SAAS,KAAK,CAAC,UAAU,eAAe,CAAC;GAI1D,MAAM,YAAY,gCAAgC,EAAE,SAAS,CAAC;GAC9D,MAAM,gBACJ,QAAQ,SAAS,UAAU,YAAY,UAAU;GACnD,MAAM,mBACJ,QAAQ,SAAS,kBAAkB;GAOrC,MAAM,CAAC,cAAc,eAAe,GAAG,IAAI,MAAM;GACjD,MAAM,wBAAwB,CAAC,cAAc,UAAU,GAAG,IAAI,MAAM;GAEpE,MAAM,uBACJ,oBACC,yBAA0B,CAAC,oBAAoB,CAAC;GACnD,SAAS,SAAS,SAAS,CAAC,CAAC,iBAAiB,sBAAsB,GAAG;GACvE,SAAS,SAAS,SAAS,CAAC,CAAC,mBAAmB,iBAAiB,GAAG;GAGpE,IAAI,UAAU;IACZ,MAAM,CAAC,kBAAkB,eAAe,WAAW;IACnD,IAAI,gBAAgB;KAClB,IAAI,mBAAmB,YACrB,cAAc,WAAW,cAAc;KAEzC;IACF;GACF;GAMA,IAAI,sBACF;GAOF,IAFE,eACC,CAAC,YAAY,eAAe,MAAM,UAAU,MAAM,OAAO,UAAU,IAEpE;GAGF,MAAM,0BAA0B,SAAS,SACrC,SAAS,CAAC,CACX,cAAc,MAAM,YACnB,eAAe,MAAM,UAAU,MAAM,OAAO,OAAO,CACrD;GACF,IACE,YAAY,UACZ,CAAC,UAAU,gBACX,yBAEA,cAAc,GAAG,IAAI,QAAQ,uBAAuB;QAC/C,IAAI,YAAY,QACrB,cAAc,GAAG,IAAI,QAAQ,WAAW,EAAE;EAE9C,CAAC;CAEL,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,oBAAC,wBAAD;EAAwB,OAAO,SAAS;EACrC;CACqB,CAAA;AAE5B;AAEA,SAAS,4BAA4B;CACnC,MAAM,WAAW,IAAI,sBAAsB;CAC3C,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,wBAAwB,KAAK,GACxE;CAEF,OAAO;AACT;AAEA,SAAgB,mBACd,UACG;CAEH,OADiB,0BACH,CAAC,CAAC,WAAW,QAAQ,CAAC;AACtC"}
|
|
@@ -15,7 +15,7 @@ interface ChainOrderProps {
|
|
|
15
15
|
toIsAllNetworks: boolean;
|
|
16
16
|
pinnedChains: number[];
|
|
17
17
|
}
|
|
18
|
-
interface ChainOrderState extends ChainOrderProps {
|
|
18
|
+
export interface ChainOrderState extends ChainOrderProps {
|
|
19
19
|
initializeChains(chainIds: number[], type: FormType): number[];
|
|
20
20
|
setChain(chainId: number, type: FormType): void;
|
|
21
21
|
setIsAllNetworks(isAllNetworks: boolean, formType: FormType): void;
|
|
@@ -23,5 +23,4 @@ interface ChainOrderState extends ChainOrderProps {
|
|
|
23
23
|
setPinnedChain(chainId: number): void;
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
|
-
export { ChainOrderState };
|
|
27
26
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/chains/types.ts"],"mappings":";;UAEU;EACR;IACE;IACA;;EAEF;IACE;IACA;;EAEF;EACA;EACA;EACA;EACA;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/chains/types.ts"],"mappings":";;UAEU;EACR;IACE;IACA;;EAEF;IACE;IACA;;EAEF;EACA;EACA;EACA;EACA;;iBAGe,wBAAwB;EACvC,iBAAiB,oBAAoB,MAAM;EAC3C,SAAS,iBAAiB,MAAM;EAChC,iBAAiB,wBAAwB,UAAU;EACnD,mBAAmB,0BAA0B,UAAU;EACvD,eAAe"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContractCall } from "@lifi/sdk";
|
|
2
2
|
import { StoreApi, UseBoundStore } from "zustand";
|
|
3
3
|
//#region src/stores/form/types.d.ts
|
|
4
|
-
interface DefaultFieldValues {
|
|
4
|
+
export interface DefaultFieldValues {
|
|
5
5
|
fromChain?: number;
|
|
6
6
|
fromToken?: string;
|
|
7
7
|
toChain?: number;
|
|
@@ -10,7 +10,7 @@ interface DefaultFieldValues {
|
|
|
10
10
|
fromAmount: string;
|
|
11
11
|
toAmount: string;
|
|
12
12
|
}
|
|
13
|
-
interface DefaultValues extends DefaultFieldValues {
|
|
13
|
+
export interface DefaultValues extends DefaultFieldValues {
|
|
14
14
|
cashFiatAmount: string;
|
|
15
15
|
contractCalls?: ContractCall[];
|
|
16
16
|
tokenSearchFilter: string;
|
|
@@ -23,38 +23,38 @@ interface DefaultValues extends DefaultFieldValues {
|
|
|
23
23
|
/** Limit-order: id of the route the user picked. */
|
|
24
24
|
selectedRouteId?: string;
|
|
25
25
|
}
|
|
26
|
-
type GenericFormValue = string | number | boolean | ContractCall[] | undefined;
|
|
27
|
-
interface FormValueControl<T> {
|
|
26
|
+
export type GenericFormValue = string | number | boolean | ContractCall[] | undefined;
|
|
27
|
+
export interface FormValueControl<T> {
|
|
28
28
|
isTouched: boolean;
|
|
29
29
|
isDirty: boolean;
|
|
30
30
|
value: T;
|
|
31
31
|
}
|
|
32
|
-
type FormValues = { [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]>; };
|
|
33
|
-
type FormFieldNames = keyof FormValues;
|
|
34
|
-
type ExtractValueType<T> = T extends FormValueControl<infer U> ? U : never;
|
|
35
|
-
type FormFieldArray<T extends FormFieldNames[]> = { [K in keyof T]: ExtractValueType<FormValues[T[K]]>; };
|
|
36
|
-
type TouchedFields = { [K in FormFieldNames]?: boolean; };
|
|
32
|
+
export type FormValues = { [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]>; };
|
|
33
|
+
export type FormFieldNames = keyof FormValues;
|
|
34
|
+
export type ExtractValueType<T> = T extends FormValueControl<infer U> ? U : never;
|
|
35
|
+
export type FormFieldArray<T extends FormFieldNames[]> = { [K in keyof T]: ExtractValueType<FormValues[T[K]]>; };
|
|
36
|
+
export type TouchedFields = { [K in FormFieldNames]?: boolean; };
|
|
37
37
|
type ValidationFn = (value: any) => Promise<boolean | string>;
|
|
38
|
-
interface ValidationProps {
|
|
38
|
+
export interface ValidationProps {
|
|
39
39
|
isValid: boolean;
|
|
40
40
|
isValidating: boolean;
|
|
41
41
|
errors: { [K in FormFieldNames]?: string; };
|
|
42
42
|
validation: { [K in FormFieldNames]?: ValidationFn; };
|
|
43
43
|
}
|
|
44
|
-
interface ValidationActions {
|
|
44
|
+
export interface ValidationActions {
|
|
45
45
|
addFieldValidation: (name: FormFieldNames, validationFn: ValidationFn) => void;
|
|
46
46
|
triggerFieldValidation: (name: FormFieldNames) => Promise<boolean>;
|
|
47
47
|
clearErrors: (name: FormFieldNames) => void;
|
|
48
48
|
}
|
|
49
|
-
interface FormProps {
|
|
49
|
+
export interface FormProps {
|
|
50
50
|
defaultValues: FormValues;
|
|
51
51
|
userValues: FormValues;
|
|
52
52
|
touchedFields: { [K in FormFieldNames]?: boolean; };
|
|
53
53
|
}
|
|
54
|
-
interface ResetOptions {
|
|
54
|
+
export interface ResetOptions {
|
|
55
55
|
defaultValue?: GenericFormValue;
|
|
56
56
|
}
|
|
57
|
-
interface FormActions {
|
|
57
|
+
export interface FormActions {
|
|
58
58
|
setDefaultValues: (formValues: DefaultValues) => void;
|
|
59
59
|
setUserAndDefaultValues: (formValues: Partial<DefaultValues>) => void;
|
|
60
60
|
isTouched: (fieldName: FormFieldNames) => boolean;
|
|
@@ -64,21 +64,20 @@ interface FormActions {
|
|
|
64
64
|
setFieldValue: (fieldName: FormFieldNames, value: GenericFormValue, options?: SetOptions) => void;
|
|
65
65
|
getFieldValues: <T extends FormFieldNames[]>(...names: T) => FormFieldArray<T>;
|
|
66
66
|
}
|
|
67
|
-
type FormValuesState = FormProps & FormActions & ValidationProps & ValidationActions;
|
|
68
|
-
type FormStoreStore = UseBoundStore<StoreApi<FormValuesState>>;
|
|
69
|
-
interface SetOptions {
|
|
67
|
+
export type FormValuesState = FormProps & FormActions & ValidationProps & ValidationActions;
|
|
68
|
+
export type FormStoreStore = UseBoundStore<StoreApi<FormValuesState>>;
|
|
69
|
+
export interface SetOptions {
|
|
70
70
|
isDirty?: boolean;
|
|
71
71
|
isTouched?: boolean;
|
|
72
72
|
}
|
|
73
|
-
type FormType = "from" | "to";
|
|
74
|
-
interface FormTypeProps {
|
|
73
|
+
export type FormType = "from" | "to";
|
|
74
|
+
export interface FormTypeProps {
|
|
75
75
|
formType: FormType;
|
|
76
76
|
}
|
|
77
|
-
declare const FormKeyHelper: {
|
|
77
|
+
export declare const FormKeyHelper: {
|
|
78
78
|
getChainKey: (formType: FormType) => "fromChain" | "toChain";
|
|
79
79
|
getTokenKey: (formType: FormType) => "fromToken" | "toToken";
|
|
80
80
|
getAmountKey: (formType: FormType) => "fromAmount" | "toAmount";
|
|
81
81
|
};
|
|
82
82
|
//#endregion
|
|
83
|
-
export { DefaultFieldValues, DefaultValues, ExtractValueType, FormActions, FormFieldArray, FormFieldNames, FormKeyHelper, FormProps, FormStoreStore, FormType, FormTypeProps, FormValueControl, FormValues, FormValuesState, GenericFormValue, ResetOptions, SetOptions, TouchedFields, ValidationActions, ValidationProps };
|
|
84
83
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/form/types.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/form/types.ts"],"mappings":";;;iBAGiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,sBAAsB;EACrC;EACA,gBAAgB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;YAGU,+CAIR;iBAEa,iBAAiB;EAChC;EACA;EACA,OAAO;;YAGG,gBACT,kBAAkB,gBAAgB,iBAAiB,cAAc;YAGxD,uBAAuB;YACvB,iBAAiB,KAC3B,UAAU,uBAAuB,KAAK;YAC5B,eAAe,UAAU,uBAClC,WAAW,IAAI,iBAAiB,WAAW,EAAE;YAGpC,mBAAmB,KAAK;KAE/B,gBAAgB,eAAe;iBACnB;EACf;EACA;EACA,WACG,KAAK;EAER,eACG,KAAK,kBAAkB;;iBAIX;EACf,qBAAqB,MAAM,gBAAgB,cAAc;EACzD,yBAAyB,MAAM,mBAAmB;EAClD,cAAc,MAAM;;iBAGL;EACf,eAAe;EACf,YAAY;EACZ,kBAAkB,KAAK;;iBAGR;EACf,eAAe;;iBAGA;EACf,mBAAmB,YAAY;EAC/B,0BAA0B,YAAY,QAAQ;EAC9C,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,eAAe,WAAW;EAC1B,aAAa,WAAW,gBAAgB,eAAe;EACvD,gBACE,WAAW,gBACX,OAAO,kBACP,UAAU;EAEZ,iBAAiB,UAAU,qBAAqB,OAAO,MAAM,eAAe;;YAGlE,kBAAkB,YAC5B,cACA,kBACA;YAEU,iBAAiB,cAAc,SAAS;iBAEnC;EACf;EACA;;YAGU;iBAEK;EACf,UAAU;;qBAGC;EACX,cAAc,UAAU;EAExB,cAAc,UAAU;EAExB,eAAe,UAAU"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FormActions } from "./types.js";
|
|
2
2
|
//#region src/stores/form/useFieldActions.d.ts
|
|
3
|
-
declare const useFieldActions: () => FormActions;
|
|
3
|
+
export declare const useFieldActions: () => FormActions;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useFieldActions };
|
|
6
5
|
//# sourceMappingURL=useFieldActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldActions.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldActions.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useFieldActions.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldActions.ts"],"mappings":";;qBAaa,uBAAsB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FormFieldArray, FormFieldNames } from "./types.js";
|
|
2
2
|
//#region src/stores/form/useFieldValues.d.ts
|
|
3
|
-
declare const useFieldValues: <T extends FormFieldNames[]>(...names: T) => FormFieldArray<T>;
|
|
3
|
+
export declare const useFieldValues: <T extends FormFieldNames[]>(...names: T) => FormFieldArray<T>;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { useFieldValues };
|
|
6
5
|
//# sourceMappingURL=useFieldValues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldValues.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldValues.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useFieldValues.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldValues.ts"],"mappings":";;qBAIa,iBAAkB,UAAU,qBACpC,OAAO,MACT,eAAe"}
|
|
@@ -6,7 +6,7 @@ interface HeaderStateBase {
|
|
|
6
6
|
headerHeight: number;
|
|
7
7
|
backAction?: () => void;
|
|
8
8
|
}
|
|
9
|
-
interface HeaderState extends HeaderStateBase {
|
|
9
|
+
export interface HeaderState extends HeaderStateBase {
|
|
10
10
|
setAction(element?: React.ReactNode | null): () => void;
|
|
11
11
|
setTitle(title?: string): () => void;
|
|
12
12
|
removeAction(): void;
|
|
@@ -16,5 +16,4 @@ interface HeaderState extends HeaderStateBase {
|
|
|
16
16
|
executeBackAction(): void;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
export { HeaderState };
|
|
20
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/header/types.ts"],"mappings":";;UAIU;EACR,UAAU,MAAM;EAChB;EACA;EACA;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/header/types.ts"],"mappings":";;UAIU;EACR,UAAU,MAAM;EAChB;EACA;EACA;;iBAGe,oBAAoB;EACnC,UAAU,UAAU,MAAM;EAC1B,SAAS;EACT;EACA;EACA,gBAAgB;EAChB,cAAc;EACd"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "../types.js";
|
|
2
2
|
import { HeaderState } from "./types.js";
|
|
3
3
|
//#region src/stores/header/useHeaderStore.d.ts
|
|
4
|
-
declare function useHeaderStore<T>(selector: (state: HeaderState) => T): T;
|
|
5
|
-
declare function useSetHeaderHeight(): any;
|
|
4
|
+
export declare function useHeaderStore<T>(selector: (state: HeaderState) => T): T;
|
|
5
|
+
export declare function useSetHeaderHeight(): any;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { useHeaderStore, useSetHeaderHeight };
|
|
8
7
|
//# sourceMappingURL=useHeaderStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderStore.d.ts","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useHeaderStore.d.ts","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"mappings":";;;wBA8BgB,eAAe,GAAG,WAAW,OAAO,gBAAgB,IAAI;wBAkBxD"}
|
|
@@ -7,7 +7,6 @@ interface InputModeState {
|
|
|
7
7
|
setInputMode: (formType: FormTypeProps["formType"], mode: InputMode) => void;
|
|
8
8
|
toggleInputMode: (formType: FormTypeProps["formType"]) => void;
|
|
9
9
|
}
|
|
10
|
-
declare const useInputModeStore: UseBoundStore<StoreApi<InputModeState>>;
|
|
10
|
+
export declare const useInputModeStore: UseBoundStore<StoreApi<InputModeState>>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { useInputModeStore };
|
|
13
12
|
//# sourceMappingURL=useInputModeStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputModeStore.d.ts","names":[],"sources":["../../../../src/stores/inputMode/useInputModeStore.ts"],"mappings":";;;KAIK;UAEK;EACR,WAAW,sBAAsB;EACjC,eAAe,UAAU,2BAA2B,MAAM;EAC1D,kBAAkB,UAAU;;
|
|
1
|
+
{"version":3,"file":"useInputModeStore.d.ts","names":[],"sources":["../../../../src/stores/inputMode/useInputModeStore.ts"],"mappings":";;;KAIK;UAEK;EACR,WAAW,sBAAsB;EACjC,eAAe,UAAU,2BAA2B,MAAM;EAC1D,kBAAkB,UAAU;;qBAGjB,mBAAmB,cAAc,SAAS"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRecentTokensStore } from "./createRecentTokensStore.js";
|
|
2
|
+
import { createContext, use, useRef } from "react";
|
|
3
|
+
import { useShallow } from "zustand/shallow";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/stores/recentTokens/RecentTokensStore.tsx
|
|
6
|
+
const RecentTokensStoreContext = createContext(null);
|
|
7
|
+
const RecentTokensStoreProvider = ({ children, ...props }) => {
|
|
8
|
+
const storeRef = useRef(null);
|
|
9
|
+
if (!storeRef.current) storeRef.current = createRecentTokensStore(props);
|
|
10
|
+
return /* @__PURE__ */ jsx(RecentTokensStoreContext, {
|
|
11
|
+
value: storeRef.current,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
function useRecentTokensStore(selector) {
|
|
16
|
+
const useStore = use(RecentTokensStoreContext);
|
|
17
|
+
if (!useStore) throw new Error(`You forgot to wrap your component in <${RecentTokensStoreProvider.name}>.`);
|
|
18
|
+
return useStore(useShallow(selector));
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { RecentTokensStoreProvider, useRecentTokensStore };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=RecentTokensStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentTokensStore.js","names":[],"sources":["../../../../src/stores/recentTokens/RecentTokensStore.tsx"],"sourcesContent":["import { type Context, createContext, use, useRef } from 'react'\nimport { useShallow } from 'zustand/shallow'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport { createRecentTokensStore } from './createRecentTokensStore.js'\nimport type { RecentTokensState, RecentTokensStore } from './types.js'\n\nconst RecentTokensStoreContext: Context<RecentTokensStore | null> =\n createContext<RecentTokensStore | null>(null)\n\nexport const RecentTokensStoreProvider: React.FC<PersistStoreProviderProps> = ({\n children,\n ...props\n}) => {\n const storeRef = useRef<RecentTokensStore>(null)\n\n if (!storeRef.current) {\n storeRef.current = createRecentTokensStore(props)\n }\n\n return (\n <RecentTokensStoreContext value={storeRef.current}>\n {children}\n </RecentTokensStoreContext>\n )\n}\n\nexport function useRecentTokensStore<T>(\n selector: (store: RecentTokensState) => T\n): T {\n const useStore = use(RecentTokensStoreContext)\n\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${RecentTokensStoreProvider.name}>.`\n )\n }\n\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;AAMA,MAAM,2BACJ,cAAwC,IAAI;AAE9C,MAAa,6BAAkE,EAC7E,UACA,GAAG,YACC;CACJ,MAAM,WAAW,OAA0B,IAAI;CAE/C,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,wBAAwB,KAAK;CAGlD,OACE,oBAAC,0BAAD;EAA0B,OAAO,SAAS;EACvC;CACuB,CAAA;AAE9B;AAEA,SAAgB,qBACd,UACG;CACH,MAAM,WAAW,IAAI,wBAAwB;CAE7C,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,0BAA0B,KAAK,GAC1E;CAGF,OAAO,SAAS,WAAW,QAAQ,CAAC;AACtC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getTokenKey } from "./utils.js";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
import { persist } from "zustand/middleware";
|
|
4
|
+
//#region src/stores/recentTokens/createRecentTokensStore.ts
|
|
5
|
+
const recentTokensLimit = 10;
|
|
6
|
+
const isStoredRecentToken = (value) => {
|
|
7
|
+
const token = value;
|
|
8
|
+
return typeof token === "object" && token !== null && typeof token.chainId === "number" && typeof token.address === "string" && typeof token.symbol === "string" && typeof token.name === "string" && typeof token.decimals === "number" && (token.logoURI === void 0 || typeof token.logoURI === "string") && (token.flagged === void 0 || typeof token.flagged === "boolean");
|
|
9
|
+
};
|
|
10
|
+
const sanitizeRecentTokens = (stored) => {
|
|
11
|
+
if (!Array.isArray(stored)) return [];
|
|
12
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13
|
+
const recentTokens = [];
|
|
14
|
+
for (const token of stored) {
|
|
15
|
+
if (!isStoredRecentToken(token)) continue;
|
|
16
|
+
const key = getTokenKey(token.chainId, token.address);
|
|
17
|
+
if (!seen.has(key)) {
|
|
18
|
+
seen.add(key);
|
|
19
|
+
recentTokens.push(token);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return recentTokens.slice(0, recentTokensLimit);
|
|
23
|
+
};
|
|
24
|
+
const createRecentTokensStore = ({ namePrefix }) => create()(persist((set, get) => ({
|
|
25
|
+
recentTokens: [],
|
|
26
|
+
addRecentToken: (token) => {
|
|
27
|
+
const key = getTokenKey(token.chainId, token.address);
|
|
28
|
+
set((state) => ({ recentTokens: [token, ...state.recentTokens.filter((t) => getTokenKey(t.chainId, t.address) !== key)].slice(0, recentTokensLimit) }));
|
|
29
|
+
},
|
|
30
|
+
removeRecentToken: (chainId, address) => {
|
|
31
|
+
const key = getTokenKey(chainId, address);
|
|
32
|
+
set((state) => ({ recentTokens: state.recentTokens.filter((t) => getTokenKey(t.chainId, t.address) !== key) }));
|
|
33
|
+
},
|
|
34
|
+
clearRecentTokens: (entries) => set((state) => {
|
|
35
|
+
const removed = new Set(entries.map((e) => getTokenKey(e.chainId, e.address)));
|
|
36
|
+
return { recentTokens: state.recentTokens.filter((t) => !removed.has(getTokenKey(t.chainId, t.address))) };
|
|
37
|
+
}),
|
|
38
|
+
isRecentToken: (chainId, address) => {
|
|
39
|
+
const key = getTokenKey(chainId, address);
|
|
40
|
+
return get().recentTokens.some((t) => getTokenKey(t.chainId, t.address) === key);
|
|
41
|
+
}
|
|
42
|
+
}), {
|
|
43
|
+
name: `${namePrefix || "li.fi"}-recent-tokens`,
|
|
44
|
+
version: 0,
|
|
45
|
+
partialize: (state) => ({ recentTokens: state.recentTokens }),
|
|
46
|
+
merge: (persisted, current) => ({
|
|
47
|
+
...current,
|
|
48
|
+
recentTokens: sanitizeRecentTokens(persisted?.recentTokens)
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
//#endregion
|
|
52
|
+
export { createRecentTokensStore };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=createRecentTokensStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRecentTokensStore.js","names":[],"sources":["../../../../src/stores/recentTokens/createRecentTokensStore.ts"],"sourcesContent":["import type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport type { PersistStoreProps } from '../types.js'\nimport type {\n RecentToken,\n RecentTokensProps,\n RecentTokensState,\n} from './types.js'\nimport { getTokenKey } from './utils.js'\n\nconst recentTokensLimit = 10\n\nconst isStoredRecentToken = (value: unknown): value is RecentToken => {\n const token = value as Partial<RecentToken> | null\n return (\n typeof token === 'object' &&\n token !== null &&\n typeof token.chainId === 'number' &&\n typeof token.address === 'string' &&\n typeof token.symbol === 'string' &&\n typeof token.name === 'string' &&\n typeof token.decimals === 'number' &&\n (token.logoURI === undefined || typeof token.logoURI === 'string') &&\n (token.flagged === undefined || typeof token.flagged === 'boolean')\n )\n}\n\n// The key lives on the integrator's origin, so its content is untrusted.\nconst sanitizeRecentTokens = (stored: unknown): RecentToken[] => {\n if (!Array.isArray(stored)) {\n return []\n }\n const seen = new Set<string>()\n const recentTokens: RecentToken[] = []\n for (const token of stored) {\n if (!isStoredRecentToken(token)) {\n continue\n }\n const key = getTokenKey(token.chainId, token.address)\n if (!seen.has(key)) {\n seen.add(key)\n recentTokens.push(token)\n }\n }\n return recentTokens.slice(0, recentTokensLimit)\n}\n\nexport const createRecentTokensStore = ({\n namePrefix,\n}: PersistStoreProps): UseBoundStore<StoreApi<RecentTokensState>> =>\n create<RecentTokensState>()(\n persist(\n (set, get) => ({\n recentTokens: [],\n addRecentToken: (token) => {\n const key = getTokenKey(token.chainId, token.address)\n set((state) => ({\n recentTokens: [\n token,\n ...state.recentTokens.filter(\n (t) => getTokenKey(t.chainId, t.address) !== key\n ),\n ].slice(0, recentTokensLimit),\n }))\n },\n removeRecentToken: (chainId, address) => {\n const key = getTokenKey(chainId, address)\n set((state) => ({\n recentTokens: state.recentTokens.filter(\n (t) => getTokenKey(t.chainId, t.address) !== key\n ),\n }))\n },\n clearRecentTokens: (entries) =>\n set((state) => {\n const removed = new Set(\n entries.map((e) => getTokenKey(e.chainId, e.address))\n )\n return {\n recentTokens: state.recentTokens.filter(\n (t) => !removed.has(getTokenKey(t.chainId, t.address))\n ),\n }\n }),\n isRecentToken: (chainId, address) => {\n const key = getTokenKey(chainId, address)\n return get().recentTokens.some(\n (t) => getTokenKey(t.chainId, t.address) === key\n )\n },\n }),\n {\n name: `${namePrefix || 'li.fi'}-recent-tokens`,\n version: 0,\n partialize: (state) => ({\n recentTokens: state.recentTokens,\n }),\n merge: (persisted, current) => ({\n ...current,\n recentTokens: sanitizeRecentTokens(\n (persisted as Partial<RecentTokensProps> | undefined)?.recentTokens\n ),\n }),\n }\n )\n )\n"],"mappings":";;;;AAWA,MAAM,oBAAoB;AAE1B,MAAM,uBAAuB,UAAyC;CACpE,MAAM,QAAQ;CACd,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAO,MAAM,YAAY,YACzB,OAAO,MAAM,YAAY,YACzB,OAAO,MAAM,WAAW,YACxB,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,aAAa,aACzB,MAAM,YAAY,KAAA,KAAa,OAAO,MAAM,YAAY,cACxD,MAAM,YAAY,KAAA,KAAa,OAAO,MAAM,YAAY;AAE7D;AAGA,MAAM,wBAAwB,WAAmC;CAC/D,IAAI,CAAC,MAAM,QAAQ,MAAM,GACvB,OAAO,CAAC;CAEV,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,eAA8B,CAAC;CACrC,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,CAAC,oBAAoB,KAAK,GAC5B;EAEF,MAAM,MAAM,YAAY,MAAM,SAAS,MAAM,OAAO;EACpD,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,aAAa,KAAK,KAAK;EACzB;CACF;CACA,OAAO,aAAa,MAAM,GAAG,iBAAiB;AAChD;AAEA,MAAa,2BAA2B,EACtC,iBAEA,OAA0B,CAAC,CACzB,SACG,KAAK,SAAS;CACb,cAAc,CAAC;CACf,iBAAiB,UAAU;EACzB,MAAM,MAAM,YAAY,MAAM,SAAS,MAAM,OAAO;EACpD,KAAK,WAAW,EACd,cAAc,CACZ,OACA,GAAG,MAAM,aAAa,QACnB,MAAM,YAAY,EAAE,SAAS,EAAE,OAAO,MAAM,GAC/C,CACF,CAAC,CAAC,MAAM,GAAG,iBAAiB,EAC9B,EAAE;CACJ;CACA,oBAAoB,SAAS,YAAY;EACvC,MAAM,MAAM,YAAY,SAAS,OAAO;EACxC,KAAK,WAAW,EACd,cAAc,MAAM,aAAa,QAC9B,MAAM,YAAY,EAAE,SAAS,EAAE,OAAO,MAAM,GAC/C,EACF,EAAE;CACJ;CACA,oBAAoB,YAClB,KAAK,UAAU;EACb,MAAM,UAAU,IAAI,IAClB,QAAQ,KAAK,MAAM,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CACtD;EACA,OAAO,EACL,cAAc,MAAM,aAAa,QAC9B,MAAM,CAAC,QAAQ,IAAI,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CACvD,EACF;CACF,CAAC;CACH,gBAAgB,SAAS,YAAY;EACnC,MAAM,MAAM,YAAY,SAAS,OAAO;EACxC,OAAO,IAAI,CAAC,CAAC,aAAa,MACvB,MAAM,YAAY,EAAE,SAAS,EAAE,OAAO,MAAM,GAC/C;CACF;AACF,IACA;CACE,MAAM,GAAG,cAAc,QAAQ;CAC/B,SAAS;CACT,aAAa,WAAW,EACtB,cAAc,MAAM,aACtB;CACA,QAAQ,WAAW,aAAa;EAC9B,GAAG;EACH,cAAc,qBACX,WAAsD,YACzD;CACF;AACF,CACF,CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/stores/recentTokens/utils.ts
|
|
2
|
+
const getTokenKey = (chainId, address) => `${chainId}-${address.toLowerCase()}`;
|
|
3
|
+
const toRecentToken = (token) => ({
|
|
4
|
+
chainId: Number(token.chainId),
|
|
5
|
+
address: token.address,
|
|
6
|
+
symbol: token.symbol,
|
|
7
|
+
name: token.name ?? "",
|
|
8
|
+
decimals: token.decimals,
|
|
9
|
+
logoURI: token.logoURI ?? void 0,
|
|
10
|
+
flagged: token.verificationStatus === "flagged" || void 0
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getTokenKey, toRecentToken };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/stores/recentTokens/utils.ts"],"sourcesContent":["import type { TokenAmount } from '../../types/token.js'\nimport type { RecentToken } from './types.js'\n\nexport const getTokenKey = (chainId: number, address: string): string =>\n `${chainId}-${address.toLowerCase()}`\n\n// No price, and no verdict but a flag: a stale \"verified\" would hide a warning.\nexport const toRecentToken = (token: TokenAmount): RecentToken => ({\n // Plain-JS configs can pass a string chainId or null fields; hydration rejects both.\n chainId: Number(token.chainId),\n // Keep the casing: the form and the selected check compare it exactly.\n address: token.address,\n symbol: token.symbol,\n name: token.name ?? '',\n decimals: token.decimals,\n logoURI: token.logoURI ?? undefined,\n flagged: token.verificationStatus === 'flagged' || undefined,\n})\n"],"mappings":";AAGA,MAAa,eAAe,SAAiB,YAC3C,GAAG,QAAQ,GAAG,QAAQ,YAAY;AAGpC,MAAa,iBAAiB,WAAqC;CAEjE,SAAS,OAAO,MAAM,OAAO;CAE7B,SAAS,MAAM;CACf,QAAQ,MAAM;CACd,MAAM,MAAM,QAAQ;CACpB,UAAU,MAAM;CAChB,SAAS,MAAM,WAAW,KAAA;CAC1B,SAAS,MAAM,uBAAuB,aAAa,KAAA;AACrD"}
|
|
@@ -2,8 +2,7 @@ import { RouteExecutionState } from "./types.js";
|
|
|
2
2
|
import "../types.js";
|
|
3
3
|
import { JSX } from "react";
|
|
4
4
|
//#region src/stores/routes/RouteExecutionStore.d.ts
|
|
5
|
-
declare function useRouteExecutionStoreContext(): any;
|
|
6
|
-
declare function useRouteExecutionStore<T>(selector: (state: RouteExecutionState) => T): T;
|
|
5
|
+
export declare function useRouteExecutionStoreContext(): any;
|
|
6
|
+
export declare function useRouteExecutionStore<T>(selector: (state: RouteExecutionState) => T): T;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { useRouteExecutionStore, useRouteExecutionStoreContext };
|
|
9
8
|
//# sourceMappingURL=RouteExecutionStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteExecutionStore.d.ts","names":[],"sources":["../../../../src/stores/routes/RouteExecutionStore.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"RouteExecutionStore.d.ts","names":[],"sources":["../../../../src/stores/routes/RouteExecutionStore.tsx"],"mappings":";;;;wBA4BgB;wBAUA,uBAAuB,GACrC,WAAW,OAAO,wBAAwB,IACzC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Route, RouteExtended } from "@lifi/sdk";
|
|
2
2
|
//#region src/stores/routes/types.d.ts
|
|
3
|
-
interface RouteExecution {
|
|
3
|
+
export interface RouteExecution {
|
|
4
4
|
route: RouteExtended;
|
|
5
5
|
status: RouteExecutionStatus;
|
|
6
6
|
}
|
|
7
|
-
interface RouteExecutionState {
|
|
7
|
+
export interface RouteExecutionState {
|
|
8
8
|
routes: Partial<Record<string, RouteExecution>>;
|
|
9
9
|
setExecutableRoute: (route: Route, observableRouteIds?: string[]) => void;
|
|
10
10
|
updateRoute: (route: Route) => void;
|
|
11
11
|
deleteRoute: (routeId: string) => void;
|
|
12
12
|
deleteRoutes: (type: "completed" | "active" | "failed", accountAddresses?: string[]) => void;
|
|
13
13
|
}
|
|
14
|
-
declare enum RouteExecutionStatus {
|
|
14
|
+
export declare enum RouteExecutionStatus {
|
|
15
15
|
Idle = 1,
|
|
16
16
|
Pending = 2,
|
|
17
17
|
Done = 4,
|
|
@@ -20,5 +20,4 @@ declare enum RouteExecutionStatus {
|
|
|
20
20
|
Refunded = 32
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
export { RouteExecution, RouteExecutionState, RouteExecutionStatus };
|
|
24
23
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/routes/types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/routes/types.ts"],"mappings":";;iBAEiB;EACf,OAAO;EACP,QAAQ;;iBAGO;EACf,QAAQ,QAAQ,eAAe;EAC/B,qBAAqB,OAAO,OAAO;EACnC,cAAc,OAAO;EACrB,cAAc;EACd,eACE,yCACA;;oBAIQ;EACV;EACA;EACA;EACA;EACA;EACA"}
|
|
@@ -5,18 +5,19 @@ import { useAccount } from "@lifi/wallet-management";
|
|
|
5
5
|
//#region src/stores/routes/useRouteExecutionIndicator.ts
|
|
6
6
|
const isRecentTransaction = (route) => {
|
|
7
7
|
const startedAt = route.route.steps[0]?.execution?.startedAt ?? 0;
|
|
8
|
-
return startedAt > 0 && Date.now() - startedAt <
|
|
8
|
+
return startedAt > 0 && Date.now() - startedAt < 864e5;
|
|
9
9
|
};
|
|
10
10
|
const useRouteExecutionIndicator = () => {
|
|
11
11
|
const { accounts } = useAccount();
|
|
12
12
|
const accountAddresses = useMemo(() => accounts.map((account) => account.address), [accounts]);
|
|
13
|
-
|
|
13
|
+
const selector = useCallback((state) => {
|
|
14
14
|
const recentOwnedRoutes = Object.values(state.routes).filter((route) => accountAddresses.includes(route.route.fromAddress) && isRecentTransaction(route));
|
|
15
15
|
return {
|
|
16
16
|
failed: recentOwnedRoutes.some((r) => r.status === 8),
|
|
17
17
|
active: recentOwnedRoutes.some((r) => r.status === 2)
|
|
18
18
|
};
|
|
19
|
-
}, [accountAddresses])
|
|
19
|
+
}, [accountAddresses]);
|
|
20
|
+
return useRouteExecutionStore(selector);
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
22
23
|
export { useRouteExecutionIndicator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouteExecutionIndicator.js","names":[],"sources":["../../../../src/stores/routes/useRouteExecutionIndicator.ts"],"sourcesContent":["import { useAccount } from '@lifi/wallet-management'\nimport { useCallback, useMemo } from 'react'\nimport { useRouteExecutionStore } from './RouteExecutionStore.js'\nimport type { RouteExecution, RouteExecutionState } from './types.js'\nimport { RouteExecutionStatus } from './types.js'\n\nexport type RouteExecutionIndicator = {\n failed: boolean\n active: boolean\n}\n\nconst isRecentTransaction = (route: RouteExecution): boolean => {\n const startedAt = route.route.steps[0]?.execution?.startedAt ?? 0\n return startedAt > 0 && Date.now() - startedAt < 1000 * 60 * 60 * 24 // 1 day\n}\n\nexport const useRouteExecutionIndicator = (): RouteExecutionIndicator => {\n const { accounts } = useAccount()\n const accountAddresses = useMemo(\n () => accounts.map((account) => account.address),\n [accounts]\n )\n const selector = useCallback(\n (state: RouteExecutionState): RouteExecutionIndicator => {\n const routes = Object.values(state.routes) as RouteExecution[]\n const recentOwnedRoutes = routes.filter(\n (route) =>\n accountAddresses.includes(route.route.fromAddress) &&\n isRecentTransaction(route)\n )\n return {\n failed: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Failed\n ),\n active: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Pending\n ),\n }\n },\n [accountAddresses]\n )\n return useRouteExecutionStore(selector)\n}\n"],"mappings":";;;;;AAWA,MAAM,uBAAuB,UAAmC;CAC9D,MAAM,YAAY,MAAM,MAAM,MAAM,EAAE,EAAE,WAAW,aAAa;CAChE,OAAO,YAAY,KAAK,KAAK,IAAI,IAAI,YAAY
|
|
1
|
+
{"version":3,"file":"useRouteExecutionIndicator.js","names":[],"sources":["../../../../src/stores/routes/useRouteExecutionIndicator.ts"],"sourcesContent":["import { useAccount } from '@lifi/wallet-management'\nimport { useCallback, useMemo } from 'react'\nimport { useRouteExecutionStore } from './RouteExecutionStore.js'\nimport type { RouteExecution, RouteExecutionState } from './types.js'\nimport { RouteExecutionStatus } from './types.js'\n\nexport type RouteExecutionIndicator = {\n failed: boolean\n active: boolean\n}\n\nconst isRecentTransaction = (route: RouteExecution): boolean => {\n const startedAt = route.route.steps[0]?.execution?.startedAt ?? 0\n return startedAt > 0 && Date.now() - startedAt < 1000 * 60 * 60 * 24 // 1 day\n}\n\nexport const useRouteExecutionIndicator = (): RouteExecutionIndicator => {\n const { accounts } = useAccount()\n const accountAddresses = useMemo(\n () => accounts.map((account) => account.address),\n [accounts]\n )\n const selector = useCallback(\n (state: RouteExecutionState): RouteExecutionIndicator => {\n const routes = Object.values(state.routes) as RouteExecution[]\n const recentOwnedRoutes = routes.filter(\n (route) =>\n accountAddresses.includes(route.route.fromAddress) &&\n isRecentTransaction(route)\n )\n return {\n failed: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Failed\n ),\n active: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Pending\n ),\n }\n },\n [accountAddresses]\n )\n return useRouteExecutionStore(selector)\n}\n"],"mappings":";;;;;AAWA,MAAM,uBAAuB,UAAmC;CAC9D,MAAM,YAAY,MAAM,MAAM,MAAM,EAAE,EAAE,WAAW,aAAa;CAChE,OAAO,YAAY,KAAK,KAAK,IAAI,IAAI,YAAY;AACnD;AAEA,MAAa,mCAA4D;CACvE,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,mBAAmB,cACjB,SAAS,KAAK,YAAY,QAAQ,OAAO,GAC/C,CAAC,QAAQ,CACX;CACA,MAAM,WAAW,aACd,UAAwD;EAEvD,MAAM,oBADS,OAAO,OAAO,MAAM,MACJ,CAAC,CAAC,QAC9B,UACC,iBAAiB,SAAS,MAAM,MAAM,WAAW,KACjD,oBAAoB,KAAK,CAC7B;EACA,OAAO;GACL,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,CACX;GACA,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,CACX;EACF;CACF,GACA,CAAC,gBAAgB,CACnB;CACA,OAAO,uBAAuB,QAAQ;AACxC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ExecutionAction, RouteExtended } from "@lifi/sdk";
|
|
2
2
|
//#region src/stores/routes/utils.d.ts
|
|
3
|
-
declare const isRouteDone: (route: RouteExtended) => boolean;
|
|
4
|
-
declare const isRouteFailed: (route: RouteExtended) => boolean;
|
|
5
|
-
declare const isRouteActive: (route?: RouteExtended) => boolean;
|
|
6
|
-
declare const getSourceTxHash: (route?: RouteExtended) => string | undefined;
|
|
3
|
+
export declare const isRouteDone: (route: RouteExtended) => boolean;
|
|
4
|
+
export declare const isRouteFailed: (route: RouteExtended) => boolean;
|
|
5
|
+
export declare const isRouteActive: (route?: RouteExtended) => boolean;
|
|
6
|
+
export declare const getSourceTxHash: (route?: RouteExtended) => string | undefined;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { getSourceTxHash, isRouteActive, isRouteDone, isRouteFailed };
|
|
9
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/stores/routes/utils.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/stores/routes/utils.ts"],"mappings":";;qBAGa,cAAe,OAAO;qBAgBtB,gBAAiB,OAAO;qBAIxB,gBAAiB,QAAQ;qBAgCzB,kBAAmB,QAAQ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SettingsStoreProviderProps } from "./types.js";
|
|
2
2
|
import { JSX, PropsWithChildren } from "react";
|
|
3
3
|
//#region src/stores/settings/SettingsStore.d.ts
|
|
4
|
-
declare const SettingsStoreProvider: ({ children, config }: PropsWithChildren<SettingsStoreProviderProps>) => JSX.Element;
|
|
5
|
-
declare function useSettingsStoreContext(): any;
|
|
4
|
+
export declare const SettingsStoreProvider: ({ children, config }: PropsWithChildren<SettingsStoreProviderProps>) => JSX.Element;
|
|
5
|
+
export declare function useSettingsStoreContext(): any;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { SettingsStoreProvider, useSettingsStoreContext };
|
|
8
7
|
//# sourceMappingURL=SettingsStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsStore.d.ts","names":[],"sources":["../../../../src/stores/settings/SettingsStore.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SettingsStore.d.ts","names":[],"sources":["../../../../src/stores/settings/SettingsStore.tsx"],"mappings":";;;qBAgBa,0BACX,UACA,UACC,kBAAkB,gCAA8B,IAAI;wBAYvC"}
|