setTransactionMessageComputeUnitLimit
Sets the compute unit limit for a transaction message.
This function works with all transaction versions:
- V1: Sets the
computeUnitLimitfield in the transaction message's config. - Legacy / V0: Appends (or replaces) a
SetComputeUnitLimitinstruction from the Compute Budget program.
Type Parameters
| Type Parameter | Description |
|---|---|
TTransactionMessage extends TransactionMessage | The transaction message type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
computeUnitLimit | number | undefined | The maximum compute units (CUs) allowed, or undefined to remove the limit. |
transactionMessage | TTransactionMessage | The transaction message to configure. |
Returns
TTransactionMessage
A new transaction message with the compute unit limit set.