Layer 1 Currency API

Parameters

Description

host

Layer 1 currency base url, e.g. http://l1-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.cl1_api.config(host=..., client=inject_client)

All Methods

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_allow_spend_last_reference(address: str) AllowSpendReference[source]
async get_cluster_info() List[PeerInfo][source]
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 get_token_lock_last_reference(address: str) TokenLockReference[source]
async post_allow_spend(tx: SignedAllowSpend)[source]
async post_token_lock(tx: SignedTokenLock)[source]
async post_transaction(tx: SignedTransaction)[source]