import {EventEmitter} from "events"; import {EventOptions} from "web3-eth-contract"; import TransactionLog = Truffle.TransactionLog; declare type BN = import("bn.js"); declare const artifacts: Truffle.Artifacts; /** * Namespace */ declare global { namespace Truffle { type Accounts = string[]; interface TransactionDetails { from?: string; gas?: BN | number | string; gasPrice?: BN | number | string; value?: BN | string; } export interface TransactionLog { address: string; args: any; blockHash: string; blockNumber: number; event: string; logIndex: number; transactionHash: string; transactionIndex: number; type: string; } export interface TransactionResponse { tx: string; receipt: any; logs: TransactionLog[]; } interface Contract extends ContractNew { deployed(): Promise; at(address: string): T; address: string; contractName: string; } interface ContractInstance { address: string; contract: any; transactionHash: string; } interface ContractNew { "new"(...args: ARGs): any; } interface Deployer { link(library: Truffle.Contract, destination: Truffle.Contract): Deployer; link(library: Truffle.Contract, destinations: Array>): Deployer; deploy(c: ContractNew, ...args: T): Deployer; } type Migration = (deploy: Deployer, network: string, accounts: Accounts) => void; // Wanna exact typings for your smartcontracts? Use typechain interface Artifacts { require(name: string): T; } } } export type Callback = (error: Error, result: T) => void; export interface ContractEventLog extends TransactionLog { returnValues: T; } export interface ContractEventEmitter extends EventEmitter { on( event: "data" | "changed", listener: (event: ContractEventLog) => void ): this; on(event: "error", listener: (error: Error) => void): this; } export type ContractEvent = ( options?: EventOptions, cb?: Callback> ) => ContractEventEmitter;