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:
David Craven
2020-05-12 13:25:22 +02:00
committed by GitHub
parent 825f3ab64c
commit f861f3fac4
21 changed files with 697 additions and 564 deletions
+10 -12
View File
@@ -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");