2018-09-24 16:07:14 -04:00
|
|
|
import { BigNumber } from './utils/bignumber';
|
|
|
|
import { Indexed, Interface } from './utils/interface';
|
2018-09-26 16:15:13 -04:00
|
|
|
import { UnsignedTransaction } from './utils/transaction';
|
2019-02-11 19:24:27 -05:00
|
|
|
import { BlockTag, Provider } from './providers/abstract-provider';
|
2018-09-24 16:07:14 -04:00
|
|
|
import { Signer } from './abstract-signer';
|
|
|
|
import { Arrayish } from './utils/bytes';
|
2020-01-29 22:14:34 -05:00
|
|
|
import { EventFragment, FunctionFragment, ParamType } from './utils/abi-coder';
|
2018-09-24 16:07:14 -04:00
|
|
|
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './providers/abstract-provider';
|
|
|
|
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
|
|
|
|
export declare type EventFilter = {
|
|
|
|
address?: string;
|
|
|
|
topics?: Array<string>;
|
|
|
|
};
|
|
|
|
export interface Event extends Log {
|
2018-10-01 17:34:44 -04:00
|
|
|
args?: Array<any>;
|
|
|
|
decode?: (data: string, topics?: Array<string>) => any;
|
|
|
|
event?: string;
|
|
|
|
eventSignature?: string;
|
2018-09-24 16:07:14 -04:00
|
|
|
removeListener: () => void;
|
|
|
|
getBlock: () => Promise<Block>;
|
|
|
|
getTransaction: () => Promise<TransactionResponse>;
|
|
|
|
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
|
|
|
}
|
2018-10-04 20:25:07 -04:00
|
|
|
export interface ContractReceipt extends TransactionReceipt {
|
|
|
|
events?: Array<Event>;
|
|
|
|
}
|
|
|
|
export interface ContractTransaction extends TransactionResponse {
|
|
|
|
wait(confirmations?: number): Promise<ContractReceipt>;
|
|
|
|
}
|
2018-09-24 16:07:14 -04:00
|
|
|
export declare class VoidSigner extends Signer {
|
|
|
|
readonly address: string;
|
|
|
|
constructor(address: string, provider: Provider);
|
|
|
|
getAddress(): Promise<string>;
|
|
|
|
_fail(message: string, operation: string): Promise<any>;
|
|
|
|
signMessage(message: Arrayish | string): Promise<string>;
|
|
|
|
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
|
|
|
connect(provider: Provider): VoidSigner;
|
|
|
|
}
|
|
|
|
interface Bucket<T> {
|
|
|
|
[name: string]: T;
|
|
|
|
}
|
|
|
|
export declare class Contract {
|
|
|
|
readonly address: string;
|
|
|
|
readonly interface: Interface;
|
|
|
|
readonly signer: Signer;
|
|
|
|
readonly provider: Provider;
|
|
|
|
readonly estimate: Bucket<(...params: Array<any>) => Promise<BigNumber>>;
|
|
|
|
readonly functions: Bucket<ContractFunction>;
|
|
|
|
readonly filters: Bucket<(...params: Array<any>) => EventFilter>;
|
|
|
|
readonly [name: string]: ContractFunction | any;
|
|
|
|
readonly addressPromise: Promise<string>;
|
|
|
|
readonly deployTransaction: TransactionResponse;
|
2019-02-11 19:24:27 -05:00
|
|
|
private _deployedPromise;
|
2020-01-29 22:14:34 -05:00
|
|
|
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
2018-09-24 16:07:14 -04:00
|
|
|
deployed(): Promise<Contract>;
|
2019-02-11 19:24:27 -05:00
|
|
|
_deployed(blockTag?: BlockTag): Promise<Contract>;
|
2018-09-24 16:07:14 -04:00
|
|
|
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
|
|
|
connect(signerOrProvider: Signer | Provider | string): Contract;
|
|
|
|
attach(addressOrName: string): Contract;
|
|
|
|
static isIndexed(value: any): value is Indexed;
|
|
|
|
private _events;
|
|
|
|
private _getEventFilter;
|
|
|
|
private _addEventListener;
|
|
|
|
on(event: EventFilter | string, listener: Listener): Contract;
|
|
|
|
once(event: EventFilter | string, listener: Listener): Contract;
|
|
|
|
addListener(eventName: EventFilter | string, listener: Listener): Contract;
|
|
|
|
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
|
|
|
listenerCount(eventName?: EventFilter | string): number;
|
|
|
|
listeners(eventName: EventFilter | string): Array<Listener>;
|
|
|
|
removeAllListeners(eventName: EventFilter | string): Contract;
|
|
|
|
removeListener(eventName: any, listener: Listener): Contract;
|
|
|
|
}
|
2018-09-26 16:15:13 -04:00
|
|
|
export declare class ContractFactory {
|
|
|
|
readonly interface: Interface;
|
|
|
|
readonly bytecode: string;
|
|
|
|
readonly signer: Signer;
|
2020-01-29 22:14:34 -05:00
|
|
|
constructor(contractInterface: Array<string | FunctionFragment | EventFragment | ParamType> | string | Interface, bytecode: Arrayish | string | {
|
2018-09-26 16:15:13 -04:00
|
|
|
object: string;
|
|
|
|
}, signer?: Signer);
|
|
|
|
getDeployTransaction(...args: Array<any>): UnsignedTransaction;
|
|
|
|
deploy(...args: Array<any>): Promise<Contract>;
|
|
|
|
attach(address: string): Contract;
|
|
|
|
connect(signer: Signer): ContractFactory;
|
|
|
|
static fromSolidity(compilerOutput: any, signer?: Signer): ContractFactory;
|
|
|
|
}
|
2018-09-24 16:07:14 -04:00
|
|
|
export {};
|