@lifi/widget 4.0.0-beta.18 → 4.0.0-beta.19
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.js.map +1 -1
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppDrawer.js.map +1 -1
- package/dist/esm/AppLayout.js.map +1 -1
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputStartAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/Avatar/ChainBadgeContent.js.map +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/TokenAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/utils.js.map +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.style.js.map +1 -1
- package/dist/esm/components/Chains/ChainListItem.js.map +1 -1
- package/dist/esm/components/Chains/ChainSearchInput.js.map +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -1
- package/dist/esm/components/Chains/PinChainButton.js.map +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/ContextMenu.js.map +1 -1
- package/dist/esm/components/ContractComponent/ContractComponent.js.map +1 -1
- package/dist/esm/components/ContractComponent/ItemPrice.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.js.map +1 -1
- package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.js.map +1 -1
- package/dist/esm/components/Header/ActivitiesButton.js.map +1 -1
- package/dist/esm/components/Header/BackButton.js.map +1 -1
- package/dist/esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/dist/esm/components/Header/DisconnectIconButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/Header/SplitNavigationTabs.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/Header/WalletMenu.js.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.js.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.style.js.map +1 -1
- package/dist/esm/components/Initializer.js.map +1 -1
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/Messages/AccountDeployedMessage.js.map +1 -1
- package/dist/esm/components/Messages/AccountNotDeployedMessage.js.map +1 -1
- package/dist/esm/components/Messages/FundsSufficiencyMessage.js.map +1 -1
- package/dist/esm/components/Messages/GasRefuelMessage.js.map +1 -1
- package/dist/esm/components/Messages/GasSufficiencyMessage.js.map +1 -1
- package/dist/esm/components/Messages/MinFromAmountUSDMessage.js.map +1 -1
- package/dist/esm/components/Messages/MissingRouteRequiredAccountMessage.js.map +1 -1
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
- package/dist/esm/components/NotFound.js.map +1 -1
- package/dist/esm/components/PageEntered.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.js.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardSkeleton.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteNotFoundCard.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteToken.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteTokens.js.map +1 -1
- package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.js.map +1 -1
- package/dist/esm/components/SelectChainAndToken.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/Step/DestinationWalletAddress.js.map +1 -1
- package/dist/esm/components/Step/Step.js.map +1 -1
- package/dist/esm/components/Step/StepAction.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js.map +1 -1
- package/dist/esm/components/Step/StepList.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/StepDivider/StepDivider.js.map +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js.map +1 -1
- package/dist/esm/components/Timer/StepTimer.js.map +1 -1
- package/dist/esm/components/Timer/TimerContent.js.map +1 -1
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/PinTokenButton.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/TokenNotFound.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/Tools/ToolItem.js.map +1 -1
- package/dist/esm/components/Tools/Tools.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCardSkeleton.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/timer/useExecutionTimer.js.map +1 -1
- package/dist/esm/hooks/timer/useInterval.js.map +1 -1
- package/dist/esm/hooks/timer/useTimer.js.map +1 -1
- package/dist/esm/hooks/timer/validate.js.map +1 -1
- package/dist/esm/hooks/useAccountsBalancesData.js.map +1 -1
- package/dist/esm/hooks/useActionMessage.js.map +1 -1
- package/dist/esm/hooks/useAddressActivity.js.map +1 -1
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useChain.js.map +1 -1
- package/dist/esm/hooks/useChains.js.map +1 -1
- package/dist/esm/hooks/useContactSupport.js.map +1 -1
- package/dist/esm/hooks/useDebouncedWatch.js.map +1 -1
- package/dist/esm/hooks/useDefaultElementId.js.map +1 -1
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useFromAmountThreshold.js.map +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
- package/dist/esm/hooks/useGasRefuel.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -1
- package/dist/esm/hooks/useHeader.js.map +1 -1
- package/dist/esm/hooks/useInitializeSDKProviders.js.map +1 -1
- package/dist/esm/hooks/useInitializer.js.map +1 -1
- package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
- package/dist/esm/hooks/useIsContractAddress.js.map +1 -1
- package/dist/esm/hooks/useLanguages.js.map +1 -1
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useLongPress.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRouteRequiredAccountConnection.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useScrollableContainer.js.map +1 -1
- package/dist/esm/hooks/useSetContentHeight.js.map +1 -1
- package/dist/esm/hooks/useSettingMonitor.js.map +1 -1
- package/dist/esm/hooks/useSwapOnly.js.map +1 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToAddressReset.js.map +1 -1
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenRateText.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/hooks/useWideVariant.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.js.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/ActiveTransactionItem.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/ActivitiesPageMenuButton.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/TransactionHistoryEmpty.js.map +1 -1
- package/dist/esm/pages/ActivitiesPage/TransactionHistoryItem.js.map +1 -1
- package/dist/esm/pages/LanguagesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainWarningMessages.js.map +1 -1
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/GasPriceSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/LanguageSetting.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ResetSettingsButton.js.map +1 -1
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SmallBalanceFilterSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ActionRow.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ReceiptsCard.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/SentToWalletRow.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/StepActionRow.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/StepActionsList.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StartTransactionButton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/I18nProvider/i18n.js.map +1 -1
- package/dist/esm/providers/QueryClientProvider.js.map +1 -1
- package/dist/esm/providers/SDKClientProvider.js.map +1 -1
- package/dist/esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/bookmarks/createBookmarkStore.js.map +1 -1
- package/dist/esm/stores/bookmarks/useBookmarkActions.js.map +1 -1
- package/dist/esm/stores/bookmarks/useBookmarks.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/useChainOrder.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/createFormStore.js.map +1 -1
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.js.map +1 -1
- package/dist/esm/stores/form/useFieldValues.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/form/useFormStore.js.map +1 -1
- package/dist/esm/stores/form/useTouchedFields.js.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useIntermediateRoutesStore.js.map +1 -1
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/useSetExecutableRoute.js.map +1 -1
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/useSettings.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
- package/dist/esm/stores/settings/useSplitSubvariantStore.js.map +1 -1
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/themes/utils.js.map +1 -1
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.js.map +1 -1
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/currencyExtendedFormatter.js.map +1 -1
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/deepMerge.js.map +1 -1
- package/dist/esm/utils/fees.js.map +1 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getActionMessage.js.map +1 -1
- package/dist/esm/utils/getErrorMessage.js.map +1 -1
- package/dist/esm/utils/getPriceImpact.js.map +1 -1
- package/dist/esm/utils/input.js.map +1 -1
- package/dist/esm/utils/item.js.map +1 -1
- package/dist/esm/utils/percentFormatter.js.map +1 -1
- package/dist/esm/utils/prepareActions.js.map +1 -1
- package/dist/esm/utils/timer.js.map +1 -1
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/dist/esm/utils/variant.js.map +1 -1
- package/dist/esm/utils/widgetSize.js.map +1 -1
- package/package.json +11 -11
- package/src/config/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPinnedTokensStore.js","names":[],"sources":["../../../../src/stores/pinnedTokens/createPinnedTokensStore.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 { PinnedTokensState } from './types.js'\n\nexport const createPinnedTokensStore = ({\n namePrefix,\n}: PersistStoreProps): UseBoundStore<StoreApi<PinnedTokensState>> =>\n create<PinnedTokensState>()(\n persist(\n (set, get) => ({\n pinnedTokens: {},\n pinToken: (chainId: number, tokenAddress: string) => {\n set((state) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = state.pinnedTokens[chainId] || []\n if (!chainTokens.includes(normalizedAddress)) {\n return {\n pinnedTokens: {\n ...state.pinnedTokens,\n [chainId]: [...chainTokens, normalizedAddress],\n },\n }\n }\n return state\n })\n },\n unpinToken: (chainId: number, tokenAddress: string) => {\n set((state) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = state.pinnedTokens[chainId] || []\n if (chainTokens.includes(normalizedAddress)) {\n return {\n pinnedTokens: {\n ...state.pinnedTokens,\n [chainId]: chainTokens.filter(\n (addr) => addr !== normalizedAddress\n ),\n },\n }\n }\n return state\n })\n },\n isPinned: (chainId: number, tokenAddress: string) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = get().pinnedTokens[chainId] || []\n return chainTokens.includes(normalizedAddress)\n },\n getPinnedTokens: (chainId: number) => {\n return get().pinnedTokens[chainId] || []\n },\n getAllPinnedTokens: () => {\n const allPinned: Array<{ chainId: number; tokenAddress: string }> = []\n const pinnedTokens = get().pinnedTokens\n Object.entries(pinnedTokens).forEach(([chainIdStr, addresses]) => {\n const chainId = Number.parseInt(chainIdStr, 10)\n addresses.forEach((address) => {\n allPinned.push({ chainId, tokenAddress: address })\n })\n })\n return allPinned\n },\n }),\n {\n name: `${namePrefix || 'li.fi'}-pinned-tokens`,\n version: 0,\n partialize: (state) => ({\n pinnedTokens: state.pinnedTokens,\n }),\n }\n )\n )\n"],"mappings":";;;AAMA,MAAa,2BAA2B,EACtC,iBAEA,QAA2B,CACzB,SACG,KAAK,SAAS;CACb,cAAc,EAAE;CAChB,WAAW,SAAiB,iBAAyB;
|
|
1
|
+
{"version":3,"file":"createPinnedTokensStore.js","names":[],"sources":["../../../../src/stores/pinnedTokens/createPinnedTokensStore.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 { PinnedTokensState } from './types.js'\n\nexport const createPinnedTokensStore = ({\n namePrefix,\n}: PersistStoreProps): UseBoundStore<StoreApi<PinnedTokensState>> =>\n create<PinnedTokensState>()(\n persist(\n (set, get) => ({\n pinnedTokens: {},\n pinToken: (chainId: number, tokenAddress: string) => {\n set((state) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = state.pinnedTokens[chainId] || []\n if (!chainTokens.includes(normalizedAddress)) {\n return {\n pinnedTokens: {\n ...state.pinnedTokens,\n [chainId]: [...chainTokens, normalizedAddress],\n },\n }\n }\n return state\n })\n },\n unpinToken: (chainId: number, tokenAddress: string) => {\n set((state) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = state.pinnedTokens[chainId] || []\n if (chainTokens.includes(normalizedAddress)) {\n return {\n pinnedTokens: {\n ...state.pinnedTokens,\n [chainId]: chainTokens.filter(\n (addr) => addr !== normalizedAddress\n ),\n },\n }\n }\n return state\n })\n },\n isPinned: (chainId: number, tokenAddress: string) => {\n const normalizedAddress = tokenAddress.toLowerCase()\n const chainTokens = get().pinnedTokens[chainId] || []\n return chainTokens.includes(normalizedAddress)\n },\n getPinnedTokens: (chainId: number) => {\n return get().pinnedTokens[chainId] || []\n },\n getAllPinnedTokens: () => {\n const allPinned: Array<{ chainId: number; tokenAddress: string }> = []\n const pinnedTokens = get().pinnedTokens\n Object.entries(pinnedTokens).forEach(([chainIdStr, addresses]) => {\n const chainId = Number.parseInt(chainIdStr, 10)\n addresses.forEach((address) => {\n allPinned.push({ chainId, tokenAddress: address })\n })\n })\n return allPinned\n },\n }),\n {\n name: `${namePrefix || 'li.fi'}-pinned-tokens`,\n version: 0,\n partialize: (state) => ({\n pinnedTokens: state.pinnedTokens,\n }),\n }\n )\n )\n"],"mappings":";;;AAMA,MAAa,2BAA2B,EACtC,iBAEA,QAA2B,CACzB,SACG,KAAK,SAAS;CACb,cAAc,EAAE;CAChB,WAAW,SAAiB,iBAAyB;EACnD,KAAK,UAAU;GACb,MAAM,oBAAoB,aAAa,aAAa;GACpD,MAAM,cAAc,MAAM,aAAa,YAAY,EAAE;GACrD,IAAI,CAAC,YAAY,SAAS,kBAAkB,EAC1C,OAAO,EACL,cAAc;IACZ,GAAG,MAAM;KACR,UAAU,CAAC,GAAG,aAAa,kBAAkB;IAC/C,EACF;GAEH,OAAO;IACP;;CAEJ,aAAa,SAAiB,iBAAyB;EACrD,KAAK,UAAU;GACb,MAAM,oBAAoB,aAAa,aAAa;GACpD,MAAM,cAAc,MAAM,aAAa,YAAY,EAAE;GACrD,IAAI,YAAY,SAAS,kBAAkB,EACzC,OAAO,EACL,cAAc;IACZ,GAAG,MAAM;KACR,UAAU,YAAY,QACpB,SAAS,SAAS,kBACpB;IACF,EACF;GAEH,OAAO;IACP;;CAEJ,WAAW,SAAiB,iBAAyB;EACnD,MAAM,oBAAoB,aAAa,aAAa;EAEpD,QADoB,KAAK,CAAC,aAAa,YAAY,EAAE,EAClC,SAAS,kBAAkB;;CAEhD,kBAAkB,YAAoB;EACpC,OAAO,KAAK,CAAC,aAAa,YAAY,EAAE;;CAE1C,0BAA0B;EACxB,MAAM,YAA8D,EAAE;EACtE,MAAM,eAAe,KAAK,CAAC;EAC3B,OAAO,QAAQ,aAAa,CAAC,SAAS,CAAC,YAAY,eAAe;GAChE,MAAM,UAAU,OAAO,SAAS,YAAY,GAAG;GAC/C,UAAU,SAAS,YAAY;IAC7B,UAAU,KAAK;KAAE;KAAS,cAAc;KAAS,CAAC;KAClD;IACF;EACF,OAAO;;CAEV,GACD;CACE,MAAM,GAAG,cAAc,QAAQ;CAC/B,SAAS;CACT,aAAa,WAAW,EACtB,cAAc,MAAM,cACrB;CACF,CACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteExecutionStore.js","names":[],"sources":["../../../../src/stores/routes/RouteExecutionStore.tsx"],"sourcesContent":["import { createContext, type JSX, useContext, useRef } from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport { createRouteExecutionStore } from './createRouteExecutionStore.js'\nimport type { RouteExecutionState } from './types.js'\n\ntype RouteExecutionStore = UseBoundStore<StoreApi<RouteExecutionState>>\n\nconst RouteExecutionStoreContext = createContext<RouteExecutionStore | null>(\n null\n)\n\nexport function RouteExecutionStoreProvider({\n children,\n ...props\n}: PersistStoreProviderProps): JSX.Element {\n const storeRef = useRef<RouteExecutionStore>(null)\n if (!storeRef.current) {\n storeRef.current = createRouteExecutionStore(props)\n }\n return (\n <RouteExecutionStoreContext.Provider value={storeRef.current}>\n {children}\n </RouteExecutionStoreContext.Provider>\n )\n}\n\nexport function useRouteExecutionStoreContext(): any {\n const useStore = useContext(RouteExecutionStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useRouteExecutionStore<T>(\n selector: (state: RouteExecutionState) => T\n): T {\n const useStore = useRouteExecutionStoreContext()\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;AASA,MAAM,6BAA6B,cACjC,KACD;AAED,SAAgB,4BAA4B,EAC1C,UACA,GAAG,SACsC;CACzC,MAAM,WAAW,OAA4B,KAAK;
|
|
1
|
+
{"version":3,"file":"RouteExecutionStore.js","names":[],"sources":["../../../../src/stores/routes/RouteExecutionStore.tsx"],"sourcesContent":["import { createContext, type JSX, useContext, useRef } from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport { createRouteExecutionStore } from './createRouteExecutionStore.js'\nimport type { RouteExecutionState } from './types.js'\n\ntype RouteExecutionStore = UseBoundStore<StoreApi<RouteExecutionState>>\n\nconst RouteExecutionStoreContext = createContext<RouteExecutionStore | null>(\n null\n)\n\nexport function RouteExecutionStoreProvider({\n children,\n ...props\n}: PersistStoreProviderProps): JSX.Element {\n const storeRef = useRef<RouteExecutionStore>(null)\n if (!storeRef.current) {\n storeRef.current = createRouteExecutionStore(props)\n }\n return (\n <RouteExecutionStoreContext.Provider value={storeRef.current}>\n {children}\n </RouteExecutionStoreContext.Provider>\n )\n}\n\nexport function useRouteExecutionStoreContext(): any {\n const useStore = useContext(RouteExecutionStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useRouteExecutionStore<T>(\n selector: (state: RouteExecutionState) => T\n): T {\n const useStore = useRouteExecutionStoreContext()\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;AASA,MAAM,6BAA6B,cACjC,KACD;AAED,SAAgB,4BAA4B,EAC1C,UACA,GAAG,SACsC;CACzC,MAAM,WAAW,OAA4B,KAAK;CAClD,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,0BAA0B,MAAM;CAErD,OACE,oBAAC,2BAA2B,UAA5B;EAAqC,OAAO,SAAS;EAClD;EACmC,CAAA;;AAI1C,SAAgB,gCAAqC;CACnD,MAAM,WAAW,WAAW,2BAA2B;CACvD,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,4BAA4B,KAAK,IAC3E;CAEH,OAAO;;AAGT,SAAgB,uBACd,UACG;CAEH,OADiB,+BACF,CAAC,WAAW,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRouteExecutionStore.js","names":[],"sources":["../../../../src/stores/routes/createRouteExecutionStore.ts"],"sourcesContent":["import type { Route, RouteExtended } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport { hasEnumFlag } from '../../utils/enum.js'\nimport type { PersistStoreProps } from '../types.js'\nimport type { RouteExecution, RouteExecutionState } from './types.js'\nimport { RouteExecutionStatus } from './types.js'\nimport {\n isRouteDone,\n isRouteFailed,\n isRoutePartiallyDone,\n isRouteRefunded,\n} from './utils.js'\n\nexport const createRouteExecutionStore = ({\n namePrefix,\n}: PersistStoreProps): UseBoundStore<StoreApi<RouteExecutionState>> =>\n create<RouteExecutionState>()(\n persist(\n (set, get) => ({\n routes: {},\n setExecutableRoute: (route: Route, observableRouteIds?: string[]) => {\n if (!get().routes[route.id]) {\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n // clean previous idle routes\n Object.keys(routes)\n .filter(\n (routeId) =>\n !observableRouteIds?.includes(routeId) &&\n hasEnumFlag(\n routes[routeId]!.status,\n RouteExecutionStatus.Idle\n )\n )\n .forEach((routeId) => {\n delete routes[routeId]\n })\n routes[route.id] = {\n route,\n status: RouteExecutionStatus.Idle,\n }\n return {\n routes,\n }\n })\n }\n },\n updateRoute: (route: RouteExtended) => {\n if (get().routes[route.id]) {\n set((state: RouteExecutionState) => {\n const updatedState = {\n routes: {\n ...state.routes,\n [route.id]: { ...state.routes[route.id]!, route },\n },\n }\n const isFailed = isRouteFailed(route)\n if (isFailed) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Failed\n return updatedState\n }\n const isDone = isRouteDone(route)\n if (isDone) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Done\n if (isRoutePartiallyDone(route)) {\n updatedState.routes[route.id]!.status |=\n RouteExecutionStatus.Partial\n } else if (isRouteRefunded(route)) {\n updatedState.routes[route.id]!.status |=\n RouteExecutionStatus.Refunded\n }\n return updatedState\n }\n const isLoading = route.steps.some((step) => step.execution)\n if (isLoading) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Pending\n }\n return updatedState\n })\n }\n },\n deleteRoutes: (type, accountAddresses) =>\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n Object.keys(routes)\n .filter((routeId) => {\n const route = routes[routeId]\n if (\n accountAddresses &&\n !accountAddresses.includes(route?.route.fromAddress ?? '')\n ) {\n return false\n }\n return type === 'completed'\n ? hasEnumFlag(route?.status ?? 0, RouteExecutionStatus.Done)\n : type === 'failed'\n ? hasEnumFlag(\n route?.status ?? 0,\n RouteExecutionStatus.Failed\n )\n : !hasEnumFlag(\n route?.status ?? 0,\n RouteExecutionStatus.Done\n )\n })\n .forEach((routeId) => {\n delete routes[routeId]\n })\n return {\n routes,\n }\n }),\n deleteRoute: (routeId: string) => {\n if (get().routes[routeId]) {\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n delete routes[routeId]\n return {\n routes,\n }\n })\n }\n },\n }),\n {\n name: `${namePrefix || 'li.fi'}-widget-routes`,\n // Bump version on breaking changes to the stored structure.\n version: 4,\n // Clear stored routes on any version mismatch to avoid errors from incompatible data shapes.\n migrate: () => ({ routes: {} }),\n partialize: (state) => ({ routes: state.routes }),\n merge: (persistedState: any, currentState: RouteExecutionState) => {\n const state = {\n ...currentState,\n ...persistedState,\n } as RouteExecutionState\n try {\n // Keep only the most recent 100 routes, evicting the oldest when the\n // limit is exceeded.\n const maxStoredRoutes = 100\n const allRoutes = Object.values(state.routes) as RouteExecution[]\n const storedRoutes = allRoutes\n .sort(\n (a, b) =>\n (b.route.steps[0]?.execution?.startedAt ?? 0) -\n (a.route.steps[0]?.execution?.startedAt ?? 0)\n )\n .slice(0, maxStoredRoutes)\n const keepIds = new Set(storedRoutes.map((r) => r.route.id))\n for (const id of Object.keys(state.routes)) {\n if (!keepIds.has(id)) {\n delete state.routes[id]\n }\n }\n } catch (error) {\n console.error(error)\n }\n return state\n },\n }\n )\n )\n"],"mappings":";;;;;AAeA,MAAa,6BAA6B,EACxC,iBAEA,QAA6B,CAC3B,SACG,KAAK,SAAS;CACb,QAAQ,EAAE;CACV,qBAAqB,OAAc,uBAAkC;
|
|
1
|
+
{"version":3,"file":"createRouteExecutionStore.js","names":[],"sources":["../../../../src/stores/routes/createRouteExecutionStore.ts"],"sourcesContent":["import type { Route, RouteExtended } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport { hasEnumFlag } from '../../utils/enum.js'\nimport type { PersistStoreProps } from '../types.js'\nimport type { RouteExecution, RouteExecutionState } from './types.js'\nimport { RouteExecutionStatus } from './types.js'\nimport {\n isRouteDone,\n isRouteFailed,\n isRoutePartiallyDone,\n isRouteRefunded,\n} from './utils.js'\n\nexport const createRouteExecutionStore = ({\n namePrefix,\n}: PersistStoreProps): UseBoundStore<StoreApi<RouteExecutionState>> =>\n create<RouteExecutionState>()(\n persist(\n (set, get) => ({\n routes: {},\n setExecutableRoute: (route: Route, observableRouteIds?: string[]) => {\n if (!get().routes[route.id]) {\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n // clean previous idle routes\n Object.keys(routes)\n .filter(\n (routeId) =>\n !observableRouteIds?.includes(routeId) &&\n hasEnumFlag(\n routes[routeId]!.status,\n RouteExecutionStatus.Idle\n )\n )\n .forEach((routeId) => {\n delete routes[routeId]\n })\n routes[route.id] = {\n route,\n status: RouteExecutionStatus.Idle,\n }\n return {\n routes,\n }\n })\n }\n },\n updateRoute: (route: RouteExtended) => {\n if (get().routes[route.id]) {\n set((state: RouteExecutionState) => {\n const updatedState = {\n routes: {\n ...state.routes,\n [route.id]: { ...state.routes[route.id]!, route },\n },\n }\n const isFailed = isRouteFailed(route)\n if (isFailed) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Failed\n return updatedState\n }\n const isDone = isRouteDone(route)\n if (isDone) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Done\n if (isRoutePartiallyDone(route)) {\n updatedState.routes[route.id]!.status |=\n RouteExecutionStatus.Partial\n } else if (isRouteRefunded(route)) {\n updatedState.routes[route.id]!.status |=\n RouteExecutionStatus.Refunded\n }\n return updatedState\n }\n const isLoading = route.steps.some((step) => step.execution)\n if (isLoading) {\n updatedState.routes[route.id]!.status =\n RouteExecutionStatus.Pending\n }\n return updatedState\n })\n }\n },\n deleteRoutes: (type, accountAddresses) =>\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n Object.keys(routes)\n .filter((routeId) => {\n const route = routes[routeId]\n if (\n accountAddresses &&\n !accountAddresses.includes(route?.route.fromAddress ?? '')\n ) {\n return false\n }\n return type === 'completed'\n ? hasEnumFlag(route?.status ?? 0, RouteExecutionStatus.Done)\n : type === 'failed'\n ? hasEnumFlag(\n route?.status ?? 0,\n RouteExecutionStatus.Failed\n )\n : !hasEnumFlag(\n route?.status ?? 0,\n RouteExecutionStatus.Done\n )\n })\n .forEach((routeId) => {\n delete routes[routeId]\n })\n return {\n routes,\n }\n }),\n deleteRoute: (routeId: string) => {\n if (get().routes[routeId]) {\n set((state: RouteExecutionState) => {\n const routes = { ...state.routes }\n delete routes[routeId]\n return {\n routes,\n }\n })\n }\n },\n }),\n {\n name: `${namePrefix || 'li.fi'}-widget-routes`,\n // Bump version on breaking changes to the stored structure.\n version: 4,\n // Clear stored routes on any version mismatch to avoid errors from incompatible data shapes.\n migrate: () => ({ routes: {} }),\n partialize: (state) => ({ routes: state.routes }),\n merge: (persistedState: any, currentState: RouteExecutionState) => {\n const state = {\n ...currentState,\n ...persistedState,\n } as RouteExecutionState\n try {\n // Keep only the most recent 100 routes, evicting the oldest when the\n // limit is exceeded.\n const maxStoredRoutes = 100\n const allRoutes = Object.values(state.routes) as RouteExecution[]\n const storedRoutes = allRoutes\n .sort(\n (a, b) =>\n (b.route.steps[0]?.execution?.startedAt ?? 0) -\n (a.route.steps[0]?.execution?.startedAt ?? 0)\n )\n .slice(0, maxStoredRoutes)\n const keepIds = new Set(storedRoutes.map((r) => r.route.id))\n for (const id of Object.keys(state.routes)) {\n if (!keepIds.has(id)) {\n delete state.routes[id]\n }\n }\n } catch (error) {\n console.error(error)\n }\n return state\n },\n }\n )\n )\n"],"mappings":";;;;;AAeA,MAAa,6BAA6B,EACxC,iBAEA,QAA6B,CAC3B,SACG,KAAK,SAAS;CACb,QAAQ,EAAE;CACV,qBAAqB,OAAc,uBAAkC;EACnE,IAAI,CAAC,KAAK,CAAC,OAAO,MAAM,KACtB,KAAK,UAA+B;GAClC,MAAM,SAAS,EAAE,GAAG,MAAM,QAAQ;GAElC,OAAO,KAAK,OAAO,CAChB,QACE,YACC,CAAC,oBAAoB,SAAS,QAAQ,IACtC,YACE,OAAO,SAAU,QAAA,EAElB,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G,MAAM,QAAQ;GAClC,OAAO,OAAO;GACd,OAAO,EACL,QACD;IACD;;CAGP,GACD;CACE,MAAM,GAAG,cAAc,QAAQ;CAE/B,SAAS;CAET,gBAAgB,EAAE,QAAQ,EAAE,EAAE;CAC9B,aAAa,WAAW,EAAE,QAAQ,MAAM,QAAQ;CAChD,QAAQ,gBAAqB,iBAAsC;EACjE,MAAM,QAAQ;GACZ,GAAG;GACH,GAAG;GACJ;EACD,IAAI;GAKF,MAAM,eADY,OAAO,OAAO,MAAM,OACR,CAC3B,MACE,GAAG,OACD,EAAE,MAAM,MAAM,IAAI,WAAW,aAAa,MAC1C,EAAE,MAAM,MAAM,IAAI,WAAW,aAAa,GAC9C,CACA,MAAM,GAAG,IAAgB;GAC5B,MAAM,UAAU,IAAI,IAAI,aAAa,KAAK,MAAM,EAAE,MAAM,GAAG,CAAC;GAC5D,KAAK,MAAM,MAAM,OAAO,KAAK,MAAM,OAAO,EACxC,IAAI,CAAC,QAAQ,IAAI,GAAG,EAClB,OAAO,MAAM,OAAO;WAGjB,OAAO;GACd,QAAQ,MAAM,MAAM;;EAEtB,OAAO;;CAEV,CACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntermediateRoutesStore.js","names":[],"sources":["../../../../src/stores/routes/useIntermediateRoutesStore.ts"],"sourcesContent":["import type { Route } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\n\ninterface IntermediateRoutesState {\n intermediateRoutes: Record<string, Route[] | undefined>\n setIntermediateRoutes: (\n key: readonly unknown[],\n routes: Route[] | undefined\n ) => void\n getIntermediateRoutes: (key: readonly unknown[]) => Route[] | undefined\n}\n\nexport const useIntermediateRoutesStore: UseBoundStore<\n StoreApi<IntermediateRoutesState>\n> = create<IntermediateRoutesState>((set, get) => ({\n intermediateRoutes: {},\n setIntermediateRoutes: (key, routes) => {\n const stringKey = JSON.stringify(key)\n // Create a new state with only the current key\n const newRoutesByKey: Record<string, Route[] | undefined> = {}\n newRoutesByKey[stringKey] = routes\n set({ intermediateRoutes: newRoutesByKey })\n },\n getIntermediateRoutes: (key) => {\n const stringKey = JSON.stringify(key)\n return get().intermediateRoutes[stringKey]\n },\n}))\n"],"mappings":";;AAaA,MAAa,6BAET,QAAiC,KAAK,SAAS;CACjD,oBAAoB,EAAE;CACtB,wBAAwB,KAAK,WAAW;EACtC,MAAM,YAAY,KAAK,UAAU,IAAI;EAErC,MAAM,iBAAsD,EAAE;
|
|
1
|
+
{"version":3,"file":"useIntermediateRoutesStore.js","names":[],"sources":["../../../../src/stores/routes/useIntermediateRoutesStore.ts"],"sourcesContent":["import type { Route } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\n\ninterface IntermediateRoutesState {\n intermediateRoutes: Record<string, Route[] | undefined>\n setIntermediateRoutes: (\n key: readonly unknown[],\n routes: Route[] | undefined\n ) => void\n getIntermediateRoutes: (key: readonly unknown[]) => Route[] | undefined\n}\n\nexport const useIntermediateRoutesStore: UseBoundStore<\n StoreApi<IntermediateRoutesState>\n> = create<IntermediateRoutesState>((set, get) => ({\n intermediateRoutes: {},\n setIntermediateRoutes: (key, routes) => {\n const stringKey = JSON.stringify(key)\n // Create a new state with only the current key\n const newRoutesByKey: Record<string, Route[] | undefined> = {}\n newRoutesByKey[stringKey] = routes\n set({ intermediateRoutes: newRoutesByKey })\n },\n getIntermediateRoutes: (key) => {\n const stringKey = JSON.stringify(key)\n return get().intermediateRoutes[stringKey]\n },\n}))\n"],"mappings":";;AAaA,MAAa,6BAET,QAAiC,KAAK,SAAS;CACjD,oBAAoB,EAAE;CACtB,wBAAwB,KAAK,WAAW;EACtC,MAAM,YAAY,KAAK,UAAU,IAAI;EAErC,MAAM,iBAAsD,EAAE;EAC9D,eAAe,aAAa;EAC5B,IAAI,EAAE,oBAAoB,gBAAgB,CAAC;;CAE7C,wBAAwB,QAAQ;EAC9B,MAAM,YAAY,KAAK,UAAU,IAAI;EACrC,OAAO,KAAK,CAAC,mBAAmB;;CAEnC,EAAE"}
|
|
@@ -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,IAAI,WAAW,aAAa;
|
|
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,IAAI,WAAW,aAAa;CAChE,OAAO,YAAY,KAAK,KAAK,KAAK,GAAG,YAAY,MAAO,KAAK,KAAK;;AAGpE,MAAa,mCAA4D;CACvE,MAAM,EAAE,aAAa,YAAY;CACjC,MAAM,mBAAmB,cACjB,SAAS,KAAK,YAAY,QAAQ,QAAQ,EAChD,CAAC,SAAS,CACX;CAoBD,OAAO,uBAnBU,aACd,UAAwD;EAEvD,MAAM,oBADS,OAAO,OAAO,MAAM,OACH,CAAC,QAC9B,UACC,iBAAiB,SAAS,MAAM,MAAM,YAAY,IAClD,oBAAoB,MAAM,CAC7B;EACD,OAAO;GACL,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,EACV;GACD,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,EACV;GACF;IAEH,CAAC,iBAAiB,CAEkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSetExecutableRoute.js","names":[],"sources":["../../../../src/stores/routes/useSetExecutableRoute.ts"],"sourcesContent":["import { useRouteExecutionStore } from './RouteExecutionStore.js'\nimport type { RouteExecutionState } from './types.js'\n\nexport const useSetExecutableRoute =\n (): RouteExecutionState['setExecutableRoute'] => {\n return useRouteExecutionStore((state) => state.setExecutableRoute)\n }\n"],"mappings":";;AAGA,MAAa,8BACsC;
|
|
1
|
+
{"version":3,"file":"useSetExecutableRoute.js","names":[],"sources":["../../../../src/stores/routes/useSetExecutableRoute.ts"],"sourcesContent":["import { useRouteExecutionStore } from './RouteExecutionStore.js'\nimport type { RouteExecutionState } from './types.js'\n\nexport const useSetExecutableRoute =\n (): RouteExecutionState['setExecutableRoute'] => {\n return useRouteExecutionStore((state) => state.setExecutableRoute)\n }\n"],"mappings":";;AAGA,MAAa,8BACsC;CAC/C,OAAO,wBAAwB,UAAU,MAAM,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/stores/routes/utils.ts"],"sourcesContent":["import type { ExecutionAction, RouteExtended } from '@lifi/sdk'\nimport microdiff from 'microdiff'\n\nexport const isRouteDone = (route: RouteExtended): boolean => {\n return route.steps.every((step) => step.execution?.status === 'DONE')\n}\n\nexport const isRoutePartiallyDone = (route: RouteExtended): boolean => {\n return route.steps.some((step) =>\n step.execution?.actions?.some((action) => action.substatus === 'PARTIAL')\n )\n}\n\nexport const isRouteRefunded = (route: RouteExtended): boolean => {\n return route.steps.some((step) =>\n step.execution?.actions?.some((action) => action.substatus === 'REFUNDED')\n )\n}\n\nexport const isRouteFailed = (route: RouteExtended): boolean => {\n return route.steps.some((step) => step.execution?.status === 'FAILED')\n}\n\nexport const isRouteActive = (route?: RouteExtended): boolean => {\n if (!route) {\n return false\n }\n const isDone = isRouteDone(route)\n const isFailed = isRouteFailed(route)\n const alreadyStarted = route.steps.some((step) => step.execution)\n return !isDone && !isFailed && alreadyStarted\n}\n\nexport const getUpdatedAction = (\n currentRoute: RouteExtended,\n updatedRoute: RouteExtended\n): ExecutionAction | undefined => {\n const actionDiff = microdiff(currentRoute, updatedRoute).find((diff) =>\n diff.path.includes('actions')\n )\n if (!actionDiff) {\n return undefined\n }\n // Find action index in the diff array so we can slice the complete action object\n // e.g. ['steps', 0, 'execution', 'actions', 0, 'message']\n const actionDiffIndex = actionDiff.path.indexOf('actions') + 2\n const actionPathSlice = actionDiff.path.slice(0, actionDiffIndex)\n // Reduce updated route using the diff path to get updated process\n const action = actionPathSlice.reduce(\n (obj, path) => obj[path],\n updatedRoute as any\n ) as ExecutionAction\n return action\n}\n\nexport const getSourceTxHash = (route?: RouteExtended): string | undefined => {\n const sourceAction = route?.steps[0].execution?.actions\n ?.filter(\n (action) => !['RESET_ALLOWANCE', 'SET_ALLOWANCE'].includes(action.type)\n )\n .find((action) => action.txHash || action.taskId)\n return sourceAction?.txHash || sourceAction?.taskId\n}\n"],"mappings":";;AAGA,MAAa,eAAe,UAAkC;
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/stores/routes/utils.ts"],"sourcesContent":["import type { ExecutionAction, RouteExtended } from '@lifi/sdk'\nimport microdiff from 'microdiff'\n\nexport const isRouteDone = (route: RouteExtended): boolean => {\n return route.steps.every((step) => step.execution?.status === 'DONE')\n}\n\nexport const isRoutePartiallyDone = (route: RouteExtended): boolean => {\n return route.steps.some((step) =>\n step.execution?.actions?.some((action) => action.substatus === 'PARTIAL')\n )\n}\n\nexport const isRouteRefunded = (route: RouteExtended): boolean => {\n return route.steps.some((step) =>\n step.execution?.actions?.some((action) => action.substatus === 'REFUNDED')\n )\n}\n\nexport const isRouteFailed = (route: RouteExtended): boolean => {\n return route.steps.some((step) => step.execution?.status === 'FAILED')\n}\n\nexport const isRouteActive = (route?: RouteExtended): boolean => {\n if (!route) {\n return false\n }\n const isDone = isRouteDone(route)\n const isFailed = isRouteFailed(route)\n const alreadyStarted = route.steps.some((step) => step.execution)\n return !isDone && !isFailed && alreadyStarted\n}\n\nexport const getUpdatedAction = (\n currentRoute: RouteExtended,\n updatedRoute: RouteExtended\n): ExecutionAction | undefined => {\n const actionDiff = microdiff(currentRoute, updatedRoute).find((diff) =>\n diff.path.includes('actions')\n )\n if (!actionDiff) {\n return undefined\n }\n // Find action index in the diff array so we can slice the complete action object\n // e.g. ['steps', 0, 'execution', 'actions', 0, 'message']\n const actionDiffIndex = actionDiff.path.indexOf('actions') + 2\n const actionPathSlice = actionDiff.path.slice(0, actionDiffIndex)\n // Reduce updated route using the diff path to get updated process\n const action = actionPathSlice.reduce(\n (obj, path) => obj[path],\n updatedRoute as any\n ) as ExecutionAction\n return action\n}\n\nexport const getSourceTxHash = (route?: RouteExtended): string | undefined => {\n const sourceAction = route?.steps[0].execution?.actions\n ?.filter(\n (action) => !['RESET_ALLOWANCE', 'SET_ALLOWANCE'].includes(action.type)\n )\n .find((action) => action.txHash || action.taskId)\n return sourceAction?.txHash || sourceAction?.taskId\n}\n"],"mappings":";;AAGA,MAAa,eAAe,UAAkC;CAC5D,OAAO,MAAM,MAAM,OAAO,SAAS,KAAK,WAAW,WAAW,OAAO;;AAGvE,MAAa,wBAAwB,UAAkC;CACrE,OAAO,MAAM,MAAM,MAAM,SACvB,KAAK,WAAW,SAAS,MAAM,WAAW,OAAO,cAAc,UAAU,CAC1E;;AAGH,MAAa,mBAAmB,UAAkC;CAChE,OAAO,MAAM,MAAM,MAAM,SACvB,KAAK,WAAW,SAAS,MAAM,WAAW,OAAO,cAAc,WAAW,CAC3E;;AAGH,MAAa,iBAAiB,UAAkC;CAC9D,OAAO,MAAM,MAAM,MAAM,SAAS,KAAK,WAAW,WAAW,SAAS;;AAGxE,MAAa,iBAAiB,UAAmC;CAC/D,IAAI,CAAC,OACH,OAAO;CAET,MAAM,SAAS,YAAY,MAAM;CACjC,MAAM,WAAW,cAAc,MAAM;CACrC,MAAM,iBAAiB,MAAM,MAAM,MAAM,SAAS,KAAK,UAAU;CACjE,OAAO,CAAC,UAAU,CAAC,YAAY;;AAGjC,MAAa,oBACX,cACA,iBACgC;CAChC,MAAM,aAAa,UAAU,cAAc,aAAa,CAAC,MAAM,SAC7D,KAAK,KAAK,SAAS,UAAU,CAC9B;CACD,IAAI,CAAC,YACH;CAIF,MAAM,kBAAkB,WAAW,KAAK,QAAQ,UAAU,GAAG;CAO7D,OANwB,WAAW,KAAK,MAAM,GAAG,gBAEnB,CAAC,QAC5B,KAAK,SAAS,IAAI,OACnB,aAEW;;AAGf,MAAa,mBAAmB,UAA8C;CAC5E,MAAM,eAAe,OAAO,MAAM,GAAG,WAAW,SAC5C,QACC,WAAW,CAAC,CAAC,mBAAmB,gBAAgB,CAAC,SAAS,OAAO,KAAK,CACxE,CACA,MAAM,WAAW,OAAO,UAAU,OAAO,OAAO;CACnD,OAAO,cAAc,UAAU,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsStore.js","names":[],"sources":["../../../../src/stores/settings/SettingsStore.tsx"],"sourcesContent":["import {\n createContext,\n type JSX,\n type PropsWithChildren,\n useContext,\n useRef,\n} from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport { createSettingsStore } from './createSettingsStore.js'\nimport type { SettingsState, SettingsStoreProviderProps } from './types.js'\n\ntype SettingsStore = UseBoundStore<StoreApi<SettingsState>>\n\nconst SettingsStoreContext = createContext<SettingsStore | null>(null)\n\nexport const SettingsStoreProvider = ({\n children,\n config,\n}: PropsWithChildren<SettingsStoreProviderProps>): JSX.Element => {\n const storeRef = useRef<SettingsStore>(null)\n if (!storeRef.current) {\n storeRef.current = createSettingsStore(config)\n }\n return (\n <SettingsStoreContext.Provider value={storeRef.current}>\n {children}\n </SettingsStoreContext.Provider>\n )\n}\n\nexport function useSettingsStoreContext(): any {\n const useStore = useContext(SettingsStoreContext)\n if (!useStore) {\n throw new Error(\n 'You forgot to wrap your component in SettingsStoreContext.'\n )\n }\n return useStore\n}\n\nexport function useSettingsStore<T>(selector: (state: SettingsState) => T): T {\n const useStore = useSettingsStoreContext()\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;AAcA,MAAM,uBAAuB,cAAoC,KAAK;AAEtE,MAAa,yBAAyB,EACpC,UACA,aACgE;CAChE,MAAM,WAAW,OAAsB,KAAK;
|
|
1
|
+
{"version":3,"file":"SettingsStore.js","names":[],"sources":["../../../../src/stores/settings/SettingsStore.tsx"],"sourcesContent":["import {\n createContext,\n type JSX,\n type PropsWithChildren,\n useContext,\n useRef,\n} from 'react'\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport { createSettingsStore } from './createSettingsStore.js'\nimport type { SettingsState, SettingsStoreProviderProps } from './types.js'\n\ntype SettingsStore = UseBoundStore<StoreApi<SettingsState>>\n\nconst SettingsStoreContext = createContext<SettingsStore | null>(null)\n\nexport const SettingsStoreProvider = ({\n children,\n config,\n}: PropsWithChildren<SettingsStoreProviderProps>): JSX.Element => {\n const storeRef = useRef<SettingsStore>(null)\n if (!storeRef.current) {\n storeRef.current = createSettingsStore(config)\n }\n return (\n <SettingsStoreContext.Provider value={storeRef.current}>\n {children}\n </SettingsStoreContext.Provider>\n )\n}\n\nexport function useSettingsStoreContext(): any {\n const useStore = useContext(SettingsStoreContext)\n if (!useStore) {\n throw new Error(\n 'You forgot to wrap your component in SettingsStoreContext.'\n )\n }\n return useStore\n}\n\nexport function useSettingsStore<T>(selector: (state: SettingsState) => T): T {\n const useStore = useSettingsStoreContext()\n return useStore(useShallow(selector))\n}\n"],"mappings":";;;;;AAcA,MAAM,uBAAuB,cAAoC,KAAK;AAEtE,MAAa,yBAAyB,EACpC,UACA,aACgE;CAChE,MAAM,WAAW,OAAsB,KAAK;CAC5C,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,oBAAoB,OAAO;CAEhD,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO,SAAS;EAC5C;EAC6B,CAAA;;AAIpC,SAAgB,0BAA+B;CAC7C,MAAM,WAAW,WAAW,qBAAqB;CACjD,IAAI,CAAC,UACH,MAAM,IAAI,MACR,6DACD;CAEH,OAAO;;AAGT,SAAgB,iBAAoB,UAA0C;CAE5E,OADiB,yBACF,CAAC,WAAW,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSettingsStore.js","names":[],"sources":["../../../../src/stores/settings/createSettingsStore.ts"],"sourcesContent":["/** biome-ignore-all lint/correctness/noUnusedVariables: allowed in this store */\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport { allLanguages } from '../../providers/I18nProvider/constants.js'\nimport { loadLocale } from '../../providers/I18nProvider/i18n.js'\nimport type { LanguageKey } from '../../providers/I18nProvider/types.js'\nimport type { WidgetConfig } from '../../types/widget.js'\nimport type { SettingsProps, SettingsState } from './types.js'\nimport { SettingsToolTypes } from './types.js'\nimport { getStateValues } from './utils/getStateValues.js'\n\nexport const defaultSlippage = undefined\n\nexport const defaultConfigurableSettings: Pick<\n SettingsState,\n 'routePriority' | 'slippage' | 'gasPrice'\n> = {\n routePriority: 'CHEAPEST',\n slippage: defaultSlippage,\n gasPrice: 'normal',\n}\n\nconst defaultSettings: SettingsProps = {\n gasPrice: 'normal',\n enabledAutoRefuel: true,\n disabledBridges: [],\n disabledExchanges: [],\n enabledBridges: [],\n enabledExchanges: [],\n _enabledBridges: {},\n _enabledExchanges: {},\n smallBalanceThreshold: undefined,\n}\n\nexport const createSettingsStore = (\n config: WidgetConfig\n): UseBoundStore<StoreApi<SettingsState>> =>\n create<SettingsState>()(\n persist(\n (set, get) => ({\n ...defaultSettings,\n setValue: (key, value) =>\n set(() => ({\n [key]: value,\n })),\n setValues: (values: Partial<SettingsProps>) =>\n set(() => ({\n ...values,\n })),\n getSettings: () => getStateValues(get()),\n getValue: (key) => get()[key],\n initializeTools: (toolType, tools, reset) => {\n if (!tools.length) {\n return\n }\n set((state) => {\n const updatedState = { ...state }\n if (!reset) {\n // Add new tools\n tools.forEach((tool) => {\n if (!Object.hasOwn(updatedState[`_enabled${toolType}`], tool)) {\n updatedState[`_enabled${toolType}`][tool] = true\n }\n })\n // Filter tools we no longer have\n updatedState[`_enabled${toolType}`] = Object.fromEntries(\n Object.entries(updatedState[`_enabled${toolType}`]).filter(\n ([key]) => tools.includes(key)\n )\n )\n } else {\n tools.forEach((tool) => {\n updatedState[`_enabled${toolType}`][tool] = true\n })\n }\n const enabledToolKeys = Object.keys(\n updatedState[`_enabled${toolType}`]\n )\n updatedState[`enabled${toolType}`] = enabledToolKeys.filter(\n (key) => updatedState[`_enabled${toolType}`][key]\n )\n updatedState[`disabled${toolType}`] = enabledToolKeys.filter(\n (key) => !updatedState[`_enabled${toolType}`][key]\n )\n return updatedState\n })\n },\n setToolValue: (toolType, tool, value) =>\n set((state) => {\n const enabledTools = {\n ...state[`_enabled${toolType}`],\n [tool]: value,\n }\n const enabledToolKeys = Object.keys(enabledTools)\n return {\n [`_enabled${toolType}`]: enabledTools,\n [`enabled${toolType}`]: enabledToolKeys.filter(\n (key) => enabledTools[key]\n ),\n [`disabled${toolType}`]: enabledToolKeys.filter(\n (key) => !enabledTools[key]\n ),\n }\n }),\n toggleToolKeys: (toolType, toolKeys) =>\n set((state) => {\n const allKeysInCollectionEnabled = toolKeys.every(\n (toolKey) => state[`_enabled${toolType}`][toolKey]\n )\n\n // then toggle those keys to false\n const updatedTools = toolKeys.reduce(\n (accum, toolKey) => {\n accum[toolKey] = !allKeysInCollectionEnabled\n return accum\n },\n {\n ...state[`_enabled${toolType}`],\n }\n )\n\n const enableKeys: string[] = []\n const disabledKeys: string[] = []\n\n Object.entries(updatedTools).forEach(([key, value]) => {\n if (value) {\n enableKeys.push(key)\n } else {\n disabledKeys.push(key)\n }\n })\n\n return {\n [`_enabled${toolType}`]: updatedTools,\n [`enabled${toolType}`]: enableKeys,\n [`disabled${toolType}`]: disabledKeys,\n }\n }),\n reset: (bridges, exchanges) => {\n set(() => ({\n ...defaultSettings,\n ...defaultConfigurableSettings,\n }))\n get().initializeTools('Bridges', bridges, true)\n get().initializeTools('Exchanges', exchanges, true)\n return { ...get() }\n },\n }),\n {\n name: 'li.fi-widget-settings',\n version: 6,\n partialize: (state) => {\n const {\n disabledBridges,\n disabledExchanges,\n enabledBridges,\n enabledExchanges,\n ...partializedState\n } = state\n return partializedState\n },\n merge: (persistedState: any, currentState: SettingsState) => {\n const state = { ...currentState, ...persistedState }\n SettingsToolTypes.forEach((toolType) => {\n if (persistedState?.[`_enabled${toolType}`]) {\n const enabledToolKeys = Object.keys(\n persistedState[`_enabled${toolType}`]\n )\n state[`enabled${toolType}`] = enabledToolKeys.filter(\n (key) => persistedState[`_enabled${toolType}`][key]\n )\n state[`disabled${toolType}`] = enabledToolKeys.filter(\n (key) => !persistedState[`_enabled${toolType}`][key]\n )\n }\n })\n return state\n },\n migrate: () => ({}),\n onRehydrateStorage: () => {\n const initializeLanguageSettings = async (\n state: SettingsState,\n initialLanguage?: string\n ) => {\n const customLanguages = Object.keys(\n config?.languageResources || {}\n ).filter((key) => !allLanguages.includes(key as LanguageKey))\n if (\n initialLanguage &&\n // Custom language resources and English are added statically.\n initialLanguage !== 'en' &&\n !customLanguages.includes(initialLanguage)\n ) {\n await loadLocale(\n initialLanguage as LanguageKey,\n config?.languageResources?.[initialLanguage as LanguageKey]\n ).then((languageResource) => {\n state.setValues({\n language: initialLanguage,\n languageCache: languageResource,\n })\n })\n }\n }\n return (state?: SettingsState) => {\n // Preload translations (from existing translation files)\n if (state) {\n // NB: State always exists unless there is any error\n initializeLanguageSettings(\n state,\n state.getValue('language') || config?.languages?.default\n )\n }\n }\n },\n }\n )\n )\n"],"mappings":";;;;;;AAcA,MAAa,8BAGT;CACF,eAAe;CACf,UAAA,KAAA;CACA,UAAU;CACX;AAED,MAAM,kBAAiC;CAC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jD;;IAEH;AACF,SAAO;;CAET,gBAAgB,EAAE;CAClB,0BAA0B;EACxB,MAAM,6BAA6B,OACjC,OACA,oBACG;GACH,MAAM,kBAAkB,OAAO,KAC7B,QAAQ,qBAAqB,EAAE,CAChC,CAAC,QAAQ,QAAQ,CAAC,aAAa,SAAS,IAAmB,CAAC;AAC7D,OACE,mBAEA,oBAAoB,QACpB,CAAC,gBAAgB,SAAS,gBAAgB,CAE1C,OAAM,WACJ,iBACA,QAAQ,oBAAoB,iBAC7B,CAAC,MAAM,qBAAqB;AAC3B,UAAM,UAAU;KACd,UAAU;KACV,eAAe;KAChB,CAAC;KACF;;AAGN,UAAQ,UAA0B;AAEhC,OAAI,MAEF,4BACE,OACA,MAAM,SAAS,WAAW,IAAI,QAAQ,WAAW,QAClD;;;CAIR,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"createSettingsStore.js","names":[],"sources":["../../../../src/stores/settings/createSettingsStore.ts"],"sourcesContent":["/** biome-ignore-all lint/correctness/noUnusedVariables: allowed in this store */\nimport type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport { allLanguages } from '../../providers/I18nProvider/constants.js'\nimport { loadLocale } from '../../providers/I18nProvider/i18n.js'\nimport type { LanguageKey } from '../../providers/I18nProvider/types.js'\nimport type { WidgetConfig } from '../../types/widget.js'\nimport type { SettingsProps, SettingsState } from './types.js'\nimport { SettingsToolTypes } from './types.js'\nimport { getStateValues } from './utils/getStateValues.js'\n\nexport const defaultSlippage = undefined\n\nexport const defaultConfigurableSettings: Pick<\n SettingsState,\n 'routePriority' | 'slippage' | 'gasPrice'\n> = {\n routePriority: 'CHEAPEST',\n slippage: defaultSlippage,\n gasPrice: 'normal',\n}\n\nconst defaultSettings: SettingsProps = {\n gasPrice: 'normal',\n enabledAutoRefuel: true,\n disabledBridges: [],\n disabledExchanges: [],\n enabledBridges: [],\n enabledExchanges: [],\n _enabledBridges: {},\n _enabledExchanges: {},\n smallBalanceThreshold: undefined,\n}\n\nexport const createSettingsStore = (\n config: WidgetConfig\n): UseBoundStore<StoreApi<SettingsState>> =>\n create<SettingsState>()(\n persist(\n (set, get) => ({\n ...defaultSettings,\n setValue: (key, value) =>\n set(() => ({\n [key]: value,\n })),\n setValues: (values: Partial<SettingsProps>) =>\n set(() => ({\n ...values,\n })),\n getSettings: () => getStateValues(get()),\n getValue: (key) => get()[key],\n initializeTools: (toolType, tools, reset) => {\n if (!tools.length) {\n return\n }\n set((state) => {\n const updatedState = { ...state }\n if (!reset) {\n // Add new tools\n tools.forEach((tool) => {\n if (!Object.hasOwn(updatedState[`_enabled${toolType}`], tool)) {\n updatedState[`_enabled${toolType}`][tool] = true\n }\n })\n // Filter tools we no longer have\n updatedState[`_enabled${toolType}`] = Object.fromEntries(\n Object.entries(updatedState[`_enabled${toolType}`]).filter(\n ([key]) => tools.includes(key)\n )\n )\n } else {\n tools.forEach((tool) => {\n updatedState[`_enabled${toolType}`][tool] = true\n })\n }\n const enabledToolKeys = Object.keys(\n updatedState[`_enabled${toolType}`]\n )\n updatedState[`enabled${toolType}`] = enabledToolKeys.filter(\n (key) => updatedState[`_enabled${toolType}`][key]\n )\n updatedState[`disabled${toolType}`] = enabledToolKeys.filter(\n (key) => !updatedState[`_enabled${toolType}`][key]\n )\n return updatedState\n })\n },\n setToolValue: (toolType, tool, value) =>\n set((state) => {\n const enabledTools = {\n ...state[`_enabled${toolType}`],\n [tool]: value,\n }\n const enabledToolKeys = Object.keys(enabledTools)\n return {\n [`_enabled${toolType}`]: enabledTools,\n [`enabled${toolType}`]: enabledToolKeys.filter(\n (key) => enabledTools[key]\n ),\n [`disabled${toolType}`]: enabledToolKeys.filter(\n (key) => !enabledTools[key]\n ),\n }\n }),\n toggleToolKeys: (toolType, toolKeys) =>\n set((state) => {\n const allKeysInCollectionEnabled = toolKeys.every(\n (toolKey) => state[`_enabled${toolType}`][toolKey]\n )\n\n // then toggle those keys to false\n const updatedTools = toolKeys.reduce(\n (accum, toolKey) => {\n accum[toolKey] = !allKeysInCollectionEnabled\n return accum\n },\n {\n ...state[`_enabled${toolType}`],\n }\n )\n\n const enableKeys: string[] = []\n const disabledKeys: string[] = []\n\n Object.entries(updatedTools).forEach(([key, value]) => {\n if (value) {\n enableKeys.push(key)\n } else {\n disabledKeys.push(key)\n }\n })\n\n return {\n [`_enabled${toolType}`]: updatedTools,\n [`enabled${toolType}`]: enableKeys,\n [`disabled${toolType}`]: disabledKeys,\n }\n }),\n reset: (bridges, exchanges) => {\n set(() => ({\n ...defaultSettings,\n ...defaultConfigurableSettings,\n }))\n get().initializeTools('Bridges', bridges, true)\n get().initializeTools('Exchanges', exchanges, true)\n return { ...get() }\n },\n }),\n {\n name: 'li.fi-widget-settings',\n version: 6,\n partialize: (state) => {\n const {\n disabledBridges,\n disabledExchanges,\n enabledBridges,\n enabledExchanges,\n ...partializedState\n } = state\n return partializedState\n },\n merge: (persistedState: any, currentState: SettingsState) => {\n const state = { ...currentState, ...persistedState }\n SettingsToolTypes.forEach((toolType) => {\n if (persistedState?.[`_enabled${toolType}`]) {\n const enabledToolKeys = Object.keys(\n persistedState[`_enabled${toolType}`]\n )\n state[`enabled${toolType}`] = enabledToolKeys.filter(\n (key) => persistedState[`_enabled${toolType}`][key]\n )\n state[`disabled${toolType}`] = enabledToolKeys.filter(\n (key) => !persistedState[`_enabled${toolType}`][key]\n )\n }\n })\n return state\n },\n migrate: () => ({}),\n onRehydrateStorage: () => {\n const initializeLanguageSettings = async (\n state: SettingsState,\n initialLanguage?: string\n ) => {\n const customLanguages = Object.keys(\n config?.languageResources || {}\n ).filter((key) => !allLanguages.includes(key as LanguageKey))\n if (\n initialLanguage &&\n // Custom language resources and English are added statically.\n initialLanguage !== 'en' &&\n !customLanguages.includes(initialLanguage)\n ) {\n await loadLocale(\n initialLanguage as LanguageKey,\n config?.languageResources?.[initialLanguage as LanguageKey]\n ).then((languageResource) => {\n state.setValues({\n language: initialLanguage,\n languageCache: languageResource,\n })\n })\n }\n }\n return (state?: SettingsState) => {\n // Preload translations (from existing translation files)\n if (state) {\n // NB: State always exists unless there is any error\n initializeLanguageSettings(\n state,\n state.getValue('language') || config?.languages?.default\n )\n }\n }\n },\n }\n )\n )\n"],"mappings":";;;;;;AAcA,MAAa,8BAGT;CACF,eAAe;CACf,UAAA,KAAA;CACA,UAAU;CACX;AAED,MAAM,kBAAiC;CACrC,UAAU;CACV,mBAAmB;CACnB,iBAAiB,EAAE;CACnB,mBAAmB,EAAE;CACrB,gBAAgB,EAAE;CAClB,kBAAkB,EAAE;CACpB,iBAAiB,EAAE;CACnB,mBAAmB,EAAE;CACrB,uBAAuB,KAAA;CACxB;AAED,MAAa,uBACX,WAEA,QAAuB,CACrB,SACG,KAAK,SAAS;CACb,GAAG;CACH,WAAW,KAAK,UACd,WAAW,GACR,MAAM,OACR,EAAE;CACL,YAAY,WACV,WAAW,EACT,GAAG,QACJ,EAAE;CACL,mBAAmB,eAAe,KAAK,CAAC;CACxC,WAAW,QAAQ,KAAK,CAAC;CACzB,kBAAkB,UAAU,OAAO,UAAU;EAC3C,IAAI,CAAC,MAAM,QACT;EAEF,KAAK,UAAU;GACb,MAAM,eAAe,EAAE,GAAG,OAAO;GACjC,IAAI,CAAC,OAAO;IAEV,MAAM,SAAS,SAAS;KACtB,IAAI,CAAC,OAAO,OAAO,aAAa,WAAW,aAAa,KAAK,EAC3D,aAAa,WAAW,YAAY,QAAQ;MAE9C;IAEF,aAAa,WAAW,cAAc,OAAO,YAC3C,OAAO,QAAQ,aAAa,WAAW,YAAY,CAAC,QACjD,CAAC,SAAS,MAAM,SAAS,IAAI,CAC/B,CACF;UAED,MAAM,SAAS,SAAS;IACtB,aAAa,WAAW,YAAY,QAAQ;KAC5C;GAEJ,MAAM,kBAAkB,OAAO,KAC7B,aAAa,WAAW,YACzB;GACD,aAAa,UAAU,cAAc,gBAAgB,QAClD,QAAQ,aAAa,WAAW,YAAY,KAC9C;GACD,aAAa,WAAW,cAAc,gBAAgB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SAAS,aAAa;GACtC,IAAI,iBAAiB,WAAW,aAAa;IAC3C,MAAM,kBAAkB,OAAO,KAC7B,eAAe,WAAW,YAC3B;IACD,MAAM,UAAU,cAAc,gBAAgB,QAC3C,QAAQ,eAAe,WAAW,YAAY,KAChD;IACD,MAAM,WAAW,cAAc,gBAAgB,QAC5C,QAAQ,CAAC,eAAe,WAAW,YAAY,KACjD;;IAEH;EACF,OAAO;;CAET,gBAAgB,EAAE;CAClB,0BAA0B;EACxB,MAAM,6BAA6B,OACjC,OACA,oBACG;GACH,MAAM,kBAAkB,OAAO,KAC7B,QAAQ,qBAAqB,EAAE,CAChC,CAAC,QAAQ,QAAQ,CAAC,aAAa,SAAS,IAAmB,CAAC;GAC7D,IACE,mBAEA,oBAAoB,QACpB,CAAC,gBAAgB,SAAS,gBAAgB,EAE1C,MAAM,WACJ,iBACA,QAAQ,oBAAoB,iBAC7B,CAAC,MAAM,qBAAqB;IAC3B,MAAM,UAAU;KACd,UAAU;KACV,eAAe;KAChB,CAAC;KACF;;EAGN,QAAQ,UAA0B;GAEhC,IAAI,OAEF,2BACE,OACA,MAAM,SAAS,WAAW,IAAI,QAAQ,WAAW,QAClD;;;CAIR,CACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettings.js","names":[],"sources":["../../../../src/stores/settings/useSettings.ts"],"sourcesContent":["import { useSettingsStore } from './SettingsStore.js'\nimport type { SettingsState } from './types.js'\n\nexport const useSettings = <K extends keyof SettingsState>(\n keys: Array<K>\n): Pick<SettingsState, (typeof keys)[number]> => {\n return useSettingsStore((state) =>\n keys.reduce(\n (values, key) => {\n values[key] = state[key]\n return values\n },\n {} as Pick<SettingsState, (typeof keys)[number]>\n )\n )\n}\n"],"mappings":";;AAGA,MAAa,eACX,SAC+C;
|
|
1
|
+
{"version":3,"file":"useSettings.js","names":[],"sources":["../../../../src/stores/settings/useSettings.ts"],"sourcesContent":["import { useSettingsStore } from './SettingsStore.js'\nimport type { SettingsState } from './types.js'\n\nexport const useSettings = <K extends keyof SettingsState>(\n keys: Array<K>\n): Pick<SettingsState, (typeof keys)[number]> => {\n return useSettingsStore((state) =>\n keys.reduce(\n (values, key) => {\n values[key] = state[key]\n return values\n },\n {} as Pick<SettingsState, (typeof keys)[number]>\n )\n )\n}\n"],"mappings":";;AAGA,MAAa,eACX,SAC+C;CAC/C,OAAO,kBAAkB,UACvB,KAAK,QACF,QAAQ,QAAQ;EACf,OAAO,OAAO,MAAM;EACpB,OAAO;IAET,EAAE,CACH,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSettingsActions.js","names":[],"sources":["../../../../src/stores/settings/useSettingsActions.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { widgetEvents } from '../../hooks/useWidgetEvents.js'\nimport { useWidgetEvents } from '../../hooks/useWidgetEvents.js'\nimport { WidgetEvent } from '../../types/events.js'\nimport type { WidgetConfig } from '../../types/widget.js'\nimport { deepEqual } from '../../utils/deepEqual.js'\nimport { defaultConfigurableSettings } from './createSettingsStore.js'\nimport { useSettingsStore } from './SettingsStore.js'\nimport type {\n SettingsActions,\n SettingsProps,\n SettingsToolType,\n ValueSetter,\n} from './types.js'\n\nconst emitEventOnChange = <T extends (...args: any[]) => any>(\n emitter: typeof widgetEvents,\n actions: Omit<SettingsActions, 'initializeTools'>,\n settingFunction: T,\n ...args: Parameters<T>\n) => {\n const oldSettings = actions.getSettings()\n\n settingFunction(...args)\n\n const newSettings = actions.getSettings()\n\n if (!deepEqual(oldSettings, newSettings)) {\n ;(Object.keys(oldSettings) as (keyof SettingsProps)[]).forEach(\n (toolKey) => {\n if (!deepEqual(oldSettings[toolKey], newSettings[toolKey])) {\n emitter.emit(WidgetEvent.SettingUpdated, {\n setting: toolKey,\n newValue: newSettings[toolKey],\n oldValue: oldSettings[toolKey],\n newSettings: newSettings,\n oldSettings: oldSettings,\n })\n }\n }\n )\n }\n}\n\nexport const useSettingsActions = (): {\n setValue: ValueSetter<SettingsProps>\n setValues: (values: Partial<SettingsProps>) => void\n setDefaultSettings: (config?: WidgetConfig) => void\n resetSettings: (bridges: string[], exchanges: string[]) => void\n setToolValue: (\n toolType: SettingsToolType,\n tool: string,\n value: boolean\n ) => void\n toggleToolKeys: (toolType: SettingsToolType, toolKeys: string[]) => void\n} => {\n const emitter = useWidgetEvents()\n const actions = useSettingsStore((state) => ({\n setValue: state.setValue,\n setValues: state.setValues,\n getValue: state.getValue,\n getSettings: state.getSettings,\n reset: state.reset,\n setToolValue: state.setToolValue,\n toggleToolKeys: state.toggleToolKeys,\n }))\n\n const setValueWithEmittedEvent = useCallback<ValueSetter<SettingsProps>>(\n (value, newValue) => {\n const setting = value as keyof SettingsProps\n emitEventOnChange(emitter, actions, actions.setValue, setting, newValue)\n },\n [emitter, actions]\n )\n\n const setValuesWithEmittedEvent = useCallback(\n (values: Partial<SettingsProps>) => {\n Object.entries(values).forEach(([key, value]) => {\n setValueWithEmittedEvent(key as keyof SettingsProps, value)\n })\n },\n [setValueWithEmittedEvent]\n )\n\n const setDefaultSettingsWithEmittedEvents = useCallback(\n (config?: WidgetConfig) => {\n const slippage = actions.getValue('slippage')\n const routePriority = actions.getValue('routePriority')\n const gasPrice = actions.getValue('gasPrice')\n\n const defaultSlippage =\n (config?.slippage || config?.sdkConfig?.routeOptions?.slippage || 0) *\n 100\n const defaultRoutePriority =\n config?.routePriority || config?.sdkConfig?.routeOptions?.order\n\n defaultConfigurableSettings.slippage = (\n defaultSlippage || defaultConfigurableSettings.slippage\n )?.toString()\n\n defaultConfigurableSettings.routePriority =\n defaultRoutePriority || defaultConfigurableSettings.routePriority\n\n if (!slippage) {\n setValueWithEmittedEvent(\n 'slippage',\n defaultConfigurableSettings.slippage\n )\n }\n if (!routePriority) {\n setValueWithEmittedEvent(\n 'routePriority',\n defaultConfigurableSettings.routePriority\n )\n }\n if (!gasPrice) {\n setValueWithEmittedEvent(\n 'gasPrice',\n defaultConfigurableSettings.gasPrice\n )\n }\n },\n [actions, setValueWithEmittedEvent]\n )\n\n const resetWithEmittedEvents = useCallback(\n (bridges: string[], exchanges: string[]) => {\n emitEventOnChange(emitter, actions, actions.reset, bridges, exchanges)\n },\n [emitter, actions]\n )\n\n const setToolValueWithEmittedEvents = useCallback(\n (toolType: SettingsToolType, tool: string, value: boolean) => {\n emitEventOnChange(\n emitter,\n actions,\n actions.setToolValue,\n toolType,\n tool,\n value\n )\n },\n [emitter, actions]\n )\n\n const toggleToolKeysWithEmittedEvents = useCallback(\n (toolType: SettingsToolType, toolKeys: string[]) => {\n emitEventOnChange(\n emitter,\n actions,\n actions.toggleToolKeys,\n toolType,\n toolKeys\n )\n },\n [emitter, actions]\n )\n\n return {\n setValue: setValueWithEmittedEvent,\n setValues: setValuesWithEmittedEvent,\n setDefaultSettings: setDefaultSettingsWithEmittedEvents,\n resetSettings: resetWithEmittedEvents,\n setToolValue: setToolValueWithEmittedEvents,\n toggleToolKeys: toggleToolKeysWithEmittedEvents,\n }\n}\n"],"mappings":";;;;;;;AAeA,MAAM,qBACJ,SACA,SACA,iBACA,GAAG,SACA;CACH,MAAM,cAAc,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"useSettingsActions.js","names":[],"sources":["../../../../src/stores/settings/useSettingsActions.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { widgetEvents } from '../../hooks/useWidgetEvents.js'\nimport { useWidgetEvents } from '../../hooks/useWidgetEvents.js'\nimport { WidgetEvent } from '../../types/events.js'\nimport type { WidgetConfig } from '../../types/widget.js'\nimport { deepEqual } from '../../utils/deepEqual.js'\nimport { defaultConfigurableSettings } from './createSettingsStore.js'\nimport { useSettingsStore } from './SettingsStore.js'\nimport type {\n SettingsActions,\n SettingsProps,\n SettingsToolType,\n ValueSetter,\n} from './types.js'\n\nconst emitEventOnChange = <T extends (...args: any[]) => any>(\n emitter: typeof widgetEvents,\n actions: Omit<SettingsActions, 'initializeTools'>,\n settingFunction: T,\n ...args: Parameters<T>\n) => {\n const oldSettings = actions.getSettings()\n\n settingFunction(...args)\n\n const newSettings = actions.getSettings()\n\n if (!deepEqual(oldSettings, newSettings)) {\n ;(Object.keys(oldSettings) as (keyof SettingsProps)[]).forEach(\n (toolKey) => {\n if (!deepEqual(oldSettings[toolKey], newSettings[toolKey])) {\n emitter.emit(WidgetEvent.SettingUpdated, {\n setting: toolKey,\n newValue: newSettings[toolKey],\n oldValue: oldSettings[toolKey],\n newSettings: newSettings,\n oldSettings: oldSettings,\n })\n }\n }\n )\n }\n}\n\nexport const useSettingsActions = (): {\n setValue: ValueSetter<SettingsProps>\n setValues: (values: Partial<SettingsProps>) => void\n setDefaultSettings: (config?: WidgetConfig) => void\n resetSettings: (bridges: string[], exchanges: string[]) => void\n setToolValue: (\n toolType: SettingsToolType,\n tool: string,\n value: boolean\n ) => void\n toggleToolKeys: (toolType: SettingsToolType, toolKeys: string[]) => void\n} => {\n const emitter = useWidgetEvents()\n const actions = useSettingsStore((state) => ({\n setValue: state.setValue,\n setValues: state.setValues,\n getValue: state.getValue,\n getSettings: state.getSettings,\n reset: state.reset,\n setToolValue: state.setToolValue,\n toggleToolKeys: state.toggleToolKeys,\n }))\n\n const setValueWithEmittedEvent = useCallback<ValueSetter<SettingsProps>>(\n (value, newValue) => {\n const setting = value as keyof SettingsProps\n emitEventOnChange(emitter, actions, actions.setValue, setting, newValue)\n },\n [emitter, actions]\n )\n\n const setValuesWithEmittedEvent = useCallback(\n (values: Partial<SettingsProps>) => {\n Object.entries(values).forEach(([key, value]) => {\n setValueWithEmittedEvent(key as keyof SettingsProps, value)\n })\n },\n [setValueWithEmittedEvent]\n )\n\n const setDefaultSettingsWithEmittedEvents = useCallback(\n (config?: WidgetConfig) => {\n const slippage = actions.getValue('slippage')\n const routePriority = actions.getValue('routePriority')\n const gasPrice = actions.getValue('gasPrice')\n\n const defaultSlippage =\n (config?.slippage || config?.sdkConfig?.routeOptions?.slippage || 0) *\n 100\n const defaultRoutePriority =\n config?.routePriority || config?.sdkConfig?.routeOptions?.order\n\n defaultConfigurableSettings.slippage = (\n defaultSlippage || defaultConfigurableSettings.slippage\n )?.toString()\n\n defaultConfigurableSettings.routePriority =\n defaultRoutePriority || defaultConfigurableSettings.routePriority\n\n if (!slippage) {\n setValueWithEmittedEvent(\n 'slippage',\n defaultConfigurableSettings.slippage\n )\n }\n if (!routePriority) {\n setValueWithEmittedEvent(\n 'routePriority',\n defaultConfigurableSettings.routePriority\n )\n }\n if (!gasPrice) {\n setValueWithEmittedEvent(\n 'gasPrice',\n defaultConfigurableSettings.gasPrice\n )\n }\n },\n [actions, setValueWithEmittedEvent]\n )\n\n const resetWithEmittedEvents = useCallback(\n (bridges: string[], exchanges: string[]) => {\n emitEventOnChange(emitter, actions, actions.reset, bridges, exchanges)\n },\n [emitter, actions]\n )\n\n const setToolValueWithEmittedEvents = useCallback(\n (toolType: SettingsToolType, tool: string, value: boolean) => {\n emitEventOnChange(\n emitter,\n actions,\n actions.setToolValue,\n toolType,\n tool,\n value\n )\n },\n [emitter, actions]\n )\n\n const toggleToolKeysWithEmittedEvents = useCallback(\n (toolType: SettingsToolType, toolKeys: string[]) => {\n emitEventOnChange(\n emitter,\n actions,\n actions.toggleToolKeys,\n toolType,\n toolKeys\n )\n },\n [emitter, actions]\n )\n\n return {\n setValue: setValueWithEmittedEvent,\n setValues: setValuesWithEmittedEvent,\n setDefaultSettings: setDefaultSettingsWithEmittedEvents,\n resetSettings: resetWithEmittedEvents,\n setToolValue: setToolValueWithEmittedEvents,\n toggleToolKeys: toggleToolKeysWithEmittedEvents,\n }\n}\n"],"mappings":";;;;;;;AAeA,MAAM,qBACJ,SACA,SACA,iBACA,GAAG,SACA;CACH,MAAM,cAAc,QAAQ,aAAa;CAEzC,gBAAgB,GAAG,KAAK;CAExB,MAAM,cAAc,QAAQ,aAAa;CAEzC,IAAI,CAAC,UAAU,aAAa,YAAY,EACrC,OAAQ,KAAK,YAAY,CAA6B,SACpD,YAAY;EACX,IAAI,CAAC,UAAU,YAAY,UAAU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kBAAkB,SAAS,SAAS,QAAQ,OAAO,SAAS,UAAU;KAExE,CAAC,SAAS,QAAQ,CAkCmB;EACrC,cAhCoC,aACnC,UAA4B,MAAc,UAAmB;GAC5D,kBACE,SACA,SACA,QAAQ,cACR,UACA,MACA,MACD;KAEH,CAAC,SAAS,QAAQ,CAqByB;EAC3C,gBAnBsC,aACrC,UAA4B,aAAuB;GAClD,kBACE,SACA,SACA,QAAQ,gBACR,UACA,SACD;KAEH,CAAC,SAAS,QAAQ,CAS6B;EAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSplitSubvariantStore.js","names":[],"sources":["../../../../src/stores/settings/useSplitSubvariantStore.tsx"],"sourcesContent":["import { createContext, type JSX, useContext, useRef } from 'react'\nimport { create } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type {\n SplitSubvariantProps,\n SplitSubvariantProviderProps,\n SplitSubvariantState,\n SplitSubvariantStore,\n} from './types.js'\n\nconst SplitSubvariantStoreContext = createContext<SplitSubvariantStore | null>(\n null\n)\n\nconst shouldRecreateStore = (\n store: SplitSubvariantStore,\n props: SplitSubvariantProps\n) => {\n const { state } = store.getState()\n return state !== props.state\n}\n\nexport function SplitSubvariantStoreProvider({\n children,\n ...props\n}: SplitSubvariantProviderProps): JSX.Element {\n const storeRef = useRef<SplitSubvariantStore>(null)\n if (!storeRef.current || shouldRecreateStore(storeRef.current, props)) {\n storeRef.current = createSplitSubvariantStore(props)\n }\n return (\n <SplitSubvariantStoreContext.Provider value={storeRef.current}>\n {children}\n </SplitSubvariantStoreContext.Provider>\n )\n}\n\nfunction useSplitSubvariantStoreContext() {\n const useStore = useContext(SplitSubvariantStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${SplitSubvariantStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useSplitSubvariantStore<T>(\n selector: (state: SplitSubvariantState) => T\n): T {\n const useStore = useSplitSubvariantStoreContext()\n return useStore(useShallow(selector))\n}\n\nconst createSplitSubvariantStore = ({ state }: SplitSubvariantProps) =>\n create<SplitSubvariantState>((set) => ({\n state,\n setState(state) {\n set(() => ({\n state,\n }))\n },\n }))\n"],"mappings":";;;;;AAUA,MAAM,8BAA8B,cAClC,KACD;AAED,MAAM,uBACJ,OACA,UACG;CACH,MAAM,EAAE,UAAU,MAAM,UAAU;
|
|
1
|
+
{"version":3,"file":"useSplitSubvariantStore.js","names":[],"sources":["../../../../src/stores/settings/useSplitSubvariantStore.tsx"],"sourcesContent":["import { createContext, type JSX, useContext, useRef } from 'react'\nimport { create } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type {\n SplitSubvariantProps,\n SplitSubvariantProviderProps,\n SplitSubvariantState,\n SplitSubvariantStore,\n} from './types.js'\n\nconst SplitSubvariantStoreContext = createContext<SplitSubvariantStore | null>(\n null\n)\n\nconst shouldRecreateStore = (\n store: SplitSubvariantStore,\n props: SplitSubvariantProps\n) => {\n const { state } = store.getState()\n return state !== props.state\n}\n\nexport function SplitSubvariantStoreProvider({\n children,\n ...props\n}: SplitSubvariantProviderProps): JSX.Element {\n const storeRef = useRef<SplitSubvariantStore>(null)\n if (!storeRef.current || shouldRecreateStore(storeRef.current, props)) {\n storeRef.current = createSplitSubvariantStore(props)\n }\n return (\n <SplitSubvariantStoreContext.Provider value={storeRef.current}>\n {children}\n </SplitSubvariantStoreContext.Provider>\n )\n}\n\nfunction useSplitSubvariantStoreContext() {\n const useStore = useContext(SplitSubvariantStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${SplitSubvariantStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useSplitSubvariantStore<T>(\n selector: (state: SplitSubvariantState) => T\n): T {\n const useStore = useSplitSubvariantStoreContext()\n return useStore(useShallow(selector))\n}\n\nconst createSplitSubvariantStore = ({ state }: SplitSubvariantProps) =>\n create<SplitSubvariantState>((set) => ({\n state,\n setState(state) {\n set(() => ({\n state,\n }))\n },\n }))\n"],"mappings":";;;;;AAUA,MAAM,8BAA8B,cAClC,KACD;AAED,MAAM,uBACJ,OACA,UACG;CACH,MAAM,EAAE,UAAU,MAAM,UAAU;CAClC,OAAO,UAAU,MAAM;;AAGzB,SAAgB,6BAA6B,EAC3C,UACA,GAAG,SACyC;CAC5C,MAAM,WAAW,OAA6B,KAAK;CACnD,IAAI,CAAC,SAAS,WAAW,oBAAoB,SAAS,SAAS,MAAM,EACnE,SAAS,UAAU,2BAA2B,MAAM;CAEtD,OACE,oBAAC,4BAA4B,UAA7B;EAAsC,OAAO,SAAS;EACnD;EACoC,CAAA;;AAI3C,SAAS,iCAAiC;CACxC,MAAM,WAAW,WAAW,4BAA4B;CACxD,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,6BAA6B,KAAK,IAC5E;CAEH,OAAO;;AAGT,SAAgB,wBACd,UACG;CAEH,OADiB,gCACF,CAAC,WAAW,SAAS,CAAC;;AAGvC,MAAM,8BAA8B,EAAE,YACpC,QAA8B,SAAS;CACrC;CACA,SAAS,OAAO;EACd,WAAW,EACT,OACD,EAAE;;CAEN,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","names":["createTheme","createMuiTheme"],"sources":["../../../src/themes/createTheme.ts"],"sourcesContent":["import type {\n CSSObject,\n Shape,\n SimplePaletteColorOptions,\n Theme,\n} from '@mui/material'\nimport {\n alpha,\n buttonClasses,\n createTheme as createMuiTheme,\n css,\n darken,\n keyframes,\n lighten,\n tabsClasses,\n touchRippleClasses,\n} from '@mui/material'\nimport type { WidgetTheme } from '../types/widget.js'\nimport { palette, paletteDark, paletteLight } from './palettes.js'\nimport type {} from './types.js'\nimport { getStyleOverrides } from './utils.js'\n\nconst shape: Shape = {\n borderRadius: 12,\n borderRadiusSecondary: 12,\n borderRadiusTertiary: 24,\n}\n\nconst enterKeyframe = keyframes`\n 0% {\n transform: scale(0);\n opacity: 0.05;\n }\n 100% {\n transform: scale(1);\n opacity: 0.1;\n }\n`\n\nexport const createTheme = (widgetTheme: WidgetTheme = {}): Theme => {\n const configuredPaletteLight = widgetTheme.colorSchemes?.light?.palette\n const configuredPaletteDark = widgetTheme.colorSchemes?.dark?.palette\n\n const primaryMainColorLight =\n (configuredPaletteLight?.primary as SimplePaletteColorOptions)?.main ??\n palette.primary.main\n const primaryMainColorDark =\n (configuredPaletteDark?.primary as SimplePaletteColorOptions)?.main ??\n palette.primary.main\n\n const primaryLightenColorLight = lighten(primaryMainColorLight, 0.84)\n const primaryDarkenColorLight = darken(primaryMainColorLight, 0.2)\n const primaryLightenColorDark =\n primaryMainColorLight === primaryMainColorDark\n ? primaryLightenColorLight\n : lighten(primaryMainColorDark, 0.84)\n const primaryDarkenColorDark =\n primaryMainColorLight === primaryMainColorDark\n ? primaryDarkenColorLight\n : darken(primaryMainColorDark, 0.2)\n\n const secondaryMainColorLight =\n (configuredPaletteLight?.secondary as SimplePaletteColorOptions)?.main ??\n palette.secondary.main\n const secondaryMainColorDark =\n (configuredPaletteDark?.secondary as SimplePaletteColorOptions)?.main ??\n palette.secondary.main\n\n const secondaryLightenColorLight = lighten(secondaryMainColorLight, 0.84)\n const secondaryDarkenColorLight = darken(secondaryMainColorLight, 0.2)\n const secondaryLightenColorDark =\n secondaryMainColorLight === secondaryMainColorDark\n ? secondaryLightenColorLight\n : lighten(secondaryMainColorDark, 0.84)\n const secondaryDarkenColorDark =\n secondaryMainColorLight === secondaryMainColorDark\n ? secondaryDarkenColorLight\n : darken(secondaryMainColorDark, 0.2)\n\n const theme = createMuiTheme({\n cssVariables: {\n cssVarPrefix: 'lifi',\n colorSchemeSelector: 'class',\n nativeColor: true,\n },\n colorSchemes: {\n light: {\n palette: {\n ...palette,\n ...paletteLight,\n ...widgetTheme.colorSchemes?.light?.palette,\n primary: {\n main: primaryMainColorLight,\n light: primaryLightenColorLight,\n dark: primaryDarkenColorLight,\n },\n secondary: {\n main: secondaryMainColorLight,\n light: secondaryLightenColorLight,\n dark: secondaryDarkenColorLight,\n },\n },\n },\n dark: {\n palette: {\n ...palette,\n ...paletteDark,\n ...widgetTheme.colorSchemes?.dark?.palette,\n primary: {\n main: primaryMainColorDark,\n light: primaryLightenColorDark,\n dark: primaryDarkenColorDark,\n },\n secondary: {\n main: secondaryMainColorDark,\n light: secondaryLightenColorDark,\n dark: secondaryDarkenColorDark,\n },\n },\n },\n },\n container: widgetTheme.container,\n routesContainer: widgetTheme.routesContainer,\n chainSidebarContainer: widgetTheme.chainSidebarContainer,\n header: widgetTheme.header,\n navigation: {\n edge: true,\n ...widgetTheme.navigation,\n },\n typography: {\n fontFamily: 'Inter, sans-serif',\n ...widgetTheme.typography,\n },\n shape: {\n ...shape,\n ...widgetTheme.shape,\n },\n breakpoints: {\n values: {\n xs: 360,\n sm: 416,\n md: 900,\n lg: 1200,\n xl: 1536,\n },\n },\n components: {\n MuiScopedCssBaseline: {\n styleOverrides: {\n root: {\n fontFamily: 'Inter, sans-serif',\n ...widgetTheme.typography,\n },\n },\n },\n MuiAppBar: {\n styleOverrides: {\n root: ({ ownerState }) => ({\n minHeight: 40,\n padding: 0,\n ...getStyleOverrides('MuiAppBar', 'root', widgetTheme, ownerState),\n }),\n },\n },\n MuiCard: {\n defaultProps: {\n variant: 'outlined',\n ...widgetTheme.components?.MuiCard?.defaultProps,\n },\n styleOverrides: {\n root: ({ ownerState, theme }) => {\n const root = widgetTheme.components?.MuiCard?.styleOverrides\n ?.root as CSSObject\n const rootHover = root?.['&:hover']\n return {\n backgroundColor: theme.vars.palette.background.paper,\n backgroundImage: 'none',\n borderRadius: theme.vars.shape.borderRadius,\n overflow: 'hidden',\n position: 'relative',\n boxSizing: 'border-box',\n transition: theme.transitions.create(\n ['background-color', 'filter'],\n {\n duration: theme.transitions.duration.enteringScreen,\n easing: theme.transitions.easing.easeOut,\n }\n ),\n ...(!!ownerState.onClick && {\n '&:hover': {\n cursor: 'pointer',\n },\n }),\n ...(!!ownerState.onClick &&\n (ownerState.variant === 'outlined' ||\n ownerState.variant === 'filled') && {\n '&:hover': {\n cursor: 'pointer',\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.background.paper} 98%, black)`,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.background.paper} 98%, white)`,\n }),\n },\n }),\n ...(!!ownerState.onClick &&\n ownerState.variant === 'elevation' && {\n '&:hover': {\n cursor: 'pointer',\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent))`,\n ...theme.applyStyles('dark', {\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.background} 8%, transparent))`,\n }),\n },\n }),\n ...(typeof root === 'object' && root),\n ...(!!ownerState.onClick &&\n !!rootHover && {\n '&:hover': {\n ...rootHover,\n ...theme.applyStyles('dark', {\n ...rootHover,\n }),\n },\n }),\n ...(!ownerState.onClick && {\n '&:hover': {},\n }),\n }\n },\n },\n variants: widgetTheme.components?.MuiCard?.variants ?? [\n {\n props: { variant: 'outlined' },\n style: ({ theme }) => ({\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: theme.vars.palette.grey[300],\n ...theme.applyStyles('dark', {\n borderColor: theme.vars.palette.grey[800],\n }),\n }),\n },\n {\n props: { variant: 'elevation' },\n style: ({ theme }) => ({\n border: 'none',\n boxShadow: 'none',\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent))`,\n ...theme.applyStyles('dark', {\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.background} 4%, transparent))`,\n }),\n }),\n },\n {\n props: { variant: 'filled' },\n style: {\n border: 'none',\n },\n },\n ],\n },\n MuiInputCard: {\n ...widgetTheme.components?.MuiInputCard,\n },\n MuiButtonBase: {\n styleOverrides: {\n // This `css()` function invokes keyframes. `styled-components` only supports keyframes\n // in string templates. Do not convert these styles in JS object as it will break.\n root: css`\n &\n .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible} {\n opacity: 0.1;\n animation-name: ${enterKeyframe};\n }\n `,\n },\n },\n MuiButton: {\n defaultProps: {\n disableElevation: true,\n ...widgetTheme.components?.MuiButton?.defaultProps,\n },\n styleOverrides: {\n root: ({ theme, ownerState }) => ({\n borderRadius: theme.vars.shape.borderRadiusSecondary,\n textTransform: 'none',\n fontSize: 16,\n fontWeight: 600,\n '&.Mui-disabled, &.Mui-disabled:hover': {\n color: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 56%, transparent)`,\n cursor: 'not-allowed',\n pointerEvents: 'auto',\n },\n [`&.${buttonClasses.loading}.Mui-disabled`]: {\n backgroundColor: theme.vars.palette.primary.main,\n color: theme.palette.getContrastText(theme.palette.primary.main),\n cursor: 'auto',\n pointerEvents: 'auto',\n },\n [`.${buttonClasses.loadingIndicator}`]: {\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n [`&.${buttonClasses.root}.${buttonClasses.loading}`]: {\n color: 'transparent',\n },\n ...getStyleOverrides('MuiButton', 'root', widgetTheme, ownerState),\n }),\n text: ({ theme, ownerState }) => ({\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 8%, transparent)`,\n color: theme.vars.palette.primary.main,\n '&:hover': {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 12%, transparent)`,\n },\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 42%, transparent)`,\n color: theme.palette.getContrastText(\n alpha(theme.palette.primary.main, 0.08)\n ),\n '&:hover': {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 56%, transparent)`,\n },\n }),\n ...getStyleOverrides('MuiButton', 'text', widgetTheme, ownerState),\n }),\n contained: ({ ownerState }) => ({\n '&:hover': {\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n ...getStyleOverrides(\n 'MuiButton',\n 'contained',\n widgetTheme,\n ownerState\n ),\n }),\n sizeMedium: ({ ownerState }) => ({\n padding: '10px 14px',\n ...getStyleOverrides(\n 'MuiButton',\n 'sizeMedium',\n widgetTheme,\n ownerState\n ),\n }),\n },\n },\n MuiIconButton: {\n ...widgetTheme.components?.MuiIconButton,\n styleOverrides: {\n ...widgetTheme.components?.MuiIconButton?.styleOverrides,\n root: ({ ownerState }) => ({\n color: 'inherit',\n '&:hover': {\n color: 'inherit',\n },\n ...getStyleOverrides(\n 'MuiIconButton',\n 'root',\n widgetTheme,\n ownerState\n ),\n }),\n },\n },\n MuiAvatar: {\n styleOverrides: {\n root: {\n height: 40,\n width: 40,\n },\n img: {\n objectFit: 'contain',\n },\n },\n ...widgetTheme.components?.MuiAvatar,\n },\n MuiListItemText: {\n styleOverrides: {\n primary: ({ theme }) => ({\n fontWeight: 600,\n fontSize: '1.125rem',\n lineHeight: '1.2778',\n color: theme.vars.palette.text.primary,\n }),\n secondary: ({ theme }) => ({\n fontWeight: 500,\n fontSize: '0.75rem',\n color: theme.vars.palette.text.secondary,\n }),\n },\n },\n MuiTooltip: {\n defaultProps: {\n enterDelay: 400,\n disableInteractive: true,\n arrow: true,\n placement: 'top',\n },\n styleOverrides: {\n tooltip: ({ theme }) => ({\n backgroundColor: 'rgb(0 0 0 / 64%)',\n backdropFilter: 'blur(3px)',\n fontSize: '0.75rem',\n padding: theme.spacing(1, 1.5),\n }),\n arrow: {\n color: 'rgb(0 0 0 / 64%)',\n },\n },\n },\n MuiMenu: {\n styleOverrides: {\n paper: ({ theme }) => ({\n backgroundColor: theme.vars.palette.background.paper,\n backgroundImage: 'none',\n }),\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: {\n backgroundImage: 'none',\n },\n },\n },\n MuiPaper: {\n styleOverrides: {\n root: {\n backgroundImage: 'none',\n },\n },\n },\n MuiTabs: {\n ...widgetTheme.components?.MuiTabs,\n styleOverrides: {\n ...widgetTheme.components?.MuiTabs?.styleOverrides,\n root: ({ theme, ownerState }) => {\n const rootStyleOverrides = getStyleOverrides(\n 'MuiTabs',\n 'root',\n widgetTheme,\n ownerState\n )\n return {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,\n }),\n borderRadius: theme.vars.shape.borderRadius,\n ...rootStyleOverrides,\n [`.${tabsClasses.indicator}`]: {\n backgroundColor: theme.vars.palette.background.paper,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.background} 56%, transparent)`,\n }),\n borderRadius:\n theme.shape.borderRadius > 0\n ? `calc(${theme.vars.shape.borderRadius} - 4px)`\n : theme.vars.shape.borderRadius,\n boxShadow: `0px 2px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,\n ...rootStyleOverrides?.[`.${tabsClasses.indicator}`],\n },\n }\n },\n },\n },\n MuiNavigationTabs: {\n ...widgetTheme.components?.MuiNavigationTabs,\n },\n MuiNavigationTab: {\n ...widgetTheme.components?.MuiNavigationTab,\n },\n MuiCheckbox: {\n styleOverrides: {\n root: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n },\n ...widgetTheme.components?.MuiCheckbox,\n },\n },\n })\n\n return theme\n}\n"],"mappings":";;;;AAsBA,MAAM,QAAe;CACnB,cAAc;CACd,uBAAuB;CACvB,sBAAsB;CACvB;AAED,MAAM,gBAAgB,SAAS;;;;;;;;;;AAW/B,MAAaA,iBAAe,cAA2B,EAAE,KAAY;CACnE,MAAM,yBAAyB,YAAY,cAAc,OAAO;CAChE,MAAM,wBAAwB,YAAY,cAAc,MAAM;CAE9D,MAAM,yBACH,wBAAwB,UAAuC,QAChE,QAAQ,QAAQ;CAClB,MAAM,wBACH,uBAAuB,UAAuC,QAC/D,QAAQ,QAAQ;CAElB,MAAM,2BAA2B,QAAQ,uBAAuB,IAAK;CACrE,MAAM,0BAA0B,OAAO,uBAAuB,GAAI;CAClE,MAAM,0BACJ,0BAA0B,uBACt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AC7B,iBAAiB,MAAM,KAAK,QAAQ,WAAW;QAC/C,GAAG,MAAM,YAAY,QAAQ,EAC3B,iBAAiB,sBAAsB,MAAM,KAAK,QAAQ,OAAO,WAAW,qBAC7E,CAAC;QACF,cACE,MAAM,MAAM,eAAe,IACvB,QAAQ,MAAM,KAAK,MAAM,aAAa,WACtC,MAAM,KAAK,MAAM;QACvB,WAAW,kCAAkC,MAAM,KAAK,QAAQ,OAAO,aAAa;QACpF,GAAG,qBAAqB,IAAI,YAAY;QACzC;OACF;;KAEJ;IACF;GACD,mBAAmB,EACjB,GAAG,YAAY,YAAY,mBAC5B;GACD,kBAAkB,EAChB,GAAG,YAAY,YAAY,kBAC5B;GACD,aAAa;IACX,gBAAgB,EACd,MAAM,EACJ,WAAW,EACT,iBAAiB,eAClB,EACF,EACF;IACD,GAAG,YAAY,YAAY;IAC5B;GACF;EACF,CAAC;AAEF,QAAO"}
|
|
1
|
+
{"version":3,"file":"createTheme.js","names":["createTheme","createMuiTheme"],"sources":["../../../src/themes/createTheme.ts"],"sourcesContent":["import type {\n CSSObject,\n Shape,\n SimplePaletteColorOptions,\n Theme,\n} from '@mui/material'\nimport {\n alpha,\n buttonClasses,\n createTheme as createMuiTheme,\n css,\n darken,\n keyframes,\n lighten,\n tabsClasses,\n touchRippleClasses,\n} from '@mui/material'\nimport type { WidgetTheme } from '../types/widget.js'\nimport { palette, paletteDark, paletteLight } from './palettes.js'\nimport type {} from './types.js'\nimport { getStyleOverrides } from './utils.js'\n\nconst shape: Shape = {\n borderRadius: 12,\n borderRadiusSecondary: 12,\n borderRadiusTertiary: 24,\n}\n\nconst enterKeyframe = keyframes`\n 0% {\n transform: scale(0);\n opacity: 0.05;\n }\n 100% {\n transform: scale(1);\n opacity: 0.1;\n }\n`\n\nexport const createTheme = (widgetTheme: WidgetTheme = {}): Theme => {\n const configuredPaletteLight = widgetTheme.colorSchemes?.light?.palette\n const configuredPaletteDark = widgetTheme.colorSchemes?.dark?.palette\n\n const primaryMainColorLight =\n (configuredPaletteLight?.primary as SimplePaletteColorOptions)?.main ??\n palette.primary.main\n const primaryMainColorDark =\n (configuredPaletteDark?.primary as SimplePaletteColorOptions)?.main ??\n palette.primary.main\n\n const primaryLightenColorLight = lighten(primaryMainColorLight, 0.84)\n const primaryDarkenColorLight = darken(primaryMainColorLight, 0.2)\n const primaryLightenColorDark =\n primaryMainColorLight === primaryMainColorDark\n ? primaryLightenColorLight\n : lighten(primaryMainColorDark, 0.84)\n const primaryDarkenColorDark =\n primaryMainColorLight === primaryMainColorDark\n ? primaryDarkenColorLight\n : darken(primaryMainColorDark, 0.2)\n\n const secondaryMainColorLight =\n (configuredPaletteLight?.secondary as SimplePaletteColorOptions)?.main ??\n palette.secondary.main\n const secondaryMainColorDark =\n (configuredPaletteDark?.secondary as SimplePaletteColorOptions)?.main ??\n palette.secondary.main\n\n const secondaryLightenColorLight = lighten(secondaryMainColorLight, 0.84)\n const secondaryDarkenColorLight = darken(secondaryMainColorLight, 0.2)\n const secondaryLightenColorDark =\n secondaryMainColorLight === secondaryMainColorDark\n ? secondaryLightenColorLight\n : lighten(secondaryMainColorDark, 0.84)\n const secondaryDarkenColorDark =\n secondaryMainColorLight === secondaryMainColorDark\n ? secondaryDarkenColorLight\n : darken(secondaryMainColorDark, 0.2)\n\n const theme = createMuiTheme({\n cssVariables: {\n cssVarPrefix: 'lifi',\n colorSchemeSelector: 'class',\n nativeColor: true,\n },\n colorSchemes: {\n light: {\n palette: {\n ...palette,\n ...paletteLight,\n ...widgetTheme.colorSchemes?.light?.palette,\n primary: {\n main: primaryMainColorLight,\n light: primaryLightenColorLight,\n dark: primaryDarkenColorLight,\n },\n secondary: {\n main: secondaryMainColorLight,\n light: secondaryLightenColorLight,\n dark: secondaryDarkenColorLight,\n },\n },\n },\n dark: {\n palette: {\n ...palette,\n ...paletteDark,\n ...widgetTheme.colorSchemes?.dark?.palette,\n primary: {\n main: primaryMainColorDark,\n light: primaryLightenColorDark,\n dark: primaryDarkenColorDark,\n },\n secondary: {\n main: secondaryMainColorDark,\n light: secondaryLightenColorDark,\n dark: secondaryDarkenColorDark,\n },\n },\n },\n },\n container: widgetTheme.container,\n routesContainer: widgetTheme.routesContainer,\n chainSidebarContainer: widgetTheme.chainSidebarContainer,\n header: widgetTheme.header,\n navigation: {\n edge: true,\n ...widgetTheme.navigation,\n },\n typography: {\n fontFamily: 'Inter, sans-serif',\n ...widgetTheme.typography,\n },\n shape: {\n ...shape,\n ...widgetTheme.shape,\n },\n breakpoints: {\n values: {\n xs: 360,\n sm: 416,\n md: 900,\n lg: 1200,\n xl: 1536,\n },\n },\n components: {\n MuiScopedCssBaseline: {\n styleOverrides: {\n root: {\n fontFamily: 'Inter, sans-serif',\n ...widgetTheme.typography,\n },\n },\n },\n MuiAppBar: {\n styleOverrides: {\n root: ({ ownerState }) => ({\n minHeight: 40,\n padding: 0,\n ...getStyleOverrides('MuiAppBar', 'root', widgetTheme, ownerState),\n }),\n },\n },\n MuiCard: {\n defaultProps: {\n variant: 'outlined',\n ...widgetTheme.components?.MuiCard?.defaultProps,\n },\n styleOverrides: {\n root: ({ ownerState, theme }) => {\n const root = widgetTheme.components?.MuiCard?.styleOverrides\n ?.root as CSSObject\n const rootHover = root?.['&:hover']\n return {\n backgroundColor: theme.vars.palette.background.paper,\n backgroundImage: 'none',\n borderRadius: theme.vars.shape.borderRadius,\n overflow: 'hidden',\n position: 'relative',\n boxSizing: 'border-box',\n transition: theme.transitions.create(\n ['background-color', 'filter'],\n {\n duration: theme.transitions.duration.enteringScreen,\n easing: theme.transitions.easing.easeOut,\n }\n ),\n ...(!!ownerState.onClick && {\n '&:hover': {\n cursor: 'pointer',\n },\n }),\n ...(!!ownerState.onClick &&\n (ownerState.variant === 'outlined' ||\n ownerState.variant === 'filled') && {\n '&:hover': {\n cursor: 'pointer',\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.background.paper} 98%, black)`,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.background.paper} 98%, white)`,\n }),\n },\n }),\n ...(!!ownerState.onClick &&\n ownerState.variant === 'elevation' && {\n '&:hover': {\n cursor: 'pointer',\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent))`,\n ...theme.applyStyles('dark', {\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.background} 8%, transparent))`,\n }),\n },\n }),\n ...(typeof root === 'object' && root),\n ...(!!ownerState.onClick &&\n !!rootHover && {\n '&:hover': {\n ...rootHover,\n ...theme.applyStyles('dark', {\n ...rootHover,\n }),\n },\n }),\n ...(!ownerState.onClick && {\n '&:hover': {},\n }),\n }\n },\n },\n variants: widgetTheme.components?.MuiCard?.variants ?? [\n {\n props: { variant: 'outlined' },\n style: ({ theme }) => ({\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: theme.vars.palette.grey[300],\n ...theme.applyStyles('dark', {\n borderColor: theme.vars.palette.grey[800],\n }),\n }),\n },\n {\n props: { variant: 'elevation' },\n style: ({ theme }) => ({\n border: 'none',\n boxShadow: 'none',\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent))`,\n ...theme.applyStyles('dark', {\n filter: `drop-shadow(0 1px 4px color-mix(in srgb, ${theme.vars.palette.common.background} 4%, transparent))`,\n }),\n }),\n },\n {\n props: { variant: 'filled' },\n style: {\n border: 'none',\n },\n },\n ],\n },\n MuiInputCard: {\n ...widgetTheme.components?.MuiInputCard,\n },\n MuiButtonBase: {\n styleOverrides: {\n // This `css()` function invokes keyframes. `styled-components` only supports keyframes\n // in string templates. Do not convert these styles in JS object as it will break.\n root: css`\n &\n .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible} {\n opacity: 0.1;\n animation-name: ${enterKeyframe};\n }\n `,\n },\n },\n MuiButton: {\n defaultProps: {\n disableElevation: true,\n ...widgetTheme.components?.MuiButton?.defaultProps,\n },\n styleOverrides: {\n root: ({ theme, ownerState }) => ({\n borderRadius: theme.vars.shape.borderRadiusSecondary,\n textTransform: 'none',\n fontSize: 16,\n fontWeight: 600,\n '&.Mui-disabled, &.Mui-disabled:hover': {\n color: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 56%, transparent)`,\n cursor: 'not-allowed',\n pointerEvents: 'auto',\n },\n [`&.${buttonClasses.loading}.Mui-disabled`]: {\n backgroundColor: theme.vars.palette.primary.main,\n color: theme.palette.getContrastText(theme.palette.primary.main),\n cursor: 'auto',\n pointerEvents: 'auto',\n },\n [`.${buttonClasses.loadingIndicator}`]: {\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n [`&.${buttonClasses.root}.${buttonClasses.loading}`]: {\n color: 'transparent',\n },\n ...getStyleOverrides('MuiButton', 'root', widgetTheme, ownerState),\n }),\n text: ({ theme, ownerState }) => ({\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 8%, transparent)`,\n color: theme.vars.palette.primary.main,\n '&:hover': {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 12%, transparent)`,\n },\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 42%, transparent)`,\n color: theme.palette.getContrastText(\n alpha(theme.palette.primary.main, 0.08)\n ),\n '&:hover': {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.primary.main} 56%, transparent)`,\n },\n }),\n ...getStyleOverrides('MuiButton', 'text', widgetTheme, ownerState),\n }),\n contained: ({ ownerState }) => ({\n '&:hover': {\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n ...getStyleOverrides(\n 'MuiButton',\n 'contained',\n widgetTheme,\n ownerState\n ),\n }),\n sizeMedium: ({ ownerState }) => ({\n padding: '10px 14px',\n ...getStyleOverrides(\n 'MuiButton',\n 'sizeMedium',\n widgetTheme,\n ownerState\n ),\n }),\n },\n },\n MuiIconButton: {\n ...widgetTheme.components?.MuiIconButton,\n styleOverrides: {\n ...widgetTheme.components?.MuiIconButton?.styleOverrides,\n root: ({ ownerState }) => ({\n color: 'inherit',\n '&:hover': {\n color: 'inherit',\n },\n ...getStyleOverrides(\n 'MuiIconButton',\n 'root',\n widgetTheme,\n ownerState\n ),\n }),\n },\n },\n MuiAvatar: {\n styleOverrides: {\n root: {\n height: 40,\n width: 40,\n },\n img: {\n objectFit: 'contain',\n },\n },\n ...widgetTheme.components?.MuiAvatar,\n },\n MuiListItemText: {\n styleOverrides: {\n primary: ({ theme }) => ({\n fontWeight: 600,\n fontSize: '1.125rem',\n lineHeight: '1.2778',\n color: theme.vars.palette.text.primary,\n }),\n secondary: ({ theme }) => ({\n fontWeight: 500,\n fontSize: '0.75rem',\n color: theme.vars.palette.text.secondary,\n }),\n },\n },\n MuiTooltip: {\n defaultProps: {\n enterDelay: 400,\n disableInteractive: true,\n arrow: true,\n placement: 'top',\n },\n styleOverrides: {\n tooltip: ({ theme }) => ({\n backgroundColor: 'rgb(0 0 0 / 64%)',\n backdropFilter: 'blur(3px)',\n fontSize: '0.75rem',\n padding: theme.spacing(1, 1.5),\n }),\n arrow: {\n color: 'rgb(0 0 0 / 64%)',\n },\n },\n },\n MuiMenu: {\n styleOverrides: {\n paper: ({ theme }) => ({\n backgroundColor: theme.vars.palette.background.paper,\n backgroundImage: 'none',\n }),\n },\n },\n MuiDrawer: {\n styleOverrides: {\n paper: {\n backgroundImage: 'none',\n },\n },\n },\n MuiPaper: {\n styleOverrides: {\n root: {\n backgroundImage: 'none',\n },\n },\n },\n MuiTabs: {\n ...widgetTheme.components?.MuiTabs,\n styleOverrides: {\n ...widgetTheme.components?.MuiTabs?.styleOverrides,\n root: ({ theme, ownerState }) => {\n const rootStyleOverrides = getStyleOverrides(\n 'MuiTabs',\n 'root',\n widgetTheme,\n ownerState\n )\n return {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,\n }),\n borderRadius: theme.vars.shape.borderRadius,\n ...rootStyleOverrides,\n [`.${tabsClasses.indicator}`]: {\n backgroundColor: theme.vars.palette.background.paper,\n ...theme.applyStyles('dark', {\n backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.background} 56%, transparent)`,\n }),\n borderRadius:\n theme.shape.borderRadius > 0\n ? `calc(${theme.vars.shape.borderRadius} - 4px)`\n : theme.vars.shape.borderRadius,\n boxShadow: `0px 2px 4px color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,\n ...rootStyleOverrides?.[`.${tabsClasses.indicator}`],\n },\n }\n },\n },\n },\n MuiNavigationTabs: {\n ...widgetTheme.components?.MuiNavigationTabs,\n },\n MuiNavigationTab: {\n ...widgetTheme.components?.MuiNavigationTab,\n },\n MuiCheckbox: {\n styleOverrides: {\n root: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n },\n ...widgetTheme.components?.MuiCheckbox,\n },\n },\n })\n\n return theme\n}\n"],"mappings":";;;;AAsBA,MAAM,QAAe;CACnB,cAAc;CACd,uBAAuB;CACvB,sBAAsB;CACvB;AAED,MAAM,gBAAgB,SAAS;;;;;;;;;;AAW/B,MAAaA,iBAAe,cAA2B,EAAE,KAAY;CACnE,MAAM,yBAAyB,YAAY,cAAc,OAAO;CAChE,MAAM,wBAAwB,YAAY,cAAc,MAAM;CAE9D,MAAM,yBACH,wBAAwB,UAAuC,QAChE,QAAQ,QAAQ;CAClB,MAAM,wBACH,uBAAuB,UAAuC,QAC/D,QAAQ,QAAQ;CAElB,MAAM,2BAA2B,QAAQ,uBAAuB,IAAK;CACrE,MAAM,0BAA0B,OAAO,uBAAuB,GAAI;CAClE,MAAM,0BACJ,0BAA0B,uBACtB,2BACA,QAAQ,sBAAsB,IAAK;CACzC,MAAM,yBACJ,0BAA0B,uBACtB,0BACA,OAAO,sBAAsB,GAAI;CAEvC,MAAM,2BACH,wBAAwB,YAAyC,QAClE,QAAQ,UAA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ACF,cACE,MAAM,MAAM,eAAe,IACvB,QAAQ,MAAM,KAAK,MAAM,aAAa,WACtC,MAAM,KAAK,MAAM;QACvB,WAAW,kCAAkC,MAAM,KAAK,QAAQ,OAAO,aAAa;QACpF,GAAG,qBAAqB,IAAI,YAAY;QACzC;OACF;;KAEJ;IACF;GACD,mBAAmB,EACjB,GAAG,YAAY,YAAY,mBAC5B;GACD,kBAAkB,EAChB,GAAG,YAAY,YAAY,kBAC5B;GACD,aAAa;IACX,gBAAgB,EACd,MAAM,EACJ,WAAW,EACT,iBAAiB,eAClB,EACF,EACF;IACD,GAAG,YAAY,YAAY;IAC5B;GACF;EACF,CAAC;CAEF,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/themes/utils.ts"],"sourcesContent":["import type { WidgetTheme, WidgetThemeComponents } from '../types/widget.js'\n\ntype ComponentName = keyof WidgetThemeComponents\n\nexport const getStyleOverrides = (\n componentName: ComponentName,\n styleOverrideProp: string,\n theme: WidgetTheme,\n ownerState?: any\n): any => {\n const component = theme.components?.[componentName]\n const property = (component?.styleOverrides as any)?.[styleOverrideProp]\n\n if (typeof property === 'function') {\n return property({ theme, ownerState })\n }\n return property\n}\n"],"mappings":";AAIA,MAAa,qBACX,eACA,mBACA,OACA,eACQ;CAER,MAAM,aADY,MAAM,aAAa,iBACR,kBAAyB;
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/themes/utils.ts"],"sourcesContent":["import type { WidgetTheme, WidgetThemeComponents } from '../types/widget.js'\n\ntype ComponentName = keyof WidgetThemeComponents\n\nexport const getStyleOverrides = (\n componentName: ComponentName,\n styleOverrideProp: string,\n theme: WidgetTheme,\n ownerState?: any\n): any => {\n const component = theme.components?.[componentName]\n const property = (component?.styleOverrides as any)?.[styleOverrideProp]\n\n if (typeof property === 'function') {\n return property({ theme, ownerState })\n }\n return property\n}\n"],"mappings":";AAIA,MAAa,qBACX,eACA,mBACA,OACA,eACQ;CAER,MAAM,aADY,MAAM,aAAa,iBACR,kBAAyB;CAEtD,IAAI,OAAO,aAAa,YACtB,OAAO,SAAS;EAAE;EAAO;EAAY,CAAC;CAExC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../../src/types/events.ts"],"sourcesContent":["import type { ChainId, ChainType, ExecutionAction, Route } from '@lifi/sdk'\nimport type { DefaultValues } from '../stores/form/types.js'\nimport type { SettingsProps } from '../stores/settings/types.js'\nimport type { NavigationRouteType } from '../utils/navigationRoutes.js'\nimport type { TokenAmount } from './token.js'\n\nexport enum WidgetEvent {\n AvailableRoutes = 'availableRoutes',\n ChainPinned = 'chainPinned',\n ContactSupport = 'contactSupport',\n DestinationChainTokenSelected = 'destinationChainTokenSelected',\n FormFieldChanged = 'formFieldChanged',\n LowAddressActivityConfirmed = 'lowAddressActivityConfirmed',\n PageEntered = 'pageEntered',\n RouteExecutionCompleted = 'routeExecutionCompleted',\n RouteExecutionFailed = 'routeExecutionFailed',\n RouteExecutionStarted = 'routeExecutionStarted',\n RouteExecutionUpdated = 'routeExecutionUpdated',\n RouteHighValueLoss = 'routeHighValueLoss',\n RouteSelected = 'routeSelected',\n SendToWalletToggled = 'sendToWalletToggled',\n SettingUpdated = 'settingUpdated',\n SourceChainTokenSelected = 'sourceChainTokenSelected',\n TokenSearch = 'tokenSearch',\n WidgetExpanded = 'widgetExpanded',\n}\n\nexport type WidgetEvents = {\n availableRoutes: Route[]\n chainPinned: ChainPinned\n contactSupport: ContactSupport\n destinationChainTokenSelected: ChainTokenSelected\n formFieldChanged: FormFieldChanged\n lowAddressActivityConfirmed: LowAddressActivityConfirmed\n pageEntered: NavigationRouteType\n routeExecutionCompleted: Route\n routeExecutionFailed: RouteExecutionUpdate\n routeExecutionStarted: Route\n routeExecutionUpdated: RouteExecutionUpdate\n routeHighValueLoss: RouteHighValueLossUpdate\n routeSelected: RouteSelected\n sendToWalletToggled: boolean\n settingUpdated: SettingUpdated\n sourceChainTokenSelected: ChainTokenSelected\n tokenSearch: TokenSearch\n walletConnected: WalletConnected\n widgetExpanded: boolean\n}\n\nexport type ContactSupport = {\n supportId?: string\n}\n\nexport type RouteHighValueLossUpdate = {\n fromAmountUSD: number\n toAmountUSD: number\n gasCostUSD?: number\n feeCostUSD?: number\n valueLoss: number\n}\n\nexport type RouteExecutionUpdate = {\n route: Route\n action: ExecutionAction\n}\n\nexport type RouteSelected = {\n route: Route\n routes: Route[]\n}\n\nexport type TokenSearch = {\n value: string\n tokens: TokenAmount[]\n}\n\nexport type ChainTokenSelected = {\n chainId: ChainId\n tokenAddress: string\n}\n\nexport type WalletConnected = {\n address?: string\n chainId?: number\n chainType?: ChainType\n}\n\nexport type FormFieldChanged = {\n [K in keyof DefaultValues]: {\n fieldName: K\n newValue: DefaultValues[K]\n oldValue: DefaultValues[K]\n }\n}[keyof DefaultValues]\n\nexport type SettingUpdated<\n K extends keyof SettingsProps = keyof SettingsProps,\n> = {\n setting: K\n newValue: SettingsProps[K]\n oldValue: SettingsProps[K]\n newSettings: SettingsProps\n oldSettings: SettingsProps\n}\n\nexport type ChainPinned = {\n chainId: number\n pinned: boolean\n}\n\nexport type LowAddressActivityConfirmed = {\n address: string\n chainId: number\n}\n"],"mappings":";AAMA,IAAY,cAAL,yBAAA,aAAA;
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../../src/types/events.ts"],"sourcesContent":["import type { ChainId, ChainType, ExecutionAction, Route } from '@lifi/sdk'\nimport type { DefaultValues } from '../stores/form/types.js'\nimport type { SettingsProps } from '../stores/settings/types.js'\nimport type { NavigationRouteType } from '../utils/navigationRoutes.js'\nimport type { TokenAmount } from './token.js'\n\nexport enum WidgetEvent {\n AvailableRoutes = 'availableRoutes',\n ChainPinned = 'chainPinned',\n ContactSupport = 'contactSupport',\n DestinationChainTokenSelected = 'destinationChainTokenSelected',\n FormFieldChanged = 'formFieldChanged',\n LowAddressActivityConfirmed = 'lowAddressActivityConfirmed',\n PageEntered = 'pageEntered',\n RouteExecutionCompleted = 'routeExecutionCompleted',\n RouteExecutionFailed = 'routeExecutionFailed',\n RouteExecutionStarted = 'routeExecutionStarted',\n RouteExecutionUpdated = 'routeExecutionUpdated',\n RouteHighValueLoss = 'routeHighValueLoss',\n RouteSelected = 'routeSelected',\n SendToWalletToggled = 'sendToWalletToggled',\n SettingUpdated = 'settingUpdated',\n SourceChainTokenSelected = 'sourceChainTokenSelected',\n TokenSearch = 'tokenSearch',\n WidgetExpanded = 'widgetExpanded',\n}\n\nexport type WidgetEvents = {\n availableRoutes: Route[]\n chainPinned: ChainPinned\n contactSupport: ContactSupport\n destinationChainTokenSelected: ChainTokenSelected\n formFieldChanged: FormFieldChanged\n lowAddressActivityConfirmed: LowAddressActivityConfirmed\n pageEntered: NavigationRouteType\n routeExecutionCompleted: Route\n routeExecutionFailed: RouteExecutionUpdate\n routeExecutionStarted: Route\n routeExecutionUpdated: RouteExecutionUpdate\n routeHighValueLoss: RouteHighValueLossUpdate\n routeSelected: RouteSelected\n sendToWalletToggled: boolean\n settingUpdated: SettingUpdated\n sourceChainTokenSelected: ChainTokenSelected\n tokenSearch: TokenSearch\n walletConnected: WalletConnected\n widgetExpanded: boolean\n}\n\nexport type ContactSupport = {\n supportId?: string\n}\n\nexport type RouteHighValueLossUpdate = {\n fromAmountUSD: number\n toAmountUSD: number\n gasCostUSD?: number\n feeCostUSD?: number\n valueLoss: number\n}\n\nexport type RouteExecutionUpdate = {\n route: Route\n action: ExecutionAction\n}\n\nexport type RouteSelected = {\n route: Route\n routes: Route[]\n}\n\nexport type TokenSearch = {\n value: string\n tokens: TokenAmount[]\n}\n\nexport type ChainTokenSelected = {\n chainId: ChainId\n tokenAddress: string\n}\n\nexport type WalletConnected = {\n address?: string\n chainId?: number\n chainType?: ChainType\n}\n\nexport type FormFieldChanged = {\n [K in keyof DefaultValues]: {\n fieldName: K\n newValue: DefaultValues[K]\n oldValue: DefaultValues[K]\n }\n}[keyof DefaultValues]\n\nexport type SettingUpdated<\n K extends keyof SettingsProps = keyof SettingsProps,\n> = {\n setting: K\n newValue: SettingsProps[K]\n oldValue: SettingsProps[K]\n newSettings: SettingsProps\n oldSettings: SettingsProps\n}\n\nexport type ChainPinned = {\n chainId: number\n pinned: boolean\n}\n\nexport type LowAddressActivityConfirmed = {\n address: string\n chainId: number\n}\n"],"mappings":";AAMA,IAAY,cAAL,yBAAA,aAAA;CACL,YAAA,qBAAA;CACA,YAAA,iBAAA;CACA,YAAA,oBAAA;CACA,YAAA,mCAAA;CACA,YAAA,sBAAA;CACA,YAAA,iCAAA;CACA,YAAA,iBAAA;CACA,YAAA,6BAAA;CACA,YAAA,0BAAA;CACA,YAAA,2BAAA;CACA,YAAA,2BAAA;CACA,YAAA,wBAAA;CACA,YAAA,mBAAA;CACA,YAAA,yBAAA;CACA,YAAA,oBAAA;CACA,YAAA,8BAAA;CACA,YAAA,iBAAA;CACA,YAAA,oBAAA;;KACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","names":[],"sources":["../../../src/types/widget.ts"],"sourcesContent":["import type {\n BaseToken,\n ChainType,\n ContractCall,\n ExecutionOptions,\n ExtendedChain,\n Order,\n RouteExtended,\n RouteOptions,\n SDKConfig,\n StaticToken,\n Token,\n} from '@lifi/sdk'\nimport type { WalletMenuOpenArgs } from '@lifi/wallet-management'\nimport type { WidgetProviderProps } from '@lifi/widget-provider'\nimport type {\n Components,\n PaletteMode,\n PaletteOptions,\n Shape,\n SxProps,\n Theme,\n} from '@mui/material'\nimport type { TypographyVariantsOptions } from '@mui/material/styles'\nimport type {\n CSSProperties,\n FC,\n PropsWithChildren,\n ReactNode,\n RefObject,\n} from 'react'\nimport type {\n LanguageKey,\n LanguageResources,\n} from '../providers/I18nProvider/types.js'\nimport type { DefaultFieldValues } from '../stores/form/types.js'\n\nexport type WidgetVariant = 'compact' | 'wide' | 'drawer'\nexport type WidgetSubvariant = 'default' | 'split' | 'custom' | 'refuel'\nexport type SplitSubvariant = 'bridge' | 'swap'\nexport type SplitSubvariantOptions = {\n defaultTab: SplitSubvariant\n}\nexport type CustomSubvariant = 'checkout' | 'deposit'\nexport type WideSubvariant = {\n disableChainSidebar?: boolean\n}\nexport interface SubvariantOptions {\n /**\n * Configure split subvariant behavior:\n * - 'bridge' | 'swap': Single mode without tabs\n * - { defaultTab: 'bridge' | 'swap' }: Tabs mode with configurable default tab\n */\n split?: SplitSubvariant | SplitSubvariantOptions\n custom?: CustomSubvariant\n wide?: WideSubvariant\n}\n\nexport type Appearance = PaletteMode | 'system'\nexport interface NavigationProps {\n /**\n * If given, uses a negative margin to counteract the padding on sides for navigation elements like icon buttons.\n * @default true\n */\n edge?: boolean\n}\nexport type WidgetThemeComponents = Partial<\n Pick<\n Components<Theme>,\n | 'MuiAppBar'\n | 'MuiAvatar'\n | 'MuiButton'\n | 'MuiCard'\n | 'MuiIconButton'\n | 'MuiInputCard'\n | 'MuiNavigationTabs'\n | 'MuiNavigationTab'\n | 'MuiTabs'\n | 'MuiCheckbox'\n >\n>\n\nexport type WidgetTheme = {\n colorSchemes?: {\n light?: {\n palette: PaletteOptions\n }\n dark?: {\n palette: PaletteOptions\n }\n }\n shape?: Partial<Shape>\n typography?: TypographyVariantsOptions\n components?: WidgetThemeComponents\n container?: CSSProperties\n routesContainer?: CSSProperties\n chainSidebarContainer?: CSSProperties\n header?: CSSProperties\n navigation?: NavigationProps\n}\n\nexport enum DisabledUI {\n FromAmount = 'fromAmount',\n FromToken = 'fromToken',\n ToAddress = 'toAddress',\n ToToken = 'toToken',\n}\nexport type DisabledUIType = `${DisabledUI}`\n\nexport enum HiddenUI {\n Appearance = 'appearance',\n DrawerCloseButton = 'drawerCloseButton',\n History = 'history',\n Language = 'language',\n PoweredBy = 'poweredBy',\n ToAddress = 'toAddress',\n FromToken = 'fromToken',\n ToToken = 'toToken',\n WalletMenu = 'walletMenu',\n IntegratorStepDetails = 'integratorStepDetails',\n ReverseTokensButton = 'reverseTokensButton',\n RouteTokenDescription = 'routeTokenDescription',\n RouteCardPriceImpact = 'routeCardPriceImpact',\n ChainSelect = 'chainSelect',\n BridgesSettings = 'bridgesSettings',\n AddressBookConnectedWallets = 'addressBookConnectedWallets',\n LowAddressActivityConfirmation = 'lowAddressActivityConfirmation',\n GasRefuelMessage = 'gasRefuelMessage',\n SearchTokenInput = 'searchTokenInput',\n InsufficientGasMessage = 'insufficientGasMessage',\n ContactSupport = 'contactSupport',\n HideSmallBalances = 'hideSmallBalances',\n AllNetworks = 'allNetworks',\n}\nexport type HiddenUIType = `${HiddenUI}`\n\nexport enum RequiredUI {\n ToAddress = 'toAddress',\n AccountDeployedMessage = 'accountDeployedMessage',\n}\nexport type RequiredUIType = `${RequiredUI}`\n\nexport type DefaultUI = {\n transactionDetailsExpanded?: boolean\n navigationHeaderTitleNoWrap?: boolean\n}\n\nexport interface WidgetWalletConfig {\n walletEcosystemsOrder?: Record<string, ChainType[]>\n onConnect?(args?: WalletMenuOpenArgs): void\n /**\n * Determines whether the widget should provide partial wallet management functionality.\n *\n * In partial mode, external wallet management will be used for \"opt-out\" providers,\n * while the internal management is applied for any remaining providers that do not opt out.\n * This allows a flexible balance between the integrator's custom wallet menu and the widget's native wallet menu.\n * @default false\n */\n usePartialWalletManagement?: boolean\n /**\n * This option forces the widget to always use internal wallet management ignoring external wallet management contexts\n * @default false\n */\n forceInternalWalletManagement?: boolean\n}\n\nexport interface WidgetSDKConfig\n extends Omit<\n SDKConfig,\n | 'apiKey'\n | 'disableVersionCheck'\n | 'integrator'\n | 'providers'\n | 'routeOptions'\n | 'widgetVersion'\n > {\n routeOptions?: Omit<RouteOptions, 'bridges' | 'exchanges'>\n executionOptions?: Pick<ExecutionOptions, 'updateTransactionRequestHook'>\n}\n\nexport interface WidgetContractTool {\n name: string\n logoURI: string\n}\n\nexport interface CalculateFeeParams {\n fromChain: ExtendedChain\n toChain: ExtendedChain\n fromToken: Token\n toToken: Token\n fromAddress?: string\n toAddress?: string\n fromAmount?: bigint\n toAmount?: bigint\n slippage?: number\n}\n\nexport interface WidgetFeeConfig {\n name?: string\n logoURI?: string\n fee?: number\n /**\n * Whether to show the fee percentage in the fee details.\n * @default false\n */\n showFeePercentage?: boolean\n /**\n * Whether to show a tooltip with the fee details. Requires `name` or `feeTooltipComponent` to be set.\n * @default false\n */\n showFeeTooltip?: boolean\n /**\n * Custom tooltip component to show with the fee details.\n */\n feeTooltipComponent?: ReactNode\n /**\n * Function to calculate fees before fetching quotes.\n * If provided, this function will be used instead of the `fee` parameter.\n * Only one of `fee` or `calculateFee` should be used.\n *\n * @param params Object containing the fee calculation parameters\n * @returns A promise that resolves to the calculated fee as a number (e.g., 0.03 represents a 3% fee)\n */\n calculateFee?(params: CalculateFeeParams): Promise<number | undefined>\n /**\n * @internal\n */\n _vcComponent?: FC<{ route: RouteExtended }>\n}\n\nexport interface ToAddress {\n name?: string\n address: string\n chainType: ChainType\n logoURI?: string\n}\n\nexport interface AllowDeny<T> {\n allow?: T[]\n deny?: T[]\n}\n\nexport type AllowDenySetItem = string | number\nexport interface AllowDenySet {\n allow?: Set<AllowDenySetItem>\n deny?: Set<AllowDenySetItem>\n}\n\nexport type AllowDenySets = {\n from?: AllowDenySet\n to?: AllowDenySet\n} & AllowDenySet\n\nexport type AllowDenyItems<T> = {\n from?: AllowDeny<T>\n to?: AllowDeny<T>\n} & AllowDeny<T>\n\nexport type WidgetChains = {\n types?: AllowDeny<ChainType>\n} & AllowDenyItems<number>\n\nexport type WidgetTokens = {\n featured?: StaticToken[]\n include?: Token[]\n popular?: StaticToken[]\n} & AllowDenyItems<BaseToken>\n\nexport type WidgetLanguages = {\n default?: LanguageKey\n} & AllowDeny<LanguageKey>\n\nexport type PoweredByType = 'default' | 'jumper'\n\nexport interface RouteLabel {\n text: string\n sx?: SxProps<Theme>\n}\n\nexport interface RouteLabelRule {\n label: RouteLabel\n // Matching criteria\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n fromChainId?: number[]\n toChainId?: number[]\n fromTokenAddress?: string[]\n toTokenAddress?: string[]\n}\n\nexport type ExplorerUrl =\n | string\n | {\n url: string\n txPath?: string\n addressPath?: string\n }\n\nexport type WidgetProvider = (\n props: PropsWithChildren<WidgetProviderProps>\n) => ReactNode\n\nexport interface WidgetConfig {\n fromChain?: number\n toChain?: number\n fromToken?: string\n toToken?: string\n toAddress?: ToAddress\n toAddresses?: ToAddress[]\n fromAmount?: number | string\n minFromAmountUSD?: number\n toAmount?: number | string\n formUpdateKey?: string\n\n providers?: WidgetProvider[]\n\n contractCalls?: ContractCall[]\n contractComponent?: ReactNode\n contractSecondaryComponent?: ReactNode\n contractCompactComponent?: ReactNode\n contractTool?: WidgetContractTool\n integrator: string\n apiKey?: string\n fee?: number\n feeConfig?: WidgetFeeConfig\n referrer?: string\n\n routePriority?: Order\n slippage?: number\n\n variant?: WidgetVariant\n subvariant?: WidgetSubvariant\n subvariantOptions?: SubvariantOptions\n\n appearance?: Appearance\n theme?: WidgetTheme\n\n disabledUI?: DisabledUIType[]\n hiddenUI?: HiddenUIType[]\n requiredUI?: RequiredUIType[]\n defaultUI?: DefaultUI\n useRecommendedRoute?: boolean\n useRelayerRoutes?: boolean\n\n walletConfig?: WidgetWalletConfig\n sdkConfig?: WidgetSDKConfig\n\n buildUrl?: boolean\n keyPrefix?: string\n\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n chains?: WidgetChains\n tokens?: WidgetTokens\n languages?: WidgetLanguages\n languageResources?: LanguageResources\n explorerUrls?: Record<number, ExplorerUrl[]> &\n Partial<Record<'internal', ExplorerUrl[]>>\n poweredBy?: PoweredByType\n\n /**\n * Custom labels/badges to show on routes based on specified rules\n */\n routeLabels?: RouteLabelRule[]\n}\n\nexport interface FormFieldOptions {\n setUrlSearchParam: boolean\n}\n\nexport interface FieldValues\n extends Omit<DefaultFieldValues, 'fromAmount' | 'toAmount' | 'toAddress'> {\n fromAmount?: number | string\n toAmount?: number | string\n toAddress?: ToAddress | string\n}\n\nexport type FieldNames = keyof FieldValues\n\nexport type SetFieldValueFunction = <K extends FieldNames>(\n key: K,\n value: FieldValues[K],\n options?: FormFieldOptions\n) => void\n\nexport type FormState = {\n setFieldValue: SetFieldValueFunction\n}\n\nexport type FormRef = RefObject<FormState | null>\n\nexport interface FormRefProps {\n formRef?: FormRef\n}\n\nexport interface WidgetConfigProps extends FormRefProps {\n config: WidgetConfig\n}\n\nexport interface WidgetConfigPartialProps {\n config?: Partial<WidgetConfig>\n}\n\nexport type WidgetProps = WidgetDrawerProps &\n WidgetConfig &\n WidgetConfigPartialProps &\n FormRefProps\n\nexport interface WidgetDrawerProps extends WidgetConfigPartialProps {\n elementRef?: RefObject<HTMLDivElement>\n open?: boolean\n /**\n * Make sure to make the onClose callback stable (e.g. using useCallback) to avoid causing re-renders of the entire widget\n */\n onClose?(): void\n}\n\nexport enum ExpansionType {\n Routes = 'routes',\n FromChain = 'fromChain',\n ToChain = 'toChain',\n}\n"],"mappings":";AAqGA,IAAY,aAAL,yBAAA,YAAA;AACL,YAAA,gBAAA;AACA,YAAA,eAAA;AACA,YAAA,eAAA;AACA,YAAA,aAAA;;KACD;AAGD,IAAY,WAAL,yBAAA,UAAA;AACL,UAAA,gBAAA;AACA,UAAA,uBAAA;AACA,UAAA,aAAA;AACA,UAAA,cAAA;AACA,UAAA,eAAA;AACA,UAAA,eAAA;AACA,UAAA,eAAA;AACA,UAAA,aAAA;AACA,UAAA,gBAAA;AACA,UAAA,2BAAA;AACA,UAAA,yBAAA;AACA,UAAA,2BAAA;AACA,UAAA,0BAAA;AACA,UAAA,iBAAA;AACA,UAAA,qBAAA;AACA,UAAA,iCAAA;AACA,UAAA,oCAAA;AACA,UAAA,sBAAA;AACA,UAAA,sBAAA;AACA,UAAA,4BAAA;AACA,UAAA,oBAAA;AACA,UAAA,uBAAA;AACA,UAAA,iBAAA;;KACD;AAGD,IAAY,aAAL,yBAAA,YAAA;AACL,YAAA,eAAA;AACA,YAAA,4BAAA;;KACD;AAsRD,IAAY,gBAAL,yBAAA,eAAA;AACL,eAAA,YAAA;AACA,eAAA,eAAA;AACA,eAAA,aAAA;;KACD"}
|
|
1
|
+
{"version":3,"file":"widget.js","names":[],"sources":["../../../src/types/widget.ts"],"sourcesContent":["import type {\n BaseToken,\n ChainType,\n ContractCall,\n ExecutionOptions,\n ExtendedChain,\n Order,\n RouteExtended,\n RouteOptions,\n SDKConfig,\n StaticToken,\n Token,\n} from '@lifi/sdk'\nimport type { WalletMenuOpenArgs } from '@lifi/wallet-management'\nimport type { WidgetProviderProps } from '@lifi/widget-provider'\nimport type {\n Components,\n PaletteMode,\n PaletteOptions,\n Shape,\n SxProps,\n Theme,\n} from '@mui/material'\nimport type { TypographyVariantsOptions } from '@mui/material/styles'\nimport type {\n CSSProperties,\n FC,\n PropsWithChildren,\n ReactNode,\n RefObject,\n} from 'react'\nimport type {\n LanguageKey,\n LanguageResources,\n} from '../providers/I18nProvider/types.js'\nimport type { DefaultFieldValues } from '../stores/form/types.js'\n\nexport type WidgetVariant = 'compact' | 'wide' | 'drawer'\nexport type WidgetSubvariant = 'default' | 'split' | 'custom' | 'refuel'\nexport type SplitSubvariant = 'bridge' | 'swap'\nexport type SplitSubvariantOptions = {\n defaultTab: SplitSubvariant\n}\nexport type CustomSubvariant = 'checkout' | 'deposit'\nexport type WideSubvariant = {\n disableChainSidebar?: boolean\n}\nexport interface SubvariantOptions {\n /**\n * Configure split subvariant behavior:\n * - 'bridge' | 'swap': Single mode without tabs\n * - { defaultTab: 'bridge' | 'swap' }: Tabs mode with configurable default tab\n */\n split?: SplitSubvariant | SplitSubvariantOptions\n custom?: CustomSubvariant\n wide?: WideSubvariant\n}\n\nexport type Appearance = PaletteMode | 'system'\nexport interface NavigationProps {\n /**\n * If given, uses a negative margin to counteract the padding on sides for navigation elements like icon buttons.\n * @default true\n */\n edge?: boolean\n}\nexport type WidgetThemeComponents = Partial<\n Pick<\n Components<Theme>,\n | 'MuiAppBar'\n | 'MuiAvatar'\n | 'MuiButton'\n | 'MuiCard'\n | 'MuiIconButton'\n | 'MuiInputCard'\n | 'MuiNavigationTabs'\n | 'MuiNavigationTab'\n | 'MuiTabs'\n | 'MuiCheckbox'\n >\n>\n\nexport type WidgetTheme = {\n colorSchemes?: {\n light?: {\n palette: PaletteOptions\n }\n dark?: {\n palette: PaletteOptions\n }\n }\n shape?: Partial<Shape>\n typography?: TypographyVariantsOptions\n components?: WidgetThemeComponents\n container?: CSSProperties\n routesContainer?: CSSProperties\n chainSidebarContainer?: CSSProperties\n header?: CSSProperties\n navigation?: NavigationProps\n}\n\nexport enum DisabledUI {\n FromAmount = 'fromAmount',\n FromToken = 'fromToken',\n ToAddress = 'toAddress',\n ToToken = 'toToken',\n}\nexport type DisabledUIType = `${DisabledUI}`\n\nexport enum HiddenUI {\n Appearance = 'appearance',\n DrawerCloseButton = 'drawerCloseButton',\n History = 'history',\n Language = 'language',\n PoweredBy = 'poweredBy',\n ToAddress = 'toAddress',\n FromToken = 'fromToken',\n ToToken = 'toToken',\n WalletMenu = 'walletMenu',\n IntegratorStepDetails = 'integratorStepDetails',\n ReverseTokensButton = 'reverseTokensButton',\n RouteTokenDescription = 'routeTokenDescription',\n RouteCardPriceImpact = 'routeCardPriceImpact',\n ChainSelect = 'chainSelect',\n BridgesSettings = 'bridgesSettings',\n AddressBookConnectedWallets = 'addressBookConnectedWallets',\n LowAddressActivityConfirmation = 'lowAddressActivityConfirmation',\n GasRefuelMessage = 'gasRefuelMessage',\n SearchTokenInput = 'searchTokenInput',\n InsufficientGasMessage = 'insufficientGasMessage',\n ContactSupport = 'contactSupport',\n HideSmallBalances = 'hideSmallBalances',\n AllNetworks = 'allNetworks',\n}\nexport type HiddenUIType = `${HiddenUI}`\n\nexport enum RequiredUI {\n ToAddress = 'toAddress',\n AccountDeployedMessage = 'accountDeployedMessage',\n}\nexport type RequiredUIType = `${RequiredUI}`\n\nexport type DefaultUI = {\n transactionDetailsExpanded?: boolean\n navigationHeaderTitleNoWrap?: boolean\n}\n\nexport interface WidgetWalletConfig {\n walletEcosystemsOrder?: Record<string, ChainType[]>\n onConnect?(args?: WalletMenuOpenArgs): void\n /**\n * Determines whether the widget should provide partial wallet management functionality.\n *\n * In partial mode, external wallet management will be used for \"opt-out\" providers,\n * while the internal management is applied for any remaining providers that do not opt out.\n * This allows a flexible balance between the integrator's custom wallet menu and the widget's native wallet menu.\n * @default false\n */\n usePartialWalletManagement?: boolean\n /**\n * This option forces the widget to always use internal wallet management ignoring external wallet management contexts\n * @default false\n */\n forceInternalWalletManagement?: boolean\n}\n\nexport interface WidgetSDKConfig\n extends Omit<\n SDKConfig,\n | 'apiKey'\n | 'disableVersionCheck'\n | 'integrator'\n | 'providers'\n | 'routeOptions'\n | 'widgetVersion'\n > {\n routeOptions?: Omit<RouteOptions, 'bridges' | 'exchanges'>\n executionOptions?: Pick<ExecutionOptions, 'updateTransactionRequestHook'>\n}\n\nexport interface WidgetContractTool {\n name: string\n logoURI: string\n}\n\nexport interface CalculateFeeParams {\n fromChain: ExtendedChain\n toChain: ExtendedChain\n fromToken: Token\n toToken: Token\n fromAddress?: string\n toAddress?: string\n fromAmount?: bigint\n toAmount?: bigint\n slippage?: number\n}\n\nexport interface WidgetFeeConfig {\n name?: string\n logoURI?: string\n fee?: number\n /**\n * Whether to show the fee percentage in the fee details.\n * @default false\n */\n showFeePercentage?: boolean\n /**\n * Whether to show a tooltip with the fee details. Requires `name` or `feeTooltipComponent` to be set.\n * @default false\n */\n showFeeTooltip?: boolean\n /**\n * Custom tooltip component to show with the fee details.\n */\n feeTooltipComponent?: ReactNode\n /**\n * Function to calculate fees before fetching quotes.\n * If provided, this function will be used instead of the `fee` parameter.\n * Only one of `fee` or `calculateFee` should be used.\n *\n * @param params Object containing the fee calculation parameters\n * @returns A promise that resolves to the calculated fee as a number (e.g., 0.03 represents a 3% fee)\n */\n calculateFee?(params: CalculateFeeParams): Promise<number | undefined>\n /**\n * @internal\n */\n _vcComponent?: FC<{ route: RouteExtended }>\n}\n\nexport interface ToAddress {\n name?: string\n address: string\n chainType: ChainType\n logoURI?: string\n}\n\nexport interface AllowDeny<T> {\n allow?: T[]\n deny?: T[]\n}\n\nexport type AllowDenySetItem = string | number\nexport interface AllowDenySet {\n allow?: Set<AllowDenySetItem>\n deny?: Set<AllowDenySetItem>\n}\n\nexport type AllowDenySets = {\n from?: AllowDenySet\n to?: AllowDenySet\n} & AllowDenySet\n\nexport type AllowDenyItems<T> = {\n from?: AllowDeny<T>\n to?: AllowDeny<T>\n} & AllowDeny<T>\n\nexport type WidgetChains = {\n types?: AllowDeny<ChainType>\n} & AllowDenyItems<number>\n\nexport type WidgetTokens = {\n featured?: StaticToken[]\n include?: Token[]\n popular?: StaticToken[]\n} & AllowDenyItems<BaseToken>\n\nexport type WidgetLanguages = {\n default?: LanguageKey\n} & AllowDeny<LanguageKey>\n\nexport type PoweredByType = 'default' | 'jumper'\n\nexport interface RouteLabel {\n text: string\n sx?: SxProps<Theme>\n}\n\nexport interface RouteLabelRule {\n label: RouteLabel\n // Matching criteria\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n fromChainId?: number[]\n toChainId?: number[]\n fromTokenAddress?: string[]\n toTokenAddress?: string[]\n}\n\nexport type ExplorerUrl =\n | string\n | {\n url: string\n txPath?: string\n addressPath?: string\n }\n\nexport type WidgetProvider = (\n props: PropsWithChildren<WidgetProviderProps>\n) => ReactNode\n\nexport interface WidgetConfig {\n fromChain?: number\n toChain?: number\n fromToken?: string\n toToken?: string\n toAddress?: ToAddress\n toAddresses?: ToAddress[]\n fromAmount?: number | string\n minFromAmountUSD?: number\n toAmount?: number | string\n formUpdateKey?: string\n\n providers?: WidgetProvider[]\n\n contractCalls?: ContractCall[]\n contractComponent?: ReactNode\n contractSecondaryComponent?: ReactNode\n contractCompactComponent?: ReactNode\n contractTool?: WidgetContractTool\n integrator: string\n apiKey?: string\n fee?: number\n feeConfig?: WidgetFeeConfig\n referrer?: string\n\n routePriority?: Order\n slippage?: number\n\n variant?: WidgetVariant\n subvariant?: WidgetSubvariant\n subvariantOptions?: SubvariantOptions\n\n appearance?: Appearance\n theme?: WidgetTheme\n\n disabledUI?: DisabledUIType[]\n hiddenUI?: HiddenUIType[]\n requiredUI?: RequiredUIType[]\n defaultUI?: DefaultUI\n useRecommendedRoute?: boolean\n useRelayerRoutes?: boolean\n\n walletConfig?: WidgetWalletConfig\n sdkConfig?: WidgetSDKConfig\n\n buildUrl?: boolean\n keyPrefix?: string\n\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n chains?: WidgetChains\n tokens?: WidgetTokens\n languages?: WidgetLanguages\n languageResources?: LanguageResources\n explorerUrls?: Record<number, ExplorerUrl[]> &\n Partial<Record<'internal', ExplorerUrl[]>>\n poweredBy?: PoweredByType\n\n /**\n * Custom labels/badges to show on routes based on specified rules\n */\n routeLabels?: RouteLabelRule[]\n}\n\nexport interface FormFieldOptions {\n setUrlSearchParam: boolean\n}\n\nexport interface FieldValues\n extends Omit<DefaultFieldValues, 'fromAmount' | 'toAmount' | 'toAddress'> {\n fromAmount?: number | string\n toAmount?: number | string\n toAddress?: ToAddress | string\n}\n\nexport type FieldNames = keyof FieldValues\n\nexport type SetFieldValueFunction = <K extends FieldNames>(\n key: K,\n value: FieldValues[K],\n options?: FormFieldOptions\n) => void\n\nexport type FormState = {\n setFieldValue: SetFieldValueFunction\n}\n\nexport type FormRef = RefObject<FormState | null>\n\nexport interface FormRefProps {\n formRef?: FormRef\n}\n\nexport interface WidgetConfigProps extends FormRefProps {\n config: WidgetConfig\n}\n\nexport interface WidgetConfigPartialProps {\n config?: Partial<WidgetConfig>\n}\n\nexport type WidgetProps = WidgetDrawerProps &\n WidgetConfig &\n WidgetConfigPartialProps &\n FormRefProps\n\nexport interface WidgetDrawerProps extends WidgetConfigPartialProps {\n elementRef?: RefObject<HTMLDivElement>\n open?: boolean\n /**\n * Make sure to make the onClose callback stable (e.g. using useCallback) to avoid causing re-renders of the entire widget\n */\n onClose?(): void\n}\n\nexport enum ExpansionType {\n Routes = 'routes',\n FromChain = 'fromChain',\n ToChain = 'toChain',\n}\n"],"mappings":";AAqGA,IAAY,aAAL,yBAAA,YAAA;CACL,WAAA,gBAAA;CACA,WAAA,eAAA;CACA,WAAA,eAAA;CACA,WAAA,aAAA;;KACD;AAGD,IAAY,WAAL,yBAAA,UAAA;CACL,SAAA,gBAAA;CACA,SAAA,uBAAA;CACA,SAAA,aAAA;CACA,SAAA,cAAA;CACA,SAAA,eAAA;CACA,SAAA,eAAA;CACA,SAAA,eAAA;CACA,SAAA,aAAA;CACA,SAAA,gBAAA;CACA,SAAA,2BAAA;CACA,SAAA,yBAAA;CACA,SAAA,2BAAA;CACA,SAAA,0BAAA;CACA,SAAA,iBAAA;CACA,SAAA,qBAAA;CACA,SAAA,iCAAA;CACA,SAAA,oCAAA;CACA,SAAA,sBAAA;CACA,SAAA,sBAAA;CACA,SAAA,4BAAA;CACA,SAAA,oBAAA;CACA,SAAA,uBAAA;CACA,SAAA,iBAAA;;KACD;AAGD,IAAY,aAAL,yBAAA,YAAA;CACL,WAAA,eAAA;CACA,WAAA,4BAAA;;KACD;AAsRD,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,YAAA;CACA,cAAA,eAAA;CACA,cAAA,aAAA;;KACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactNumberFormatter.js","names":[],"sources":["../../../src/utils/compactNumberFormatter.ts"],"sourcesContent":["/**\n * Converts a non-negative integer to its subscript representation using Unicode subscript characters.\n * @param n - The number to convert to subscript\n * @returns A string where each digit is converted to its subscript equivalent\n * @example\n * toSubscript(5) => '₅'\n * toSubscript(10) => '₁₀'\n */\nfunction toSubscript(n: number): string {\n return n\n .toString()\n .split('')\n .map((digit) => String.fromCharCode(8320 + Number(digit)))\n .join('')\n}\n\n/**\n * Formats numbers with special handling for small decimal values, converting runs of leading zeros\n * into a more compact subscript notation.\n *\n * @param value - The numeric value to format (expected to be a string representing a BigInt)\n * @param lng - The locale string for number formatting\n * @param options - Formatting options including decimals and Intl.NumberFormat options\n * @returns A formatted string with subscript notation for leading zeros\n */\nexport const compactNumberFormatter = (\n lng: string | undefined,\n options: any\n): ((value: any) => string) => {\n const formatter = new Intl.NumberFormat(lng, {\n notation: 'standard',\n roundingPriority: 'morePrecision',\n maximumSignificantDigits: 20,\n maximumFractionDigits: 20,\n ...options,\n })\n return (value: any) => {\n if (!Number.parseFloat(value) || Number.isNaN(Number(value))) {\n return '0'\n }\n\n const parts = formatter.formatToParts(value as Intl.StringNumericLiteral)\n let integerPart = ''\n let fractionPart = ''\n let decimalSeparator = ''\n let minusSign = ''\n\n for (const p of parts) {\n switch (p.type) {\n case 'integer':\n case 'group':\n integerPart += p.value\n break\n case 'fraction':\n fractionPart += p.value\n break\n case 'decimal':\n decimalSeparator = p.value\n break\n case 'minusSign':\n minusSign = p.value\n break\n }\n }\n\n // For numbers with no decimal part, return early\n if (!fractionPart) {\n return `${minusSign}${integerPart}`\n }\n\n // Count consecutive leading zeros in the fraction part\n const match = fractionPart.match(/^0+/)\n const leadingZerosCount = match ? match[0].length : 0\n\n // For numbers with few leading zeros (≤ 3), format normally\n // but limit the total length and trim trailing zeros\n if (leadingZerosCount <= 3) {\n fractionPart = fractionPart.slice(0, 6).replace(/0+$/, '')\n return `${minusSign}${integerPart}${decimalSeparator}${fractionPart}`\n }\n\n // For numbers with many leading zeros (> 3), use subscript notation\n // Format: \"0.0₍number_of_zeros₎significant_digits\"\n const zerosSubscript = toSubscript(leadingZerosCount)\n const remainder = fractionPart\n .slice(leadingZerosCount, leadingZerosCount + 4)\n .replace(/0+$/, '')\n\n return `${minusSign}${integerPart}${decimalSeparator}0${zerosSubscript}${remainder}`\n }\n}\n"],"mappings":";;;;;;;;;AAQA,SAAS,YAAY,GAAmB;
|
|
1
|
+
{"version":3,"file":"compactNumberFormatter.js","names":[],"sources":["../../../src/utils/compactNumberFormatter.ts"],"sourcesContent":["/**\n * Converts a non-negative integer to its subscript representation using Unicode subscript characters.\n * @param n - The number to convert to subscript\n * @returns A string where each digit is converted to its subscript equivalent\n * @example\n * toSubscript(5) => '₅'\n * toSubscript(10) => '₁₀'\n */\nfunction toSubscript(n: number): string {\n return n\n .toString()\n .split('')\n .map((digit) => String.fromCharCode(8320 + Number(digit)))\n .join('')\n}\n\n/**\n * Formats numbers with special handling for small decimal values, converting runs of leading zeros\n * into a more compact subscript notation.\n *\n * @param value - The numeric value to format (expected to be a string representing a BigInt)\n * @param lng - The locale string for number formatting\n * @param options - Formatting options including decimals and Intl.NumberFormat options\n * @returns A formatted string with subscript notation for leading zeros\n */\nexport const compactNumberFormatter = (\n lng: string | undefined,\n options: any\n): ((value: any) => string) => {\n const formatter = new Intl.NumberFormat(lng, {\n notation: 'standard',\n roundingPriority: 'morePrecision',\n maximumSignificantDigits: 20,\n maximumFractionDigits: 20,\n ...options,\n })\n return (value: any) => {\n if (!Number.parseFloat(value) || Number.isNaN(Number(value))) {\n return '0'\n }\n\n const parts = formatter.formatToParts(value as Intl.StringNumericLiteral)\n let integerPart = ''\n let fractionPart = ''\n let decimalSeparator = ''\n let minusSign = ''\n\n for (const p of parts) {\n switch (p.type) {\n case 'integer':\n case 'group':\n integerPart += p.value\n break\n case 'fraction':\n fractionPart += p.value\n break\n case 'decimal':\n decimalSeparator = p.value\n break\n case 'minusSign':\n minusSign = p.value\n break\n }\n }\n\n // For numbers with no decimal part, return early\n if (!fractionPart) {\n return `${minusSign}${integerPart}`\n }\n\n // Count consecutive leading zeros in the fraction part\n const match = fractionPart.match(/^0+/)\n const leadingZerosCount = match ? match[0].length : 0\n\n // For numbers with few leading zeros (≤ 3), format normally\n // but limit the total length and trim trailing zeros\n if (leadingZerosCount <= 3) {\n fractionPart = fractionPart.slice(0, 6).replace(/0+$/, '')\n return `${minusSign}${integerPart}${decimalSeparator}${fractionPart}`\n }\n\n // For numbers with many leading zeros (> 3), use subscript notation\n // Format: \"0.0₍number_of_zeros₎significant_digits\"\n const zerosSubscript = toSubscript(leadingZerosCount)\n const remainder = fractionPart\n .slice(leadingZerosCount, leadingZerosCount + 4)\n .replace(/0+$/, '')\n\n return `${minusSign}${integerPart}${decimalSeparator}0${zerosSubscript}${remainder}`\n }\n}\n"],"mappings":";;;;;;;;;AAQA,SAAS,YAAY,GAAmB;CACtC,OAAO,EACJ,UAAU,CACV,MAAM,GAAG,CACT,KAAK,UAAU,OAAO,aAAa,OAAO,OAAO,MAAM,CAAC,CAAC,CACzD,KAAK,GAAG;;;;;;;;;;;AAYb,MAAa,0BACX,KACA,YAC6B;CAC7B,MAAM,YAAY,IAAI,KAAK,aAAa,KAAK;EAC3C,UAAU;EACV,kBAAkB;EAClB,0BAA0B;EAC1B,uBAAuB;EACvB,GAAG;EACJ,CAAC;CACF,QAAQ,UAAe;EACrB,IAAI,CAAC,OAAO,WAAW,MAAM,IAAI,OAAO,MAAM,OAAO,MAAM,CAAC,EAC1D,OAAO;EAGT,MAAM,QAAQ,UAAU,cAAc,MAAmC;EACzE,IAAI,cAAc;EAClB,IAAI,eAAe;EACnB,IAAI,mBAAmB;EACvB,IAAI,YAAY;EAEhB,KAAK,MAAM,KAAK,OACd,QAAQ,EAAE,MAAV;GACE,KAAK;GACL,KAAK;IACH,eAAe,EAAE;IACjB;GACF,KAAK;IACH,gBAAgB,EAAE;IAClB;GACF,KAAK;IACH,mBAAmB,EAAE;IACrB;GACF,KAAK;IACH,YAAY,EAAE;IACd;;EAKN,IAAI,CAAC,cACH,OAAO,GAAG,YAAY;EAIxB,MAAM,QAAQ,aAAa,MAAM,MAAM;EACvC,MAAM,oBAAoB,QAAQ,MAAM,GAAG,SAAS;EAIpD,IAAI,qBAAqB,GAAG;GAC1B,eAAe,aAAa,MAAM,GAAG,EAAE,CAAC,QAAQ,OAAO,GAAG;GAC1D,OAAO,GAAG,YAAY,cAAc,mBAAmB;;EAKzD,MAAM,iBAAiB,YAAY,kBAAkB;EACrD,MAAM,YAAY,aACf,MAAM,mBAAmB,oBAAoB,EAAE,CAC/C,QAAQ,OAAO,GAAG;EAErB,OAAO,GAAG,YAAY,cAAc,iBAAiB,GAAG,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converters.js","names":[],"sources":["../../../src/utils/converters.ts"],"sourcesContent":["import type {\n ExecutionAction,\n ExecutionActionStatus,\n ExtendedTransactionInfo,\n FeeCost,\n FullStatusData,\n Substatus,\n TokenAmount,\n ToolsResponse,\n} from '@lifi/sdk'\nimport type { RouteExecution } from '../stores/routes/types.js'\nimport { formatTokenPrice } from './format.js'\n\nconst buildActionsFromTxHistory = (tx: FullStatusData): ExecutionAction[] => {\n const sending = tx.sending as ExtendedTransactionInfo\n const receiving = tx.receiving as ExtendedTransactionInfo\n\n if (!sending.token?.chainId || !receiving.token?.chainId) {\n return []\n }\n\n const actionStatus: ExecutionActionStatus =\n tx.status === 'DONE' ? 'DONE' : 'FAILED'\n const substatus: Substatus =\n actionStatus === 'FAILED' ? 'UNKNOWN_ERROR' : 'COMPLETED'\n\n if (sending.chainId === receiving.chainId) {\n return [\n {\n type: 'SWAP', // operations on same chain will be swaps\n message: '',\n status: actionStatus,\n chainId: sending.chainId,\n txHash: sending.txHash,\n txLink: sending.txLink,\n substatus,\n substatusMessage: '',\n },\n ]\n }\n\n const actions: ExecutionAction[] = [\n {\n type: 'CROSS_CHAIN', // first step of bridging, ignoring the approvals\n message: '',\n status: actionStatus, // can be FAILED\n chainId: sending.chainId,\n txHash: sending.txHash,\n txLink: sending.txLink,\n },\n {\n type: 'RECEIVING_CHAIN', // final step of bridging, post swaps\n message: '',\n status: actionStatus,\n substatus,\n substatusMessage: '',\n chainId: receiving.chainId,\n txHash: receiving.txHash,\n txLink: receiving.txLink,\n },\n ]\n\n return actions\n}\n\nexport const buildRouteFromTxHistory = (\n tx: FullStatusData,\n tools?: ToolsResponse\n): RouteExecution | undefined => {\n const sending = tx.sending as ExtendedTransactionInfo\n const receiving = tx.receiving as ExtendedTransactionInfo\n\n if (!sending.token?.chainId || !receiving.token?.chainId) {\n return\n }\n\n let usedTool = tx.sending.includedSteps?.find(\n (step) => step.toolDetails.key === tx.tool\n )?.toolDetails\n\n if (!usedTool) {\n const selectedBridge = tools?.bridges.find(\n (bridge) => bridge.key === tx.tool\n )\n\n const selectedExchange = tools?.exchanges.find(\n (exchange) => exchange.key === tx.tool\n )\n usedTool = {\n key: tx.tool,\n name: selectedBridge?.name ?? selectedExchange?.name ?? tx.tool,\n logoURI: selectedBridge?.logoURI ?? selectedExchange?.logoURI ?? '',\n }\n }\n\n const fromToken: TokenAmount = {\n ...sending.token,\n amount: BigInt(sending.amount ?? 0),\n }\n\n const toToken: TokenAmount = {\n ...receiving.token,\n amount: BigInt(receiving.amount ?? 0),\n }\n\n const sendingValue = sending.value ? BigInt(sending.value) : 0n\n const sendingFeeAmount =\n sending.gasToken.address === sending.token.address && sending.amount\n ? sendingValue - BigInt(sending.amount)\n : sendingValue\n const sendingFeeAmountUsd =\n sending.gasToken.priceUSD && sendingFeeAmount\n ? formatTokenPrice(\n sendingFeeAmount,\n sending.gasToken.priceUSD,\n sending.gasToken.decimals\n )\n : 0\n\n const feeCosts: FeeCost[] | undefined = sendingFeeAmount\n ? [\n {\n amount: sendingFeeAmount.toString(),\n amountUSD: sendingFeeAmountUsd.toFixed(2),\n token: sending.gasToken,\n included: false,\n // Not used\n description: '',\n name: '',\n percentage: '',\n },\n ]\n : undefined\n\n const routeExecution: RouteExecution = {\n status: 1,\n route: {\n id: (tx as FullStatusData).transactionId,\n fromAddress: (tx as FullStatusData).fromAddress,\n toAddress: (tx as FullStatusData).toAddress,\n fromChainId: sending.chainId,\n fromAmount: sending.amount ?? '',\n fromAmountUSD: sending.amountUSD ?? '',\n toAmount: receiving.amount ?? '',\n toAmountMin: receiving.amount ?? '',\n toAmountUSD: receiving.amountUSD ?? '',\n toChainId: receiving.chainId,\n fromToken,\n toToken,\n gasCostUSD: sending.gasAmountUSD,\n steps: [\n {\n id: (tx as FullStatusData).transactionId,\n type: 'lifi',\n tool: tx.tool,\n toolDetails: usedTool,\n action: {\n fromToken: sending.token,\n fromAmount: sending.amount ?? '',\n fromChainId: sending.chainId,\n fromAddress: (tx as FullStatusData).fromAddress,\n toToken: receiving.token,\n toChainId: receiving.chainId,\n toAddress: (tx as FullStatusData).toAddress,\n slippage: 0,\n },\n estimate: {\n tool: tx.tool,\n approvalAddress: '',\n fromAmount: sending.amount ?? '',\n fromAmountUSD: sending.amountUSD ?? '',\n toAmountMin: receiving.amount ?? '',\n toAmount: receiving.amount ?? '',\n toAmountUSD: receiving.amountUSD ?? '',\n executionDuration: 0,\n },\n includedSteps: [\n {\n id: (tx as FullStatusData).transactionId,\n type: sending.chainId === receiving.chainId ? 'swap' : 'cross',\n action: {\n fromChainId: sending.chainId,\n fromAmount: sending.amount ?? '',\n fromToken: sending.token,\n toChainId: receiving.chainId,\n toToken: receiving.token,\n slippage: 0,\n fromAddress: (tx as FullStatusData).fromAddress,\n toAddress: (tx as FullStatusData).toAddress,\n },\n estimate: {\n tool: tx.tool,\n fromAmount: sending.amount ?? '',\n toAmount: receiving.amount ?? '',\n toAmountMin: receiving.amount ?? '',\n approvalAddress: '',\n executionDuration: 0,\n },\n tool: tx.tool,\n toolDetails: usedTool,\n },\n ],\n integrator: tx.metadata?.integrator ?? '',\n execution: {\n status: 'DONE', // can be FAILED\n startedAt: sending.timestamp\n ? sending.timestamp * 1000\n : Date.now(),\n actions: buildActionsFromTxHistory(tx),\n fromAmount: sending.amount,\n toAmount: receiving.amount,\n toToken: receiving.token,\n internalTxLink: tx.lifiExplorerLink,\n externalTxLink: tx.bridgeExplorerLink,\n gasCosts: [\n {\n amount: sending.gasAmount,\n amountUSD: sending.gasAmountUSD,\n token: sending.gasToken,\n estimate: '0',\n limit: '0',\n price: '0',\n type: 'SEND',\n },\n ],\n feeCosts,\n },\n },\n ],\n insurance: {\n state: 'NOT_INSURABLE',\n feeAmountUsd: '0',\n },\n },\n }\n\n return routeExecution\n}\n"],"mappings":";;AA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ACpC,mBAAmB;KACpB;IACD,eAAe,CACb;KACE,IAAK,GAAsB;KAC3B,MAAM,QAAQ,YAAY,UAAU,UAAU,SAAS;KACvD,QAAQ;MACN,aAAa,QAAQ;MACrB,YAAY,QAAQ,UAAU;MAC9B,WAAW,QAAQ;MACnB,WAAW,UAAU;MACrB,SAAS,UAAU;MACnB,UAAU;MACV,aAAc,GAAsB;MACpC,WAAY,GAAsB;MACnC;KACD,UAAU;MACR,MAAM,GAAG;MACT,YAAY,QAAQ,UAAU;MAC9B,UAAU,UAAU,UAAU;MAC9B,aAAa,UAAU,UAAU;MACjC,iBAAiB;MACjB,mBAAmB;MACpB;KACD,MAAM,GAAG;KACT,aAAa;KACd,CACF;IACD,YAAY,GAAG,UAAU,cAAc;IACvC,WAAW;KACT,QAAQ;KACR,WAAW,QAAQ,YACf,QAAQ,YAAY,MACpB,KAAK,KAAK;KACd,SAAS,0BAA0B,GAAG;KACtC,YAAY,QAAQ;KACpB,UAAU,UAAU;KACpB,SAAS,UAAU;KACnB,gBAAgB,GAAG;KACnB,gBAAgB,GAAG;KACnB,UAAU,CACR;MACE,QAAQ,QAAQ;MAChB,WAAW,QAAQ;MACnB,OAAO,QAAQ;MACf,UAAU;MACV,OAAO;MACP,OAAO;MACP,MAAM;MACP,CACF;KACD;KACD;IACF,CACF;GACD,WAAW;IACT,OAAO;IACP,cAAc;IACf;GACF;EAGkB"}
|
|
1
|
+
{"version":3,"file":"converters.js","names":[],"sources":["../../../src/utils/converters.ts"],"sourcesContent":["import type {\n ExecutionAction,\n ExecutionActionStatus,\n ExtendedTransactionInfo,\n FeeCost,\n FullStatusData,\n Substatus,\n TokenAmount,\n ToolsResponse,\n} from '@lifi/sdk'\nimport type { RouteExecution } from '../stores/routes/types.js'\nimport { formatTokenPrice } from './format.js'\n\nconst buildActionsFromTxHistory = (tx: FullStatusData): ExecutionAction[] => {\n const sending = tx.sending as ExtendedTransactionInfo\n const receiving = tx.receiving as ExtendedTransactionInfo\n\n if (!sending.token?.chainId || !receiving.token?.chainId) {\n return []\n }\n\n const actionStatus: ExecutionActionStatus =\n tx.status === 'DONE' ? 'DONE' : 'FAILED'\n const substatus: Substatus =\n actionStatus === 'FAILED' ? 'UNKNOWN_ERROR' : 'COMPLETED'\n\n if (sending.chainId === receiving.chainId) {\n return [\n {\n type: 'SWAP', // operations on same chain will be swaps\n message: '',\n status: actionStatus,\n chainId: sending.chainId,\n txHash: sending.txHash,\n txLink: sending.txLink,\n substatus,\n substatusMessage: '',\n },\n ]\n }\n\n const actions: ExecutionAction[] = [\n {\n type: 'CROSS_CHAIN', // first step of bridging, ignoring the approvals\n message: '',\n status: actionStatus, // can be FAILED\n chainId: sending.chainId,\n txHash: sending.txHash,\n txLink: sending.txLink,\n },\n {\n type: 'RECEIVING_CHAIN', // final step of bridging, post swaps\n message: '',\n status: actionStatus,\n substatus,\n substatusMessage: '',\n chainId: receiving.chainId,\n txHash: receiving.txHash,\n txLink: receiving.txLink,\n },\n ]\n\n return actions\n}\n\nexport const buildRouteFromTxHistory = (\n tx: FullStatusData,\n tools?: ToolsResponse\n): RouteExecution | undefined => {\n const sending = tx.sending as ExtendedTransactionInfo\n const receiving = tx.receiving as ExtendedTransactionInfo\n\n if (!sending.token?.chainId || !receiving.token?.chainId) {\n return\n }\n\n let usedTool = tx.sending.includedSteps?.find(\n (step) => step.toolDetails.key === tx.tool\n )?.toolDetails\n\n if (!usedTool) {\n const selectedBridge = tools?.bridges.find(\n (bridge) => bridge.key === tx.tool\n )\n\n const selectedExchange = tools?.exchanges.find(\n (exchange) => exchange.key === tx.tool\n )\n usedTool = {\n key: tx.tool,\n name: selectedBridge?.name ?? selectedExchange?.name ?? tx.tool,\n logoURI: selectedBridge?.logoURI ?? selectedExchange?.logoURI ?? '',\n }\n }\n\n const fromToken: TokenAmount = {\n ...sending.token,\n amount: BigInt(sending.amount ?? 0),\n }\n\n const toToken: TokenAmount = {\n ...receiving.token,\n amount: BigInt(receiving.amount ?? 0),\n }\n\n const sendingValue = sending.value ? BigInt(sending.value) : 0n\n const sendingFeeAmount =\n sending.gasToken.address === sending.token.address && sending.amount\n ? sendingValue - BigInt(sending.amount)\n : sendingValue\n const sendingFeeAmountUsd =\n sending.gasToken.priceUSD && sendingFeeAmount\n ? formatTokenPrice(\n sendingFeeAmount,\n sending.gasToken.priceUSD,\n sending.gasToken.decimals\n )\n : 0\n\n const feeCosts: FeeCost[] | undefined = sendingFeeAmount\n ? [\n {\n amount: sendingFeeAmount.toString(),\n amountUSD: sendingFeeAmountUsd.toFixed(2),\n token: sending.gasToken,\n included: false,\n // Not used\n description: '',\n name: '',\n percentage: '',\n },\n ]\n : undefined\n\n const routeExecution: RouteExecution = {\n status: 1,\n route: {\n id: (tx as FullStatusData).transactionId,\n fromAddress: (tx as FullStatusData).fromAddress,\n toAddress: (tx as FullStatusData).toAddress,\n fromChainId: sending.chainId,\n fromAmount: sending.amount ?? '',\n fromAmountUSD: sending.amountUSD ?? '',\n toAmount: receiving.amount ?? '',\n toAmountMin: receiving.amount ?? '',\n toAmountUSD: receiving.amountUSD ?? '',\n toChainId: receiving.chainId,\n fromToken,\n toToken,\n gasCostUSD: sending.gasAmountUSD,\n steps: [\n {\n id: (tx as FullStatusData).transactionId,\n type: 'lifi',\n tool: tx.tool,\n toolDetails: usedTool,\n action: {\n fromToken: sending.token,\n fromAmount: sending.amount ?? '',\n fromChainId: sending.chainId,\n fromAddress: (tx as FullStatusData).fromAddress,\n toToken: receiving.token,\n toChainId: receiving.chainId,\n toAddress: (tx as FullStatusData).toAddress,\n slippage: 0,\n },\n estimate: {\n tool: tx.tool,\n approvalAddress: '',\n fromAmount: sending.amount ?? '',\n fromAmountUSD: sending.amountUSD ?? '',\n toAmountMin: receiving.amount ?? '',\n toAmount: receiving.amount ?? '',\n toAmountUSD: receiving.amountUSD ?? '',\n executionDuration: 0,\n },\n includedSteps: [\n {\n id: (tx as FullStatusData).transactionId,\n type: sending.chainId === receiving.chainId ? 'swap' : 'cross',\n action: {\n fromChainId: sending.chainId,\n fromAmount: sending.amount ?? '',\n fromToken: sending.token,\n toChainId: receiving.chainId,\n toToken: receiving.token,\n slippage: 0,\n fromAddress: (tx as FullStatusData).fromAddress,\n toAddress: (tx as FullStatusData).toAddress,\n },\n estimate: {\n tool: tx.tool,\n fromAmount: sending.amount ?? '',\n toAmount: receiving.amount ?? '',\n toAmountMin: receiving.amount ?? '',\n approvalAddress: '',\n executionDuration: 0,\n },\n tool: tx.tool,\n toolDetails: usedTool,\n },\n ],\n integrator: tx.metadata?.integrator ?? '',\n execution: {\n status: 'DONE', // can be FAILED\n startedAt: sending.timestamp\n ? sending.timestamp * 1000\n : Date.now(),\n actions: buildActionsFromTxHistory(tx),\n fromAmount: sending.amount,\n toAmount: receiving.amount,\n toToken: receiving.token,\n internalTxLink: tx.lifiExplorerLink,\n externalTxLink: tx.bridgeExplorerLink,\n gasCosts: [\n {\n amount: sending.gasAmount,\n amountUSD: sending.gasAmountUSD,\n token: sending.gasToken,\n estimate: '0',\n limit: '0',\n price: '0',\n type: 'SEND',\n },\n ],\n feeCosts,\n },\n },\n ],\n insurance: {\n state: 'NOT_INSURABLE',\n feeAmountUsd: '0',\n },\n },\n }\n\n return routeExecution\n}\n"],"mappings":";;AAaA,MAAM,6BAA6B,OAA0C;CAC3E,MAAM,UAAU,GAAG;CACnB,MAAM,YAAY,GAAG;CAErB,IAAI,CAAC,QAAQ,OAAO,WAAW,CAAC,UAAU,OAAO,SAC/C,OAAO,EAAE;CAGX,MAAM,eACJ,GAAG,WAAW,SAAS,SAAS;CAClC,MAAM,YACJ,iBAAiB,WAAW,kBAAkB;CAEhD,IAAI,QAAQ,YAAY,UAAU,SAChC,OAAO,CACL;EACE,MAAM;EACN,SAAS;EACT,QAAQ;EACR,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EAChB,QAAQ,QAAQ;EAChB;EACA,kBAAkB;EACnB,CACF;CAwBH,OAAO,CApBL;EACE,MAAM;EACN,SAAS;EACT,QAAQ;EACR,SAAS,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;IACvC,WAAW;KACT,QAAQ;KACR,WAAW,QAAQ,YACf,QAAQ,YAAY,MACpB,KAAK,KAAK;KACd,SAAS,0BAA0B,GAAG;KACtC,YAAY,QAAQ;KACpB,UAAU,UAAU;KACpB,SAAS,UAAU;KACnB,gBAAgB,GAAG;KACnB,gBAAgB,GAAG;KACnB,UAAU,CACR;MACE,QAAQ,QAAQ;MAChB,WAAW,QAAQ;MACnB,OAAO,QAAQ;MACf,UAAU;MACV,OAAO;MACP,OAAO;MACP,MAAM;MACP,CACF;KACD;KACD;IACF,CACF;GACD,WAAW;IACT,OAAO;IACP,cAAc;IACf;GACF;EAGkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currencyExtendedFormatter.js","names":[],"sources":["../../../src/utils/currencyExtendedFormatter.ts"],"sourcesContent":["export const currencyExtendedFormatter = (\n lng: string | undefined,\n options: any\n): ((value: any) => string) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...options,\n style: 'currency',\n })\n return (value: any) => {\n if (value > 0 && value < 0.01) {\n return `<${formatter.format(0.01)}`\n }\n return formatter.format(value)\n }\n}\n"],"mappings":";AAAA,MAAa,6BACX,KACA,YAC6B;CAC7B,MAAM,YAAY,IAAI,KAAK,aAAa,KAAK;EAC3C,GAAG;EACH,OAAO;EACR,CAAC;
|
|
1
|
+
{"version":3,"file":"currencyExtendedFormatter.js","names":[],"sources":["../../../src/utils/currencyExtendedFormatter.ts"],"sourcesContent":["export const currencyExtendedFormatter = (\n lng: string | undefined,\n options: any\n): ((value: any) => string) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...options,\n style: 'currency',\n })\n return (value: any) => {\n if (value > 0 && value < 0.01) {\n return `<${formatter.format(0.01)}`\n }\n return formatter.format(value)\n }\n}\n"],"mappings":";AAAA,MAAa,6BACX,KACA,YAC6B;CAC7B,MAAM,YAAY,IAAI,KAAK,aAAa,KAAK;EAC3C,GAAG;EACH,OAAO;EACR,CAAC;CACF,QAAQ,UAAe;EACrB,IAAI,QAAQ,KAAK,QAAQ,KACvB,OAAO,IAAI,UAAU,OAAO,IAAK;EAEnC,OAAO,UAAU,OAAO,MAAM"}
|