diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index b05b4ef488..a22f388004 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -436,7 +436,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org analysis, test, filePanel.remixdHandle, - filePanel.gitHandle + filePanel.gitHandle, + filePanel.hardhatHandle ]) if (isElectron()) { diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index fd74b1722d..10f89a4759 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -57,6 +57,11 @@ class FileManager extends Plugin { this.mode = mode } + async compileWithHardhat (cmd) { + console.log('Inside compileWithHardhat, calling hardhat compile using appManager') + return await this.appManager.call('hardhat', 'compile', cmd) + } + limitPluginScope (path) { return path.replace(/^\/browser\//, '').replace(/^browser\//, '') // forbids plugin to access the root filesystem } diff --git a/apps/remix-ide/src/app/files/hardhat-handle.js b/apps/remix-ide/src/app/files/hardhat-handle.js index 9f95211b76..e9e8b770ef 100644 --- a/apps/remix-ide/src/app/files/hardhat-handle.js +++ b/apps/remix-ide/src/app/files/hardhat-handle.js @@ -11,7 +11,7 @@ const profile = { version: packageJson.version } -export class hardhatHandle extends WebsocketPlugin { +export class HardhatHandle extends WebsocketPlugin { constructor () { super(profile) } diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 3ec635040c..8b8cfd8b98 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -81,7 +81,7 @@ export class RemixdHandle extends WebsocketPlugin { } }, 3000) this.locahostProvider.init(() => {}) - // this.call('manager', 'activatePlugin', 'git') + this.call('manager', 'activatePlugin', 'hardhat') } } if (this.locahostProvider.isConnected()) { diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 991108285c..6bdef578d6 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -9,6 +9,7 @@ import { checkSpecialChars, checkSlash } from '../../lib/helper' var EventManager = require('../../lib/events') var { RemixdHandle } = require('../files/remixd-handle.js') var { GitHandle } = require('../files/git-handle.js') +var { HardhatHandle } = require('../files/hardhat-handle.js') var globalRegistry = require('../../global/registry') var examples = require('../editor/examples') var GistHandler = require('../../lib/gist-handler') @@ -60,6 +61,7 @@ module.exports = class Filepanel extends ViewPlugin { this.remixdHandle = new RemixdHandle(this._deps.fileProviders.localhost, appManager) this.gitHandle = new GitHandle() + this.hardhatHandle = new HardhatHandle() this.registeredMenuItems = [] this.request = {} this.workspaces = [] diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index c80514370b..2d2ff32217 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -83,7 +83,7 @@ class CompileTab { console.log('mode is - ', this.fileManager.mode) if(this.fileManager.mode === 'localhost') { console.log('calling compilehardhat') - // this.fileProvider.compileWithHardhat().then(console.log) + this.fileManager.compileWithHardhat('npx hardhat compile').then(console.log) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() diff --git a/libs/remixd/src/services/remixdClient.ts b/libs/remixd/src/services/remixdClient.ts index 7fb5062335..31588628ea 100644 --- a/libs/remixd/src/services/remixdClient.ts +++ b/libs/remixd/src/services/remixdClient.ts @@ -5,7 +5,6 @@ import * as utils from '../utils' import * as chokidar from 'chokidar' import * as fs from 'fs-extra' import * as isbinaryfile from 'isbinaryfile' -const hre = require("hardhat"); export class RemixdClient extends PluginClient { methods: Array