File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ export type Input = {
15
15
export type Output = readonly ContractArtifact [ ] ;
16
16
17
17
const parseArtifact = type ( "parse.json" ) . to ( types . Artifact ) ;
18
+ type Artifact = typeof types . Artifact . infer ;
19
+
20
+ function hasMetadata (
21
+ artifact : Artifact ,
22
+ ) : artifact is Artifact & { [ k in "metadata" ] -?: Exclude < Artifact [ "metadata" ] , undefined > } {
23
+ return artifact . metadata !== undefined ;
24
+ }
18
25
19
26
export async function findContractArtifacts ( { forgeOutDir } : Input ) : Promise < Output > {
20
27
const files = ( await glob ( "**/*.sol/*.json" , { ignore : "**/*.abi.json" , cwd : forgeOutDir } ) ) . sort ( ) ;
@@ -35,8 +42,9 @@ export async function findContractArtifacts({ forgeOutDir }: Input): Promise<Out
35
42
return artifact ;
36
43
} )
37
44
. filter ( isDefined )
38
- . filter ( type ( { metadata : "object" } ) . allows )
45
+ . filter ( hasMetadata )
39
46
. map ( ( artifact ) => {
47
+ artifact ;
40
48
const sourcePath = Object . keys ( artifact . metadata . settings . compilationTarget ) [ 0 ] ;
41
49
const name = artifact . metadata . settings . compilationTarget [ sourcePath ] ;
42
50
const deployedBytecodeSize = size ( artifact . deployedBytecode . object ) ;
You can’t perform that action at this time.
0 commit comments