@@ -109,6 +109,17 @@ class Options:
109
109
"--wallet.hotkey" ,
110
110
help = "Hotkey of the wallet" ,
111
111
)
112
+ wallet_ss58_address = typer .Option (
113
+ None ,
114
+ "--wallet-name" ,
115
+ "--name" ,
116
+ "--wallet_name" ,
117
+ "--wallet.name" ,
118
+ "--address" ,
119
+ "--ss58" ,
120
+ "--ss58-address" ,
121
+ help = "SS58 address or wallet name to check. Leave empty to be prompted." ,
122
+ )
112
123
wallet_hotkey_ss58 = typer .Option (
113
124
None ,
114
125
"--hotkey" ,
@@ -687,6 +698,9 @@ def __init__(self):
687
698
self .wallet_app .command (
688
699
"swap-coldkey" , rich_help_panel = HELP_PANELS ["WALLET" ]["SECURITY" ]
689
700
)(self .wallet_swap_coldkey )
701
+ self .wallet_app .command (
702
+ "swap-check" , rich_help_panel = HELP_PANELS ["WALLET" ]["SECURITY" ]
703
+ )(self .wallet_check_ck_swap )
690
704
self .wallet_app .command (
691
705
"regen-coldkey" , rich_help_panel = HELP_PANELS ["WALLET" ]["SECURITY" ]
692
706
)(self .wallet_regen_coldkey )
@@ -2309,28 +2323,98 @@ def wallet_new_coldkey(
2309
2323
2310
2324
def wallet_check_ck_swap (
2311
2325
self ,
2312
- wallet_name : Optional [str ] = Options .wallet_name ,
2326
+ wallet_ss58_address : Optional [str ] = Options .wallet_ss58_address ,
2313
2327
wallet_path : Optional [str ] = Options .wallet_path ,
2314
2328
wallet_hotkey : Optional [str ] = Options .wallet_hotkey ,
2329
+ scheduled_block : Optional [int ] = typer .Option (
2330
+ None ,
2331
+ "--block" ,
2332
+ help = "Block number where the swap was scheduled" ,
2333
+ ),
2334
+ show_all : bool = typer .Option (
2335
+ False ,
2336
+ "--all" ,
2337
+ "-a" ,
2338
+ help = "Show all pending coldkey swaps" ,
2339
+ ),
2315
2340
network : Optional [list [str ]] = Options .network ,
2316
2341
quiet : bool = Options .quiet ,
2317
2342
verbose : bool = Options .verbose ,
2318
2343
):
2319
2344
"""
2320
- Check the status of your scheduled coldkey swap .
2345
+ Check the status of scheduled coldkey swaps .
2321
2346
2322
2347
USAGE
2323
2348
2324
- Users should provide the old coldkey wallet to check the swap status.
2349
+ This command can be used in three ways:
2350
+ 1. Show all pending swaps (--all)
2351
+ 2. Check status of a specific wallet's swap or SS58 address
2352
+ 3. Check detailed swap status with block number (--block)
2325
2353
2326
- EXAMPLE
2354
+ EXAMPLES
2355
+
2356
+ Show all pending swaps:
2357
+ [green]$[/green] btcli wallet swap-check --all
2327
2358
2328
- [green]$[/green] btcli wallet check_coldkey_swap
2359
+ Check specific wallet's swap:
2360
+ [green]$[/green] btcli wallet swap-check --wallet.name my_wallet
2361
+
2362
+ Check swap using SS58 address:
2363
+ [green]$[/green] btcli wallet swap-check --ss58-address 5DkQ4...
2364
+
2365
+ Check swap details with block number:
2366
+ [green]$[/green] btcli wallet swap-check --wallet.name my_wallet --block 12345
2329
2367
"""
2330
2368
self .verbosity_handler (quiet , verbose )
2331
- wallet = self .wallet_ask (wallet_name , wallet_path , wallet_hotkey )
2332
2369
self .initialize_chain (network )
2333
- return self ._run_command (wallets .check_coldkey_swap (wallet , self .subtensor ))
2370
+
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
+
2387
+ if show_all :
2388
+ return self ._run_command (
2389
+ wallets .check_swap_status (self .subtensor , None , None )
2390
+ )
2391
+
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
+ )
2399
+
2400
+ if not scheduled_block :
2401
+ block_input = Prompt .ask (
2402
+ "[blue]Enter the block number[/blue] where the swap was scheduled [dim](optional, press enter to skip)[/dim]" ,
2403
+ default = "" ,
2404
+ )
2405
+ if block_input :
2406
+ try :
2407
+ scheduled_block = int (block_input )
2408
+ except ValueError :
2409
+ console .print (
2410
+ "[red]Invalid block number. Skipping block check.[/red]"
2411
+ )
2412
+
2413
+ return self ._run_command (
2414
+ wallets .check_swap_status (
2415
+ self .subtensor , wallet .coldkeypub .ss58_address , scheduled_block
2416
+ )
2417
+ )
2334
2418
2335
2419
def wallet_create_wallet (
2336
2420
self ,
0 commit comments