From 7c693da3e17834fb7d6fdafd22e81428beede585 Mon Sep 17 00:00:00 2001 From: haerdib Date: Fri, 8 Dec 2023 17:31:01 +0100 Subject: [PATCH] revert example changes --- examples/examples/benchmark_bulk_xt.rs | 30 +++++++++----------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/examples/examples/benchmark_bulk_xt.rs b/examples/examples/benchmark_bulk_xt.rs index b139e70c7..b42156566 100644 --- a/examples/examples/benchmark_bulk_xt.rs +++ b/examples/examples/benchmark_bulk_xt.rs @@ -15,15 +15,12 @@ //! This example floods the node with a series of transactions. -use codec::Encode; use kitchensink_runtime::{AccountId, BalancesCall, RuntimeCall}; -use sp_core::{Bytes, H256}; use sp_keyring::AccountKeyring; use substrate_api_client::{ - ac_compose_macros::rpc_params, ac_primitives::{AssetRuntimeConfig, ExtrinsicSigner as GenericExtrinsicSigner, SignExtrinsic}, - rpc::{JsonrpseeClient, Request}, - Api, + rpc::JsonrpseeClient, + Api, SubmitExtrinsic, }; // To test this example with CI we run it against the Substrate kitchensink node, which uses the asset pallet. @@ -58,23 +55,16 @@ async fn main() { // waiting for the response of the node. let mut nonce = api.get_nonce().unwrap(); let first_nonce = nonce; + while nonce < first_nonce + 500 { + // Compose a balance extrinsic. + let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { + dest: recipient.clone(), + value: 1_000_000, + }); + let xt = api.compose_extrinsic_offline(call, nonce); - // Compose a balance extrinsic. - let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: recipient.clone(), - value: 1_000_000, - }); - - while nonce < first_nonce + 60 { - // Create the extrinsic. - let xt = api.compose_extrinsic_offline(call.clone(), nonce); - let xt_bytes: Bytes = xt.encode().into(); - let hex_encoded_xt = rpc_params![xt_bytes]; println!("Sending extrinsic with nonce {}", nonce); - - // Send the extrinsic with jsonrpsee - let _xt_hash: H256 = - api.client().request("author_submitExtrinsic", hex_encoded_xt).unwrap(); + let _tx_hash = api.submit_extrinsic(xt).unwrap(); nonce += 1; }