Creates a Codama root node from a single Anchor IDL.
This function takes an Anchor IDL object and converts it into a Codama root node that can be used with Codama visitors for code generation and AST transformation.
An Anchor IDL object to convert
A Codama root node containing the program from the IDL
import { rootNodeFromAnchor } from "@macalinao/codama-nodes-from-anchor-x";import { visit } from "codama";const idl = JSON.parse(fs.readFileSync("./idl.json", "utf-8"));const root = rootNodeFromAnchor(idl);// Use with Codama visitorsvisit(root, myVisitor); Copy
import { rootNodeFromAnchor } from "@macalinao/codama-nodes-from-anchor-x";import { visit } from "codama";const idl = JSON.parse(fs.readFileSync("./idl.json", "utf-8"));const root = rootNodeFromAnchor(idl);// Use with Codama visitorsvisit(root, myVisitor);
rootNodeFromAnchorIdls
Creates a Codama root node from a single Anchor IDL.
This function takes an Anchor IDL object and converts it into a Codama root node that can be used with Codama visitors for code generation and AST transformation.