console.log('Hardhat artifacts folder doesn\'t exist... waiting for the first compilation.')
console.log('If you are using Hardhat, run `npx hardhat compile` or run the compilation with `Enable Hardhat Compilation` checked from the Remix IDE.')
console.log('If you are using Hardhat, run `npx hardhat compile` or run the compilation with `Enable Hardhat Compilation` checked from the Remix IDE.')
this.listenOnHardHatFolder()
this.listenOnHardHatFolder()
}
}
}
}
compile(configPath: string){
compile(configPath: string){
@ -67,7 +75,16 @@ export class HardhatClient extends PluginClient {
})
})
}
}
checkPath() {
if(!fs.existsSync(this.buildPath)){
this.listenOnHardHatFolder()
returnfalse
}
returntrue
}
privateasyncprocessArtifact() {
privateasyncprocessArtifact() {
if(!this.checkPath())return
// resolving the files
// resolving the files
constfolderFiles=awaitfs.readdir(this.buildPath)
constfolderFiles=awaitfs.readdir(this.buildPath)
consttargetsSynced=[]
consttargetsSynced=[]
@ -111,23 +128,32 @@ export class HardhatClient extends PluginClient {
}
}
}
}
}
}
if(!this.warnLog){
this.call('terminal','log',{value:'receiving compilation result from Hardhat',type:'log'})
clearTimeout(this.logTimeout)
this.warnLog=true
this.logTimeout=setTimeout(()=>{
}
this.call('terminal','log',{value:'receiving compilation result from Hardhat',type:'log'})
if(targetsSynced.length){
if(targetsSynced.length){
console.log(`Processing artifacts for files: ${[...newSet(targetsSynced)].join(', ')}`)
console.log(`Processing artifacts for files: ${[...newSet(targetsSynced)].join(', ')}`)
this.call('terminal','log',{type:'log',value:`synced with Hardhat: ${[...newSet(targetsSynced)].join(', ')}`})
// @ts-ignore
}
this.call('terminal','log',{type:'log',value:`synced with Hardhat: ${[...newSet(targetsSynced)].join(', ')}`})
}else{
console.log('No artifacts to process')
// @ts-ignore
this.call('terminal','log',{type:'log',value:'No artifacts from Hardhat to process'})
}
},1000)
}
}
listenOnHardHatFolder() {
listenOnHardHatFolder() {
console.log('Hardhat artifacts folder doesn\'t exist... waiting for the compilation.')