import { default as create, StoreApi, UseBoundStore } from 'zustand'; import { TAppContractsContext, TBaseContractExtended, TConnectorList, TEthersAdaptor, TTypedContract } from "../../models"; export type { create, StoreApi, UseBoundStore }; /** * i've added comment headers since this is a large file due to the factory function */ /** * #### Summary * Props for the ContractContext generated by the contractContextFactory * * @category ContractAppContext */ export declare type TContractsContextProps = { ethersContextKey?: string | undefined; }; declare type TContractsAppStore>, GContractsTypes extends ReturnType]['connect']> = ReturnType]['connect']>, GAppContractsState = TAppContractsContext> = { contractState: GAppContractsState | undefined; setContractState: (contractState: GAppContractsState) => void; connectToAllContracts: (ethersAdaptor: TEthersAdaptor | undefined) => void; connectToContract: (contractName: GContractNames, ethersAdaptor: TEthersAdaptor | undefined) => void; setContractConnectors: (contractConnectors: GAppConnectorList) => void; }; /** * #### Summary * This is the factory function that creates the ContractContext and returns the hooks you can use to access typed contracts through out your app. * * ##### ✏️ Notes * - you must define the generic GContractNames if you want type narrowing for the hooks: e.g. `contractsContextFactory(getAppContractsConfig);`, where getAppContractsConfig is a function that returns Record of contract names and connectors. * - See [this for an example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/release/packages/vite-app-ts/src/config/appContracts.config.ts) for an example of how to use this. * * @category ContractAppContext * @template GContractNames A type that represents the names of the contracts you want to access. Should be `keyof ReturnType`, where `loadAppContractConnectors` is the function that returns the contract connectors config. * @template GAppConnectorList A type are the list of contracts and their connectors. Should be `ReturnType`, where `loadAppContractConnectors` is the function that returns the contract connectors config. * @template GContractConnector TTypedContract allows the factory to strictly type contracts for the react hooks. Should be `TTypedContract, ReturnType>`, where `loadAppContractConnectors` is the function that returns the contract connectors config. * @param loadAppContractConnectors A function that returns a list of app contract connectors. See [this for an example](https://github.com/scaffold-eth/scaffold-eth-typescript/blob/release/packages/vite-app-ts/src/config/appContracts.config.ts) * @returns A context for contracts, hook to access contracts, hook to load contracts, hook to connect to contracts in a network */ export declare const contractsContextFactory: >>(loadAppContractConnectors: () => GAppConnectorList) => { /** * #### Summary * This hook allows you to get the contracts attached to a particular network. * * ##### ✏️ Notes * To be used with {@link useConnectAppContracts} which needs to be called in your app to connect to the contracts in a particular network. * * @category ContractAppContext */ useAppContracts: (contractName: GContractName, chainId: number | undefined) => TTypedContract; /** * #### Summary * This hook needs to be called in your app to load all your app contracts * * @category ContractAppContext */ useLoadAppContracts: () => void; /** * #### Summary * This hook needs to be called in your app to connect your app to a network * * @category ContractAppContext */ useConnectAppContracts: (adaptor: TEthersAdaptor | undefined) => void; useContractsAppStore: UseBoundStore]["connect"]>, TAppContractsContext]["connect"]>>>>>; }; //# sourceMappingURL=contractsContextFactory.d.ts.map