Simplify marketplace buy/sell endpoint paths to avoid conflicts
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 49s
CLI Tests / test-cli (push) Failing after 2s
Integration Tests / test-service-integration (push) Has started running
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has started running
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 49s
CLI Tests / test-cli (push) Failing after 2s
Integration Tests / test-service-integration (push) Has started running
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has started running
This commit is contained in:
@@ -285,13 +285,32 @@ 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."""
|
||||
"""Handle marketplace buy command via coordinator API using dual-mode wallet adapter."""
|
||||
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
|
||||
|
||||
if not args.item or not args.wallet:
|
||||
print("Error: --item and --wallet are required")
|
||||
sys.exit(1)
|
||||
|
||||
# Load config and use dual-mode adapter
|
||||
try:
|
||||
config = Config()
|
||||
except Exception:
|
||||
config = None
|
||||
|
||||
adapter = DualModeWalletAdapter(config, use_daemon=True)
|
||||
|
||||
# Get wallet balance via daemon first
|
||||
try:
|
||||
balance_info = adapter.get_wallet_balance(args.wallet)
|
||||
if balance_info:
|
||||
print(f"Wallet balance: {balance_info.get('balance', 0)} AIT")
|
||||
except Exception as e:
|
||||
print(f"Note: Could not get balance from daemon ({e}), proceeding...")
|
||||
|
||||
# Submit purchase to coordinator API
|
||||
purchase_data = {
|
||||
"buyer_id": args.wallet,
|
||||
|
||||
Reference in New Issue
Block a user