getTransactionMessageHeapSize

function getTransactionMessageHeapSize(
    transactionMessage,
): number | undefined;

Returns the heap size currently set on a transaction message, or undefined if none is set.

This function works with all transaction versions:

  • V1: Reads from the transaction message's config.heapSize.
  • Legacy / V0: Searches the instructions for a RequestHeapFrame instruction and decodes its value.

Parameters

ParameterTypeDescription
transactionMessageTransactionMessageThe transaction message to inspect.

Returns

number | undefined

The heap size in bytes, or undefined if none is set.

Example

const heapSize = getTransactionMessageHeapSize(transactionMessage);
if (heapSize !== undefined) {
    console.log(`Heap size: ${heapSize}`);
}

On this page