Skip to content

Codama not generating PDA helper methods #121

@jim4067

Description

@jim4067

from this SE issue: https://solana.stackexchange.com/questions/22459/how-to-get-codama-with-the-create-solana-program-tool-to-generate-find-pda-funct

When using create-solana-program with an anchor IDL, I do not get the PDA helper function for finding PDAs e.g, a pdas directory isn't created that I can easily use for my PDAs as observed here https://github.com/solana-program/token-2022/tree/main/clients/js/src/generated/pdas

reproducibility

create a new solana project with anchor using the default counter template

pnpm create solana-program

Update the counter to be a PDA instead of an on-curve account in anchor

#[derive(Accounts)]
pub struct Create<'info> {
  #[account(init, payer = payer, seeds = [b"counter"], bump, space = 8 + 40)]
  pub counter: Account<'info, Counter>,
  #[account(mut)]
  pub payer: Signer<'info>,
  pub system_program: Program<'info, System>,
}

Build the program

pnpm programs:build

Generate the clients

pnpm generate

Screenshot below shows the generated folders

Image

env

anchor 0.31.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions