lssa/test_program_methods/guest/src/bin/validity_window.rs

32 lines
817 B
Rust
Raw Normal View History

use nssa_core::program::{
2026-03-28 03:13:46 -03:00
AccountPostState, BlockValidityWindow, ProgramInput, ProgramOutput, TimestampValidityWindow,
read_nssa_inputs,
};
2026-03-28 03:13:46 -03:00
type Instruction = (BlockValidityWindow, TimestampValidityWindow);
fn main() {
let (
ProgramInput {
pre_states,
instruction: (block_validity_window, timestamp_validity_window),
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
return;
};
let post = pre.account.clone();
2026-03-25 17:42:17 -03:00
ProgramOutput::new(
instruction_words,
vec![pre],
vec![AccountPostState::new(post)],
2026-03-20 13:16:52 -03:00
)
2026-03-28 01:13:48 -03:00
.with_block_validity_window(block_validity_window)
.with_timestamp_validity_window(timestamp_validity_window)
2026-03-25 17:42:17 -03:00
.write();
}