ethers.js/packages/providers/src.ts/contracts.ts
2022-04-18 14:20:40 -04:00

23 lines
920 B
TypeScript

import type { Addressable } from "@ethersproject/address";
import type {
CallRequest, Provider, TransactionRequest, TransactionResponse
} from "./provider.js";
// The object that will be used to run Contracts. The Signer and Provider
// both adhere to this, but other types of objects may wish to as well.
export interface ContractRunner {
provider: null | Provider;
// Required to estimate gas; usually a Signer or Provider
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
// Required for pure, view or static calls to contracts; usually a Signer or Provider
call?: (tx: CallRequest) => Promise<string>;
// Required to support ENS names; usually a Signer or Provider
resolveName?: (name: string | Addressable) => Promise<null | string>;
// Required for mutating calls; usually a Signer
sendTransaction?: (tx: TransactionRequest) => Promise<TransactionResponse>;
}