refactor: pass self_program_id to ProgramOutput in production guest programs

This commit is contained in:
moudyellaz 2026-04-02 00:40:23 +02:00 committed by Moudy
parent 85cc323649
commit 58b72dd77c
6 changed files with 12 additions and 16 deletions

View File

@ -13,8 +13,7 @@ use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs};
fn main() {
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction,
},
@ -153,7 +152,7 @@ fn main() {
}
};
ProgramOutput::new(instruction_words, pre_states_clone, post_states)
ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states)
.with_chained_calls(chained_calls)
.write();
}

View File

@ -3,8 +3,7 @@ use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs};
fn main() {
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction,
},
@ -57,7 +56,7 @@ fn main() {
}
};
ProgramOutput::new(instruction_words, pre_states_clone, post_states)
ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states)
.with_chained_calls(chained_calls)
.write();
}

View File

@ -66,8 +66,7 @@ fn transfer(
fn main() {
// Read input accounts.
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction: balance_to_move,
},
@ -85,5 +84,5 @@ fn main() {
_ => panic!("invalid params"),
};
ProgramOutput::new(instruction_words, pre_states, post_states).write();
ProgramOutput::new(self_program_id, instruction_words, pre_states, post_states).write();
}

View File

@ -45,8 +45,7 @@ fn main() {
// Read input accounts.
// It is expected to receive only two accounts: [pinata_account, winner_account]
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction: solution,
},
@ -80,6 +79,7 @@ fn main() {
.expect("Overflow when adding prize to winner");
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pinata, winner],
vec![

View File

@ -51,8 +51,7 @@ fn main() {
// It is expected to receive three accounts: [pinata_definition, pinata_token_holding,
// winner_token_holding]
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction: solution,
},
@ -98,6 +97,7 @@ fn main() {
.with_pda_seeds(vec![PdaSeed::new([0; 32])]);
ProgramOutput::new(
self_program_id,
instruction_words,
vec![
pinata_definition,

View File

@ -11,8 +11,7 @@ use token_program::core::Instruction;
fn main() {
let (
ProgramInput {
self_program_id: _,
ProgramInput { self_program_id,
pre_states,
instruction,
},
@ -82,5 +81,5 @@ fn main() {
}
};
ProgramOutput::new(instruction_words, pre_states_clone, post_states).write();
ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states).write();
}