Import
Signature
Return the CAIP-2 id for a network name or id, and register it with x402. Resolves short aliases such as "mainnet" or "testnet" to canonical short CAIP-2 identifiers ("algorand:<32-char-prefix>"). Normalizes legacy long IDs ("algorand:<44-char-hash>"). When given "localnet" or its aliases, queries the provided algod_client (or the default localnet endpoint) to derive and register the network configuration dynamically.

Parameters

str
required
Network name, alias, canonical short CAIP-2 ID, or legacy long ID.
Any
default:"None"
Pre-configured algosdk.v2client.algod.AlgodClient instance. Used to query genesis parameters when resolving "localnet".

Returns

str
Canonical short CAIP-2 network identifier (e.g. "algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k").

Raises

  • UnknownNetworkError: (a ValueError) If the network name cannot be resolved or is invalid.

Examples

See also

  • endpoints_for: Resolves connection endpoints for the network.
  • genesis_hash_for: Returns the full 44-character base64 genesis hash.
Source: ai_economy_sdk/network.py