Skip to main content

generate

Function generate 

Source
pub fn generate(
    idl_path: String,
    base_path: String,
    languages: Vec<Language>,
) -> Result<()>
Expand description

Convert the Anchor IDL at idl_path to a Codama IDL, then drive the Codama CLI to render clients for each requested language under <base_path>/<language>.

Implementation notes:

  • Conversion happens in-process via [root_node_from_anchor]. The converted Codama IDL is staged under <base_path>/.codama/idl.json alongside a generated codama.json config so the user can inspect or re-run the rendering manually with codama run --all.
  • The Codama CLI is invoked as npx --yes codama run --config <cfg> --all by default. Set ANCHOR_CODAMA_CMD to override the binary (e.g. when codama is already on PATH); arguments are appended as given. Codama itself installs missing renderer packages on demand.