ethers.js/lib.commonjs/contract/factory.d.ts

62 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

2023-03-03 18:25:07 -07:00
import { Interface } from "../abi/index.js";
import { BaseContract } from "./contract.js";
import type { InterfaceAbi } from "../abi/index.js";
2023-06-13 21:47:44 -04:00
import type { Addressable } from "../address/index.js";
2023-03-03 18:25:07 -07:00
import type { ContractRunner } from "../providers/index.js";
import type { BytesLike } from "../utils/index.js";
import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js";
import type { ContractTransactionResponse } from "./wrappers.js";
2023-06-01 17:52:58 -04:00
/**
* A **ContractFactory** is used to deploy a Contract to the blockchain.
*/
2023-03-03 18:25:07 -07:00
export declare class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract> {
2023-06-01 17:52:58 -04:00
/**
* The Contract Interface.
*/
2023-03-03 18:25:07 -07:00
readonly interface: Interface;
2023-06-01 17:52:58 -04:00
/**
* The Contract deployment bytecode. Often called the initcode.
*/
2023-03-03 18:25:07 -07:00
readonly bytecode: string;
2023-06-01 17:52:58 -04:00
/**
* The ContractRunner to deploy the Contract as.
*/
2023-03-03 18:25:07 -07:00
readonly runner: null | ContractRunner;
2023-06-01 17:52:58 -04:00
/**
* Create a new **ContractFactory** with %%abi%% and %%bytecode%%,
* optionally connected to %%runner%%.
*
* The %%bytecode%% may be the ``bytecode`` property within the
* standard Solidity JSON output.
*/
2023-03-03 18:25:07 -07:00
constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | {
object: string;
}, runner?: null | ContractRunner);
2023-06-13 21:47:44 -04:00
attach(target: string | Addressable): BaseContract & Omit<I, keyof BaseContract>;
2023-06-01 17:52:58 -04:00
/**
* Resolves to the transaction to deploy the contract, passing %%args%%
* into the constructor.
*/
2023-03-03 18:25:07 -07:00
getDeployTransaction(...args: ContractMethodArgs<A>): Promise<ContractDeployTransaction>;
2023-06-01 17:52:58 -04:00
/**
* Resolves to the Contract deployed by passing %%args%% into the
* constructor.
*
2024-02-02 03:25:03 -05:00
* This will resolve to the Contract before it has been deployed to the
2023-06-01 17:52:58 -04:00
* network, so the [[BaseContract-waitForDeployment]] should be used before
* sending any transactions to it.
*/
2023-03-03 18:25:07 -07:00
deploy(...args: ContractMethodArgs<A>): Promise<BaseContract & {
deploymentTransaction(): ContractTransactionResponse;
} & Omit<I, keyof BaseContract>>;
2023-06-01 17:52:58 -04:00
/**
* Return a new **ContractFactory** with the same ABI and bytecode,
* but connected to %%runner%%.
*/
2023-03-03 18:25:07 -07:00
connect(runner: null | ContractRunner): ContractFactory<A, I>;
2023-06-01 17:52:58 -04:00
/**
* Create a new **ContractFactory** from the standard Solidity JSON output.
*/
2023-03-03 18:25:07 -07:00
static fromSolidity<A extends Array<any> = Array<any>, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory<A, I>;
}
//# sourceMappingURL=factory.d.ts.map