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

62 lines
2.5 KiB
TypeScript
Raw Normal View History

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