Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
ScriptTransactionRequest

Icon LinkClass: ScriptTransactionRequest

@fuel-ts/account .ScriptTransactionRequest

ScriptTransactionRequest provides functionalities for creating a transaction request that uses a script.

Icon LinkHierarchy

Icon LinkConstructors

Icon Linkconstructor

new ScriptTransactionRequest(scriptTransactionRequestLike?): ScriptTransactionRequest

Constructor for ScriptTransactionRequest.

Icon LinkParameters

NameTypeDescription
scriptTransactionRequestLikeScriptTransactionRequestLikeThe initial values for the instance.

Icon LinkReturns

ScriptTransactionRequest

Icon LinkOverrides

BaseTransactionRequest .constructor

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:65 Icon Link

Icon LinkProperties

Icon Linkabis

Optional abis: JsonAbisFromAllCalls

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:58 Icon Link


Icon LinkgasLimit

gasLimit: BN

Gas limit for transaction

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:52 Icon Link


Icon LinkgasPrice

gasPrice: BN

Gas price for transaction

Icon LinkInherited from

BaseTransactionRequest .gasPrice

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:95 Icon Link


Icon Linkinputs

inputs: TransactionRequestInput [] = []

List of inputs

Icon LinkInherited from

BaseTransactionRequest .inputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:103 Icon Link


Icon Linkmaturity

maturity: number

Block until which tx cannot be included

Icon LinkInherited from

BaseTransactionRequest .maturity

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:97 Icon Link


Icon LinkmaxFee

Optional maxFee: BN

The maximum fee payable by this transaction using BASE_ASSET.

Icon LinkInherited from

BaseTransactionRequest .maxFee

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:99 Icon Link


Icon Linkoutputs

outputs: TransactionRequestOutput [] = []

List of outputs

Icon LinkInherited from

BaseTransactionRequest .outputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:105 Icon Link


Icon Linkscript

script: Uint8Array

Script to execute

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:54 Icon Link


Icon LinkscriptData

scriptData: Uint8Array

Script input data (parameters)

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:56 Icon Link


Icon Linktype

type: Script

Type of the transaction

Icon LinkOverrides

BaseTransactionRequest .type

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:50 Icon Link


Icon LinkwitnessLimit

Optional witnessLimit: BN

The maximum amount of witness data allowed for the transaction

Icon LinkInherited from

BaseTransactionRequest .witnessLimit

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:101 Icon Link


Icon Linkwitnesses

witnesses: BytesLike [] = []

List of witnesses

Icon LinkInherited from

BaseTransactionRequest .witnesses

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:107 Icon Link

Icon LinkMethods

Icon LinkaddAccountWitnesses

addAccountWitnesses(account): Promise<ScriptTransactionRequest >

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

Promise<ScriptTransactionRequest >

The transaction with the signature witness added.

Icon LinkInherited from

BaseTransactionRequest .addAccountWitnesses

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:275 Icon Link


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

BaseTransactionRequest .addChangeOutput

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:533 Icon Link


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

BaseTransactionRequest .addCoinInput

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:351 Icon Link


Icon LinkaddCoinOutput

addCoinOutput(to, amount, assetId?): ScriptTransactionRequest

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

ScriptTransactionRequest

Icon LinkInherited from

BaseTransactionRequest .addCoinOutput

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:497 Icon Link


Icon LinkaddCoinOutputs

addCoinOutputs(to, quantities): ScriptTransactionRequest

Adds multiple coin outputs to the transaction.

Icon LinkParameters

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

Icon LinkReturns

ScriptTransactionRequest

Icon LinkInherited from

BaseTransactionRequest .addCoinOutputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:514 Icon Link


Icon LinkaddContractInputAndOutput

addContractInputAndOutput(contract): ScriptTransactionRequest

Adds a contract input and output to the transaction request.

Icon LinkParameters

NameTypeDescription
contractContractIdLike The contract ID.

Icon LinkReturns

ScriptTransactionRequest

The current instance of the ScriptTransactionRequest.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:180 Icon Link


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

BaseTransactionRequest .addMessageInput

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:394 Icon Link


Icon LinkaddPredicateResource

addPredicateResource(resource, predicate): ScriptTransactionRequest

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

ScriptTransactionRequest

This transaction.

Icon LinkInherited from

BaseTransactionRequest .addPredicateResource

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:467 Icon Link


Icon LinkaddPredicateResources

addPredicateResources(resources, predicate): ScriptTransactionRequest

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

ScriptTransactionRequest

This transaction.

Icon LinkInherited from

BaseTransactionRequest .addPredicateResources

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:484 Icon Link


Icon LinkaddResource

addResource(resource): ScriptTransactionRequest

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

ScriptTransactionRequest

This transaction.

Icon LinkInherited from

BaseTransactionRequest .addResource

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:437 Icon Link


Icon LinkaddResources

addResources(resources): ScriptTransactionRequest

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

ScriptTransactionRequest

This transaction.

Icon LinkInherited from

BaseTransactionRequest .addResources

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:454 Icon Link


Icon LinkaddVariableOutputs

addVariableOutputs(numberOfVariables?): number

Adds variable outputs to the transaction request.

Icon LinkParameters

NameTypeDefault valueDescription
numberOfVariablesnumber1The number of variables to add.

Icon LinkReturns

number

The new length of the outputs array.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:143 Icon Link


Icon LinkcalculateMaxGas

calculateMaxGas(chainInfo, minGas): BN

Icon LinkParameters

NameType
chainInfoChainInfo
minGasBN

Icon LinkReturns

BN

Icon LinkOverrides

BaseTransactionRequest .calculateMaxGas

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:156 Icon Link


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

BaseTransactionRequest .fundWithFakeUtxos

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:600 Icon Link


Icon LinkgetBaseTransaction

getBaseTransaction(): ToBaseTransactionResponse

Method to obtain the base transaction details.

Icon LinkReturns

ToBaseTransactionResponse

The base transaction details.

Icon LinkInherited from

BaseTransactionRequest .getBaseTransaction

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:165 Icon Link


Icon LinkgetChangeOutputs

getChangeOutputs(): ChangeTransactionRequestOutput []

Gets the change outputs for a transaction.

Icon LinkReturns

ChangeTransactionRequestOutput []

The change outputs.

Icon LinkInherited from

BaseTransactionRequest .getChangeOutputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:313 Icon Link


Icon LinkgetCoinInputs

getCoinInputs(): CoinTransactionRequestInput []

Gets the coin inputs for a transaction.

Icon LinkReturns

CoinTransactionRequestInput []

The coin inputs.

Icon LinkInherited from

BaseTransactionRequest .getCoinInputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:291 Icon Link


Icon LinkgetCoinOutputs

getCoinOutputs(): CoinTransactionRequestOutput []

Gets the coin outputs for a transaction.

Icon LinkReturns

CoinTransactionRequestOutput []

The coin outputs.

Icon LinkInherited from

BaseTransactionRequest .getCoinOutputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:302 Icon Link


Icon LinkgetCoinOutputsQuantities

getCoinOutputsQuantities(): CoinQuantity []

Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.

Icon LinkReturns

CoinQuantity []

CoinQuantity array.

Icon LinkInherited from

BaseTransactionRequest .getCoinOutputsQuantities

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:647 Icon Link


Icon LinkgetContractInputs

getContractInputs(): ContractTransactionRequestInput []

Get contract inputs for the transaction.

Icon LinkReturns

ContractTransactionRequestInput []

An array of contract transaction request inputs.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:98 Icon Link


Icon LinkgetContractOutputs

getContractOutputs(): ContractTransactionRequestOutput []

Get contract outputs for the transaction.

Icon LinkReturns

ContractTransactionRequestOutput []

An array of contract transaction request outputs.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:109 Icon Link


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

BaseTransactionRequest .getTransactionId

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:209 Icon Link


Icon LinkgetVariableOutputs

getVariableOutputs(): VariableTransactionRequestOutput []

Get variable outputs for the transaction.

Icon LinkReturns

VariableTransactionRequestOutput []

An array of variable transaction request outputs.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:120 Icon Link


Icon LinkmetadataGas

metadataGas(gasCosts): BN

Icon LinkParameters

NameType
gasCostsGqlGasCosts

Icon LinkReturns

BN

Icon LinkOverrides

BaseTransactionRequest.metadataGas

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:226 Icon Link


Icon LinksetData

setData(abi, args): ScriptTransactionRequest

Sets the data for the transaction request.

Icon LinkParameters

NameTypeDescription
abiJsonAbiScript JSON ABI.
argsInputValue[]The input arguments.

Icon LinkReturns

ScriptTransactionRequest

The current instance of the ScriptTransactionRequest.

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:220 Icon Link


Icon LinksetScript

setScript<T>(script, data): void

Set the script and its data.

Icon LinkType parameters

Name
T

Icon LinkParameters

NameTypeDescription
scriptAbstractScriptRequest<T>The abstract script request.
dataTThe script data.

Icon LinkReturns

void

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:132 Icon Link


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

BaseTransactionRequest .toJSON

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:671 Icon Link


Icon LinktoTransaction

toTransaction(): TransactionScript

Converts the transaction request to a TransactionScript.

Icon LinkReturns

TransactionScript

The transaction script object.

Icon LinkOverrides

BaseTransactionRequest .toTransaction

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:78 Icon Link


Icon LinktoTransactionBytes

toTransactionBytes(): Uint8Array

Converts the transaction request to a byte array.

Icon LinkReturns

Uint8Array

The transaction bytes.

Icon LinkInherited from

BaseTransactionRequest .toTransactionBytes

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:191 Icon Link


Icon LinkupdatePredicateInputs

updatePredicateInputs(inputs): void

Icon LinkParameters

NameType
inputsTransactionRequestInput []

Icon LinkReturns

void

Icon LinkInherited from

BaseTransactionRequest .updatePredicateInputs

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:675 Icon Link


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

BaseTransactionRequest .updateWitness

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:262 Icon Link


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

BaseTransactionRequest .updateWitnessByOwner

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:247 Icon Link


Icon Linkfrom

from(obj): ScriptTransactionRequest

Icon LinkParameters

NameType
objScriptTransactionRequestLike

Icon LinkReturns

ScriptTransactionRequest

Icon LinkDefined in

packages/account/src/providers/transaction-request/script-transaction-request.ts:42 Icon Link


Icon LinkgetPolicyMeta

getPolicyMeta(req): Object

Icon LinkParameters

Icon LinkReturns

Object

NameType
policiesPolicy[]
policyTypesnumber

Icon LinkInherited from

BaseTransactionRequest .getPolicyMeta

Icon LinkDefined in

packages/account/src/providers/transaction-request/transaction-request.ts:132 Icon Link