aboutsummaryrefslogtreecommitdiffstats
path: root/packages/typescript-typings/types/ethers/index.d.ts
blob: 875563ba2db59cc99dadccb07d91f40b94ec91e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
declare module 'ethers' {
    import { TxData } from 'ethereum-types';

    export interface TransactionDescription {
        name: string;
        signature: string;
        sighash: string;
        data: string;
    }
    export interface CallDescription extends TransactionDescription {
        parse: (...args: any[]) => any;
    }
    export interface FunctionDescription {
        (...params: any[]): TransactionDescription | CallDescription;
        inputs: { names: string[]; types: string[] };
        outputs: { names: string[]; types: string[] };
        type: string;
    }
    export interface EventDescription {
        parse: (...args: any[]) => any;
        inputs: { names: string[]; types: string[] };
        signature: string;
        topics: string[];
    }
    export class Interface {
        public functions: { [functionName: string]: FunctionDescription };
        public events: { [eventName: string]: EventDescription };
        constructor(abi: any);
    }
    export class Contract {
        public static getDeployTransaction(bytecode: string, abi: any, ...args: any[]): Partial<TxData>;
        constructor(address: string, abi: any, provider: any);
    }
    const enum errors {
        INVALID_ARGUMENT = 'INVALID_ARGUMENT',
    }

    export type ParamName = null | string | NestedParamName;

    export interface NestedParamName {
        name: string | null;
        names: ParamName[];
    }

    export const utils: {
        AbiCoder: {
            defaultCoder: AbiCoder;
        };
    };

    export interface AbiCoder {
        encode: (names: ParamName[] | string[], types: string[] | any[], args: any[] | undefined) => string;
        decode: (names: ParamName[] | string[], types: string[] | string, data: string | undefined) => any;
    }
}