Skip to content

Commit ba05ad2

Browse files
committed
Finalise feat
1 parent 35c32da commit ba05ad2

File tree

2 files changed

+27
-33
lines changed

2 files changed

+27
-33
lines changed

bittensor_cli/cli.py

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,45 +2357,42 @@ def wallet_check_ck_swap(
23572357
[green]$[/green] btcli wallet swap-check --all
23582358
23592359
Check specific wallet's swap:
2360-
[green]$[/green] btcli wallet swap-check --wallet.name my_wallet
2360+
[green]$[/green] btcli wallet swap-check --wallet-name my_wallet
23612361
23622362
Check swap using SS58 address:
2363-
[green]$[/green] btcli wallet swap-check --ss58-address 5DkQ4...
2363+
[green]$[/green] btcli wallet swap-check --ss58 5DkQ4...
23642364
23652365
Check swap details with block number:
2366-
[green]$[/green] btcli wallet swap-check --wallet.name my_wallet --block 12345
2366+
[green]$[/green] btcli wallet swap-check --wallet-name my_wallet --block 12345
23672367
"""
23682368
self.verbosity_handler(quiet, verbose)
23692369
self.initialize_chain(network)
23702370

2371-
if not wallet_ss58_address:
2372-
wallet_or_ss58_address = Prompt.ask(
2373-
"Enter the [blue]SS58 address[/blue] or the [blue]wallet name[/blue]. [dim]Leave blank to check all pending swaps[/dim]"
2374-
)
2375-
if not wallet_or_ss58_address:
2376-
show_all = True
2377-
else:
2378-
if is_valid_ss58_address(wallet_or_ss58_address):
2379-
return self._run_command(
2380-
wallets.check_swap_status(
2381-
self.subtensor, wallet_or_ss58_address, scheduled_block
2382-
)
2383-
)
2384-
else:
2385-
wallet_name = wallet_or_ss58_address
2386-
23872371
if show_all:
23882372
return self._run_command(
23892373
wallets.check_swap_status(self.subtensor, None, None)
23902374
)
23912375

2392-
wallet = self.wallet_ask(
2393-
wallet_name,
2394-
wallet_path,
2395-
wallet_hotkey,
2396-
ask_for=[WO.NAME, WO.PATH],
2397-
validate=WV.WALLET,
2398-
)
2376+
if not wallet_ss58_address:
2377+
wallet_ss58_address = Prompt.ask(
2378+
"Enter [blue]wallet name[/blue] or [blue]SS58 address[/blue] [dim](leave blank to show all pending swaps)[/dim]"
2379+
)
2380+
if not wallet_ss58_address:
2381+
return self._run_command(
2382+
wallets.check_swap_status(self.subtensor, None, None)
2383+
)
2384+
2385+
if is_valid_ss58_address(wallet_ss58_address):
2386+
ss58_address = wallet_ss58_address
2387+
else:
2388+
wallet = self.wallet_ask(
2389+
wallet_ss58_address,
2390+
wallet_path,
2391+
wallet_hotkey,
2392+
ask_for=[WO.NAME, WO.PATH],
2393+
validate=WV.WALLET,
2394+
)
2395+
ss58_address = wallet.coldkeypub.ss58_address
23992396

24002397
if not scheduled_block:
24012398
block_input = Prompt.ask(
@@ -2406,14 +2403,11 @@ def wallet_check_ck_swap(
24062403
try:
24072404
scheduled_block = int(block_input)
24082405
except ValueError:
2409-
console.print(
2410-
"[red]Invalid block number. Skipping block check.[/red]"
2411-
)
2406+
print_error("Invalid block number")
2407+
raise typer.Exit()
24122408

24132409
return self._run_command(
2414-
wallets.check_swap_status(
2415-
self.subtensor, wallet.coldkeypub.ss58_address, scheduled_block
2416-
)
2410+
wallets.check_swap_status(self.subtensor, ss58_address, scheduled_block)
24172411
)
24182412

24192413
def wallet_create_wallet(

bittensor_cli/src/commands/wallets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ async def check_swap_status(
16831683

16841684
console.print(table)
16851685
console.print(
1686-
"\n[dim]Tip: Check specific swap details by providing the original coldkey SS58 address[/dim]"
1686+
"\n[dim]Tip: Check specific swap details by providing the original coldkey SS58 address and the block number.[/dim]"
16871687
)
16881688
return
16891689

0 commit comments

Comments
 (0)