jam.types.work.package module
Work package types for the JAM protocol.
- class jam.types.work.package.Authorizer(code_hash: ByteArray32, params: Bytes)[source]
-
Authorizer structure.
- code_hash: ByteArray32
- __init__(code_hash: ByteArray32, params: Bytes) 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
- class jam.types.work.package.WorkItems(initial: Sequence[T] = [], codec: Codec[T] | None = None)[source]
-
- 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.work.package.WorkPackage(authorization: Bytes, auth_code_host: U32, authorizer: Authorizer, context: RefineContext, items: WorkItems)[source]
-
Work package structure.
- authorizer: Authorizer
- context: RefineContext
- __init__(authorization: Bytes, auth_code_host: U32, authorizer: Authorizer, context: RefineContext, items: WorkItems) 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