bittensor-cli 8.4.3__py3-none-any.whl → 9.0.0rc2__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 +2 -2
- bittensor_cli/cli.py +1508 -1385
- bittensor_cli/src/__init__.py +627 -197
- bittensor_cli/src/bittensor/balances.py +41 -8
- bittensor_cli/src/bittensor/chain_data.py +557 -428
- bittensor_cli/src/bittensor/extrinsics/registration.py +161 -47
- bittensor_cli/src/bittensor/extrinsics/root.py +14 -8
- bittensor_cli/src/bittensor/extrinsics/transfer.py +14 -21
- bittensor_cli/src/bittensor/minigraph.py +46 -8
- bittensor_cli/src/bittensor/subtensor_interface.py +572 -253
- bittensor_cli/src/bittensor/utils.py +326 -75
- bittensor_cli/src/commands/stake/__init__.py +154 -0
- bittensor_cli/src/commands/stake/children_hotkeys.py +121 -87
- bittensor_cli/src/commands/stake/move.py +1000 -0
- bittensor_cli/src/commands/stake/stake.py +1637 -1264
- bittensor_cli/src/commands/subnets/__init__.py +0 -0
- bittensor_cli/src/commands/subnets/price.py +867 -0
- bittensor_cli/src/commands/subnets/subnets.py +2055 -0
- bittensor_cli/src/commands/sudo.py +529 -26
- bittensor_cli/src/commands/wallets.py +234 -544
- bittensor_cli/src/commands/weights.py +15 -11
- {bittensor_cli-8.4.3.dist-info → bittensor_cli-9.0.0rc2.dist-info}/METADATA +7 -4
- bittensor_cli-9.0.0rc2.dist-info/RECORD +32 -0
- bittensor_cli/src/bittensor/async_substrate_interface.py +0 -2748
- bittensor_cli/src/commands/root.py +0 -1752
- bittensor_cli/src/commands/subnets.py +0 -897
- bittensor_cli-8.4.3.dist-info/RECORD +0 -31
- {bittensor_cli-8.4.3.dist-info → bittensor_cli-9.0.0rc2.dist-info}/WHEEL +0 -0
- {bittensor_cli-8.4.3.dist-info → bittensor_cli-9.0.0rc2.dist-info}/entry_points.txt +0 -0
- {bittensor_cli-8.4.3.dist-info → bittensor_cli-9.0.0rc2.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,7 @@
|
|
18
18
|
# DEALINGS IN THE SOFTWARE.
|
19
19
|
|
20
20
|
from typing import Union
|
21
|
+
from bittensor_cli.src import UNITS
|
21
22
|
|
22
23
|
|
23
24
|
class Balance:
|
@@ -72,7 +73,10 @@ class Balance:
|
|
72
73
|
"""
|
73
74
|
Returns the Balance object as a string in the format "symbolvalue", where the value is in tao.
|
74
75
|
"""
|
75
|
-
|
76
|
+
if self.unit == UNITS[0]:
|
77
|
+
return f"{self.unit} {float(self.tao):,.4f}"
|
78
|
+
else:
|
79
|
+
return f"{float(self.tao):,.4f} {self.unit}\u200e"
|
76
80
|
|
77
81
|
def __rich__(self):
|
78
82
|
return "[green]{}[/green][green]{}[/green][green].[/green][dim green]{}[/dim green]".format(
|
@@ -225,12 +229,6 @@ class Balance:
|
|
225
229
|
except (ValueError, TypeError):
|
226
230
|
raise NotImplementedError("Unsupported type")
|
227
231
|
|
228
|
-
def __int__(self) -> int:
|
229
|
-
return self.rao
|
230
|
-
|
231
|
-
def __float__(self) -> float:
|
232
|
-
return self.tao
|
233
|
-
|
234
232
|
def __nonzero__(self) -> bool:
|
235
233
|
return bool(self.rao)
|
236
234
|
|
@@ -278,4 +276,39 @@ class Balance:
|
|
278
276
|
|
279
277
|
:return: A Balance object representing the given amount.
|
280
278
|
"""
|
281
|
-
return Balance(amount)
|
279
|
+
return Balance(int(amount))
|
280
|
+
|
281
|
+
@staticmethod
|
282
|
+
def get_unit(netuid: int):
|
283
|
+
units = UNITS
|
284
|
+
base = len(units)
|
285
|
+
if netuid < base:
|
286
|
+
return units[netuid]
|
287
|
+
else:
|
288
|
+
result = ""
|
289
|
+
while netuid > 0:
|
290
|
+
result = units[netuid % base] + result
|
291
|
+
netuid //= base
|
292
|
+
return result
|
293
|
+
|
294
|
+
def set_unit(self, netuid: int):
|
295
|
+
self.unit = Balance.get_unit(netuid)
|
296
|
+
self.rao_unit = Balance.get_unit(netuid)
|
297
|
+
return self
|
298
|
+
|
299
|
+
|
300
|
+
def fixed_to_float(fixed: dict) -> float:
|
301
|
+
# Currently this is stored as a U64F64
|
302
|
+
# which is 64 bits of integer and 64 bits of fractional
|
303
|
+
# uint_bits = 64
|
304
|
+
frac_bits = 64
|
305
|
+
|
306
|
+
data: int = fixed["bits"]
|
307
|
+
|
308
|
+
# Shift bits to extract integer part (assuming 64 bits for integer part)
|
309
|
+
integer_part = data >> frac_bits
|
310
|
+
fractional_part = data & (2**frac_bits - 1)
|
311
|
+
|
312
|
+
frac_float = fractional_part / (2**frac_bits)
|
313
|
+
|
314
|
+
return integer_part + frac_float
|