@fuel-ts/account v0.94.2 • Docs
ScriptTransactionRequest
provides functionalities for creating a transaction request that uses a script.
new ScriptTransactionRequest(
scriptTransactionRequestLike
):ScriptTransactionRequest
Constructor for ScriptTransactionRequest
.
• scriptTransactionRequestLike: ScriptTransactionRequestLike
= {}
The initial values for the instance.
BaseTransactionRequest
.constructor
packages/account/src/providers/transaction-request/script-transaction-request.ts:64
optional
abis:JsonAbisFromAllCalls
packages/account/src/providers/transaction-request/script-transaction-request.ts:57
gasLimit:
BN
Gas limit for transaction
packages/account/src/providers/transaction-request/script-transaction-request.ts:51
inputs:
TransactionRequestInput
[] =[]
List of inputs
BaseTransactionRequest
.inputs
packages/account/src/providers/transaction-request/transaction-request.ts:113
optional
maturity:number
Block until which tx cannot be included
BaseTransactionRequest
.maturity
packages/account/src/providers/transaction-request/transaction-request.ts:107
maxFee:
BN
The maximum fee payable by this transaction using BASE_ASSET.
BaseTransactionRequest
.maxFee
packages/account/src/providers/transaction-request/transaction-request.ts:109
outputs:
TransactionRequestOutput
[] =[]
List of outputs
BaseTransactionRequest
.outputs
packages/account/src/providers/transaction-request/transaction-request.ts:115
script:
Uint8Array
Script to execute
packages/account/src/providers/transaction-request/script-transaction-request.ts:53
scriptData:
Uint8Array
Script input data (parameters)
packages/account/src/providers/transaction-request/script-transaction-request.ts:55
optional
tip:BN
Gas price for transaction
packages/account/src/providers/transaction-request/transaction-request.ts:105
type:
Script
Type of the transaction
packages/account/src/providers/transaction-request/script-transaction-request.ts:49
optional
witnessLimit:BN
The maximum amount of witness data allowed for the transaction
BaseTransactionRequest
.witnessLimit
packages/account/src/providers/transaction-request/transaction-request.ts:111
witnesses:
BytesLike
[] =[]
List of witnesses
BaseTransactionRequest
.witnesses
packages/account/src/providers/transaction-request/transaction-request.ts:117
addAccountWitnesses(
account
):Promise
<ScriptTransactionRequest
>
Helper function to add an external signature to the transaction.
• account: Account
| Account
[]
The account/s to sign to the transaction.
Promise
<ScriptTransactionRequest
>
The transaction with the signature witness added.
BaseTransactionRequest
.addAccountWitnesses
packages/account/src/providers/transaction-request/transaction-request.ts:286
addChangeOutput(
to
,assetId
):void
Adds a change output to the transaction.
• to: AddressLike
Address of the owner.
• assetId: BytesLike
Asset ID of coin.
void
BaseTransactionRequest
.addChangeOutput
packages/account/src/providers/transaction-request/transaction-request.ts:508
addCoinInput(
coin
):void
Adds a single coin input to the transaction and a change output for the related assetId, if one it was not added yet.
• coin: Coin
Coin resource.
void
BaseTransactionRequest
.addCoinInput
packages/account/src/providers/transaction-request/transaction-request.ts:360
addCoinOutput(
to
,amount
,assetId
):ScriptTransactionRequest
Adds a coin output to the transaction.
• to: AddressLike
Address of the owner.
• amount: BigNumberish
Amount of coin.
• assetId: BytesLike
Asset ID of coin.
BaseTransactionRequest
.addCoinOutput
packages/account/src/providers/transaction-request/transaction-request.ts:472
addCoinOutputs(
to
,quantities
):ScriptTransactionRequest
Adds multiple coin outputs to the transaction.
• to: AddressLike
Address of the destination.
• quantities: CoinQuantityLike
[]
Quantities of coins.
BaseTransactionRequest
.addCoinOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:489
addContractInputAndOutput(
contract
):ScriptTransactionRequest
Adds a contract input and output to the transaction request.
• contract: ContractIdLike
The contract ID.
The current instance of the ScriptTransactionRequest
.
packages/account/src/providers/transaction-request/script-transaction-request.ts:190
addMessageInput(
message
):void
Adds a single message input to the transaction and a change output for the asset against the message
• message: MessageCoin
Message resource.
void
BaseTransactionRequest
.addMessageInput
packages/account/src/providers/transaction-request/transaction-request.ts:401
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.
• resource: Resource
The resource to add.
This transaction.
BaseTransactionRequest
.addResource
packages/account/src/providers/transaction-request/transaction-request.ts:442
addResources(
resources
):ScriptTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.
• resources: readonly Resource
[]
The resources to add.
This transaction.
BaseTransactionRequest
.addResources
packages/account/src/providers/transaction-request/transaction-request.ts:459
addVariableOutputs(
numberOfVariables
):number
Adds variable outputs to the transaction request.
• numberOfVariables: number
= 1
The number of variables to add.
number
The new length of the outputs array.
packages/account/src/providers/transaction-request/script-transaction-request.ts:142
byteLength():
number
number
BaseTransactionRequest
.byteLength
packages/account/src/providers/transaction-request/transaction-request.ts:696
calculateMaxGas(
chainInfo
,minGas
):BN
Calculates the maximum gas for the transaction.
• chainInfo: ChainInfo
The chain information.
• minGas: BN
The minimum gas.
BN
the maximum gas.
BaseTransactionRequest
.calculateMaxGas
packages/account/src/providers/transaction-request/script-transaction-request.ts:162
fundWithFakeUtxos(
quantities
,baseAssetId
,resourcesOwner
?):ScriptTransactionRequest
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.
• quantities: CoinQuantity
[]
CoinQuantity Array.
• baseAssetId: string
The base asset to fund the transaction.
• resourcesOwner?: AbstractAddress
BaseTransactionRequest
.fundWithFakeUtxos
packages/account/src/providers/transaction-request/transaction-request.ts:583
protected
getBaseTransaction():ToBaseTransactionResponse
Method to obtain the base transaction details.
ToBaseTransactionResponse
The base transaction details.
BaseTransactionRequest
.getBaseTransaction
packages/account/src/providers/transaction-request/transaction-request.ts:176
getChangeOutputs():
ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
BaseTransactionRequest
.getChangeOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:324
getCoinInputs():
CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
BaseTransactionRequest
.getCoinInputs
packages/account/src/providers/transaction-request/transaction-request.ts:302
getCoinOutputs():
CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
BaseTransactionRequest
.getCoinOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:313
getCoinOutputsQuantities():
CoinQuantity
[]
Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.
CoinQuantity
[]
CoinQuantity array.
BaseTransactionRequest
.getCoinOutputsQuantities
packages/account/src/providers/transaction-request/transaction-request.ts:634
getContractInputs():
ContractTransactionRequestInput
[]
Get contract inputs for the transaction.
ContractTransactionRequestInput
[]
An array of contract transaction request inputs.
packages/account/src/providers/transaction-request/script-transaction-request.ts:97
getContractOutputs():
ContractTransactionRequestOutput
[]
Get contract outputs for the transaction.
ContractTransactionRequestOutput
[]
An array of contract transaction request outputs.
packages/account/src/providers/transaction-request/script-transaction-request.ts:108
getTransactionId(
chainId
):string
Gets the Transaction Request by hashing the transaction.
• chainId: number
The chain ID.
string
BaseTransactionRequest
.getTransactionId
packages/account/src/providers/transaction-request/script-transaction-request.ts:219
getVariableOutputs():
VariableTransactionRequestOutput
[]
Get variable outputs for the transaction.
VariableTransactionRequestOutput
[]
An array of variable transaction request outputs.
packages/account/src/providers/transaction-request/script-transaction-request.ts:119
removeWitness(
index
):void
• index: number
void
BaseTransactionRequest
.removeWitness
packages/account/src/providers/transaction-request/transaction-request.ts:662
setData(
abi
,args
):ScriptTransactionRequest
Sets the data for the transaction request.
• abi: JsonAbi
Script JSON ABI.
• args: InputValue
[]
The input arguments.
The current instance of the ScriptTransactionRequest
.
packages/account/src/providers/transaction-request/script-transaction-request.ts:230
setScript<
T
>(script
,data
):void
Set the script and its data.
• T
• script: AbstractScriptRequest
<T
>
The abstract script request.
• data: T
The script data.
void
packages/account/src/providers/transaction-request/script-transaction-request.ts:131
toJSON():
any
Return the minimum amount in native coins required to create a transaction.
any
The transaction as a JSON object.
BaseTransactionRequest
.toJSON
packages/account/src/providers/transaction-request/transaction-request.ts:658
toTransaction():
TransactionScript
Converts the transaction request to a TransactionScript
.
TransactionScript
The transaction script object.
BaseTransactionRequest
.toTransaction
packages/account/src/providers/transaction-request/script-transaction-request.ts:77
toTransactionBytes():
Uint8Array
Converts the transaction request to a byte array.
Uint8Array
The transaction bytes.
BaseTransactionRequest
.toTransactionBytes
packages/account/src/providers/transaction-request/transaction-request.ts:202
updatePredicateGasUsed(
inputs
):void
• inputs: TransactionRequestInput
[]
void
BaseTransactionRequest
.updatePredicateGasUsed
packages/account/src/providers/transaction-request/transaction-request.ts:676
updateWitness(
index
,witness
):void
Updates an existing witness without any side effects.
• index: number
The index of the witness to update.
• witness: BytesLike
The new witness.
void
If the witness does not exist.
BaseTransactionRequest
.updateWitness
packages/account/src/providers/transaction-request/transaction-request.ts:273
updateWitnessByOwner(
address
,signature
):void
Updates the witness for a given owner and signature.
• address: string
| AbstractAddress
The address to get the coin input witness index for.
• signature: BytesLike
The signature to update the witness with.
void
BaseTransactionRequest
.updateWitnessByOwner
packages/account/src/providers/transaction-request/transaction-request.ts:258
static
from(obj
):ScriptTransactionRequest
• obj: ScriptTransactionRequestLike
packages/account/src/providers/transaction-request/script-transaction-request.ts:41
static
getPolicyMeta(req
):object
• req: BaseTransactionRequest
object
policies:
Policy
[]
policyTypes:
number
BaseTransactionRequest
.getPolicyMeta
packages/account/src/providers/transaction-request/transaction-request.ts:142