pypergraph.network.api package¶
Submodules¶
pypergraph.network.api.block_explorer_api module¶
- 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.
pypergraph.network.api.layer_0_api module¶
- class pypergraph.network.api.layer_0_api.L0Api(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_delegated_stake_last_reference(address: str) TransactionReference[source]¶
- async get_latest_snapshot() SignedGlobalIncrementalSnapshot[source]¶
- async get_metrics() List[Dict[str, Any]][source]¶
Get metrics from the L0 endpoint.
- Returns:
Prometheus output as a list of dictionaries.
- async get_node_collateral_last_reference(address: str) TransactionReference[source]¶
- async get_node_parameters(search_name_or_id: str | None = None, sort: Literal['name', 'peerID', 'address', 'totalAddressesAssigned', 'totalAmountDelegated'] | None = None, sort_order: Literal['ASC', 'DESC'] | None = None)[source]¶
- async get_total_supply() TotalSupply[source]¶
pypergraph.network.api.layer_1_api module¶
- class pypergraph.network.api.layer_1_api.L1Api(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_last_reference(address: str) TransactionReference[source]¶
- async get_metrics() List[Dict[str, Any]][source]¶
Get metrics from the L1 endpoint.
- Returns:
Prometheus output as a list of dictionaries.
- async get_pending_transaction(hash: str) PendingTransaction[source]¶
- async post_transaction(tx: SignedTransaction)[source]¶
pypergraph.network.api.metagraph_currency_layer_1_api module¶
- class pypergraph.network.api.metagraph_currency_layer_1_api.ML1Api(host: str, client: RESTClient | None = None, timeout: int = 25)[source]¶
Bases:
L1Api
pypergraph.network.api.metagraph_data_layer_1_api module¶
- class pypergraph.network.api.metagraph_data_layer_1_api.MDL1Api(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_data() List[SignedTransaction][source]¶
Retrieve enqueued data update objects.
pypergraph.network.api.metagraph_layer_0_api module¶
- class pypergraph.network.api.metagraph_layer_0_api.ML0Api(host: str, client: RESTClient | None = None, timeout: int = 25)[source]¶
Bases:
L0Api- async get_total_supply() TotalSupply[source]¶
- async get_total_supply_at_ordinal(ordinal: int) TotalSupply[source]¶
Module contents¶
- class pypergraph.network.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.