mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 11:41:02 +00:00
Split subxt (#102)
* Proc macro improvements. * Use proc-macros. * Update examples. * Fix build. * Run rustfmt. * Fix total issuance test. * Remove gas limit from put code call. * Handle runtime errors. * Fix tests. * Make test more reliable. * Revert "Handle runtime errors." This reverts commit 26f30a9f4cfcfddfb3e49308cded46cfe6468697. * Use expect instead of unwrap. * Parse marker type. * Fetch doesn't fail.
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
|
||||
use sp_keyring::AccountKeyring;
|
||||
use substrate_subxt::{
|
||||
balances,
|
||||
DefaultNodeRuntime as Runtime,
|
||||
balances::*,
|
||||
ClientBuilder,
|
||||
DefaultNodeRuntime,
|
||||
};
|
||||
|
||||
#[async_std::main]
|
||||
@@ -27,18 +28,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let signer = AccountKeyring::Alice.pair();
|
||||
let dest = AccountKeyring::Bob.to_account_id().into();
|
||||
|
||||
let cli = substrate_subxt::ClientBuilder::<Runtime>::new()
|
||||
.build()
|
||||
.await?;
|
||||
let xt = cli.xt(signer, None).await?;
|
||||
let xt_result = xt
|
||||
let client = ClientBuilder::<DefaultNodeRuntime>::new().build().await?;
|
||||
let result = client
|
||||
.xt(signer, None)
|
||||
.await?
|
||||
.watch()
|
||||
.submit(balances::TransferCall {
|
||||
to: &dest,
|
||||
amount: 10_000,
|
||||
})
|
||||
.transfer(&dest, 10_000)
|
||||
.await?;
|
||||
if let Some(event) = xt_result.find_event::<balances::TransferEvent<_>>()? {
|
||||
|
||||
if let Some(event) = result.transfer()? {
|
||||
println!("Balance transfer success: value: {:?}", event.amount);
|
||||
} else {
|
||||
println!("Failed to find Balances::Transfer Event");
|
||||
|
||||
Reference in New Issue
Block a user