|
|
|
@ -100,7 +100,19 @@ export class CompilerArtefacts extends Plugin { |
|
|
|
|
|
|
|
|
|
async getArtefactsByContractName (contractName) { |
|
|
|
|
const contractsDataByFilename = this.getAllContractDatas() |
|
|
|
|
// let contractArtefacts
|
|
|
|
|
if (contractName.includes(':')) { |
|
|
|
|
const nameArr = contractName.split(':') |
|
|
|
|
const filename = nameArr[0] |
|
|
|
|
const contract = nameArr[1] |
|
|
|
|
if(Object.keys(contractsDataByFilename).includes(filename) && contractsDataByFilename[filename][contract])
|
|
|
|
|
return contractsDataByFilename[filename][contract] |
|
|
|
|
else { |
|
|
|
|
let allContractsData = {} |
|
|
|
|
await this.getArtefactsFromFE ('contracts', contract, allContractsData) |
|
|
|
|
if(allContractsData[contractName]) return allContractsData[contractName] |
|
|
|
|
else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
const contractArtefacts = this.getAllContractArtefactsfromOutput(contractsDataByFilename, contractName) |
|
|
|
|
let keys = Object.keys(contractArtefacts) |
|
|
|
|
if (!keys.length) { |
|
|
|
@ -115,6 +127,7 @@ export class CompilerArtefacts extends Plugin { |
|
|
|
|
OR just compile the required contract again`)
|
|
|
|
|
} else throw new Error(`Could not find artifacts for ${contractName}. Compile contract to generate artifacts.`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getCompilerAbstract (file) { |
|
|
|
|
return this.compilersArtefactsPerFile[file] |
|
|
|
|