New transaction.get_interchain and block.get_interchain call the prime-node
/api/v1/{transaction,block}/{id}/interchain endpoints, returning an
InterchainTrace {block_id, validator_blocks, interchain_transactions}. Adds
VerificationBlock / InterchainTransaction / InterchainTrace dataclasses with
from_dict, exports them, and a from_dict test.
21 lines
656 B
Python
21 lines
656 B
Python
"""Block endpoints."""
|
|
|
|
from .client import Client
|
|
from .models import Block, InterchainTrace
|
|
|
|
|
|
class BlockClient:
|
|
def __init__(self, client: Client):
|
|
self._client = client
|
|
|
|
def get(self, block_id: str) -> Block:
|
|
return self._client.get(f"/api/v1/block/{block_id}", Block)
|
|
|
|
def get_interchain(self, block_id: str) -> InterchainTrace:
|
|
"""Trace a block to the validator (verification) blocks that validated it
|
|
and the public-chain interchain anchors those validator blocks were
|
|
bundled into."""
|
|
return self._client.get(
|
|
f"/api/v1/block/{block_id}/interchain", InterchainTrace
|
|
)
|