Files
prime-sdk-python/prime_sdk/block.py
Andrew Miller e4e49218d0 add get_interchain: trace a transaction/block to validator blocks + interchain anchors
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.
2026-06-02 14:12:59 -04:00

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
)