diff --git a/examples/next/package.json b/examples/next/package.json index 9784cbfd..30024d11 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -10,7 +10,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@0xsequence/design-system": "^1.7.0", + "@0xsequence/design-system": "^1.7.1", "@0xsequence/kit": "workspace:*", "@0xsequence/kit-checkout": "workspace:*", "@0xsequence/kit-connectors": "workspace:*", diff --git a/examples/next/src/app/Web3Provider.tsx b/examples/next/src/app/Providers.tsx similarity index 60% rename from examples/next/src/app/Web3Provider.tsx rename to examples/next/src/app/Providers.tsx index 2734ac09..0860764b 100644 --- a/examples/next/src/app/Web3Provider.tsx +++ b/examples/next/src/app/Providers.tsx @@ -1,24 +1,25 @@ 'use client' -import { KitProvider } from '@0xsequence/kit' +import { KitProvider } from '@0xsequence/kit/components' import { KitCheckoutProvider } from '@0xsequence/kit-checkout' import { KitWalletProvider } from '@0xsequence/kit-wallet' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { WagmiProvider } from 'wagmi' +import { State, WagmiProvider } from 'wagmi' -import { wagmiConfig, kitConfig } from './config' +import { kitConfig, wagmiConfig } from '@/config' const queryClient = new QueryClient() -export interface Web3ProviderProps { +export interface ProvidersProps { + initialState: State | undefined children: React.ReactNode } -export const Web3Provider = (props: Web3ProviderProps) => { - const { children } = props +export const Providers = (props: ProvidersProps) => { + const { initialState, children } = props return ( - + diff --git a/examples/next/src/app/WalletOptions.tsx b/examples/next/src/app/WalletOptions.tsx deleted file mode 100644 index 53856e8f..00000000 --- a/examples/next/src/app/WalletOptions.tsx +++ /dev/null @@ -1,17 +0,0 @@ -'use client' - -import { useConnect } from 'wagmi' - -export const WalletOptions = () => { - const { connectors, connect } = useConnect() - - return ( -
- {connectors.map(connector => ( - - ))} -
- ) -} diff --git a/examples/next/src/app/components/Connected.tsx b/examples/next/src/app/components/Connected.tsx index 897534bd..3e4c90ec 100644 --- a/examples/next/src/app/components/Connected.tsx +++ b/examples/next/src/app/components/Connected.tsx @@ -1,5 +1,6 @@ import { Box, Text, Card, Button, Select, SignoutIcon } from '@0xsequence/design-system' -import { signEthAuthProof, useIndexerClient, useStorage, useWaasFeeOptions, validateEthProof } from '@0xsequence/kit' +import { signEthAuthProof, validateEthProof } from '@0xsequence/kit' +import { useIndexerClient, useWaasFeeOptions, useStorage } from '@0xsequence/kit/hooks' import { CheckoutSettings } from '@0xsequence/kit-checkout' import { useOpenWalletModal } from '@0xsequence/kit-wallet' import { allNetworks } from '@0xsequence/network' @@ -16,7 +17,7 @@ import { useWriteContract } from 'wagmi' -import { isDebugMode } from '../config' +import { isDebugMode } from '../../config' import { Header } from './Header' @@ -53,7 +54,9 @@ export const Connected = () => { }, [pendingFeeOptionConfirmation]) useEffect(() => { - console.log(error?.message) + if (error?.message) { + console.log(error?.message) + } }, [error]) const chainId = useChainId() diff --git a/examples/next/src/app/components/Header.tsx b/examples/next/src/app/components/Header.tsx index db644031..f10beb3b 100644 --- a/examples/next/src/app/components/Header.tsx +++ b/examples/next/src/app/components/Header.tsx @@ -9,7 +9,7 @@ export const Header = () => { return ( - Sequence kit + Sequence kit { }} src="kit-logo-text.svg" alt="Sequence Kit Text Logo" + disableAnimation /> diff --git a/examples/next/src/app/layout.tsx b/examples/next/src/app/layout.tsx index d1ecdb49..ab631e1b 100644 --- a/examples/next/src/app/layout.tsx +++ b/examples/next/src/app/layout.tsx @@ -1,11 +1,14 @@ +import './globals.css' +import '@0xsequence/design-system/styles.css' import { ThemeProvider } from '@0xsequence/design-system' import type { Metadata } from 'next' import { Inter } from 'next/font/google' +import { headers } from 'next/headers' +import { cookieToInitialState } from 'wagmi' -import './globals.css' -import '@0xsequence/design-system/styles.css' +import { wagmiConfig } from '../config' -import { Web3Provider } from './Web3Provider' +import { Providers } from './Providers' const inter = Inter({ subsets: ['latin'] }) @@ -19,11 +22,13 @@ export default function RootLayout({ }: Readonly<{ children: React.ReactNode }>) { + const initialState = cookieToInitialState(wagmiConfig, headers().get('cookie')) + return ( - {children} + {children} diff --git a/examples/next/src/app/page.tsx b/examples/next/src/app/page.tsx index c5fdc509..9faa6440 100644 --- a/examples/next/src/app/page.tsx +++ b/examples/next/src/app/page.tsx @@ -1,52 +1,41 @@ 'use client' import { Box, Image, Button } from '@0xsequence/design-system' -import { useOpenConnectModal } from '@0xsequence/kit' -import { useEffect, useState } from 'react' +import { useOpenConnectModal } from '@0xsequence/kit/hooks' import { useAccount } from 'wagmi' import { Connected } from './components/Connected' import { Footer } from './components/Footer' export default function Home() { - const [isClient, setIsClient] = useState(false) const { isConnected } = useAccount() const { setOpenConnectModal } = useOpenConnectModal() - useEffect(() => { - setIsClient(true) - }, []) - return (
- {isClient ? ( - <> - {!isConnected ? ( - - - Next - - - Sequence Kit Logo - Sequence Kit Text Logo - - -
) diff --git a/examples/next/src/app/config.ts b/examples/next/src/config.ts similarity index 92% rename from examples/next/src/app/config.ts rename to examples/next/src/config.ts index 45c4716f..df2214ee 100644 --- a/examples/next/src/app/config.ts +++ b/examples/next/src/config.ts @@ -2,7 +2,7 @@ import { KitConfig, getKitConnectWallets } from '@0xsequence/kit' import { getDefaultConnectors, getDefaultWaasConnectors, mock } from '@0xsequence/kit-connectors' import { findNetworkConfig, allNetworks } from '@0xsequence/network' import { Transport, zeroAddress } from 'viem' -import { createConfig, createStorage, http, noopStorage } from 'wagmi' +import { createConfig, createStorage, http, noopStorage, cookieStorage } from 'wagmi' import { Chain, arbitrumNova, arbitrumSepolia, mainnet, polygon } from 'wagmi/chains' export type ConnectionMode = 'waas' | 'universal' @@ -83,9 +83,10 @@ export const wagmiConfig = createConfig({ transports, chains, connectors: connectionMode === 'waas' ? getWaasConnectors() : getUniversalConnectors(), - storage: createStorage({ - storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage - }), + // storage: createStorage({ + // storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage + // }), + storage: createStorage({ storage: cookieStorage }), ssr: true }) diff --git a/examples/react/package.json b/examples/react/package.json index f34a3fce..6e55050c 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -12,7 +12,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@0xsequence/design-system": "^1.7.0", + "@0xsequence/design-system": "^1.7.1", "@0xsequence/kit": "workspace:*", "@0xsequence/kit-checkout": "workspace:*", "@0xsequence/kit-connectors": "workspace:*", diff --git a/examples/react/src/App.tsx b/examples/react/src/App.tsx index 58b47e46..d9dd7378 100644 --- a/examples/react/src/App.tsx +++ b/examples/react/src/App.tsx @@ -1,7 +1,7 @@ import '@0xsequence/design-system/styles.css' import { ThemeProvider } from '@0xsequence/design-system' -import { KitProvider } from '@0xsequence/kit' +import { KitProvider } from '@0xsequence/kit/components' import { KitCheckoutProvider } from '@0xsequence/kit-checkout' import { KitWalletProvider } from '@0xsequence/kit-wallet' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' diff --git a/examples/react/src/components/Homepage.tsx b/examples/react/src/components/Homepage.tsx index 901be570..55938a54 100644 --- a/examples/react/src/components/Homepage.tsx +++ b/examples/react/src/components/Homepage.tsx @@ -16,14 +16,8 @@ import { Modal, TextInput } from '@0xsequence/design-system' -import { - useOpenConnectModal, - signEthAuthProof, - validateEthProof, - useTheme as useKitTheme, - getModalPositionCss, - useStorage -} from '@0xsequence/kit' +import { getModalPositionCss, signEthAuthProof, validateEthProof } from '@0xsequence/kit' +import { useOpenConnectModal, useTheme as useKitTheme, useStorage } from '@0xsequence/kit/hooks' import { useCheckoutModal } from '@0xsequence/kit-checkout' import { useOpenWalletModal } from '@0xsequence/kit-wallet' import { allNetworks } from '@0xsequence/network' diff --git a/packages/checkout/package.json b/packages/checkout/package.json index a0a9207b..5feca97c 100644 --- a/packages/checkout/package.json +++ b/packages/checkout/package.json @@ -23,7 +23,7 @@ "react-copy-to-clipboard": "^5.1.0" }, "peerDependencies": { - "@0xsequence/design-system": ">=1.7.0", + "@0xsequence/design-system": ">=1.7.1", "@0xsequence/kit": "workspace:*", "ethers": ">=5.7.2", "framer-motion": ">=8.5.2", @@ -33,7 +33,7 @@ "viem": ">=2.0.0" }, "devDependencies": { - "@0xsequence/design-system": "^1.7.0", + "@0xsequence/design-system": "^1.7.1", "@0xsequence/kit": "workspace:*", "@types/react-copy-to-clipboard": "^5.0.4", "babel-plugin-module-resolver": "^5.0.2", diff --git a/packages/checkout/src/contexts/CheckoutModal.tsx b/packages/checkout/src/contexts/CheckoutModal.tsx index 58a57936..c06a9e8e 100644 --- a/packages/checkout/src/contexts/CheckoutModal.tsx +++ b/packages/checkout/src/contexts/CheckoutModal.tsx @@ -1,4 +1,6 @@ -import { createGenericContext, Theme } from '@0xsequence/kit' +import { Theme } from '@0xsequence/kit' + +import { createGenericContext } from './genericContext' interface CoinQuantity { contractAddress: string diff --git a/packages/checkout/src/contexts/Navigation.tsx b/packages/checkout/src/contexts/Navigation.tsx index 1fc3fe16..90b91497 100644 --- a/packages/checkout/src/contexts/Navigation.tsx +++ b/packages/checkout/src/contexts/Navigation.tsx @@ -1,4 +1,4 @@ -import { createGenericContext } from '@0xsequence/kit' +import { createGenericContext } from './genericContext' export interface SelectCheckoutNavigation { location: 'select-method-checkout' diff --git a/packages/kit/src/utils/genericContext.ts b/packages/checkout/src/contexts/genericContext.ts similarity index 100% rename from packages/kit/src/utils/genericContext.ts rename to packages/checkout/src/contexts/genericContext.ts diff --git a/packages/checkout/src/shared/components/KitCheckoutProvider.tsx b/packages/checkout/src/shared/components/KitCheckoutProvider.tsx index 1fdbed0b..c3cfa280 100644 --- a/packages/checkout/src/shared/components/KitCheckoutProvider.tsx +++ b/packages/checkout/src/shared/components/KitCheckoutProvider.tsx @@ -1,5 +1,6 @@ import { Box, Modal, ThemeProvider } from '@0xsequence/design-system' -import { getModalPositionCss, useTheme } from '@0xsequence/kit' +import { getModalPositionCss } from '@0xsequence/kit' +import { useTheme } from '@0xsequence/kit/hooks' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { AnimatePresence } from 'framer-motion' import React, { useState, useEffect } from 'react' diff --git a/packages/checkout/src/views/CheckoutSelection/component/OrderSummaryItem.tsx b/packages/checkout/src/views/CheckoutSelection/component/OrderSummaryItem.tsx index c26e6fe1..ee49c7ae 100644 --- a/packages/checkout/src/views/CheckoutSelection/component/OrderSummaryItem.tsx +++ b/packages/checkout/src/views/CheckoutSelection/component/OrderSummaryItem.tsx @@ -1,5 +1,5 @@ import { Box, Card, Image, Text, Skeleton, TokenImage, NetworkImage } from '@0xsequence/design-system' -import { useContractInfo, useTokenMetadata } from '@0xsequence/kit' +import { useContractInfo, useTokenMetadata } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' diff --git a/packages/checkout/src/views/CheckoutSelection/index.tsx b/packages/checkout/src/views/CheckoutSelection/index.tsx index ec4681e0..14f205cf 100644 --- a/packages/checkout/src/views/CheckoutSelection/index.tsx +++ b/packages/checkout/src/views/CheckoutSelection/index.tsx @@ -11,7 +11,8 @@ import { Skeleton, TokenImage } from '@0xsequence/design-system' -import { getNativeTokenInfoByChainId, useBalances, useContractInfo, useTokenMetadata, useProjectAccessKey } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useBalances, useContractInfo, useTokenMetadata, useProjectAccessKey } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' import { useAccount, useConfig } from 'wagmi' diff --git a/packages/checkout/src/views/PendingTransaction.tsx b/packages/checkout/src/views/PendingTransaction.tsx index 28494966..6a4e9322 100644 --- a/packages/checkout/src/views/PendingTransaction.tsx +++ b/packages/checkout/src/views/PendingTransaction.tsx @@ -1,5 +1,5 @@ import { Box } from '@0xsequence/design-system' -import { useProjectAccessKey } from '@0xsequence/kit' +import { useProjectAccessKey } from '@0xsequence/kit/hooks' import React, { useEffect } from 'react' import { fetchSardineOrderStatus } from '../api' diff --git a/packages/kit/components/package.json b/packages/kit/components/package.json new file mode 100644 index 00000000..6f401c43 --- /dev/null +++ b/packages/kit/components/package.json @@ -0,0 +1,4 @@ +{ + "main": "dist/0xsequence-kit-components.cjs.js", + "module": "dist/0xsequence-kit-components.esm.js" +} diff --git a/packages/kit/contexts/package.json b/packages/kit/contexts/package.json new file mode 100644 index 00000000..c5b3112c --- /dev/null +++ b/packages/kit/contexts/package.json @@ -0,0 +1,4 @@ +{ + "main": "dist/0xsequence-kit-contexts.cjs.js", + "module": "dist/0xsequence-kit-contexts.esm.js" +} diff --git a/packages/kit/hooks/package.json b/packages/kit/hooks/package.json new file mode 100644 index 00000000..455e1966 --- /dev/null +++ b/packages/kit/hooks/package.json @@ -0,0 +1,4 @@ +{ + "main": "dist/0xsequence-kit-hooks.cjs.js", + "module": "dist/0xsequence-kit-hooks.esm.js" +} diff --git a/packages/kit/package.json b/packages/kit/package.json index f677192f..25262451 100644 --- a/packages/kit/package.json +++ b/packages/kit/package.json @@ -21,7 +21,7 @@ "@0xsequence/api": "^1.9.26", "@0xsequence/auth": "^1.9.26", "@0xsequence/core": "^1.9.26", - "@0xsequence/design-system": "^1.7.0", + "@0xsequence/design-system": "^1.7.1", "@0xsequence/ethauth": "^0.8.1", "@0xsequence/indexer": "^1.9.26", "@0xsequence/kit-connectors": "workspace:*", @@ -52,6 +52,17 @@ }, "files": [ "src", - "dist" - ] + "dist", + "components", + "hooks", + "contexts" + ], + "preconstruct": { + "entrypoints": [ + "index.ts", + "components/index.ts", + "hooks/index.ts", + "contexts/index.ts" + ] + } } diff --git a/packages/kit/src/components/KitProvider/index.tsx b/packages/kit/src/components/KitProvider/index.tsx index 4ad2bfc8..5f18dd1a 100644 --- a/packages/kit/src/components/KitProvider/index.tsx +++ b/packages/kit/src/components/KitProvider/index.tsx @@ -1,3 +1,5 @@ +'use client' + import { sequence } from '0xsequence' import { Box, Button, Card, Collapsible, Modal, Text, ThemeProvider } from '@0xsequence/design-system' import { GoogleOAuthProvider } from '@react-oauth/google' diff --git a/packages/kit/src/components/TxnDetails/index.tsx b/packages/kit/src/components/TxnDetails/index.tsx index ebfe4c52..94643aaa 100644 --- a/packages/kit/src/components/TxnDetails/index.tsx +++ b/packages/kit/src/components/TxnDetails/index.tsx @@ -1,7 +1,7 @@ import { commons } from '@0xsequence/core' import { Box, Card, GradientAvatar, Skeleton, Text, TokenImage } from '@0xsequence/design-system' import { ContractType } from '@0xsequence/indexer' -import { useTokenMetadata, useBalances } from '@0xsequence/kit' +import { useTokenMetadata, useBalances } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React, { useEffect, useState } from 'react' import { useConfig } from 'wagmi' diff --git a/packages/kit/src/components/index.ts b/packages/kit/src/components/index.ts index 65e177e3..26c50ee1 100644 --- a/packages/kit/src/components/index.ts +++ b/packages/kit/src/components/index.ts @@ -1 +1,3 @@ +'use client' + export * from './KitProvider' diff --git a/packages/kit/src/constants/localStorage.ts b/packages/kit/src/constants/localStorage.ts index f9046fa6..fb53dbce 100644 --- a/packages/kit/src/constants/localStorage.ts +++ b/packages/kit/src/constants/localStorage.ts @@ -14,8 +14,8 @@ const WAAS_ACTIVE_LOGIN_TYPE = 'waasActiveLoginType' // TODO: remove all of this.. we should not be storing these in local storage export enum LocalStorageKey { - Settings = `${PREFIX}.${SETTINGS}`, - Theme = `${PREFIX}.${THEME}`, + Settings = `${PREFIX}.${SETTINGS}`, // Wallet settings + Theme = `${PREFIX}.${THEME}`, // Wallet theme EthAuthProof = `${PREFIX}.${ETHAUTH_PROOF}`, EthAuthSettings = `${PREFIX}.${ETHAUTH_SETTINGS}`, WaasGoogleClientID = `${PREFIX}.${WAAS_GOOGLE_CLIENT_ID}`, diff --git a/packages/kit/src/contexts/Analytics.ts b/packages/kit/src/contexts/Analytics.ts index 51fb1695..98f3ec2f 100644 --- a/packages/kit/src/contexts/Analytics.ts +++ b/packages/kit/src/contexts/Analytics.ts @@ -1,7 +1,7 @@ import { sequence } from '0xsequence' import React from 'react' -import { createGenericContext } from '../utils' +import { createGenericContext } from './genericContext' type AnalyticsContext = { setAnalytics: React.Dispatch> diff --git a/packages/kit/src/contexts/ConnectModal.ts b/packages/kit/src/contexts/ConnectModal.ts index 8cc71438..727338c7 100644 --- a/packages/kit/src/contexts/ConnectModal.ts +++ b/packages/kit/src/contexts/ConnectModal.ts @@ -1,6 +1,6 @@ import React from 'react' -import { createGenericContext } from '../utils' +import { createGenericContext } from './genericContext' type ConnectModalContext = { setOpenConnectModal: React.Dispatch> diff --git a/packages/kit/src/contexts/KitConfig.ts b/packages/kit/src/contexts/KitConfig.ts index 266f8bba..a7cc9cbb 100644 --- a/packages/kit/src/contexts/KitConfig.ts +++ b/packages/kit/src/contexts/KitConfig.ts @@ -1,4 +1,5 @@ import { KitConfig } from '../types' -import { createGenericContext } from '../utils' + +import { createGenericContext } from './genericContext' export const [useKitConfig, KitConfigContextProvider] = createGenericContext() diff --git a/packages/kit/src/contexts/Theme.ts b/packages/kit/src/contexts/Theme.ts index 5bc1d10f..5931f368 100644 --- a/packages/kit/src/contexts/Theme.ts +++ b/packages/kit/src/contexts/Theme.ts @@ -1,7 +1,8 @@ import React from 'react' -import { ModalPosition, Theme } from '../index' -import { createGenericContext } from '../utils' +import { ModalPosition, Theme } from '../types' + +import { createGenericContext } from './genericContext' type ThemeContext = { setTheme: React.Dispatch> diff --git a/packages/kit/src/contexts/WalletSettings.ts b/packages/kit/src/contexts/WalletSettings.ts index 5551c507..722adc2d 100644 --- a/packages/kit/src/contexts/WalletSettings.ts +++ b/packages/kit/src/contexts/WalletSettings.ts @@ -1,7 +1,8 @@ import React from 'react' import { DisplayedAsset } from '../types' -import { createGenericContext } from '../utils' + +import { createGenericContext } from './genericContext' type WalletConfigContext = { setDisplayedAssets: React.Dispatch> diff --git a/packages/kit/src/contexts/genericContext.ts b/packages/kit/src/contexts/genericContext.ts new file mode 100644 index 00000000..0ca6a4c9 --- /dev/null +++ b/packages/kit/src/contexts/genericContext.ts @@ -0,0 +1,19 @@ +import { useContext, createContext } from 'react' + +// https://medium.com/@rivoltafilippo/typing-react-context-to-avoid-an-undefined-default-value-2c7c5a7d5947 + +export const createGenericContext = () => { + // Create a context with a generic parameter or undefined + const genericContext = createContext(undefined) + + // Check if the value provided to the context is defined or throw an error + const useGenericContext = () => { + const contextIsDefined = useContext(genericContext) + if (!contextIsDefined) { + throw new Error('useGenericContext must be used within a Provider') + } + return contextIsDefined + } + + return [useGenericContext, genericContext.Provider] as const +} diff --git a/packages/kit/src/index.ts b/packages/kit/src/index.ts index 274007b7..b3343965 100644 --- a/packages/kit/src/index.ts +++ b/packages/kit/src/index.ts @@ -1,6 +1,6 @@ -export * from './components' +// export * from './components' +// export * from './hooks' +// export * from './contexts' export * from './constants' -export * from './hooks' -export * from './contexts' export * from './utils' export * from './types' diff --git a/packages/kit/src/utils/index.ts b/packages/kit/src/utils/index.ts index bb8ec778..49b0b485 100644 --- a/packages/kit/src/utils/index.ts +++ b/packages/kit/src/utils/index.ts @@ -1,7 +1,6 @@ export * from './getKitConnectWallets' export * from './helpers' export * from './tokens' -export * from './genericContext' export * from './styling' export * from './networks' export * from './adapters' diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 98f46f91..009170cf 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -27,7 +27,7 @@ "react-copy-to-clipboard": "^5.1.0" }, "peerDependencies": { - "@0xsequence/design-system": ">=1.7.0", + "@0xsequence/design-system": ">=1.7.1", "@0xsequence/kit": "workspace:*", "ethers": ">=5.7.2", "framer-motion": ">=8.5.2", @@ -37,7 +37,7 @@ "viem": ">=2.0.0" }, "devDependencies": { - "@0xsequence/design-system": "^1.7.0", + "@0xsequence/design-system": "^1.7.1", "@0xsequence/kit": "workspace:*", "@types/react-copy-to-clipboard": "^5.0.4", "babel-plugin-module-resolver": "^5.0.2", diff --git a/packages/wallet/src/hooks/data.ts b/packages/wallet/src/hooks/data.ts index f5bda6a2..0fe40be9 100644 --- a/packages/wallet/src/hooks/data.ts +++ b/packages/wallet/src/hooks/data.ts @@ -1,16 +1,16 @@ import { SequenceAPIClient, TokenPrice } from '@0xsequence/api' import { Transaction, TokenBalance, SequenceIndexer } from '@0xsequence/indexer' +import { DisplayedAsset } from '@0xsequence/kit' import { getTransactionHistory, useAPIClient, useIndexerClients, - DisplayedAsset, getNativeTokenBalance, getTokenBalances, getCoinPrices, getCollectionBalance, useMetadataClient -} from '@0xsequence/kit' +} from '@0xsequence/kit/hooks' import { GetContractInfoBatchReturn, SequenceMetadata } from '@0xsequence/metadata' import { useQuery } from '@tanstack/react-query' import { ethers } from 'ethers' diff --git a/packages/wallet/src/shared/KitWalletProvider/index.tsx b/packages/wallet/src/shared/KitWalletProvider/index.tsx index de9aa9a8..4cf979b6 100644 --- a/packages/wallet/src/shared/KitWalletProvider/index.tsx +++ b/packages/wallet/src/shared/KitWalletProvider/index.tsx @@ -1,5 +1,6 @@ import { Box, Modal, ThemeProvider, Scroll } from '@0xsequence/design-system' -import { getModalPositionCss, useTheme } from '@0xsequence/kit' +import { getModalPositionCss } from '@0xsequence/kit' +import { useTheme } from '@0xsequence/kit/hooks' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { AnimatePresence } from 'framer-motion' import React, { useState, useEffect } from 'react' diff --git a/packages/wallet/src/shared/TransactionHistoryList/TransactionHistoryItem.tsx b/packages/wallet/src/shared/TransactionHistoryList/TransactionHistoryItem.tsx index e312a0a9..5c430bdb 100644 --- a/packages/wallet/src/shared/TransactionHistoryList/TransactionHistoryItem.tsx +++ b/packages/wallet/src/shared/TransactionHistoryList/TransactionHistoryItem.tsx @@ -1,7 +1,8 @@ import { TokenPrice } from '@0xsequence/api' import { ArrowRightIcon, Box, Text, Image, TransactionIcon, vars, Skeleton, NetworkImage } from '@0xsequence/design-system' import { Transaction, TxnTransfer, TxnTransferType } from '@0xsequence/indexer' -import { getNativeTokenInfoByChainId, useCoinPrices, useExchangeRate } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useCoinPrices, useExchangeRate } from '@0xsequence/kit/hooks' import dayjs from 'dayjs' import { ethers } from 'ethers' import React from 'react' diff --git a/packages/wallet/src/shared/WalletHeader/components/WalletDropdownContent.tsx b/packages/wallet/src/shared/WalletHeader/components/WalletDropdownContent.tsx index 2cd31394..bd439211 100644 --- a/packages/wallet/src/shared/WalletHeader/components/WalletDropdownContent.tsx +++ b/packages/wallet/src/shared/WalletHeader/components/WalletDropdownContent.tsx @@ -11,7 +11,7 @@ import { TransactionIcon, vars } from '@0xsequence/design-system' -import { useTheme } from '@0xsequence/kit' +import { useTheme } from '@0xsequence/kit/hooks' import React, { forwardRef } from 'react' import { useDisconnect, useAccount } from 'wagmi' diff --git a/packages/wallet/src/views/CoinDetails/index.tsx b/packages/wallet/src/views/CoinDetails/index.tsx index 6a24d007..2a0f0d2d 100644 --- a/packages/wallet/src/views/CoinDetails/index.tsx +++ b/packages/wallet/src/views/CoinDetails/index.tsx @@ -1,11 +1,6 @@ import { Box, Button, Image, SendIcon, Text } from '@0xsequence/design-system' -import { - getNativeTokenInfoByChainId, - useExchangeRate, - useCoinPrices, - useTransactionHistory, - useCoinBalance -} from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useExchangeRate, useCoinPrices, useTransactionHistory, useCoinBalance } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' import { useAccount, useConfig } from 'wagmi' diff --git a/packages/wallet/src/views/CollectibleDetails/index.tsx b/packages/wallet/src/views/CollectibleDetails/index.tsx index cedaa458..7b0c3bec 100644 --- a/packages/wallet/src/views/CollectibleDetails/index.tsx +++ b/packages/wallet/src/views/CollectibleDetails/index.tsx @@ -1,5 +1,5 @@ import { Box, Button, Image, NetworkImage, SendIcon, Text } from '@0xsequence/design-system' -import { useExchangeRate, useTransactionHistory, useCollectiblePrices, useCollectibleBalance } from '@0xsequence/kit' +import { useExchangeRate, useTransactionHistory, useCollectiblePrices, useCollectibleBalance } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' import { useAccount } from 'wagmi' diff --git a/packages/wallet/src/views/CollectionDetails/index.tsx b/packages/wallet/src/views/CollectionDetails/index.tsx index 27590c6b..6e20142c 100644 --- a/packages/wallet/src/views/CollectionDetails/index.tsx +++ b/packages/wallet/src/views/CollectionDetails/index.tsx @@ -1,6 +1,6 @@ import { Box, Image, Text, TokenImage, vars } from '@0xsequence/design-system' import { TokenBalance } from '@0xsequence/indexer' -import { useCollectionBalance } from '@0xsequence/kit' +import { useCollectionBalance } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' import { useAccount } from 'wagmi' diff --git a/packages/wallet/src/views/Home/components/AssetSummary/CoinTile/index.tsx b/packages/wallet/src/views/Home/components/AssetSummary/CoinTile/index.tsx index 85b4c3c0..dbee41b5 100644 --- a/packages/wallet/src/views/Home/components/AssetSummary/CoinTile/index.tsx +++ b/packages/wallet/src/views/Home/components/AssetSummary/CoinTile/index.tsx @@ -1,11 +1,11 @@ import { Box } from '@0xsequence/design-system' import { TokenBalance } from '@0xsequence/indexer' -import { getNativeTokenInfoByChainId, useContractInfo, useExchangeRate, useCoinPrices } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useContractInfo, useExchangeRate, useCoinPrices } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React from 'react' import { useConfig } from 'wagmi' - import { useSettings } from '../../../../../hooks' import { computeBalanceFiat, formatDisplay, getPercentagePriceChange, compareAddress } from '../../../../../utils' diff --git a/packages/wallet/src/views/Home/components/AssetSummary/CollectibleTile/index.tsx b/packages/wallet/src/views/Home/components/AssetSummary/CollectibleTile/index.tsx index bf92bcee..dc6f3823 100644 --- a/packages/wallet/src/views/Home/components/AssetSummary/CollectibleTile/index.tsx +++ b/packages/wallet/src/views/Home/components/AssetSummary/CollectibleTile/index.tsx @@ -1,10 +1,9 @@ import { TokenBalance } from '@0xsequence/indexer' -import { useTokenMetadata } from '@0xsequence/kit' +import { useTokenMetadata } from '@0xsequence/kit/hooks' import React from 'react' import { CollectibleTileImage } from '../../../../../shared/CollectibleTileImage' - interface CollectibleTileProps { balance: TokenBalance } diff --git a/packages/wallet/src/views/Home/components/AssetSummary/index.tsx b/packages/wallet/src/views/Home/components/AssetSummary/index.tsx index f60e6aeb..36b2e91a 100644 --- a/packages/wallet/src/views/Home/components/AssetSummary/index.tsx +++ b/packages/wallet/src/views/Home/components/AssetSummary/index.tsx @@ -1,6 +1,6 @@ import { Box, vars } from '@0xsequence/design-system' import { TokenBalance } from '@0xsequence/indexer' -import { useWalletSettings } from '@0xsequence/kit' +import { useWalletSettings } from '@0xsequence/kit/hooks' import React from 'react' import { useAccount } from 'wagmi' @@ -11,7 +11,6 @@ import { CoinTile } from './CoinTile' import { CollectibleTile } from './CollectibleTile' import { SkeletonTiles } from './SkeletonTiles' - export const AssetSummary = () => { const { address } = useAccount() const { setNavigation } = useNavigation() diff --git a/packages/wallet/src/views/Search/SearchWallet.tsx b/packages/wallet/src/views/Search/SearchWallet.tsx index e1d3742b..2c0ba242 100644 --- a/packages/wallet/src/views/Search/SearchWallet.tsx +++ b/packages/wallet/src/views/Search/SearchWallet.tsx @@ -1,5 +1,6 @@ import { Box, SearchIcon, Skeleton, Text, TextInput } from '@0xsequence/design-system' -import { getNativeTokenInfoByChainId, useExchangeRate, useCoinPrices, useBalances } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useExchangeRate, useCoinPrices, useBalances } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import Fuse from 'fuse.js' import React, { useState } from 'react' diff --git a/packages/wallet/src/views/Search/SearchWalletViewAll.tsx b/packages/wallet/src/views/Search/SearchWalletViewAll.tsx index 6d9558ef..e1886885 100644 --- a/packages/wallet/src/views/Search/SearchWalletViewAll.tsx +++ b/packages/wallet/src/views/Search/SearchWalletViewAll.tsx @@ -1,5 +1,6 @@ import { Box, SearchIcon, Skeleton, TabsContent, TabsHeader, TabsRoot, Text, TextInput } from '@0xsequence/design-system' -import { getNativeTokenInfoByChainId, useExchangeRate, useCoinPrices, useBalances } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useExchangeRate, useCoinPrices, useBalances } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import Fuse from 'fuse.js' import React, { useState, useEffect } from 'react' diff --git a/packages/wallet/src/views/SendCoin.tsx b/packages/wallet/src/views/SendCoin.tsx index 8aa6ea2e..55741043 100644 --- a/packages/wallet/src/views/SendCoin.tsx +++ b/packages/wallet/src/views/SendCoin.tsx @@ -13,14 +13,9 @@ import { Card } from '@0xsequence/design-system' import { TokenBalance } from '@0xsequence/indexer' -import { - getNativeTokenInfoByChainId, - useAnalyticsContext, - ExtendedConnector, - useExchangeRate, - useCoinPrices, - useBalances -} from '@0xsequence/kit' +import { getNativeTokenInfoByChainId, ExtendedConnector } from '@0xsequence/kit' +import { useAnalyticsContext } from '@0xsequence/kit/contexts' +import { useExchangeRate, useCoinPrices, useBalances } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React, { useState, ChangeEvent, useRef } from 'react' import { useAccount, useChainId, useSwitchChain, useConfig, useSendTransaction } from 'wagmi' diff --git a/packages/wallet/src/views/SendCollectible.tsx b/packages/wallet/src/views/SendCollectible.tsx index 1cacdf50..15d983f0 100644 --- a/packages/wallet/src/views/SendCollectible.tsx +++ b/packages/wallet/src/views/SendCollectible.tsx @@ -15,7 +15,9 @@ import { Card } from '@0xsequence/design-system' import { TokenBalance } from '@0xsequence/indexer' -import { getNativeTokenInfoByChainId, useAnalyticsContext, ExtendedConnector, useCollectibleBalance } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId, ExtendedConnector } from '@0xsequence/kit' +import { useAnalyticsContext } from '@0xsequence/kit/contexts' +import { useCollectibleBalance } from '@0xsequence/kit/hooks' import { ethers } from 'ethers' import React, { useRef, useState, ChangeEvent, useEffect } from 'react' import { useAccount, useChainId, useSwitchChain, useConfig, useSendTransaction } from 'wagmi' diff --git a/packages/wallet/src/views/TransactionDetails/index.tsx b/packages/wallet/src/views/TransactionDetails/index.tsx index 72b890f8..e98a60ed 100644 --- a/packages/wallet/src/views/TransactionDetails/index.tsx +++ b/packages/wallet/src/views/TransactionDetails/index.tsx @@ -12,7 +12,8 @@ import { TokenImage } from '@0xsequence/design-system' import { Transaction, TxnTransfer } from '@0xsequence/indexer' -import { getNativeTokenInfoByChainId, useExchangeRate, useCoinPrices, useCollectiblePrices } from '@0xsequence/kit' +import { getNativeTokenInfoByChainId } from '@0xsequence/kit' +import { useExchangeRate, useCoinPrices, useCollectiblePrices } from '@0xsequence/kit/hooks' import dayjs from 'dayjs' import { ethers } from 'ethers' import React from 'react' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f1fdc23..f103be9b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,8 +99,8 @@ importers: examples/next: dependencies: '@0xsequence/design-system': - specifier: ^1.7.0 - version: 1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^1.7.1 + version: 1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@0xsequence/kit': specifier: workspace:* version: link:../../packages/kit @@ -160,8 +160,8 @@ importers: examples/react: dependencies: '@0xsequence/design-system': - specifier: ^1.7.0 - version: 1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^1.7.1 + version: 1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@0xsequence/kit': specifier: workspace:* version: link:../../packages/kit @@ -310,8 +310,8 @@ importers: version: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.3)(zod@3.23.7) devDependencies: '@0xsequence/design-system': - specifier: ^1.7.0 - version: 1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^1.7.1 + version: 1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@0xsequence/kit': specifier: workspace:* version: link:../kit @@ -398,8 +398,8 @@ importers: specifier: ^1.9.26 version: 1.9.26(ethers@5.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.3)) '@0xsequence/design-system': - specifier: ^1.7.0 - version: 1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^1.7.1 + version: 1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@0xsequence/ethauth': specifier: ^0.8.1 version: 0.8.1(ethers@5.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.3)) @@ -499,8 +499,8 @@ importers: version: 2.10.2(bufferutil@4.0.8)(typescript@5.4.5)(utf-8-validate@6.0.3)(zod@3.23.7) devDependencies: '@0xsequence/design-system': - specifier: ^1.7.0 - version: 1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^1.7.1 + version: 1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@0xsequence/kit': specifier: workspace:* version: link:../kit @@ -552,8 +552,8 @@ packages: peerDependencies: ethers: '>=5.5' - '@0xsequence/design-system@1.7.0': - resolution: {integrity: sha512-NgPHWbANqzL0O6zmBg4KmkX65DlDY7t2ZaDF4LgWrXzKc7UhGWShrkS+feFdsL4NAV2xYpABRAnFgT3kC99/Jg==} + '@0xsequence/design-system@1.7.1': + resolution: {integrity: sha512-RHS0tFcHsuEV/Zq5VRMUZ+xhZpAYW6TieZv7ZG4plA2OCvDUze3yF0e1aKT3PnxqR1tOb01ufYZrwrDIaTSEIg==} peerDependencies: framer-motion: '>=6' react: '>=17' @@ -7624,7 +7624,7 @@ snapshots: '@0xsequence/abi': 1.9.26 ethers: 5.7.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) - '@0xsequence/design-system@1.7.0(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@0xsequence/design-system@1.7.1(@types/react-dom@18.3.0)(@types/react@18.3.1)(framer-motion@8.5.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@radix-ui/react-aspect-ratio': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-checkbox': 1.0.4(@types/react-dom@18.3.0)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)