From e470006facbed35cbd45fa25514fbbb683b47188 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 25 May 2023 14:01:43 +0300 Subject: [PATCH] examples: Remove prior light client example Signed-off-by: Alexandru Vasile --- examples/examples/tx_basic_light_client.rs | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 examples/examples/tx_basic_light_client.rs diff --git a/examples/examples/tx_basic_light_client.rs b/examples/examples/tx_basic_light_client.rs deleted file mode 100644 index e89c0da5ce..0000000000 --- a/examples/examples/tx_basic_light_client.rs +++ /dev/null @@ -1,38 +0,0 @@ -use sp_keyring::AccountKeyring; -use subxt::rpc::LightClient; -use subxt::{tx::PairSigner, OnlineClient, PolkadotConfig}; - -use std::sync::Arc; - -// Generate an interface that we can use from the node's metadata. -#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] -pub mod polkadot {} - -#[tokio::main] -async fn main() -> Result<(), Box> { - // Create a light client from the provided chain spec. - let light_client = LightClient::new(include_str!("../../artifacts/dev_spec.json"))?; - let api = OnlineClient::::from_rpc_client(Arc::new(light_client)).await?; - - // Build a balance transfer extrinsic. - let dest = AccountKeyring::Bob.to_account_id().into(); - let balance_transfer_tx = polkadot::tx().balances().transfer(dest, 10_000); - - // Submit the balance transfer extrinsic from Alice, and wait for it to be successful - // and in a finalized block. We get back the extrinsic events if all is well. - let from = PairSigner::new(AccountKeyring::Alice.pair()); - let events = api - .tx() - .sign_and_submit_then_watch_default(&balance_transfer_tx, &from) - .await? - .wait_for_finalized_success() - .await?; - - // Find a Transfer event and print it. - let transfer_event = events.find_first::()?; - if let Some(event) = transfer_event { - println!("Balance transfer success: {event:?}"); - } - - Ok(()) -}