@fuel-ts/account .CreateTransactionRequest
CreateTransactionRequest
provides functionalities for creating a transaction request that creates a contract.
↳ CreateTransactionRequest
• new CreateTransactionRequest(createTransactionRequestLike
): CreateTransactionRequest
Creates an instance CreateTransactionRequest
.
Name | Type | Description |
---|---|---|
createTransactionRequestLike | CreateTransactionRequestLike | The initial values for the instance |
BaseTransactionRequest .constructor
packages/account/src/providers/transaction-request/create-transaction-request.ts:55
• bytecodeWitnessIndex: number
Witness index of contract bytecode to create
packages/account/src/providers/transaction-request/create-transaction-request.ts:44
• inputs: TransactionRequestInput
[] = []
List of inputs
BaseTransactionRequest .inputs
packages/account/src/providers/transaction-request/transaction-request.ts:107
• Optional
maturity: number
Block until which tx cannot be included
BaseTransactionRequest .maturity
packages/account/src/providers/transaction-request/transaction-request.ts:101
• maxFee: BN
The maximum fee payable by this transaction using BASE_ASSET.
BaseTransactionRequest .maxFee
packages/account/src/providers/transaction-request/transaction-request.ts:103
• outputs: TransactionRequestOutput
[] = []
List of outputs
BaseTransactionRequest .outputs
packages/account/src/providers/transaction-request/transaction-request.ts:109
• salt: string
Salt
packages/account/src/providers/transaction-request/create-transaction-request.ts:46
• storageSlots: TransactionRequestStorageSlot
[]
List of storage slots to initialize
packages/account/src/providers/transaction-request/create-transaction-request.ts:48
• Optional
tip: BN
Gas price for transaction
packages/account/src/providers/transaction-request/transaction-request.ts:99
• type: Create
Type of the transaction
packages/account/src/providers/transaction-request/create-transaction-request.ts:42
• Optional
witnessLimit: BN
The maximum amount of witness data allowed for the transaction
BaseTransactionRequest .witnessLimit
packages/account/src/providers/transaction-request/transaction-request.ts:105
• witnesses: BytesLike
[] = []
List of witnesses
BaseTransactionRequest .witnesses
packages/account/src/providers/transaction-request/transaction-request.ts:111
▸ addAccountWitnesses(account
): Promise
<CreateTransactionRequest
>
Helper function to add an external signature to the transaction.
Promise
<CreateTransactionRequest
>
The transaction with the signature witness added.
BaseTransactionRequest .addAccountWitnesses
packages/account/src/providers/transaction-request/transaction-request.ts:280
▸ addChangeOutput(to
, assetId
): void
Adds a change output to the transaction.
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the owner. |
assetId | BytesLike | Asset ID of coin. |
void
BaseTransactionRequest .addChangeOutput
packages/account/src/providers/transaction-request/transaction-request.ts:502
▸ 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.
Name | Type | Description |
---|---|---|
coin | Coin | Coin resource. |
void
BaseTransactionRequest .addCoinInput
packages/account/src/providers/transaction-request/transaction-request.ts:354
▸ addCoinOutput(to
, amount
, assetId
): CreateTransactionRequest
Adds a coin output to the transaction.
Name | Type | Description |
---|---|---|
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:466
▸ addCoinOutputs(to
, quantities
): CreateTransactionRequest
Adds multiple coin outputs to the transaction.
Name | Type | Description |
---|---|---|
to | AddressLike | Address of the destination. |
quantities | CoinQuantityLike [] | Quantities of coins. |
BaseTransactionRequest .addCoinOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:483
▸ addContractCreatedOutput(contractId
, stateRoot
): void
Adds a contract created output to the transaction request.
void
packages/account/src/providers/transaction-request/create-transaction-request.ts:110
▸ addMessageInput(message
): void
Adds a single message input to the transaction and a change output for the asset against the message
Name | Type | Description |
---|---|---|
message | MessageCoin | Message resource. |
void
BaseTransactionRequest .addMessageInput
packages/account/src/providers/transaction-request/transaction-request.ts:395
▸ addResource(resource
): CreateTransactionRequest
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/account/src/providers/transaction-request/transaction-request.ts:436
▸ addResources(resources
): CreateTransactionRequest
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/account/src/providers/transaction-request/transaction-request.ts:453
▸ calculateMaxGas(chainInfo
, minGas
): BN
Name | Type |
---|---|
chainInfo | ChainInfo |
minGas | BN |
BN
BaseTransactionRequest .calculateMaxGas
packages/account/src/providers/transaction-request/transaction-request.ts:550
▸ fundWithFakeUtxos(quantities
, baseAssetId
, resourcesOwner?
): void
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.
Name | Type | Description |
---|---|---|
quantities | CoinQuantity [] | CoinQuantity Array. |
baseAssetId | string | The base asset to fund the transaction. |
resourcesOwner? | AbstractAddress | - |
void
BaseTransactionRequest .fundWithFakeUtxos
packages/account/src/providers/transaction-request/transaction-request.ts:577
▸ 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:170
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
BaseTransactionRequest .getChangeOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:318
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
BaseTransactionRequest .getCoinInputs
packages/account/src/providers/transaction-request/transaction-request.ts:296
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
BaseTransactionRequest .getCoinOutputs
packages/account/src/providers/transaction-request/transaction-request.ts:307
▸ 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:626
▸ getContractCreatedOutputs(): ContractCreatedTransactionRequestOutput
[]
Get contract created outputs for the transaction.
ContractCreatedTransactionRequestOutput
[]
An array of contract created transaction request outputs.
packages/account/src/providers/transaction-request/create-transaction-request.ts:86
▸ getTransactionId(chainId
): string
Gets the Transaction Request by hashing the transaction.
Name | Type | Description |
---|---|---|
chainId | number | The chain ID. |
string
BaseTransactionRequest .getTransactionId
packages/account/src/providers/transaction-request/create-transaction-request.ts:100
▸ metadataGas(gasCosts
): BN
Name | Type |
---|---|
gasCosts | GasCosts |
BN
BaseTransactionRequest.metadataGas
packages/account/src/providers/transaction-request/create-transaction-request.ts:123
▸ removeWitness(index
): void
Name | Type |
---|---|
index | number |
void
BaseTransactionRequest .removeWitness
packages/account/src/providers/transaction-request/transaction-request.ts:654
▸ 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:650
▸ toTransaction(): TransactionCreate
Converts the transaction request to a TransactionCreate
.
TransactionCreate
The transaction create object.
BaseTransactionRequest .toTransaction
packages/account/src/providers/transaction-request/create-transaction-request.ts:67
▸ 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:196
▸ updatePredicateGasUsed(inputs
): void
Name | Type |
---|---|
inputs | TransactionRequestInput [] |
void
BaseTransactionRequest .updatePredicateGasUsed
packages/account/src/providers/transaction-request/transaction-request.ts:668
▸ 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/account/src/providers/transaction-request/transaction-request.ts:267
▸ 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
BaseTransactionRequest .updateWitnessByOwner
packages/account/src/providers/transaction-request/transaction-request.ts:252
▸ from(obj
): CreateTransactionRequest
Name | Type |
---|---|
obj | CreateTransactionRequestLike |
packages/account/src/providers/transaction-request/create-transaction-request.ts:34
▸ getPolicyMeta(req
): Object
Name | Type |
---|---|
req | BaseTransactionRequest |
Object
Name | Type |
---|---|
policies | Policy [] |
policyTypes | number |
BaseTransactionRequest .getPolicyMeta
packages/account/src/providers/transaction-request/transaction-request.ts:136