fix: add optional positional wallet name argument to balance and address commands
Some checks failed
CLI Tests / test-cli (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Some checks failed
CLI Tests / test-cli (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
- Added @click.argument("name", required=False) to balance command
- Added @click.argument("name", required=False) to address command
- Commands now accept wallet name as positional argument or fall back to --wallet-name option
- Fixes UsageError when running "aitbc wallet balance my-agent-wallet"
- Matches scenario documentation syntax expectations
This commit is contained in:
@@ -476,11 +476,17 @@ def info(ctx):
|
||||
|
||||
|
||||
@wallet.command()
|
||||
@click.argument("name", required=False)
|
||||
@click.pass_context
|
||||
def balance(ctx):
|
||||
def balance(ctx, name: Optional[str]):
|
||||
"""Check wallet balance"""
|
||||
wallet_name = ctx.obj["wallet_name"]
|
||||
wallet_path = ctx.obj["wallet_path"]
|
||||
wallet_name = name or ctx.obj["wallet_name"]
|
||||
if not wallet_name:
|
||||
error("No wallet specified. Use --wallet-name or provide wallet name as argument")
|
||||
return
|
||||
|
||||
wallet_dir = ctx.obj["wallet_dir"]
|
||||
wallet_path = wallet_dir / f"{wallet_name}.json"
|
||||
config = ctx.obj.get("config")
|
||||
|
||||
# Auto-create wallet if it doesn't exist
|
||||
@@ -699,11 +705,17 @@ def spend(ctx, amount: float, description: str):
|
||||
|
||||
|
||||
@wallet.command()
|
||||
@click.argument("name", required=False)
|
||||
@click.pass_context
|
||||
def address(ctx):
|
||||
def address(ctx, name: Optional[str]):
|
||||
"""Show wallet address"""
|
||||
wallet_name = ctx.obj["wallet_name"]
|
||||
wallet_path = ctx.obj["wallet_path"]
|
||||
wallet_name = name or ctx.obj["wallet_name"]
|
||||
if not wallet_name:
|
||||
error("No wallet specified. Use --wallet-name or provide wallet name as argument")
|
||||
return
|
||||
|
||||
wallet_dir = ctx.obj["wallet_dir"]
|
||||
wallet_path = wallet_dir / f"{wallet_name}.json"
|
||||
|
||||
if not wallet_path.exists():
|
||||
error(f"Wallet '{wallet_name}' not found")
|
||||
|
||||
Reference in New Issue
Block a user