@@ -1575,6 +1575,117 @@ async def get_stake(
1575
1575
1576
1576
return Balance .from_rao (int (stake )).set_unit (netuid = netuid )
1577
1577
1578
+ async def get_stake_add_fee (
1579
+ self ,
1580
+ amount : Balance ,
1581
+ netuid : int ,
1582
+ coldkey_ss58 : str ,
1583
+ hotkey_ss58 : str ,
1584
+ block : Optional [int ] = None ,
1585
+ ) -> Balance :
1586
+ """
1587
+ Calculates the fee for adding new stake to a hotkey.
1588
+
1589
+ Args:
1590
+ amount: Amount of stake to add in TAO
1591
+ netuid: Netuid of subnet
1592
+ coldkey_ss58: SS58 address of source coldkey
1593
+ hotkey_ss58: SS58 address of destination hotkey
1594
+ block: Block number at which to perform the calculation
1595
+
1596
+ Returns:
1597
+ The calculated stake fee as a Balance object
1598
+ """
1599
+ result = await self .query_runtime_api (
1600
+ runtime_api = "StakeInfoRuntimeApi" ,
1601
+ method = "get_stake_fee" ,
1602
+ params = [
1603
+ None ,
1604
+ coldkey_ss58 ,
1605
+ (hotkey_ss58 , netuid ),
1606
+ coldkey_ss58 ,
1607
+ amount .rao ,
1608
+ ],
1609
+ block = block ,
1610
+ )
1611
+ return Balance .from_rao (result )
1612
+
1613
+ async def get_unstake_fee (
1614
+ self ,
1615
+ amount : Balance ,
1616
+ netuid : int ,
1617
+ coldkey_ss58 : str ,
1618
+ hotkey_ss58 : str ,
1619
+ block : Optional [int ] = None ,
1620
+ ) -> Balance :
1621
+ """
1622
+ Calculates the fee for unstaking from a hotkey.
1623
+
1624
+ Args:
1625
+ amount: Amount of stake to unstake in TAO
1626
+ netuid: Netuid of subnet
1627
+ coldkey_ss58: SS58 address of source coldkey
1628
+ hotkey_ss58: SS58 address of destination hotkey
1629
+ block: Block number at which to perform the calculation
1630
+
1631
+ Returns:
1632
+ The calculated stake fee as a Balance object
1633
+ """
1634
+ result = await self .query_runtime_api (
1635
+ runtime_api = "StakeInfoRuntimeApi" ,
1636
+ method = "get_stake_fee" ,
1637
+ params = [
1638
+ None ,
1639
+ coldkey_ss58 ,
1640
+ (hotkey_ss58 , netuid ),
1641
+ coldkey_ss58 ,
1642
+ amount .rao ,
1643
+ ],
1644
+ block = block ,
1645
+ )
1646
+ return Balance .from_rao (result )
1647
+
1648
+ async def get_stake_movement_fee (
1649
+ self ,
1650
+ amount : Balance ,
1651
+ origin_netuid : int ,
1652
+ origin_hotkey_ss58 : str ,
1653
+ origin_coldkey_ss58 : str ,
1654
+ destination_netuid : int ,
1655
+ destination_hotkey_ss58 : str ,
1656
+ destination_coldkey_ss58 : str ,
1657
+ block : Optional [int ] = None ,
1658
+ ) -> Balance :
1659
+ """
1660
+ Calculates the fee for moving stake between hotkeys/subnets/coldkeys.
1661
+
1662
+ Args:
1663
+ amount: Amount of stake to move in TAO
1664
+ origin_netuid: Netuid of source subnet
1665
+ origin_hotkey_ss58: SS58 address of source hotkey
1666
+ origin_coldkey_ss58: SS58 address of source coldkey
1667
+ destination_netuid: Netuid of destination subnet
1668
+ destination_hotkey_ss58: SS58 address of destination hotkey
1669
+ destination_coldkey_ss58: SS58 address of destination coldkey
1670
+ block: Block number at which to perform the calculation
1671
+
1672
+ Returns:
1673
+ The calculated stake fee as a Balance object
1674
+ """
1675
+ result = await self .query_runtime_api (
1676
+ runtime_api = "StakeInfoRuntimeApi" ,
1677
+ method = "get_stake_fee" ,
1678
+ params = [
1679
+ (origin_hotkey_ss58 , origin_netuid ),
1680
+ origin_coldkey_ss58 ,
1681
+ (destination_hotkey_ss58 , destination_netuid ),
1682
+ destination_coldkey_ss58 ,
1683
+ amount .rao ,
1684
+ ],
1685
+ block = block ,
1686
+ )
1687
+ return Balance .from_rao (result )
1688
+
1578
1689
async def get_stake_for_coldkey_and_hotkey (
1579
1690
self ,
1580
1691
coldkey_ss58 : str ,
0 commit comments