Codama is a Solana framework designed to facilitate the building of standardized programs through specifications and code generation. It aims to streamline the development of on-chain programs by providing a structured approach to defining program interfaces and interactions. The package `codama` (currently at version 1.6.0) serves as the main entry point, re-exporting core modules like `@codama/errors`, `@codama/nodes`, `@codama/validators`, and `@codama/visitors`, bundling them into a cohesive API. It offers utilities for managing Solana IDLs, allowing developers to create, manipulate, and validate program definitions from a `RootNode` or JSON representation. The project appears to have an active release cadence, with recent minor updates introducing new node types (e.g., `EventNode`) and functionality like a dynamic client for instruction building, indicating ongoing development and feature expansion within the Solana ecosystem.
npm install codamaVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Codama IDL instance from both JSON and a programmatic `RootNode`, then displaying and cloning it.
Ensure any custom IDL parsers or code generators are updated to optionally handle the presence of `EventNode` within `ProgramNode` structures. Refer to the `@codama/nodes` and `@codama/node-types` changelogs for full details.
Review the `@codama/errors` documentation and examples if you plan to utilize or are affected by the new 'dynamic-client' for runtime instruction construction.
If a symbol is not found when importing directly from `codama`, try importing it from the specific sub-package it belongs to (e.g., `import { getDebugStringVisitor } from '@codama/visitors';`).Run `npm install codama` or `pnpm install codama` to add the package to your project's dependencies. Ensure your `tsconfig.json` includes `node_modules/@types` if using TypeScript.
Ensure you are using ESM `import { createFromJson } from 'codama'` for TypeScript/modern JavaScript projects. If forced to use CommonJS, consider transpiling your code or using dynamic `import()`.Ensure the object passed to `programNode` or `createFromRoot` strictly adheres to the `ProgramNode` definition from `@codama/nodes` (or re-exported by `codama`), including all required fields and types. Check the latest `@codama/node-types` for schema updates, especially after major/minor version bumps.