get_interchain: per_chain + chains options (default first anchor per chain); bump 0.5.0
All checks were successful
Publish to PyPI Registry / publish (release) Successful in 23s
All checks were successful
Publish to PyPI Registry / publish (release) Successful in 23s
transaction.get_interchain / block.get_interchain take per_chain= and chains= kwargs mapping to prime-node's ?perChain=&chains= params. Default (no kwargs) returns one anchor per chain. Shared interchain_query() helper, exported; pytest.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
"""Block endpoints."""
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from .client import Client
|
||||
from .interchain import interchain_query
|
||||
from .models import Block, InterchainTrace
|
||||
|
||||
|
||||
@@ -11,10 +14,21 @@ 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:
|
||||
def get_interchain(
|
||||
self,
|
||||
block_id: str,
|
||||
per_chain: Optional[int] = None,
|
||||
chains: Optional[List[str]] = None,
|
||||
) -> InterchainTrace:
|
||||
"""Trace a block to the validator (verification) blocks that validated it
|
||||
and the public-chain interchain anchors those validator blocks were
|
||||
bundled into."""
|
||||
bundled into.
|
||||
|
||||
By default returns the first anchor per public chain (anchor proofs are
|
||||
chained, so the earliest per chain is the meaningful one). ``per_chain``
|
||||
caps anchors per chain (1 = first per chain; 0 = all); ``chains``
|
||||
restricts to specific chain ids."""
|
||||
return self._client.get(
|
||||
f"/api/v1/block/{block_id}/interchain", InterchainTrace
|
||||
f"/api/v1/block/{block_id}/interchain{interchain_query(per_chain, chains)}",
|
||||
InterchainTrace,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user