feat: migrate wallet daemon and CLI to use centralized aitbc package utilities
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
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
- 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
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from aitbc.http_client import AITBCHTTPClient
|
||||
from aitbc.exceptions import NetworkError
|
||||
|
||||
|
||||
def handle_account_get(args, default_rpc_url, output_format):
|
||||
@@ -21,17 +22,15 @@ def handle_account_get(args, default_rpc_url, output_format):
|
||||
if chain_id:
|
||||
params["chain_id"] = chain_id
|
||||
|
||||
response = requests.get(f"{rpc_url}/rpc/account/{args.address}", params=params, timeout=10)
|
||||
if response.status_code == 200:
|
||||
account = response.json()
|
||||
if output_format(args) == "json":
|
||||
print(json.dumps(account, indent=2))
|
||||
else:
|
||||
render_mapping(f"Account {args.address}:", account)
|
||||
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:
|
||||
print(f"Query failed: {response.status_code}")
|
||||
print(f"Error: {response.text}")
|
||||
sys.exit(1)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user