utilsUtility functions for the payments library.
snake_to_camelsnake_to_camel(name)
Convert snake_case to camelCase.
:param name: str :return: str
is_ethereum_addressis_ethereum_address(address: str) → bool
Check if a string is a valid Ethereum address.
Args:
address: The address to validateReturns: True if the address is valid, False otherwise
get_random_big_intget_random_big_int(bits: int = 128) → int
Generate a random big integer with the specified number of bits.
Args:
bits: The number of bits for the random integer (default: 128)Returns: A random big integer
generate_step_idgenerate_step_id() → str
Generate a random step id.
:return: str
is_step_id_validis_step_id_valid(step_id: str) → bool
Check if the step id has the right format.
:param step_id: str :return: bool
sleepsleep(ms: int) → None
Sleep for the specified number of milliseconds.
Args:
ms: The number of milliseconds to sleepjson_replacerjson_replacer(key: str, value: Any) → Any
Custom JSON replacer function to handle special values.
Args:
key: The key being serializedvalue: The value being serializedReturns: The value to serialize, or None to exclude the key-value pair
decode_access_tokendecode_access_token(access_token: str) → Optional[Dict[str, Any]]
Decode an access token to extract wallet address and plan ID.
Args:
access_token: The access token to decodeReturns: The decoded token data or None if invalid
get_query_protocol_endpointsget_query_protocol_endpoints(server_host: str)
Returns the list of endpoints that are used by agents/services implementing the Nevermined Query Protocol.
:param server_host: str :return: list
get_ai_hub_open_api_urlget_ai_hub_open_api_url(server_host: str) → str
Returns the URL to the OpenAPI documentation of the AI Hub.
:param server_host: str :return: str
get_service_host_from_endpointsget_service_host_from_endpoints(endpoints: List[Dict[str, str]]) → Optional[str]
Extract the service host from a list of endpoints.
Args:
endpoints: List of endpoint dictionariesReturns: The service host URL or None if not found
This file was automatically generated via lazydocs.