@@ -1213,31 +1213,34 @@ async def stake_add_new(
1213
1213
wallet .coldkeypub .ss58_address
1214
1214
].set_unit (0 )
1215
1215
remaining_wallet_balance = current_wallet_balance
1216
- max_slippage = 0
1216
+ max_slippage = 0.0
1217
1217
1218
- all_dynamic_info = await asyncio .gather (
1219
- * [subtensor .get_subnet_dynamic_info (x ) for x in netuids ]
1218
+ all_dynamic_info , initial_stake_balances = await asyncio .gather (
1219
+ asyncio .gather (* [subtensor .get_subnet_dynamic_info (x ) for x in netuids ]),
1220
+ asyncio .gather (
1221
+ * [
1222
+ subtensor .get_stake_for_coldkey_and_hotkey_on_netuid (
1223
+ coldkey_ss58 = wallet .coldkeypub .ss58_address ,
1224
+ hotkey_ss58 = staking_address_ss58 ,
1225
+ netuid = x ,
1226
+ )
1227
+ for x in netuids
1228
+ ]
1229
+ ),
1220
1230
)
1221
1231
1222
- for netuid , dynamic_info in zip (netuids , all_dynamic_info ):
1232
+ for netuid , dynamic_info , current_stake_balance in zip (
1233
+ netuids , all_dynamic_info , initial_stake_balances
1234
+ ):
1223
1235
# Check that the subnet exists.
1224
1236
if not dynamic_info :
1225
1237
err_console .print (f"Subnet with netuid: { netuid } does not exist." )
1226
1238
continue
1227
1239
1228
- # Get old staking balance.
1229
- # TODO gather this
1230
- current_stake_balance : Balance = (
1231
- subtensor .get_stake_for_coldkey_and_hotkey_on_netuid ( # TODO add/await
1232
- coldkey_ss58 = wallet .coldkeypub .ss58_address ,
1233
- hotkey_ss58 = staking_address_ss58 ,
1234
- netuid = netuid ,
1235
- ).set_unit (netuid )
1236
- )
1237
1240
current_stake_balances .append (current_stake_balance )
1238
1241
1239
1242
# Get the amount.
1240
- amount_to_stake_as_balance = None
1243
+ amount_to_stake_as_balance = Balance ( 0 )
1241
1244
if amount :
1242
1245
amount_to_stake_as_balance = Balance .from_tao (amount )
1243
1246
elif stake_all :
@@ -1306,7 +1309,7 @@ async def stake_add_new(
1306
1309
style = "light_goldenrod2" ,
1307
1310
)
1308
1311
table .add_column (
1309
- f"Recieved ({ Balance .get_unit (netuid )} )" ,
1312
+ f"Received ({ Balance .get_unit (netuid )} )" ,
1310
1313
justify = "center" ,
1311
1314
style = "light_slate_blue" ,
1312
1315
)
0 commit comments