@lifi/widget 4.3.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/App.d.ts +0 -1
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -1
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.d.ts +13 -0
- package/dist/esm/components/ActionRow/ActionRow.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +9 -0
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts +7 -0
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.d.ts.map +1 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +7 -0
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts.map +1 -0
- package/dist/esm/components/Avatar/Avatar.d.ts +12 -0
- package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +14 -0
- package/dist/esm/components/Avatar/TokenAvatar.d.ts.map +1 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts +6 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.d.ts.map +1 -0
- package/dist/esm/components/BaseTransactionButton/types.d.ts +14 -0
- package/dist/esm/components/BaseTransactionButton/types.d.ts.map +1 -0
- package/dist/esm/components/BottomSheet/types.d.ts +11 -0
- package/dist/esm/components/BottomSheet/types.d.ts.map +1 -0
- package/dist/esm/components/ButtonTertiary.d.ts +7 -0
- package/dist/esm/components/ButtonTertiary.d.ts.map +1 -0
- package/dist/esm/components/Card/Card.d.ts +12 -0
- package/dist/esm/components/Card/Card.d.ts.map +1 -0
- package/dist/esm/components/Card/CardIconButton.d.ts +7 -0
- package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -0
- package/dist/esm/components/Card/CardTitle.d.ts +9 -0
- package/dist/esm/components/Card/CardTitle.d.ts.map +1 -0
- package/dist/esm/components/Card/InputCard.d.ts +7 -0
- package/dist/esm/components/Card/InputCard.d.ts.map +1 -0
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts +7 -0
- package/dist/esm/components/ChainSelect/ChainSelect.d.ts.map +1 -0
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts +10 -0
- package/dist/esm/components/ChainSelect/ChainSelect.style.d.ts.map +1 -0
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts +7 -0
- package/dist/esm/components/ContractComponent/ContractComponent.d.ts.map +1 -0
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts +0 -1
- package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/NFTBase.d.ts.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts +0 -1
- package/dist/esm/components/ContractComponent/NFT/types.d.ts.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts +21 -0
- package/dist/esm/components/ExecutionStatusCard/ExecutionStatusCard.d.ts.map +1 -0
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts +16 -0
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.d.ts.map +1 -0
- package/dist/esm/components/ExecutionStatusCard/iconKey.js +1 -0
- package/dist/esm/components/ExecutionStatusCard/iconKey.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +13 -0
- package/dist/esm/components/FeeBreakdownTooltip.d.ts.map +1 -0
- package/dist/esm/components/IconCircle/IconCircle.d.ts +11 -0
- package/dist/esm/components/IconCircle/IconCircle.d.ts.map +1 -0
- package/dist/esm/components/IconCircle/statusIcons.d.ts +6 -0
- package/dist/esm/components/IconCircle/statusIcons.d.ts.map +1 -0
- package/dist/esm/components/IconTypography.d.ts +7 -0
- package/dist/esm/components/IconTypography.d.ts.map +1 -0
- package/dist/esm/components/ListItem/ListItemButton.d.ts +7 -0
- package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -0
- package/dist/esm/components/ListItemButton.d.ts +7 -0
- package/dist/esm/components/ListItemButton.d.ts.map +1 -0
- package/dist/esm/components/Messages/WarningMessages.d.ts +11 -0
- package/dist/esm/components/Messages/WarningMessages.d.ts.map +1 -0
- package/dist/esm/components/PageContainer.d.ts +12 -0
- package/dist/esm/components/PageContainer.d.ts.map +1 -0
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts +5 -0
- package/dist/esm/components/PoweredBy/PoweredBy.d.ts.map +1 -0
- package/dist/esm/components/ProgressToNextUpdate.d.ts +10 -0
- package/dist/esm/components/ProgressToNextUpdate.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteCard.d.ts +7 -0
- package/dist/esm/components/RouteCard/RouteCard.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts +7 -0
- package/dist/esm/components/RouteCard/RouteCardSkeleton.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteDetails.d.ts +10 -0
- package/dist/esm/components/RouteCard/RouteDetails.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts +12 -0
- package/dist/esm/components/RouteCard/RouteDetails.style.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts +5 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteTokens.d.ts +11 -0
- package/dist/esm/components/RouteCard/RouteTokens.d.ts.map +1 -0
- package/dist/esm/components/RouteCard/RouteTokens.js +2 -2
- package/dist/esm/components/RouteCard/RouteTokens.js.map +1 -1
- package/dist/esm/components/RouteCard/types.d.ts +14 -0
- package/dist/esm/components/RouteCard/types.d.ts.map +1 -0
- package/dist/esm/components/Search/SearchInput.d.ts +17 -0
- package/dist/esm/components/Search/SearchInput.d.ts.map +1 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts +10 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.d.ts.map +1 -0
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +15 -6
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts +1 -4
- package/dist/esm/components/Skeleton/WidgetSkeleton.d.ts.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts +9 -0
- package/dist/esm/components/StepActions/SentToWalletRow.d.ts.map +1 -0
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts +7 -0
- package/dist/esm/components/StepActions/StepActionRow.style.d.ts.map +1 -0
- package/dist/esm/components/StepActions/StepActionsList.d.ts +12 -0
- package/dist/esm/components/StepActions/StepActionsList.d.ts.map +1 -0
- package/dist/esm/components/StepActions/executionRows.d.ts +26 -0
- package/dist/esm/components/StepActions/executionRows.d.ts.map +1 -0
- package/dist/esm/components/Token/Token.d.ts +17 -0
- package/dist/esm/components/Token/Token.d.ts.map +1 -0
- package/dist/esm/components/TokenList/TokenNotFound.d.ts +6 -0
- package/dist/esm/components/TokenList/TokenNotFound.d.ts.map +1 -0
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts +7 -0
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts.map +1 -0
- package/dist/esm/components/TokenList/types.d.ts +20 -0
- package/dist/esm/components/TokenList/types.d.ts.map +1 -0
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +6 -0
- package/dist/esm/components/TokenList/useTokenSelect.d.ts.map +1 -0
- package/dist/esm/components/TokenRate/TokenRate.d.ts +10 -0
- package/dist/esm/components/TokenRate/TokenRate.d.ts.map +1 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js +1 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js +9 -0
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts +8 -0
- package/dist/esm/components/TransactionCard/TransactionCard.style.d.ts.map +1 -0
- package/dist/esm/config/constants.d.ts.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.d.ts.map +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useAddressActivity.d.ts +11 -0
- package/dist/esm/hooks/useAddressActivity.d.ts.map +1 -0
- package/dist/esm/hooks/useAddressValidation.d.ts +28 -0
- package/dist/esm/hooks/useAddressValidation.d.ts.map +1 -0
- package/dist/esm/hooks/useAddressValidation.js +6 -1
- package/dist/esm/hooks/useAddressValidation.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +12 -0
- package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -0
- package/dist/esm/hooks/useChain.d.ts +10 -0
- package/dist/esm/hooks/useChain.d.ts.map +1 -0
- package/dist/esm/hooks/useContactSupport.d.ts +5 -0
- package/dist/esm/hooks/useContactSupport.d.ts.map +1 -0
- package/dist/esm/hooks/useDebouncedWatch.d.ts +6 -0
- package/dist/esm/hooks/useDebouncedWatch.d.ts.map +1 -0
- package/dist/esm/hooks/useDisplayedTokens.js +48 -0
- package/dist/esm/hooks/useDisplayedTokens.js.map +1 -0
- package/dist/esm/hooks/useExplorer.d.ts +14 -0
- package/dist/esm/hooks/useExplorer.d.ts.map +1 -0
- package/dist/esm/hooks/useHeader.d.ts +6 -0
- package/dist/esm/hooks/useHeader.d.ts.map +1 -0
- package/dist/esm/hooks/useListHeight.d.ts +12 -0
- package/dist/esm/hooks/useListHeight.d.ts.map +1 -0
- package/dist/esm/hooks/useListHeight.js +1 -0
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useNavigateBack.d.ts +5 -0
- package/dist/esm/hooks/useNavigateBack.d.ts.map +1 -0
- package/dist/esm/hooks/usePacedRouteExecution.js +1 -0
- package/dist/esm/hooks/usePacedRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.d.ts +18 -0
- package/dist/esm/hooks/useRouteExecution.d.ts.map +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts +10 -0
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts.map +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.js +1 -0
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/hooks/useRoutes.d.ts +32 -0
- package/dist/esm/hooks/useRoutes.d.ts.map +1 -0
- package/dist/esm/hooks/useRoutes.js +12 -8
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.d.ts +16 -0
- package/dist/esm/hooks/useToAddressRequirements.d.ts.map +1 -0
- package/dist/esm/hooks/useToken.d.ts +9 -0
- package/dist/esm/hooks/useToken.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +11 -0
- package/dist/esm/hooks/useTokenAddressBalance.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenBalances.d.ts +14 -0
- package/dist/esm/hooks/useTokenBalances.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenBalances.js +5 -45
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenList.d.ts +16 -0
- package/dist/esm/hooks/useTokenList.d.ts.map +1 -0
- package/dist/esm/hooks/useTokenList.js +31 -0
- package/dist/esm/hooks/useTokenList.js.map +1 -0
- package/dist/esm/hooks/useTools.d.ts +8 -0
- package/dist/esm/hooks/useTools.d.ts.map +1 -0
- package/dist/esm/hooks/useTransactionDetails.js +1 -3
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js +1 -0
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/hooks/useWidgetChains.d.ts +0 -1
- package/dist/esm/hooks/useWidgetChains.d.ts.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts +0 -1
- package/dist/esm/hooks/useWidgetEvents.d.ts.map +1 -1
- package/dist/esm/i18n/en.json +321 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js +1 -0
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts +10 -0
- package/dist/esm/pages/MainPage/MainWarningMessages.d.ts.map +1 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts +7 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts.map +1 -0
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts +6 -0
- package/dist/esm/pages/SelectChainPage/SelectChainPage.d.ts.map +1 -0
- package/dist/esm/pages/SelectChainPage/types.d.ts +8 -0
- package/dist/esm/pages/SelectChainPage/types.d.ts.map +1 -0
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts +10 -0
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts.map +1 -0
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts +9 -0
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts +14 -0
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts +19 -0
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts +12 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.js +1 -0
- package/dist/esm/pages/TransactionPage/ExecutionDoneCard.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +11 -0
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts +6 -0
- package/dist/esm/pages/TransactionPage/StartTransactionButton.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts +15 -0
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionContent.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts +12 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionDoneButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionPage.js +1 -0
- package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/types.d.ts +9 -0
- package/dist/esm/pages/TransactionPage/types.d.ts.map +1 -0
- package/dist/esm/pages/TransactionPage/utils.d.ts +6 -0
- package/dist/esm/pages/TransactionPage/utils.d.ts.map +1 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts +5 -0
- package/dist/esm/providers/I18nProvider/I18nProvider.d.ts.map +1 -0
- package/dist/esm/providers/I18nProvider/types.d.ts +2 -3
- package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
- package/dist/esm/providers/QueryClientProvider.d.ts +6 -0
- package/dist/esm/providers/QueryClientProvider.d.ts.map +1 -0
- package/dist/esm/providers/SDKClientProvider.d.ts +8 -0
- package/dist/esm/providers/SDKClientProvider.d.ts.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +10 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts.map +1 -0
- package/dist/esm/providers/WalletProvider/WalletProvider.js +8 -3
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts +8 -0
- package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
- package/dist/esm/providers/WidgetProvider/types.d.ts +11 -0
- package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -0
- package/dist/esm/shared.d.ts +107 -0
- package/dist/esm/shared.js +105 -0
- package/dist/esm/stores/StoreProvider.d.ts +7 -0
- package/dist/esm/stores/StoreProvider.d.ts.map +1 -0
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +7 -0
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts.map +1 -0
- package/dist/esm/stores/bookmarks/types.d.ts +0 -1
- package/dist/esm/stores/bookmarks/types.d.ts.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +8 -0
- package/dist/esm/stores/chains/ChainOrderStore.d.ts.map +1 -0
- package/dist/esm/stores/chains/types.d.ts +27 -0
- package/dist/esm/stores/chains/types.d.ts.map +1 -0
- package/dist/esm/stores/form/createFormStore.js +1 -0
- package/dist/esm/stores/form/createFormStore.js.map +1 -1
- package/dist/esm/stores/form/types.d.ts +7 -7
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.d.ts +0 -1
- package/dist/esm/stores/form/useFieldActions.d.ts.map +1 -1
- package/dist/esm/stores/form/useFieldValues.d.ts +0 -1
- package/dist/esm/stores/form/useFieldValues.d.ts.map +1 -1
- package/dist/esm/stores/header/types.d.ts +20 -0
- package/dist/esm/stores/header/types.d.ts.map +1 -0
- package/dist/esm/stores/header/useHeaderStore.d.ts +8 -0
- package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -0
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +13 -0
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts.map +1 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +9 -0
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts.map +1 -0
- package/dist/esm/stores/routes/createRouteExecutionStore.js +1 -0
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/types.d.ts +24 -0
- package/dist/esm/stores/routes/types.d.ts.map +1 -0
- package/dist/esm/stores/routes/types.js +14 -0
- package/dist/esm/stores/routes/types.js.map +1 -0
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js +1 -0
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/utils.d.ts +9 -0
- package/dist/esm/stores/routes/utils.d.ts.map +1 -0
- package/dist/esm/stores/settings/SettingsStore.d.ts +8 -0
- package/dist/esm/stores/settings/SettingsStore.d.ts.map +1 -0
- package/dist/esm/stores/settings/types.d.ts +5 -2
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/types.d.ts +9 -0
- package/dist/esm/stores/types.d.ts.map +1 -0
- package/dist/esm/themes/azureLight.d.ts +0 -1
- package/dist/esm/themes/azureLight.d.ts.map +1 -1
- package/dist/esm/themes/createTheme.d.ts +0 -1
- package/dist/esm/themes/createTheme.d.ts.map +1 -1
- package/dist/esm/themes/jumper.d.ts +0 -1
- package/dist/esm/themes/jumper.d.ts.map +1 -1
- package/dist/esm/themes/palettes.d.ts.map +1 -1
- package/dist/esm/themes/types.d.ts +0 -1
- package/dist/esm/themes/types.d.ts.map +1 -1
- package/dist/esm/themes/watermelonLight.d.ts +0 -1
- package/dist/esm/themes/watermelonLight.d.ts.map +1 -1
- package/dist/esm/themes/windows95.d.ts +0 -1
- package/dist/esm/themes/windows95.d.ts.map +1 -1
- package/dist/esm/types/events.d.ts +4 -3
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/token.d.ts +1 -2
- package/dist/esm/types/token.d.ts.map +1 -1
- package/dist/esm/types/widget.d.ts +72 -73
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.d.ts +8 -8
- package/dist/esm/utils/compactNumberFormatter.d.ts.map +1 -1
- package/dist/esm/utils/converters.d.ts +7 -0
- package/dist/esm/utils/converters.d.ts.map +1 -0
- package/dist/esm/utils/currencyExtendedFormatter.d.ts.map +1 -1
- package/dist/esm/utils/elements.d.ts +11 -0
- package/dist/esm/utils/elements.d.ts.map +1 -0
- package/dist/esm/utils/elements.js +8 -1
- package/dist/esm/utils/elements.js.map +1 -1
- package/dist/esm/utils/enum.d.ts +5 -0
- package/dist/esm/utils/enum.d.ts.map +1 -0
- package/dist/esm/utils/fees.d.ts +17 -0
- package/dist/esm/utils/fees.d.ts.map +1 -0
- package/dist/esm/utils/format.d.ts +14 -14
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/getPriceImpact.d.ts +1 -7
- package/dist/esm/utils/getPriceImpact.d.ts.map +1 -1
- package/dist/esm/utils/input.d.ts +5 -0
- package/dist/esm/utils/input.d.ts.map +1 -0
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/percentFormatter.d.ts +5 -5
- package/dist/esm/utils/percentFormatter.d.ts.map +1 -1
- package/dist/esm/utils/tokenList.js +3 -3
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/dist/esm/utils/wallet.d.ts +5 -0
- package/dist/esm/utils/wallet.d.ts.map +1 -0
- package/package.json +28 -20
- package/src/components/RouteCard/RouteTokens.tsx +3 -2
- package/src/components/SendToWallet/SendToWalletButton.tsx +27 -5
- package/src/components/TransactionCard/ActiveTransactionCard.style.tsx +11 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useDisplayedTokens.ts +70 -0
- package/src/hooks/useListHeight.ts +4 -0
- package/src/hooks/useRoutes.ts +360 -325
- package/src/hooks/useTokenBalances.ts +8 -53
- package/src/hooks/useTokenList.ts +59 -0
- package/src/hooks/useTransactionDetails.ts +1 -3
- package/src/providers/WalletProvider/WalletProvider.tsx +15 -3
- package/src/shared.ts +191 -0
- package/src/stores/form/createFormStore.ts +1 -0
- package/src/stores/form/types.ts +1 -0
- package/src/utils/tokenList.ts +3 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FormType } from "../form/types.js";
|
|
2
|
+
//#region src/stores/chains/types.d.ts
|
|
3
|
+
interface ChainOrderProps {
|
|
4
|
+
chainOrder: {
|
|
5
|
+
from: number[];
|
|
6
|
+
to: number[];
|
|
7
|
+
};
|
|
8
|
+
availableChains: {
|
|
9
|
+
from: number[];
|
|
10
|
+
to: number[];
|
|
11
|
+
};
|
|
12
|
+
fromShowAllNetworks: boolean;
|
|
13
|
+
toShowAllNetworks: boolean;
|
|
14
|
+
fromIsAllNetworks: boolean;
|
|
15
|
+
toIsAllNetworks: boolean;
|
|
16
|
+
pinnedChains: number[];
|
|
17
|
+
}
|
|
18
|
+
interface ChainOrderState extends ChainOrderProps {
|
|
19
|
+
initializeChains(chainIds: number[], type: FormType): number[];
|
|
20
|
+
setChain(chainId: number, type: FormType): void;
|
|
21
|
+
setIsAllNetworks(isAllNetworks: boolean, formType: FormType): void;
|
|
22
|
+
setShowAllNetworks(showAllNetworks: boolean, formType: FormType): void;
|
|
23
|
+
setPinnedChain(chainId: number): void;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ChainOrderState };
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/chains/types.ts"],"mappings":";;UAEU;EACR;IACE;IACA;;EAEF;IACE;IACA;;EAEF;EACA;EACA;EACA;EACA;;UAGe,wBAAwB;EACvC,iBAAiB,oBAAoB,MAAM;EAC3C,SAAS,iBAAiB,MAAM;EAChC,iBAAiB,wBAAwB,UAAU;EACnD,mBAAmB,0BAA0B,UAAU;EACvD,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFormStore.js","names":[],"sources":["../../../../src/stores/form/createFormStore.ts"],"sourcesContent":["import type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { DEFAULT_VALID_UNTIL_SECONDS } from '../../utils/limitOrder.js'\nimport type {\n DefaultValues,\n FormFieldArray,\n FormFieldNames,\n FormValueControl,\n FormValues,\n FormValuesState,\n} from './types.js'\n\nexport const formDefaultValues: DefaultValues = {\n fromAmount: '',\n toAmount: '',\n tokenSearchFilter: '',\n priceInverted: false,\n validUntil: DEFAULT_VALID_UNTIL_SECONDS,\n partiallyFillable: true,\n}\n\nconst defaultValueToFormValue = <T>(value: T): FormValueControl<T> => ({\n isTouched: false,\n isDirty: false,\n value,\n})\n\nconst valuesToFormValues = (defaultValues: DefaultValues): FormValues => {\n return (Object.keys(defaultValues) as FormFieldNames[]).reduce(\n (accum, key) => {\n accum[key] = defaultValueToFormValue(defaultValues[key]) as never\n return accum\n },\n {} as FormValues\n )\n}\n\nconst isString = (str: unknown): str is string =>\n typeof str === 'string' || str instanceof String\n\nconst getUpdatedTouchedFields = (userValues: FormValues) => {\n return (Object.keys(userValues) as FormFieldNames[]).reduce(\n (accum, key) => {\n if (userValues[key]?.isTouched) {\n accum[key] = true\n }\n return accum\n },\n {} as Record<FormFieldNames, boolean>\n )\n}\n\nconst mergeDefaultFormValues = (\n userValues: FormValues,\n defaultValues: FormValues\n) =>\n (Object.keys(defaultValues) as FormFieldNames[]).reduce<FormValues>(\n (accum, key) => {\n const formValue = {\n isTouched: !!(\n userValues[key]?.isTouched || defaultValues[key]?.isTouched\n ),\n isDirty: !!(userValues[key]?.isDirty || defaultValues[key]?.isTouched),\n value:\n userValues[key]?.value !== undefined && userValues[key]?.value !== ''\n ? userValues[key]?.value\n : defaultValues[key]?.value,\n }\n accum[key] = formValue as never\n return accum\n },\n { ...valuesToFormValues(formDefaultValues) }\n )\n\nexport const createFormStore = (\n defaultValues?: DefaultValues\n): UseBoundStore<StoreApi<FormValuesState>> =>\n create<FormValuesState>((set, get) => {\n const _defaultValues = valuesToFormValues({\n ...formDefaultValues,\n ...defaultValues,\n })\n return {\n defaultValues: _defaultValues,\n userValues: _defaultValues,\n touchedFields: {},\n isValid: true,\n isValidating: false,\n errors: {},\n validation: {},\n setDefaultValues: (defaultValue) => {\n const defaultFormValues = valuesToFormValues(defaultValue)\n set((state) => ({\n defaultValues: defaultFormValues,\n userValues: mergeDefaultFormValues(\n state.userValues,\n defaultFormValues\n ),\n }))\n },\n setUserAndDefaultValues: (formValues) => {\n const currentUserValues = get().userValues\n ;(Object.keys(formValues) as FormFieldNames[]).forEach((key) => {\n if (formValues[key] !== currentUserValues[key]?.value) {\n get().resetField(key, { defaultValue: formValues[key] })\n get().setFieldValue(key, formValues[key], { isTouched: true })\n }\n })\n },\n isTouched: (fieldName: FormFieldNames) =>\n !!get().userValues[fieldName]?.isTouched,\n isDirty: (fieldName: FormFieldNames) =>\n !!get().userValues[fieldName]?.isDirty,\n setAsTouched: (fieldName: FormFieldNames) => {\n const userValues = {\n ...get().userValues,\n [fieldName]: {\n ...get().userValues[fieldName],\n isTouched: true,\n },\n }\n\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n },\n resetField: (fieldName, { defaultValue } = {}) => {\n if (defaultValue) {\n const fieldValues = {\n ...get().defaultValues[fieldName],\n value: defaultValue,\n }\n const defaultValues = {\n ...get().defaultValues,\n [fieldName]: { ...fieldValues },\n }\n const userValues = {\n ...get().userValues,\n [fieldName]: { ...fieldValues },\n }\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => {\n return {\n defaultValues,\n userValues,\n touchedFields,\n }\n })\n } else {\n const userValues = {\n ...get().userValues,\n [fieldName]: { ...get().defaultValues[fieldName] },\n }\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n }\n },\n setFieldValue: (fieldName, value, { isDirty, isTouched } = {}) => {\n const userValues = {\n ...get().userValues,\n [fieldName]: {\n value,\n isDirty:\n isDirty === undefined\n ? get().userValues[fieldName]?.isDirty\n : isDirty,\n isTouched:\n isTouched === undefined\n ? get().userValues[fieldName]?.isTouched\n : isTouched,\n },\n }\n\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n },\n getFieldValues: <T extends FormFieldNames[]>(...names: T) =>\n names.map((name) => get().userValues[name]?.value) as FormFieldArray<T>,\n addFieldValidation: (name, validationFn) => {\n set((state) => ({\n validation: {\n ...state.validation,\n [name]: validationFn,\n },\n }))\n },\n triggerFieldValidation: async (name) => {\n try {\n let valid = true\n set(() => ({ isValid: false, isValidating: true }))\n\n const validationFn = get().validation[name]\n\n if (validationFn) {\n const result = await validationFn(get().userValues?.[name]?.value)\n if (isString(result)) {\n valid = false\n set((state) => ({\n errors: {\n ...state.errors,\n [name]: result,\n },\n }))\n } else {\n valid = result as boolean\n if (valid) {\n get().clearErrors(name)\n }\n }\n }\n\n set(() => ({ isValid: valid, isValidating: false }))\n return valid\n } catch (err) {\n set(() => ({ isValidating: false }))\n throw err\n }\n },\n clearErrors: (name) => {\n const newErrors = { ...get().errors }\n\n delete newErrors[name]\n\n set(() => ({\n errors: newErrors,\n }))\n },\n }\n })\n"],"mappings":";;;AAYA,MAAa,oBAAmC;CAC9C,YAAY;CACZ,UAAU;CACV,mBAAmB;CACnB,eAAe;CACf,YAAY;CACZ,mBAAmB;AACrB;AAEA,MAAM,2BAA8B,WAAmC;CACrE,WAAW;CACX,SAAS;CACT;AACF;AAEA,MAAM,sBAAsB,kBAA6C;CACvE,OAAQ,OAAO,KAAK,aAAa,CAAC,CAAsB,QACrD,OAAO,QAAQ;EACd,MAAM,OAAO,wBAAwB,c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AU,EAAE,UAC7B;KACN,WACE,cAAc,KAAA,IACV,IAAI,CAAC,CAAC,WAAW,UAAU,EAAE,YAC7B;IACR;GACF;GAEA,MAAM,gBAAgB,wBAAwB,UAAU;GAExD,WAAW;IACT;IACA;GACF,EAAE;EACJ;EACA,iBAA6C,GAAG,UAC9C,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,WAAW,KAAK,EAAE,KAAK;EACnD,qBAAqB,MAAM,iBAAiB;GAC1C,KAAK,WAAW,EACd,YAAY;IACV,GAAG,MAAM;KACR,OAAO;GACV,EACF,EAAE;EACJ;EACA,wBAAwB,OAAO,SAAS;GACtC,IAAI;IACF,IAAI,QAAQ;IACZ,WAAW;KAAE,SAAS;KAAO,cAAc;IAAK,EAAE;IAElD,MAAM,eAAe,IAAI,CAAC,CAAC,WAAW;IAEtC,IAAI,cAAc;KAChB,MAAM,SAAS,MAAM,aAAa,IAAI,CAAC,CAAC,aAAa,KAAK,EAAE,KAAK;KACjE,IAAI,SAAS,MAAM,GAAG;MACpB,QAAQ;MACR,KAAK,WAAW,EACd,QAAQ;OACN,GAAG,MAAM;QACR,OAAO;MACV,EACF,EAAE;KACJ,OAAO;MACL,QAAQ;MACR,IAAI,OACF,IAAI,CAAC,CAAC,YAAY,IAAI;KAE1B;IACF;IAEA,WAAW;KAAE,SAAS;KAAO,cAAc;IAAM,EAAE;IACnD,OAAO;GACT,SAAS,KAAK;IACZ,WAAW,EAAE,cAAc,MAAM,EAAE;IACnC,MAAM;GACR;EACF;EACA,cAAc,SAAS;GACrB,MAAM,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;GAEpC,OAAO,UAAU;GAEjB,WAAW,EACT,QAAQ,UACV,EAAE;EACJ;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"createFormStore.js","names":[],"sources":["../../../../src/stores/form/createFormStore.ts"],"sourcesContent":["import type { StoreApi, UseBoundStore } from 'zustand'\nimport { create } from 'zustand'\nimport { DEFAULT_VALID_UNTIL_SECONDS } from '../../utils/limitOrder.js'\nimport type {\n DefaultValues,\n FormFieldArray,\n FormFieldNames,\n FormValueControl,\n FormValues,\n FormValuesState,\n} from './types.js'\n\nexport const formDefaultValues: DefaultValues = {\n fromAmount: '',\n toAmount: '',\n cashFiatAmount: '',\n tokenSearchFilter: '',\n priceInverted: false,\n validUntil: DEFAULT_VALID_UNTIL_SECONDS,\n partiallyFillable: true,\n}\n\nconst defaultValueToFormValue = <T>(value: T): FormValueControl<T> => ({\n isTouched: false,\n isDirty: false,\n value,\n})\n\nconst valuesToFormValues = (defaultValues: DefaultValues): FormValues => {\n return (Object.keys(defaultValues) as FormFieldNames[]).reduce(\n (accum, key) => {\n accum[key] = defaultValueToFormValue(defaultValues[key]) as never\n return accum\n },\n {} as FormValues\n )\n}\n\nconst isString = (str: unknown): str is string =>\n typeof str === 'string' || str instanceof String\n\nconst getUpdatedTouchedFields = (userValues: FormValues) => {\n return (Object.keys(userValues) as FormFieldNames[]).reduce(\n (accum, key) => {\n if (userValues[key]?.isTouched) {\n accum[key] = true\n }\n return accum\n },\n {} as Record<FormFieldNames, boolean>\n )\n}\n\nconst mergeDefaultFormValues = (\n userValues: FormValues,\n defaultValues: FormValues\n) =>\n (Object.keys(defaultValues) as FormFieldNames[]).reduce<FormValues>(\n (accum, key) => {\n const formValue = {\n isTouched: !!(\n userValues[key]?.isTouched || defaultValues[key]?.isTouched\n ),\n isDirty: !!(userValues[key]?.isDirty || defaultValues[key]?.isTouched),\n value:\n userValues[key]?.value !== undefined && userValues[key]?.value !== ''\n ? userValues[key]?.value\n : defaultValues[key]?.value,\n }\n accum[key] = formValue as never\n return accum\n },\n { ...valuesToFormValues(formDefaultValues) }\n )\n\nexport const createFormStore = (\n defaultValues?: DefaultValues\n): UseBoundStore<StoreApi<FormValuesState>> =>\n create<FormValuesState>((set, get) => {\n const _defaultValues = valuesToFormValues({\n ...formDefaultValues,\n ...defaultValues,\n })\n return {\n defaultValues: _defaultValues,\n userValues: _defaultValues,\n touchedFields: {},\n isValid: true,\n isValidating: false,\n errors: {},\n validation: {},\n setDefaultValues: (defaultValue) => {\n const defaultFormValues = valuesToFormValues(defaultValue)\n set((state) => ({\n defaultValues: defaultFormValues,\n userValues: mergeDefaultFormValues(\n state.userValues,\n defaultFormValues\n ),\n }))\n },\n setUserAndDefaultValues: (formValues) => {\n const currentUserValues = get().userValues\n ;(Object.keys(formValues) as FormFieldNames[]).forEach((key) => {\n if (formValues[key] !== currentUserValues[key]?.value) {\n get().resetField(key, { defaultValue: formValues[key] })\n get().setFieldValue(key, formValues[key], { isTouched: true })\n }\n })\n },\n isTouched: (fieldName: FormFieldNames) =>\n !!get().userValues[fieldName]?.isTouched,\n isDirty: (fieldName: FormFieldNames) =>\n !!get().userValues[fieldName]?.isDirty,\n setAsTouched: (fieldName: FormFieldNames) => {\n const userValues = {\n ...get().userValues,\n [fieldName]: {\n ...get().userValues[fieldName],\n isTouched: true,\n },\n }\n\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n },\n resetField: (fieldName, { defaultValue } = {}) => {\n if (defaultValue) {\n const fieldValues = {\n ...get().defaultValues[fieldName],\n value: defaultValue,\n }\n const defaultValues = {\n ...get().defaultValues,\n [fieldName]: { ...fieldValues },\n }\n const userValues = {\n ...get().userValues,\n [fieldName]: { ...fieldValues },\n }\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => {\n return {\n defaultValues,\n userValues,\n touchedFields,\n }\n })\n } else {\n const userValues = {\n ...get().userValues,\n [fieldName]: { ...get().defaultValues[fieldName] },\n }\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n }\n },\n setFieldValue: (fieldName, value, { isDirty, isTouched } = {}) => {\n const userValues = {\n ...get().userValues,\n [fieldName]: {\n value,\n isDirty:\n isDirty === undefined\n ? get().userValues[fieldName]?.isDirty\n : isDirty,\n isTouched:\n isTouched === undefined\n ? get().userValues[fieldName]?.isTouched\n : isTouched,\n },\n }\n\n const touchedFields = getUpdatedTouchedFields(userValues)\n\n set(() => ({\n userValues,\n touchedFields,\n }))\n },\n getFieldValues: <T extends FormFieldNames[]>(...names: T) =>\n names.map((name) => get().userValues[name]?.value) as FormFieldArray<T>,\n addFieldValidation: (name, validationFn) => {\n set((state) => ({\n validation: {\n ...state.validation,\n [name]: validationFn,\n },\n }))\n },\n triggerFieldValidation: async (name) => {\n try {\n let valid = true\n set(() => ({ isValid: false, isValidating: true }))\n\n const validationFn = get().validation[name]\n\n if (validationFn) {\n const result = await validationFn(get().userValues?.[name]?.value)\n if (isString(result)) {\n valid = false\n set((state) => ({\n errors: {\n ...state.errors,\n [name]: result,\n },\n }))\n } else {\n valid = result as boolean\n if (valid) {\n get().clearErrors(name)\n }\n }\n }\n\n set(() => ({ isValid: valid, isValidating: false }))\n return valid\n } catch (err) {\n set(() => ({ isValidating: false }))\n throw err\n }\n },\n clearErrors: (name) => {\n const newErrors = { ...get().errors }\n\n delete newErrors[name]\n\n set(() => ({\n errors: newErrors,\n }))\n },\n }\n })\n"],"mappings":";;;AAYA,MAAa,oBAAmC;CAC9C,YAAY;CACZ,UAAU;CACV,gBAAgB;CAChB,mBAAmB;CACnB,eAAe;CACf,YAAY;CACZ,mBAAmB;AACrB;AAEA,MAAM,2BAA8B,WAAmC;CACrE,WAAW;CACX,SAAS;CACT;AACF;AAEA,MAAM,sBAAsB,kBAA6C;CACvE,OAAQ,OAAO,KAAK,aAAa,CAAC,CAAsB,QACrD,OAAO,QAAQ;EACd,MAAM,OAAO,wBAAwB,cAAc,IAAI;EACvD,OAAO;CACT,GACA,CAAC,CACH;AACF;AAEA,MAAM,YAAY,QAChB,OAAO,QAAQ,YAAY,eAAe;AAE5C,MAAM,2BAA2B,eAA2B;CAC1D,OAAQ,OAAO,KAAK,UAAU,CAAC,CAAsB,QAClD,OAAO,QAAQ;EACd,IAAI,WAAW,IAAI,EAAE,WACnB,MAAM,OAAO;EAEf,OA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AE,KAAK;EACnD,qBAAqB,MAAM,iBAAiB;GAC1C,KAAK,WAAW,EACd,YAAY;IACV,GAAG,MAAM;KACR,OAAO;GACV,EACF,EAAE;EACJ;EACA,wBAAwB,OAAO,SAAS;GACtC,IAAI;IACF,IAAI,QAAQ;IACZ,WAAW;KAAE,SAAS;KAAO,cAAc;IAAK,EAAE;IAElD,MAAM,eAAe,IAAI,CAAC,CAAC,WAAW;IAEtC,IAAI,cAAc;KAChB,MAAM,SAAS,MAAM,aAAa,IAAI,CAAC,CAAC,aAAa,KAAK,EAAE,KAAK;KACjE,IAAI,SAAS,MAAM,GAAG;MACpB,QAAQ;MACR,KAAK,WAAW,EACd,QAAQ;OACN,GAAG,MAAM;QACR,OAAO;MACV,EACF,EAAE;KACJ,OAAO;MACL,QAAQ;MACR,IAAI,OACF,IAAI,CAAC,CAAC,YAAY,IAAI;KAE1B;IACF;IAEA,WAAW;KAAE,SAAS;KAAO,cAAc;IAAM,EAAE;IACnD,OAAO;GACT,SAAS,KAAK;IACZ,WAAW,EAAE,cAAc,MAAM,EAAE;IACnC,MAAM;GACR;EACF;EACA,cAAc,SAAS;GACrB,MAAM,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;GAEpC,OAAO,UAAU;GAEjB,WAAW,EACT,QAAQ,UACV,EAAE;EACJ;CACF;AACF,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContractCall } from "@lifi/sdk";
|
|
2
2
|
import { StoreApi, UseBoundStore } from "zustand";
|
|
3
|
-
|
|
4
3
|
//#region src/stores/form/types.d.ts
|
|
5
4
|
interface DefaultFieldValues {
|
|
6
5
|
fromChain?: number;
|
|
@@ -12,6 +11,7 @@ interface DefaultFieldValues {
|
|
|
12
11
|
toAmount: string;
|
|
13
12
|
}
|
|
14
13
|
interface DefaultValues extends DefaultFieldValues {
|
|
14
|
+
cashFiatAmount: string;
|
|
15
15
|
contractCalls?: ContractCall[];
|
|
16
16
|
tokenSearchFilter: string;
|
|
17
17
|
/** Limit-order: when true, the price is displayed/entered inverted. */
|
|
@@ -29,17 +29,17 @@ interface FormValueControl<T> {
|
|
|
29
29
|
isDirty: boolean;
|
|
30
30
|
value: T;
|
|
31
31
|
}
|
|
32
|
-
type FormValues = { [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]
|
|
32
|
+
type FormValues = { [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]>; };
|
|
33
33
|
type FormFieldNames = keyof FormValues;
|
|
34
34
|
type ExtractValueType<T> = T extends FormValueControl<infer U> ? U : never;
|
|
35
|
-
type FormFieldArray<T extends FormFieldNames[]> = { [K in keyof T]: ExtractValueType<FormValues[T[K]]
|
|
36
|
-
type TouchedFields = { [K in FormFieldNames]?: boolean };
|
|
35
|
+
type FormFieldArray<T extends FormFieldNames[]> = { [K in keyof T]: ExtractValueType<FormValues[T[K]]>; };
|
|
36
|
+
type TouchedFields = { [K in FormFieldNames]?: boolean; };
|
|
37
37
|
type ValidationFn = (value: any) => Promise<boolean | string>;
|
|
38
38
|
interface ValidationProps {
|
|
39
39
|
isValid: boolean;
|
|
40
40
|
isValidating: boolean;
|
|
41
|
-
errors: { [K in FormFieldNames]?: string };
|
|
42
|
-
validation: { [K in FormFieldNames]?: ValidationFn };
|
|
41
|
+
errors: { [K in FormFieldNames]?: string; };
|
|
42
|
+
validation: { [K in FormFieldNames]?: ValidationFn; };
|
|
43
43
|
}
|
|
44
44
|
interface ValidationActions {
|
|
45
45
|
addFieldValidation: (name: FormFieldNames, validationFn: ValidationFn) => void;
|
|
@@ -49,7 +49,7 @@ interface ValidationActions {
|
|
|
49
49
|
interface FormProps {
|
|
50
50
|
defaultValues: FormValues;
|
|
51
51
|
userValues: FormValues;
|
|
52
|
-
touchedFields: { [K in FormFieldNames]?: boolean };
|
|
52
|
+
touchedFields: { [K in FormFieldNames]?: boolean; };
|
|
53
53
|
}
|
|
54
54
|
interface ResetOptions {
|
|
55
55
|
defaultValue?: GenericFormValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/form/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/form/types.ts"],"mappings":";;;UAGiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,sBAAsB;EACrC;EACA,gBAAgB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;KAGU,+CAIR;UAEa,iBAAiB;EAChC;EACA;EACA,OAAO;;KAGG,gBACT,kBAAkB,gBAAgB,iBAAiB,cAAc;KAGxD,uBAAuB;KACvB,iBAAiB,KAC3B,UAAU,uBAAuB,KAAK;KAC5B,eAAe,UAAU,uBAClC,WAAW,IAAI,iBAAiB,WAAW,EAAE;KAGpC,mBAAmB,KAAK;KAE/B,gBAAgB,eAAe;UACnB;EACf;EACA;EACA,WACG,KAAK;EAER,eACG,KAAK,kBAAkB;;UAIX;EACf,qBAAqB,MAAM,gBAAgB,cAAc;EACzD,yBAAyB,MAAM,mBAAmB;EAClD,cAAc,MAAM;;UAGL;EACf,eAAe;EACf,YAAY;EACZ,kBAAkB,KAAK;;UAGR;EACf,eAAe;;UAGA;EACf,mBAAmB,YAAY;EAC/B,0BAA0B,YAAY,QAAQ;EAC9C,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,eAAe,WAAW;EAC1B,aAAa,WAAW,gBAAgB,eAAe;EACvD,gBACE,WAAW,gBACX,OAAO,kBACP,UAAU;EAEZ,iBAAiB,UAAU,qBAAqB,OAAO,MAAM,eAAe;;KAGlE,kBAAkB,YAC5B,cACA,kBACA;KAEU,iBAAiB,cAAc,SAAS;UAEnC;EACf;EACA;;KAGU;UAEK;EACf,UAAU;;cAGC;EACX,cAAc,UAAU;EAExB,cAAc,UAAU;EAExB,eAAe,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/stores/form/types.ts"],"sourcesContent":["import type { ContractCall } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\n\nexport interface DefaultFieldValues {\n fromChain?: number\n fromToken?: string\n toChain?: number\n toToken?: string\n toAddress?: string\n fromAmount: string\n toAmount: string\n}\n\nexport interface DefaultValues extends DefaultFieldValues {\n contractCalls?: ContractCall[]\n tokenSearchFilter: string\n /** Limit-order: when true, the price is displayed/entered inverted. */\n priceInverted: boolean\n /** Limit-order: order validity as a duration in seconds. */\n validUntil: number\n /** Limit-order: whether the order may be partially filled. */\n partiallyFillable: boolean\n /** Limit-order: id of the route the user picked. */\n selectedRouteId?: string\n}\n\nexport type GenericFormValue =\n | string\n | number\n | boolean\n | ContractCall[]\n | undefined\nexport interface FormValueControl<T> {\n isTouched: boolean\n isDirty: boolean\n value: T\n}\n\nexport type FormValues = {\n [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]>\n}\n\nexport type FormFieldNames = keyof FormValues\nexport type ExtractValueType<T> =\n T extends FormValueControl<infer U> ? U : never\nexport type FormFieldArray<T extends FormFieldNames[]> = {\n [K in keyof T]: ExtractValueType<FormValues[T[K]]>\n}\n\nexport type TouchedFields = { [K in FormFieldNames]?: boolean }\n\ntype ValidationFn = (value: any) => Promise<boolean | string>\nexport interface ValidationProps {\n isValid: boolean\n isValidating: boolean\n errors: {\n [K in FormFieldNames]?: string\n }\n validation: {\n [K in FormFieldNames]?: ValidationFn\n }\n}\n\nexport interface ValidationActions {\n addFieldValidation: (name: FormFieldNames, validationFn: ValidationFn) => void\n triggerFieldValidation: (name: FormFieldNames) => Promise<boolean>\n clearErrors: (name: FormFieldNames) => void\n}\n\nexport interface FormProps {\n defaultValues: FormValues\n userValues: FormValues\n touchedFields: { [K in FormFieldNames]?: boolean }\n}\n\nexport interface ResetOptions {\n defaultValue?: GenericFormValue\n}\n\nexport interface FormActions {\n setDefaultValues: (formValues: DefaultValues) => void\n setUserAndDefaultValues: (formValues: Partial<DefaultValues>) => void\n isTouched: (fieldName: FormFieldNames) => boolean\n isDirty: (fieldName: FormFieldNames) => boolean\n setAsTouched: (fieldName: FormFieldNames) => void\n resetField: (fieldName: FormFieldNames, resetOptions?: ResetOptions) => void\n setFieldValue: (\n fieldName: FormFieldNames,\n value: GenericFormValue,\n options?: SetOptions\n ) => void\n getFieldValues: <T extends FormFieldNames[]>(...names: T) => FormFieldArray<T>\n}\n\nexport type FormValuesState = FormProps &\n FormActions &\n ValidationProps &\n ValidationActions\n\nexport type FormStoreStore = UseBoundStore<StoreApi<FormValuesState>>\n\nexport interface SetOptions {\n isDirty?: boolean\n isTouched?: boolean\n}\n\nexport type FormType = 'from' | 'to'\n\nexport interface FormTypeProps {\n formType: FormType\n}\n\nexport const FormKeyHelper = {\n getChainKey: (formType: FormType): 'fromChain' | 'toChain' =>\n `${formType}Chain`,\n getTokenKey: (formType: FormType): 'fromToken' | 'toToken' =>\n `${formType}Token`,\n getAmountKey: (formType: FormType): 'fromAmount' | 'toAmount' =>\n `${formType}Amount`,\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/stores/form/types.ts"],"sourcesContent":["import type { ContractCall } from '@lifi/sdk'\nimport type { StoreApi, UseBoundStore } from 'zustand'\n\nexport interface DefaultFieldValues {\n fromChain?: number\n fromToken?: string\n toChain?: number\n toToken?: string\n toAddress?: string\n fromAmount: string\n toAmount: string\n}\n\nexport interface DefaultValues extends DefaultFieldValues {\n cashFiatAmount: string\n contractCalls?: ContractCall[]\n tokenSearchFilter: string\n /** Limit-order: when true, the price is displayed/entered inverted. */\n priceInverted: boolean\n /** Limit-order: order validity as a duration in seconds. */\n validUntil: number\n /** Limit-order: whether the order may be partially filled. */\n partiallyFillable: boolean\n /** Limit-order: id of the route the user picked. */\n selectedRouteId?: string\n}\n\nexport type GenericFormValue =\n | string\n | number\n | boolean\n | ContractCall[]\n | undefined\nexport interface FormValueControl<T> {\n isTouched: boolean\n isDirty: boolean\n value: T\n}\n\nexport type FormValues = {\n [Property in keyof DefaultValues]: FormValueControl<DefaultValues[Property]>\n}\n\nexport type FormFieldNames = keyof FormValues\nexport type ExtractValueType<T> =\n T extends FormValueControl<infer U> ? U : never\nexport type FormFieldArray<T extends FormFieldNames[]> = {\n [K in keyof T]: ExtractValueType<FormValues[T[K]]>\n}\n\nexport type TouchedFields = { [K in FormFieldNames]?: boolean }\n\ntype ValidationFn = (value: any) => Promise<boolean | string>\nexport interface ValidationProps {\n isValid: boolean\n isValidating: boolean\n errors: {\n [K in FormFieldNames]?: string\n }\n validation: {\n [K in FormFieldNames]?: ValidationFn\n }\n}\n\nexport interface ValidationActions {\n addFieldValidation: (name: FormFieldNames, validationFn: ValidationFn) => void\n triggerFieldValidation: (name: FormFieldNames) => Promise<boolean>\n clearErrors: (name: FormFieldNames) => void\n}\n\nexport interface FormProps {\n defaultValues: FormValues\n userValues: FormValues\n touchedFields: { [K in FormFieldNames]?: boolean }\n}\n\nexport interface ResetOptions {\n defaultValue?: GenericFormValue\n}\n\nexport interface FormActions {\n setDefaultValues: (formValues: DefaultValues) => void\n setUserAndDefaultValues: (formValues: Partial<DefaultValues>) => void\n isTouched: (fieldName: FormFieldNames) => boolean\n isDirty: (fieldName: FormFieldNames) => boolean\n setAsTouched: (fieldName: FormFieldNames) => void\n resetField: (fieldName: FormFieldNames, resetOptions?: ResetOptions) => void\n setFieldValue: (\n fieldName: FormFieldNames,\n value: GenericFormValue,\n options?: SetOptions\n ) => void\n getFieldValues: <T extends FormFieldNames[]>(...names: T) => FormFieldArray<T>\n}\n\nexport type FormValuesState = FormProps &\n FormActions &\n ValidationProps &\n ValidationActions\n\nexport type FormStoreStore = UseBoundStore<StoreApi<FormValuesState>>\n\nexport interface SetOptions {\n isDirty?: boolean\n isTouched?: boolean\n}\n\nexport type FormType = 'from' | 'to'\n\nexport interface FormTypeProps {\n formType: FormType\n}\n\nexport const FormKeyHelper = {\n getChainKey: (formType: FormType): 'fromChain' | 'toChain' =>\n `${formType}Chain`,\n getTokenKey: (formType: FormType): 'fromToken' | 'toToken' =>\n `${formType}Token`,\n getAmountKey: (formType: FormType): 'fromAmount' | 'toAmount' =>\n `${formType}Amount`,\n}\n"],"mappings":";AAiHA,MAAa,gBAAgB;CAC3B,cAAc,aACZ,GAAG,SAAS;CACd,cAAc,aACZ,GAAG,SAAS;CACd,eAAe,aACb,GAAG,SAAS;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldActions.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldActions.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFieldActions.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldActions.ts"],"mappings":";;cAaa,uBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldValues.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldValues.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFieldValues.d.ts","names":[],"sources":["../../../../src/stores/form/useFieldValues.ts"],"mappings":";;cAIa,iBAAkB,UAAU,qBACpC,OAAO,MACT,eAAe"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StoreApi, UseBoundStore } from "zustand";
|
|
2
|
+
//#region src/stores/header/types.d.ts
|
|
3
|
+
interface HeaderStateBase {
|
|
4
|
+
element?: React.ReactNode | null;
|
|
5
|
+
title?: string;
|
|
6
|
+
headerHeight: number;
|
|
7
|
+
backAction?: () => void;
|
|
8
|
+
}
|
|
9
|
+
interface HeaderState extends HeaderStateBase {
|
|
10
|
+
setAction(element?: React.ReactNode | null): () => void;
|
|
11
|
+
setTitle(title?: string): () => void;
|
|
12
|
+
removeAction(): void;
|
|
13
|
+
removeTitle(): void;
|
|
14
|
+
setHeaderHeight(headerHeight: number): void;
|
|
15
|
+
setBackAction(action: () => void): void;
|
|
16
|
+
executeBackAction(): void;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { HeaderState };
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/header/types.ts"],"mappings":";;UAIU;EACR,UAAU,MAAM;EAChB;EACA;EACA;;UAGe,oBAAoB;EACnC,UAAU,UAAU,MAAM;EAC1B,SAAS;EACT;EACA;EACA,gBAAgB;EAChB,cAAc;EACd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../types.js";
|
|
2
|
+
import { HeaderState } from "./types.js";
|
|
3
|
+
//#region src/stores/header/useHeaderStore.d.ts
|
|
4
|
+
declare function useHeaderStore<T>(selector: (state: HeaderState) => T): T;
|
|
5
|
+
declare function useSetHeaderHeight(): any;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { useHeaderStore, useSetHeaderHeight };
|
|
8
|
+
//# sourceMappingURL=useHeaderStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeaderStore.d.ts","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"mappings":";;;iBA8BgB,eAAe,GAAG,WAAW,OAAO,gBAAgB,IAAI;iBAkBxD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormTypeProps } from "../form/types.js";
|
|
2
|
+
import { StoreApi, UseBoundStore } from "zustand";
|
|
3
|
+
//#region src/stores/inputMode/useInputModeStore.d.ts
|
|
4
|
+
type InputMode = "amount" | "price";
|
|
5
|
+
interface InputModeState {
|
|
6
|
+
inputMode: Record<"from" | "to", InputMode>;
|
|
7
|
+
setInputMode: (formType: FormTypeProps["formType"], mode: InputMode) => void;
|
|
8
|
+
toggleInputMode: (formType: FormTypeProps["formType"]) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const useInputModeStore: UseBoundStore<StoreApi<InputModeState>>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useInputModeStore };
|
|
13
|
+
//# sourceMappingURL=useInputModeStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInputModeStore.d.ts","names":[],"sources":["../../../../src/stores/inputMode/useInputModeStore.ts"],"mappings":";;;KAIK;UAEK;EACR,WAAW,sBAAsB;EACjC,eAAe,UAAU,2BAA2B,MAAM;EAC1D,kBAAkB,UAAU;;cAGjB,mBAAmB,cAAc,SAAS"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RouteExecutionState } from "./types.js";
|
|
2
|
+
import "../types.js";
|
|
3
|
+
import { JSX } from "react";
|
|
4
|
+
//#region src/stores/routes/RouteExecutionStore.d.ts
|
|
5
|
+
declare function useRouteExecutionStoreContext(): any;
|
|
6
|
+
declare function useRouteExecutionStore<T>(selector: (state: RouteExecutionState) => T): T;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useRouteExecutionStore, useRouteExecutionStoreContext };
|
|
9
|
+
//# sourceMappingURL=RouteExecutionStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteExecutionStore.d.ts","names":[],"sources":["../../../../src/stores/routes/RouteExecutionStore.tsx"],"mappings":";;;;iBA4BgB;iBAUA,uBAAuB,GACrC,WAAW,OAAO,wBAAwB,IACzC"}
|
|
@@ -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":"
|
|
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,OAA4B,CAAC,CAC3B,SACG,KAAK,SAAS;CACb,QAAQ,CAAC;CACT,qBAAqB,OAAc,uBAAkC;EACnE,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,MAAM,KACtB,KAAK,UAA+B;GAClC,MAAM,SAAS,EAAE,GAAG,MAAM,OAAO;GAEjC,OAAO,KAAK,MAAM,CAAC,CAChB,QACE,YACC,CAAC,oBAAoB,SAAS,OAAO,KACrC,YACE,OAAO,QAAQ,CAAE,QAAA,CAEnB,CACJ,CAAC,CACA,SAAS,YAAY;IAC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ChC,IAAI,IAAI,CAAC,CAAC,OAAO,UACf,KAAK,UAA+B;GAClC,MAAM,SAAS,EAAE,GAAG,MAAM,OAAO;GACjC,OAAO,OAAO;GACd,OAAO,EACL,OACF;EACF,CAAC;CAEL;AACF,IACA;CACE,MAAM,GAAG,cAAc,QAAQ;CAE/B,SAAS;CAET,gBAAgB,EAAE,QAAQ,CAAC,EAAE;CAC7B,aAAa,WAAW,EAAE,QAAQ,MAAM,OAAO;CAC/C,QAAQ,gBAAqB,iBAAsC;EACjE,MAAM,QAAQ;GACZ,GAAG;GACH,GAAG;EACL;EACA,IAAI;GAKF,MAAM,eADY,OAAO,OAAO,MAAM,MACT,CAAC,CAC3B,MACE,GAAG,OACD,EAAE,MAAM,MAAM,EAAE,EAAE,WAAW,aAAa,MAC1C,EAAE,MAAM,MAAM,EAAE,EAAE,WAAW,aAAa,EAC/C,CAAC,CACA,MAAM,GAAG,GAAe;GAC3B,MAAM,UAAU,IAAI,IAAI,aAAa,KAAK,MAAM,EAAE,MAAM,EAAE,CAAC;GAC3D,KAAK,MAAM,MAAM,OAAO,KAAK,MAAM,MAAM,GACvC,IAAI,CAAC,QAAQ,IAAI,EAAE,GACjB,OAAO,MAAM,OAAO;EAG1B,SAAS,OAAO;GACd,QAAQ,MAAM,KAAK;EACrB;EACA,OAAO;CACT;AACF,CACF,CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Route, RouteExtended } from "@lifi/sdk";
|
|
2
|
+
//#region src/stores/routes/types.d.ts
|
|
3
|
+
interface RouteExecution {
|
|
4
|
+
route: RouteExtended;
|
|
5
|
+
status: RouteExecutionStatus;
|
|
6
|
+
}
|
|
7
|
+
interface RouteExecutionState {
|
|
8
|
+
routes: Partial<Record<string, RouteExecution>>;
|
|
9
|
+
setExecutableRoute: (route: Route, observableRouteIds?: string[]) => void;
|
|
10
|
+
updateRoute: (route: Route) => void;
|
|
11
|
+
deleteRoute: (routeId: string) => void;
|
|
12
|
+
deleteRoutes: (type: "completed" | "active" | "failed", accountAddresses?: string[]) => void;
|
|
13
|
+
}
|
|
14
|
+
declare enum RouteExecutionStatus {
|
|
15
|
+
Idle = 1,
|
|
16
|
+
Pending = 2,
|
|
17
|
+
Done = 4,
|
|
18
|
+
Failed = 8,
|
|
19
|
+
Partial = 16,
|
|
20
|
+
Refunded = 32
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { RouteExecution, RouteExecutionState, RouteExecutionStatus };
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/routes/types.ts"],"mappings":";;UAEiB;EACf,OAAO;EACP,QAAQ;;UAGO;EACf,QAAQ,QAAQ,eAAe;EAC/B,qBAAqB,OAAO,OAAO;EACnC,cAAc,OAAO;EACrB,cAAc;EACd,eACE,yCACA;;aAIQ;EACV;EACA;EACA;EACA;EACA;EACA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/stores/routes/types.ts
|
|
2
|
+
let RouteExecutionStatus = /* @__PURE__ */ function(RouteExecutionStatus) {
|
|
3
|
+
RouteExecutionStatus[RouteExecutionStatus["Idle"] = 1] = "Idle";
|
|
4
|
+
RouteExecutionStatus[RouteExecutionStatus["Pending"] = 2] = "Pending";
|
|
5
|
+
RouteExecutionStatus[RouteExecutionStatus["Done"] = 4] = "Done";
|
|
6
|
+
RouteExecutionStatus[RouteExecutionStatus["Failed"] = 8] = "Failed";
|
|
7
|
+
RouteExecutionStatus[RouteExecutionStatus["Partial"] = 16] = "Partial";
|
|
8
|
+
RouteExecutionStatus[RouteExecutionStatus["Refunded"] = 32] = "Refunded";
|
|
9
|
+
return RouteExecutionStatus;
|
|
10
|
+
}({});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { RouteExecutionStatus };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/stores/routes/types.ts"],"sourcesContent":["import type { Route, RouteExtended } from '@lifi/sdk'\n\nexport interface RouteExecution {\n route: RouteExtended\n status: RouteExecutionStatus\n}\n\nexport interface RouteExecutionState {\n routes: Partial<Record<string, RouteExecution>>\n setExecutableRoute: (route: Route, observableRouteIds?: string[]) => void\n updateRoute: (route: Route) => void\n deleteRoute: (routeId: string) => void\n deleteRoutes: (\n type: 'completed' | 'active' | 'failed',\n accountAddresses?: string[]\n ) => void\n}\n\nexport enum RouteExecutionStatus {\n Idle = 1 << 0,\n Pending = 1 << 1,\n Done = 1 << 2,\n Failed = 1 << 3,\n Partial = 1 << 4,\n Refunded = 1 << 5,\n}\n"],"mappings":";AAkBA,IAAY,uBAAL,yBAAA,sBAAA;CACL,qBAAA,qBAAA,UAAA,KAAA;CACA,qBAAA,qBAAA,aAAA,KAAA;CACA,qBAAA,qBAAA,UAAA,KAAA;CACA,qBAAA,qBAAA,YAAA,KAAA;CACA,qBAAA,qBAAA,aAAA,MAAA;CACA,qBAAA,qBAAA,cAAA,MAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"useRouteExecutionIndicator.js","names":[],"sources":["../../../../src/stores/routes/useRouteExecutionIndicator.ts"],"sourcesContent":["import { useAccount } from '@lifi/wallet-management'\nimport { useCallback, useMemo } from 'react'\nimport { useRouteExecutionStore } from './RouteExecutionStore.js'\nimport type { RouteExecution, RouteExecutionState } from './types.js'\nimport { RouteExecutionStatus } from './types.js'\n\nexport type RouteExecutionIndicator = {\n failed: boolean\n active: boolean\n}\n\nconst isRecentTransaction = (route: RouteExecution): boolean => {\n const startedAt = route.route.steps[0]?.execution?.startedAt ?? 0\n return startedAt > 0 && Date.now() - startedAt < 1000 * 60 * 60 * 24 // 1 day\n}\n\nexport const useRouteExecutionIndicator = (): RouteExecutionIndicator => {\n const { accounts } = useAccount()\n const accountAddresses = useMemo(\n () => accounts.map((account) => account.address),\n [accounts]\n )\n const selector = useCallback(\n (state: RouteExecutionState): RouteExecutionIndicator => {\n const routes = Object.values(state.routes) as RouteExecution[]\n const recentOwnedRoutes = routes.filter(\n (route) =>\n accountAddresses.includes(route.route.fromAddress) &&\n isRecentTransaction(route)\n )\n return {\n failed: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Failed\n ),\n active: recentOwnedRoutes.some(\n (r) => r.status === RouteExecutionStatus.Pending\n ),\n }\n },\n [accountAddresses]\n )\n return useRouteExecutionStore(selector)\n}\n"],"mappings":";;;;;AAWA,MAAM,uBAAuB,UAAmC;CAC9D,MAAM,YAAY,MAAM,MAAM,MAAM,EAAE,EAAE,WAAW,aAAa;CAChE,OAAO,YAAY,KAAK,KAAK,IAAI,IAAI,YAAY,MAAO,KAAK,KAAK;AACpE;AAEA,MAAa,mCAA4D;CACvE,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,mBAAmB,cACjB,SAAS,KAAK,YAAY,QAAQ,OAAO,GAC/C,CAAC,QAAQ,CACX;CAoBA,OAAO,uBAnBU,aACd,UAAwD;EAEvD,MAAM,oBADS,OAAO,OAAO,MAAM,MACJ,CAAC,CAAC,QAC9B,UACC,iBAAiB,SAAS,MAAM,MAAM,WAAW,KACjD,oBAAoB,KAAK,CAC7B;EACA,OAAO;GACL,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,CACX;GACA,QAAQ,kBAAkB,MACvB,MAAM,EAAE,WAAA,CACX;EACF;CACF,GACA,CAAC,gBAAgB,CAEkB,CAAC;AACxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutionAction, RouteExtended } from "@lifi/sdk";
|
|
2
|
+
//#region src/stores/routes/utils.d.ts
|
|
3
|
+
declare const isRouteDone: (route: RouteExtended) => boolean;
|
|
4
|
+
declare const isRouteFailed: (route: RouteExtended) => boolean;
|
|
5
|
+
declare const isRouteActive: (route?: RouteExtended) => boolean;
|
|
6
|
+
declare const getSourceTxHash: (route?: RouteExtended) => string | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getSourceTxHash, isRouteActive, isRouteDone, isRouteFailed };
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/stores/routes/utils.ts"],"mappings":";;cAGa,cAAe,OAAO;cAgBtB,gBAAiB,OAAO;cAIxB,gBAAiB,QAAQ;cAgCzB,kBAAmB,QAAQ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SettingsStoreProviderProps } from "./types.js";
|
|
2
|
+
import { JSX, PropsWithChildren } from "react";
|
|
3
|
+
//#region src/stores/settings/SettingsStore.d.ts
|
|
4
|
+
declare const SettingsStoreProvider: ({ children, config }: PropsWithChildren<SettingsStoreProviderProps>) => JSX.Element;
|
|
5
|
+
declare function useSettingsStoreContext(): any;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SettingsStoreProvider, useSettingsStoreContext };
|
|
8
|
+
//# sourceMappingURL=SettingsStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsStore.d.ts","names":[],"sources":["../../../../src/stores/settings/SettingsStore.tsx"],"mappings":";;;cAgBa,0BACX,UACA,UACC,kBAAkB,gCAA8B,IAAI;iBAYvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageResource } from "../../providers/I18nProvider/types.js";
|
|
2
|
+
import { WidgetConfig } from "../../types/widget.js";
|
|
2
3
|
import { Order } from "@lifi/sdk";
|
|
3
|
-
|
|
4
4
|
//#region src/stores/settings/types.d.ts
|
|
5
5
|
interface SettingsProps {
|
|
6
6
|
gasPrice?: string;
|
|
@@ -18,6 +18,9 @@ interface SettingsProps {
|
|
|
18
18
|
_enabledExchanges: Record<string, boolean>;
|
|
19
19
|
smallBalanceThreshold?: string;
|
|
20
20
|
}
|
|
21
|
+
interface SettingsStoreProviderProps {
|
|
22
|
+
config: WidgetConfig;
|
|
23
|
+
}
|
|
21
24
|
//#endregion
|
|
22
|
-
export { SettingsProps };
|
|
25
|
+
export { SettingsProps, SettingsStoreProviderProps };
|
|
23
26
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/settings/types.ts"],"mappings":";;;;UAciB
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/stores/settings/types.ts"],"mappings":";;;;UAciB;EACf;EACA;EACA,gBAAgB;EAChB;EACA,gBAAgB;EAChB;EACA;EACA;EACA;EACA,iBAAiB;EACjB;EACA;EACA,mBAAmB;EACnB;;UAoBe;EACf,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
//#region src/stores/types.d.ts
|
|
3
|
+
interface PersistStoreProps {
|
|
4
|
+
namePrefix?: string;
|
|
5
|
+
}
|
|
6
|
+
type PersistStoreProviderProps = PropsWithChildren<PersistStoreProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PersistStoreProps, PersistStoreProviderProps };
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/stores/types.ts"],"mappings":";;UAEiB;EACf;;KAGU,4BAA4B,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azureLight.d.ts","names":[],"sources":["../../../src/themes/azureLight.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"azureLight.d.ts","names":[],"sources":["../../../src/themes/azureLight.ts"],"mappings":";;cAGa,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.d.ts","names":[],"sources":["../../../src/themes/createTheme.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTheme.d.ts","names":[],"sources":["../../../src/themes/createTheme.ts"],"mappings":";;;cAuCa,gBAAe,cAAa,gBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jumper.d.ts","names":[],"sources":["../../../src/themes/jumper.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"jumper.d.ts","names":[],"sources":["../../../src/themes/jumper.ts"],"mappings":";;cAEa,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palettes.d.ts","names":[],"sources":["../../../src/themes/palettes.ts"],"mappings":";cAAa
|
|
1
|
+
{"version":3,"file":"palettes.d.ts","names":[],"sources":["../../../src/themes/palettes.ts"],"mappings":";cAAa;EACX;IACE;;EAEF;IACE;;EAEF;IACE;;EAEF;IACE;;EAEF;IACE;;EAEF;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;;;cAIS;EACX;IACE;IACA;;EAEF;IACE;IACA;;;cAIS;EACX;IACE;IACA;;EAEF;IACE;IACA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NavigationProps } from "../types/widget.js";
|
|
2
2
|
import { CSSProperties } from "react";
|
|
3
3
|
import { CardProps, ComponentsOverrides, ComponentsVariants, SimplePaletteColorOptions, TabProps, TabsProps } from "@mui/material";
|
|
4
|
-
|
|
5
4
|
//#region src/themes/types.d.ts
|
|
6
5
|
declare module "@mui/material/styles" {
|
|
7
6
|
interface Shape {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/themes/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/themes/types.ts"],"mappings":";;;;;YAcY;IACR;IACA;IACA;;YAEQ;IACR,OAAO;IACP,WAAW;IACX,iBAAiB;IACjB,uBAAuB;IACvB,QAAQ;IACR,YAAY;;YAEJ;IACR,QAAQ,QAAQ;IAChB,YAAY;IACZ,kBAAkB;IAClB,wBAAwB;IACxB,SAAS;IACT,aAAa;;YAEL;IACR;IACA;IACA;;YAEQ;IACR,cAAc,QAAQ;IACtB,mBAAmB,QAAQ;IAC3B,kBAAkB,QAAQ;;YAElB;IACR;MACE,eAAe;MACf,iBAAiB,oBACf,KAAK;MAEP,WAAW;;IAEb;MACE,eAAe;MACf,iBAAiB,oBACf,KAAK;MAEP,WAAW;;IAEb;MACE,eAAe;MACf,iBAAiB,oBACf,KAAK;MAEP,WAAW;;;YAGL;IACR,YAAY;;YAGJ;IACR,aAAa;;;;YAKL;IACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watermelonLight.d.ts","names":[],"sources":["../../../src/themes/watermelonLight.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"watermelonLight.d.ts","names":[],"sources":["../../../src/themes/watermelonLight.ts"],"mappings":";;cAGa,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windows95.d.ts","names":[],"sources":["../../../src/themes/windows95.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"windows95.d.ts","names":[],"sources":["../../../src/themes/windows95.ts"],"mappings":";;cAGa,gBAAgB"}
|
|
@@ -4,7 +4,6 @@ import { TokenAmount as TokenAmount$1 } from "./token.js";
|
|
|
4
4
|
import { SettingsProps } from "../stores/settings/types.js";
|
|
5
5
|
import { NavigationRouteType } from "../utils/navigationRoutes.js";
|
|
6
6
|
import { ChainId, ExecutionAction, Route } from "@lifi/sdk";
|
|
7
|
-
|
|
8
7
|
//#region src/types/events.d.ts
|
|
9
8
|
declare enum WidgetEvent {
|
|
10
9
|
AppearanceChanged = "appearanceChanged",
|
|
@@ -80,7 +79,7 @@ type FormFieldChanged = { [K in keyof DefaultValues]: {
|
|
|
80
79
|
fieldName: K;
|
|
81
80
|
newValue: DefaultValues[K];
|
|
82
81
|
oldValue: DefaultValues[K];
|
|
83
|
-
} }[keyof DefaultValues];
|
|
82
|
+
}; }[keyof DefaultValues];
|
|
84
83
|
type SettingUpdated<K extends keyof SettingsProps = keyof SettingsProps> = {
|
|
85
84
|
setting: K;
|
|
86
85
|
newValue: SettingsProps[K];
|
|
@@ -97,7 +96,9 @@ type LowAddressActivityConfirmed = {
|
|
|
97
96
|
chainId: number;
|
|
98
97
|
};
|
|
99
98
|
type NavigationTabChanged = {
|
|
100
|
-
/** Key of the now-active tab. */
|
|
99
|
+
/** Key of the now-active tab. */
|
|
100
|
+
tab: NavigationTabKey;
|
|
101
|
+
/** Key of the previously active tab, or `undefined` on first render. */
|
|
101
102
|
previousTab?: NavigationTabKey;
|
|
102
103
|
};
|
|
103
104
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","names":[],"sources":["../../../src/types/events.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../../../src/types/events.ts"],"mappings":";;;;;;;aAOY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV,oBAAoB,MAAM;EAC1B,kBAAkB,MAAM;EACxB,cAAc,MAAM;EACpB,iBAAiB,MAAM;EACvB,gCAAgC,MAAM;EACtC,mBAAmB,MAAM;EACzB,8BAA8B,MAAM;EACpC,uBAAuB,MAAM;EAC7B,cAAc,MAAM;EACpB,0BAA0B,MAAM;EAChC,uBAAuB,MAAM;EAC7B,wBAAwB,MAAM;EAC9B,wBAAwB,MAAM;EAC9B,qBAAqB,MAAM;EAC3B,gBAAgB,MAAM;EACtB,sBAAsB;EACtB,iBAAiB,MAAM;EACvB,2BAA2B,MAAM;EACjC,cAAc,MAAM;EACpB,iBAAiB;;KAUP;EACV;;KAGU;EACV;EACA;EACA;EACA;EACA;;KAGU;EACV,OAAO;EACP,QAAQ;;KAGE;EACV,OAAO;EACP,QAAQ;;KAGE;EACV;EACA,QAAQ;;KAGE;EACV,SAAS;EACT;;KAGU,sBACT,WAAW;EACV,WAAW;EACX,UAAU,cAAc;EACxB,UAAU,cAAc;WAEpB;KAEI,eACV,gBAAgB,sBAAsB;EAEtC,SAAS;EACT,UAAU,cAAc;EACxB,UAAU,cAAc;EACxB,aAAa;EACb,aAAa;;KAGH;EACV;EACA;;KAGU;EACV;EACA;;KAGU;;EAEV,KAAK;;EAEL,cAAc"}
|