clients.client_manager | Algorand Developer Portal
clients.client_manager
Classes
AlgoSdkClients |
Container for Algorand SDK client instances. |
|---|---|
NetworkDetail |
Details about an Algorand network. |
ClientManager |
Manager for Algorand SDK clients. |
Module Contents
class algokit_utils.clients.client_manager.AlgoSdkClients(algod: algosdk.v2client.algod.AlgodClient, indexer: algosdk.v2client.indexer.IndexerClient | None = None, kmd: algosdk.kmd.KMDClient | None = None)
Container for Algorand SDK client instances.
Holds references to Algod, Indexer and KMD clients.
- Parameters:
- algod – Algod client instance
- indexer – Optional Indexer client instance
- kmd – Optional KMD client instance
algod
indexer = None
kmd = None
class algokit_utils.clients.client_manager.NetworkDetail
Details about an Algorand network.
Contains network type flags and genesis information.
istestnet: bool_
Whether the network is a testnet
ismainnet: bool_
Whether the network is a mainnet
islocalnet: bool_
Whether the network is a localnet
genesisid: str_
The genesis ID of the network
genesishash: str_
The genesis hash of the network
class algokit_utils.clients.client_manager.ClientManager(clients_or_configs: algokit_utils.models.network.AlgoClientConfigs | AlgoSdkClients, algorand_client: algokit_utils.algorand.AlgorandClient)
Manager for Algorand SDK clients.
Provides access to Algod, Indexer and KMD clients and helper methods for working with them.
Parameters:
- clients_or_configs – Either client instances or client configurations
- algorand_client – AlgorandClient instance
Example:
# Algod only
client_manager = ClientManager(algod_client)
# Algod and Indexer
client_manager = ClientManager(algod_client, indexer_client)
# Algod config only
client_manager = ClientManager(ClientManager.get_algod_config_from_environment())
# Algod and Indexer config
client_manager = ClientManager(ClientManager.get_algod_config_from_environment(),
ClientManager.get_indexer_config_from_environment())
property algod : algosdk.v2client.algod.AlgodClient
Returns an algosdk Algod API client.
- Returns: Algod client instance
property indexer : algosdk.v2client.indexer.IndexerClient
Returns an algosdk Indexer API client.
- Raises: ValueError – If no Indexer client is configured
- Returns: Indexer client instance
property indexerif_present: algosdk.v2client.indexer.IndexerClient | None_
Returns the Indexer client if configured, otherwise None.
- Returns: Indexer client instance or None
property kmd : algosdk.kmd.KMDClient
Returns an algosdk KMD API client.
- Raises: ValueError – If no KMD client is configured
- Returns: KMD client instance
network() → NetworkDetail
Get details about the connected Algorand network.
- Returns: Network details including type and genesis information
- Example:
client_manager = ClientManager(algod_client)
network_detail = client_manager.network()
is_localnet() → bool
Check if connected to a local network.
- Returns: True if connected to a local network
is_testnet() → bool
Check if connected to TestNet.
- Returns: True if connected to TestNet
is_mainnet() → bool
Check if connected to MainNet.
- Returns: True if connected to MainNet
get_testnet_dispenser(auth_token: str | None = None, request_timeout: int | None = None) → algokit_utils.clients.dispenser_api_client.TestNetDispenserApiClient
Get a TestNet dispenser API client.
- Parameters:
- auth_token – Optional authentication token
- request_timeout – Optional request timeout in seconds
- Returns: TestNet dispenser client instance
get_app_factory(app_spec: algokit_utils.applications.app_spec.arc56.Arc56Contract | algokit_utils._legacy_v2.application_specification.ApplicationSpecification | str, app_name: str | None = None, default_sender: str | None = None, default_signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None, version: str | None = None, compilation_params: algokit_utils.applications.app_client.AppClientCompilationParams | None = None) → algokit_utils.applications.app_factory.AppFactory
Get an application factory for deploying smart contracts.
- Parameters:
- app_spec – Application specification
- app_name – Optional application name
- default_sender – Optional default sender address
- default_signer – Optional default transaction signer
- version – Optional version string
- compilation_params – Optional compilation parameters
- Raises: ValueError – If no Algorand client is configured
- Returns: Application factory instance