Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use new srml_system_rpc crate.
  • Loading branch information
tomusdrw committed Oct 16, 2019
commit 2a2ee402e736540f4e7d6d179e421c683f0d9727
3 changes: 1 addition & 2 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ edition = "2018"
[dependencies]
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
jsonrpc-core = "13.2.0"
node-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
node-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
polkadot-primitives = { path = "../primitives" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
srml-system-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }


10 changes: 5 additions & 5 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

use std::sync::Arc;

use polkadot_primitives::Block;
use node_primitives::AccountNonceApi;
use node_rpc::accounts::{Accounts, AccountsApi};
use polkadot_primitives::{Block, AccountId, Nonce};
use sr_primitives::traits::ProvideRuntimeApi;
use transaction_pool::txpool::{ChainApi, Pool};

Expand All @@ -34,12 +32,14 @@ pub fn create<C, P>(client: Arc<C>, pool: Arc<Pool<P>>) -> RpcExtension where
C: ProvideRuntimeApi,
C: client::blockchain::HeaderBackend<Block>,
C: Send + Sync + 'static,
C::Api: AccountNonceApi<Block>,
C::Api: srml_system_rpc::AccountNonceApi<Block, AccountId, Nonce>,
P: ChainApi + Sync + Send + 'static,
{
use srml_system_rpc::{System, SystemApi};

let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(
AccountsApi::to_delegate(Accounts::new(client.clone(), pool))
SystemApi::to_delegate(System::new(client.clone(), pool))
);
io
}
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ staking = { package = "srml-staking", git = "https://github.com/paritytech/subst
srml-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sudo = { package = "srml-sudo", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
system = { package = "srml-system", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
system_rpc_runtime_api = { package = "srml-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
timestamp = { package = "srml-timestamp", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
treasury = { package = "srml-treasury", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }

Expand Down Expand Up @@ -104,6 +105,7 @@ std = [
"staking/std",
"sudo/std",
"system/std",
"system_rpc_runtime_api/std",
"timestamp/std",
"treasury/std",
"version/std",
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ impl_runtime_apis! {
}
}

impl node_primitives::AccountNonceApi<Block> for Runtime {
impl system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
Expand Down