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 @@
|
||||
"""Transaction endpoints."""
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from .client import CONTENT_TYPE_JSON, Client
|
||||
from .interchain import interchain_query
|
||||
from .models import (
|
||||
InterchainTrace,
|
||||
ListTransactionsResponse,
|
||||
@@ -40,13 +43,25 @@ class TransactionClient:
|
||||
def get(self, transaction_id: str) -> Transaction:
|
||||
return self._client.get(f"/api/v1/transaction/{transaction_id}", Transaction)
|
||||
|
||||
def get_interchain(self, transaction_id: str) -> InterchainTrace:
|
||||
def get_interchain(
|
||||
self,
|
||||
transaction_id: str,
|
||||
per_chain: Optional[int] = None,
|
||||
chains: Optional[List[str]] = None,
|
||||
) -> InterchainTrace:
|
||||
"""Trace a transaction to the validator (verification) blocks that
|
||||
validated its prime block and the public-chain interchain anchors those
|
||||
validator blocks were bundled into. If the transaction is still pending
|
||||
(not yet in a block) the trace's lists are empty."""
|
||||
(not yet in a block) the trace's lists are empty.
|
||||
|
||||
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/transaction/{transaction_id}/interchain", InterchainTrace
|
||||
f"/api/v1/transaction/{transaction_id}/interchain"
|
||||
f"{interchain_query(per_chain, chains)}",
|
||||
InterchainTrace,
|
||||
)
|
||||
|
||||
def list(self) -> ListTransactionsResponse:
|
||||
|
||||
Reference in New Issue
Block a user