Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
CreateTransactionRequest

Icon LinkClass: CreateTransactionRequest

@fuel-ts/account .CreateTransactionRequest
CreateTransactionRequest provides functionalities for creating a transaction request that creates a contract.

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new CreateTransactionRequest(createTransactionRequestLike?): CreateTransactionRequest
Creates an instance CreateTransactionRequest.

Icon LinkParameters

NameTypeDescription
createTransactionRequestLikeCreateTransactionRequestLikeThe initial values for the instance

Icon LinkReturns

Icon LinkOverrides

Icon LinkDefined in

Icon LinkProperties

Icon LinkbytecodeWitnessIndex

bytecodeWitnessIndex: number
Witness index of contract bytecode to create

Icon LinkDefined in


Icon LinkgasPrice

gasPrice: BN
Gas price for transaction

Icon LinkInherited from

Icon LinkDefined in


Icon Linkinputs

inputs: TransactionRequestInput [] = []
List of inputs

Icon LinkInherited from

Icon LinkDefined in


Icon Linkmaturity

maturity: number
Block until which tx cannot be included

Icon LinkInherited from

Icon LinkDefined in


Icon LinkmaxFee

Optional maxFee: BN
The maximum fee payable by this transaction using BASE_ASSET.

Icon LinkInherited from

Icon LinkDefined in


Icon Linkoutputs

outputs: TransactionRequestOutput [] = []
List of outputs

Icon LinkInherited from

Icon LinkDefined in


Icon Linksalt

salt: string
Salt

Icon LinkDefined in


Icon LinkstorageSlots

storageSlots: TransactionRequestStorageSlot[]
List of storage slots to initialize

Icon LinkDefined in


Icon Linktype

type: Create
Type of the transaction

Icon LinkOverrides

Icon LinkDefined in


Icon LinkwitnessLimit

Optional witnessLimit: BN
The maximum amount of witness data allowed for the transaction

Icon LinkInherited from

Icon LinkDefined in


Icon Linkwitnesses

witnesses: BytesLike [] = []
List of witnesses

Icon LinkInherited from

Icon LinkDefined in

Icon LinkMethods

Icon LinkaddAccountWitnesses

addAccountWitnesses(account): Promise<CreateTransactionRequest >
Helper function to add an external signature to the transaction.

Icon LinkParameters

NameTypeDescription
accountAccount | Account []The account/s to sign to the transaction.

Icon LinkReturns

The transaction with the signature witness added.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddChangeOutput

addChangeOutput(to, assetId?): void
Adds a change output to the transaction.

Icon LinkParameters

NameTypeDefault valueDescription
toAddressLike undefinedAddress of the owner.
assetIdBytesLike BaseAssetIdAsset ID of coin.

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddCoinInput

addCoinInput(coin, predicate?): void
Adds a single coin input to the transaction and a change output for the related assetId, if one it was not added yet.

Icon LinkParameters

NameTypeDescription
coinCoin Coin resource.
predicate?Predicate <InputValue[]>Predicate bytes.

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddCoinOutput

addCoinOutput(to, amount, assetId?): CreateTransactionRequest
Adds a coin output to the transaction.

Icon LinkParameters

NameTypeDefault valueDescription
toAddressLike undefinedAddress of the owner.
amountBigNumberishundefinedAmount of coin.
assetIdBytesLike BaseAssetIdAsset ID of coin.

Icon LinkReturns

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddCoinOutputs

addCoinOutputs(to, quantities): CreateTransactionRequest
Adds multiple coin outputs to the transaction.

Icon LinkParameters

NameTypeDescription
toAddressLike Address of the destination.
quantitiesCoinQuantityLike []Quantities of coins.

Icon LinkReturns

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddContractCreatedOutput

addContractCreatedOutput(contractId, stateRoot): void
Adds a contract created output to the transaction request.

Icon LinkParameters

NameTypeDescription
contractIdBytesLike The contract ID.
stateRootBytesLike The state root.

Icon LinkReturns

void

Icon LinkDefined in


Icon LinkaddMessageInput

addMessageInput(message, predicate?): void
Adds a single message input to the transaction and a change output for the baseAssetId, if one it was not added yet.

Icon LinkParameters

NameTypeDescription
messageMessageCoin Message resource.
predicate?Predicate <InputValue[]>Predicate bytes.

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddPredicateResource

addPredicateResource(resource, predicate): CreateTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.

Icon LinkParameters

NameType
resourceResource
predicatePredicate <InputValue[]>

Icon LinkReturns

This transaction.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddPredicateResources

addPredicateResources(resources, predicate): CreateTransactionRequest
Adds multiple predicate coin/message inputs to the transaction and change outputs from the related assetIds.

