setTransactionMessageHeapSize

function setTransactionMessageHeapSize<TTransactionMessage>(
    heapSize,
    transactionMessage,
): TTransactionMessage;

Sets the heap frame size for a transaction message.

This function works with all transaction versions:

  • V1: Sets the heapSize field in the transaction message's config.
  • Legacy / V0: Appends (or replaces) a RequestHeapFrame instruction from the Compute Budget program.

Type Parameters

Type ParameterDescription
TTransactionMessage extends TransactionMessageThe transaction message type.

Parameters

ParameterTypeDescription
heapSizenumber | undefinedThe requested heap frame size in bytes, or undefined to remove the setting.
transactionMessageTTransactionMessageThe transaction message to configure.

Returns

TTransactionMessage

A new transaction message with the heap size set.

Example

const txMessage = setTransactionMessageHeapSize(
    256_000,
    transactionMessage,
);

On this page