Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions utils/sender/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ use std::{
collections::VecDeque,
error::Error,
sync::atomic::{AtomicU64, Ordering},
time::Instant,
time::Instant, u128,
};
// use subxt::{ext::sp_core::Pair, utils::AccountId32, OnlineClient, PolkadotConfig};

use sp_core::{sr25519::Pair as SrPair, Pair};
use subxt::{
blocks::BlockRef, config::polkadot::PolkadotExtrinsicParamsBuilder as Params, dynamic::Value,
tx::SubmittableTransaction, OnlineClient, PolkadotConfig,
blocks::BlockRef, config::polkadot::PolkadotExtrinsicParamsBuilder as Params, dynamic::Value, ext::scale_value::{Primitive, ValueDef}, tx::SubmittableTransaction, OnlineClient, PolkadotConfig
};
use tokio::sync::RwLock;

Expand All @@ -23,6 +21,14 @@ const SENDER_SEED: &str = "//Sender";
const RECEIVER_SEED: &str = "//Receiver";
const ALICE_SEED: &str = "//Alice";

/// Amount to send in each transaction, small so that we can do many transactions before
/// running out of funds.
const SMALL_TOKEN_AMOUNT: Value = Value { value: ValueDef::Primitive(Primitive::U128(1)), context: () };

/// Amount to seed each sender with, largest possible value so that we do not run out of funds.
const BIG_TOKEN_AMOUNT: Value = Value { value: ValueDef::Primitive(Primitive::U128(u128::MAX)), context: () };


/// Util program to send transactions
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand Down Expand Up @@ -157,7 +163,7 @@ fn main() -> Result<(), Box<dyn Error>> {
"transfer_keep_alive",
vec![
Value::unnamed_variant("Id", [Value::from_bytes(sender.public())]),
Value::u128(100000000000000000000),
BIG_TOKEN_AMOUNT,
],
);

Expand Down Expand Up @@ -270,7 +276,7 @@ fn main() -> Result<(), Box<dyn Error>> {
"transfer_keep_alive",
vec![
Value::unnamed_variant("Id", [Value::from_bytes(receivers[i].public())]),
Value::u128(1000000000000),
SMALL_TOKEN_AMOUNT,
],
).into_value()
).collect::<Vec<_>>();
Expand All @@ -286,7 +292,7 @@ fn main() -> Result<(), Box<dyn Error>> {
"transfer_keep_alive",
vec![
Value::unnamed_variant("Id", [Value::from_bytes(receivers[0].public())]),
Value::u128(1000000000000),
SMALL_TOKEN_AMOUNT,
],
)
};
Expand Down