Block Explorer API¶
Parameters |
Description |
|---|---|
host |
Block explorer base url, e.g. |
client |
Non-default REST client injection of type |
Reconfigure Client and Host¶
from pypergraph import DagTokenNetwork
from pypergraph.core.cross_platform.di.RESTClient
class InjectClient(RESTClient)
...
inject_client = InjectClient()
network = DagTokenNetwork(...)
network.be_api.config(host=..., client=inject_client)
All Methods¶
- class pypergraph.network.api.block_explorer_api.BlockExplorerApi(host: str, client: RESTClient | None = None, timeout: int = 25)[source]
Bases:
object- config(host: str | None = None, client: RESTClient | None = None)[source]
Reconfigure the RestAPIClient.
- async get_address_balance(hash: str) Balance[source]
Retrieve the balance for a given address from the block explorer.
- Parameters:
hash – Address hash.
- Returns:
Balance object.
- async get_currency_snapshot(metagraph_id: str, hash_or_ordinal: str) CurrencySnapshot[source]
- async get_currency_snapshot_rewards(metagraph_id: str, hash_or_ordinal: str) List[RewardTransaction][source]
- async get_currency_transaction(metagraph_id: str, hash: str) Transaction[source]
- async get_currency_transactions(metagraph_id: str, limit: int | None, search_after: str | None = None, search_before: str | None = None) List[Transaction][source]
- async get_currency_transactions_by_address(metagraph_id: str, address: str, limit: int = 0, search_after: str = '', sent_only: bool = False, received_only: bool = False, search_before: str = '') List[Transaction][source]
- async get_currency_transactions_by_snapshot(metagraph_id: str, hash_or_ordinal: str, limit: int = 0, search_after: str = '', search_before: str = '') List[Transaction][source]
- async get_latest_currency_snapshot(metagraph_id: str) CurrencySnapshot[source]
- async get_latest_currency_snapshot_rewards(metagraph_id: str) List[RewardTransaction][source]
- async get_latest_snapshot() Snapshot[source]
Get the latest snapshot from the block explorer.
- Returns:
Snapshot object.
- async get_latest_snapshot_rewards() List[RewardTransaction][source]
- async get_latest_snapshot_transactions() List[Transaction][source]
Retrieve transactions for the latest snapshot.
- Returns:
List of Transaction objects.
- async get_rewards_by_snapshot(id: str | int) List[RewardTransaction][source]
Retrieve reward objects for a given snapshot.
- Parameters:
id – Hash or ordinal.
- Returns:
List of Reward objects.
- async get_snapshot(id: str | int) Snapshot[source]
Retrieve a snapshot by its hash or ordinal.
- Parameters:
id – Hash or ordinal identifier.
- Returns:
Snapshot object.
- async get_transaction(hash: str) Transaction[source]
Retrieve a transaction by its hash.
- Parameters:
hash – Transaction hash.
- Returns:
Transaction object.
- async get_transactions(limit: int | None, search_after: str | None = None, search_before: str | None = None) List[Transaction][source]
Get transactions from the block explorer. Supports pagination.
- Parameters:
limit – Maximum number of transactions.
search_after – Pagination parameter.
search_before – Pagination parameter.
- Returns:
List of Transaction objects.
- async get_transactions_by_address(address: str, limit: int = 0, search_after: str = '', sent_only: bool = False, received_only: bool = False, search_before: str = '') List[Transaction][source]
Retrieve transactions for a specific DAG address. Supports pagination.
- Parameters:
address – DAG address.
limit – Maximum number of transactions.
search_after – Pagination parameter.
sent_only – Filter for sent transactions.
received_only – Filter for received transactions.
search_before – Pagination parameter.
- Returns:
List of Transaction objects.
- async get_transactions_by_snapshot(id: str | int) List[Transaction][source]
Retrieve transactions for a given snapshot.
- Parameters:
id – Hash or ordinal identifier.
- Returns:
List of Transaction objects.