diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts index d85d05da66..3f1c13779f 100644 --- a/apps/solidity-compiler/src/app/compiler-api.ts +++ b/apps/solidity-compiler/src/app/compiler-api.ts @@ -38,6 +38,18 @@ export const CompilerApiMixin = (Base) => class extends Base { 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) { this.hhCompilation = value } diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index 09aa9ad66f..f28a1b8988 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -29,7 +29,7 @@ export class CompileTab extends Plugin { constructor (public api, public contentImport) { super(profile) 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 () { @@ -123,10 +123,10 @@ export class CompileTab extends Plugin { const configFilePath = 'remix-compiler.config.js' this.api.writeFile(configFilePath, fileContent) _paq.push(['trackEvent', 'compiler', 'compileWithHardhat']) - this.call('hardhat', 'compile', configFilePath).then((result) => { - this.call('terminal', 'log', { type: 'info', value: result }) + this.api.compileWithHardhat(configFilePath).then((result) => { + this.api.logToTerminal({ type: 'info', value: result }) }).catch((error) => { - this.call('terminal', 'log', { type: 'error', value: error }) + this.api.logToTerminal({ type: 'error', value: error }) }) } }