Icon LinkParameters

NameTypeDescription
resourcesResource []The resources to add.
predicatePredicate <InputValue[]>-

Icon LinkReturns

This transaction.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddResource

addResource(resource): CreateTransactionRequest
Adds a single resource to the transaction by adding a coin/message input and a change output for the related assetId, if one it was not added yet.

Icon LinkParameters

NameTypeDescription
resourceResource The resource to add.

Icon LinkReturns

This transaction.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkaddResources

addResources(resources): CreateTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.

Icon LinkParameters

NameTypeDescription
resourcesreadonly Resource []The resources to add.

Icon LinkReturns

This transaction.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkcalculateMaxGas

calculateMaxGas(chainInfo, minGas): BN

Icon LinkParameters

NameType
chainInfoChainInfo
minGasBN

Icon LinkReturns

BN

Icon LinkInherited from

Icon LinkDefined in


Icon LinkfundWithFakeUtxos

fundWithFakeUtxos(quantities, resourcesOwner?): void
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.

Icon LinkParameters

NameTypeDescription
quantitiesCoinQuantity []CoinQuantity Array.
resourcesOwner?AbstractAddress -

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetBaseTransaction

getBaseTransaction(): ToBaseTransactionResponse
Method to obtain the base transaction details.

Icon LinkReturns

ToBaseTransactionResponse
The base transaction details.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetChangeOutputs

getChangeOutputs(): ChangeTransactionRequestOutput []
Gets the change outputs for a transaction.

Icon LinkReturns

The change outputs.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetCoinInputs

getCoinInputs(): CoinTransactionRequestInput []
Gets the coin inputs for a transaction.

Icon LinkReturns

The coin inputs.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetCoinOutputs

getCoinOutputs(): CoinTransactionRequestOutput []
Gets the coin outputs for a transaction.

Icon LinkReturns

The coin outputs.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetCoinOutputsQuantities

getCoinOutputsQuantities(): CoinQuantity []
Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.

Icon LinkReturns

CoinQuantity array.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkgetContractCreatedOutputs

getContractCreatedOutputs(): ContractCreatedTransactionRequestOutput []
Get contract created outputs for the transaction.

Icon LinkReturns

An array of contract created transaction request outputs.

Icon LinkDefined in


Icon LinkgetTransactionId

getTransactionId(chainId): string
Gets the Transaction Request by hashing the transaction.

Icon LinkParameters

NameTypeDescription
chainIdnumberThe chain ID.

Icon LinkReturns

string
  • A hash of the transaction, which is the transaction ID.

Icon LinkOverrides

Icon LinkDefined in


Icon LinkmetadataGas

metadataGas(gasCosts): BN

Icon LinkParameters

NameType
gasCostsGqlGasCosts

Icon LinkReturns

BN

Icon LinkOverrides

BaseTransactionRequest.metadataGas

Icon LinkDefined in


Icon LinktoJSON

toJSON(): any
Return the minimum amount in native coins required to create a transaction.

Icon LinkReturns

any
The transaction as a JSON object.

Icon LinkInherited from

Icon LinkDefined in


Icon LinktoTransaction

toTransaction(): TransactionCreate
Converts the transaction request to a TransactionCreate.

Icon LinkReturns

TransactionCreate
The transaction create object.

Icon LinkOverrides

Icon LinkDefined in


Icon LinktoTransactionBytes

toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.

Icon LinkReturns

Uint8Array
The transaction bytes.

Icon LinkInherited from

Icon LinkDefined in


Icon LinkupdatePredicateInputs

updatePredicateInputs(inputs): void

Icon LinkParameters

NameType
inputsTransactionRequestInput []

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkupdateWitness

updateWitness(index, witness): void
Updates an existing witness without any side effects.
Throws
If the witness does not exist.

Icon LinkParameters

NameTypeDescription
indexnumberThe index of the witness to update.
witnessBytesLike The new witness.

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon LinkupdateWitnessByOwner

updateWitnessByOwner(address, signature): void
Updates the witness for a given owner and signature.

Icon LinkParameters

NameTypeDescription
addressstring | AbstractAddress The address to get the coin input witness index for.
signatureBytesLike The signature to update the witness with.

Icon LinkReturns

void

Icon LinkInherited from

Icon LinkDefined in


Icon Linkfrom

Icon LinkParameters

NameType
objCreateTransactionRequestLike

Icon LinkReturns

Icon LinkDefined in


Icon LinkgetPolicyMeta

getPolicyMeta(req): Object

Icon LinkParameters

Icon LinkReturns

Object
NameType
policiesPolicy[]
policyTypesnumber

Icon LinkInherited from

Icon LinkDefined in