ethers.js/src.ts/providers/contracts.ts

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-09-05 23:14:43 +03:00
import type {
Provider, TransactionRequest, TransactionResponse
2022-09-05 23:14:43 +03:00
} from "./provider.js";
/**
* A **ContractRunner** is a generic interface which defines an object
* capable of interacting with a Contract on the network.
*
* The more operations supported, the more utility it is capable of.
*
* The most common ContractRunners are [Providers](Provider) which enable
* read-only access and [Signers](Signer) which enable write-access.
*/
2022-09-05 23:14:43 +03:00
export interface ContractRunner {
/**
* The provider used for necessary state querying operations.
*
* This can also point to the **ContractRunner** itself, in the
* case of an [[AbstractProvider]].
*/
2022-09-05 23:14:43 +03:00
provider: null | Provider;
/**
* Required to estimate gas.
*/
2022-09-05 23:14:43 +03:00
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
/**
* Required for pure, view or static calls to contracts.
*/
call?: (tx: TransactionRequest) => Promise<string>;
2022-09-05 23:14:43 +03:00
/**
* Required to support ENS names
*/
2022-09-05 23:14:43 +03:00
resolveName?: (name: string) => Promise<null | string>;
/**
* Required for state mutating calls
*/
2022-09-05 23:14:43 +03:00
sendTransaction?: (tx: TransactionRequest) => Promise<TransactionResponse>;
}