get artefacts using fully qualified name

pull/5370/head
aniket-engg 3 years ago committed by Aniket
parent 3ca7d74114
commit b7f151330c
  1. 15
      libs/remix-core-plugin/src/lib/compiler-artefacts.ts

@ -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]

Loading…
Cancel
Save