Generate Parsers with Codama
How-to generate Vixen parser with Codama
This guide walks you through generating a Vixen Parser using Codama, a tool for rendering Rust SDKs and parser implementations from IDLs.
Vixen is a framework for building real-time program data pipelines in Rust. This guide helps you scaffold a parser that can be used in the Vixen runtime to decode and process Solana program data.
Prerequisites
An
idl.jsonfile: Either Anchor-generated or custom.Install pnpm: Or use npm/yarn if preferred.
Initialize a JavaScript Project:
pnpm init
Installation
Install the required Codama packages:
pnpm install @codama/renderers-vixen-parserAlso, install dependencies for the parser generation script:
pnpm install \
@codama/nodes \
@codama/nodes-from-anchor \
@codama/renderers-core \
@codama/visitors-coreSetup
Create a Parser Generation Script
Create a new file, codama.cjs:
Tip: The
projectNameis used for the Cargo crate name of the generated parser.
Run the Code Generation Script
Your folder structure should look like:
Build and Verify
If successful, you now have a working parser for Solana account data using Yellowstone Vixen.
Completion
Congratulations! You now have a custom Vixen parser ready for integration into a Vixen pipeline.
Last updated
Was this helpful?