Skip to content
Snippets Groups Projects
Select Git revision
  • fa9169b98d4e990ce8a18cec8fa48eab5efdbbd8
  • master default protected
  • elois-ci-refactor protected
  • gtest
  • hugo/gtest
  • json-output
  • nostr
  • 48-error-base-58-requirement-is-violated
  • no-rename
  • hugo/tx-comments
  • poka/dev
  • hugo/dev
  • tuxmain/mail
  • test-gtest
  • 0.4.3-gtest-RC1
  • 0.4.3-RC2
  • 0.4.3-RC1
  • 0.4.2
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.17
  • 0.2.16
  • 0.2.15
  • 0.2.14
  • 0.2.13
  • 0.2.12
  • 0.2.10
  • 0.2.9
  • 0.2.8
  • 0.2.7
  • 0.2.6
  • 0.2.5
33 results

commented.rs

Blame
  • 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
    }