import { Abi, AbiParametersToPrimitiveTypes, ExtractAbiFunction, ExtractAbiFunctionNames } from 'abitype'; import { SafeVersion, TransactionOptions, TransactionResult } from '@safe-global/types-kit/types'; /** * Extracts the names of read-only functions (view or pure) from a given contract ABI. * * @template ContractAbi - The ABI of the contract. * @type {ContractReadFunctionNames} */ export type ContractReadFunctionNames = ExtractAbiFunctionNames; /** * Extracts the names of write functions (nonpayable or payable) from a given contract ABI. * * @template ContractAbi - The ABI of the contract. * @type {ContractWriteFunctionNames} */ export type ContractWriteFunctionNames = ExtractAbiFunctionNames; /** * Extracts the function arguments from a given contract ABI and function name. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name to extract arguments from, derived from the ABI. * @template ArgType - The type of arguments to extract, either 'inputs' or 'outputs'. (default: 'inputs') * @type {ExtractFunctionArgs} */ export type ExtractFunctionArgs = ExtractAbiFunctionNames, ArgType extends 'inputs' | 'outputs' = 'inputs'> = AbiParametersToPrimitiveTypes[ArgType], ArgType>; /** * Encodes a function call for a contract. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name to encode, derived from the ABI. */ export type EncodeFunction = ExtractAbiFunctionNames> = (functionToEncode: ContractFunctionName, args: ExtractFunctionArgs) => string; /** * Estimates the gas required for a function call on a contract. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function for which gas is being estimated, derived from the ABI. */ export type EstimateGasFunction = ExtractAbiFunctionNames> = (functionToEncode: ContractFunctionName, args: ExtractFunctionArgs, options?: TransactionOptions) => Promise; export type GetAddressFunction = () => string; /** * Defines a function type for a contract, derived by the given function name from a given contract ABI. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name, derived from the ABI. */ export type ContractFunction = ExtractAbiFunctionNames> = (...args: ExtractFunctionArgs['length'] extends 0 ? [] : [ExtractFunctionArgs]) => Promise>; /** * Defines an adapter-specific function type for a contract, derived by the given function name from a given contract ABI. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionName - The function name, derived from the ABI. */ export type SafeContractFunction = ExtractAbiFunctionNames> = (args: AbiParametersToPrimitiveTypes['inputs']>, options?: TransactionOptions) => Promise; /** * Represents the base contract type for a contract. * * @template ContractAbi - The ABI of the contract. * @template ContractFunctionNames - The function names, derived from the ABI. * @type {BaseContract} */ type BaseContract = ContractReadFunctionNames | ContractWriteFunctionNames> = { [FunctionName in ContractFunctionNames]: ContractFunction; } & { safeVersion: SafeVersion; encode: EncodeFunction; getAddress: GetAddressFunction; }; export default BaseContract; //# sourceMappingURL=BaseContract.d.ts.map