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

@@ -17,12 +17,19 @@ import os
@click.group()
@click.option("--chain-id", help="Chain ID for multichain operations (e.g., ait-mainnet, ait-devnet)")
@click.pass_context
def blockchain(ctx):
def blockchain(ctx, chain_id: Optional[str]):
"""Query blockchain information and status"""
# Set role for blockchain commands
ctx.ensure_object(dict)
ctx.parent.detected_role = 'blockchain'
# Handle chain_id with auto-detection
from aitbc_cli.utils.chain_id import get_chain_id
config = ctx.obj.get('config')
default_rpc_url = _get_node_endpoint(ctx)
ctx.obj['chain_id'] = get_chain_id(default_rpc_url, override=chain_id)
@blockchain.command()

View File

@@ -266,8 +266,10 @@ def pay(ctx, booking_id: str, amount: float, from_wallet: str, to_wallet: str, t
address = wallet_data["address"]
# Get wallet balance from blockchain
from aitbc_cli.utils.chain_id import get_chain_id
rpc_url = config.get('rpc_url', 'http://localhost:8006')
balance_response = httpx.Client().get(f"{rpc_url}/rpc/account/{address}?chain_id=ait-testnet", timeout=5)
chain_id = get_chain_id(rpc_url)
balance_response = httpx.Client().get(f"{rpc_url}/rpc/account/{address}?chain_id={chain_id}", timeout=5)
if balance_response.status_code != 200:
error(f"Failed to get wallet balance")
return
@@ -285,7 +287,7 @@ def pay(ctx, booking_id: str, amount: float, from_wallet: str, to_wallet: str, t
"value": amount,
"fee": 1,
"nonce": balance_data["nonce"],
"chain_id": "ait-testnet",
"chain_id": chain_id,
"payload": {
"type": "marketplace_payment",
"booking_id": booking_id,