27 lines
841 B
Rust
Raw Normal View History

2025-07-17 10:10:39 -03:00
use core::account::Account;
2025-07-11 19:21:06 -03:00
2025-07-16 17:33:58 -03:00
use nssa;
2025-07-16 17:25:03 -03:00
2025-07-17 11:07:18 -03:00
use nssa::program::TransferMultipleProgram;
2025-07-16 16:45:07 -03:00
2025-07-18 17:10:33 -03:00
/// A public execution of the TransferMultipleProgram.
2025-07-11 19:44:43 -03:00
/// This would be executed by the runtime after checking that
/// the initiating transaction includes the sender's signature.
2025-07-16 17:25:03 -03:00
pub fn main() {
2025-07-11 19:44:43 -03:00
// Account fetched from the chain state with 150 in its balance.
2025-07-18 15:56:41 -03:00
let sender = Account::new([5; 8], 150);
2025-07-11 19:44:43 -03:00
// Account fetched from the chain state with 900 in its balance.
2025-07-18 15:56:41 -03:00
let receiver_1 = Account::new([6; 8], 900);
// Account fetched from the chain state with 500 in its balance.
let receiver_2 = Account::new([6; 8], 500);
2025-07-17 11:07:18 -03:00
let balance_to_move = vec![10, 20];
2025-07-11 19:21:06 -03:00
2025-07-18 17:10:33 -03:00
let inputs_outputs =
2025-07-18 20:34:07 -03:00
nssa::execute_onchain::<TransferMultipleProgram>(&[sender, receiver_1, receiver_2], balance_to_move).unwrap();
2025-07-18 17:10:33 -03:00
println!("OK!");
2025-07-11 19:21:06 -03:00
}