import { Contract, ContractOptions, EventData, PastEventOptions } from "web3-eth-contract";
/**
 * A collection of all contract interface definitions.
 */
export type AllABIs = readonly any[];
type ExtractMethods<A extends AllABIs[number]> = A extends {
    type: "function";
} ? A["name"] : never;
type ExtractEvents<A extends AllABIs[number]> = A extends {
    type: "event";
} ? A["name"] : never;
type TypeOrInternalType<T> = T['internalType'] extends unknown ? T['type'] : T['internalType'];
/**
 * Converts a type to a JavaScript representation.
 */
export type MapTypeToJS<L, C> = L extends "tuple[]" ? TuplifyUnion<C[number], C[number]['name']>[] : L extends "address" | "uint256" | "uint128" | "uint8" | "string" | "bytes32" | "uint64" ? string : L extends "uint256[]" | "string[]" ? string[] : L extends "bool" ? boolean : L extends 'tuple' ? TuplifyUnion<C[number], C[number]['name']> : unknown;
type ExtractFromObj<R extends (AllABIs[number] & {
    type: "function";
})> = {
    [K in R["outputs"][number]["name"]]: MapTypeToJS<TypeOrInternalType<(R["outputs"][number] & {
        name: K;
    })>, (R["outputs"][number] & {
        name: K;
    })["components"]>;
};
/**
 * Defines the structure of a contract method.
 */
export type ExtractMethodDefinition<A extends AllABIs, N extends (AllABIs[number] & {
    type: "function";
})["name"], R = A[number] & {
    type: "function";
    name: N;
}> = (...args: TuplifyUnion<(A[number] & {
    type: "function";
    name: N;
})["inputs"][number], (A[number] & {
    type: "function";
    name: N;
})["inputs"][number]["name"]>) => {
    call: () => Promise<R extends {
        outputs: {
            length: 1;
        };
    } ? MapTypeToJS<TypeOrInternalType<R["outputs"][0]>, R["outputs"][0]['components']> : R extends {
        outputs: any;
    } ? ExtractFromObj<R> : void>;
    send: (prop: {
        from: string;
        maxPriorityFeePerGas?: number;
        gas?: number;
        gasPrice?: string;
    }) => Promise<void>;
};
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
type Push<T extends any[], V> = [...T, V];
/**
 * Creates a tuple from a union of types.
 */
export type TuplifyUnion<FUNCS, T, L = LastOf<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<TuplifyUnion<FUNCS, Exclude<T, L>>, MapTypeToJS<TypeOrInternalType<(FUNCS & {
    name: L;
})>, (FUNCS & {
    name: L;
})['components']>>;
/**
 * A specialized contract class with enhanced event handling.
 */
export declare class GenericContract<A extends AllABIs = AllABIs, E extends string = ExtractEvents<A[number]> | "allEvents"> extends Contract {
    events: Exclude<E, "allEvents">;
    constructor(jsonInterface: A, address?: string, options?: ContractOptions);
    methods: {
        [k in ExtractMethods<A[number]>]: ExtractMethodDefinition<A, k>;
    };
    getPastEvents(event: E): Promise<GenericEventData<A>[]>;
    getPastEvents(event: E, options: PastEventOptions, callback: (error: Error, event: EventData) => void): Promise<GenericEventData<A>[]>;
    getPastEvents(event: E, options: PastEventOptions): Promise<GenericEventData<A>[]>;
    getPastEvents(event: E, callback: (error: Error, event: EventData) => void): Promise<GenericEventData<A>[]>;
}
/**
 * The main contract class for interacting with blockchain contracts.
 */
export default GenericContract;
/**
 * Represents the data returned from a contract event.
 */
export type GenericEventData<E extends AllABIs> = EventData & GenericEvent<E>;
type ABIEvent = AllABIs[number] & {
    type: "event";
};
type GenericEvent<ABI extends AllABIs, E extends string = ExtractEvents<ABI[number]>> = {
    event: E;
    returnValues: ExtractReturnValues<ABIEvent & {
        name: E;
    }>;
};
type ExtractReturnValues<E extends ABIEvent> = ExtractInputType<E["inputs"][number]>;
type ExtractInputType<I extends ABIEvent["inputs"][number]> = {
    [k in I["name"]]: MapTypeToJS<TypeOrInternalType<I>, I['components']>;
};
