diff --git a/templates/extensions/foundry/packages/foundry/script/generateTsAbis.js b/templates/extensions/foundry/packages/foundry/script/generateTsAbis.js index dcea507f8..699c914cd 100644 --- a/templates/extensions/foundry/packages/foundry/script/generateTsAbis.js +++ b/templates/extensions/foundry/packages/foundry/script/generateTsAbis.js @@ -36,12 +36,14 @@ function getArtifactOfContract(contractName) { function getInheritedFromContracts(artifact) { let inheritedFromContracts = []; - for (const astNode of artifact.ast.nodes) { - if (astNode.nodeType == "ContractDefinition") { - if (astNode.baseContracts.length > 0) { - inheritedFromContracts = astNode.baseContracts.map( - ({ baseName }) => baseName.name - ); + if (artifact?.ast) { + for (const astNode of artifact.ast.nodes) { + if (astNode.nodeType == "ContractDefinition") { + if (astNode.baseContracts.length > 0) { + inheritedFromContracts = astNode.baseContracts.map( + ({ baseName }) => baseName.name + ); + } } } }