Turbin3 / poseidon

A Transpiler to convert your Solana programs from Typescript to Anchor
https://turbin3.github.io/poseidon/
49 stars 19 forks source link

issue transpiling `SystemAccount` #6

Closed Mahhheshh closed 1 month ago

Mahhheshh commented 1 month ago

example:

export default class Example {
  static PROGRAM_ID = new Pubkey("1111111111111111111111111111");

  example_instruction(
    system_program: SystemAccount
  ): Result {

  }
}
use anchor_lang::prelude::*;
declare_id!("1111111111111111111111111111");
#[program]
pub mod example {
    use super::*;
    pub fn example_instruction(ctx: Context<ExampleInstructionContext>) -> Result<()> {
        Ok(())
    }
}
#[derive(Accounts)]
pub struct ExampleInstructionContext<'info> {
    #[account(mut)]
    pub system_program: SystemAccount<'info>,
    pub system_program: Program<'info, System>,
}

either need to mention this in docs this behaviour, either introduce reserved keywords or handle the overlap between variables

ShrinathNR commented 1 month ago

Thanks, Updated the docs briefly mentioning that program accounts get added automatically according to Poseidon program.