Select Git revision
-
Jonas SPRENGER authoredJonas SPRENGER authored
commented.rs 990 B
use crate::*;
#[cfg(any(feature = "dev", feature = "gdev"))] // find how to get runtime calls
type Call = runtime::runtime_types::gdev_runtime::RuntimeCall;
type BalancesCall = runtime::runtime_types::pallet_balances::pallet::Call;
type SystemCall = runtime::runtime_types::frame_system::pallet::Call;
/// commented balance transfer
pub async fn transfer(
data: &Data,
amount: u64,
dest: AccountId,
comment: String,
) -> Result<(), subxt::Error> {
// build transfer call
let transfer_call = Call::Balances(BalancesCall::transfer_keep_alive {
dest: dest.into(),
value: amount,
});
// build comment call
let comment_call = Call::System(SystemCall::remark_with_event {
remark: comment.as_bytes().to_vec(),
});
// wrap these calls in a batch call
submit_call_and_look_event::<
runtime::utility::events::BatchCompleted,
Payload<runtime::utility::calls::types::Batch>,
>(
data,
&runtime::tx()
.utility()
.batch(vec![transfer_call, comment_call]),
)
.await
}