Skip to content

@fuel-ts/contract v0.92.1Docs


Class: ContractFactory

ContractFactory provides utilities for deploying and configuring contracts.

Constructors

new ContractFactory()

new ContractFactory(bytecode, abi, accountOrProvider): ContractFactory

Create a ContractFactory instance.

Parameters

bytecode: BytesLike

The bytecode of the contract.

abi: JsonAbi | Interface<JsonAbi>

The contract's ABI (Application Binary Interface).

accountOrProvider: null | Provider | Account = null

An account or provider to be associated with the factory.

Returns

ContractFactory

Defined in

contract-factory.ts:60

Properties

account

account: null | Account

Defined in

contract-factory.ts:51


bytecode

bytecode: BytesLike

Defined in

contract-factory.ts:48


interface

interface: Interface<JsonAbi>

Defined in

contract-factory.ts:49


provider

provider: null | Provider

Defined in

contract-factory.ts:50

Methods

connect()

connect(provider): ContractFactory

Connect the factory to a provider.

Parameters

provider: Provider

The provider to be associated with the factory.

Returns

ContractFactory

A new ContractFactory instance.

Defined in

contract-factory.ts:102


createTransactionRequest()

createTransactionRequest(deployContractOptions?): object

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

Parameters

deployContractOptions?: DeployContractOptions

Options for deploying the contract.

Returns

object

The CreateTransactionRequest object for deploying the contract.

NameTypeDefined in
contractIdstringcontract-factory.ts:143
transactionRequestCreateTransactionRequestcontract-factory.ts:144

Defined in

contract-factory.ts:112


deployContract()

deployContract<TContract>(deployContractOptions): Promise<DeployContractResult<TContract>>

Deploy a contract with the specified options.

Type Parameters

TContract extends Contract = Contract

Parameters

deployContractOptions: DeployContractOptions = {}

Options for deploying the contract.

Returns

Promise<DeployContractResult<TContract>>

A promise that resolves to the deployed contract instance.

Defined in

contract-factory.ts:154


setConfigurableConstants()

setConfigurableConstants(configurableConstants): void

Set configurable constants of the contract with the specified values.

Parameters

configurableConstants

An object containing configurable names and their values.

Returns

void

Defined in

contract-factory.ts:185