Introduction¶
Networks can be either a DagTokenNetwork() class or a MetagraphTokenNetwork() class. These classes have methods for easing API interactions. Both are temporarily configured using the NetworkInfo class [missing ref]. The main difference between the two classes is the parameters they support.
DAG Token Network¶
A network object is instantiated like this:
from pypergraph import DagTokenNetwork()
network = DagTokenNetwork(network_id="mainnet")
Variable |
Value |
Description |
|---|---|---|
connected_network |
NetworkInfo() |
Class used to configure |
_network_change |
BehaviorSubject() |
RxPy BehaviorSubject that stores the emitted events. |
network_id |
|
Specify the connected network by setting this value. |
l0_api |
|
Layer 0 API class containing methods for interacting with the global layer 0 API endpoints. |
cl1_api |
|
Layer 1 API class containing methods for interacting with the currency layer 1 API endpoints. |
be_api |
|
Block explorer API class containing methods for interacting with the Constellation block explorer API endpoints. |
RxPy Event Emitter¶
An event is emitted on DagTokenNetwork().set_network(...) called in DagTokenNetwork().config(...).
Key |
Value |
|---|---|
module |
|
type |
|
event |
|
See also the Monitor [missing link].
Metagraph Token Network¶
from pypergraph import MetagraphTokenNetwork()
metagraph_network = MetagraphTokenNetwork(...)
Variable |
Value |
Description |
|---|---|---|
connected_network |
NetworkInfo() |
Class used to configure |
network_id |
|
Specify the connected network by setting this value. |
metagraph_id |
|
The DAG address used to identify the Metagraph (not necessary when transacting DAG). |
l0_api |
|
Layer 0 API class containing methods for interacting with Metagraph layer 0 API endpoints. |
cl1_api |
|
Layer 1 API class containing methods for interacting with Metagraph currency layer 1 API endpoints. |
dl1_api |
|
Layer 1 API class containing methods for interacting with Metagraph data layer 1 API endpoints. Used for custom data. |
be_api |
|
Block explorer API class containing methods for interacting with Constellation’s block explorer. |