Skip to content

CLI: alw swap now is case-sensitive on --from/--to chain IDs (inconsistent with quote and pair) #248

@moorsecopers99

Description

@moorsecopers99

Description

Severity: S3 (UX — gratuitous rejection of a reasonable invocation)

Location: allways/cli/swap_commands/swap.py:603-608

if from_chain_opt and from_chain_opt not in SUPPORTED_CHAINS:
    console.print(f'[red]Unknown source chain: {from_chain_opt}[/red]')
    return
if to_chain_opt and to_chain_opt not in SUPPORTED_CHAINS:
    console.print(f'[red]Unknown destination chain: {to_chain_opt}[/red]')
    return

SUPPORTED_CHAINS keys are lowercase (chains.py:40-43). Sister commands already lowercase before validating:

Only alw swap now is case-sensitive — inconsistent and unfriendly. Users typing the chain ticker as BTC / TAO is reasonable and supported elsewhere.

Steps to reproduce

  1. alw swap now --from BTC --to TAO --amount 0.001

Expected behaviour

  • Same as alw swap quote --from BTC --to TAO --amount 0.001: chain IDs lowercased, command proceeds.

Actual behaviour

  • [red]Unknown source chain: BTC[/red] and exits.

Fix

  • One-liner before the validation block:

    if from_chain_opt:
        from_chain_opt = from_chain_opt.lower()
    if to_chain_opt:
        to_chain_opt = to_chain_opt.lower()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions