@aztec/noir-noir_codegen 0.0.0-test.1 → 0.0.1-commit.b655e406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CompiledCircuit } from '@noir-
|
|
1
|
+
import { CompiledCircuit } from '@aztec/noir-types';
|
|
2
2
|
export declare const codegen: (programs: [string, CompiledCircuit][], embedArtifact: boolean, useFixedLengthArrays: boolean) => string;
|
package/lib/main.js
CHANGED
|
@@ -14,8 +14,8 @@ function main() {
|
|
|
14
14
|
const programs = files.map((file_path) => {
|
|
15
15
|
const program_name = path.parse(file_path).name;
|
|
16
16
|
const file_contents = fs.readFileSync(file_path).toString();
|
|
17
|
-
const { abi, bytecode } = JSON.parse(file_contents);
|
|
18
|
-
return [program_name, { abi, bytecode }];
|
|
17
|
+
const { abi, bytecode, debug_symbols, file_map } = JSON.parse(file_contents);
|
|
18
|
+
return [program_name, { abi, bytecode, debug_symbols, file_map }];
|
|
19
19
|
});
|
|
20
20
|
const result = codegen(programs, !cliConfig.externalArtifact, cliConfig.useFixedLengthArrays);
|
|
21
21
|
const outputDir = path.resolve(cliConfig.outDir ?? './codegen');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CompiledCircuit } from '@noir-
|
|
2
|
-
import { Abi } from '@noir-
|
|
1
|
+
import { CompiledCircuit } from '@aztec/noir-types';
|
|
2
|
+
import { Abi } from '@aztec/noir-noirc_abi';
|
|
3
3
|
export declare class TypingsGenerator {
|
|
4
4
|
private useFixedLengthArrays;
|
|
5
5
|
/** All the types in the ABIs */
|
|
@@ -4,9 +4,9 @@ const codegenPrelude = `/* Autogenerated file, do not edit! */
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
|
|
7
|
-
import { Noir, InputMap, type CompiledCircuit, type ForeignCallHandler } from "@noir-
|
|
7
|
+
import { Noir, InputMap, type CompiledCircuit, type ForeignCallHandler } from "@aztec/noir-noir_js"
|
|
8
8
|
|
|
9
|
-
export { type ForeignCallHandler } from "@noir-
|
|
9
|
+
export { type ForeignCallHandler } from "@aztec/noir-noir_js"
|
|
10
10
|
`;
|
|
11
11
|
/**
|
|
12
12
|
* Returns the last component of a path, e.g. "foo::bar::baz" -\> "baz"
|
|
@@ -238,13 +238,18 @@ ${interfacesCode}`;
|
|
|
238
238
|
}
|
|
239
239
|
const codegenFunction = (name, function_signature, compiled_program) => {
|
|
240
240
|
const args = function_signature.inputs.map(([name]) => `${name}`).join(', ');
|
|
241
|
-
const args_with_types = function_signature.inputs.map(([name, type]) => `${name}: ${type}`)
|
|
241
|
+
const args_with_types = function_signature.inputs.map(([name, type]) => `${name}: ${type}`);
|
|
242
|
+
if (!compiled_program) {
|
|
243
|
+
args_with_types.push(`${name}_circuit: CompiledCircuit`);
|
|
244
|
+
}
|
|
245
|
+
args_with_types.push('foreignCallHandler?: ForeignCallHandler');
|
|
246
|
+
const args_with_types_joined_by_comma = args_with_types.join(', ');
|
|
242
247
|
const artifact = compiled_program
|
|
243
248
|
? `export const ${name}_circuit: CompiledCircuit = ${JSON.stringify(compiled_program)};`
|
|
244
249
|
: '';
|
|
245
250
|
return `${artifact}
|
|
246
251
|
|
|
247
|
-
export async function ${name}(${
|
|
252
|
+
export async function ${name}(${args_with_types_joined_by_comma}): Promise<${function_signature.returnValue}> {
|
|
248
253
|
const program = new Noir(${name}_circuit);
|
|
249
254
|
const args: InputMap = { ${args} };
|
|
250
255
|
const { returnValue } = await program.execute(args, foreignCallHandler);
|
package/package.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"contributors": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "0.0.
|
|
7
|
-
"packageManager": "yarn@
|
|
6
|
+
"version": "0.0.1-commit.b655e406",
|
|
7
|
+
"packageManager": "yarn@4.5.2",
|
|
8
8
|
"license": "(MIT OR Apache-2.0)",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"homepage": "https://noir-lang.org/",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"url": "https://github.com/noir-lang/noir/issues"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
20
|
+
"@aztec/noir-types": "0.0.1-commit.b655e406",
|
|
21
|
+
"glob": "^11.0.3",
|
|
22
|
+
"ts-command-line-args": "^2.5.1"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"lib",
|
|
@@ -35,29 +35,29 @@
|
|
|
35
35
|
"dev": "tsc-multi --watch",
|
|
36
36
|
"build": "tsc",
|
|
37
37
|
"test": "yarn test:codegen && yarn test:node && yarn test:clean",
|
|
38
|
-
"test:codegen": "${NARGO:-nargo} export --program-dir=./test/test_lib && tsx src/main.ts ./test/test_lib/export/** --out-dir ./test/codegen",
|
|
38
|
+
"test:codegen": "rm -rf ./test/test_lib/export && ${NARGO:-nargo} export --program-dir=./test/test_lib && tsx src/main.ts ./test/test_lib/export/** --out-dir ./test/codegen",
|
|
39
39
|
"test:node": "mocha --timeout 25000 --exit --config ./.mocharc.json",
|
|
40
40
|
"test:clean": "rm -rf ./test/codegen ./test/test_lib/export",
|
|
41
41
|
"prettier": "prettier 'src/**/*.ts'",
|
|
42
42
|
"prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
|
|
43
|
-
"lint": "NODE_NO_WARNINGS=1 eslint . --
|
|
43
|
+
"lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0",
|
|
44
44
|
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
|
|
45
45
|
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
|
|
46
46
|
"clean": "rm -rf ./lib"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@aztec/noir-noir_js": "0.0.1-commit.b655e406",
|
|
49
50
|
"@types/chai": "^4",
|
|
50
|
-
"@types/mocha": "^10.0.
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"@types/prettier": "^3",
|
|
51
|
+
"@types/mocha": "^10.0.10",
|
|
52
|
+
"@types/node": "^22.13.10",
|
|
53
|
+
"@types/prettier": "^3.0.0",
|
|
53
54
|
"chai": "^4.4.1",
|
|
54
|
-
"eslint": "^
|
|
55
|
-
"eslint-plugin-prettier": "^5.1
|
|
56
|
-
"mocha": "^
|
|
57
|
-
"prettier": "3.
|
|
58
|
-
"ts-node": "^10.9.
|
|
59
|
-
"tsx": "^4.
|
|
60
|
-
"typescript": "^5.
|
|
61
|
-
"@aztec/noir-noir_js": "0.0.0-test.1"
|
|
55
|
+
"eslint": "^9.28.0",
|
|
56
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
57
|
+
"mocha": "^11.5.0",
|
|
58
|
+
"prettier": "3.5.3",
|
|
59
|
+
"ts-node": "^10.9.2",
|
|
60
|
+
"tsx": "^4.19.3",
|
|
61
|
+
"typescript": "^5.8.3"
|
|
62
62
|
}
|
|
63
63
|
}
|