factory.d.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { Interface } from "../abi/index.js";
  2. import { BaseContract } from "./contract.js";
  3. import type { InterfaceAbi } from "../abi/index.js";
  4. import type { Addressable } from "../address/index.js";
  5. import type { ContractRunner } from "../providers/index.js";
  6. import type { BytesLike } from "../utils/index.js";
  7. import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js";
  8. import type { ContractTransactionResponse } from "./wrappers.js";
  9. /**
  10. * A **ContractFactory** is used to deploy a Contract to the blockchain.
  11. */
  12. export declare class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract> {
  13. /**
  14. * The Contract Interface.
  15. */
  16. readonly interface: Interface;
  17. /**
  18. * The Contract deployment bytecode. Often called the initcode.
  19. */
  20. readonly bytecode: string;
  21. /**
  22. * The ContractRunner to deploy the Contract as.
  23. */
  24. readonly runner: null | ContractRunner;
  25. /**
  26. * Create a new **ContractFactory** with %%abi%% and %%bytecode%%,
  27. * optionally connected to %%runner%%.
  28. *
  29. * The %%bytecode%% may be the ``bytecode`` property within the
  30. * standard Solidity JSON output.
  31. */
  32. constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | {
  33. object: string;
  34. }, runner?: null | ContractRunner);
  35. attach(target: string | Addressable): BaseContract & Omit<I, keyof BaseContract>;
  36. /**
  37. * Resolves to the transaction to deploy the contract, passing %%args%%
  38. * into the constructor.
  39. */
  40. getDeployTransaction(...args: ContractMethodArgs<A>): Promise<ContractDeployTransaction>;
  41. /**
  42. * Resolves to the Contract deployed by passing %%args%% into the
  43. * constructor.
  44. *
  45. * This will resolve to the Contract before it has been deployed to the
  46. * network, so the [[BaseContract-waitForDeployment]] should be used before
  47. * sending any transactions to it.
  48. */
  49. deploy(...args: ContractMethodArgs<A>): Promise<BaseContract & {
  50. deploymentTransaction(): ContractTransactionResponse;
  51. } & Omit<I, keyof BaseContract>>;
  52. /**
  53. * Return a new **ContractFactory** with the same ABI and bytecode,
  54. * but connected to %%runner%%.
  55. */
  56. connect(runner: null | ContractRunner): ContractFactory<A, I>;
  57. /**
  58. * Create a new **ContractFactory** from the standard Solidity JSON output.
  59. */
  60. static fromSolidity<A extends Array<any> = Array<any>, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory<A, I>;
  61. }
  62. //# sourceMappingURL=factory.d.ts.map