mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-01-08 16:13:09 +00:00
22 lines
504 B
Python
22 lines
504 B
Python
|
|
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,
|
||
|
|
)
|