Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Contractfactory

Icon LinkClass: ContractFactory

@fuel-ts/contract .ContractFactory

ContractFactory provides utilities for deploying and configuring contracts.

Icon LinkConstructors

Icon Linkconstructor

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

Create a ContractFactory instance.

Icon LinkParameters

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

Icon LinkReturns

ContractFactory

Icon LinkDefined in

contract-factory.ts:55 Icon Link

Icon LinkProperties

Icon Linkaccount

account: null | Account

Icon LinkDefined in

contract-factory.ts:46 Icon Link


Icon Linkbytecode

bytecode: BytesLike

Icon LinkDefined in

contract-factory.ts:43 Icon Link


Icon Linkinterface

interface: Interface<JsonAbi>

Icon LinkDefined in

contract-factory.ts:44 Icon Link


Icon Linkprovider

provider: null | Provider

Icon LinkDefined in

contract-factory.ts:45 Icon Link

Icon LinkMethods

Icon Linkconnect

connect(provider): ContractFactory

Connect the factory to a provider.

Icon LinkParameters

NameTypeDescription
providerProvider The provider to be associated with the factory.

Icon LinkReturns

ContractFactory

A new ContractFactory instance.

Icon LinkDefined in

contract-factory.ts:97 Icon Link


Icon LinkcreateTransactionRequest

createTransactionRequest(deployContractOptions?): Object

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

Icon LinkParameters

NameTypeDescription
deployContractOptions?DeployContractOptions Options for deploying the contract.

Icon LinkReturns

Object

The CreateTransactionRequest object for deploying the contract.

NameType
contractIdstring
transactionRequestCreateTransactionRequest

Icon LinkDefined in

contract-factory.ts:107 Icon Link


Icon LinkdeployContract

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

Deploy a contract with the specified options.

Icon LinkType parameters

NameType
TContractextends Contract = Contract

Icon LinkParameters

NameTypeDescription
deployContractOptionsDeployContractOptions Options for deploying the contract.

Icon LinkReturns

Promise<DeployContractResult <TContract>>

A promise that resolves to the deployed contract instance.

Icon LinkDefined in

contract-factory.ts:149 Icon Link


Icon LinkgetAccount

getAccount(): Account

Icon LinkReturns

Account

Icon LinkDefined in

contract-factory.ts:205 Icon Link


Icon LinkprepareDeploy

prepareDeploy(deployContractOptions): Promise<{ contractId: string ; transactionRequest: CreateTransactionRequest }>

Icon LinkParameters

NameType
deployContractOptionsDeployContractOptions

Icon LinkReturns

Promise<{ contractId: string ; transactionRequest: CreateTransactionRequest }>

Icon LinkDefined in

contract-factory.ts:212 Icon Link


Icon LinksetConfigurableConstants

setConfigurableConstants(configurableConstants): void

Set configurable constants of the contract with the specified values.

Icon LinkParameters

NameTypeDescription
configurableConstantsObjectAn object containing configurable names and their values.

Icon LinkReturns

void

Icon LinkDefined in

contract-factory.ts:174 Icon Link