22 lines
504 B
Python
Raw Normal View History

2025-10-20 15:42:12 +02:00
from typing import List, Self
from core.models import NbeSchema
from node.models.blocks import Block, Header
from node.models.transactions import Transaction
class BlockRead(NbeSchema):
id: int
slot: int
header: Header
transactions: List[Transaction]
@classmethod
def from_block(cls, block: Block) -> Self:
return cls(
id=block.id,
slot=block.header.slot,
header=block.header,
transactions=block.transactions,
)