Layer 0 API

Parameters

Description

host

Layer 0 base url, e.g. https://l0-lb-mainnet.constellationnetwork.io

client

Non-default REST client injection of type RESTClient, see pypergraph.core.cross_platform.api.rest_client.


Reconfigure Client and Host

from pypergraph import DagTokenNetwork
from pypergraph.core.cross_platform.di.RESTClient

class InjectClient(RESTClient)
    ...

inject_client = InjectClient()

network = DagTokenNetwork(...)
network.l0_api.config(host=..., client=inject_client)

All Methods

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_address_balance(address: str) Balance[source]
async get_cluster_info() List[PeerInfo][source]
async get_delegated_stake_last_reference(address: str) TransactionReference[source]
async get_delegated_stakes_info(address) DelegatedStakesInfo[source]
async get_delegated_stakes_reward_info()[source]
async get_latest_snapshot() SignedGlobalIncrementalSnapshot[source]
async get_latest_snapshot_ordinal() Ordinal[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_collaterals_info(address) NodeCollateralsInfo[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_node_parameters_by_address(address)[source]
async get_total_supply() TotalSupply[source]
async post_delegated_stake(tx: SignedCreateDelegatedStake)[source]
async post_node_collateral(tx: SignedCreateNodeCollateral)[source]
async post_node_parameters(tx: SignedUpdateNodeParameters)[source]

Register validator parameters for delegated staking

async post_state_channel_snapshot(address: str, snapshot: dict)[source]
async put_delegated_stake_withdrawal(tx: SignedWithdrawDelegatedStake)[source]
async put_node_collateral_withdrawal(tx: SignedWithdrawNodeCollateral)[source]