Skip to content

Commit

Permalink
use remix plugin 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Nov 9, 2020
1 parent 5f2587a commit f16c126
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 64 deletions.
6 changes: 5 additions & 1 deletion apps/remix-ide-e2e/src/tests/pluginManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.pause(2000)
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
Expand All @@ -54,8 +55,11 @@ module.exports = {
'Should deactivate plugins': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.click('*[data-id="pluginManagerComponentPluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.pause(2000)
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
.waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
},
Expand Down
16 changes: 7 additions & 9 deletions apps/remix-ide/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const appManager = self.appManager
const pluginLoader = appManager.pluginLoader
const workspace = pluginLoader.get()
const engine = new Engine(appManager)
const engine = new Engine()
engine.setPluginOption = ({ name, kind }) => {
if (kind === 'provider') return {queueTimeout: 60000 * 2}
if (name === 'LearnEth') return {queueTimeout: 60000}
return {queueTimeout: 10000}
}
await engine.onload()

engine.register(appManager)
// SERVICES
// ----------------- import content servive ------------------------
const contentImport = new CompilerImport()
Expand Down Expand Up @@ -398,17 +398,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
await appManager.activatePlugin(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter'])
await appManager.activatePlugin(['mainPanel', 'menuicons'])
await appManager.activatePlugin(['sidePanel']) // activating host plugin separately
await appManager.activatePlugin(['home', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'scriptRunner', 'terminal', 'fetchAndCompile'])
await appManager.activatePlugin(['home', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'terminal', 'fetchAndCompile'])

const queryParams = new QueryParams()
const params = queryParams.get()

// Set workspace after initial activation
if (Array.isArray(workspace)) {
appManager.activatePlugin(workspace).then(() => {
appManager.activatePlugin(workspace).then(async () => {
try {
if (params.deactivate) {
appManager.deactivatePlugin(params.deactivate.split(','))
await appManager.deactivatePlugin(params.deactivate.split(','))
}
} catch (e) {
console.log(e)
Expand All @@ -422,9 +422,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
if (callDetails.length > 1) {
toolTip(`initiating ${callDetails[0]} ...`)
// @todo(remove the timeout when activatePlugin is on 0.3.0)
setTimeout(() => {
appManager.call(...callDetails).catch(console.error)
}, 5000)
appManager.call(...callDetails).catch(console.error)
}
}
}).catch(console.error)
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/files/remixd-handle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import isElectron from 'is-electron'
import { WebsocketPlugin } from '@remixproject/engine'
import { WebsocketPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json'
var yo = require('yo-yo')
var modalDialog = require('../ui/modaldialog')
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/app/tabs/debugger-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DebuggerTab extends ViewPlugin {

this.renderComponent()

this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.log(e.message))
this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.error(e))
// this.call('manager', 'activatePlugin', 'udapp')

return this.el
Expand Down
22 changes: 14 additions & 8 deletions apps/remix-ide/src/remixAppManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global localStorage, fetch */
import { PluginManager, IframePlugin } from '@remixproject/engine'
import { PluginManager } from '@remixproject/engine'
import { IframePlugin } from '@remixproject/engine-web'
import { EventEmitter } from 'events'
import QueryParams from './lib/query-params'
import { PermissionHandler } from './app/ui/persmission-handler'
Expand Down Expand Up @@ -28,11 +29,12 @@ export class RemixAppManager extends PluginManager {
this.permissionHandler = new PermissionHandler()
}

async canActivate (from, to) {
return canActivate(from.name)
async canActivatePlugin (from, to) {
return true // canActivate(from.name)
}

async canDeactivate (from, to) {
async canDeactivatePlugin (from, to) {
console.log('canDeactivatePlugin', from, to)
return from.name === 'manager'
}

Expand Down Expand Up @@ -69,8 +71,8 @@ export class RemixAppManager extends PluginManager {
this.event.emit('deactivate', plugin)
}

onRegistration (plugin) {
this.event.emit('added', plugin.name)
onRegistration () {
console.log('manager has been registered')
}

async ensureActivated (apiName) {
Expand Down Expand Up @@ -105,8 +107,12 @@ export class RemixAppManager extends PluginManager {
'description': 'Use an external wallet for transacting',
'icon': 'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHdpZHRoPSI1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyYWRpYWxHcmFkaWVud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AwMDA3MDkuMDAwMTA3LjAwMDEwNjNsNjAuNDI5MDU2IDU4Ljk1ODM1NDhjLjY0NDE1OS42Mjg0NzkgMS42ODg1NDkuNjI4NDc5IDIuMzMyNzA5IDBsNjAuNDI4MDc5LTU4Ljk1NzE5MjVjMi41NzY2NC0yLjUxMzkyMzEgNi43NTQxOTktMi41MTM5MjMxIDkuMzMwODM5IDB6IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDk4IDE2MCkiLz48L2c+PC9zdmc+',
'location': 'mainPanel'
})
return plugins.map(plugin => new IframePlugin(plugin))
})
return plugins.map(plugin => {
if (plugin.name === 'scriptRunner') {
plugin.url = 'ipfs://QmRWBCgCzKa1ixoVN9mvJACVuqWLRTRYS4sUJ9wzUBRHSf'
}
return new IframePlugin(plugin) })
}
}

Expand Down
8 changes: 4 additions & 4 deletions libs/remixd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
},
"homepage": "https://github.com/ethereum/remix-project#readme",
"dependencies": {
"@remixproject/plugin": "0.3.0-beta.5",
"@remixproject/plugin-api": "0.3.0-beta.5",
"@remixproject/plugin-utils": "0.3.0-beta.5",
"@remixproject/plugin-ws": "^0.3.0-beta.8",
"@remixproject/plugin": "^0.3.2",
"@remixproject/plugin-api": "^0.3.2",
"@remixproject/plugin-utils": "^0.3.2",
"@remixproject/plugin-ws": "^0.3.2",
"axios": "^0.20.0",
"chokidar": "^2.1.8",
"commander": "^2.20.3",
Expand Down
136 changes: 106 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,26 @@
]
},
"dependencies": {
"@remixproject/engine": "^0.2.3",
"@remixproject/engine": "^0.3.2",
"@remixproject/engine-web": "^0.3.2",
"@remixproject/plugin-ws": "^0.3.2",
"@remixproject/plugin": "^0.3.2",
"@remixproject/plugin-api": "^0.3.2",
"@remixproject/plugin-utils": "^0.3.2",
"@types/jest": "^26.0.5",
"@types/tape": "^4.2.33",
"ansi-gray": "^0.1.1",
"axios": "^0.20.0",
"change-case": "^4.1.1",
"chokidar": "^2.1.8",
"color-support": "^1.1.3",
"commander": "^2.20.3",
"ethereumjs-block": "^2.2.2",
"ethereumjs-tx": "^2.1.2",
"ethereumjs-vm": "4.1.3",
"fs-extra": "^3.0.1",
"http-server": "^0.11.1",
"isbinaryfile": "^3.0.2",
"merge": "^1.2.0",
"npm-install-version": "^6.0.2",
"react": "16.13.1",
Expand All @@ -145,15 +155,6 @@
"signale": "^1.4.0",
"time-stamp": "^2.2.0",
"winston": "^3.3.3",
"@remixproject/plugin": "0.3.0-beta.5",
"@remixproject/plugin-api": "0.3.0-beta.5",
"@remixproject/plugin-utils": "0.3.0-beta.5",
"@remixproject/plugin-ws": "^0.3.0-beta.8",
"axios": "^0.20.0",
"chokidar": "^2.1.8",
"commander": "^2.20.3",
"fs-extra": "^3.0.1",
"isbinaryfile": "^3.0.2",
"ws": "^7.3.0"
},
"devDependencies": {
Expand Down

0 comments on commit f16c126

Please sign in to comment.