Skip to content

Commit

Permalink
revert example changes
Browse files Browse the repository at this point in the history
  • Loading branch information
haerdib committed Dec 8, 2023
1 parent ccbabcb commit 7c693da
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions examples/examples/benchmark_bulk_xt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 7c693da

Please sign in to comment.