mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 23:11:08 +00:00
examples: Use subscription ID
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -10,9 +10,7 @@
|
|||||||
//! polkadot --dev --tmp
|
//! polkadot --dev --tmp
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use sp_keyring::AccountKeyring;
|
|
||||||
use subxt::{
|
use subxt::{
|
||||||
tx::PairSigner,
|
|
||||||
OnlineClient,
|
OnlineClient,
|
||||||
PolkadotConfig,
|
PolkadotConfig,
|
||||||
};
|
};
|
||||||
@@ -24,9 +22,6 @@ pub mod polkadot {}
|
|||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let signer = PairSigner::new(AccountKeyring::Alice.pair());
|
|
||||||
let dest = AccountKeyring::Bob.to_account_id().into();
|
|
||||||
|
|
||||||
// Create a client to use:
|
// Create a client to use:
|
||||||
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
let api = OnlineClient::<PolkadotConfig>::new().await?;
|
||||||
|
|
||||||
@@ -37,7 +32,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
while let Some(event) = follow_sub.next().await {
|
while let Some(event) = follow_sub.next().await {
|
||||||
let event = event?;
|
let event = event?;
|
||||||
|
|
||||||
println!("event: {:?}", event);
|
println!(
|
||||||
|
"sub_id: {:?} event: {:?}",
|
||||||
|
follow_sub.subscription_id(),
|
||||||
|
event
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user