feat: add NominationPoolsApi and StakingApi to Asset Hub runtime
- Implement NominationPoolsApi (pending_rewards, points_to_balance, etc.) - Implement StakingApi (nominations_quota, eras_stakers_page_count, pending_rewards) - Fix ss58-registry doc-test crate name (pezkuwi → pezsp) - Update CRITICAL_STATE.md with current network status and pending tasks
This commit is contained in:
@@ -1898,6 +1898,66 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl pezpallet_nomination_pools_runtime_api::NominationPoolsApi<
|
||||
Block,
|
||||
AccountId,
|
||||
Balance,
|
||||
> for Runtime {
|
||||
fn pending_rewards(member: AccountId) -> Balance {
|
||||
NominationPools::api_pending_rewards(member).unwrap_or_default()
|
||||
}
|
||||
|
||||
fn points_to_balance(pool_id: pezpallet_nomination_pools::PoolId, points: Balance) -> Balance {
|
||||
NominationPools::api_points_to_balance(pool_id, points)
|
||||
}
|
||||
|
||||
fn balance_to_points(pool_id: pezpallet_nomination_pools::PoolId, new_funds: Balance) -> Balance {
|
||||
NominationPools::api_balance_to_points(pool_id, new_funds)
|
||||
}
|
||||
|
||||
fn pool_pending_slash(pool_id: pezpallet_nomination_pools::PoolId) -> Balance {
|
||||
NominationPools::api_pool_pending_slash(pool_id)
|
||||
}
|
||||
|
||||
fn member_pending_slash(member: AccountId) -> Balance {
|
||||
NominationPools::api_member_pending_slash(member)
|
||||
}
|
||||
|
||||
fn pool_needs_delegate_migration(pool_id: pezpallet_nomination_pools::PoolId) -> bool {
|
||||
NominationPools::api_pool_needs_delegate_migration(pool_id)
|
||||
}
|
||||
|
||||
fn member_needs_delegate_migration(member: AccountId) -> bool {
|
||||
NominationPools::api_member_needs_delegate_migration(member)
|
||||
}
|
||||
|
||||
fn member_total_balance(member: AccountId) -> Balance {
|
||||
NominationPools::api_member_total_balance(member)
|
||||
}
|
||||
|
||||
fn pool_balance(pool_id: pezpallet_nomination_pools::PoolId) -> Balance {
|
||||
NominationPools::api_pool_balance(pool_id)
|
||||
}
|
||||
|
||||
fn pool_accounts(pool_id: pezpallet_nomination_pools::PoolId) -> (AccountId, AccountId) {
|
||||
NominationPools::api_pool_accounts(pool_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl pezpallet_staking_runtime_api::StakingApi<Block, Balance, AccountId> for Runtime {
|
||||
fn nominations_quota(balance: Balance) -> u32 {
|
||||
Staking::api_nominations_quota(balance)
|
||||
}
|
||||
|
||||
fn eras_stakers_page_count(era: pezsp_staking::EraIndex, account: AccountId) -> pezsp_staking::Page {
|
||||
Staking::api_eras_stakers_page_count(era, account)
|
||||
}
|
||||
|
||||
fn pending_rewards(era: pezsp_staking::EraIndex, account: AccountId) -> bool {
|
||||
Staking::api_pending_rewards(era, account)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl pezframe_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade(checks: pezframe_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
|
||||
|
||||
Vendored
+2
-2
@@ -39,7 +39,7 @@ impl Token {
|
||||
/// `TokenRegistry` variant.
|
||||
///
|
||||
/// ```
|
||||
/// # use pezkuwi_ss58_registry::{Token, TokenRegistry};
|
||||
/// # use pezsp_ss58_registry::{Token, TokenRegistry};
|
||||
/// # #[cfg(feature = "std")]
|
||||
/// # fn x() {
|
||||
/// let token: Token = TokenRegistry::Hez.into();
|
||||
@@ -60,7 +60,7 @@ impl Token {
|
||||
/// different amounts.
|
||||
///
|
||||
/// ```
|
||||
/// # use pezkuwi_ss58_registry::{Token, TokenAmount};
|
||||
/// # use pezsp_ss58_registry::{Token, TokenAmount};
|
||||
/// # #[cfg(feature = "std")]
|
||||
/// # fn x() {
|
||||
/// let token = Token { name: "I❤U", decimals: 8 };
|
||||
|
||||
Reference in New Issue
Block a user