config — Network configuration¶
Networks¶
- class o2_sdk.config.Network[source]¶
Enum of available O2 Exchange networks.
- TESTNET = "testnet"¶
The O2 testnet (for testing and development). Includes a faucet for obtaining test tokens.
- DEVNET = "devnet"¶
The O2 devnet (for internal/early development). Includes a faucet.
- MAINNET = "mainnet"¶
The O2 mainnet (production). No faucet available.
Usage:
from o2_sdk import O2Client, Network # Testnet (default) client = O2Client(network=Network.TESTNET) # Mainnet client = O2Client(network=Network.MAINNET)
Network configuration¶
- class o2_sdk.config.NetworkConfig[source]¶
Configuration for connecting to an O2 Exchange network.
This is a frozen (immutable) dataclass. Pass a custom instance to
O2Clientfor private deployments or custom endpoints.from o2_sdk import O2Client, NetworkConfig custom = NetworkConfig( api_base="https://my-private-api.example.com", ws_url="wss://my-private-api.example.com/v1/ws", fuel_rpc="https://my-fuel-node.example.com/v1/graphql", faucet_url=None, ) client = O2Client(custom_config=custom)
Built-in endpoints¶
Network |
REST API |
WebSocket |
Faucet |
|---|---|---|---|
Testnet |
|
|
Yes |
Devnet |
|
|
Yes |
Mainnet |
|
|
No |
Helper function¶
- o2_sdk.config.get_config(network)[source]¶
Return the built-in
NetworkConfigfor the given network.- Parameters:
network (Network) – The target network.
- Returns:
The network configuration.
- Return type: