File tree Expand file tree Collapse file tree 1 file changed +7
-21
lines changed
bittensor_cli/src/bittensor Expand file tree Collapse file tree 1 file changed +7
-21
lines changed Original file line number Diff line number Diff line change 36
36
decode_hex_identity_dict ,
37
37
validate_chain_endpoint ,
38
38
u16_normalized_float ,
39
+ U16_MAX ,
39
40
)
40
41
41
42
SubstrateClass = (
@@ -1526,29 +1527,14 @@ async def get_stake_fee(
1526
1527
5. Moving between coldkeys
1527
1528
"""
1528
1529
1529
- origin = None
1530
- if origin_hotkey_ss58 is not None and origin_netuid is not None :
1531
- origin = (origin_hotkey_ss58 , origin_netuid )
1530
+ if origin_netuid is None :
1531
+ origin_netuid = 0
1532
1532
1533
- destination = None
1534
- if destination_hotkey_ss58 is not None and destination_netuid is not None :
1535
- destination = (destination_hotkey_ss58 , destination_netuid )
1533
+ fee_rate = await self .query ("Swap" , "FeeRate" , [origin_netuid ])
1534
+ fee = amount * (fee_rate / U16_MAX )
1536
1535
1537
- result_ = await self .query_runtime_api (
1538
- runtime_api = "StakeInfoRuntimeApi" ,
1539
- method = "get_stake_fee" ,
1540
- params = [
1541
- origin ,
1542
- origin_coldkey_ss58 ,
1543
- destination ,
1544
- destination_coldkey_ss58 ,
1545
- amount ,
1546
- ],
1547
- block_hash = block_hash ,
1548
- )
1549
- result = Balance .from_rao (result_ )
1550
- if isinstance (origin_netuid , int ):
1551
- result .set_unit (origin_netuid )
1536
+ result = Balance .from_tao (fee )
1537
+ result .set_unit (origin_netuid )
1552
1538
1553
1539
return result
1554
1540
You can’t perform that action at this time.
0 commit comments