fillTransactionMessageProvisoryComputeUnitLimit

function fillTransactionMessageProvisoryComputeUnitLimit<
    TTransactionMessage,
>(transactionMessage): TTransactionMessage;

Sets the compute unit limit to a provisory value of 0 if no compute unit limit is currently set on the transaction message. If a limit is already set (any value, including 0), the message is returned unchanged.

This is useful during transaction construction to reserve space for a compute unit limit that will later be replaced with an actual estimate via estimateAndSetComputeUnitLimitFactory.

Type Parameters

Type Parameter
TTransactionMessage extends TransactionMessage

Parameters

ParameterTypeDescription
transactionMessageTTransactionMessageThe transaction message to add a provisory limit to.

Returns

TTransactionMessage

The transaction message with a provisory compute unit limit set, or unchanged if one was already present.

Example

import { fillTransactionMessageProvisoryComputeUnitLimit } from '@solana/kit';
 
const messageWithProvisoryLimit = fillTransactionMessageProvisoryComputeUnitLimit(transactionMessage);

On this page