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
Name | Type | Default value | Description |
---|---|---|---|
bytecode | BytesLike | undefined | The bytecode of the contract. |
abi | JsonAbi | Interface <JsonAbi > | undefined | The contract's ABI (Application Binary Interface). |
accountOrProvider | null | Provider | Account | null | An account or provider to be associated with the factory. |
Returns
Defined in
Properties
account
• account: null
| Account
Defined in
bytecode
• bytecode: BytesLike
Defined in
interface
• interface: Interface
<JsonAbi
>
Defined in
provider
• provider: null
| Provider
Defined in
Methods
connect
▸ connect(provider
): ContractFactory
Connect the factory to a provider.
Parameters
Name | Type | Description |
---|---|---|
provider | Provider | The provider to be associated with the factory. |
Returns
A new ContractFactory instance.
Defined in
createTransactionRequest
▸ createTransactionRequest(deployContractOptions?
): Object
Create a transaction request to deploy a contract with the specified options.
Parameters
Name | Type | Description |
---|---|---|
deployContractOptions? | DeployContractOptions | Options for deploying the contract. |
Returns
Object
The CreateTransactionRequest object for deploying the contract.
Name | Type |
---|---|
contractId | string |
transactionRequest | CreateTransactionRequest |
Defined in
deployContract
▸ deployContract<TContract
>(deployContractOptions?
): Promise
<DeployContractResult
<TContract
>>
Deploy a contract with the specified options.
Type parameters
Name | Type |
---|---|
TContract | extends Contract = Contract |
Parameters
Name | Type | Description |
---|---|---|
deployContractOptions | DeployContractOptions | Options for deploying the contract. |
Returns
Promise
<DeployContractResult
<TContract
>>
A promise that resolves to the deployed contract instance.
Defined in
getAccount
▸ getAccount(): Account
Returns
Defined in
prepareDeploy
▸ prepareDeploy(deployContractOptions
): Promise
<{ contractId
: string
; transactionRequest
: CreateTransactionRequest
}>
Parameters
Name | Type |
---|---|
deployContractOptions | DeployContractOptions |
Returns
Promise
<{ contractId
: string
; transactionRequest
: CreateTransactionRequest
}>
Defined in
setConfigurableConstants
▸ setConfigurableConstants(configurableConstants
): void
Set configurable constants of the contract with the specified values.
Parameters
Name | Type | Description |
---|---|---|
configurableConstants | Object | An object containing configurable names and their values. |
Returns
void