mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
WIP
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
NODE_TEMPLATE=../target/release/test-node
|
NODE_TEMPLATE=../target/release/test-node
|
||||||
$NODE_TEMPLATE --chain=dev-chain.json --alice
|
$NODE_TEMPLATE --chain=dev-chain.json --alice -lrpc=debug
|
||||||
|
|||||||
@@ -195,3 +195,65 @@ pub struct NominateCall<T: Staking> {
|
|||||||
/// The targets that are being nominated
|
/// The targets that are being nominated
|
||||||
pub targets: Vec<T::Address>,
|
pub targets: Vec<T::Address>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use crate::{
|
||||||
|
// events::EventsDecoder,
|
||||||
|
extrinsic::PairSigner,
|
||||||
|
// subscription::EventSubscription,
|
||||||
|
// system::AccountStoreExt,
|
||||||
|
// tests::{test_client, TestRuntime},
|
||||||
|
runtimes::KusamaRuntime as RT,
|
||||||
|
ClientBuilder,
|
||||||
|
// frame::staking::NominateCallExt,
|
||||||
|
// frame::staking::CurrentEraStoreExt,
|
||||||
|
// frame::staking::CurrentEraStore,
|
||||||
|
// frame::staking::HistoryDepthStore,
|
||||||
|
// runtimes::StakingRuntime as RT,
|
||||||
|
};
|
||||||
|
// use sp_core::{sr25519::Pair, Pair as _};
|
||||||
|
use sp_keyring::AccountKeyring;
|
||||||
|
use core::marker::PhantomData;
|
||||||
|
use crate::frame::balances::*;
|
||||||
|
use crate::frame::system::*;
|
||||||
|
use crate::extrinsic::Signer;
|
||||||
|
|
||||||
|
#[async_std::test]
|
||||||
|
async fn test_nominate() {
|
||||||
|
env_logger::try_init().ok();
|
||||||
|
let alice = PairSigner::<RT, _>::new(AccountKeyring::Alice.pair());
|
||||||
|
let bob = PairSigner::<RT, _>::new(AccountKeyring::Bob.pair());
|
||||||
|
|
||||||
|
let client = ClientBuilder::<RT>::new()
|
||||||
|
.build()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
println!("HAVE CLIENT");
|
||||||
|
|
||||||
|
let current_era = client.current_era(None).await;
|
||||||
|
println!("Current era: {:?}", current_era);
|
||||||
|
let hd = client.history_depth(None).await;
|
||||||
|
println!("History depth: {:?}", hd);
|
||||||
|
let total_issuance = client.total_issuance(None).await;
|
||||||
|
println!("total issuance: {:?}", total_issuance);
|
||||||
|
let alice_account = client.account(&alice.account_id(), None).await;
|
||||||
|
println!("Alice's account info: {:?}", alice_account);
|
||||||
|
let o = client.nominate(&alice, vec![bob.account_id().clone()]).await;
|
||||||
|
println!("Nom nom: {:?}", o);
|
||||||
|
// let event = client.
|
||||||
|
// current_era()
|
||||||
|
// .await;
|
||||||
|
// println!("Current era: {:?}", event);
|
||||||
|
// let (client, _) = test_client().await;
|
||||||
|
// let event = client.
|
||||||
|
// nominate_and_watch(&alice, vec![AccountKeyring::Bob.to_account_id()])
|
||||||
|
// .await
|
||||||
|
// .unwrap();
|
||||||
|
// // .nominate()
|
||||||
|
// // .unwrap()
|
||||||
|
// // .unwrap();
|
||||||
|
// dbg!(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ pallet-aura = { version = "2.0.0-rc6", default-features = false }
|
|||||||
pallet-balances = { version = "2.0.0-rc6", default-features = false }
|
pallet-balances = { version = "2.0.0-rc6", default-features = false }
|
||||||
pallet-grandpa = { version = "2.0.0-rc6", default-features = false }
|
pallet-grandpa = { version = "2.0.0-rc6", default-features = false }
|
||||||
pallet-randomness-collective-flip = { version = "2.0.0-rc6", default-features = false }
|
pallet-randomness-collective-flip = { version = "2.0.0-rc6", default-features = false }
|
||||||
|
pallet-staking = { version = "2.0.0-rc6", default-features = false }
|
||||||
pallet-sudo = { version = "2.0.0-rc6", default-features = false }
|
pallet-sudo = { version = "2.0.0-rc6", default-features = false }
|
||||||
pallet-timestamp = { version = "2.0.0-rc6", default-features = false }
|
pallet-timestamp = { version = "2.0.0-rc6", default-features = false }
|
||||||
pallet-transaction-payment = { version = "2.0.0-rc6", default-features = false }
|
pallet-transaction-payment = { version = "2.0.0-rc6", default-features = false }
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ pub use frame_support::{
|
|||||||
StorageValue,
|
StorageValue,
|
||||||
};
|
};
|
||||||
pub use pallet_balances::Call as BalancesCall;
|
pub use pallet_balances::Call as BalancesCall;
|
||||||
|
pub use pallet_staking::Call as StakingCall;
|
||||||
pub use pallet_timestamp::Call as TimestampCall;
|
pub use pallet_timestamp::Call as TimestampCall;
|
||||||
#[cfg(any(feature = "std", test))]
|
#[cfg(any(feature = "std", test))]
|
||||||
pub use sp_runtime::BuildStorage;
|
pub use sp_runtime::BuildStorage;
|
||||||
@@ -305,6 +306,31 @@ impl pallet_sudo::Trait for Runtime {
|
|||||||
type Call = Call;
|
type Call = Call;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// impl pallet_staking::Trait for Runtime {
|
||||||
|
// type Currency = Balances;
|
||||||
|
// type UnixTime = pallet_timestamp::Module<Self>;
|
||||||
|
// type CurrencyToVote = CurrencyToVoteHandler;
|
||||||
|
// type RewardRemainder = ();
|
||||||
|
// type Event = ();
|
||||||
|
// type Slash = ();
|
||||||
|
// type Reward = ();
|
||||||
|
// type SessionsPerEra = ();
|
||||||
|
// type SlashDeferDuration = ();
|
||||||
|
// type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
|
||||||
|
// type BondingDuration = ();
|
||||||
|
// type SessionInterface = Self;
|
||||||
|
// type RewardCurve = RewardCurve;
|
||||||
|
// type NextNewSession = Session;
|
||||||
|
// type ElectionLookahead = ();
|
||||||
|
// type Call = Call;
|
||||||
|
// type MaxIterations = MaxIterations;
|
||||||
|
// type MinSolutionScoreBump = ();
|
||||||
|
// type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
||||||
|
// type UnsignedPriority = ();
|
||||||
|
// type WeightInfo = ();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime where
|
||||||
Block = Block,
|
Block = Block,
|
||||||
|
|||||||
Reference in New Issue
Block a user