remove unused queue.py module and refactor chain_id handling in CLI
Some checks failed
CLI Tests / test-cli (push) Failing after 3s
Security Scanning / security-scan (push) Successful in 1m23s
Blockchain Synchronization Verification / sync-verification (push) Failing after 6s
P2P Network Verification / p2p-verification (push) Successful in 11s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 8s

Deleted aitbc/queue.py containing TaskQueue, JobScheduler, BackgroundTaskManager, and WorkerPool classes that were not being used in the codebase.

Refactored chain_id handling in CLI to use centralized get_chain_id utility function instead of duplicating chain_id detection logic in send_transaction, get_balance, and agent_operations functions.
This commit is contained in:
aitbc
2026-04-25 09:10:12 +02:00
parent ac0d4b3f45
commit 787ddcdae3
11 changed files with 157 additions and 457 deletions

View File

@@ -18,12 +18,19 @@ from utils import error, success, output
class DualModeWalletAdapter:
"""Adapter supporting both file-based and daemon-based wallet operations"""
def __init__(self, config: Config, use_daemon: bool = False):
def __init__(self, config: Config, use_daemon: bool = False, chain_id: Optional[str] = None):
self.config = config
self.use_daemon = use_daemon
self.chain_id = chain_id
self.wallet_dir = Path.home() / ".aitbc" / "wallets"
self.wallet_dir.mkdir(parents=True, exist_ok=True)
# Auto-detect chain_id if not provided
if not self.chain_id:
from aitbc_cli.utils.chain_id import get_chain_id
default_rpc_url = config.blockchain_rpc_url if hasattr(config, 'blockchain_rpc_url') else 'http://localhost:8006'
self.chain_id = get_chain_id(default_rpc_url)
if use_daemon:
self.daemon_client = WalletDaemonClient(config)
else:
@@ -311,7 +318,7 @@ class DualModeWalletAdapter:
rpc_url = self.config.blockchain_rpc_url
try:
resp = httpx.get(f"{rpc_url}/rpc/account/{from_address}?chain_id=ait-testnet", timeout=5)
resp = httpx.get(f"{rpc_url}/rpc/account/{from_address}?chain_id={self.chain_id}", timeout=5)
if resp.status_code == 200:
data = resp.json()
chain_balance = data.get("balance", 0)