Merge branch 'master' into intl

pull/5370/head
drafish 2 years ago
commit 30e7f1b637
  1. 8
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  2. 8
      apps/remix-ide/src/app/files/foundry-handle.js
  3. 8
      apps/remix-ide/src/app/files/git-handle.js
  4. 8
      apps/remix-ide/src/app/files/hardhat-handle.js
  5. 8
      apps/remix-ide/src/app/files/slither-handle.js
  6. 9
      apps/remix-ide/src/app/files/truffle-handle.js
  7. 14
      apps/remix-ide/src/app/plugins/remixd-handle.tsx
  8. 1
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  9. 3
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx
  10. 8
      libs/remixd/src/services/foundryClient.ts
  11. 9
      libs/remixd/src/services/hardhatClient.ts
  12. 6
      libs/remixd/src/services/truffleClient.ts

@ -158,7 +158,7 @@ module.exports = {
writeFileSync('./apps/remix-ide/contracts/hardhat/artifacts/contracts/Lock.sol/Lock.dbg.json', JSON.stringify(hardhat_compilation_Lock_dbg)) writeFileSync('./apps/remix-ide/contracts/hardhat/artifacts/contracts/Lock.sol/Lock.dbg.json', JSON.stringify(hardhat_compilation_Lock_dbg))
done() done()
}) })
.expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from hardhat').before(60000) .expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from Hardhat').before(60000)
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
.openFile('contracts') .openFile('contracts')
@ -186,7 +186,7 @@ module.exports = {
console.log('working directory', process.cwd()) console.log('working directory', process.cwd())
connectRemixd(browser, done) connectRemixd(browser, done)
}) })
.expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from hardhat').before(60000) .expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from Hardhat').before(60000)
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
.openFile('contracts') .openFile('contracts')
@ -210,7 +210,7 @@ module.exports = {
writeFileSync('./apps/remix-ide/contracts/foundry/out/Counter.sol/Counter.json', JSON.stringify(foundryCompilation)) writeFileSync('./apps/remix-ide/contracts/foundry/out/Counter.sol/Counter.json', JSON.stringify(foundryCompilation))
done() done()
}) })
.expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from foundry').before(60000) .expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from Foundry').before(60000)
let contractAaddress let contractAaddress
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
@ -245,7 +245,7 @@ module.exports = {
writeFileSync('./apps/remix-ide/contracts/truffle/build/contracts/Migrations.json', JSON.stringify(truffle_compilation)) writeFileSync('./apps/remix-ide/contracts/truffle/build/contracts/Migrations.json', JSON.stringify(truffle_compilation))
done() done()
}) })
.expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from truffle').before(60000) .expect.element('*[data-id="terminalJournal"]').text.to.contain('receiving compilation result from Truffle').before(60000)
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
.openFile('contracts') .openFile('contracts')

@ -15,4 +15,12 @@ export class FoundryHandle extends WebsocketPlugin {
constructor () { constructor () {
super(profile) super(profile)
} }
callPluginMethod(key, payload = []) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
}
} }

@ -15,4 +15,12 @@ export class GitHandle extends WebsocketPlugin {
constructor () { constructor () {
super(profile) super(profile)
} }
callPluginMethod(key, payload = []) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
}
} }

@ -15,4 +15,12 @@ export class HardhatHandle extends WebsocketPlugin {
constructor () { constructor () {
super(profile) super(profile)
} }
callPluginMethod(key, payload = []) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
}
} }

@ -16,4 +16,12 @@ export class SlitherHandle extends WebsocketPlugin {
constructor () { constructor () {
super(profile) super(profile)
} }
callPluginMethod(key, payload = []) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
}
} }

@ -15,4 +15,13 @@ export class TruffleHandle extends WebsocketPlugin {
constructor () { constructor () {
super(profile) super(profile)
} }
callPluginMethod(key, payload = []) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
}
} }

