From c2df8308d796082bc06ffb954ef22958111826b8 Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:32:31 +0200 Subject: [PATCH] Companion for #11831 (#5784) * Companion for #11831 * commti * fix * fix * commit * fix? * added rpc extension * fmt * add dependency * added NominationPools to runtimes * implement np * implement for kusama & westend * remove np-rpc from rococco * fmt * add np-rpc to the client * fix wrong dependency in client * remove from client * remove from rpc * fix? * switch back * fix? * . * add rpc extension * fmt * fix dependency * commit * only implement the api in the runtimes * update * update runtimes * update sp-io * update * Update Cargo.toml * Update Cargo.toml * Update Cargo.toml * commit * Revert "Merge branch 'rpc-pending-rewards' of github.com:Szegoo/polkadot into rpc-pending-rewards" This reverts commit dd260820641060b6106b238081d674e902267f24, reversing changes made to 8f3b58dbe28132a95c4d595700214f886da22e5e. Co-authored-by: kianenigma --- polkadot/Cargo.lock | 12 ++++++++++++ polkadot/runtime/kusama/Cargo.toml | 2 ++ polkadot/runtime/kusama/src/lib.rs | 10 ++++++++++ polkadot/runtime/westend/Cargo.toml | 2 ++ polkadot/runtime/westend/src/lib.rs | 10 ++++++++++ 5 files changed, 36 insertions(+) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index 9776acc1e0..d7d1baa273 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -3198,6 +3198,7 @@ dependencies = [ "pallet-multisig", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-preimage", @@ -5263,6 +5264,16 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#531d7c3a5b26f5849aa6e23518c45a56d67faccb" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-std", +] + [[package]] name = "pallet-offences" version = "4.0.0-dev" @@ -12204,6 +12215,7 @@ dependencies = [ "pallet-multisig", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-preimage", diff --git a/polkadot/runtime/kusama/Cargo.toml b/polkadot/runtime/kusama/Cargo.toml index 8f417a9a4f..ddd7f0bb9b 100644 --- a/polkadot/runtime/kusama/Cargo.toml +++ b/polkadot/runtime/kusama/Cargo.toml @@ -45,6 +45,7 @@ pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "m pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -148,6 +149,7 @@ std = [ "pallet-membership/std", "pallet-multisig/std", "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index da1a7c8896..72c10da9b9 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -2010,6 +2010,16 @@ sp_api::impl_runtime_apis! { } } + impl pallet_nomination_pools_runtime_api::NominationPoolsApi< + Block, + AccountId, + Balance, + > for Runtime { + fn pending_rewards(member: AccountId) -> Balance { + NominationPools::pending_rewards(member) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade() -> (Weight, Weight) { diff --git a/polkadot/runtime/westend/Cargo.toml b/polkadot/runtime/westend/Cargo.toml index bf1e976361..747bd331de 100644 --- a/polkadot/runtime/westend/Cargo.toml +++ b/polkadot/runtime/westend/Cargo.toml @@ -68,6 +68,7 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "maste pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -140,6 +141,7 @@ std = [ "beefy-primitives/std", "pallet-multisig/std", "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index e3493c347f..18a8a809c3 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -1578,6 +1578,16 @@ sp_api::impl_runtime_apis! { } } + impl pallet_nomination_pools_runtime_api::NominationPoolsApi< + Block, + AccountId, + Balance, + > for Runtime { + fn pending_rewards(member: AccountId) -> Balance { + NominationPools::pending_rewards(member) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade() -> (frame_support::weights::Weight, frame_support::weights::Weight) {