@fuel-ts/providers .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/providers/src/transaction-request/create-transaction-request.ts:55
• bytecodeWitnessIndex: number
Witness index of contract bytecode to create
packages/providers/src/transaction-request/create-transaction-request.ts:44
• gasPrice: BN
Gas price for transaction
BaseTransactionRequest .gasPrice
packages/providers/src/transaction-request/transaction-request.ts:92
• inputs: TransactionRequestInput
[] = []
List of inputs
BaseTransactionRequest .inputs
packages/providers/src/transaction-request/transaction-request.ts:100
• maturity: number
Block until which tx cannot be included
BaseTransactionRequest .maturity
packages/providers/src/transaction-request/transaction-request.ts:94
• Optional
maxFee: BN
The maximum fee payable by this transaction using BASE_ASSET.
BaseTransactionRequest .maxFee
packages/providers/src/transaction-request/transaction-request.ts:96
• outputs: TransactionRequestOutput
[] = []
List of outputs
BaseTransactionRequest .outputs
packages/providers/src/transaction-request/transaction-request.ts:102
• salt: string
Salt
packages/providers/src/transaction-request/create-transaction-request.ts:46
• storageSlots: TransactionRequestStorageSlot
[]
List of storage slots to initialize
packages/providers/src/transaction-request/create-transaction-request.ts:48
• type: Create
Type of the transaction
packages/providers/src/transaction-request/create-transaction-request.ts:42
• Optional
witnessLimit: BN
The maximum amount of witness data allowed for the transaction
BaseTransactionRequest .witnessLimit
packages/providers/src/transaction-request/transaction-request.ts:98
• witnesses: BytesLike
[] = []
List of witnesses
BaseTransactionRequest .witnesses
packages/providers/src/transaction-request/transaction-request.ts:104
▸ 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:498
▸ 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:316
▸ addCoinOutput(to
, amount
, assetId?
): CreateTransactionRequest
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:462
▸ 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/providers/src/transaction-request/transaction-request.ts:479
▸ addContractCreatedOutput(contractId
, stateRoot
): void
Adds a contract created output to the transaction request.
Name | Type | Description |
---|---|---|
contractId | BytesLike | The contract ID. |
stateRoot | BytesLike | The state root. |
void
packages/providers/src/transaction-request/create-transaction-request.ts:116
▸ 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:359
▸ addPredicateResource(resource
, predicate
): CreateTransactionRequest
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:432
▸ addPredicateResources(resources
, predicate
): CreateTransactionRequest
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:449
▸ 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/providers/src/transaction-request/transaction-request.ts:402
▸ 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/providers/src/transaction-request/transaction-request.ts:419
▸ calculateMaxGas(chainInfo
, minGas
): BN
Name | Type |
---|---|
chainInfo | ChainInfo |
minGas | BN |
BN
BaseTransactionRequest .calculateMaxGas
packages/providers/src/transaction-request/transaction-request.ts:543
▸ fundWithFakeUtxos(quantities
): void
Funds the transaction with fake UTXOs for each assetId and amount in the quantities array.
Name | Type | Description |
---|---|---|
quantities | CoinQuantity [] | CoinQuantity Array. |
void
BaseTransactionRequest .fundWithFakeUtxos
packages/providers/src/transaction-request/transaction-request.ts:565
▸ getBaseTransaction(): ToBaseTransactionResponse
Method to obtain the base transaction details.
ToBaseTransactionResponse
The base transaction details.
BaseTransactionRequest .getBaseTransaction
packages/providers/src/transaction-request/transaction-request.ts:162
▸ getChangeOutputs(): ChangeTransactionRequestOutput
[]
Gets the change outputs for a transaction.
ChangeTransactionRequestOutput
[]
The change outputs.
BaseTransactionRequest .getChangeOutputs
packages/providers/src/transaction-request/transaction-request.ts:278
▸ getCoinInputs(): CoinTransactionRequestInput
[]
Gets the coin inputs for a transaction.
CoinTransactionRequestInput
[]
The coin inputs.
BaseTransactionRequest .getCoinInputs
packages/providers/src/transaction-request/transaction-request.ts:256
▸ getCoinOutputs(): CoinTransactionRequestOutput
[]
Gets the coin outputs for a transaction.
CoinTransactionRequestOutput
[]
The coin outputs.
BaseTransactionRequest .getCoinOutputs
packages/providers/src/transaction-request/transaction-request.ts:267
▸ getCoinOutputsQuantities(): CoinQuantity
[]
Retrieves an array of CoinQuantity for each coin output present in the transaction. a transaction.
CoinQuantity
[]
CoinQuantity array.
BaseTransactionRequest .getCoinOutputsQuantities
packages/providers/src/transaction-request/transaction-request.ts:612
▸ getContractCreatedOutputs(): ContractCreatedTransactionRequestOutput
[]
Get contract created outputs for the transaction.
ContractCreatedTransactionRequestOutput
[]
An array of contract created transaction request outputs.
packages/providers/src/transaction-request/create-transaction-request.ts:92
▸ getTransactionId(chainId
): string
Gets the Transaction Request by hashing the transaction.
Name | Type | Description |
---|---|---|
chainId | number | The chain ID. |
string
BaseTransactionRequest .getTransactionId
packages/providers/src/transaction-request/create-transaction-request.ts:106
▸ metadataGas(gasCosts
): BN
Name | Type |
---|---|
gasCosts | GqlGasCosts |
BN
BaseTransactionRequest.metadataGas
packages/providers/src/transaction-request/create-transaction-request.ts:129
▸ 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:636
▸ toTransaction(): TransactionCreate
Converts the transaction request to a TransactionCreate
.
TransactionCreate
The transaction create object.
BaseTransactionRequest .toTransaction
packages/providers/src/transaction-request/create-transaction-request.ts:72
▸ toTransactionBytes(): Uint8Array
Converts the transaction request to a byte array.
Uint8Array
The transaction bytes.
BaseTransactionRequest .toTransactionBytes
packages/providers/src/transaction-request/transaction-request.ts:188
▸ 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:244
▸ 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/providers/src/transaction-request/transaction-request.ts:229
▸ from(obj
): CreateTransactionRequest
Name | Type |
---|---|
obj | CreateTransactionRequestLike |
packages/providers/src/transaction-request/create-transaction-request.ts:34
▸ getPolicyMeta(req
): Object
Name | Type |
---|---|
req | BaseTransactionRequest |
Object
Name | Type |
---|---|
policies | Policy [] |
policyTypes | number |
BaseTransactionRequest .getPolicyMeta
packages/providers/src/transaction-request/transaction-request.ts:129