Skip to main content
Version: dev

compile_contract()

compile_contract(
fileManager,
projectPath?,
logFn?,
debugLogFn?): Promise<ContractCompilationArtifacts>

Compiles a Noir project

Parameters

ParameterTypeDescription
fileManagerFileManagerThe file manager to use
projectPath?stringThe path to the project inside the file manager. Defaults to the root of the file manager
logFn?LogFnA logging function. If not provided, console.log will be used
debugLogFn?LogFnA debug logging function. If not provided, logFn will be used

Returns

Promise<ContractCompilationArtifacts>

Example

// Node.js

import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';

const fm = createFileManager(myProjectPath);
const myCompiledCode = await compile_contract(fm);
// Browser

import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';

const fm = createFileManager('/');
for (const path of files) {
await fm.writeFile(path, await getFileAsStream(path));
}
const myCompiledCode = await compile_contract(fm);

Generated using typedoc-plugin-markdown and TypeDoc