9393 unstake_multiple_extrinsic ,
9494)
9595from bittensor .core .metagraph import AsyncMetagraph
96- from bittensor .core .settings import version_as_int , TYPE_REGISTRY
96+ from bittensor .core .settings import version_as_int , TYPE_REGISTRY , DEFAULT_PERIOD
9797from bittensor .core .types import (
9898 ParamWithTypes ,
9999 Salt ,
@@ -956,7 +956,11 @@ async def bonds(
956956 return b_map
957957
958958 async def commit (
959- self , wallet : "Wallet" , netuid : int , data : str , period : Optional [int ] = None
959+ self ,
960+ wallet : "Wallet" ,
961+ netuid : int ,
962+ data : str ,
963+ period : Optional [int ] = DEFAULT_PERIOD ,
960964 ) -> bool :
961965 """Commits arbitrary data to the Bittensor network by publishing metadata.
962966
@@ -2385,6 +2389,17 @@ async def get_liquidity_list(
23852389 logging .debug (f"Subnet { netuid } is not active." )
23862390 return None
23872391
2392+ positions_response = await self .query_map (
2393+ module = "Swap" ,
2394+ name = "Positions" ,
2395+ params = [netuid , wallet .coldkeypub .ss58_address ],
2396+ block = block ,
2397+ block_hash = block_hash ,
2398+ reuse_block = reuse_block ,
2399+ )
2400+ if len (positions_response .records ) == 0 :
2401+ return []
2402+
23882403 block_hash = await self .determine_block_hash (
23892404 block = block , block_hash = block_hash , reuse_block = reuse_block
23902405 )
@@ -2408,25 +2423,20 @@ async def get_liquidity_list(
24082423 params = [netuid ],
24092424 block_hash = block_hash ,
24102425 )
2426+
24112427 (
2412- (fee_global_tao_query , fee_global_alpha_query , sqrt_price_query ),
2413- positions_response ,
2414- ) = await asyncio .gather (
2415- self .substrate .query_multi (
2416- [
2417- fee_global_tao_query_sk ,
2418- fee_global_alpha_query_sk ,
2419- sqrt_price_query_sk ,
2420- ],
2421- block_hash = block_hash ,
2422- ),
2423- self .query_map (
2424- module = "Swap" ,
2425- name = "Positions" ,
2426- block = block ,
2427- params = [netuid , wallet .coldkeypub .ss58_address ],
2428- ),
2428+ fee_global_tao_query ,
2429+ fee_global_alpha_query ,
2430+ sqrt_price_query ,
2431+ ) = await self .substrate .query_multi (
2432+ storage_keys = [
2433+ fee_global_tao_query_sk ,
2434+ fee_global_alpha_query_sk ,
2435+ sqrt_price_query_sk ,
2436+ ],
2437+ block_hash = block_hash ,
24292438 )
2439+
24302440 # convert to floats
24312441 fee_global_tao = fixed_to_float (fee_global_tao_query [1 ])
24322442 fee_global_alpha = fixed_to_float (fee_global_alpha_query [1 ])
@@ -4043,7 +4053,7 @@ async def set_reveal_commitment(
40434053 data : str ,
40444054 blocks_until_reveal : int = 360 ,
40454055 block_time : Union [int , float ] = 12 ,
4046- period : Optional [int ] = None ,
4056+ period : Optional [int ] = DEFAULT_PERIOD ,
40474057 ) -> tuple [bool , int ]:
40484058 """
40494059 Commits arbitrary data to the Bittensor network by publishing metadata.
@@ -4437,7 +4447,7 @@ async def sign_and_send_extrinsic(
44374447 wait_for_finalization : bool = False ,
44384448 sign_with : str = "coldkey" ,
44394449 use_nonce : bool = False ,
4440- period : Optional [int ] = None ,
4450+ period : Optional [int ] = DEFAULT_PERIOD ,
44414451 nonce_key : str = "hotkey" ,
44424452 raise_error : bool = False ,
44434453 ) -> tuple [bool , str ]:
@@ -4480,6 +4490,7 @@ async def sign_and_send_extrinsic(
44804490 getattr (wallet , nonce_key ).ss58_address
44814491 )
44824492 extrinsic_data ["nonce" ] = next_nonce
4493+
44834494 if period is not None :
44844495 extrinsic_data ["era" ] = {"period" : period }
44854496
@@ -4523,7 +4534,7 @@ async def add_stake(
45234534 safe_staking : bool = False ,
45244535 allow_partial_stake : bool = False ,
45254536 rate_tolerance : float = 0.005 ,
4526- period : Optional [int ] = None ,
4537+ period : Optional [int ] = DEFAULT_PERIOD ,
45274538 ) -> bool :
45284539 """
45294540 Adds a stake from the specified wallet to the neuron identified by the SS58 address of its hotkey in specified
@@ -4581,7 +4592,7 @@ async def add_liquidity(
45814592 hotkey : Optional [str ] = None ,
45824593 wait_for_inclusion : bool = True ,
45834594 wait_for_finalization : bool = False ,
4584- period : Optional [int ] = None ,
4595+ period : Optional [int ] = DEFAULT_PERIOD ,
45854596 ) -> tuple [bool , str ]:
45864597 """
45874598 Adds liquidity to the specified price range.
@@ -4664,7 +4675,7 @@ async def burned_register(
46644675 netuid : int ,
46654676 wait_for_inclusion : bool = False ,
46664677 wait_for_finalization : bool = True ,
4667- period : Optional [int ] = None ,
4678+ period : Optional [int ] = DEFAULT_PERIOD ,
46684679 ) -> bool :
46694680 """
46704681 Registers a neuron on the Bittensor network by recycling TAO. This method of registration involves recycling
@@ -4713,7 +4724,7 @@ async def commit_weights(
47134724 wait_for_inclusion : bool = False ,
47144725 wait_for_finalization : bool = False ,
47154726 max_retries : int = 5 ,
4716- period : Optional [int ] = 16 ,
4727+ period : Optional [int ] = DEFAULT_PERIOD ,
47174728 mechid : int = 0 ,
47184729 ) -> tuple [bool , str ]:
47194730 """
@@ -4788,7 +4799,7 @@ async def modify_liquidity(
47884799 hotkey : Optional [str ] = None ,
47894800 wait_for_inclusion : bool = True ,
47904801 wait_for_finalization : bool = False ,
4791- period : Optional [int ] = None ,
4802+ period : Optional [int ] = DEFAULT_PERIOD ,
47924803 ) -> tuple [bool , str ]:
47934804 """Modifies liquidity in liquidity position by adding or removing liquidity from it.
47944805
@@ -4861,7 +4872,7 @@ async def move_stake(
48614872 amount : Optional [Balance ] = None ,
48624873 wait_for_inclusion : bool = True ,
48634874 wait_for_finalization : bool = False ,
4864- period : Optional [int ] = None ,
4875+ period : Optional [int ] = DEFAULT_PERIOD ,
48654876 move_all_stake : bool = False ,
48664877 ) -> bool :
48674878 """
@@ -4913,7 +4924,7 @@ async def register(
49134924 num_processes : Optional [int ] = None ,
49144925 update_interval : Optional [int ] = None ,
49154926 log_verbose : bool = False ,
4916- period : Optional [int ] = None ,
4927+ period : Optional [int ] = DEFAULT_PERIOD ,
49174928 ):
49184929 """
49194930 Registers a neuron on the Bittensor network using the provided wallet.
@@ -4967,7 +4978,7 @@ async def register_subnet(
49674978 wallet : "Wallet" ,
49684979 wait_for_inclusion : bool = False ,
49694980 wait_for_finalization : bool = True ,
4970- period : Optional [int ] = None ,
4981+ period : Optional [int ] = DEFAULT_PERIOD ,
49714982 ) -> bool :
49724983 """
49734984 Registers a new subnetwork on the Bittensor network.
@@ -5001,7 +5012,7 @@ async def remove_liquidity(
50015012 hotkey : Optional [str ] = None ,
50025013 wait_for_inclusion : bool = True ,
50035014 wait_for_finalization : bool = False ,
5004- period : Optional [int ] = None ,
5015+ period : Optional [int ] = DEFAULT_PERIOD ,
50055016 ) -> tuple [bool , str ]:
50065017 """Remove liquidity and credit balances back to wallet's hotkey stake.
50075018
@@ -5049,7 +5060,7 @@ async def reveal_weights(
50495060 wait_for_inclusion : bool = False ,
50505061 wait_for_finalization : bool = False ,
50515062 max_retries : int = 5 ,
5052- period : Optional [int ] = None ,
5063+ period : Optional [int ] = DEFAULT_PERIOD ,
50535064 mechid : int = 0 ,
50545065 ) -> tuple [bool , str ]:
50555066 """
@@ -5114,7 +5125,7 @@ async def root_set_pending_childkey_cooldown(
51145125 cooldown : int ,
51155126 wait_for_inclusion : bool = True ,
51165127 wait_for_finalization : bool = True ,
5117- period : Optional [int ] = None ,
5128+ period : Optional [int ] = DEFAULT_PERIOD ,
51185129 ) -> tuple [bool , str ]:
51195130 """Sets the pending childkey cooldown.
51205131
@@ -5150,7 +5161,7 @@ async def root_register(
51505161 block_hash : Optional [str ] = None ,
51515162 wait_for_inclusion : bool = True ,
51525163 wait_for_finalization : bool = True ,
5153- period : Optional [int ] = None ,
5164+ period : Optional [int ] = DEFAULT_PERIOD ,
51545165 ) -> bool :
51555166 """
51565167 Register neuron by recycling some TAO.
@@ -5185,7 +5196,7 @@ async def root_set_weights(
51855196 version_key : int = 0 ,
51865197 wait_for_inclusion : bool = True ,
51875198 wait_for_finalization : bool = True ,
5188- period : Optional [int ] = None ,
5199+ period : Optional [int ] = DEFAULT_PERIOD ,
51895200 ) -> bool :
51905201 """
51915202 Set weights for the root network.
@@ -5223,7 +5234,7 @@ async def set_auto_stake(
52235234 wallet : "Wallet" ,
52245235 netuid : int ,
52255236 hotkey_ss58 : str ,
5226- period : Optional [int ] = None ,
5237+ period : Optional [int ] = DEFAULT_PERIOD ,
52275238 raise_error : bool = False ,
52285239 wait_for_inclusion : bool = True ,
52295240 wait_for_finalization : bool = True ,
@@ -5267,7 +5278,7 @@ async def set_children(
52675278 wait_for_inclusion : bool = True ,
52685279 wait_for_finalization : bool = True ,
52695280 raise_error : bool = False ,
5270- period : Optional [int ] = None ,
5281+ period : Optional [int ] = DEFAULT_PERIOD ,
52715282 ) -> tuple [bool , str ]:
52725283 """
52735284 Allows a coldkey to set children-keys.
@@ -5321,7 +5332,7 @@ async def set_delegate_take(
53215332 wait_for_inclusion : bool = True ,
53225333 wait_for_finalization : bool = True ,
53235334 raise_error : bool = False ,
5324- period : Optional [int ] = None ,
5335+ period : Optional [int ] = DEFAULT_PERIOD ,
53255336 ) -> tuple [bool , str ]:
53265337 """
53275338 Sets the delegate 'take' percentage for a neuron identified by its hotkey.
@@ -5404,7 +5415,7 @@ async def set_subnet_identity(
54045415 subnet_identity : SubnetIdentity ,
54055416 wait_for_inclusion : bool = False ,
54065417 wait_for_finalization : bool = True ,
5407- period : Optional [int ] = None ,
5418+ period : Optional [int ] = DEFAULT_PERIOD ,
54085419 ) -> tuple [bool , str ]:
54095420 """
54105421 Sets the identity of a subnet for a specific wallet and network.
@@ -5454,7 +5465,7 @@ async def set_weights(
54545465 wait_for_finalization : bool = False ,
54555466 max_retries : int = 5 ,
54565467 block_time : float = 12.0 ,
5457- period : Optional [int ] = 8 ,
5468+ period : Optional [int ] = DEFAULT_PERIOD ,
54585469 mechid : int = 0 ,
54595470 commit_reveal_version : int = 4 ,
54605471 ):
@@ -5579,7 +5590,7 @@ async def serve_axon(
55795590 wait_for_inclusion : bool = False ,
55805591 wait_for_finalization : bool = True ,
55815592 certificate : Optional [Certificate ] = None ,
5582- period : Optional [int ] = None ,
5593+ period : Optional [int ] = DEFAULT_PERIOD ,
55835594 ) -> bool :
55845595 """
55855596 Registers an ``Axon`` serving endpoint on the Bittensor network for a specific neuron. This function is used to
@@ -5617,7 +5628,7 @@ async def start_call(
56175628 netuid : int ,
56185629 wait_for_inclusion : bool = True ,
56195630 wait_for_finalization : bool = False ,
5620- period : Optional [int ] = None ,
5631+ period : Optional [int ] = DEFAULT_PERIOD ,
56215632 ) -> tuple [bool , str ]:
56225633 """
56235634 Submits a start_call extrinsic to the blockchain, to trigger the start call process for a subnet (used to start
@@ -5658,7 +5669,7 @@ async def swap_stake(
56585669 safe_staking : bool = False ,
56595670 allow_partial_stake : bool = False ,
56605671 rate_tolerance : float = 0.005 ,
5661- period : Optional [int ] = None ,
5672+ period : Optional [int ] = DEFAULT_PERIOD ,
56625673 ) -> bool :
56635674 """
56645675 Moves stake between subnets while keeping the same coldkey-hotkey pair ownership.
@@ -5717,7 +5728,7 @@ async def toggle_user_liquidity(
57175728 enable : bool ,
57185729 wait_for_inclusion : bool = True ,
57195730 wait_for_finalization : bool = False ,
5720- period : Optional [int ] = None ,
5731+ period : Optional [int ] = DEFAULT_PERIOD ,
57215732 ) -> tuple [bool , str ]:
57225733 """Allow to toggle user liquidity for specified subnet.
57235734
@@ -5757,7 +5768,7 @@ async def transfer(
57575768 wait_for_inclusion : bool = True ,
57585769 wait_for_finalization : bool = False ,
57595770 keep_alive : bool = True ,
5760- period : Optional [int ] = None ,
5771+ period : Optional [int ] = DEFAULT_PERIOD ,
57615772 ) -> bool :
57625773 """
57635774 Transfer token of amount to destination.
@@ -5800,7 +5811,7 @@ async def transfer_stake(
58005811 amount : Balance ,
58015812 wait_for_inclusion : bool = True ,
58025813 wait_for_finalization : bool = False ,
5803- period : Optional [int ] = None ,
5814+ period : Optional [int ] = DEFAULT_PERIOD ,
58045815 ) -> bool :
58055816 """
58065817 Transfers stake from one subnet to another while changing the coldkey owner.
@@ -5846,7 +5857,7 @@ async def unstake(
58465857 safe_staking : bool = False ,
58475858 allow_partial_stake : bool = False ,
58485859 rate_tolerance : float = 0.005 ,
5849- period : Optional [int ] = None ,
5860+ period : Optional [int ] = DEFAULT_PERIOD ,
58505861 unstake_all : bool = False ,
58515862 ) -> bool :
58525863 """
@@ -5903,7 +5914,7 @@ async def unstake_all(
59035914 rate_tolerance : Optional [float ] = 0.005 ,
59045915 wait_for_inclusion : bool = True ,
59055916 wait_for_finalization : bool = False ,
5906- period : Optional [int ] = None ,
5917+ period : Optional [int ] = DEFAULT_PERIOD ,
59075918 ) -> tuple [bool , str ]:
59085919 """Unstakes all TAO/Alpha associated with a hotkey from the specified subnets on the Bittensor network.
59095920
@@ -5987,7 +5998,7 @@ async def unstake_multiple(
59875998 amounts : Optional [list [Balance ]] = None ,
59885999 wait_for_inclusion : bool = True ,
59896000 wait_for_finalization : bool = False ,
5990- period : Optional [int ] = None ,
6001+ period : Optional [int ] = DEFAULT_PERIOD ,
59916002 unstake_all : bool = False ,
59926003 ) -> bool :
59936004 """
0 commit comments