@fuel-ts/providers .BaseTransactionRequest
Abstract class to define the functionalities of a transaction request transaction request.
BaseTransactionRequest
BaseTransactionRequestLike
• new BaseTransactionRequest(baseTransactionRequest?
)
Constructor for initializing a base transaction request.
Name | Type | Description |
---|---|---|
baseTransactionRequest | BaseTransactionRequestLike | Optional object containing properties to initialize the transaction request. |
packages/providers/src/transaction-request/transaction-request.ts:83
• gasLimit: BN
Gas limit for transaction
BaseTransactionRequestLike.gasLimit
packages/providers/src/transaction-request/transaction-request.ts:68
• gasPrice: BN
Gas price for transaction
BaseTransactionRequestLike.gasPrice
packages/providers/src/transaction-request/transaction-request.ts:66
• inputs: TransactionRequestInput
[] = []
List of inputs
BaseTransactionRequestLike.inputs
packages/providers/src/transaction-request/transaction-request.ts:72
• maturity: number
Block until which tx cannot be included
BaseTransactionRequestLike.maturity
packages/providers/src/transaction-request/transaction-request.ts:70
• outputs: TransactionRequestOutput
[] = []
List of outputs
BaseTransactionRequestLike.outputs
packages/providers/src/transaction-request/transaction-request.ts:74
• Abstract
type: TransactionType
Type of the transaction
packages/providers/src/transaction-request/transaction-request.ts:64
• witnesses: BytesLike
[] = []
List of witnesses
BaseTransactionRequestLike.witnesses
packages/providers/src/transaction-request/transaction-request.ts:76
▸ 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
packages/providers/src/transaction-request/transaction-request.ts:439
▸ 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
packages/providers/src/transaction-request/transaction-request.ts:257
▸ addCoinOutput(to
, amount
, assetId?
): BaseTransactionRequest
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. |
packages/providers/src/transaction-request/transaction-request.ts:403
▸ addCoinOutputs(to
, quantities
): BaseTransactionRequest
Adds multiple coin outputs to the transaction.
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the destination. |
quantities | CoinQuantityLike [] | Quantities of coins. |
packages/providers/src/transaction-request/transaction-request.ts:420
▸ 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
packages/providers/src/transaction-request/transaction-request.ts:300
▸ addPredicateResource(resource
, predicate
): BaseTransactionRequest
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.
packages/providers/src/transaction-request/transaction-request.ts:373
▸ addPredicateResources(resources
, predicate
): BaseTransactionRequest
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.
packages/providers/src/transaction-request/transaction-request.ts:390
▸ addResource(resource
): BaseTransactionRequest
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.
packages/providers/src/transaction-request/transaction-request.ts:343
▸ addResources(resources
): BaseTransactionRequest
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.
packages/providers/src/transaction-request/transaction-request.ts:360
▸ calculateFee(gasPriceFactor
): CoinQuantity
Return the minimum amount in native coins required to create a transaction. This is required even if the gasPrice is 0.
Name | Type |
---|---|
gasPriceFactor | BN |
The minimum amount in coins required to create a transaction.
packages/providers/src/transaction-request/transaction-request.ts:473
▸ 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.
packages/providers/src/transaction-request/transaction-request.ts:104
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
packages/providers/src/transaction-request/transaction-request.ts:219
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
packages/providers/src/transaction-request/transaction-request.ts:197
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
packages/providers/src/transaction-request/transaction-request.ts:208
▸ toJSON(): any
Return the minimum amount in native coins required to create a transaction.
any
The transaction as a JSON object.
packages/providers/src/transaction-request/transaction-request.ts:488
▸ Abstract
toTransaction(): TransactionScript
| TransactionCreate
TransactionScript
| TransactionCreate
packages/providers/src/transaction-request/transaction-request.ts:124
▸ toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.
Uint8Array
The transaction bytes.
packages/providers/src/transaction-request/transaction-request.ts:131
▸ 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
packages/providers/src/transaction-request/transaction-request.ts:185
▸ 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
packages/providers/src/transaction-request/transaction-request.ts:171
Was this page helpful?