make sure compile-logic do not use call directly

pull/1342/head
yann300 3 years ago committed by davidzagi93@gmail.com
parent 10a68f7aa8
commit 6195a1fb52
  1. 12
      apps/solidity-compiler/src/app/compiler-api.ts
  2. 8
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -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 {
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 {
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 })
}) })
} }
} }

Loading…
Cancel
Save