Files
aitbc/cli/handlers/account.py
aitbc cbd8700984
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 9s
CLI Tests / test-cli (push) Failing after 3s
Integration Tests / test-service-integration (push) Successful in 41s
Python Tests / test-python (push) Failing after 18s
Security Scanning / security-scan (push) Failing after 2m0s
feat: migrate wallet daemon and CLI to use centralized aitbc package utilities
- Migrate simple_daemon.py from mock data to real keystore and blockchain RPC integration
- Add httpx for async HTTP client in wallet daemon
- Implement real wallet listing from keystore directory
- Implement blockchain balance queries via RPC
- Update CLI to use aitbc.AITBCHTTPClient instead of requests
- Add aitbc imports: constants, http_client, exceptions, logging, paths, validation
- Add address and amount validation in
2026-04-24 22:05:55 +02:00

37 lines
1.1 KiB
Python

"""Account handlers."""
import json
import sys
from aitbc.http_client import AITBCHTTPClient
from aitbc.exceptions import NetworkError
def handle_account_get(args, default_rpc_url, output_format):
"""Handle account get command."""
rpc_url = args.rpc_url or default_rpc_url
chain_id = getattr(args, "chain_id", None)
if not args.address:
print("Error: --address is required")
sys.exit(1)
print(f"Getting account {args.address} from {rpc_url}...")
try:
params = {}
if chain_id:
params["chain_id"] = chain_id
http_client = AITBCHTTPClient(base_url=rpc_url, timeout=10)
account = http_client.get(f"/rpc/account/{args.address}", params=params)
if output_format(args) == "json":
print(json.dumps(account, indent=2))
else:
render_mapping(f"Account {args.address}:", account)
except NetworkError as e:
print(f"Error getting account: {e}")
sys.exit(1)
except Exception as e:
print(f"Error getting account: {e}")
sys.exit(1)