fillTransactionMessageProvisoryResourceLimits

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

Sets resource limits to a provisory value of 0 if no limit is currently set on the transaction message.

For all versions, this fills the compute unit limit. For version 1 messages, it also fills the loaded accounts data size limit. If a limit is already set (any value, including 0), that limit is left unchanged.

This is useful during transaction construction to reserve space for resource limits that will later be replaced with actual estimates via estimateAndSetResourceLimitsFactory.

Type Parameters

Type Parameter
TTransactionMessage extends TransactionMessage

Parameters

ParameterTypeDescription
transactionMessageTTransactionMessageThe transaction message to add provisory limits to.

Returns

TTransactionMessage

The transaction message with provisory resource limits set, or unchanged if all applicable limits were already present.

Example

import { fillTransactionMessageProvisoryResourceLimits } from '@solana/kit';
 
const messageWithProvisoryLimits = fillTransactionMessageProvisoryResourceLimits(transactionMessage);

On this page