I have a anchor program locally that runs perfectly with anchor typescript client, but while trying to access with rust's solana_client it throws this error:
AnchorError caused by account: system_program. Error Code: InvalidProgramId. Error Number: 3008. Error Message: Program ID was not as expected.
I have defined the same program id with:
let program_id = Pubkey::from_str("my_program_id").unwrap();
The weirdest part is that it even finds the correct instruction, so I'm completely clueless about this error message.
This is how I'm trying to call the instruction:
let instruction = Instruction::new_with_bytes(
program_id,
_r, // my instruction
vec![
AccountMeta::new(my_account.pubkey(), false),
AccountMeta::new(payer.pubkey(), true),
AccountMeta::new(program_id, false),
],
);