@@ -610,14 +610,14 @@ def get_all_subnets_info(self, block: Optional[int] = None) -> list["SubnetInfo"
610
610
611
611
def get_balance (self , address : str , block : Optional [int ] = None ) -> Balance :
612
612
"""
613
- Retrieves the balance for given coldkey.
613
+ Retrieves the balance for given coldkey. Always in TAO.
614
614
615
615
Arguments:
616
- address (str) : coldkey address.
616
+ address: coldkey address.
617
617
block (Optional[int]): The blockchain block number for the query.
618
618
619
619
Returns:
620
- Balance object.
620
+ Balance object in TAO .
621
621
"""
622
622
balance = self .substrate .query (
623
623
module = "System" ,
@@ -1122,15 +1122,15 @@ def get_delegates(self, block: Optional[int] = None) -> list["DelegateInfo"]:
1122
1122
1123
1123
def get_existential_deposit (self , block : Optional [int ] = None ) -> Optional [Balance ]:
1124
1124
"""
1125
- Retrieves the existential deposit amount for the Bittensor blockchain.
1125
+ Retrieves the existential deposit amount for the Bittensor blockchain. Always in TAO.
1126
1126
The existential deposit is the minimum amount of TAO required for an account to exist on the blockchain.
1127
1127
Accounts with balances below this threshold can be reaped to conserve network resources.
1128
1128
1129
1129
Arguments:
1130
1130
block (Optional[int]): The blockchain block number for the query.
1131
1131
1132
1132
Returns:
1133
- The existential deposit amount.
1133
+ The existential deposit amount. Always in TAO.
1134
1134
1135
1135
The existential deposit is a fundamental economic parameter in the Bittensor network, ensuring efficient use of
1136
1136
storage and preventing the proliferation of dust accounts.
@@ -1424,16 +1424,19 @@ def get_stake(
1424
1424
block : Optional [int ] = None ,
1425
1425
) -> Balance :
1426
1426
"""
1427
- Returns the stake under a coldkey - hotkey pairing.
1427
+ Returns the amount of Alpha staked by a specific coldkey to a specific hotkey within a given subnet.
1428
+ This function retrieves the delegated stake balance, referred to as the 'Alpha' value.
1428
1429
1429
1430
Args:
1430
- hotkey_ss58 (str): The SS58 address of the hotkey.
1431
- coldkey_ss58 (str): The SS58 address of the coldkey.
1432
- netuid (int): The subnet ID
1433
- block (Optional[int]): The block number at which to query the stake information.
1431
+ coldkey_ss58: The SS58 address of the coldkey that delegated the stake. This address owns the stake.
1432
+ hotkey_ss58: The ss58 address of the hotkey which the stake is on.
1433
+ netuid: The unique identifier of the subnet to query.
1434
+ block: The specific block number at which to retrieve the stake information. If None, the current stake at
1435
+ the latest block is returned. Defaults to ``None``.
1434
1436
1435
1437
Returns:
1436
- Balance: The stake under the coldkey - hotkey pairing.
1438
+ An object representing the amount of Alpha (TAO ONLY if the subnet's netuid is 0) currently staked from the
1439
+ specified coldkey to the specified hotkey within the given subnet.
1437
1440
"""
1438
1441
alpha_shares_query = self .query_module (
1439
1442
module = "SubtensorModule" ,
@@ -2632,27 +2635,27 @@ def add_stake(
2632
2635
period : Optional [int ] = None ,
2633
2636
) -> bool :
2634
2637
"""
2635
- Adds the specified amount of stake to a neuron identified by the hotkey ``SS58`` address.
2636
- Staking is a fundamental process in the Bittensor network that enables neurons to participate actively and earn
2637
- incentives.
2638
+ Adds a stake from the specified wallet to the neuron identified by the SS58 address of its hotkey in specified subnet.
2639
+ Staking is a fundamental process in the Bittensor network that enables neurons to participate actively and earn incentives.
2638
2640
2639
2641
Args:
2640
- wallet (bittensor_wallet.Wallet): The wallet to be used for staking.
2641
- hotkey_ss58 (Optional[str]): The ``SS58`` address of the hotkey associated with the neuron.
2642
- netuid (Optional[int]): The unique identifier of the subnet to which the neuron belongs.
2643
- amount (Balance): The amount of TAO to stake.
2644
- wait_for_inclusion (bool): Waits for the transaction to be included in a block.
2645
- wait_for_finalization (bool): Waits for the transaction to be finalized on the blockchain.
2646
- safe_staking (bool): If true, enables price safety checks to protect against fluctuating prices. The stake
2647
- will only execute if the price change doesn't exceed the rate tolerance. Default is False.
2648
- allow_partial_stake (bool): If true and safe_staking is enabled, allows partial staking when
2649
- the full amount would exceed the price tolerance. If false, the entire stake fails if it would
2650
- exceed the tolerance. Default is False.
2651
- rate_tolerance (float): The maximum allowed price change ratio when staking. For example,
2652
- 0.005 = 0.5% maximum price increase. Only used when safe_staking is True. Default is 0.005.
2653
- period (Optional[int]): The number of blocks during which the transaction will remain valid after it's
2654
- submitted. If the transaction is not included in a block within that number of blocks, it will expire
2655
- and be rejected. You can think of it as an expiration date for the transaction.
2642
+ wallet: The wallet to be used for staking.
2643
+ hotkey_ss58: The SS58 address of the hotkey associated with the neuron to which you intend to delegate your
2644
+ stake. If not specified, the wallet's hotkey will be used. Defaults to ``None``.
2645
+ netuid: The unique identifier of the subnet to which the neuron belongs.
2646
+ amount: The amount of TAO to stake.
2647
+ wait_for_inclusion: Waits for the transaction to be included in a block. Defaults to ``True``.
2648
+ wait_for_finalization: Waits for the transaction to be finalized on the blockchain. Defaults to ``False``.
2649
+ safe_staking: If true, enables price safety checks to protect against fluctuating prices. The stake will
2650
+ only execute if the price change doesn't exceed the rate tolerance. Default is ``False``.
2651
+ allow_partial_stake: If true and safe_staking is enabled, allows partial staking when the full amount would
2652
+ exceed the price tolerance. If false, the entire stake fails if it would exceed the tolerance.
2653
+ Default is ``False``.
2654
+ rate_tolerance: The maximum allowed price change ratio when staking. For example,
2655
+ 0.005 = 0.5% maximum price increase. Only used when safe_staking is True. Default is ``0.005``.
2656
+ period: The number of blocks during which the transaction will remain valid after it's submitted. If the
2657
+ transaction is not included in a block within that number of blocks, it will expire and be rejected. You
2658
+ can think of it as an expiration date for the transaction. Defaults to ``None``.
2656
2659
2657
2660
Returns:
2658
2661
bool: True if the staking is successful, False otherwise.
@@ -3668,6 +3671,7 @@ def unstake(
3668
3671
allow_partial_stake : bool = False ,
3669
3672
rate_tolerance : float = 0.005 ,
3670
3673
period : Optional [int ] = None ,
3674
+ unstake_all : bool = False ,
3671
3675
) -> bool :
3672
3676
"""
3673
3677
Removes a specified amount of stake from a single hotkey account. This function is critical for adjusting
@@ -3678,7 +3682,7 @@ def unstake(
3678
3682
removed.
3679
3683
hotkey_ss58 (Optional[str]): The ``SS58`` address of the hotkey account to unstake from.
3680
3684
netuid (Optional[int]): The unique identifier of the subnet.
3681
- amount (Balance): The amount of alpha to unstake. If not specified, unstakes all.
3685
+ amount (Balance): The amount of alpha to unstake. If not specified, unstakes all. Alpha amount.
3682
3686
wait_for_inclusion (bool): Waits for the transaction to be included in a block.
3683
3687
wait_for_finalization (bool): Waits for the transaction to be finalized on the blockchain.
3684
3688
safe_staking (bool): If true, enables price safety checks to protect against fluctuating prices. The unstake
@@ -3691,6 +3695,7 @@ def unstake(
3691
3695
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
3692
3696
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
3693
3697
You can think of it as an expiration date for the transaction.
3698
+ unstake_all: If true, unstakes all tokens. Default is ``False``.
3694
3699
3695
3700
Returns:
3696
3701
bool: ``True`` if the unstaking process is successful, False otherwise.
@@ -3712,6 +3717,7 @@ def unstake(
3712
3717
allow_partial_stake = allow_partial_stake ,
3713
3718
rate_tolerance = rate_tolerance ,
3714
3719
period = period ,
3720
+ unstake_all = unstake_all ,
3715
3721
)
3716
3722
3717
3723
def unstake_multiple (
@@ -3723,6 +3729,7 @@ def unstake_multiple(
3723
3729
wait_for_inclusion : bool = True ,
3724
3730
wait_for_finalization : bool = False ,
3725
3731
period : Optional [int ] = None ,
3732
+ unstake_all : bool = False ,
3726
3733
) -> bool :
3727
3734
"""
3728
3735
Performs batch unstaking from multiple hotkey accounts, allowing a neuron to reduce its staked amounts
@@ -3740,6 +3747,7 @@ def unstake_multiple(
3740
3747
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
3741
3748
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
3742
3749
You can think of it as an expiration date for the transaction.
3750
+ unstake_all: If true, unstakes all tokens. Default is ``False``.
3743
3751
3744
3752
Returns:
3745
3753
bool: ``True`` if the batch unstaking is successful, False otherwise.
@@ -3756,4 +3764,5 @@ def unstake_multiple(
3756
3764
wait_for_inclusion = wait_for_inclusion ,
3757
3765
wait_for_finalization = wait_for_finalization ,
3758
3766
period = period ,
3767
+ unstake_all = unstake_all ,
3759
3768
)
0 commit comments