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.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Block endpoints."""
|
||||
|
||||
from .client import Client
|
||||
from .models import Block
|
||||
from .models import Block, InterchainTrace
|
||||
|
||||
|
||||
class BlockClient:
|
||||
@@ -10,3 +10,11 @@ class BlockClient:
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user