@@ -3,7 +3,7 @@ import path from "path";
3
3
import fs from "fs" ;
4
4
5
5
import { lazyObject } from "hardhat/plugins" ;
6
- import { extendConfig , extendEnvironment , scope , task , types } from "hardhat/config" ;
6
+ import { extendConfig , extendEnvironment , scope , subtask , task , types } from "hardhat/config" ;
7
7
import { ActionType , HardhatRuntimeEnvironment , RunSuperFunction } from "hardhat/types" ;
8
8
import { TASK_CLEAN , TASK_COMPILE_SOLIDITY_READ_FILE as TASK_READ_FILE } from "hardhat/builtin-tasks/task-names" ;
9
9
@@ -18,6 +18,7 @@ import {
18
18
TASK_CIRCUITS_SETUP ,
19
19
TASK_GENERATE_VERIFIERS ,
20
20
TASK_ZKIT_CLEAN ,
21
+ SUBTASK_ZKIT_GET_CIRCUIT_ZKIT ,
21
22
} from "./task-names" ;
22
23
23
24
import { zkitConfigExtender } from "./config/config" ;
@@ -44,7 +45,13 @@ import { CircuitArtifacts } from "./artifacts/CircuitArtifacts";
44
45
import { CIRCUITS_COMPILE_CACHE_FILENAME , CIRCUITS_SETUP_CACHE_FILENAME } from "./constants" ;
45
46
import { getNormalizedFullPath , getUniqueProvingSystems } from "./utils" ;
46
47
47
- import { MakeTaskConfig , CompileTaskConfig , GenerateVerifiersTaskConfig , SetupTaskConfig } from "./types/tasks" ;
48
+ import {
49
+ MakeTaskConfig ,
50
+ CompileTaskConfig ,
51
+ GenerateVerifiersTaskConfig ,
52
+ SetupTaskConfig ,
53
+ GetCircuitZKitConfig ,
54
+ } from "./types/tasks" ;
48
55
import { CircuitArtifact } from "./types/artifacts/circuit-artifacts" ;
49
56
import { CompileFlags , CircomResolvedFileInfo , CircuitSetupInfo , SetupContributionSettings } from "./types/core" ;
50
57
import { ProvingSystemData } from "./types/cache" ;
@@ -67,7 +74,7 @@ extendEnvironment((hre) => {
67
74
circuitName : string ,
68
75
provingSystem ?: ProvingSystemType ,
69
76
) : Promise < CircuitZKit < ProvingSystemType > > => {
70
- return circuitZKitBuilder . getCircuitZKit ( circuitName , provingSystem ) ;
77
+ return hre . run ( SUBTASK_ZKIT_GET_CIRCUIT_ZKIT , { circuitName, provingSystem } ) ;
71
78
} ,
72
79
} ;
73
80
} ) ;
@@ -317,6 +324,17 @@ const clean: ActionType<any> = async (_taskArgs: any, env: HardhatRuntimeEnviron
317
324
fs . rmSync ( circuitTypesFullPath , { recursive : true , force : true } ) ;
318
325
} ;
319
326
327
+ const getCircuitZKit : ActionType < GetCircuitZKitConfig > = async (
328
+ taskArgs : GetCircuitZKitConfig ,
329
+ env : HardhatRuntimeEnvironment ,
330
+ ) : Promise < CircuitZKit < ProvingSystemType > > => {
331
+ return env . zkit . circuitZKitBuilder . getCircuitZKit (
332
+ taskArgs . circuitName ,
333
+ taskArgs . provingSystem ,
334
+ taskArgs . verifiersDir ,
335
+ ) ;
336
+ } ;
337
+
320
338
task ( TASK_CLEAN ) . setAction ( async ( _taskArgs : any , env : HardhatRuntimeEnvironment , runSuper : RunSuperFunction < any > ) => {
321
339
await runSuper ( ) ;
322
340
@@ -370,3 +388,9 @@ zkitScope
370
388
. setAction ( generateVerifiers ) ;
371
389
372
390
zkitScope . task ( TASK_ZKIT_CLEAN , "Clean all circuit artifacts, keys, types and etc" ) . setAction ( clean ) ;
391
+
392
+ subtask ( SUBTASK_ZKIT_GET_CIRCUIT_ZKIT )
393
+ . addOptionalParam ( "verifiersDir" , undefined , undefined , types . string )
394
+ . addOptionalParam ( "verifierTemplateType" , undefined , undefined , types . any )
395
+ . addParam ( "circuitName" , undefined , undefined , types . string )
396
+ . setAction ( getCircuitZKit ) ;
0 commit comments