@@ -2620,9 +2620,7 @@ async def get_subnet_price(
2620
2620
if netuid == 0 :
2621
2621
return Balance .from_tao (1 )
2622
2622
2623
- block_hash = await self .determine_block_hash (
2624
- block = block , block_hash = block_hash , reuse_block = reuse_block
2625
- )
2623
+ block_hash = await self .determine_block_hash (block = block )
2626
2624
current_sqrt_price = await self .substrate .query (
2627
2625
module = "Swap" ,
2628
2626
storage_function = "AlphaSqrtPrice" ,
@@ -3740,22 +3738,24 @@ async def subnet(
3740
3738
if not block_hash and reuse_block :
3741
3739
block_hash = self .substrate .last_block_hash
3742
3740
3743
- query = await self .substrate .runtime_call (
3744
- "SubnetInfoRuntimeApi" ,
3745
- "get_dynamic_info" ,
3746
- params = [netuid ],
3747
- block_hash = block_hash ,
3741
+ query , price = await asyncio .gather (
3742
+ self .substrate .runtime_call (
3743
+ "SubnetInfoRuntimeApi" ,
3744
+ "get_dynamic_info" ,
3745
+ params = [netuid ],
3746
+ block_hash = block_hash ,
3747
+ ),
3748
+ self .get_subnet_price (
3749
+ netuid = netuid ,
3750
+ block = block ,
3751
+ block_hash = block_hash ,
3752
+ reuse_block = reuse_block ,
3753
+ ),
3754
+ return_exceptions = True ,
3748
3755
)
3749
3756
3750
3757
if isinstance (decoded := query .decode (), dict ):
3751
- try :
3752
- price = await self .get_subnet_price (
3753
- netuid = netuid ,
3754
- block = block ,
3755
- block_hash = block_hash ,
3756
- reuse_block = reuse_block ,
3757
- )
3758
- except SubstrateRequestException :
3758
+ if isinstance (price , SubstrateRequestException ):
3759
3759
price = None
3760
3760
return DynamicInfo .from_dict ({** decoded , "price" : price })
3761
3761
return None
0 commit comments