@@ -3915,7 +3915,7 @@ async def get_stake_info_for_coldkey(
39153915 block : Optional [int ] = None ,
39163916 block_hash : Optional [str ] = None ,
39173917 reuse_block : bool = False ,
3918- ) -> Optional [ list ["StakeInfo" ] ]:
3918+ ) -> list ["StakeInfo" ]:
39193919 """
39203920 Retrieves the stake information for a given coldkey.
39213921
@@ -3926,7 +3926,7 @@ async def get_stake_info_for_coldkey(
39263926 reuse_block: Whether to reuse the last-used block hash.
39273927
39283928 Returns:
3929- An optional list of StakeInfo objects, or ``None`` if no stake information is found .
3929+ List of StakeInfo objects.
39303930 """
39313931 result = await self .query_runtime_api (
39323932 runtime_api = "StakeInfoRuntimeApi" ,
@@ -3943,6 +3943,42 @@ async def get_stake_info_for_coldkey(
39433943 stakes : list [StakeInfo ] = StakeInfo .list_from_dicts (result )
39443944 return [stake for stake in stakes if stake .stake > 0 ]
39453945
3946+ async def get_stake_info_for_coldkeys (
3947+ self ,
3948+ coldkey_ss58s : list [str ],
3949+ block : Optional [int ] = None ,
3950+ block_hash : Optional [str ] = None ,
3951+ reuse_block : bool = False ,
3952+ ) -> dict [str , list ["StakeInfo" ]]:
3953+ """
3954+ Retrieves the stake information for multiple coldkeys.
3955+
3956+ Parameters:
3957+ coldkey_ss58s: A list of SS58 addresses of the coldkeys to query.
3958+ block: The block number at which to query the stake information.
3959+ block_hash: The hash of the blockchain block number for the query.
3960+ reuse_block: Whether to reuse the last-used block hash.
3961+
3962+ Returns:
3963+ The dictionary mapping coldkey addresses to a list of StakeInfo objects.
3964+ """
3965+ query = await self .query_runtime_api (
3966+ runtime_api = "StakeInfoRuntimeApi" ,
3967+ method = "get_stake_info_for_coldkeys" ,
3968+ params = [coldkey_ss58s ],
3969+ block = block ,
3970+ block_hash = block_hash ,
3971+ reuse_block = reuse_block ,
3972+ )
3973+
3974+ if query is None :
3975+ return {}
3976+
3977+ return {
3978+ decode_account_id (ck ): StakeInfo .list_from_dicts (st_info )
3979+ for ck , st_info in query
3980+ }
3981+
39463982 async def get_stake_for_hotkey (
39473983 self ,
39483984 hotkey_ss58 : str ,
@@ -5619,7 +5655,7 @@ async def sign_and_send_extrinsic(
56195655 wait_for_inclusion = wait_for_inclusion ,
56205656 wait_for_finalization = wait_for_finalization ,
56215657 )
5622- extrinsic_response . extrinsic_receipt = response
5658+
56235659 # We only wait here if we expect finalization.
56245660 if not wait_for_finalization and not wait_for_inclusion :
56255661 extrinsic_response .extrinsic_fee = await self .get_extrinsic_fee (
@@ -5631,6 +5667,8 @@ async def sign_and_send_extrinsic(
56315667 logging .debug (extrinsic_response .message )
56325668 return extrinsic_response
56335669
5670+ extrinsic_response .extrinsic_receipt = response
5671+
56345672 if await response .is_success :
56355673 extrinsic_response .extrinsic_fee = Balance .from_rao (
56365674 await response .total_fee_amount
0 commit comments