Skip to content

Commit cb18fba

Browse files
committed
Better checks the swap status
1 parent 00d977d commit cb18fba

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

bittensor_cli/src/commands/wallets.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,9 +2002,9 @@ async def check_swap_status(
20022002
origin_ss58: The SS58 address of the original coldkey
20032003
block_number: Optional block number where the swap was scheduled
20042004
"""
2005-
scheduled_swaps = await subtensor.get_scheduled_coldkey_swap()
20062005

20072006
if not origin_ss58:
2007+
scheduled_swaps = await subtensor.get_scheduled_coldkey_swap()
20082008
if not scheduled_swaps:
20092009
console.print("[yellow]No pending coldkey swaps found.[/yellow]")
20102010
return
@@ -2036,8 +2036,16 @@ async def check_swap_status(
20362036
"\n[dim]Tip: Check specific swap details by providing the original coldkey SS58 address and the block number.[/dim]"
20372037
)
20382038
return
2039-
2040-
is_pending = origin_ss58 in scheduled_swaps
2039+
chain_reported_completion_block, destination_address = await subtensor.query(
2040+
"SubtensorModule", "ColdkeySwapScheduled", [origin_ss58]
2041+
)
2042+
if (
2043+
chain_reported_completion_block != 0
2044+
and destination_address != "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM"
2045+
):
2046+
is_pending = True
2047+
else:
2048+
is_pending = False
20412049

20422050
if not is_pending:
20432051
console.print(
@@ -2050,7 +2058,7 @@ async def check_swap_status(
20502058
)
20512059

20522060
if expected_block_number is None:
2053-
return
2061+
expected_block_number = chain_reported_completion_block
20542062

20552063
swap_info = await find_coldkey_swap_extrinsic(
20562064
subtensor=subtensor,

0 commit comments

Comments
 (0)