ContractFactory provides utilities for deploying and configuring contracts.

Type Parameters

Hierarchy

  • ContractFactory

    Constructors

    Properties

    account: null | Account
    bytecode: BytesLike
    interface: Interface
    provider: null | Provider
    storageSlots: StorageSlot[]

    Methods

    • Connect the factory to a provider.

      Parameters

      • provider: Provider

        The provider to be associated with the factory.

      Returns ContractFactory<Contract>

      A new ContractFactory instance.

    • Create a transaction request to deploy a contract with the specified options.

      Parameters

      • OptionaldeployOptions: {
            chunkSizeMultiplier?: number;
            configurableConstants?: {
                [name: string]: unknown;
            };
            salt?: BytesLike;
            stateRoot?: BytesLike;
            storageSlots?: StorageSlot[];
        } & CreateTransactionRequestLike & {
            bytecode?: BytesLike;
        }

        Options for deploying the contract.

      Returns {
          contractId: string;
          transactionRequest: CreateTransactionRequest;
      }

      The CreateTransactionRequest object for deploying the contract.

    • Deploy a contract of any length with the specified options.

      Type Parameters

      Parameters

      Returns Promise<DeployContractResult<T>>

      A promise that resolves to the deployed contract instance.

    • Chunks and deploys a contract via a loader contract. Suitable for deploying contracts larger than the max contract size.

      Type Parameters

      Parameters

      Returns Promise<DeployContractResult<T>>

      A promise that resolves to the deployed contract instance.

    • Set configurable constants of the contract with the specified values.

      Parameters

      • configurableConstants: {
            [name: string]: unknown;
        }

        An object containing configurable names and their values.

        • [name: string]: unknown

      Returns void