import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ReactNode } from 'react'; import { LogLevel } from '@parity/product-sdk-logger'; import { b as App, S as SignMessageWithDotNsIdentityArgs, D as DotNsIdentitySignature, A as Account } from '../types-CztPAgZT.js'; import { ChainDefinition, TypedApi } from 'polkadot-api'; import '@parity/product-sdk-cloud-storage'; import '@parity/result'; import '@parity/product-sdk-chain-client'; import '../dotns-hLSvmo6u.js'; /** Props for ProductSDKProvider */ interface ProductSDKProviderProps { /** Application name - used for storage namespacing and product account derivation */ name: string; /** Log level (default: 'info') */ logLevel?: LogLevel; /** Child components */ children: ReactNode; /** Fallback to show while loading */ fallback?: ReactNode; } /** * Provider component that initializes the Product SDK * * @example * ```tsx * import { ProductSDKProvider } from '@parity/product-sdk/react'; * * function App() { * return ( * }> * * * ); * } * ``` */ declare function ProductSDKProvider({ name, logLevel, children, fallback, }: ProductSDKProviderProps): react_jsx_runtime.JSX.Element; /** Context for the Product SDK app instance */ declare const ProductSDKContext: react.Context; /** * Hook to access the Product SDK app instance * * @throws If used outside of ProductSDKProvider * * @example * ```tsx * function MyComponent() { * const app = useProductSDK(); * // Use app.wallet, app.localStorage, etc. * } * ``` */ declare function useProductSDK(): App; /** * useWallet hook */ /** Wallet hook state */ interface UseWalletState { /** Whether wallet is connected */ isConnected: boolean; /** Whether connection is in progress */ isConnecting: boolean; /** Available accounts */ accounts: Account[]; /** Currently selected account */ selectedAccount: Account | null; /** Last error */ error: Error | null; } /** Wallet hook actions */ interface UseWalletActions { /** Connect to wallet */ connect: () => Promise; /** Disconnect from wallet */ disconnect: () => Promise; /** Select an account */ selectAccount: (address: string) => void; /** Sign a message */ signMessage: (message: string | Uint8Array) => Promise; /** Sign a message with the account that owns a DotNS / People username identity. */ signMessageWithDotNsIdentity: (args: SignMessageWithDotNsIdentityArgs) => Promise; } /** Return type of useWallet */ type UseWalletReturn = UseWalletState & UseWalletActions; /** * Hook for wallet connection and signing * * @example * ```tsx * function WalletButton() { * const { isConnected, accounts, connect, disconnect, selectAccount } = useWallet(); * * if (!isConnected) { * return ; * } * * return ( *
* * *
* ); * } * ``` */ declare function useWallet(): UseWalletReturn; /** * useLocalStorage hook */ /** * Hook for key-value storage operations * * @param key - Storage key * @param defaultValue - Default value if key doesn't exist * * @example * ```tsx * function ThemeToggle() { * const [theme, setTheme, { loading }] = useLocalStorage('theme', 'light'); * * if (loading) return
Loading...
; * * return ( * * ); * } * ``` */ declare function useLocalStorage(key: string, defaultValue?: T): [T | null, (value: T) => Promise, { loading: boolean; error: Error | null; }]; /** * Hook for string storage (simpler API) * * @param key - Storage key * @param defaultValue - Default value */ declare function useLocalStorageString(key: string, defaultValue?: string): [string | null, (value: string) => Promise, { loading: boolean; }]; /** * useChain hook */ /** * Hook to get a typed chain client * * @param chain - Chain descriptor (PAPI ChainDefinition) * * @example * ```tsx * import { paseo_asset_hub } from '@parity/product-sdk-descriptors/paseo-asset-hub'; * import { useChain } from '@parity/product-sdk/react'; * * function AssetHubBalance() { * const assetHub = useChain(paseo_asset_hub); * * // assetHub is typed for Asset Hub queries * const balance = await assetHub.query.System.Account.getValue(address); * } * ``` */ declare function useChain(chain: T): TypedApi; export { ProductSDKContext, ProductSDKProvider, type ProductSDKProviderProps, type UseWalletActions, type UseWalletReturn, type UseWalletState, useChain, useLocalStorage, useLocalStorageString, useProductSDK, useWallet };