bittensor-cli 8.2.0rc13__py3-none-any.whl → 8.2.0rc15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bittensor_cli/__init__.py +1 -1
- bittensor_cli/cli.py +411 -28
- bittensor_cli/src/__init__.py +1 -0
- bittensor_cli/src/bittensor/balances.py +29 -1
- bittensor_cli/src/bittensor/chain_data.py +17 -2
- bittensor_cli/src/bittensor/subtensor_interface.py +94 -77
- bittensor_cli/src/bittensor/utils.py +25 -5
- bittensor_cli/src/commands/stake/move.py +992 -0
- bittensor_cli/src/commands/stake/stake.py +25 -1137
- bittensor_cli/src/commands/subnets/__init__.py +0 -0
- bittensor_cli/src/commands/subnets/price.py +867 -0
- bittensor_cli/src/commands/{subnets.py → subnets/subnets.py} +63 -202
- bittensor_cli/src/commands/sudo.py +1 -2
- bittensor_cli/src/commands/wallets.py +9 -59
- {bittensor_cli-8.2.0rc13.dist-info → bittensor_cli-8.2.0rc15.dist-info}/METADATA +3 -1
- bittensor_cli-8.2.0rc15.dist-info/RECORD +33 -0
- bittensor_cli-8.2.0rc13.dist-info/RECORD +0 -30
- {bittensor_cli-8.2.0rc13.dist-info → bittensor_cli-8.2.0rc15.dist-info}/WHEEL +0 -0
- {bittensor_cli-8.2.0rc13.dist-info → bittensor_cli-8.2.0rc15.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-8.2.0rc13.dist-info → bittensor_cli-8.2.0rc15.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,6 @@ import json
|
|
3
3
|
import sqlite3
|
4
4
|
from typing import TYPE_CHECKING, Optional, cast
|
5
5
|
import typer
|
6
|
-
import plotille
|
7
6
|
|
8
7
|
from bittensor_wallet import Wallet
|
9
8
|
from bittensor_wallet.errors import KeyFileError
|
@@ -116,9 +115,15 @@ async def register_subnetwork_extrinsic(
|
|
116
115
|
has_identity = any(subnet_identity.values())
|
117
116
|
if has_identity:
|
118
117
|
identity_data = {
|
119
|
-
"subnet_name": subnet_identity["subnet_name"].encode()
|
120
|
-
|
121
|
-
|
118
|
+
"subnet_name": subnet_identity["subnet_name"].encode()
|
119
|
+
if subnet_identity.get("subnet_name")
|
120
|
+
else b"",
|
121
|
+
"github_repo": subnet_identity["github_repo"].encode()
|
122
|
+
if subnet_identity.get("github_repo")
|
123
|
+
else b"",
|
124
|
+
"subnet_contact": subnet_identity["subnet_contact"].encode()
|
125
|
+
if subnet_identity.get("subnet_contact")
|
126
|
+
else b"",
|
122
127
|
}
|
123
128
|
for field, value in identity_data.items():
|
124
129
|
max_size = 64 # bytes
|
@@ -199,7 +204,7 @@ async def subnets_list(
|
|
199
204
|
|
200
205
|
async def fetch_subnet_data():
|
201
206
|
block_number = await subtensor.substrate.get_block_number(None)
|
202
|
-
subnets = await subtensor.
|
207
|
+
subnets = await subtensor.all_subnets()
|
203
208
|
|
204
209
|
# Sort subnets by market cap, keeping the root subnet in the first position
|
205
210
|
root_subnet = next(s for s in subnets if s.netuid == 0)
|
@@ -795,30 +800,22 @@ async def show(
|
|
795
800
|
prompt: bool = True,
|
796
801
|
) -> Optional[str]:
|
797
802
|
async def show_root():
|
798
|
-
all_subnets = await subtensor.
|
803
|
+
all_subnets = await subtensor.all_subnets()
|
799
804
|
root_info = next((s for s in all_subnets if s.netuid == 0), None)
|
800
805
|
if root_info is None:
|
801
806
|
print_error("The root subnet does not exist")
|
802
807
|
raise typer.Exit()
|
803
808
|
|
804
|
-
|
805
|
-
subtensor.
|
806
|
-
runtime_api="SubnetInfoRuntimeApi",
|
807
|
-
method="get_subnet_state",
|
808
|
-
params=[0],
|
809
|
-
),
|
809
|
+
root_state, identities, old_identities = await asyncio.gather(
|
810
|
+
subtensor.get_subnet_state(netuid=0),
|
810
811
|
subtensor.query_all_identities(),
|
811
812
|
subtensor.get_delegate_identities(),
|
812
813
|
)
|
813
814
|
|
814
|
-
if
|
815
|
+
if root_state is None:
|
815
816
|
err_console.print("The root subnet does not exist")
|
816
817
|
return
|
817
818
|
|
818
|
-
if bytes_result.startswith("0x"):
|
819
|
-
bytes_result = bytes.fromhex(bytes_result[2:])
|
820
|
-
|
821
|
-
root_state: "SubnetState" = SubnetState.from_vec_u8(bytes_result)
|
822
819
|
if len(root_state.hotkeys) == 0:
|
823
820
|
err_console.print(
|
824
821
|
"The root-subnet is currently empty with 0 UIDs registered."
|
@@ -986,70 +983,64 @@ async def show(
|
|
986
983
|
"""
|
987
984
|
)
|
988
985
|
if delegate_selection:
|
986
|
+
valid_uids = [str(row[0]) for row in sorted_rows[:max_rows]]
|
989
987
|
while True:
|
990
988
|
selection = Prompt.ask(
|
991
|
-
"\nEnter the
|
989
|
+
"\nEnter the Position of the delegate you want to stake to [dim](or press Enter to cancel)[/dim]",
|
992
990
|
default="",
|
991
|
+
choices=[""] + valid_uids,
|
992
|
+
show_choices=False,
|
993
|
+
show_default=False,
|
993
994
|
)
|
994
995
|
|
995
996
|
if selection == "":
|
996
997
|
return None
|
997
998
|
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
999
|
+
position = int(selection)
|
1000
|
+
idx = position - 1
|
1001
|
+
original_idx = sorted_hotkeys[idx][0]
|
1002
|
+
selected_hotkey = root_state.hotkeys[original_idx]
|
1003
|
+
|
1004
|
+
coldkey_identity = identities.get(
|
1005
|
+
root_state.coldkeys[original_idx], {}
|
1006
|
+
).get("name", "")
|
1007
|
+
hotkey_identity = old_identities.get(selected_hotkey)
|
1008
|
+
validator_identity = (
|
1009
|
+
coldkey_identity
|
1010
|
+
if coldkey_identity
|
1011
|
+
else (hotkey_identity.display if hotkey_identity else "")
|
1012
|
+
)
|
1013
|
+
identity_str = f" ({validator_identity})" if validator_identity else ""
|
1008
1014
|
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
)
|
1014
|
-
except ValueError:
|
1015
|
-
console.print("[red]Please enter a valid number[/red]")
|
1015
|
+
console.print(
|
1016
|
+
f"\nSelected delegate: [{COLOR_PALETTE['GENERAL']['SUBHEADING']}]{selected_hotkey}{identity_str}"
|
1017
|
+
)
|
1018
|
+
return selected_hotkey
|
1016
1019
|
|
1017
1020
|
async def show_subnet(netuid_: int):
|
1018
1021
|
if not await subtensor.subnet_exists(netuid=netuid):
|
1019
1022
|
err_console.print(f"[red]Subnet {netuid} does not exist[/red]")
|
1020
1023
|
raise typer.Exit()
|
1021
1024
|
(
|
1022
|
-
|
1023
|
-
|
1025
|
+
subnet_info,
|
1026
|
+
subnet_state,
|
1024
1027
|
identities,
|
1025
1028
|
old_identities,
|
1026
1029
|
) = await asyncio.gather(
|
1027
|
-
subtensor.
|
1028
|
-
subtensor.
|
1029
|
-
runtime_api="SubnetInfoRuntimeApi",
|
1030
|
-
method="get_subnet_state",
|
1031
|
-
params=[netuid_],
|
1032
|
-
),
|
1030
|
+
subtensor.subnet(netuid=netuid_),
|
1031
|
+
subtensor.get_subnet_state(netuid=netuid_),
|
1033
1032
|
subtensor.query_all_identities(),
|
1034
1033
|
subtensor.get_delegate_identities(),
|
1035
1034
|
)
|
1036
|
-
|
1037
|
-
if subnet_info is None:
|
1038
|
-
print_error(f"Subnet {netuid_} does not exist")
|
1039
|
-
raise typer.Exit()
|
1040
|
-
|
1041
|
-
if (bytes_result := hex_bytes_result) is None:
|
1035
|
+
if subnet_state is None:
|
1042
1036
|
print_error(f"Subnet {netuid_} does not exist")
|
1043
1037
|
raise typer.Exit()
|
1044
1038
|
|
1045
|
-
if bytes_result.startswith("0x"):
|
1046
|
-
bytes_result = bytes.fromhex(bytes_result[2:])
|
1047
|
-
|
1048
|
-
subnet_state: "SubnetState" = SubnetState.from_vec_u8(bytes_result)
|
1049
1039
|
if subnet_info is None:
|
1050
1040
|
print_error(f"Subnet {netuid_} does not exist")
|
1051
1041
|
raise typer.Exit()
|
1052
|
-
|
1042
|
+
|
1043
|
+
if len(subnet_state.hotkeys) == 0:
|
1053
1044
|
print_error(f"Subnet {netuid_} is currently empty with 0 UIDs registered.")
|
1054
1045
|
raise typer.Exit()
|
1055
1046
|
|
@@ -1068,10 +1059,6 @@ async def show(
|
|
1068
1059
|
pad_edge=True,
|
1069
1060
|
)
|
1070
1061
|
|
1071
|
-
# Add index for selection if selecting delegates
|
1072
|
-
if delegate_selection:
|
1073
|
-
table.add_column("#", style="cyan", justify="right")
|
1074
|
-
|
1075
1062
|
# For hotkey_block_emission calculation
|
1076
1063
|
emission_sum = sum(
|
1077
1064
|
[
|
@@ -1262,8 +1249,6 @@ async def show(
|
|
1262
1249
|
)
|
1263
1250
|
for pos, row in enumerate(rows, 1):
|
1264
1251
|
table_row = []
|
1265
|
-
if delegate_selection:
|
1266
|
-
table_row.append(str(pos))
|
1267
1252
|
table_row.extend(row)
|
1268
1253
|
table.add_row(*table_row)
|
1269
1254
|
if delegate_selection and pos == max_rows:
|
@@ -1316,20 +1301,24 @@ async def show(
|
|
1316
1301
|
|
1317
1302
|
if delegate_selection:
|
1318
1303
|
while True:
|
1304
|
+
valid_uids = [str(row[0]) for row in rows[:max_rows]]
|
1319
1305
|
selection = Prompt.ask(
|
1320
|
-
"\nEnter the
|
1306
|
+
"\nEnter the UID of the delegate you want to stake to [dim](or press Enter to cancel)[/dim]",
|
1321
1307
|
default="",
|
1308
|
+
choices=[""] + valid_uids,
|
1309
|
+
show_choices=False,
|
1310
|
+
show_default=False,
|
1322
1311
|
)
|
1323
1312
|
|
1324
1313
|
if selection == "":
|
1325
1314
|
return None
|
1326
1315
|
|
1327
1316
|
try:
|
1328
|
-
|
1329
|
-
if
|
1330
|
-
|
1317
|
+
uid = int(selection)
|
1318
|
+
# Check if the UID exists in the subnet
|
1319
|
+
if uid in [int(row[0]) for row in rows]:
|
1320
|
+
row_data = next(row for row in rows if int(row[0]) == uid)
|
1331
1321
|
hotkey = subnet_state.hotkeys[uid]
|
1332
|
-
row_data = rows[idx - 1]
|
1333
1322
|
identity = "" if row_data[9] == "~" else row_data[9]
|
1334
1323
|
identity_str = f" ({identity})" if identity else ""
|
1335
1324
|
console.print(
|
@@ -1338,7 +1327,7 @@ async def show(
|
|
1338
1327
|
return hotkey
|
1339
1328
|
else:
|
1340
1329
|
console.print(
|
1341
|
-
f"[red]Invalid
|
1330
|
+
f"[red]Invalid UID. Please enter a valid UID from the table above[/red]"
|
1342
1331
|
)
|
1343
1332
|
except ValueError:
|
1344
1333
|
console.print("[red]Please enter a valid number[/red]")
|
@@ -1581,7 +1570,13 @@ async def metagraph_cmd(
|
|
1581
1570
|
print_error(f"Subnet with netuid: {netuid} does not exist", status)
|
1582
1571
|
return False
|
1583
1572
|
|
1584
|
-
|
1573
|
+
(
|
1574
|
+
neurons,
|
1575
|
+
difficulty_,
|
1576
|
+
total_issuance_,
|
1577
|
+
block,
|
1578
|
+
subnet_state,
|
1579
|
+
) = await asyncio.gather(
|
1585
1580
|
subtensor.neurons(netuid, block_hash=block_hash),
|
1586
1581
|
subtensor.get_hyperparameter(
|
1587
1582
|
param_name="Difficulty", netuid=netuid, block_hash=block_hash
|
@@ -1593,22 +1588,9 @@ async def metagraph_cmd(
|
|
1593
1588
|
block_hash=block_hash,
|
1594
1589
|
),
|
1595
1590
|
subtensor.substrate.get_block_number(block_hash=block_hash),
|
1591
|
+
subtensor.get_subnet_state(netuid=netuid),
|
1596
1592
|
)
|
1597
1593
|
|
1598
|
-
hex_bytes_result = await subtensor.query_runtime_api(
|
1599
|
-
runtime_api="SubnetInfoRuntimeApi",
|
1600
|
-
method="get_subnet_state",
|
1601
|
-
params=[netuid],
|
1602
|
-
)
|
1603
|
-
if not (bytes_result := hex_bytes_result):
|
1604
|
-
err_console.print(f"Subnet {netuid} does not exist")
|
1605
|
-
return
|
1606
|
-
|
1607
|
-
if bytes_result.startswith("0x"):
|
1608
|
-
bytes_result = bytes.fromhex(bytes_result[2:])
|
1609
|
-
|
1610
|
-
subnet_state: "SubnetState" = SubnetState.from_vec_u8(bytes_result)
|
1611
|
-
|
1612
1594
|
difficulty = int(difficulty_)
|
1613
1595
|
total_issuance = Balance.from_rao(total_issuance_)
|
1614
1596
|
metagraph = MiniGraph(
|
@@ -2051,124 +2033,3 @@ async def metagraph_cmd(
|
|
2051
2033
|
table.add_row(*row)
|
2052
2034
|
|
2053
2035
|
console.print(table)
|
2054
|
-
|
2055
|
-
|
2056
|
-
async def price(
|
2057
|
-
subtensor: "SubtensorInterface",
|
2058
|
-
netuid: int,
|
2059
|
-
interval_hours: int = 24,
|
2060
|
-
):
|
2061
|
-
"""Plot historical subnet price data in the CLI."""
|
2062
|
-
|
2063
|
-
blocks_per_hour = int(3600 / 12) # ~300 blocks per hour
|
2064
|
-
total_blocks = blocks_per_hour * interval_hours
|
2065
|
-
|
2066
|
-
with console.status(":chart_increasing: Fetching historical price data..."):
|
2067
|
-
current_block_hash = await subtensor.substrate.get_chain_head()
|
2068
|
-
current_block = await subtensor.substrate.get_block_number(current_block_hash)
|
2069
|
-
|
2070
|
-
# Block range
|
2071
|
-
step = 300
|
2072
|
-
start_block = max(0, current_block - total_blocks)
|
2073
|
-
block_numbers = range(start_block, current_block + 1, step)
|
2074
|
-
|
2075
|
-
# Fetch all block hashes
|
2076
|
-
block_hash_cors = [
|
2077
|
-
subtensor.substrate.get_block_hash(bn) for bn in block_numbers
|
2078
|
-
]
|
2079
|
-
block_hashes = await asyncio.gather(*block_hash_cors)
|
2080
|
-
|
2081
|
-
# Fetch subnet data for each block
|
2082
|
-
subnet_info_cors = [
|
2083
|
-
subtensor.get_subnet_dynamic_info(netuid, bh) for bh in block_hashes
|
2084
|
-
]
|
2085
|
-
subnet_infos = await asyncio.gather(*subnet_info_cors)
|
2086
|
-
|
2087
|
-
valid_data = [
|
2088
|
-
(bn, info)
|
2089
|
-
for bn, info in zip(block_numbers, subnet_infos)
|
2090
|
-
if info is not None
|
2091
|
-
]
|
2092
|
-
if not valid_data:
|
2093
|
-
err_console.print(f"[red]No price data found for subnet {netuid}[/red]")
|
2094
|
-
return
|
2095
|
-
|
2096
|
-
block_numbers, subnet_infos = zip(*valid_data)
|
2097
|
-
prices = [subnet_info.price.tao for subnet_info in subnet_infos]
|
2098
|
-
|
2099
|
-
if len(prices) < 5:
|
2100
|
-
err_console.print(
|
2101
|
-
f"[red]Insufficient price data for subnet {netuid}. Need at least 5 data points but only found {len(prices)}.[/red]"
|
2102
|
-
)
|
2103
|
-
return
|
2104
|
-
|
2105
|
-
fig = plotille.Figure()
|
2106
|
-
fig.width = 60
|
2107
|
-
fig.height = 20
|
2108
|
-
fig.color_mode = "rgb"
|
2109
|
-
fig.background = None
|
2110
|
-
|
2111
|
-
def color_label(text):
|
2112
|
-
return plotille.color(text, fg=(186, 233, 143), mode="rgb") # Green
|
2113
|
-
|
2114
|
-
fig.x_label = color_label("Block")
|
2115
|
-
fig.y_label = color_label(f"Price ({Balance.get_unit(netuid)})")
|
2116
|
-
|
2117
|
-
fig.set_x_limits(min_=min(block_numbers), max_=max(block_numbers))
|
2118
|
-
fig.set_y_limits(min_=min(prices) * 0.95, max_=max(prices) * 1.05)
|
2119
|
-
|
2120
|
-
fig.plot(
|
2121
|
-
block_numbers,
|
2122
|
-
prices,
|
2123
|
-
label=f"Subnet {netuid} Price",
|
2124
|
-
interp="linear",
|
2125
|
-
lc="bae98f", # Green hex
|
2126
|
-
)
|
2127
|
-
|
2128
|
-
subnet = subnet_infos[-1]
|
2129
|
-
console.print(
|
2130
|
-
f"\n[{COLOR_PALETTE['GENERAL']['SYMBOL']}]Subnet {netuid} - {subnet.symbol} [cyan]{get_subnet_name(subnet)}"
|
2131
|
-
)
|
2132
|
-
console.print(
|
2133
|
-
f"Current: [blue]{prices[-1]:.6f}{Balance.get_unit(netuid)}"
|
2134
|
-
if netuid != 0
|
2135
|
-
else f"Current: [blue]{Balance.get_unit(netuid)} {prices[-1]:.6f}"
|
2136
|
-
)
|
2137
|
-
console.print(
|
2138
|
-
f"{interval_hours}h High: [dark_sea_green3]{max(prices):.6f}{Balance.get_unit(netuid)}"
|
2139
|
-
if netuid != 0
|
2140
|
-
else f"{interval_hours}h High: [dark_sea_green3]{Balance.get_unit(netuid)} {max(prices):.6f}"
|
2141
|
-
)
|
2142
|
-
console.print(
|
2143
|
-
f"{interval_hours}h Low: [red]{min(prices):.6f}{Balance.get_unit(netuid)}"
|
2144
|
-
if netuid != 0
|
2145
|
-
else f"{interval_hours}h Low: [red]{Balance.get_unit(netuid)} {min(prices):.6f}"
|
2146
|
-
)
|
2147
|
-
|
2148
|
-
change_color = "dark_sea_green3" if prices[-1] > prices[0] else "red"
|
2149
|
-
console.print(
|
2150
|
-
f"{interval_hours}h Change: "
|
2151
|
-
f"[{change_color}]{((prices[-1] - prices[0]) / prices[0] * 100):.2f}%\n"
|
2152
|
-
)
|
2153
|
-
print(fig.show())
|
2154
|
-
console.print("\nLatest stats:")
|
2155
|
-
console.print(
|
2156
|
-
f"Supply: [{COLOR_PALETTE['POOLS']['ALPHA_IN']}]{subnet.alpha_in.tao + subnet.alpha_out.tao:,.2f} {Balance.get_unit(netuid)}"
|
2157
|
-
if netuid != 0
|
2158
|
-
else f"Supply: [{COLOR_PALETTE['POOLS']['ALPHA_IN']}]{Balance.get_unit(netuid)} {subnet.alpha_in.tao + subnet.alpha_out.tao:,.2f}"
|
2159
|
-
)
|
2160
|
-
console.print(
|
2161
|
-
f"Market Cap: [steel_blue3]{subnet.price.tao * (subnet.alpha_in.tao + subnet.alpha_out.tao):,.2f} {Balance.get_unit(netuid)} / 21M"
|
2162
|
-
if netuid != 0
|
2163
|
-
else f"Market Cap: [steel_blue3]{Balance.get_unit(netuid)} {subnet.price.tao * (subnet.alpha_in.tao + subnet.alpha_out.tao):,.2f} / 21M"
|
2164
|
-
)
|
2165
|
-
console.print(
|
2166
|
-
f"Emission: [{COLOR_PALETTE['POOLS']['EMISSION']}]{subnet.emission.tao:,.2f} {Balance.get_unit(netuid)}"
|
2167
|
-
if netuid != 0
|
2168
|
-
else f"Emission: [{COLOR_PALETTE['POOLS']['EMISSION']}]{Balance.get_unit(netuid)} {subnet.emission.tao:,.2f}"
|
2169
|
-
)
|
2170
|
-
console.print(
|
2171
|
-
f"Stake: [{COLOR_PALETTE['STAKE']['TAO']}]{subnet.alpha_out.tao:,.2f} {Balance.get_unit(netuid)}"
|
2172
|
-
if netuid != 0
|
2173
|
-
else f"Stake: [{COLOR_PALETTE['STAKE']['TAO']}]{Balance.get_unit(netuid)} {subnet.alpha_out.tao:,.2f}"
|
2174
|
-
)
|
@@ -497,8 +497,7 @@ async def get_hyperparameters(subtensor: "SubtensorInterface", netuid: int):
|
|
497
497
|
print_error(f"Subnet with netuid {netuid} does not exist.")
|
498
498
|
return False
|
499
499
|
subnet = await subtensor.get_subnet_hyperparameters(netuid)
|
500
|
-
|
501
|
-
subnet_info = next((s for s in _subnet_info if s.netuid == netuid), None)
|
500
|
+
subnet_info = await subtensor.subnet(netuid)
|
502
501
|
if subnet_info is None:
|
503
502
|
print_error(f"Subnet with netuid {netuid} does not exist.")
|
504
503
|
raise typer.Exit()
|
@@ -2,7 +2,7 @@ import asyncio
|
|
2
2
|
import itertools
|
3
3
|
import os
|
4
4
|
from collections import defaultdict
|
5
|
-
from typing import Any,
|
5
|
+
from typing import Any, Generator, Optional
|
6
6
|
|
7
7
|
import aiohttp
|
8
8
|
from bittensor_wallet import Wallet, Keypair
|
@@ -23,7 +23,6 @@ from bittensor_cli.src.bittensor.balances import Balance
|
|
23
23
|
from bittensor_cli.src.bittensor.chain_data import (
|
24
24
|
DelegateInfo,
|
25
25
|
NeuronInfoLite,
|
26
|
-
StakeInfo,
|
27
26
|
)
|
28
27
|
from bittensor_cli.src.bittensor.extrinsics.registration import (
|
29
28
|
run_faucet_extrinsic,
|
@@ -150,7 +149,7 @@ async def new_hotkey(
|
|
150
149
|
use_password=use_password,
|
151
150
|
overwrite=False,
|
152
151
|
)
|
153
|
-
console.print(
|
152
|
+
console.print("[dark_sea_green]Hotkey created[/dark_sea_green]")
|
154
153
|
except KeyFileError:
|
155
154
|
print_error("KeyFileError: File is not writable")
|
156
155
|
|
@@ -179,7 +178,7 @@ async def new_coldkey(
|
|
179
178
|
use_password=use_password,
|
180
179
|
overwrite=False,
|
181
180
|
)
|
182
|
-
console.print(
|
181
|
+
console.print("[dark_sea_green]Coldkey created[/dark_sea_green]")
|
183
182
|
except KeyFileError:
|
184
183
|
print_error("KeyFileError: File is not writable")
|
185
184
|
|
@@ -194,11 +193,11 @@ async def wallet_create(
|
|
194
193
|
if uri:
|
195
194
|
try:
|
196
195
|
keypair = Keypair.create_from_uri(uri)
|
196
|
+
wallet.set_coldkey(keypair=keypair, encrypt=False, overwrite=False)
|
197
|
+
wallet.set_coldkeypub(keypair=keypair, encrypt=False, overwrite=False)
|
198
|
+
wallet.set_hotkey(keypair=keypair, encrypt=False, overwrite=False)
|
197
199
|
except Exception as e:
|
198
200
|
print_error(f"Failed to create keypair from URI: {str(e)}")
|
199
|
-
wallet.set_coldkey(keypair=keypair, encrypt=False, overwrite=False)
|
200
|
-
wallet.set_coldkeypub(keypair=keypair, encrypt=False, overwrite=False)
|
201
|
-
wallet.set_hotkey(keypair=keypair, encrypt=False, overwrite=False)
|
202
201
|
console.print(
|
203
202
|
f"[dark_sea_green]Wallet created from URI: {uri}[/dark_sea_green]"
|
204
203
|
)
|
@@ -209,7 +208,7 @@ async def wallet_create(
|
|
209
208
|
use_password=use_password,
|
210
209
|
overwrite=False,
|
211
210
|
)
|
212
|
-
console.print(
|
211
|
+
console.print("[dark_sea_green]Coldkey created[/dark_sea_green]")
|
213
212
|
except KeyFileError:
|
214
213
|
print_error("KeyFileError: File is not writable")
|
215
214
|
|
@@ -219,7 +218,7 @@ async def wallet_create(
|
|
219
218
|
use_password=False,
|
220
219
|
overwrite=False,
|
221
220
|
)
|
222
|
-
console.print(
|
221
|
+
console.print("[dark_sea_green]Hotkey created[/dark_sea_green]")
|
223
222
|
except KeyFileError:
|
224
223
|
print_error("KeyFileError: File is not writable")
|
225
224
|
|
@@ -610,7 +609,7 @@ async def overview(
|
|
610
609
|
all_hotkeys, total_balance = await _get_total_balance(
|
611
610
|
total_balance, subtensor, wallet, all_wallets, block_hash=block_hash
|
612
611
|
)
|
613
|
-
_dynamic_info = await subtensor.
|
612
|
+
_dynamic_info = await subtensor.all_subnets()
|
614
613
|
dynamic_info = {info.netuid: info for info in _dynamic_info}
|
615
614
|
|
616
615
|
with console.status(
|
@@ -1094,55 +1093,6 @@ async def _get_neurons_for_netuids(
|
|
1094
1093
|
]
|
1095
1094
|
|
1096
1095
|
|
1097
|
-
async def _get_de_registered_stake_for_coldkey_wallet(
|
1098
|
-
subtensor: SubtensorInterface,
|
1099
|
-
all_hotkey_addresses: Collection[str],
|
1100
|
-
coldkey_wallet: Wallet,
|
1101
|
-
) -> tuple[Wallet, list[tuple[str, float]], Optional[str]]:
|
1102
|
-
"""
|
1103
|
-
Looks at the total stake of a coldkey, then filters this based on the supplied hotkey addresses
|
1104
|
-
depending on whether the hotkey is a delegate
|
1105
|
-
|
1106
|
-
:param subtensor: SubtensorInterface to make queries with
|
1107
|
-
:param all_hotkey_addresses: collection of hotkey SS58 addresses
|
1108
|
-
:param coldkey_wallet: Wallet containing coldkey
|
1109
|
-
|
1110
|
-
:return: (original wallet, [(hotkey SS58, stake in TAO), ...], error message)
|
1111
|
-
"""
|
1112
|
-
# Pull all stake for our coldkey
|
1113
|
-
all_stake_info_for_coldkey = await subtensor.get_stake_info_for_coldkey(
|
1114
|
-
coldkey_ss58=coldkey_wallet.coldkeypub.ss58_address, reuse_block=True
|
1115
|
-
)
|
1116
|
-
|
1117
|
-
# Filter out hotkeys that are in our wallets
|
1118
|
-
# Filter out hotkeys that are delegates.
|
1119
|
-
async def _filter_stake_info(stake_info: StakeInfo) -> bool:
|
1120
|
-
if stake_info.stake == 0:
|
1121
|
-
return False # Skip hotkeys that we have no stake with.
|
1122
|
-
if stake_info.hotkey_ss58 in all_hotkey_addresses:
|
1123
|
-
return False # Skip hotkeys that are in our wallets.
|
1124
|
-
return not await subtensor.is_hotkey_delegate(
|
1125
|
-
hotkey_ss58=stake_info.hotkey_ss58, reuse_block=True
|
1126
|
-
)
|
1127
|
-
|
1128
|
-
all_staked = await asyncio.gather(
|
1129
|
-
*[_filter_stake_info(stake_info) for stake_info in all_stake_info_for_coldkey]
|
1130
|
-
)
|
1131
|
-
|
1132
|
-
# Collecting all filtered stake info using async for loop
|
1133
|
-
all_staked_hotkeys = []
|
1134
|
-
for stake_info, staked in zip(all_stake_info_for_coldkey, all_staked):
|
1135
|
-
if staked:
|
1136
|
-
all_staked_hotkeys.append(
|
1137
|
-
(
|
1138
|
-
stake_info.hotkey_ss58,
|
1139
|
-
stake_info.stake.tao,
|
1140
|
-
)
|
1141
|
-
)
|
1142
|
-
|
1143
|
-
return coldkey_wallet, all_staked_hotkeys, None
|
1144
|
-
|
1145
|
-
|
1146
1096
|
async def transfer(
|
1147
1097
|
wallet: Wallet,
|
1148
1098
|
subtensor: SubtensorInterface,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bittensor-cli
|
3
|
-
Version: 8.2.
|
3
|
+
Version: 8.2.0rc15
|
4
4
|
Summary: Bittensor CLI
|
5
5
|
Home-page: https://github.com/opentensor/btcli
|
6
6
|
Author: bittensor.com
|
@@ -44,6 +44,8 @@ Requires-Dist: websockets>=14.1
|
|
44
44
|
Requires-Dist: bittensor-wallet>=2.0.2
|
45
45
|
Requires-Dist: bt-decode==0.4.0
|
46
46
|
Requires-Dist: plotille
|
47
|
+
Requires-Dist: pywry
|
48
|
+
Requires-Dist: plotly
|
47
49
|
Provides-Extra: cuda
|
48
50
|
Requires-Dist: cubit>=1.1.0; extra == "cuda"
|
49
51
|
Requires-Dist: torch; extra == "cuda"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
bittensor_cli/__init__.py,sha256=ZYU7KUzCNWfB7qHzWaA9DQN0qXv3gAQ689sTTWJv9RM,1221
|
2
|
+
bittensor_cli/cli.py,sha256=Fnz8znP8gSEW81PQDp3krWMad30YKFX3GnXz7czem1Q,170276
|
3
|
+
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
+
bittensor_cli/src/__init__.py,sha256=KprSr1MmKKyh15PYcnA57mbX1svihIXyrtwnUIaUvbk,32042
|
5
|
+
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
bittensor_cli/src/bittensor/async_substrate_interface.py,sha256=qetCcD5qlAxeedhQ0cwfHo6QSjohCljJarqyzKpcHFQ,103240
|
7
|
+
bittensor_cli/src/bittensor/balances.py,sha256=1ch3c4Gc3IRgIn8MMfbavQm71n3N_fUH7j9EGM6oH6M,11436
|
8
|
+
bittensor_cli/src/bittensor/chain_data.py,sha256=WPMzvS8YgIJzMRC1AOba1p3HDTR7zK_l-OoSi6o1cbI,60034
|
9
|
+
bittensor_cli/src/bittensor/minigraph.py,sha256=MCiuLRn9lhGoO1aKrM7YOiQAmANxFRkknwHCcjpn8uw,10499
|
10
|
+
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
+
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=bF1-ziyWr7Xg8oVRyql9qmpG6TvYqRi_HJHcgSE476k,57384
|
12
|
+
bittensor_cli/src/bittensor/utils.py,sha256=-t51UAbvs2WA6bFe6DxrAN_eINfaMXCud3bnABAjzZE,41421
|
13
|
+
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=p_ARqDiniDNL-ZPuswfk_DJW5kl5rMNxL_uRbfVTkTA,64599
|
15
|
+
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=RZEQv6QVDAQDjuX_vgjOMsatYvHpA3MW8zueiL6jxlE,19376
|
16
|
+
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=8-7LVM8Xt_K-f_pJfAVeybSF_mr3pJorjs963TQbRZ0,8407
|
17
|
+
bittensor_cli/src/bittensor/templates/table.j2,sha256=P2EFiksnO1cQsB8zjK6hVJwUryHTsLslzRE0YtobAV8,10601
|
18
|
+
bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
+
bittensor_cli/src/commands/sudo.py,sha256=_W751AW_y4zwTNFkV5Am6iJOOvXck0OVxGTGttN2Mzk,26174
|
20
|
+
bittensor_cli/src/commands/wallets.py,sha256=hEmcbi2uGCsQJgPPsxJzrTvhoKmnBOvaFKqhynoI6rQ,50250
|
21
|
+
bittensor_cli/src/commands/weights.py,sha256=3BCqVB1-W6BG0U_iOtuUZmFOQ9QngsnXAkBLwCHjK0g,16440
|
22
|
+
bittensor_cli/src/commands/stake/__init__.py,sha256=kcQE86CfemAw2LoNBHA_FIwixf4VyJ26FT10f0peJEU,6569
|
23
|
+
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=WTFR0oprtOzMc5x0MXtWm595Bd4yK9iZCymwc3whr0U,28215
|
24
|
+
bittensor_cli/src/commands/stake/move.py,sha256=c0YsQxKcFYJ8Bf6Gg_8_t99QV5RBx_KiuKCkHLc2fZ4,37199
|
25
|
+
bittensor_cli/src/commands/stake/stake.py,sha256=L-xi1O82lL2jeLBN3GCjiKnZjDYzZwCvUlp8P7faOAM,78813
|
26
|
+
bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
+
bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
|
28
|
+
bittensor_cli/src/commands/subnets/subnets.py,sha256=g5fsmJlrZFmABMReBg6whu0A4QplBxx5bMsM1himpfo,79808
|
29
|
+
bittensor_cli-8.2.0rc15.dist-info/METADATA,sha256=Z8ehWeQw4iUaZbo6-IhFf_SLFMaRayWWB9PKOfHhy5A,6885
|
30
|
+
bittensor_cli-8.2.0rc15.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
31
|
+
bittensor_cli-8.2.0rc15.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
32
|
+
bittensor_cli-8.2.0rc15.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
33
|
+
bittensor_cli-8.2.0rc15.dist-info/RECORD,,
|
@@ -1,30 +0,0 @@
|
|
1
|
-
bittensor_cli/__init__.py,sha256=xAILUH3afQeZzSszUzL5phiL4q9L-DGjLa9Qb9EPnFI,1221
|
2
|
-
bittensor_cli/cli.py,sha256=tgukEorJrNCTXNmqNFjZL8QVgjZtw3pB_fTGADC0bqE,156081
|
3
|
-
bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
|
4
|
-
bittensor_cli/src/__init__.py,sha256=6i5Faz1h2ZX3YzgBT4E3w0ayZnzWmBCzUqnPefXpOQA,32004
|
5
|
-
bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
bittensor_cli/src/bittensor/async_substrate_interface.py,sha256=qetCcD5qlAxeedhQ0cwfHo6QSjohCljJarqyzKpcHFQ,103240
|
7
|
-
bittensor_cli/src/bittensor/balances.py,sha256=qMGnPx4UGwtSDjlUMP81jVRp1-8M99H0Q43IsVnl6aI,10722
|
8
|
-
bittensor_cli/src/bittensor/chain_data.py,sha256=dhTwx_9CXI9rVeJ0PsU6pqY7WHyIDuxCJVhpnPTKFPk,59445
|
9
|
-
bittensor_cli/src/bittensor/minigraph.py,sha256=MCiuLRn9lhGoO1aKrM7YOiQAmANxFRkknwHCcjpn8uw,10499
|
10
|
-
bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
|
11
|
-
bittensor_cli/src/bittensor/subtensor_interface.py,sha256=f0UveL6Nna-ZLWAQTXMp3Kiorm4QPBDtrshtHmaivF0,57023
|
12
|
-
bittensor_cli/src/bittensor/utils.py,sha256=KkYhHJZge0-uHXsG3VNz-IbWfaksuRnCXuXq1FP5CkQ,40611
|
13
|
-
bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=p_ARqDiniDNL-ZPuswfk_DJW5kl5rMNxL_uRbfVTkTA,64599
|
15
|
-
bittensor_cli/src/bittensor/extrinsics/root.py,sha256=RZEQv6QVDAQDjuX_vgjOMsatYvHpA3MW8zueiL6jxlE,19376
|
16
|
-
bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=8-7LVM8Xt_K-f_pJfAVeybSF_mr3pJorjs963TQbRZ0,8407
|
17
|
-
bittensor_cli/src/bittensor/templates/table.j2,sha256=P2EFiksnO1cQsB8zjK6hVJwUryHTsLslzRE0YtobAV8,10601
|
18
|
-
bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
bittensor_cli/src/commands/subnets.py,sha256=tB8HFKFJqy9eUPgf4kVZwb7kL1a6Ehj5_RnQQ0Hmu64,85389
|
20
|
-
bittensor_cli/src/commands/sudo.py,sha256=kLxqEledQVAGxqPb4cJrb8oDomHSZ1PwioCxubnIjRs,26268
|
21
|
-
bittensor_cli/src/commands/wallets.py,sha256=m4OYKq-6r2Fg8WkF_kCP81ittdZL1uWRgPukptihaE0,52204
|
22
|
-
bittensor_cli/src/commands/weights.py,sha256=3BCqVB1-W6BG0U_iOtuUZmFOQ9QngsnXAkBLwCHjK0g,16440
|
23
|
-
bittensor_cli/src/commands/stake/__init__.py,sha256=kcQE86CfemAw2LoNBHA_FIwixf4VyJ26FT10f0peJEU,6569
|
24
|
-
bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=WTFR0oprtOzMc5x0MXtWm595Bd4yK9iZCymwc3whr0U,28215
|
25
|
-
bittensor_cli/src/commands/stake/stake.py,sha256=MdBRj4sAuZGNJ5edPHLeaaNO4OQD70ThAUUYMKOLlvA,123929
|
26
|
-
bittensor_cli-8.2.0rc13.dist-info/METADATA,sha256=hSJvbEXbFBbojxEtOzM15LUWgY0KB1kjs0ZkBfCHnhY,6842
|
27
|
-
bittensor_cli-8.2.0rc13.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
28
|
-
bittensor_cli-8.2.0rc13.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
|
29
|
-
bittensor_cli-8.2.0rc13.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
|
30
|
-
bittensor_cli-8.2.0rc13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|