@ -44,8 +44,10 @@ export class RemixdHandle extends WebsocketPlugin {
async deactivate() { async deactivate() {
for (const plugin of this.dependentPlugins) { for (const plugin of this.dependentPlugins) {
if (await this.appManager.isActive(plugin)) {
await this.appManager.deactivatePlugin(plugin) await this.appManager.deactivatePlugin(plugin)
} }
}
if (super.socket) super.deactivate() if (super.socket) super.deactivate()
// this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 // this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342
this.localhostProvider.close((error) => { this.localhostProvider.close((error) => {
@ -60,9 +62,21 @@ export class RemixdHandle extends WebsocketPlugin {
async canceled() { async canceled() {
for (const plugin of this.dependentPlugins) { for (const plugin of this.dependentPlugins) {
if (await this.appManager.isActive(plugin)) {
await this.appManager.deactivatePlugin(plugin) await this.appManager.deactivatePlugin(plugin)
} }
}
await this.appManager.deactivatePlugin('remixd') await this.appManager.deactivatePlugin('remixd')
}
async callPluginMethod(key: string, payload?: any[]) {
if (this.socket.readyState !== this.socket.OPEN) {
console.log(`${this.profile.name} connection is not opened.`)
return false
}
return super.callPluginMethod(key, payload)
} }
/** /**

@ -254,7 +254,6 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
}> }>
<button className="btn d-flex py-0" onClick={_ => props.syncContracts()}> <button className="btn d-flex py-0" onClick={_ => props.syncContracts()}>
<i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i> <i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i>
<label data-id="" className="mt-2">HardHat</label>
</button> </button>
</OverlayTrigger> </OverlayTrigger>
</div> </div>

@ -5,6 +5,7 @@ import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs' import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'
import './remix-ui-tabs.css' import './remix-ui-tabs.css'
const _paq = window._paq = window._paq || []
/* eslint-disable-next-line */ /* eslint-disable-next-line */
export interface TabsUIProps { export interface TabsUIProps {
@ -152,8 +153,10 @@ export const TabsUI = (props: TabsUIProps) => {
const content = await props.plugin.call('fileManager', "readFile", path) const content = await props.plugin.call('fileManager', "readFile", path)
if (tabsState.currentExt === 'js' || tabsState.currentExt === 'ts') { if (tabsState.currentExt === 'js' || tabsState.currentExt === 'ts') {
await props.plugin.call('scriptRunner', 'execute', content) await props.plugin.call('scriptRunner', 'execute', content)
_paq.push(['trackEvent', 'editor', 'clickRunFromEditor', tabsState.currentExt])
} else if (tabsState.currentExt === 'sol' || tabsState.currentExt === 'yul') { } else if (tabsState.currentExt === 'sol' || tabsState.currentExt === 'yul') {
await props.plugin.call('solidity', 'compile', path) await props.plugin.call('solidity', 'compile', path)
_paq.push(['trackEvent', 'editor', 'clickRunFromEditor', tabsState.currentExt])
} }
}} }}
> >

@ -36,7 +36,7 @@ export class FoundryClient extends PluginClient {
compile (configPath: string) { compile (configPath: string) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.readOnly) { if (this.readOnly) {
const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode' const errMsg = '[Foundry Compilation]: Cannot compile in read-only mode'
return reject(new Error(errMsg)) return reject(new Error(errMsg))
} }
const cmd = `forge build` const cmd = `forge build`
@ -79,7 +79,7 @@ export class FoundryClient extends PluginClient {
} }
if (!this.warnlog) { if (!this.warnlog) {
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from foundry') this.call('terminal', 'log', 'receiving compilation result from Foundry')
this.warnlog = true this.warnlog = true
} }
} }
@ -145,9 +145,9 @@ export class FoundryClient extends PluginClient {
} }
async sync () { async sync () {
console.log('syncing from foundry') console.log('syncing from Foundry')
this.processArtifact() this.processArtifact()
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'synced with foundry') this.call('terminal', 'log', 'synced with Foundry')
} }
} }

@ -68,7 +68,6 @@ export class HardhatClient extends PluginClient {
const contractFilePath = join(this.buildPath, file) const contractFilePath = join(this.buildPath, file)
const stat = await fs.stat(contractFilePath) const stat = await fs.stat(contractFilePath)
if (!stat.isDirectory()) continue if (!stat.isDirectory()) continue
console.log('pp ', contractFilePath)
const files = await fs.readdir(contractFilePath) const files = await fs.readdir(contractFilePath)
const compilationResult = { const compilationResult = {
input: {}, input: {},
@ -89,7 +88,7 @@ export class HardhatClient extends PluginClient {
compilationResult.target = jsonStd.sourceName compilationResult.target = jsonStd.sourceName
// this is the full compilation result // this is the full compilation result
console.log('processing hardhat artifact', file) console.log('Processing Hardhat artifact for file: ', file)
const path = join(contractFilePath, jsonDbg.buildInfo) const path = join(contractFilePath, jsonDbg.buildInfo)
const content = await fs.readFile(path, { encoding: 'utf-8' }) const content = await fs.readFile(path, { encoding: 'utf-8' })
@ -102,7 +101,7 @@ export class HardhatClient extends PluginClient {
} }
if (!this.warnLog) { if (!this.warnLog) {
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from hardhat') this.call('terminal', 'log', 'receiving compilation result from Hardhat')
this.warnLog = true this.warnLog = true
} }
} }
@ -121,10 +120,10 @@ export class HardhatClient extends PluginClient {
} }
async sync () { async sync () {
console.log('syncing from hardhat') console.log('syncing from Hardhat')
this.processArtifact() this.processArtifact()
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'synced with hardhat') this.call('terminal', 'log', 'synced with Hardhat')
} }
async feedContractArtifactFile (artifactContent, compilationResultPart) { async feedContractArtifactFile (artifactContent, compilationResultPart) {

@ -82,7 +82,7 @@ export class TruffleClient extends PluginClient {
} }
if (!this.warnLog) { if (!this.warnLog) {
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'receiving compilation result from truffle') this.call('terminal', 'log', 'receiving compilation result from Truffle')
this.warnLog = true this.warnLog = true
} }
} }
@ -137,9 +137,9 @@ export class TruffleClient extends PluginClient {
} }
async sync () { async sync () {
console.log('syncing from truffle') console.log('syncing from Truffle')
this.processArtifact() this.processArtifact()
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', 'synced with truffle') this.call('terminal', 'log', 'synced with Truffle')
} }
} }

Loading…
Cancel
Save