Message v1

Mirror of solana_message::v1 (SIMD-0385).

Message

alias of MessageV1

exception MessageError

Umbrella error for solders.message.v1.Message validation.

class TransactionConfig(priority_fee=None, compute_unit_limit=None, loaded_accounts_data_size_limit=None, heap_size=None)

Inline transaction configuration carried by a MessageV1.

V1 messages carry the compute budget settings that legacy and v0 messages have to express as separate ComputeBudget instructions. Every field is optional; an unset field is simply omitted from the serialized message.

Parameters:
  • priority_fee (Optional[int]) – The priority fee in micro-lamports. Defaults to None.

  • compute_unit_limit (Optional[int]) – The compute unit limit. Defaults to None.

  • loaded_accounts_data_size_limit (Optional[int]) – The loaded accounts data size limit in bytes. Defaults to None.

  • heap_size (Optional[int]) – The requested heap size in bytes. Defaults to None.

Example

>>> from solders.message import TransactionConfig
>>> config = TransactionConfig(priority_fee=1000, compute_unit_limit=200_000)
>>> config.priority_fee
1000
compute_unit_limit

The compute unit limit.

Type:

Optional[int]

static default()

Create a new default TransactionConfig, with every field unset.

Returns:

default TransactionConfig.

Return type:

TransactionConfig

static from_bytes(data)

Deserialize a serialized TransactionConfig object.

Parameters:

data (bytes) – The serialized TransactionConfig.

Returns:

The deserialized TransactionConfig.

Return type:

TransactionConfig

static from_json(raw)

Build from a JSON string.

heap_size

The requested heap size, in bytes.

Type:

Optional[int]

loaded_accounts_data_size_limit

The loaded accounts data size limit, in bytes.

Type:

Optional[int]

priority_fee

The priority fee in micro-lamports.

Type:

Optional[int]

size()

The number of bytes this config occupies in a serialized MessageV1.

Returns:

The serialized size.

Return type:

int

to_json()

Convert to a JSON string.