Fix import errors in handlers - use absolute imports instead of relative imports
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
CLI Tests / test-cli (push) Failing after 2s
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 11s
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
CLI Tests / test-cli (push) Failing after 2s
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 11s
This commit is contained in:
@@ -286,8 +286,10 @@ def handle_market_gpu_list(args, default_coordinator_url, output_format):
|
||||
|
||||
def handle_market_buy(args, default_coordinator_url, read_password, render_mapping):
|
||||
"""Handle marketplace buy command via coordinator API using dual-mode wallet adapter."""
|
||||
from ..utils.dual_mode_wallet_adapter import DualModeWalletAdapter
|
||||
from ..config import Config
|
||||
import sys
|
||||
sys.path.insert(0, "/opt/aitbc/cli")
|
||||
from utils.dual_mode_wallet_adapter import DualModeWalletAdapter
|
||||
from config import Config
|
||||
|
||||
coordinator_url = getattr(args, 'rpc_url', default_coordinator_url) or default_coordinator_url
|
||||
|
||||
@@ -314,14 +316,13 @@ def handle_market_buy(args, default_coordinator_url, read_password, render_mappi
|
||||
# Submit purchase to coordinator API
|
||||
purchase_data = {
|
||||
"buyer_id": args.wallet,
|
||||
"gpu_id": args.item,
|
||||
"duration_hours": 1.0,
|
||||
"payment_method": "blockchain"
|
||||
}
|
||||
|
||||
print(f"Submitting purchase to {coordinator_url}...")
|
||||
try:
|
||||
response = requests.post(f"{coordinator_url}/v1/marketplace/gpu/purchase", json=purchase_data, timeout=30)
|
||||
response = requests.post(f"{coordinator_url}/v1/marketplace/gpu/{args.item}/buy", json=purchase_data, timeout=30)
|
||||
if response.status_code in (200, 201):
|
||||
result = response.json()
|
||||
print("Purchase submitted successfully")
|
||||
|
||||
@@ -73,6 +73,11 @@ def handle_wallet_transactions(args, get_transactions, output_format, first):
|
||||
|
||||
def handle_wallet_send(args, send_transaction, read_password, first):
|
||||
"""Handle wallet send command."""
|
||||
import sys
|
||||
sys.path.insert(0, "/opt/aitbc/cli")
|
||||
from utils.dual_mode_wallet_adapter import DualModeWalletAdapter
|
||||
from config import Config
|
||||
|
||||
from_wallet = first(getattr(args, "from_wallet_arg", None), getattr(args, "from_wallet", None))
|
||||
to_address = first(getattr(args, "to_address_arg", None), getattr(args, "to_address", None))
|
||||
amount_value = first(getattr(args, "amount_arg", None), getattr(args, "amount", None))
|
||||
@@ -104,7 +109,7 @@ def handle_wallet_send(args, send_transaction, read_password, first):
|
||||
|
||||
if result.get('success'):
|
||||
print("Transaction sent successfully")
|
||||
render_mapping("Transaction:", result)
|
||||
print(f"Transaction hash: {result.get('transaction_hash')}")
|
||||
else:
|
||||
print(f"Transaction failed: {result.get('error', 'Unknown error')}")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user