agentconnect.utils.payment_helper module

Payment utility functions for AgentConnect.

This module provides helper functions for setting up payment capabilities in agents.

verify_payment_environment()

Verify that all required environment variables for payments are set.

Return type:

bool

Returns:

True if environment is properly configured, False otherwise

validate_cdp_environment()

Validate that the Coinbase Developer Platform environment is properly configured.

Returns:

bool, message: str)

Return type:

Tuple of (valid

get_wallet_metadata(agent_id, wallet_data_dir=None)

Get wallet metadata for an agent if it exists.

Parameters:
  • agent_id (str) – The ID of the agent

  • wallet_data_dir (Union[str, Path, None]) – Optional custom directory for wallet data storage

Return type:

Optional[Dict[str, Any]]

Returns:

Dictionary with wallet metadata if it exists, None otherwise

backup_wallet_data(agent_id, data_dir=None, backup_dir=None)

Create a backup of wallet data for an agent.

Parameters:
  • agent_id (str) – The ID of the agent

  • data_dir (Union[str, Path, None]) – Optional custom directory for wallet data storage

  • backup_dir (Union[str, Path, None]) – Optional directory for storing backups If None, creates a backup directory under data_dir

Return type:

Optional[str]

Returns:

Path to the backup file if successful, None otherwise

check_agent_payment_readiness(agent)

Check if an agent is ready for payments.

Parameters:

agent – The agent to check

Return type:

Dict[str, Any]

Returns:

A dictionary with status information