Class: BaseTransactionRequest
@fuel-ts/account.BaseTransactionRequest
Abstract class to define the functionalities of a transaction request transaction request.
Hierarchy
BaseTransactionRequest
Implements
BaseTransactionRequestLike
Constructors
constructor
• new BaseTransactionRequest(baseTransactionRequest?
): BaseTransactionRequest
Constructor for initializing a base transaction request.
Parameters
Name | Type | Description |
---|---|---|
baseTransactionRequest | BaseTransactionRequestLike | Optional object containing properties to initialize the transaction request. |
Returns
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:118
Properties
inputs
• inputs: TransactionRequestInput
[] = []
List of inputs
Implementation of
BaseTransactionRequestLike.inputs
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:107
maturity
• Optional
maturity: number
Block until which tx cannot be included
Implementation of
BaseTransactionRequestLike.maturity
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:101
maxFee
• maxFee: BN
The maximum fee payable by this transaction using BASE_ASSET.
Implementation of
BaseTransactionRequestLike.maxFee
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:103
outputs
• outputs: TransactionRequestOutput
[] = []
List of outputs
Implementation of
BaseTransactionRequestLike.outputs
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:109
tip
• Optional
tip: BN
Gas price for transaction
Implementation of
BaseTransactionRequestLike.tip
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:99
type
• Abstract
type: TransactionType
Type of the transaction
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:97
witnessLimit
• Optional
witnessLimit: BN
The maximum amount of witness data allowed for the transaction
Implementation of
BaseTransactionRequestLike.witnessLimit
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:105
witnesses
• witnesses: BytesLike
[] = []
List of witnesses
Implementation of
BaseTransactionRequestLike.witnesses
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:111
Methods
addAccountWitnesses
▸ addAccountWitnesses(account
): Promise
<BaseTransactionRequest
>
Helper function to add an external signature to the transaction.
Parameters
Name | Type | Description |
---|---|---|
account | Account | Account [] | The account/s to sign to the transaction. |
Returns
Promise
<BaseTransactionRequest
>
The transaction with the signature witness added.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:280
addChangeOutput
▸ addChangeOutput(to
, assetId
): void
Adds a change output to the transaction.
Parameters
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the owner. |
assetId | BytesLike | Asset ID of coin. |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:502
addCoinInput
▸ 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.
Parameters
Name | Type | Description |
---|---|---|
coin | Coin | Coin resource. |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:354
addCoinOutput
▸ addCoinOutput(to
, amount
, assetId
): BaseTransactionRequest
Adds a coin output to the transaction.
Parameters
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the owner. |
amount | BigNumberish | Amount of coin. |
assetId | BytesLike | Asset ID of coin. |
Returns
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:466
addCoinOutputs
▸ addCoinOutputs(to
, quantities
): BaseTransactionRequest
Adds multiple coin outputs to the transaction.
Parameters
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the destination. |
quantities | CoinQuantityLike [] | Quantities of coins. |
Returns
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:483
addMessageInput
▸ addMessageInput(message
): void
Adds a single message input to the transaction and a change output for the asset against the message
Parameters
Name | Type | Description |
---|---|---|
message | MessageCoin | Message resource. |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:395
addResource
▸ 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.
Parameters
Name | Type | Description |
---|---|---|
resource | Resource | The resource to add. |
Returns
This transaction.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:436
addResources
▸ addResources(resources
): BaseTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.
Parameters
Name | Type | Description |
---|---|---|
resources | readonly Resource [] | The resources to add. |
Returns
This transaction.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:453
adjustWitnessIndexes
▸ adjustWitnessIndexes(removedIndex
): void
Parameters
Name | Type |
---|---|
removedIndex | number |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:659
calculateMaxGas
▸ calculateMaxGas(chainInfo
, minGas
): BN
Parameters
Name | Type |
---|---|
chainInfo | ChainInfo |
minGas | BN |
Returns
BN
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:550
fundWithFakeUtxos
▸ fundWithFakeUtxos(quantities
, baseAssetId
, resourcesOwner?
): void
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.
Parameters
Name | Type | Description |
---|---|---|
quantities | CoinQuantity [] | CoinQuantity Array. |
baseAssetId | string | The base asset to fund the transaction. |
resourcesOwner? | AbstractAddress | - |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:577
getBaseTransaction
▸ getBaseTransaction(): ToBaseTransactionResponse
Method to obtain the base transaction details.
Returns
ToBaseTransactionResponse
The base transaction details.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:170
getChangeOutputs
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
Returns
ChangeTransactionRequestOutput
[]
The change outputs.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:318
getCoinInputs
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
Returns
The coin inputs.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:296
getCoinOutputs
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
Returns
CoinTransactionRequestOutput
[]
The coin outputs.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:307
getCoinOutputsQuantities
▸ getCoinOutputsQuantities(): CoinQuantity
[]
Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.
Returns
CoinQuantity array.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:626
getTransactionId
▸ getTransactionId(chainId
): string
Gets the Transaction Request by hashing the transaction.
Parameters
Name | Type | Description |
---|---|---|
chainId | number | The chain ID. |
Returns
string
- A hash of the transaction, which is the transaction ID.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:642
removeWitness
▸ removeWitness(index
): void
Parameters
Name | Type |
---|---|
index | number |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:654
toJSON
▸ toJSON(): any
Return the minimum amount in native coins required to create a transaction.
Returns
any
The transaction as a JSON object.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:650
toTransaction
▸ toTransaction(): TransactionScript
| TransactionCreate
Returns
TransactionScript
| TransactionCreate
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:189
toTransactionBytes
▸ toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.
Returns
Uint8Array
The transaction bytes.
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:196
updatePredicateGasUsed
▸ updatePredicateGasUsed(inputs
): void
Parameters
Name | Type |
---|---|
inputs | TransactionRequestInput [] |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:668
updateWitness
▸ updateWitness(index
, witness
): void
Updates an existing witness without any side effects.
Throws
If the witness does not exist.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the witness to update. |
witness | BytesLike | The new witness. |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:267
updateWitnessByOwner
▸ updateWitnessByOwner(address
, signature
): void
Updates the witness for a given owner and signature.
Parameters
Name | Type | Description |
---|---|---|
address | string | AbstractAddress | The address to get the coin input witness index for. |
signature | BytesLike | The signature to update the witness with. |
Returns
void
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:252
getPolicyMeta
▸ getPolicyMeta(req
): Object
Parameters
Name | Type |
---|---|
req | BaseTransactionRequest |
Returns
Object
Name | Type |
---|---|
policies | Policy [] |
policyTypes | number |
Defined in
packages/account/src/providers/transaction-request/transaction-request.ts:136