fix: wrap async ChainManager calls with asyncio.run and update exchange endpoints to use /api/v1 prefix
- Add asyncio.run() wrapper to get_chain_info, delete_chain, and add_chain_to_node calls in chain.py - Update all exchange command endpoints from /exchange/* to /api/v1/exchange/* for API consistency - Mark blockchain block command as fixed in CLI checklist (uses local node) - Mark all chain management commands help as available (backup, delete, migrate, remove, restore) - Mark client batch-submit
This commit is contained in:
@@ -194,7 +194,8 @@ def delete(ctx, chain_id, force, confirm):
|
||||
chain_manager = ChainManager(config)
|
||||
|
||||
# Get chain information for confirmation
|
||||
chain_info = chain_manager.get_chain_info(chain_id, detailed=True)
|
||||
import asyncio
|
||||
chain_info = asyncio.run(chain_manager.get_chain_info(chain_id, detailed=True))
|
||||
|
||||
if not force:
|
||||
# Show warning and confirmation
|
||||
@@ -215,7 +216,8 @@ def delete(ctx, chain_id, force, confirm):
|
||||
raise click.Abort()
|
||||
|
||||
# Delete chain
|
||||
is_success = chain_manager.delete_chain(chain_id, force)
|
||||
import asyncio
|
||||
is_success = asyncio.run(chain_manager.delete_chain(chain_id, force))
|
||||
|
||||
if is_success:
|
||||
success(f"Chain {chain_id} deleted successfully!")
|
||||
@@ -240,7 +242,8 @@ def add(ctx, chain_id, node_id):
|
||||
config = load_multichain_config()
|
||||
chain_manager = ChainManager(config)
|
||||
|
||||
is_success = chain_manager.add_chain_to_node(chain_id, node_id)
|
||||
import asyncio
|
||||
is_success = asyncio.run(chain_manager.add_chain_to_node(chain_id, node_id))
|
||||
|
||||
if is_success:
|
||||
success(f"Chain {chain_id} added to node {node_id} successfully!")
|
||||
@@ -335,7 +338,8 @@ def backup(ctx, chain_id, path, compress, verify):
|
||||
config = load_multichain_config()
|
||||
chain_manager = ChainManager(config)
|
||||
|
||||
backup_result = chain_manager.backup_chain(chain_id, path, compress, verify)
|
||||
import asyncio
|
||||
backup_result = asyncio.run(chain_manager.backup_chain(chain_id, path, compress, verify))
|
||||
|
||||
success(f"Chain backup completed successfully!")
|
||||
result = {
|
||||
@@ -404,7 +408,8 @@ def monitor(ctx, chain_id, realtime, export, interval):
|
||||
|
||||
def generate_monitor_layout():
|
||||
try:
|
||||
chain_info = chain_manager.get_chain_info(chain_id, detailed=True, metrics=True)
|
||||
import asyncio
|
||||
chain_info = asyncio.run(chain_manager.get_chain_info(chain_id, detailed=True, metrics=True))
|
||||
|
||||
layout = Layout()
|
||||
layout.split_column(
|
||||
@@ -446,7 +451,8 @@ def monitor(ctx, chain_id, realtime, export, interval):
|
||||
console.print("\n[yellow]Monitoring stopped by user[/yellow]")
|
||||
else:
|
||||
# Single snapshot
|
||||
chain_info = chain_manager.get_chain_info(chain_id, detailed=True, metrics=True)
|
||||
import asyncio
|
||||
chain_info = asyncio.run(chain_manager.get_chain_info(chain_id, detailed=True, metrics=True))
|
||||
|
||||
stats_data = [
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ def rates(ctx):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/exchange/rates",
|
||||
f"{config.coordinator_url}/api/v1/exchange/rates",
|
||||
timeout=10
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ def create_payment(ctx, aitbc_amount: Optional[float], btc_amount: Optional[floa
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
rates_response = client.get(
|
||||
f"{config.coordinator_url}/exchange/rates",
|
||||
f"{config.coordinator_url}/api/v1/exchange/rates",
|
||||
timeout=10
|
||||
)
|
||||
|
||||
@@ -94,7 +94,7 @@ def create_payment(ctx, aitbc_amount: Optional[float], btc_amount: Optional[floa
|
||||
|
||||
# Create payment
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/exchange/create-payment",
|
||||
f"{config.coordinator_url}/api/v1/exchange/create-payment",
|
||||
json=payment_data,
|
||||
timeout=10
|
||||
)
|
||||
@@ -124,7 +124,7 @@ def payment_status(ctx, payment_id: str):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/exchange/payment-status/{payment_id}",
|
||||
f"{config.coordinator_url}/api/v1/exchange/payment-status/{payment_id}",
|
||||
timeout=10
|
||||
)
|
||||
|
||||
@@ -158,7 +158,7 @@ def market_stats(ctx):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/exchange/market-stats",
|
||||
f"{config.coordinator_url}/api/v1/exchange/market-stats",
|
||||
timeout=10
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user