import { Provider } from '@ethersproject/providers'; import { BaseContract, Signer } from 'ethers'; import { TBasicContractDeployment } from "./"; /** * #### Summary * ethers.BaseContract extension. This is the exactly the same as `ethers.BaseContract`, but with a type guard for the contract name: `BaseContract & { contractName: 'nameofContract' };` */ export declare type TBaseContractExtended = BaseContract & { contractName: GContractNames; }; /** * A function that connects to a contract. Used by {@link TContractConnectorBase}. This is usually something generated by typechain and is used to connect to contract on the blockchain. */ export declare type TContractConnectFunc = (address: string, signerOrProvider: Signer | Provider) => GContract; /** * #### Summary * This types describes a base for a connnector. A contract connector would be a a conception that is the minimum required to connect to a contract. It has a connector function that returns a typed contract and abi that has contract information. */ export declare type TContractConnectorBase = Readonly<{ connect: TContractConnectFunc; abi: Readonly[]>; }>; /** * #### Summary * This type descripts a connector that has enough information to create a contract in a chain. The contractName is required to use a group of connectors to create a connection of available contracts for the app. * * ##### ✏️ Notes * - The config would be a record of chain information that helps the factory create contracts for the app. * - based on {@link TContractConnectorBase} and uses {@link TBasicContractDeployment} */ export declare type TContractConnector> = Readonly<{ contractName: GContractNames; config: TBasicContractDeployment; } & TContractConnectorBase>; /** * #### Summary * A Record of typed connectors that can be used to create a contract. * * ##### ✏️ Notes * - used by {@link TAppContractsContext} */ export declare type TConnectorList> = { [contractName in GContractNames]: TContractConnector; }; /** * #### Summary * A type that infers contract type `(extended from BaseContract)` based on connectors and contractName. For example `DAI` from `{ DAI: { connect: ... } }`. If the contractName is not found, it will return a BaseContract * * ##### ✏️ Notes * - used by {@link contractsConextFactory} */ export declare type TTypedContract = GAppContractConnectorList extends { [key in GContractNames]: { connect: (address: string, signerOrProvider: Signer | Provider) => infer TypedContract; }; } ? TypedContract : never; /** * #### Summary * A utility type for typed contracts by name and then by chain * * ##### ✏️ Notes * - used by {@link TAppContractsContext} */ export declare type TContractsByName> = { [contractName in GContractNames]: { [chainId in number]: GContracts | undefined; }; }; /** * #### Summary * A utility type for typed contracts by chain and then by name * * ##### ✏️ Notes * - used by {@link TAppContractsContext} */ export declare type TContractsByChainId> = { [chainId in number]: { [contractName in GContractNames]: GContracts | undefined; }; }; /** * Describes the current ContractsContext for the app used by the context created by {@link contractContextFactory} */ export declare type TAppContractsContext> = { contractConnectors: TConnectorList; contractsByName: TContractsByName; contractsByChainId: TContractsByChainId; }; //# sourceMappingURL=contractAppContextTypes.d.ts.map