@noir-lang/noir_codegen 1.0.0-beta.22 → 1.0.0-beta.23
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.
|
@@ -247,13 +247,18 @@ const codegenFunction = (name, function_signature, compiled_program) => {
|
|
|
247
247
|
const artifact = compiled_program
|
|
248
248
|
? `export const ${name}_circuit: CompiledCircuit = ${JSON.stringify(compiled_program)};`
|
|
249
249
|
: '';
|
|
250
|
+
const returnType = function_signature.returnValue;
|
|
251
|
+
const hasReturnValue = returnType != null;
|
|
252
|
+
const body = hasReturnValue
|
|
253
|
+
? ` const { returnValue } = await program.execute(args, foreignCallHandler);
|
|
254
|
+
return returnValue as ${returnType};`
|
|
255
|
+
: ` await program.execute(args, foreignCallHandler);`;
|
|
250
256
|
return `${artifact}
|
|
251
257
|
|
|
252
|
-
export async function ${name}(${args_with_types_joined_by_comma}): Promise<${
|
|
258
|
+
export async function ${name}(${args_with_types_joined_by_comma}): Promise<${hasReturnValue ? returnType : 'void'}> {
|
|
253
259
|
const program = new Noir(${name}_circuit);
|
|
254
260
|
const args: InputMap = { ${args} };
|
|
255
|
-
|
|
256
|
-
return returnValue as ${function_signature.returnValue};
|
|
261
|
+
${body}
|
|
257
262
|
}
|
|
258
263
|
`;
|
|
259
264
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contributors": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "1.0.0-beta.
|
|
6
|
+
"version": "1.0.0-beta.23",
|
|
7
7
|
"packageManager": "yarn@4.5.2",
|
|
8
8
|
"license": "(MIT OR Apache-2.0)",
|
|
9
9
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"url": "https://github.com/noir-lang/noir/issues"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@noir-lang/types": "1.0.0-beta.
|
|
20
|
+
"@noir-lang/types": "1.0.0-beta.23",
|
|
21
21
|
"glob": "^13.0.6",
|
|
22
22
|
"ts-command-line-args": "^2.5.1"
|
|
23
23
|
},
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"clean": "rm -rf ./lib"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@noir-lang/noir_js": "1.0.0-beta.
|
|
49
|
+
"@noir-lang/noir_js": "1.0.0-beta.23",
|
|
50
50
|
"@types/chai": "^5",
|
|
51
51
|
"@types/mocha": "^10.0.10",
|
|
52
|
-
"@types/node": "^22.
|
|
52
|
+
"@types/node": "^22.20.0",
|
|
53
53
|
"@types/prettier": "^3.0.0",
|
|
54
54
|
"chai": "^6.2.2",
|
|
55
|
-
"eslint": "^10.
|
|
56
|
-
"eslint-plugin-prettier": "^5.5.
|
|
57
|
-
"mocha": "^11.7.
|
|
58
|
-
"prettier": "3.
|
|
59
|
-
"tsx": "^4.
|
|
55
|
+
"eslint": "^10.6.0",
|
|
56
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
57
|
+
"mocha": "^11.7.6",
|
|
58
|
+
"prettier": "3.9.4",
|
|
59
|
+
"tsx": "^4.22.4",
|
|
60
60
|
"typescript": "^6.0.3"
|
|
61
61
|
}
|
|
62
62
|
}
|