Header Type - JAM
- class jam.types.header.TicketsMark(initial: Sequence[T] = [], codec: Codec[T] | None = None)[source]
Bases:
Array[TicketBody]- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Any, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.header.OffendersMark(initial: Sequence[T] = [], codec: Codec[T] | None = None)[source]
Bases:
Vector[ByteArray32]- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Vector[T], int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.header.OptionalEpochMark(initial: Codable = Null)[source]
Bases:
Option- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Option, int]
Decode option from buffer.
- Parameters:
optional_type – Type of the optional value
buffer – Source buffer
offset – Starting offset
- Returns:
Tuple of (decoded value, bytes read)
- Raises:
DecodeError – If buffer is invalid or too short
ValueError – If types list is empty
- class jam.types.header.OptionalTicketsMark(initial: Codable = Null)[source]
Bases:
Option- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Option, int]
Decode option from buffer.
- Parameters:
optional_type – Type of the optional value
buffer – Source buffer
offset – Starting offset
- Returns:
Tuple of (decoded value, bytes read)
- Raises:
DecodeError – If buffer is invalid or too short
ValueError – If types list is empty
- class jam.types.header.Header(parent: ByteArray32, parent_state_root: ByteArray32, extrinsic_hash: ByteArray32, slot: U32, epoch_mark: OptionalEpochMark, tickets_mark: OptionalTicketsMark, offenders_mark: OffendersMark, author_index: U16, entropy_source: ByteArray96, seal: ByteArray96)[source]
-
Block header structure.
- parent: ByteArray32
- parent_state_root: ByteArray32
- extrinsic_hash: ByteArray32
- epoch_mark: OptionalEpochMark
- tickets_mark: OptionalTicketsMark
- offenders_mark: OffendersMark
- entropy_source: ByteArray96
- seal: ByteArray96
- __init__(parent: ByteArray32, parent_state_root: ByteArray32, extrinsic_hash: ByteArray32, slot: U32, epoch_mark: OptionalEpochMark, tickets_mark: OptionalTicketsMark, offenders_mark: OffendersMark, author_index: U16, entropy_source: ByteArray96, seal: ByteArray96) None
Initialize the Codable.
- Parameters:
codec – Optional codec to use for encoding/decoding
enc_sequence – Optional function that returns sequence of fields to encode
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[T, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing