@fuel-ts/contract .index .ContractFactory
ContractFactory
provides utilities for deploying and configuring contracts.
• new ContractFactory(bytecode
, abi
, accountOrProvider?
): ContractFactory
Create a ContractFactory instance.
Name | Type | Default value | Description |
---|---|---|---|
bytecode | BytesLike | undefined | The bytecode of the contract. |
abi | 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. |
packages/contract/src/contract-factory.ts:68
• account: null
| Account
packages/contract/src/contract-factory.ts:59
• bytecode: BytesLike
packages/contract/src/contract-factory.ts:56
• interface: Interface
packages/contract/src/contract-factory.ts:57
• provider: null
| Provider
packages/contract/src/contract-factory.ts:58
▸ blobTransactionRequest(options
): BlobTransactionRequest
Create a blob transaction request, used for deploying contract chunks.
Name | Type | Description |
---|---|---|
options | { bytecode : BytesLike } & { chunkSizeMultiplier? : number ; configurableConstants? : { [name: string] : unknown ; } ; salt? : BytesLike ; stateRoot? : BytesLike ; storageSlots? : StorageSlot [] } & CreateTransactionRequestLike | options for creating a blob transaction request. |
a populated BlobTransactionRequest.
packages/contract/src/contract-factory.ts:444
▸ connect(provider
): ContractFactory
Connect the factory to a provider.
Name | Type | Description |
---|---|---|
provider | Provider | The provider to be associated with the factory. |
A new ContractFactory instance.
packages/contract/src/contract-factory.ts:110
▸ createTransactionRequest(deployOptions?
): Object
Create a transaction request to deploy a contract with the specified options.
Name | Type | Description |
---|---|---|
deployOptions? | { chunkSizeMultiplier? : number ; configurableConstants? : { [name: string] : unknown ; } ; salt? : BytesLike ; stateRoot? : BytesLike ; storageSlots? : StorageSlot [] } & CreateTransactionRequestLike & { bytecode? : BytesLike } | Options for deploying the contract. |
Object
The CreateTransactionRequest object for deploying the contract.
Name | Type |
---|---|
contractId | string |
transactionRequest | CreateTransactionRequest |
packages/contract/src/contract-factory.ts:120
▸ deploy<TContract
>(deployOptions?
): Promise
<DeployContractResult
<TContract
>>
Deploy a contract of any length with the specified options.
Name | Type | Description |
---|---|---|
deployOptions | DeployContractOptions | Options for deploying the contract. |
Promise
<DeployContractResult
<TContract
>>
A promise that resolves to the deployed contract instance.
packages/contract/src/contract-factory.ts:195
▸ deployAsBlobTx<TContract
>(deployOptions?
): Promise
<DeployContractResult
<TContract
>>
Chunks and deploys a contract via a loader contract. Suitable for deploying contracts larger than the max contract size.
Name | Type | Description |
---|---|---|
deployOptions | DeployContractOptions | Options for deploying the contract. |
Promise
<DeployContractResult
<TContract
>>
A promise that resolves to the deployed contract instance.
packages/contract/src/contract-factory.ts:251
▸ deployAsCreateTx<TContract
>(deployOptions?
): Promise
<DeployContractResult
<TContract
>>
Deploy a contract with the specified options.
Name | Type | Description |
---|---|---|
deployOptions | DeployContractOptions | Options for deploying the contract. |
Promise
<DeployContractResult
<TContract
>>
A promise that resolves to the deployed contract instance.
packages/contract/src/contract-factory.ts:213
▸ fundTransactionRequest(request
, options?
): Promise
<TransactionRequest
>
Takes a transaction request, estimates it and funds it.
Name | Type | Description |
---|---|---|
request | TransactionRequest | the request to fund. |
options | DeployContractOptions | options for funding the request. |
Promise
<TransactionRequest
>
a funded transaction request.
packages/contract/src/contract-factory.ts:164
▸ getAccount(): Account
packages/contract/src/contract-factory.ts:414
▸ getMaxChunkSize(deployOptions
, chunkSizeMultiplier?
): number
Get the maximum chunk size for deploying a contract by chunks.
Name | Type | Default value |
---|---|---|
deployOptions | DeployContractOptions | undefined |
chunkSizeMultiplier | number | CHUNK_SIZE_MULTIPLIER |
number
packages/contract/src/contract-factory.ts:457
▸ prepareDeploy(deployOptions
): Promise
<{ contractId
: string
; transactionRequest
: CreateTransactionRequest
}>
Name | Type |
---|---|
deployOptions | DeployContractOptions |
Promise
<{ contractId
: string
; transactionRequest
: CreateTransactionRequest
}>
packages/contract/src/contract-factory.ts:421
▸ setConfigurableConstants(configurableConstants
): void
Set configurable constants of the contract with the specified values.
Name | Type | Description |
---|---|---|
configurableConstants | Object | An object containing configurable names and their values. |
void