WASM-ABI v1 parser and code generator for Calimero applications. This tool generates TypeScript client code and type definitions from ABI manifest files.
abi-codegen: The main package that generates TypeScript clients from ABI manifestscodegen-example: Example React application demonstrating the generated client
# Install the package
npm install @calimero/abi-codegen
# Use the CLI tool
npx calimero-abi-codegen -i abi.json -o src
# Use programmatically
import { loadAbiManifestFromFile } from '@calimero/abi-codegen/parse';# Clone and setup
git clone <repo-url>
cd calimero-abi-codegen
pnpm install
# Generate example client from local code
cd codegen-example
npm run regenerate:abi-conformance
npm run dev# Basic usage
npx calimero-abi-codegen -i abi.json -o src
# With custom client name
npx calimero-abi-codegen -i abi.json -o src --client-name MyClient
# Validate ABI manifest only
npx calimero-abi-codegen --validate -i abi.json
# Derive client name from WASM file
npx calimero-abi-codegen -i abi.json -o src --name-from kv_store.wasm-i, --input <file>- Input ABI JSON file (default: abi.json)-o, --outDir <dir>- Output directory for generated files (default: src)--client-name <Name>- Custom client class name (default: Client)--name-from <path>- Derive client name from file path (e.g., wasm file)--import-path <path>- Custom import path for CalimeroApp and Context (default: @calimero-network/calimero-client)--validate- Validate ABI manifest only (no code generation)-h, --help- Show help message
The example project uses local code for development and testing:
# Build the abi-codegen package
cd abi-codegen
npm run build
# Generate example client
cd ../codegen-example
npm run regenerate:abi-conformance# Run all tests
pnpm test
# Test specific package
cd abi-codegen
npm run test
npm run validate:abi
npm run generate:exampleThis project uses Conventional Commits for automatic versioning:
- feat: New features (minor version bump)
- fix: Bug fixes (patch version bump)
- BREAKING CHANGE: Breaking changes (major version bump)
- docs, style, refactor, perf, test, build, ci, chore: No version bump
git commit -m "feat: add support for custom client names"
git commit -m "fix: handle empty arrays in type generation"
git commit -m "docs: update README with usage examples"This project uses semantic-release for automatic versioning and publishing. Releases are triggered automatically when commits are pushed to the main branch.
- GitHub Secrets: Set
NPM_TOKENin repository secrets - npm Access: Ensure access to the
@calimeroorganization
- Make changes and commit with conventional commit messages
- Push to main branch or merge a PR
- CI/CD pipeline automatically:
- Runs tests
- Analyzes commits
- Determines version
- Publishes to npm
- Creates GitHub release
- Updates CHANGELOG.md
cd abi-codegen
npm run releaseThe published package includes:
- CLI binary:
calimero-abi-codegenexecutable - Library exports: Functions for programmatic use
- TypeScript types: Full type definitions
- Schema: WASM-ABI v1 schema for validation
- Documentation: README.md and CHANGELOG.md
The tool generates two main files:
- types.ts - TypeScript type definitions for all ABI types, methods, and events
- {ClientName}.ts - The main client class with methods for all ABI functions
The tool expects a WASM-ABI v1 manifest in JSON format. See the schema at abi-codegen/schema/wasm-abi-v1.schema.json for the complete specification.
- Fork the repository
- Create a feature branch
- Make changes with conventional commit messages
- Run tests:
pnpm test - Submit a pull request
MIT