@fuel-ts/account .BaseTransactionRequest
Abstract class to define the functionalities of a transaction request transaction request.
BaseTransactionRequest
BaseTransactionRequestLike
• new BaseTransactionRequest(baseTransactionRequest?
): BaseTransactionRequest
Constructor for initializing a base transaction request.
Name | Type | Description |
---|---|---|
baseTransactionRequest | BaseTransactionRequestLike | Optional object containing properties to initialize the transaction request. |
packages/account/src/providers/transaction-request/transaction-request.ts:114
• gasPrice: BN
Gas price for transaction
BaseTransactionRequestLike.gasPrice
packages/account/src/providers/transaction-request/transaction-request.ts:95
• inputs: TransactionRequestInput
[] = []
List of inputs
BaseTransactionRequestLike.inputs
packages/account/src/providers/transaction-request/transaction-request.ts:103
• maturity: number
Block until which tx cannot be included
BaseTransactionRequestLike.maturity
packages/account/src/providers/transaction-request/transaction-request.ts:97
• Optional
maxFee: BN
The maximum fee payable by this transaction using BASE_ASSET.
BaseTransactionRequestLike.maxFee
packages/account/src/providers/transaction-request/transaction-request.ts:99
• outputs: TransactionRequestOutput
[] = []
List of outputs
BaseTransactionRequestLike.outputs
packages/account/src/providers/transaction-request/transaction-request.ts:105
• Abstract
type: TransactionType
Type of the transaction
packages/account/src/providers/transaction-request/transaction-request.ts:93
• Optional
witnessLimit: BN
The maximum amount of witness data allowed for the transaction
BaseTransactionRequestLike.witnessLimit
packages/account/src/providers/transaction-request/transaction-request.ts:101
• witnesses: BytesLike
[] = []
List of witnesses
BaseTransactionRequestLike.witnesses
packages/account/src/providers/transaction-request/transaction-request.ts:107
▸ addAccountWitnesses(account
): Promise
<BaseTransactionRequest
>
Helper function to add an external signature to the transaction.
Promise
<BaseTransactionRequest
>
The transaction with the signature witness added.
packages/account/src/providers/transaction-request/transaction-request.ts:275
▸ 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/account/src/providers/transaction-request/transaction-request.ts:533
▸ 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.
void
packages/account/src/providers/transaction-request/transaction-request.ts:351
▸ 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/account/src/providers/transaction-request/transaction-request.ts:497
▸ 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/account/src/providers/transaction-request/transaction-request.ts:514
▸ 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? | Predicate <InputValue []> | Predicate bytes. |
void
packages/account/src/providers/transaction-request/transaction-request.ts:394
▸ addPredicateResource(resource
, predicate
): BaseTransactionRequest
Adds multiple resources to the transaction by adding coin/message inputs and change outputs from the related assetIds.
This transaction.
packages/account/src/providers/transaction-request/transaction-request.ts:467
▸ addPredicateResources(resources
, predicate
): BaseTransactionRequest
Adds multiple predicate coin/message inputs to the transaction and change outputs from the related assetIds.
This transaction.
packages/account/src/providers/transaction-request/transaction-request.ts:484
▸ 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/account/src/providers/transaction-request/transaction-request.ts:437
▸ 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/account/src/providers/transaction-request/transaction-request.ts:454
▸ calculateMaxGas(chainInfo
, minGas
): BN
Name | Type |
---|---|
chainInfo | ChainInfo |
minGas | BN |
BN
packages/account/src/providers/transaction-request/transaction-request.ts:578
▸ fundWithFakeUtxos(quantities
, resourcesOwner?
): void
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.
Name | Type | Description |
---|---|---|
quantities | CoinQuantity [] | CoinQuantity Array. |
resourcesOwner? | AbstractAddress | - |
void
packages/account/src/providers/transaction-request/transaction-request.ts:600
▸ getBaseTransaction(): ToBaseTransactionResponse
Method to obtain the base transaction details.
ToBaseTransactionResponse
The base transaction details.
packages/account/src/providers/transaction-request/transaction-request.ts:165
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
packages/account/src/providers/transaction-request/transaction-request.ts:313
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
packages/account/src/providers/transaction-request/transaction-request.ts:291
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
packages/account/src/providers/transaction-request/transaction-request.ts:302
▸ getCoinOutputsQuantities(): CoinQuantity
[]
Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.
CoinQuantity
[]
CoinQuantity array.
packages/account/src/providers/transaction-request/transaction-request.ts:647
▸ getTransactionId(chainId
): string
Gets the Transaction Request by hashing the transaction.
Name | Type | Description |
---|---|---|
chainId | number | The chain ID. |
string
packages/account/src/providers/transaction-request/transaction-request.ts:663
▸ toJSON(): any
Return the minimum amount in native coins required to create a transaction.
any
The transaction as a JSON object.
packages/account/src/providers/transaction-request/transaction-request.ts:671
▸ toTransaction(): TransactionCreate
| TransactionScript
TransactionCreate
| TransactionScript
packages/account/src/providers/transaction-request/transaction-request.ts:184
▸ toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.
Uint8Array
The transaction bytes.
packages/account/src/providers/transaction-request/transaction-request.ts:191
▸ updatePredicateInputs(inputs
): void
Name | Type |
---|---|
inputs | TransactionRequestInput [] |
void
packages/account/src/providers/transaction-request/transaction-request.ts:675
▸ 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/account/src/providers/transaction-request/transaction-request.ts:262
▸ updateWitnessByOwner(address
, signature
): void
Updates the witness for a given owner and signature.
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. |
void
packages/account/src/providers/transaction-request/transaction-request.ts:247
▸ getPolicyMeta(req
): Object
Name | Type |
---|---|
req | BaseTransactionRequest |
Object
Name | Type |
---|---|
policies | Policy [] |
policyTypes | number |
packages/account/src/providers/transaction-request/transaction-request.ts:132