Skip to content

Commit

Permalink
chore: formating from nano
Browse files Browse the repository at this point in the history
  • Loading branch information
supreme committed Aug 15, 2024
1 parent 6bca250 commit 1c2ba72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/communex/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def format_balance(balance: int, unit: BalanceUnit = BalanceUnit.nano) -> str:
case BalanceUnit.joule | BalanceUnit.j:
in_joules = from_nano(balance)
round_joules = round(in_joules, 4)
return f"{round_joules:,} J"
return f"{round_joules:,} COMAI"


K = TypeVar("K")
Expand Down
16 changes: 12 additions & 4 deletions src/communex/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, TypeVar, cast

from communex._common import transform_stake_dmap
from communex.balance import to_nano
from communex.balance import (to_nano, from_nano)
from communex.client import CommuneClient
from communex.key import check_ss58_address
from communex.types import (BurnConfiguration, ModuleInfoWithOptionalBalance,
Expand Down Expand Up @@ -244,22 +244,30 @@ def get_global_params(c_client: CommuneClient) -> NetworkParams:
]
}
)

global_params: NetworkParams = {
"max_allowed_subnets": int(query_all["MaxAllowedSubnets"]),
"max_allowed_modules": int(query_all["MaxAllowedModules"]),
"max_registrations_per_block": int(query_all["MaxRegistrationsPerBlock"]),
"max_name_length": int(query_all["MaxNameLength"]),
"min_weight_stake": int(query_all["MinWeightStake"]),
"min_weight_stake": from_nano(int(query_all["MinWeightStake"])),
"floor_delegation_fee": int(query_all["FloorDelegationFee"]),
"max_allowed_weights": int(query_all["MaxAllowedWeightsGlobal"]),
"curator": Ss58Address(query_all["Curator"]),
"min_name_length": int(query_all["MinNameLength"]),
"floor_founder_share": int(query_all["FloorFounderShare"]),
"general_subnet_application_cost": int(query_all["GeneralSubnetApplicationCost"]),
"general_subnet_application_cost": from_nano(int(query_all["GeneralSubnetApplicationCost"])),
"kappa": int(query_all["Kappa"]),
"rho": int(query_all["Rho"]),
"subnet_immunity_period": int(query_all["SubnetImmunityPeriod"]),
"governance_config": query_all["GlobalGovernanceConfig"] # type: ignore
"governance_config": {
"proposal_cost": from_nano(int(query_all["GlobalGovernanceConfig"]["proposal_cost"])),
"proposal_expiration": int(query_all["GlobalGovernanceConfig"]["proposal_expiration"]),
"vote_mode": query_all["GlobalGovernanceConfig"]["vote_mode"],
"proposal_reward_treasury_allocation": int(query_all["GlobalGovernanceConfig"]["proposal_reward_treasury_allocation"]),
"max_proposal_reward_treasury_allocation": from_nano(int(query_all["GlobalGovernanceConfig"]["max_proposal_reward_treasury_allocation"])),
"proposal_reward_interval": int(query_all["GlobalGovernanceConfig"]["proposal_reward_interval"])
}
}
return global_params

Expand Down

0 comments on commit 1c2ba72

Please sign in to comment.