This package generates Go clients from your Codama IDLs.
pnpm install @codama/renderers-goAdd the following script to your Codama configuration file.
{
"scripts": {
"go": {
"from": "@codama/renderers-go",
"args": ["clients/go/generated"]
}
}
}For every structurally distinct PDA found in the IDL (in program.pdas or inline in instruction account defaults), the renderer emits a Find<Name>PDA function in pdas.go. Constant seeds are inlined as byte literals (with a readable comment); variable seeds become typed parameters. The bump is returned alongside the address:
global, _, err := pump.FindGlobalPDA()
bondingCurve, bump, err := pump.FindBondingCurvePDA(mint)PDAs defined under another program (for example associated token accounts) derive under that program's id automatically. Each helper's doc comment lists the instructions that use the PDA.
git clone https://github.com/codama-idl/renderers-go.git
cd renderers-go
pnpm installpnpm buildRun all tests (type checks, unit tests, e2e tests, export tests):
pnpm testOr run individual test suites:
pnpm test:types # Type checking
pnpm test:unit # Unit tests
pnpm test:e2e # End-to-end tests (generates Go code and runs `go build`)The e2e tests generate Go clients from sample IDLs and verify they compile. To manually test a specific project:
pnpm build
node e2e/generate.cjs <project> # e.g. dummy, system, memo
cd e2e/<project> && go build ./...Available e2e projects: dummy, system, memo, pump-fun, jupiter.
To add an Anchor program, convert its IDL to the Codama format first:
node e2e/anchor-to-codama.cjs path/to/anchor-idl.json e2e/<project>/idl.jsonpnpm lint # Check for issues
pnpm lint:fix # Auto-fix issues