Skip to content

Class: ContractFactory

@fuel-ts/contract.ContractFactory

ContractFactory provides utilities for deploying and configuring contracts.

Constructors

constructor

new ContractFactory(bytecode, abi, accountOrProvider?): ContractFactory

Create a ContractFactory instance.

Parameters

NameTypeDefault valueDescription
bytecodeBytesLikeundefinedThe bytecode of the contract.
abiJsonAbi | Interface<JsonAbi>undefinedThe contract's ABI (Application Binary Interface).
accountOrProvidernull | Provider | AccountnullAn account or provider to be associated with the factory.

Returns

ContractFactory

Defined in

contract-factory.ts:40

Properties

account

account: null | Account

Defined in

contract-factory.ts:31


bytecode

bytecode: BytesLike

Defined in

contract-factory.ts:28


interface

interface: Interface<JsonAbi>

Defined in

contract-factory.ts:29


provider

provider: null | Provider

Defined in

contract-factory.ts:30

Methods

connect

connect(provider): ContractFactory

Connect the factory to a provider.

Parameters

NameTypeDescription
providerProviderThe provider to be associated with the factory.

Returns

ContractFactory

A new ContractFactory instance.

Defined in

contract-factory.ts:82


createTransactionRequest

createTransactionRequest(deployContractOptions?): Object

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

Parameters

NameTypeDescription
deployContractOptions?DeployContractOptionsOptions for deploying the contract.

Returns

Object

The CreateTransactionRequest object for deploying the contract.

NameType
contractIdstring
transactionRequestCreateTransactionRequest

Defined in

contract-factory.ts:92


deployContract

deployContract(deployContractOptions?): Promise<Contract>

Deploy a contract with the specified options.

Parameters

NameTypeDescription
deployContractOptionsDeployContractOptionsOptions for deploying the contract.

Returns

Promise<Contract>

A promise that resolves to the deployed contract instance.

Defined in

contract-factory.ts:135


setConfigurableConstants

setConfigurableConstants(configurableConstants): void

Set configurable constants of the contract with the specified values.

Parameters

NameTypeDescription
configurableConstantsObjectAn object containing configurable names and their values.

Returns

void

Defined in

contract-factory.ts:167