import { AppMetadata, Preference, SubAccountOptions } from '../core/provider/interface.js'; import { SpendPermission } from '../core/rpc/coinbase_fetchSpendPermissions.js'; import { OwnerAccount } from '../core/type/index.js'; import { Address, Hex } from 'viem'; export type ToOwnerAccountFn = () => Promise<{ account: OwnerAccount | null; }>; type Chain = { id: number; rpcUrl?: string; nativeCurrency?: { name?: string; symbol?: string; decimal?: number; }; }; export type SubAccount = { address: Address; factory?: Address; factoryData?: Hex; }; type SubAccountConfig = SubAccountOptions & { capabilities?: Record; }; type Account = { accounts?: Address[]; capabilities?: Record; chain?: Chain; }; type Config = { metadata?: AppMetadata; preference?: Preference; version: string; deviceId?: string; paymasterUrls?: Record; }; type ChainSlice = { chains: Chain[]; }; type KeysSlice = { keys: Record; }; type AccountSlice = { account: Account; }; type SubAccountSlice = { subAccount?: SubAccount; }; type SubAccountConfigSlice = { subAccountConfig?: SubAccountConfig; }; type SpendPermissionsSlice = { spendPermissions: SpendPermission[]; }; type ConfigSlice = { config: Config; }; type MergeTypes = T extends [infer First, ...infer Rest] ? First & (Rest extends unknown[] ? MergeTypes : Record) : Record; export type StoreState = MergeTypes<[ ChainSlice, KeysSlice, AccountSlice, SubAccountSlice, SubAccountConfigSlice, SpendPermissionsSlice, ConfigSlice ]>; /** * Factory function to create a store instance. * Allows creating either persistent (for regular SDK) or ephemeral (for payment flows) stores. */ export declare function createStoreInstance(options?: { persist?: boolean; storageName?: string; }): import("zustand/vanilla").StoreApi<{ subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }>; export declare const sdkstore: import("zustand/vanilla").StoreApi<{ subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }>; export type StoreInstance = ReturnType; /** * Creates store accessor helpers for a given store instance. * This allows both the global store and ephemeral stores to use the same API. */ export declare function createStoreHelpers(storeInstance: StoreInstance): { subAccountsConfig: { get: () => SubAccountConfig | undefined; set: (subAccountConfig: Partial) => void; clear: () => void; }; subAccounts: { get: () => SubAccount | undefined; set: (subAccount: Partial) => void; clear: () => void; }; spendPermissions: { get: () => SpendPermission[]; set: (spendPermissions: SpendPermission[]) => void; clear: () => void; }; account: { get: () => Account; set: (account: Partial) => void; clear: () => void; }; chains: { get: () => Chain[]; set: (chains: Chain[]) => void; clear: () => void; }; keys: { get: (key: string) => string | null; set: (key: string, value: string | null) => void; clear: () => void; }; config: { get: () => Config; set: (config: Partial) => void; }; }; export declare const subAccountsConfig: { get: () => SubAccountConfig | undefined; set: (subAccountConfig: Partial) => void; clear: () => void; }; export declare const subAccounts: { get: () => SubAccount | undefined; set: (subAccount: Partial) => void; clear: () => void; }; export declare const spendPermissions: { get: () => SpendPermission[]; set: (spendPermissions: SpendPermission[]) => void; clear: () => void; }; export declare const account: { get: () => Account; set: (account: Partial) => void; clear: () => void; }; export declare const chains: { get: () => Chain[]; set: (chains: Chain[]) => void; clear: () => void; }; export declare const keys: { get: (key: string) => string | null; set: (key: string, value: string | null) => void; clear: () => void; }; export declare const config: { get: () => Config; set: (config: Partial) => void; }; /** Persist middleware API — only exists on `sdkstore` because it is always created with `persist: true`. */ type GlobalSdkPersistApi = { rehydrate: () => Promise | void; }; export declare const store: { persist: GlobalSdkPersistApi; subAccountsConfig: { get: () => SubAccountConfig | undefined; set: (subAccountConfig: Partial) => void; clear: () => void; }; subAccounts: { get: () => SubAccount | undefined; set: (subAccount: Partial) => void; clear: () => void; }; spendPermissions: { get: () => SpendPermission[]; set: (spendPermissions: SpendPermission[]) => void; clear: () => void; }; account: { get: () => Account; set: (account: Partial) => void; clear: () => void; }; chains: { get: () => Chain[]; set: (chains: Chain[]) => void; clear: () => void; }; keys: { get: (key: string) => string | null; set: (key: string, value: string | null) => void; clear: () => void; }; config: { get: () => Config; set: (config: Partial) => void; }; setState: { (partial: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; } | Partial<{ subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }> | ((state: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }) => { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; } | Partial<{ subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }>), replace?: false): void; (state: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; } | ((state: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }) => { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }), replace: true): void; }; getState: () => { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }; getInitialState: () => { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }; subscribe: (listener: (state: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }, prevState: { subAccountConfig?: SubAccountConfig; config: Config; spendPermissions: SpendPermission[]; subAccount?: SubAccount; account: Account; keys: Record; chains: Chain[]; }) => void) => () => void; }; export {}; //# sourceMappingURL=store.d.ts.map