@fuel-ts/providers .ScriptTransactionRequest
ScriptTransactionRequest
provides functionalities for creating a transaction request that uses a script.
↳ ScriptTransactionRequest
• new ScriptTransactionRequest(scriptTransactionRequestLike?
)
Constructor for ScriptTransactionRequest
.
Name | Type | Description |
---|---|---|
scriptTransactionRequestLike | ScriptTransactionRequestLike | The initial values for the instance. |
BaseTransactionRequest .constructor
packages/providers/src/transaction-request/script-transaction-request.ts:50
• gasLimit: BN
Gas limit for transaction
BaseTransactionRequest .gasLimit
packages/providers/src/transaction-request/transaction-request.ts:69
• gasPrice: BN
Gas price for transaction
BaseTransactionRequest .gasPrice
packages/providers/src/transaction-request/transaction-request.ts:67
• inputs: TransactionRequestInput
[] = []
List of inputs
BaseTransactionRequest .inputs
packages/providers/src/transaction-request/transaction-request.ts:73
• maturity: number
Block until which tx cannot be included
BaseTransactionRequest .maturity
packages/providers/src/transaction-request/transaction-request.ts:71
• outputs: TransactionRequestOutput
[] = []
List of outputs
BaseTransactionRequest .outputs
packages/providers/src/transaction-request/transaction-request.ts:75
• script: Uint8Array
Script to execute
packages/providers/src/transaction-request/script-transaction-request.ts:41
• scriptData: Uint8Array
Script input data (parameters)
packages/providers/src/transaction-request/script-transaction-request.ts:43
• type: Script
Type of the transaction
packages/providers/src/transaction-request/script-transaction-request.ts:39
• witnesses: BytesLike
[] = []
List of witnesses
BaseTransactionRequest .witnesses
packages/providers/src/transaction-request/transaction-request.ts:77
▸ addChangeOutput(to
, assetId?
): void
Adds a change output to the transaction.
Name | Type | Default value | Description |
---|---|---|---|
to | AddressLike | undefined | Address of the owner. |
assetId | BytesLike | BaseAssetId | Asset ID of coin. |
void
BaseTransactionRequest .addChangeOutput
packages/providers/src/transaction-request/transaction-request.ts:440
▸ 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.
Name | Type | Description |
---|---|---|
coin | Coin | Coin resource. |
predicate? | AbstractPredicate | Predicate bytes. |
void
BaseTransactionRequest .addCoinInput
packages/providers/src/transaction-request/transaction-request.ts:258
▸ addCoinOutput(to
, amount
, assetId?
): ScriptTransactionRequest
Adds a coin output to the transaction.
Name | Type | Default value | Description |
---|---|---|---|
to | AddressLike | undefined | Address of the owner. |
amount | BigNumberish | undefined | Amount of coin. |
assetId | BytesLike | BaseAssetId | Asset ID of coin. |
BaseTransactionRequest .addCoinOutput
packages/providers/src/transaction-request/transaction-request.ts:404
▸ addCoinOutputs(to
, quantities
): ScriptTransactionRequest
Adds multiple coin outputs to the transaction.
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the destination. |
quantities | CoinQuantityLike [] | Quantities of coins. |
BaseTransactionRequest .addCoinOutputs
packages/providers/src/transaction-request/transaction-request.ts:421
▸ addContractInputAndOutput(contract
): ScriptTransactionRequest
Adds a contract input and output to the transaction request.
Name | Type | Description |
---|---|---|
contract | ContractIdLike | The contract ID. |
The current instance of the ScriptTransactionRequest
.
packages/providers/src/transaction-request/script-transaction-request.ts:144
▸ 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.
Name | Type | Description |
---|---|---|
message | MessageCoin | Message resource. |
predicate? | AbstractPredicate | Predicate bytes. |
void
BaseTransactionRequest .addMessageInput
packages/providers/src/transaction-request/transaction-request.ts:301
▸ addPredicateResource(resource
, predicate
): ScriptTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.
Name | Type |
---|---|
resource | Resource |
predicate | AbstractPredicate |
This transaction.
BaseTransactionRequest .addPredicateResource
packages/providers/src/transaction-request/transaction-request.ts:374
▸ addPredicateResources(resources
, predicate
): ScriptTransactionRequest
Adds multiple predicate coin/message inputs to the transaction and change outputs from the related assetIds.
Name | Type | Description |
---|---|---|
resources | Resource [] | The resources to add. |
predicate | AbstractPredicate | - |
This transaction.
BaseTransactionRequest .addPredicateResources
packages/providers/src/transaction-request/transaction-request.ts:391
▸ 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.
Name | Type | Description |
---|---|---|
resource | Resource | The resource to add. |
This transaction.
BaseTransactionRequest .addResource
packages/providers/src/transaction-request/transaction-request.ts:344
▸ addResources(resources
): ScriptTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.
Name | Type | Description |
---|---|---|
resources | readonly Resource [] | The resources to add. |
This transaction.
BaseTransactionRequest .addResources
packages/providers/src/transaction-request/transaction-request.ts:361
▸ addVariableOutputs(numberOfVariables?
): number
Adds variable outputs to the transaction request.
Name | Type | Default value | Description |
---|---|---|---|
numberOfVariables | number | 1 | The number of variables to add. |
number
The new length of the outputs array.
packages/providers/src/transaction-request/script-transaction-request.ts:125
▸ calculateFee(): CoinQuantity
Return the minimum amount in native coins required to create a transaction. This is required even if the gasPrice is 0.
The minimum amount in coins required to create a transaction.
BaseTransactionRequest .calculateFee
packages/providers/src/transaction-request/transaction-request.ts:474
▸ Protected
getBaseTransaction(): Pick
<TransactionScript
| TransactionCreate
, "inputsCount"
| "outputsCount"
| "witnessesCount"
| keyof BaseTransactionRequestLike
>
Method to obtain the base transaction details.
Pick
<TransactionScript
| TransactionCreate
, "inputsCount"
| "outputsCount"
| "witnessesCount"
| keyof BaseTransactionRequestLike
>
The base transaction details.
BaseTransactionRequest .getBaseTransaction
packages/providers/src/transaction-request/transaction-request.ts:105
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
BaseTransactionRequest .getChangeOutputs
packages/providers/src/transaction-request/transaction-request.ts:220
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
BaseTransactionRequest .getCoinInputs
packages/providers/src/transaction-request/transaction-request.ts:198
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
BaseTransactionRequest .getCoinOutputs
packages/providers/src/transaction-request/transaction-request.ts:209
▸ getContractInputs(): ContractTransactionRequestInput
[]
Get contract inputs for the transaction.
ContractTransactionRequestInput
[]
An array of contract transaction request inputs.
packages/providers/src/transaction-request/script-transaction-request.ts:80
▸ getContractOutputs(): ContractTransactionRequestOutput
[]
Get contract outputs for the transaction.
ContractTransactionRequestOutput
[]
An array of contract transaction request outputs.
packages/providers/src/transaction-request/script-transaction-request.ts:91
▸ getVariableOutputs(): VariableTransactionRequestOutput
[]
Get variable outputs for the transaction.
VariableTransactionRequestOutput
[]
An array of variable transaction request outputs.
packages/providers/src/transaction-request/script-transaction-request.ts:102
▸ setData(abi
, args
): ScriptTransactionRequest
Sets the data for the transaction request.
Name | Type | Description |
---|---|---|
abi | JsonAbi | Script JSON ABI. |
args | InputValue [] | The input arguments. |
The current instance of the ScriptTransactionRequest
.
packages/providers/src/transaction-request/script-transaction-request.ts:173
▸ setScript<T
>(script
, data
): void
Set the script and its data.
Name |
---|
T |
Name | Type | Description |
---|---|---|
script | AbstractScriptRequest <T > | The abstract script request. |
data | T | The script data. |
void
packages/providers/src/transaction-request/script-transaction-request.ts:114
▸ toJSON(): any
Return the minimum amount in native coins required to create a transaction.
any
The transaction as a JSON object.
BaseTransactionRequest .toJSON
packages/providers/src/transaction-request/transaction-request.ts:489
▸ toTransaction(): TransactionScript
Converts the transaction request to a TransactionScript
.
TransactionScript
The transaction script object.
BaseTransactionRequest .toTransaction
packages/providers/src/transaction-request/script-transaction-request.ts:61
▸ toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.
Uint8Array
The transaction bytes.
BaseTransactionRequest .toTransactionBytes
packages/providers/src/transaction-request/transaction-request.ts:132
▸ updateWitness(index
, witness
): void
Updates an existing witness without any side effects.
Throws
If the witness does not exist.
Name | Type | Description |
---|---|---|
index | number | The index of the witness to update. |
witness | BytesLike | The new witness. |
void
BaseTransactionRequest .updateWitness
packages/providers/src/transaction-request/transaction-request.ts:186
▸ updateWitnessByOwner(address
, signature
): void
Updates the witness for a given owner and signature.
Name | Type | Description |
---|---|---|
address | AbstractAddress | The address to get the coin input witness index for. |
signature | BytesLike | The signature to update the witness with. |
void
BaseTransactionRequest .updateWitnessByOwner
packages/providers/src/transaction-request/transaction-request.ts:172
▸ Static
from(obj
): ScriptTransactionRequest
Name | Type |
---|---|
obj | ScriptTransactionRequestLike |
packages/providers/src/transaction-request/script-transaction-request.ts:31
Was this page helpful?