remove old program output constructors

This commit is contained in:
Sergio Chouhy
2026-03-25 16:56:04 -03:00
parent 3356aef291
commit abc30c0ce0
25 changed files with 91 additions and 116 deletions
+4 -7
View File
@@ -9,7 +9,7 @@
use std::num::NonZero;
use amm_core::Instruction;
use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs_with_chained_call};
use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs};
fn main() {
let (
@@ -133,10 +133,7 @@ fn main() {
}
};
write_nssa_outputs_with_chained_call(
instruction_words,
pre_states_clone,
post_states,
chained_calls,
);
ProgramOutput::new(instruction_words, pre_states_clone, post_states)
.with_chained_calls(chained_calls)
.write();
}
@@ -1,7 +1,7 @@
use nssa_core::{
account::{Account, AccountWithMetadata},
program::{
AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, read_nssa_inputs, write_nssa_outputs,
AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, ProgramOutput, read_nssa_inputs,
},
};
@@ -84,5 +84,5 @@ fn main() {
_ => panic!("invalid params"),
};
write_nssa_outputs(instruction_words, pre_states, post_states);
ProgramOutput::new(instruction_words, pre_states, post_states).write();
}
+4 -3
View File
@@ -1,4 +1,4 @@
use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs};
use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs};
use risc0_zkvm::sha::{Impl, Sha256 as _};
const PRIZE: u128 = 150;
@@ -78,12 +78,13 @@ fn main() {
.checked_add(PRIZE)
.expect("Overflow when adding prize to winner");
write_nssa_outputs(
ProgramOutput::new(
instruction_words,
vec![pinata, winner],
vec![
AccountPostState::new_claimed_if_default(pinata_post),
AccountPostState::new(winner_post),
],
);
)
.write();
}
@@ -1,8 +1,7 @@
use nssa_core::{
account::Data,
program::{
AccountPostState, ChainedCall, PdaSeed, ProgramInput, read_nssa_inputs,
write_nssa_outputs_with_chained_call,
AccountPostState, ChainedCall, PdaSeed, ProgramInput, ProgramOutput, read_nssa_inputs,
},
};
use risc0_zkvm::sha::{Impl, Sha256 as _};
@@ -97,7 +96,7 @@ fn main() {
)
.with_pda_seeds(vec![PdaSeed::new([0; 32])]);
write_nssa_outputs_with_chained_call(
ProgramOutput::new(
instruction_words,
vec![
pinata_definition,
@@ -109,6 +108,7 @@ fn main() {
AccountPostState::new(pinata_token_holding_post),
AccountPostState::new(winner_token_holding_post),
],
vec![chained_call],
);
)
.with_chained_calls(vec![chained_call])
.write();
}
+2 -2
View File
@@ -6,7 +6,7 @@
//! Token program accepts [`Instruction`] as input, refer to the corresponding documentation
//! for more details.
use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs};
use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs};
use token_program::core::Instruction;
fn main() {
@@ -81,5 +81,5 @@ fn main() {
}
};
write_nssa_outputs(instruction_words, pre_states_clone, post_states);
ProgramOutput::new(instruction_words, pre_states_clone, post_states).write();
}