Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@openzeppelin/compact-builder

Programmatic library for compiling and building Compact smart contracts on the Midnight network. Drives the compactc toolchain with progress reporting, structured error handling, and configurable output layouts.

This is the library — it ships no CLI binaries. If you want the bins (compact-compiler, compact-builder) for use in package.json scripts, install @openzeppelin/compact-cli instead, which is a thin wrapper around this library.

Install

yarn add --dev @openzeppelin/compact-builder

Quick Start

import { CompactCompiler, CompactBuilder } from '@openzeppelin/compact-builder';

// Compile all .compact files in src/ to artifacts/
await new CompactCompiler({ flags: '--skip-zk' }).compile();

// Or run the full build pipeline (compile + dist assembly)
const builder = new CompactBuilder({
  cleanDist: true,
  hierarchical: true,
  exclude: ['Mock*', '*/archive/*'],
  copyToDist: ['package.json', '../README.md'],
});
await builder.build();

Public API

// Orchestrators
export class CompactCompiler { /* … */ }
export class CompactBuilder  { /* … */ }

// Service classes (use for advanced custom pipelines)
export class EnvironmentValidator { /* … */ }
export class FileDiscovery        { /* … */ }
export class CompilerService      { /* … */ }
export const UIService = { /* … */ };

// Option types
export interface CompilerOptions { /* flags, targetDir, version, hierarchical, srcDir, outDir, exclude */ }
export type BuilderOptions = CompilerOptions & {
  cleanDist?: boolean;
  copyToDist?: string[];
};

// Errors
export class CompactCliNotFoundError extends Error { /* … */ }
export class CompilationError        extends Error { /* … */ }
export class DirectoryNotFoundError  extends Error { /* … */ }

See also

See the monorepo README for the full developer guide.

License

MIT