From 40083ceae15051e431dadbfca310748bac2cb2e7 Mon Sep 17 00:00:00 2001 From: Corban Riley Date: Wed, 15 May 2024 15:35:34 -0400 Subject: [PATCH] packages/kit: Remove barrel files and place explicit exports in root index --- packages/kit/src/components/index.ts | 1 - packages/kit/src/contexts/index.ts | 6 --- packages/kit/src/hooks/index.ts | 10 ---- packages/kit/src/index.ts | 71 +++++++++++++++++++++++++--- packages/kit/src/utils/index.ts | 9 ---- 5 files changed, 65 insertions(+), 32 deletions(-) delete mode 100644 packages/kit/src/components/index.ts delete mode 100644 packages/kit/src/contexts/index.ts delete mode 100644 packages/kit/src/hooks/index.ts delete mode 100644 packages/kit/src/utils/index.ts diff --git a/packages/kit/src/components/index.ts b/packages/kit/src/components/index.ts deleted file mode 100644 index 65e177e3..00000000 --- a/packages/kit/src/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './KitProvider' diff --git a/packages/kit/src/contexts/index.ts b/packages/kit/src/contexts/index.ts deleted file mode 100644 index a1a59864..00000000 --- a/packages/kit/src/contexts/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './KitConfig' - -export * from './Analytics' -export * from './ConnectModal' -export * from './Theme' -export * from './WalletSettings' diff --git a/packages/kit/src/hooks/index.ts b/packages/kit/src/hooks/index.ts deleted file mode 100644 index bf189d14..00000000 --- a/packages/kit/src/hooks/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './useOpenConnectModal' -export * from './useTheme' -export * from './useWalletSettings' -export * from './useWaasFeeOptions' -export * from './useProjectAccessKey' -export * from './useAPIClient' -export * from './useMetadataClient' -export * from './useIndexerClient' -export * from './useStorage' -export * from './data' diff --git a/packages/kit/src/index.ts b/packages/kit/src/index.ts index 274007b7..9e3a7296 100644 --- a/packages/kit/src/index.ts +++ b/packages/kit/src/index.ts @@ -1,6 +1,65 @@ -export * from './components' -export * from './constants' -export * from './hooks' -export * from './contexts' -export * from './utils' -export * from './types' +// Provider +export { KitProvider } from './components/KitProvider' + +// Types +export type { + Wallet, + WalletField, + WalletProperties, + DisplayedAsset, + ExtendedConnector, + EthAuthSettings, + Theme, + ModalPosition, + KitConfig, + StorageItem +} from './types' + +// Constants +export { LocalStorageKey, defaultSignInOptions, DEFAULT_SESSION_EXPIRATION } from './constants' + +// Utils +export { getKitConnectWallets } from './utils/getKitConnectWallets' +export { isEmailValid, compareAddress, formatDisplay } from './utils/helpers' +export { defaultNativeTokenInfo, getNativeTokenInfoByChainId, getChainIdList } from './utils/tokens' +export { createGenericContext } from './utils/genericContext' +export { getModalPositionCss } from './utils/styling' +export { getNetwork, getNetworkColor, getNetworkBackgroundColor } from './utils/networks' +export { walletClientToSigner, publicClientToProvider } from './utils/adapters' +export { signEthAuthProof, validateEthProof } from './utils/ethAuth' +export { capitalize } from './utils/string' + +// Contexts +export { useKitConfig, KitConfigContextProvider } from './contexts/KitConfig' +export { useAnalyticsContext, AnalyticsContextProvider } from './contexts/Analytics' +export { useConnectModalContext, ConnectModalContextProvider } from './contexts/ConnectModal' +export { useThemeContext, ThemeContextProvider } from './contexts/Theme' +export { useWalletConfigContext, WalletConfigContextProvider } from './contexts/WalletSettings' + +// Hooks +export { useOpenConnectModal } from './hooks/useOpenConnectModal' +export { useTheme } from './hooks/useTheme' +export { useWalletSettings } from './hooks/useWalletSettings' +export { useWaasFeeOptions } from './hooks/useWaasFeeOptions' +export { useProjectAccessKey } from './hooks/useProjectAccessKey' +export { useAPIClient } from './hooks/useAPIClient' +export { useMetadataClient } from './hooks/useMetadataClient' +export { useIndexerClient, useIndexerClients } from './hooks/useIndexerClient' +export { useStorage, useStorageItem } from './hooks/useStorage' +export { + getNativeTokenBalance, + getCollectionBalance, + getCoinPrices, + getTransactionHistory, + useBalances, + useExchangeRate, + getTokenBalances, + useCoinBalance, + useCoinPrices, + useCollectionBalance, + useCollectibleBalance, + useCollectiblePrices, + useTokenMetadata, + useContractInfo, + useTransactionHistory +} from './hooks/data' diff --git a/packages/kit/src/utils/index.ts b/packages/kit/src/utils/index.ts deleted file mode 100644 index bb8ec778..00000000 --- a/packages/kit/src/utils/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './getKitConnectWallets' -export * from './helpers' -export * from './tokens' -export * from './genericContext' -export * from './styling' -export * from './networks' -export * from './adapters' -export * from './ethAuth' -export * from './string'