setTransactionMessageComputeUnitPrice
Sets the compute unit price for a legacy or v0 transaction message.
The value represents the price in micro-lamports per compute unit. The actual priority fee
paid is computeUnitPrice × computeUnitLimit.
This appends, replaces, or removes a SetComputeUnitPrice instruction from the Compute Budget
program. The operation is idempotent: setting the same value returns the same reference, and
setting undefined removes the instruction.
Type Parameters
| Type Parameter | Description |
|---|---|
TTransactionMessage extends TransactionMessage & object | The transaction message type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
computeUnitPrice | bigint | undefined | The price in micro-lamports per compute unit, or undefined to remove the instruction. |
transactionMessage | TTransactionMessage | The legacy or v0 transaction message to configure. |
Returns
TTransactionMessage
A new transaction message with the compute unit price set.
Example
See
- getTransactionMessageComputeUnitPrice
- setTransactionMessagePriorityFeeLamports for v1 transactions.