import { BigNumberish, AccountInterface } from 'starknet';
import { S as SchemaType, b as SDK, T as ToriiQueryBuilder, P as ParsedEntity, G as GetTokenRequest, f as GetTokenBalanceRequest } from './types-DbGeload.js';
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as react from 'react';
import { ReactNode } from 'react';
import { DojoConfig, DojoProvider } from '@dojoengine/core';
import { GameState } from './state.js';
import { Token, TokenBalance } from '@dojoengine/torii-wasm';
import { UseBoundStore, StoreApi } from 'zustand';
import '@dojoengine/torii-wasm/types';
import 'neverthrow';
import 'immer';

type DojoStoreHook<T extends SchemaType> = <U>(selector: (state: GameState<T>) => U, equals?: (a: U, b: U) => boolean) => U;
/**
 * Interface defining the shape of the Dojo context.
 */
interface DojoContextType<Client extends (...args: any) => any, Schema extends SchemaType> {
    /** The Dojo client instance */
    config: DojoConfig;
    /** The Dojo client instance */
    client: ReturnType<Client>;
    /** SDK client instance **/
    sdk: SDK<Schema>;
    /** The Dojo provider */
    provider: DojoProvider;
    /** The dojo zustand store */
    useDojoStore: DojoStoreHook<Schema>;
}
/**
 * React context for sharing Dojo-related data throughout the application.
 */
declare const DojoContext: react.Context<any>;
/**
 * Provider component that makes Dojo context available to child components.
 *
 * @param props.children - Child components that will have access to the Dojo context
 * @param props.burnerManager - Instance of BurnerManager for handling burner accounts
 * @throws {Error} If DojoProvider is used more than once in the component tree
 */
declare function DojoSdkProvider<Schema extends SchemaType>({ dojoConfig, sdk, clientFn, children, }: {
    dojoConfig: DojoConfig;
    sdk: SDK<Schema>;
    clientFn: Function;
    children: ReactNode;
}): react_jsx_runtime.JSX.Element;

/**
 * Subscribe to entity changes. This hook fetches initial data from torii and subscribes to each entity change.
 * Use `useModel` to access your data.
 *
 * @param query ToriiQuery
 */
declare function useEntityQuery<Schema extends SchemaType>(query: ToriiQueryBuilder<Schema>): void;

/**
 * Subscribe to event changes. This hook fetches initial events from torii and subscribes to new events.
 *
 * @param query ToriiQuery
 */
declare function useEventQuery<Schema extends SchemaType>(query: ToriiQueryBuilder<Schema>): void;
/**
 * Subscribe to historical events changes. This hook fetches initial data from torii and subscribes to entity changes.
 * You need to specify to torii which events has to be taken in account as historical events.
 *
 * @param query ToriiQuery
 */
declare function useHistoricalEventsQuery<Schema extends SchemaType>(query: ToriiQueryBuilder<Schema>): ParsedEntity<Schema>[];

declare function useTokens(request: GetTokenRequest & GetTokenBalanceRequest): {
    tokens: Token[];
    balances: TokenBalance[];
    getBalance: (token: Token) => TokenBalance | undefined;
    toDecimal: (token: Token, balance: TokenBalance | undefined) => number;
};

/**
 * Factory function to create a React Zustand store based on a given SchemaType.
 *
 * @template T - The schema type.
 * @returns A Zustand hook tailored to the provided schema.
 */
declare function createDojoStore<T extends SchemaType>(): UseBoundStore<StoreApi<GameState<T>>>;
/**
 * Custom hook to retrieve a specific model for a given entityId within a specified namespace.
 *
 * @param entityId - The ID of the entity.
 * @param model - The model to retrieve, specified as a string in the format "namespace-modelName".
 * @returns The model structure if found, otherwise undefined.
 */
declare function useModel<N extends keyof SchemaType, M extends keyof SchemaType[N] & string, Client extends (...args: any) => any, Schema extends SchemaType>(entityId: BigNumberish, model: `${N}-${M}`): SchemaType[N][M] | undefined;
/**
 * Custom hook to retrieve all entities that have a specific model.
 *
 * @param model - The model to retrieve, specified as a string in the format "namespace-modelName".
 * @returns The model structure if found, otherwise undefined.
 */
declare function useModels<N extends keyof SchemaType, M extends keyof SchemaType[N] & string, Client extends (...args: any) => any, Schema extends SchemaType>(model: `${N}-${M}`): {
    [entityId: string]: SchemaType[N][M] | undefined;
};

/**
 * Hook that exposes sdk features.
 *
 * @template Client Client function generated with `sozo build --typescript`
 * @template Schema Schema function generated with `sozo build --typescript`
 * @returns DojoContextType<Client, Schema>
 */
declare function useDojoSDK<Client extends (...args: any) => any, Schema extends SchemaType>(): DojoContextType<Client, Schema>;
/**
 * If you know all distinct keys of your model, here is a way to compose it.
 *
 * @param keys Each keys corresponding to your model keys.
 * @returns Composed entityId
 */
declare function useEntityId(...keys: BigNumberish[]): BigNumberish;

interface WithAccountProps {
    account: AccountInterface;
    address: `0x${string}`;
}
declare function WithAccount<P extends object>(Component: React.ComponentType<P>, Fallback?: React.ComponentType): React.FC<Omit<P, keyof WithAccountProps>>;

export { DojoContext, type DojoContextType, DojoSdkProvider, type DojoStoreHook, WithAccount, createDojoStore, useDojoSDK, useEntityId, useEntityQuery, useEventQuery, useHistoricalEventsQuery, useModel, useModels, useTokens };
