add chained_call field to program output

This commit is contained in:
Sergio Chouhy 2025-10-29 00:40:56 -03:00
parent 97eb110f0e
commit 6d9d6b3d28
2 changed files with 11 additions and 0 deletions

View File

@ -12,11 +12,20 @@ pub struct ProgramInput<T> {
pub instruction: T,
}
#[derive(Serialize, Deserialize, Clone)]
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
pub struct ChainedCall {
pub program_id: ProgramId,
pub instruction_data: InstructionData,
pub account_indices: Vec<usize>,
}
#[derive(Serialize, Deserialize, Clone)]
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
pub struct ProgramOutput {
pub pre_states: Vec<AccountWithMetadata>,
pub post_states: Vec<Account>,
pub chained_call: Option<ChainedCall>
}
pub fn read_nssa_inputs<T: DeserializeOwned>() -> ProgramInput<T> {
@ -33,6 +42,7 @@ pub fn write_nssa_outputs(pre_states: Vec<AccountWithMetadata>, post_states: Vec
let output = ProgramOutput {
pre_states,
post_states,
chained_call: None
};
env::commit(&output);
}

View File

@ -27,6 +27,7 @@ fn main() {
let ProgramOutput {
pre_states,
post_states,
chained_call: _,
} = program_output;
// Check that there are no repeated account ids