mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Integrate fee RPC (#508)
* Update cargo files * First round of build fixes * update lock file * Fix builds again * Revert cargo file * remove elections genesis * Fix chain spec * Remove imports * Update runtime/src/lib.rs Co-Authored-By: Gavin Wood <gavin@parity.io>
This commit is contained in:
Generated
+346
-311
File diff suppressed because it is too large
Load Diff
@@ -12,4 +12,6 @@ sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "pol
|
||||
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" }
|
||||
srml-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
polkadot-runtime = { path = "../runtime" }
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use polkadot_primitives::{Block, AccountId, Nonce};
|
||||
use polkadot_primitives::{Block, AccountId, Nonce, Balance};
|
||||
use sr_primitives::traits::ProvideRuntimeApi;
|
||||
use transaction_pool::txpool::{ChainApi, Pool};
|
||||
use polkadot_runtime::UncheckedExtrinsic;
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
pub type RpcExtension = jsonrpc_core::IoHandler<substrate_rpc::Metadata>;
|
||||
@@ -33,13 +34,18 @@ pub fn create<C, P>(client: Arc<C>, pool: Arc<Pool<P>>) -> RpcExtension where
|
||||
C: client::blockchain::HeaderBackend<Block>,
|
||||
C: Send + Sync + 'static,
|
||||
C::Api: srml_system_rpc::AccountNonceApi<Block, AccountId, Nonce>,
|
||||
C::Api: srml_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UncheckedExtrinsic>,
|
||||
P: ChainApi + Sync + Send + 'static,
|
||||
{
|
||||
use srml_system_rpc::{System, SystemApi};
|
||||
use srml_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
io.extend_with(
|
||||
SystemApi::to_delegate(System::new(client.clone(), pool))
|
||||
);
|
||||
io.extend_with(
|
||||
TransactionPaymentApi::to_delegate(TransactionPayment::new(client))
|
||||
);
|
||||
io
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ authorship = { package = "srml-authorship", git = "https://github.com/paritytech
|
||||
babe = { package = "srml-babe", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
balances = { package = "srml-balances", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
transaction-payment = { package = "srml-transaction-payment", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
srml-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
collective = { package = "srml-collective", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
democracy = { package = "srml-democracy", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
elections-phragmen = { package = "srml-elections-phragmen", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
|
||||
@@ -92,6 +93,7 @@ std = [
|
||||
"authorship/std",
|
||||
"balances/std",
|
||||
"transaction-payment/std",
|
||||
"srml-transaction-payment-rpc-runtime-api/std",
|
||||
"collective/std",
|
||||
"elections-phragmen/std",
|
||||
"democracy/std",
|
||||
|
||||
@@ -58,6 +58,7 @@ use srml_support::{
|
||||
};
|
||||
use im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
use system::offchain::TransactionSubmitter;
|
||||
use srml_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use staking::StakerStatus;
|
||||
@@ -379,6 +380,9 @@ impl collective::Trait<CouncilCollective> for Runtime {
|
||||
parameter_types! {
|
||||
pub const CandidacyBond: Balance = 100 * DOLLARS;
|
||||
pub const VotingBond: Balance = 5 * DOLLARS;
|
||||
pub const TermDuration: BlockNumber = 10 * MINUTES;
|
||||
pub const DesiredMembers: u32 = 13;
|
||||
pub const DesiredRunnersUp: u32 = 7;
|
||||
}
|
||||
|
||||
impl elections_phragmen::Trait for Runtime {
|
||||
@@ -388,6 +392,9 @@ impl elections_phragmen::Trait for Runtime {
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type CandidacyBond = CandidacyBond;
|
||||
type VotingBond = VotingBond;
|
||||
type TermDuration = TermDuration;
|
||||
type DesiredMembers = DesiredMembers;
|
||||
type DesiredRunnersUp = DesiredRunnersUp;
|
||||
type LoserCandidate = Treasury;
|
||||
type BadReport = Treasury;
|
||||
type KickedMember = Treasury;
|
||||
@@ -576,7 +583,7 @@ construct_runtime!(
|
||||
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
||||
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
TechnicalCommittee: collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
ElectionsPhragmen: elections_phragmen::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
ElectionsPhragmen: elections_phragmen::{Module, Call, Storage, Event<T>},
|
||||
TechnicalMembership: membership::<Instance1>::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
Treasury: treasury::{Module, Call, Storage, Event<T>},
|
||||
|
||||
@@ -742,4 +749,14 @@ impl_runtime_apis! {
|
||||
System::account_nonce(account)
|
||||
}
|
||||
}
|
||||
|
||||
impl srml_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
|
||||
Block,
|
||||
Balance,
|
||||
UncheckedExtrinsic,
|
||||
> for Runtime {
|
||||
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_info(uxt, len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
use primitives::{Pair, Public, crypto::UncheckedInto, sr25519};
|
||||
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId};
|
||||
use polkadot_runtime::{
|
||||
GenesisConfig, CouncilConfig, ElectionsPhragmenConfig, DemocracyConfig, SystemConfig,
|
||||
SessionConfig, StakingConfig, BalancesConfig, SessionKeys, TechnicalCommitteeConfig,
|
||||
SudoConfig, IndicesConfig, StakerStatus, WASM_BINARY,
|
||||
ClaimsConfig, ParachainsConfig, RegistrarConfig
|
||||
GenesisConfig, CouncilConfig, DemocracyConfig, SystemConfig, SessionConfig, StakingConfig,
|
||||
BalancesConfig, SessionKeys, TechnicalCommitteeConfig, SudoConfig, IndicesConfig, StakerStatus,
|
||||
WASM_BINARY, ClaimsConfig, ParachainsConfig, RegistrarConfig
|
||||
};
|
||||
use polkadot_runtime::constants::{currency::DOTS, time::*};
|
||||
use polkadot_runtime::constants::currency::DOTS;
|
||||
use sr_primitives::{traits::IdentifyAccount, Perbill};
|
||||
use telemetry::TelemetryEndpoints;
|
||||
use hex_literal::hex;
|
||||
@@ -138,12 +137,6 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
members: vec![],
|
||||
phantom: Default::default(),
|
||||
}),
|
||||
elections_phragmen: Some(ElectionsPhragmenConfig {
|
||||
members: vec![],
|
||||
term_duration: 49 * DAYS,
|
||||
desired_members: 7,
|
||||
desired_runners_up: 3,
|
||||
}),
|
||||
membership_Instance1: Some(Default::default()),
|
||||
babe: Some(Default::default()),
|
||||
grandpa: Some(Default::default()),
|
||||
@@ -239,8 +232,6 @@ pub fn testnet_genesis(
|
||||
const ENDOWMENT: u128 = 1_000_000 * DOTS;
|
||||
const STASH: u128 = 100 * DOTS;
|
||||
|
||||
let desired_members = (endowed_accounts.len() / 2 - initial_authorities.len()) as u32;
|
||||
|
||||
GenesisConfig {
|
||||
system: Some(SystemConfig {
|
||||
code: WASM_BINARY.to_vec(),
|
||||
@@ -280,17 +271,6 @@ pub fn testnet_genesis(
|
||||
members: vec![],
|
||||
phantom: Default::default(),
|
||||
}),
|
||||
elections_phragmen: Some(ElectionsPhragmenConfig {
|
||||
members: endowed_accounts.iter()
|
||||
.filter(|&endowed| initial_authorities.iter()
|
||||
.find(|&(_, controller, _, _, _, _)| controller == endowed)
|
||||
.is_none()
|
||||
).cloned()
|
||||
.collect(),
|
||||
term_duration: 1 * DAYS,
|
||||
desired_runners_up: desired_members / 2,
|
||||
desired_members,
|
||||
}),
|
||||
membership_Instance1: Some(Default::default()),
|
||||
babe: Some(Default::default()),
|
||||
grandpa: Some(Default::default()),
|
||||
|
||||
Reference in New Issue
Block a user