Commit 6195a1fb authored by yann300's avatar yann300 Committed by davidzagi93@gmail.com

make sure compile-logic do not use call directly

parent 10a68f7a
...@@ -38,6 +38,18 @@ export const CompilerApiMixin = (Base) => class extends Base { ...@@ -38,6 +38,18 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.call('manager', 'deactivatePlugin', 'solidity-logic') this.call('manager', 'deactivatePlugin', 'solidity-logic')
} }
resolveContentAndSave (url) {
return this.call('contentImport', 'resolveAndSave', url)
}
compileWithHardhat (configFile) {
return this.call('hardhat', 'compile', configFile)
}
logToTerminal (content) {
return this.call('terminal', 'log', content)
}
setHardHatCompilation (value) { setHardHatCompilation (value) {
this.hhCompilation = value this.hhCompilation = value
} }
......
...@@ -29,7 +29,7 @@ export class CompileTab extends Plugin { ...@@ -29,7 +29,7 @@ export class CompileTab extends Plugin {
constructor (public api, public contentImport) { constructor (public api, public contentImport) {
super(profile) super(profile)
this.event = new EventEmitter() this.event = new EventEmitter()
this.compiler = new Compiler((url, cb) => this.call('contentImport', 'resolveAndSave', url).then((result) => cb(null, result)).catch((error) => cb(error.message))) this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
} }
init () { init () {
...@@ -123,10 +123,10 @@ export class CompileTab extends Plugin { ...@@ -123,10 +123,10 @@ export class CompileTab extends Plugin {
const configFilePath = 'remix-compiler.config.js' const configFilePath = 'remix-compiler.config.js'
this.api.writeFile(configFilePath, fileContent) this.api.writeFile(configFilePath, fileContent)
_paq.push(['trackEvent', 'compiler', 'compileWithHardhat']) _paq.push(['trackEvent', 'compiler', 'compileWithHardhat'])
this.call('hardhat', 'compile', configFilePath).then((result) => { this.api.compileWithHardhat(configFilePath).then((result) => {
this.call('terminal', 'log', { type: 'info', value: result }) this.api.logToTerminal({ type: 'info', value: result })
}).catch((error) => { }).catch((error) => {
this.call('terminal', 'log', { type: 'error', value: error }) this.api.logToTerminal({ type: 'error', value: error })
}) })
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment