From ad9c71543222729a61df469a79ee6385ba35466d Mon Sep 17 00:00:00 2001 From: Shei Date: Mon, 8 Apr 2019 18:00:17 -0700 Subject: [PATCH 01/31] removing the cmd-l functionality that clobbers with browser shortcut --- src/app/editor/editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index 748fd2b096..9304cffd9e 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.js @@ -99,8 +99,12 @@ class Editor { this.editor = ace.edit(el) ace.acequire('ace/ext/language_tools') - // Unmap ctrl-t & ctrl-f - this.editor.commands.bindKeys({ 'ctrl-t': null }) + // Unmap ctrl-t & ctrl-f & ctrl-l & cmd-l + this.editor.commands.bindKeys({ + 'ctrl-t': null, + 'ctrl-L': null, + 'Command-L': null + }) // shortcuts for "Ctrl-"" and "Ctrl+"" to increase/decrease font size of the editor this.editor.commands.addCommand({ From 06adfc8274db1c187743acb72819ea6813e0e775 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 9 Apr 2019 12:56:34 +0200 Subject: [PATCH 02/31] fix terminal filtering --- src/app/panels/terminal.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 2fef8f1db0..b881d88ab8 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -132,6 +132,7 @@ class Terminal {
` self._view.dropdown = self._components.dropdown.render() self._view.pendingTxCount = yo`
0
` + self._view.inputSearch = yo`` self._view.bar = yo`
${self._view.dragbar} @@ -151,7 +152,7 @@ class Terminal { ${self._view.dropdown}
- + ${self._view.inputSearch}
@@ -280,7 +281,7 @@ class Terminal { if (inserted) { text.innerText = '' background.onclick = undefined - self._view.journal.removeChild(placeholder) + if (placeholder.parentElement) self._view.journal.removeChild(placeholder) } inserted = false delete self.scroll2bottom @@ -347,7 +348,7 @@ class Terminal { clearTimeout(filtertimeout) } filtertimeout = setTimeout(() => { - self.updateJournal({ type: 'search', value: document.querySelector('.' + event.target.className).value }) + self.updateJournal({ type: 'search', value: self._view.inputSearch.value }) }, 500) } function clear (event) { @@ -499,8 +500,8 @@ class Terminal { commands[value] = false if (!self._INDEX.commandsMain[value]) return self._INDEX.commandsMain[value].forEach(item => { - item.root.steps.forEach(item => { self._JOURNAL[item.gidx] = undefined }) - self._JOURNAL[item.gidx] = undefined + item.root.steps.forEach(item => { self._JOURNAL[item.gidx].hide = true }) + self._JOURNAL[item.gidx].hide = true }) } else if (filterEvent.type === 'search') { if (value !== self.data.activeFilters.input) { @@ -535,7 +536,7 @@ class Terminal { self._jobs = [] }) } - self._jobs.push(el) + if (self.data.activeFilters.commands[item.cmd]) self._jobs.push(el) } scroll2bottom () { var self = this From bc498df2799e6beedb46ce35958f7ea985afd9a2 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 9 Apr 2019 11:07:57 +0200 Subject: [PATCH 03/31] fixed mpuse hover for start section --- src/app/ui/landing-page/section.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/ui/landing-page/section.js b/src/app/ui/landing-page/section.js index 2adc6a6c39..f883802773 100644 --- a/src/app/ui/landing-page/section.js +++ b/src/app/ui/landing-page/section.js @@ -7,6 +7,7 @@ var css = csjs` font-weight: normal; max-width: 300px; user-select: none; + padding-left: 14px; } .text:hover { font-weight: bold; @@ -40,7 +41,7 @@ class Section { if (this.actions[i].type === `callback`) { sectionLook.appendChild(yo`
- + ${this.actions[i].label}
@@ -48,7 +49,7 @@ class Section { } else if (this.actions[i].type === `link`) { sectionLook.appendChild(yo`
- + ${this.actions[i].label}
From 43d90dc18cbdb660a5abe51b7ad1f3babf0fbe25 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 9 Apr 2019 11:17:40 +0200 Subject: [PATCH 04/31] fixed links padding --- src/app/ui/landing-page/section.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/ui/landing-page/section.js b/src/app/ui/landing-page/section.js index f883802773..2b6e9f6f42 100644 --- a/src/app/ui/landing-page/section.js +++ b/src/app/ui/landing-page/section.js @@ -17,6 +17,7 @@ var css = csjs` font-weight: normal; text-decoration : none; user-select: none; + padding-left: 14px; } .link:hover { font-weight: bold; From f4ea0d0f81bb21407cba0a7b6ceabef45afdaf1d Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 9 Apr 2019 15:26:11 +0200 Subject: [PATCH 05/31] deactivate remixd plugin if canceled or error --- src/app/files/remixd-handle.js | 25 +++++++++++++++++++++++-- src/remixAppManager.js | 7 ++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/app/files/remixd-handle.js b/src/app/files/remixd-handle.js index 1cc02c28f4..19fd6a7cc0 100644 --- a/src/app/files/remixd-handle.js +++ b/src/app/files/remixd-handle.js @@ -1,7 +1,10 @@ import { ApiFactory } from 'remix-plugin' +let globalRegistry = require('../../global/registry') var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') +var modalDialogCustom = require('../ui/modal-dialog-custom') + var csjs = require('csjs-inject') @@ -43,6 +46,11 @@ export class RemixdHandle extends ApiFactory { this.connectToLocalhost() } + canceled () { + let appManager = globalRegistry.get('appmanager').api + appManager.ensureDeactivated('remixd') + } + /** * connect to localhost if no connection and render the explorer * disconnect from localhost if connected and remove the explorer @@ -55,17 +63,30 @@ export class RemixdHandle extends ApiFactory { if (error) console.log(error) }) } else { - modalDialog('Connect to localhost', remixdDialog(), + modalDialog( + 'Connect to localhost', + remixdDialog(), { label: 'Connect', fn: () => { this.locahostProvider.init((error) => { if (error) { console.log(error) + modalDialogCustom.alert( + 'Cannot connect to the remixd daemon.' + + 'Please make sure you have the remixd running in the background.' + ) + this.canceled() } else { this.fileSystemExplorer.ensureRoot() } }) - }} + } + }, + { label: 'Cancel', + fn: () => { + this.canceled() + } + } ) } } diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 34de083d79..697229973b 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -21,6 +21,11 @@ export class RemixAppManager extends AppManagerApi { this.event.emit('ensureActivated', apiName) } + ensureDeactivated (apiName) { + if (this.store.isActive(apiName)) this.deactivateOne(apiName) + this.event.emit('ensureDeactivated', apiName) + } + proxy () { // that's temporary. should be removed when we can have proper notification registration return this.data.proxy @@ -82,4 +87,4 @@ export class RemixAppManager extends AppManagerApi { new Plugin(vyper) ] } -} +} \ No newline at end of file From 2e4b793a52ac8bf4ea8f2bc678bcc27477321473 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 15:27:47 +0200 Subject: [PATCH 06/31] Change `ApiFactory` for `BaseApi` --- src/app.js | 20 ++++++------- .../components/plugin-manager-component.js | 28 ++++++++--------- src/app/editor/SourceHighlighters.js | 22 +++++++------- src/app/files/browser-files-tree.js | 19 +++++------- src/app/files/fileManager.js | 24 ++++++++------- src/app/files/remixd-handle.js | 24 +++++++-------- src/app/panels/file-panel.js | 28 ++++++++--------- src/app/tabs/analysis-tab.js | 26 ++++++++-------- src/app/tabs/compile-tab.js | 30 +++++++++---------- src/app/tabs/debugger-tab.js | 28 ++++++++--------- src/app/tabs/run-tab.js | 28 ++++++++--------- src/app/tabs/settings-tab.js | 30 +++++++++---------- src/app/tabs/test-tab.js | 26 ++++++++-------- src/app/tabs/theme-module.js | 20 ++++++------- src/app/tabs/txlistener-module.js | 24 +++++++-------- src/app/ui/landing-page/landing-page.js | 28 ++++++++--------- src/universal-dapp.js | 22 +++++++------- 17 files changed, 200 insertions(+), 227 deletions(-) diff --git a/src/app.js b/src/app.js index a0e6475f79..d6428fda3a 100644 --- a/src/app.js +++ b/src/app.js @@ -54,7 +54,7 @@ import { EntityStore } from './lib/store' import { RemixAppManager } from './remixAppManager' import { LandingPage } from './app/ui/landing-page/landing-page' import framingService from './framingService' -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { TxListenerModule } from './app/tabs/txlistener-module' import { ThemeModule } from './app/tabs/theme-module' @@ -116,9 +116,15 @@ var css = csjs` } ` -class App extends ApiFactory { +const profile = { + name: 'app', + description: 'service - provides information about current context (network).', + methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] +} + +class App extends BaseApi { constructor (api = {}, events = {}, opts = {}) { - super() + super(profile) var self = this this.event = new EventManager() self._components = {} @@ -171,14 +177,6 @@ class App extends ApiFactory { run.apply(self) } - get profile () { - return { - name: 'app', - description: 'service - provides information about current context (network).', - methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] - } - } - render () { var self = this if (self._view.el) return self._view.el diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index f8bf6d0689..3677a00836 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -2,7 +2,7 @@ const yo = require('yo-yo') const csjs = require('csjs-inject') const EventEmitter = require('events') const LocalPlugin = require('./local-plugin') -import { Plugin, ApiFactory } from 'remix-plugin' +import { Plugin, BaseApi } from 'remix-plugin' const css = csjs` .pluginSearch { @@ -34,10 +34,20 @@ const css = csjs` } ` -class PluginManagerComponent extends ApiFactory { +const pluginProfile = { + displayName: 'plugin manager', + name: 'pluginManager', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', + description: 'start/stop services, modules and plugins', + kind: 'settings' +} + +class PluginManagerComponent extends BaseApi { constructor () { - super() + super(pluginProfile) this.event = new EventEmitter() this.views = { root: null, @@ -47,18 +57,6 @@ class PluginManagerComponent extends ApiFactory { this.filter = '' } - get profile () { - return { - displayName: 'plugin manager', - name: 'pluginManager', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', - description: 'start/stop services, modules and plugins', - kind: 'settings' - } - } - setApp (appManager) { this.appManager = appManager } diff --git a/src/app/editor/SourceHighlighters.js b/src/app/editor/SourceHighlighters.js index 85c69e2537..fc8e119839 100644 --- a/src/app/editor/SourceHighlighters.js +++ b/src/app/editor/SourceHighlighters.js @@ -1,24 +1,22 @@ 'use strict' const SourceHighlighter = require('./sourceHighlighter') -import { ApiFactory } from 'remix-plugin' +import { EditorApi } from 'remix-plugin' -class SourceHighlighters extends ApiFactory { +const profile = { + displayName: 'source highlighters', + name: 'sourceHighlighters', + methods: ['highlight', 'discardHighlight'], + description: 'service - highlight source code' +} + +class SourceHighlighters extends EditorApi { constructor () { - super() + super(profile) this.highlighters = {} } - get profile () { - return { - displayName: 'source highlighters', - name: 'sourceHighlighters', - methods: ['highlight', 'discardHighlight'], - description: 'service - highlight source code' - } - } - highlight (lineColumnPos, filePath, hexColor) { const { from } = this.currentRequest try { diff --git a/src/app/files/browser-files-tree.js b/src/app/files/browser-files-tree.js index 3c8eecf991..12e7f1cbc3 100644 --- a/src/app/files/browser-files-tree.js +++ b/src/app/files/browser-files-tree.js @@ -2,12 +2,16 @@ var EventManager = require('../../lib/events') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' -class FilesTree extends ApiFactory { + class FilesTree extends BaseApi { constructor (name, storage) { - super() + super({ + name: name, + methods: ['get', 'set', 'remove'], + description: 'service - read/write file to the `config` explorer without need of additionnal permission.' + }) this.event = new EventManager() this.storage = storage this.type = name @@ -15,15 +19,6 @@ class FilesTree extends ApiFactory { this.tree = {} } - get profile () { - // TODO should make them promisable - return { - name: this.type, - methods: ['get', 'set', 'remove'], - description: 'service - read/write file to the `config` explorer without need of additionnal permission.' - } - } - exists (path, cb) { cb(null, this._exists(path)) } diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index c4cc3a9d63..96efcaafc2 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -3,16 +3,25 @@ const EventEmitter = require('events') var globalRegistry = require('../../global/registry') var CompilerImport = require('../compiler/compiler-imports') -import { ApiFactory } from 'remix-plugin' +import { FileSystemApi } from 'remix-plugin' /* attach to files event (removed renamed) trigger: currentFileChanged */ -class FileManager extends ApiFactory { +const profile = { + displayName: 'file manager', + name: 'fileManager', + methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], + events: ['currentFileChanged'], + description: 'service - read/write to any files or folders, require giving permissions', + permission: true +} + +class FileManager extends FileSystemApi { constructor (localRegistry) { - super() + super(profile) this.openedFiles = {} // list all opened files this.events = new EventEmitter() this._components = {} @@ -41,14 +50,7 @@ class FileManager extends ApiFactory { } get profile () { - return { - displayName: 'file manager', - name: 'fileManager', - methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], - events: ['currentFileChanged'], - description: 'service - read/write to any files or folders, require giving permissions', - permission: true - } + return } fileRenamedEvent (oldName, newName, isFolder) { diff --git a/src/app/files/remixd-handle.js b/src/app/files/remixd-handle.js index 1cc02c28f4..ba39c41648 100644 --- a/src/app/files/remixd-handle.js +++ b/src/app/files/remixd-handle.js @@ -1,4 +1,4 @@ -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') @@ -16,23 +16,21 @@ var css = csjs` } ` -export class RemixdHandle extends ApiFactory { +const profile = { + name: 'remixd', + methods: [], + events: [], + description: 'using Remixd daemon, allow to access file system', + kind: 'other' +} + +export class RemixdHandle extends BaseApi { constructor (fileSystemExplorer, locahostProvider) { - super() + super(profile) this.fileSystemExplorer = fileSystemExplorer this.locahostProvider = locahostProvider } - get profile () { - return { - name: 'remixd', - methods: [], - events: [], - description: 'using Remixd daemon, allow to access file system', - kind: 'other' - } - } - deactivate () { this.locahostProvider.close((error) => { if (error) console.log(error) diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index 04f69ea2b0..4388de2d69 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -6,7 +6,7 @@ var { RemixdHandle } = require('../files/remixd-handle.js') var globalRegistry = require('../../global/registry') var css = require('./styles/file-panel-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' var canUpload = window.File || window.FileReader || window.FileList || window.Blob @@ -27,10 +27,20 @@ var canUpload = window.File || window.FileReader || window.FileList || window.Bl - call fileProvider API */ -module.exports = class Filepanel extends ApiFactory { +const profile = { + name: 'fileExplorers', + displayName: 'file explorers', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', + description: ' - ', + kind: 'fileexplorer' +} + +module.exports = class Filepanel extends BaseApi { constructor (localRegistry) { - super() + super(profile) var self = this self._components = {} self._components.registry = localRegistry || globalRegistry @@ -132,17 +142,5 @@ module.exports = class Filepanel extends ApiFactory { self.render = function render () { return element } } - - get profile () { - return { - name: 'fileExplorers', - displayName: 'file explorers', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', - description: ' - ', - kind: 'fileexplorer' - } - } } diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 2b663cf594..82ae3d5dda 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -3,28 +3,30 @@ var StaticAnalysis = require('../staticanalysis/staticAnalysisView') var EventManager = require('../../lib/events') var css = require('./styles/analysis-tab-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' -class AnalysisTab extends ApiFactory { +const profile = { + name: 'solidityStaticAnalysis', + displayName: 'solidity static analysis', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', + description: ' - ', + kind: 'analysis' +} + +class AnalysisTab extends BaseApi { constructor (registry) { - super() + super(profile) this.event = new EventManager() this.events = new EventEmitter() this.registry = registry } get profile () { - return { - name: 'solidityStaticAnalysis', - displayName: 'solidity static analysis', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', - description: ' - ', - kind: 'analysis' - } + return } render () { diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index e1ee1bf85b..fdd53f82da 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -17,12 +17,23 @@ var css = require('./styles/compile-tab-styles') const CompileTabLogic = require('./compileTab/compileTab.js') const CompilerContainer = require('./compileTab/compilerContainer.js') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + displayName: 'solidity compiler', + name: 'solidity', + methods: ['getCompilationResult'], + events: ['compilationFinished'], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE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4LDM2Ny42MUwxMTAuNDU2LDU5OS44MjJ6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8zXyIgb3BhY2l0eT0iMC40NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0xMTEuNzIxLDk0OC4yNzVsMTMwLjcwNC0yMzIuMzAzaDI2MS4zMThMMzczLjAzOCw5NDguMjc1CgkJCQlIMTExLjcyMSIvPgoJCQk8cGF0aCBpZD0iU2hhcGVfNF8iIG9wYWNpdHk9IjAuNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0yNDIuNDI0LDcxNS45NzNILTE4Ljg5M2wxMzAuNjEzLDIzMi4zMDNoMjYxLjMxNwoJCQkJTDI0Mi40MjQsNzE1Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', + description: 'compile solidity contracts', + kind: 'compile', + permission: true +} -class CompileTab extends ApiFactory { +class CompileTab extends BaseApi { constructor (editor, config, renderer, swarmfileProvider, fileManager, fileProviders, pluginManager) { - super() + super(profile) this.events = new EventEmitter() this._view = { el: null, @@ -57,19 +68,6 @@ class CompileTab extends ApiFactory { ) } - get profile () { - return { - displayName: 'solidity compiler', - name: 'solidity', - methods: ['getCompilationResult'], - events: ['compilationFinished'], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbH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o8L3N2Zz4K', - description: 'compile solidity contracts', - kind: 'compile', - permission: true - } - } - /************ * EVENTS */ diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index 78d2790861..3486f7fc42 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -3,27 +3,25 @@ var css = require('./styles/debugger-tab-styles') var DebuggerUI = require('../debugger/debuggerUI') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + displayName: 'debugger', + name: 'debugger', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', + description: 'debug transactions', + kind: 'debugging' +} -class DebuggerTab extends ApiFactory { +class DebuggerTab extends BaseApi { constructor () { - super() + super(profile) this.el = null } - get profile () { - return { - displayName: 'debugger', - name: 'debugger', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', - description: 'debug transactions', - kind: 'debugging' - } - } - render () { if (this.el) return this.el diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index d7de0575c1..e2fe378bd8 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -12,12 +12,22 @@ var ContractDropdownUI = require('./runTab/contractDropdown.js') var Recorder = require('./runTab/model/recorder.js') var RecorderUI = require('./runTab/recorder.js') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + name: 'run', + displayName: 'run transactions', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', + description: 'execute and save transactions', + kind: 'run' +} -class RunTab extends ApiFactory { +class RunTab extends BaseApi { constructor (udapp, udappUI, config, fileManager, editor, logCallback, filePanel, pluginManager, compilersArtefacts) { - super() + super(profile) this.event = new EventManager() this.renderInstanceContainer() @@ -28,18 +38,6 @@ class RunTab extends ApiFactory { this.renderContainer() } - get profile () { - return { - name: 'run', - displayName: 'run transactions', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', - description: 'execute and save transactions', - kind: 'run' - } - } - renderContainer () { this.container = yo`
` diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index a3a7c31fea..f013829dba 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -4,11 +4,22 @@ var tooltip = require('../ui/tooltip') var copyToClipboard = require('../ui/copy-to-clipboard') var EventManager = require('../../lib/events') var css = require('./styles/settings-tab-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' -module.exports = class SettingsTab extends ApiFactory { +const profile = { + displayName: 'settings', + name: 'settings', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMTUyIDg5NnEwLTEwNi03NS0xODF0LTE4MS03NS0xODEgNzUtNzUgMTgxIDc1IDE4MSAxODEgNzUgMTgxLTc1IDc1LTE4MXptNTEyLTEwOXYyMjJxMCAxMi04IDIzdC0yMCAxM2wtMTg1IDI4cS0xOSA1NC0zOSA5MSAzNSA1MCAxMDcgMTM4IDEwIDEyIDEwIDI1dC05IDIzcS0yNyAzNy05OSAxMDh0LTk0IDcxcS0xMiAwLTI2LTlsLTEzOC0xMDhxLTQ0IDIzLTkxIDM4LTE2IDEzNi0yOSAxODYtNyAyOC0zNiAyOGgtMjIycS0xNCAwLTI0LjUtOC41dC0xMS41LTIxLjVsLTI4LTE4NHEtNDktMTYtOTAtMzdsLTE0MSAxMDdxLTEwIDktMjUgOS0xNCAwLTI1LTExLTEyNi0xMTQtMTY1LTE2OC03LTEwLTctMjMgMC0xMiA4LTIzIDE1LTIxIDUxLTY2LjV0NTQtNzAuNXEtMjctNTAtNDEtOTlsLTE4My0yN3EtMTMtMi0yMS0xMi41dC04LTIzLjV2LTIyMnEwLTEyIDgtMjN0MTktMTNsMTg2LTI4cTE0LTQ2IDM5LTkyLTQwLTU3LTEwNy0xMzgtMTAtMTItMTAtMjQgMC0xMCA5LTIzIDI2LTM2IDk4LjUtMTA3LjV0OTQuNS03MS41cTEzIDAgMjYgMTBsMTM4IDEwN3E0NC0yMyA5MS0zOCAxNi0xMzYgMjktMTg2IDctMjggMzYtMjhoMjIycTE0IDAgMjQuNSA4LjV0MTEuNSAyMS41bDI4IDE4NHE0OSAxNiA5MCAzN2wxNDItMTA3cTktOSAyNC05IDEzIDAgMjUgMTAgMTI5IDExOSAxNjUgMTcwIDcgOCA3IDIyIDAgMTItOCAyMy0xNSAyMS01MSA2Ni41dC01NCA3MC41cTI2IDUwIDQxIDk4bDE4MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==', + description: ' - ', + kind: 'settings', + location: 'swapPanel' +} + +module.exports = class SettingsTab extends BaseApi { constructor (config, editor, appManager) { - super() + super(profile) this.config = config this.editor = editor this.appManager = appManager @@ -30,18 +41,7 @@ module.exports = class SettingsTab extends ApiFactory { initTheme () { this.currentTheme = this._deps.themeModule.currentTheme() } - get profile () { - return { - displayName: 'settings', - name: 'settings', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0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gOCA3IDIyIDAgMTItOCAyMy0xNSAyMS01MSA2Ni41dC01NCA3MC41cTI2IDUwIDQxIDk4bDE4MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==', - description: ' - ', - kind: 'settings', - location: 'swapPanel' - } - } + createThemeCheckies () { let themes = this._deps.themeModule.getThemes() const onswitchTheme = (event, name) => { diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index cdf1a30aa4..15a05750ba 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -3,13 +3,22 @@ var async = require('async') var tooltip = require('../ui/tooltip') var css = require('./styles/test-tab-styles') var remixTests = require('remix-tests') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' const TestTabLogic = require('./testTab/testTab') -module.exports = class TestTab extends ApiFactory { +const profile = { + name: 'solidityUnitTesting', + displayName: 'solidity unit testing', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=', + description: ' - ' +} + +module.exports = class TestTab extends BaseApi { constructor (fileManager, filePanel, compileTab) { - super() + super(profile) this.compileTab = compileTab this._view = { el: null } this.compileTab = compileTab @@ -20,17 +29,6 @@ module.exports = class TestTab extends ApiFactory { this.testList = yo`
` } - get profile () { - return { - name: 'solidityUnitTesting', - displayName: 'solidity unit testing', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0i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tMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=', - description: ' - ' - } - } - activate () { this.listenToEvents() } diff --git a/src/app/tabs/theme-module.js b/src/app/tabs/theme-module.js index a334a35d95..406c36ddee 100644 --- a/src/app/tabs/theme-module.js +++ b/src/app/tabs/theme-module.js @@ -1,4 +1,4 @@ -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' const Storage = require('remix-lib').Storage @@ -17,24 +17,22 @@ const themes = [ {name: 'Superhero', quality: 'dark', url: 'https://stackpath.bootstrapcdn.com/bootswatch/4.3.1/superhero/bootstrap.min.css'} ] -export class ThemeModule extends ApiFactory { +const profile = { + name: 'theme', + events: ['themeChanged'], + methods: ['switchTheme', 'getThemes', 'currentTheme'] +} + +export class ThemeModule extends BaseApi { constructor () { - super() + super(profile) this.events = new EventEmitter() this.storage = new Storage('style:') this.themes = themes.reduce((acc, theme) => ({ ...acc, [theme.name]: theme }), {}) this.active = this.storage.exists('theme') ? this.storage.get('theme') : 'Cerulean' } - get profile () { - return { - name: 'theme', - events: ['themeChanged'], - methods: ['switchTheme', 'getThemes', 'currentTheme'] - } - } - /** Return the active theme */ currentTheme () { return this.themes[this.active] diff --git a/src/app/tabs/txlistener-module.js b/src/app/tabs/txlistener-module.js index fb872dd5da..a6a17f6289 100644 --- a/src/app/tabs/txlistener-module.js +++ b/src/app/tabs/txlistener-module.js @@ -1,23 +1,21 @@ -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' -export class TxListenerModule extends ApiFactory { +const profile = { + name: 'txListener', + displayName: 'transaction listener', + events: ['newTransaction'], + description: 'service - notify new transactions', + permission: true +} + +export class TxListenerModule extends BaseApi { constructor (txlistener) { - super() + super(profile) this.events = new EventEmitter() txlistener.event.register('newTransaction', (tx) => { this.events.emit('newTransaction', tx) }) } - - get profile () { - return { - name: 'txListener', - displayName: 'transaction listener', - events: ['newTransaction'], - description: 'service - notify new transactions', - permission: true - } - } } diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 6569a7bcee..9c918d9099 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -56,13 +56,23 @@ let css = csjs` ` import { defaultWorkspaces } from './workspace' -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import Section from './section' -export class LandingPage extends ApiFactory { +const profile = { + displayName: 'Home', + name: 'home', + methods: [], + events: [], + description: ' - ', + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxnPjxwYXRoIGQ9IiAgIE0yNSwxQzExLjc0NSwxLDEsMTEuNzQ1LDEsMjVzMTAuNzQ1LDI0LDI0LDI0czI0LTEwLjc0NSwy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sMS41NDhjMCwwLTYuODk1LDcuOTM1LTYuODk1LDIzLjQ1MkMxOC43NTQsNDAuNTE4LDI1LDQ4LjYyNSwyNSw0OC42MjUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMi4wNTgzIi8+PC9zdmc+', + location: 'mainPanel' +} + +export class LandingPage extends BaseApi { constructor (appManager, appStore) { - super() + super(profile) this.appStore = appStore this.sections = [] let load = function (item) { @@ -178,18 +188,6 @@ export class LandingPage extends ApiFactory { this.sections.push(sectionResources) } - get profile () { - return { - displayName: 'Home', - name: 'home', - methods: [], - events: [], - description: ' - ', - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxnPjxwYXRoIGQ9IiAgIE0yNSwxQzExLjc0NSwxLDEsMTEuNzQ1LDEsMjVzMTAuNzQ1LDI0LDI0LDI0czI0LTE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c+DQoJCQkJPHBvbHlnb24gZmlsbD0iIzAxMDEwMSIgcG9pbnRzPSIyNTUuOTY5LDAgMjU1Ljk2OSwxMjYuNzgxIDI1NS45NjksMjM2LjgxOCAzNjEuMjA0LDE3NC42MTEgCQkJCSIvPg0KCQkJPC9nPg0KCQk8L2c+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=' let totalLook = yo` diff --git a/src/universal-dapp.js b/src/universal-dapp.js index a36e1f87ff..b57489d9c9 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -7,12 +7,19 @@ var TxRunner = remixLib.execution.txRunner var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext -import { ApiFactory } from 'remix-plugin' +import { UdappApi } from 'remix-plugin' -module.exports = class UniversalDApp extends ApiFactory { +const profile = { + name: 'udapp', + displayName: 'universal dapp', + methods: ['runTestTx', 'getAccounts', 'createVMAccount'], + description: 'service - run transaction and access account' +} + +module.exports = class UniversalDApp extends UdappApi { constructor (registry) { - super() + super(profile) this.event = new EventManager() this._deps = { config: registry.get('config').api @@ -32,15 +39,6 @@ module.exports = class UniversalDApp extends ApiFactory { executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) } - get profile () { - return { - name: 'udapp', - displayName: 'universal dapp', - methods: ['runTestTx', 'getAccounts', 'createVMAccount'], - description: 'service - run transaction and access account' - } - } - resetEnvironment () { this.accounts = {} if (executionContext.isVM()) { From f6d6dc4b9e66e0c1b121f427ded432d21c400347 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 9 Apr 2019 15:30:00 +0200 Subject: [PATCH 07/31] test fix --- src/app/files/remixd-handle.js | 1 - src/remixAppManager.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/files/remixd-handle.js b/src/app/files/remixd-handle.js index 19fd6a7cc0..f0cf7b8162 100644 --- a/src/app/files/remixd-handle.js +++ b/src/app/files/remixd-handle.js @@ -5,7 +5,6 @@ var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') var modalDialogCustom = require('../ui/modal-dialog-custom') - var csjs = require('csjs-inject') var css = csjs` diff --git a/src/remixAppManager.js b/src/remixAppManager.js index 697229973b..7c03f4d807 100644 --- a/src/remixAppManager.js +++ b/src/remixAppManager.js @@ -87,4 +87,4 @@ export class RemixAppManager extends AppManagerApi { new Plugin(vyper) ] } -} \ No newline at end of file +} From 79b3cf2ad0173ccd20f8b3c6687530e1b2bc14b8 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:11:56 +0200 Subject: [PATCH 08/31] Use `Udapp` instead of `TxListener` --- src/app.js | 31 ++++++++++++------------------- src/app/tabs/txlistener-module.js | 21 --------------------- src/universal-dapp.js | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 44 deletions(-) delete mode 100644 src/app/tabs/txlistener-module.js diff --git a/src/app.js b/src/app.js index d6428fda3a..4fc93f3c3d 100644 --- a/src/app.js +++ b/src/app.js @@ -55,7 +55,6 @@ import { RemixAppManager } from './remixAppManager' import { LandingPage } from './app/ui/landing-page/landing-page' import framingService from './framingService' import { BaseApi } from 'remix-plugin' -import { TxListenerModule } from './app/tabs/txlistener-module' import { ThemeModule } from './app/tabs/theme-module' var css = csjs` @@ -327,7 +326,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'}) // ----------------- UniversalDApp ----------------- - var udapp = new UniversalDApp(registry) + const udapp = new UniversalDApp(registry) // TODO: to remove when possible registry.put({api: udapp, name: 'udapp'}) udapp.event.register('transactionBroadcasted', (txhash, networkName) => { @@ -335,14 +334,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org if (txLink) registry.get('logCallback').api.logCallback(yo`${txLink}`) }) - var udappUI = new UniversalDAppUI(udapp, registry) + const udappUI = new UniversalDAppUI(udapp, registry) // TODO: to remove when possible registry.put({api: udappUI, name: 'udappUI'}) // ----------------- Tx listener ----------------- - var transactionReceiptResolver = new TransactionReceiptResolver() + const transactionReceiptResolver = new TransactionReceiptResolver() - var txlistener = new Txlistener({ + const txlistener = new Txlistener({ api: { contracts: function () { if (self._components.compilersArtefacts['__last']) return self._components.compilersArtefacts['__last'].getContracts() @@ -357,7 +356,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org }}) registry.put({api: txlistener, name: 'txlistener'}) - var eventsDecoder = new EventsDecoder({ + const eventsDecoder = new EventsDecoder({ api: { resolveReceipt: function (tx, cb) { transactionReceiptResolver.resolve(tx, cb) @@ -366,11 +365,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org }) registry.put({api: eventsDecoder, name: 'eventsdecoder'}) - /* - that proxy is used by appManager to broadcast new transaction event - */ - const txListenerModule = new TxListenerModule(txlistener) - txlistener.startListening() // TODO: There are still a lot of dep between editorpanel and filemanager @@ -383,7 +377,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // ----------------- file manager ---------------------------- self._components.fileManager = new FileManager() - var fileManager = self._components.fileManager + const fileManager = self._components.fileManager registry.put({api: fileManager, name: 'filemanager'}) // ----------------- theme module ---------------------------- @@ -395,7 +389,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.put({ api: self._components.editorpanel, name: 'editorpanel' }) // ----------------- Renderer ----------------- - var renderer = new Renderer() + const renderer = new Renderer() registry.put({api: renderer, name: 'renderer'}) // ----------------- app manager ---------------------------- @@ -472,7 +466,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org udapp.api(), fileManager.api(), sourceHighlighters.api(), - txListenerModule.api(), filePanel.api(), // { profile: support.profile(), api: support }, settings.api(), @@ -494,8 +487,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // The event listener needs to be registered as early as possible, because the // parent will send the message upon the "load" event. - var filesToLoad = null - var loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later + let filesToLoad = null + const loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later window.addEventListener('message', function (ev) { if (typeof ev.data === typeof [] && ev.data[0] === 'loadFiles') { @@ -513,7 +506,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self.loadFiles(filesToLoad) } - var txLogger = new TxLogger() // eslint-disable-line + const txLogger = new TxLogger() // eslint-disable-line txLogger.event.register('debuggingRequested', (hash) => { if (!appStore.isActive('debugger')) appManager.activateOne('debugger') debug.debugger().debug(hash) @@ -545,9 +538,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } udapp.resetAPI(transactionContextAPI) - var queryParams = new QueryParams() + const queryParams = new QueryParams() - var loadingFromGist = self.loadFromGist(queryParams.get()) + const loadingFromGist = self.loadFromGist(queryParams.get()) if (!loadingFromGist) { // insert ballot contract if there are no files to show self._components.filesProviders['browser'].resolveDirectory('browser', (error, filesList) => { diff --git a/src/app/tabs/txlistener-module.js b/src/app/tabs/txlistener-module.js deleted file mode 100644 index a6a17f6289..0000000000 --- a/src/app/tabs/txlistener-module.js +++ /dev/null @@ -1,21 +0,0 @@ -import { BaseApi } from 'remix-plugin' -import { EventEmitter } from 'events' - -const profile = { - name: 'txListener', - displayName: 'transaction listener', - events: ['newTransaction'], - description: 'service - notify new transactions', - permission: true -} - -export class TxListenerModule extends BaseApi { - - constructor (txlistener) { - super(profile) - this.events = new EventEmitter() - txlistener.event.register('newTransaction', (tx) => { - this.events.emit('newTransaction', tx) - }) - } -} diff --git a/src/universal-dapp.js b/src/universal-dapp.js index b57489d9c9..0cbd80a604 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -8,22 +8,32 @@ var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext import { UdappApi } from 'remix-plugin' +import { EventEmitter } from 'events'; const profile = { name: 'udapp', displayName: 'universal dapp', - methods: ['runTestTx', 'getAccounts', 'createVMAccount'], - description: 'service - run transaction and access account' + events: ['newTransaction'], + methods: ['sendTransaction', 'getAccounts', 'createVMAccount'], + description: 'service - run transaction and access account', + permission: true } + module.exports = class UniversalDApp extends UdappApi { constructor (registry) { super(profile) + this.events = new EventEmitter() this.event = new EventManager() this._deps = { - config: registry.get('config').api + config: registry.get('config').api, + txlistener: registry.get('txlistener').api } + this._deps.txlistener.event.register('newTransaction', (tx) => { + this.events.emit('newTransaction', tx) + }) + this._txRunnerAPI = { config: this._deps.config, detectNetwork: (cb) => { @@ -240,7 +250,7 @@ module.exports = class UniversalDApp extends UdappApi { * * @param {Object} tx - transaction. */ - runTestTx (tx) { + sendTransaction (tx) { return new Promise((resolve, reject) => { executionContext.detectNetwork((error, network) => { if (error) return reject(error) From 61029b8f10073debae630f6ed582e371ec930812 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:36:57 +0200 Subject: [PATCH 09/31] standard --- src/app.js | 2 +- src/app/files/browser-files-tree.js | 15 +++++++++------ src/app/files/fileManager.js | 4 ---- src/app/tabs/analysis-tab.js | 4 ---- src/universal-dapp.js | 5 +---- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/app.js b/src/app.js index 4fc93f3c3d..c3c5694e1a 100644 --- a/src/app.js +++ b/src/app.js @@ -488,7 +488,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // The event listener needs to be registered as early as possible, because the // parent will send the message upon the "load" event. let filesToLoad = null - const loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later + let loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later window.addEventListener('message', function (ev) { if (typeof ev.data === typeof [] && ev.data[0] === 'loadFiles') { diff --git a/src/app/files/browser-files-tree.js b/src/app/files/browser-files-tree.js index 12e7f1cbc3..34df82b5db 100644 --- a/src/app/files/browser-files-tree.js +++ b/src/app/files/browser-files-tree.js @@ -4,13 +4,13 @@ var EventManager = require('../../lib/events') import { BaseApi } from 'remix-plugin' - class FilesTree extends BaseApi { - +class FilesTree extends BaseApi { constructor (name, storage) { super({ name: name, methods: ['get', 'set', 'remove'], - description: 'service - read/write file to the `config` explorer without need of additionnal permission.' + description: + 'service - read/write file to the `config` explorer without need of additionnal permission.' }) this.event = new EventManager() this.storage = storage @@ -109,7 +109,11 @@ import { BaseApi } from 'remix-plugin' if (!this.storage.rename(unprefixedoldPath, unprefixednewPath)) { return false } - this.event.trigger('fileRenamed', [this.type + '/' + unprefixedoldPath, this.type + '/' + unprefixednewPath, isFolder]) + this.event.trigger('fileRenamed', [ + this.type + '/' + unprefixedoldPath, + this.type + '/' + unprefixednewPath, + isFolder + ]) return true } return false @@ -117,7 +121,7 @@ import { BaseApi } from 'remix-plugin' resolveDirectory (path, callback) { if (path[0] === '/') path = path.substring(1) - if (!path) return callback(null, { [this.type]: { } }) + if (!path) return callback(null, { [this.type]: {} }) var tree = {} path = this.removePrefix(path) @@ -138,7 +142,6 @@ import { BaseApi } from 'remix-plugin' if (path[0] === '/') return path.substring(1) return path } - } module.exports = FilesTree diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 96efcaafc2..c3c07d40e7 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -49,10 +49,6 @@ class FileManager extends FileSystemApi { this._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) } - get profile () { - return - } - fileRenamedEvent (oldName, newName, isFolder) { if (!isFolder) { this._deps.config.set('currentFile', '') diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 82ae3d5dda..54760b43e7 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -25,10 +25,6 @@ class AnalysisTab extends BaseApi { this.registry = registry } - get profile () { - return - } - render () { var staticanalysis = new StaticAnalysis() staticanalysis.event.register('staticAnaysisWarning', (count) => { diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 0cbd80a604..ca8ab12a5b 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -8,18 +8,15 @@ var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext import { UdappApi } from 'remix-plugin' -import { EventEmitter } from 'events'; +import { EventEmitter } from 'events' const profile = { name: 'udapp', displayName: 'universal dapp', - events: ['newTransaction'], - methods: ['sendTransaction', 'getAccounts', 'createVMAccount'], description: 'service - run transaction and access account', permission: true } - module.exports = class UniversalDApp extends UdappApi { constructor (registry) { From 18691860b04bf55117309f6146e8e3043953dfce Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:49:06 +0200 Subject: [PATCH 10/31] Remove plugin folder --- src/app/plugin/bundle.js | 94 ----------------- src/app/plugin/index.js | 55 ---------- src/app/plugin/package.json | 71 ------------- src/app/plugin/plugin.md | 53 ---------- src/app/plugin/pluginAPI.js | 150 -------------------------- src/app/plugin/pluginManager.js | 179 -------------------------------- src/app/plugin/plugins.js | 38 ------- 7 files changed, 640 deletions(-) delete mode 100644 src/app/plugin/bundle.js delete mode 100644 src/app/plugin/index.js delete mode 100644 src/app/plugin/package.json delete mode 100644 src/app/plugin/plugin.md delete mode 100644 src/app/plugin/pluginAPI.js delete mode 100644 src/app/plugin/pluginManager.js delete mode 100644 src/app/plugin/plugins.js diff --git a/src/app/plugin/bundle.js b/src/app/plugin/bundle.js deleted file mode 100644 index 8888bc1f06..0000000000 --- a/src/app/plugin/bundle.js +++ /dev/null @@ -1,94 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o this._newMessage(event), false) - } - - listen (key, type, callback) { - if (!this._notifications[key]) this._notifications[key] = {} - this._notifications[key][type] = callback - } - - call (key, type, params, callback) { - this._id++ - this._pendingRequests[this._id] = callback - window.parent.postMessage(JSON.stringify({ - action: 'request', - key, - type, - value: params, - id: this._id - }), '*') - } - - _newMessage (event) { - if (!event.data) return - if (typeof event.data !== 'string') return - - var msg - try { - msg = JSON.parse(event.data) - } catch (e) { - return console.log('unable to parse data') - } - const {action, key, type, value} = msg - if (action === 'notification') { - if (this._notifications[key] && this._notifications[key][type]) { - this._notifications[key][type](value) - } - } else if (action === 'response') { - const {id, error} = msg - if (this._pendingRequests[id]) { - this._pendingRequests[id](error, value) - delete this._pendingRequests[id] - } - } - } -} - -if (window) window.RemixExtension = RemixExtension -if (module && module.exports) module.exports = RemixExtension - diff --git a/src/app/plugin/package.json b/src/app/plugin/package.json deleted file mode 100644 index ae2bbda9a0..0000000000 --- a/src/app/plugin/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "remix-extension", - "version": "0.0.1", - "description": "Ethereum IDE and tools for the web", - "contributors": [ - { - "name": "Yann Levreau", - "email": "yann@ethdev.com" - } - ], - "main": "./index.js", - "dependencies": { - "babel-eslint": "^7.1.1", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-preset-es2015": "^6.24.0", - "babelify": "^7.3.0", - "standard": "^7.0.1", - "tape": "^4.6.0" - }, - "scripts": { - "browserify": "browserify index.js -o bundle.js" - }, - "standard": { - "ignore": [ - "node_modules/*" - ], - "parser": "babel-eslint" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ethereum/remix-ide.git" - }, - "author": "cpp-ethereum team", - "license": "MIT", - "bugs": { - "url": "https://github.com/ethereum/remix-ide/issues" - }, - "homepage": "https://github.com/ethereum/remix-ide#readme", - "browserify": { - "transform": [ - [ - "babelify", - { - "plugins": [ - [ - "fast-async", - { - "runtimePatten": null, - "compiler": { - "promises": true, - "es7": true, - "noRuntime": true, - "wrapAwait": true - } - } - ], - "transform-object-assign" - ] - } - ], - [ - "babelify", - { - "presets": [ - "es2015" - ] - } - ] - ] - } -} diff --git a/src/app/plugin/plugin.md b/src/app/plugin/plugin.md deleted file mode 100644 index 67cb3cfa20..0000000000 --- a/src/app/plugin/plugin.md +++ /dev/null @@ -1,53 +0,0 @@ -plugin api - -# current APIs: - -## 1) notifications - -### app (key: app) - - - unfocus `[]` - - focus `[]` - -### compiler (key: compiler) - - - compilationFinished `[success (bool), data (obj), source (obj)]` - - compilationData `[compilationResult]` - -### transaction listener (key: txlistener) - - - newTransaction `tx (obj)` - -## 2) interactions - -### app - - - getExecutionContextProvider `@return {String} provider (injected | web3 | vm)` - - getProviderEndpoint `@return {String} url` - - updateTitle `@param {String} title` - - detectNetWork `@return {Object} {name, id}` - - addProvider `@param {String} name, @param {String} url` - - removeProvider `@return {String} name` - -### config - - - setConfig `@param {String} path, @param {String} content` - - getConfig `@param {String} path` - - removeConfig `@param {String} path` - -### compiler - - getCompilationResult `@return {Object} compilation result` - -### udapp (only VM) - - runTx `@param {Object} tx` - - getAccounts `@return {Array} acccounts` - - createVMAccount `@param {String} privateKey, @param {String} balance (hex)` - -### editor - - getFilesFromPath `@param {Array} [path]` - - getCurrentFile `@return {String} path` - - getFile `@param {String} path` - - setFile `@param {String} path, @param {String} content` - - highlight `@param {Object} lineColumnPos {start: {line, column}, end: {line, column}}, @param {String} path, @param {String} hexColor` - - discardHighlight - diff --git a/src/app/plugin/pluginAPI.js b/src/app/plugin/pluginAPI.js deleted file mode 100644 index cf708523e0..0000000000 --- a/src/app/plugin/pluginAPI.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict' -var executionContext = require('../../execution-context') -var SourceHighlighter = require('../editor/sourceHighlighter') -/* - Defines available API. `key` / `type` -*/ -module.exports = (pluginManager, fileProviders, fileManager, compilesrArtefacts, udapp) => { - let highlighters = {} - return { - app: { - getExecutionContextProvider: (mod, cb) => { - cb(null, executionContext.getProvider()) - }, - getProviderEndpoint: (mod, cb) => { - if (executionContext.getProvider() === 'web3') { - cb(null, executionContext.web3().currentProvider.host) - } else { - cb('no endpoint: current provider is either injected or vm') - } - }, - updateTitle: (mod, title, cb) => { - pluginManager.plugins[mod].modal.setTitle(title) - if (cb) cb() - }, - detectNetWork: (mod, cb) => { - executionContext.detectNetwork((error, network) => { - cb(error, network) - }) - }, - addProvider: (mod, name, url, cb) => { - executionContext.addProvider({ name, url }) - cb() - }, - removeProvider: (mod, name, cb) => { - executionContext.removeProvider(name) - cb() - } - }, - config: { - setConfig: (mod, path, content, cb) => { - fileProviders['config'].set(mod + '/' + path, content) - cb() - }, - getConfig: (mod, path, cb) => { - cb(null, fileProviders['config'].get(mod + '/' + path)) - }, - removeConfig: (mod, path, cb) => { - cb(null, fileProviders['config'].remove(mod + '/' + path)) - if (cb) cb() - } - }, - compiler: { - getCompilationResult: (mod, cb) => { - cb(null, compilesrArtefacts['__last']) - }, - sendCompilationResult: (mod, file, source, languageVersion, data, cb) => { - pluginManager.receivedDataFrom('sendCompilationResult', mod, [file, source, languageVersion, data]) - } - }, - udapp: { - runTx: (mod, tx, cb) => { - executionContext.detectNetwork((error, network) => { - if (error) return cb(error) - if (network.name === 'Main' && network.id === '1') { - return cb('It is not allowed to make this action against mainnet') - } - udapp.silentRunTx(tx, (error, result) => { - if (error) return cb(error) - cb(null, { - transactionHash: result.transactionHash, - status: result.result.status, - gasUsed: '0x' + result.result.gasUsed.toString('hex'), - error: result.result.vm.exceptionError, - return: result.result.vm.return ? '0x' + result.result.vm.return.toString('hex') : '0x', - createdAddress: result.result.createdAddress ? '0x' + result.result.createdAddress.toString('hex') : undefined - }) - }) - }) - }, - getAccounts: (mod, cb) => { - executionContext.detectNetwork((error, network) => { - if (error) return cb(error) - if (network.name === 'Main' && network.id === '1') { - return cb('It is not allowed to make this action against mainnet') - } - udapp.getAccounts(cb) - }) - }, - createVMAccount: (mod, privateKey, balance, cb) => { - if (executionContext.getProvider() !== 'vm') return cb('plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed') - udapp.createVMAccount(privateKey, balance, (error, address) => { - cb(error, address) - }) - } - }, - editor: { - getFilesFromPath: (mod, path, cb) => { - fileManager.filesFromPath(path, cb) - }, - getCurrentFile: (mod, cb) => { - var path = fileManager.currentFile() - if (!path) { - cb('no file selected') - } else { - cb(null, path) - } - }, - getFile: (mod, path, cb) => { - var provider = fileManager.fileProviderOf(path) - if (provider) { - // TODO add approval to user for external plugin to get the content of the given `path` - provider.get(path, (error, content) => { - cb(error, content) - }) - } else { - cb(path + ' not available') - } - }, - setFile: (mod, path, content, cb) => { - var provider = fileManager.fileProviderOf(path) - if (provider) { - // TODO add approval to user for external plugin to set the content of the given `path` - provider.set(path, content, (error) => { - if (error) return cb(error) - fileManager.syncEditor(path) - cb() - }) - } else { - cb(path + ' not available') - } - }, - highlight: (mod, lineColumnPos, filePath, hexColor, cb) => { - var position - try { - position = JSON.parse(lineColumnPos) - } catch (e) { - return cb(e.message) - } - if (!highlighters[mod]) highlighters[mod] = new SourceHighlighter() - highlighters[mod].currentSourceLocation(null) - highlighters[mod].currentSourceLocationFromfileName(position, filePath, hexColor) - cb() - }, - discardHighlight: (mod, cb) => { - if (highlighters[mod]) highlighters[mod].currentSourceLocation(null) - cb() - } - } - } -} diff --git a/src/app/plugin/pluginManager.js b/src/app/plugin/pluginManager.js deleted file mode 100644 index 98b865537c..0000000000 --- a/src/app/plugin/pluginManager.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager -const PluginAPI = require('./pluginAPI') -/** - * Register and Manage plugin: - * - * Plugin registration is done in the settings tab, - * using the following format: - * { - * "title": "", - * "url": "" - * } - * - * structure of messages: - * - * - Notification sent by Remix: - *{ - * action: 'notification', - * key: , - * type: , - * value: - *} - * - * - Request sent by the plugin: - *{ - * id: , - * action: 'request', - * key: , - * type: , - * value: - *} - * - * - Response sent by Remix and receive by the plugin: - *{ - * id: , - * action: 'response', - * key: , - * type: , - * value: , - * error: (see below) - *} - * => The `error` property is `undefined` if no error happened. - * => In case of error (due to permission, system error, API error, etc...): - * error: { code, msg (optional), data (optional), stack (optional) - * => possible error code are still to be defined, but the generic one would be 500. - * - * Plugin receive 4 types of message: - * - focus (when he get focus) - * - unfocus (when he loose focus - is hidden) - * - compilationData (that is triggered just after a focus - and send the current compilation data or null) - * - compilationFinished (that is only sent to the plugin that has focus) - * - * Plugin can emit messages and receive response. - * - * CONFIG: - * - getConfig(filename). The data to send should be formatted like: - * { - * id: , - * action: 'request', - * key: 'config', - * type: 'getConfig', - * value: ['filename.ext'] - * } - * the plugin will reveice a response like: - * { - * id: , - * action: 'response', - * key: 'config', - * type: 'getConfig', - * error, - * value: ['content of filename.ext'] - * } - * same apply for the other call - * - setConfig(filename, content) - * - removeConfig - * - * See index.html and remix.js in test-browser folder for sample - * - */ -module.exports = class PluginManager { - constructor (app, compilersArtefacts, txlistener, fileProviders, fileManager, udapp) { - const self = this - self.event = new EventManager() - var pluginAPI = new PluginAPI( - this, - fileProviders, - fileManager, - compilersArtefacts, - udapp - ) - self._components = { pluginAPI } - self.plugins = {} - self.origins = {} - self.inFocus - fileManager.events.on('currentFileChanged', (file) => { - self.broadcast(JSON.stringify({ - action: 'notification', - key: 'editor', - type: 'currentFileChanged', - value: [ file ] - })) - }) - - txlistener.event.register('newTransaction', (tx) => { - self.broadcast(JSON.stringify({ - action: 'notification', - key: 'txlistener', - type: 'newTransaction', - value: [tx] - })) - }) - - window.addEventListener('message', (event) => { - if (event.type !== 'message') return - var extension = self.origins[event.origin] - if (!extension) return - - function response (key, type, callid, error, result) { - self.postToOrigin(event.origin, JSON.stringify({ - id: callid, - action: 'response', - key: key, - type: type, - error: error, - value: [ result ] - })) - } - var data = JSON.parse(event.data) - data.value.unshift(extension) - data.value.push((error, result) => { - response(data.key, data.type, data.id, error, result) - }) - if (pluginAPI[data.key] && pluginAPI[data.key][data.type]) { - pluginAPI[data.key][data.type].apply({}, data.value) - } else { - response(data.key, data.type, data.id, `Endpoint ${data.key}/${data.type} not present`, null) - } - }, false) - } - unregister (desc) { - const self = this - self._components.pluginAPI.editor.discardHighlight(desc.title, () => {}) - delete self.plugins[desc.title] - delete self.origins[desc.url] - } - register (desc, modal, content) { - const self = this - self.plugins[desc.title] = { content, modal, origin: desc.url } - self.origins[desc.url] = desc.title - } - broadcast (value) { - for (var plugin in this.plugins) { - this.post(plugin, value) - } - } - postToOrigin (origin, value) { - if (this.origins[origin]) { - this.post(this.origins[origin], value) - } - } - receivedDataFrom (methodName, mod, argumentsArray) { - // TODO check whether 'mod' as right to do that - console.log(argumentsArray) - this.event.trigger(methodName, argumentsArray) // forward to internal modules - this.broadcast(JSON.stringify({ // forward to plugins - action: 'notification', - key: mod, - type: methodName, - value: argumentsArray - })) - } - post (name, value) { - const self = this - if (self.plugins[name]) { - self.plugins[name].content.querySelector('iframe').contentWindow.postMessage(value, self.plugins[name].origin) - } - } -} diff --git a/src/app/plugin/plugins.js b/src/app/plugin/plugins.js deleted file mode 100644 index 2768c4e279..0000000000 --- a/src/app/plugin/plugins.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -module.exports = { - 'oraclize': { - url: 'https://remix-plugin.oraclize.it', - title: 'Oraclize' - }, - 'solium': { - url: 'https://two-water.surge.sh', - title: 'Solium' - }, - 'ethdoc': { - url: 'https://30400.swarm-gateways.net/bzz:/ethdoc.remixide.eth', - title: 'Ethdoc' - }, - 'openzeppelin snippet': { - url: 'https://left-edge.surge.sh', - title: 'Openzeppelin snippet' - }, - 'vyper': { - url: 'https://plugin.vyper.live', - title: 'Vyper' - }, - 'slither/mythril': { - url: 'http://jittery-space.surge.sh', - title: 'Slither/Mythril' - }, - 'pipeline': { - url: 'https://pipeline.pipeos.one', - title: 'Pipeline' - } - /* - 'etherscan-general': { - url: 'http://127.0.0.1:8081', - title: 'Etherscan-general' - } - */ -} From 60b94344c03ffe033e7ff6d65a45a5b8261e6a3c Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 17:04:59 +0200 Subject: [PATCH 11/31] Udapp listen on TxListener --- src/app.js | 1 + src/universal-dapp.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index c3c5694e1a..b7ae5a1a3f 100644 --- a/src/app.js +++ b/src/app.js @@ -355,6 +355,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org udapp: udapp.event }}) registry.put({api: txlistener, name: 'txlistener'}) + udapp.startListening(txlistener) const eventsDecoder = new EventsDecoder({ api: { diff --git a/src/universal-dapp.js b/src/universal-dapp.js index ca8ab12a5b..f5ab1a44ec 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -24,12 +24,8 @@ module.exports = class UniversalDApp extends UdappApi { this.events = new EventEmitter() this.event = new EventManager() this._deps = { - config: registry.get('config').api, - txlistener: registry.get('txlistener').api + config: registry.get('config').api } - this._deps.txlistener.event.register('newTransaction', (tx) => { - this.events.emit('newTransaction', tx) - }) this._txRunnerAPI = { config: this._deps.config, @@ -46,6 +42,14 @@ module.exports = class UniversalDApp extends UdappApi { executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) } + // TODO : event should be triggered by Udapp instead of TxListener + /** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */ + startListening (txlistener) { + txlistener.event.register('newTransaction', (tx) => { + this.events.emit('newTransaction', tx) + }) + } + resetEnvironment () { this.accounts = {} if (executionContext.isVM()) { From d24904b48ab1969fc9706a0f384dad5c11a75d91 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 15:27:47 +0200 Subject: [PATCH 12/31] Change `ApiFactory` for `BaseApi` --- src/app.js | 20 ++++++------ .../components/plugin-manager-component.js | 29 ++++++++--------- src/app/editor/SourceHighlighters.js | 22 ++++++------- src/app/files/browser-files-tree.js | 19 +++++------- src/app/files/fileManager.js | 26 +++++++--------- src/app/files/remixd-handle.js | 24 +++++++------- src/app/panels/file-panel.js | 29 ++++++++--------- src/app/tabs/analysis-tab.js | 29 ++++++++--------- src/app/tabs/compile-tab.js | 31 +++++++++---------- src/app/tabs/debugger-tab.js | 29 ++++++++--------- src/app/tabs/run-tab.js | 29 ++++++++--------- src/app/tabs/settings-tab.js | 30 +++++++++--------- src/app/tabs/test-tab.js | 27 +++++++--------- src/app/tabs/theme-module.js | 20 ++++++------ src/app/tabs/txlistener-module.js | 24 +++++++------- src/app/ui/landing-page/landing-page.js | 28 ++++++++--------- src/universal-dapp.js | 22 ++++++------- 17 files changed, 198 insertions(+), 240 deletions(-) diff --git a/src/app.js b/src/app.js index a0e6475f79..d6428fda3a 100644 --- a/src/app.js +++ b/src/app.js @@ -54,7 +54,7 @@ import { EntityStore } from './lib/store' import { RemixAppManager } from './remixAppManager' import { LandingPage } from './app/ui/landing-page/landing-page' import framingService from './framingService' -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { TxListenerModule } from './app/tabs/txlistener-module' import { ThemeModule } from './app/tabs/theme-module' @@ -116,9 +116,15 @@ var css = csjs` } ` -class App extends ApiFactory { +const profile = { + name: 'app', + description: 'service - provides information about current context (network).', + methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] +} + +class App extends BaseApi { constructor (api = {}, events = {}, opts = {}) { - super() + super(profile) var self = this this.event = new EventManager() self._components = {} @@ -171,14 +177,6 @@ class App extends ApiFactory { run.apply(self) } - get profile () { - return { - name: 'app', - description: 'service - provides information about current context (network).', - methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] - } - } - render () { var self = this if (self._view.el) return self._view.el diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index 5be1d9a220..df31814660 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -2,7 +2,7 @@ const yo = require('yo-yo') const csjs = require('csjs-inject') const EventEmitter = require('events') const LocalPlugin = require('./local-plugin') -import { Plugin, ApiFactory } from 'remix-plugin' +import { Plugin, BaseApi } from 'remix-plugin' const css = csjs` .pluginSearch { @@ -34,10 +34,20 @@ const css = csjs` } ` -class PluginManagerComponent extends ApiFactory { +const profile = { + displayName: 'plugin manager', + name: 'pluginManager', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', + description: 'start/stop services, modules and plugins', + kind: 'settings' +} + +class PluginManagerComponent extends BaseApi { constructor () { - super() + super(profile) this.event = new EventEmitter() this.views = { root: null, @@ -47,19 +57,6 @@ class PluginManagerComponent extends ApiFactory { this.filter = '' } - get profile () { - return { - displayName: 'plugin manager', - name: 'pluginManager', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', - description: 'start/stop services, modules and plugins', - kind: 'settings', - location: 'swapPanel' - } - } - setApp (appManager) { this.appManager = appManager } diff --git a/src/app/editor/SourceHighlighters.js b/src/app/editor/SourceHighlighters.js index 85c69e2537..fc8e119839 100644 --- a/src/app/editor/SourceHighlighters.js +++ b/src/app/editor/SourceHighlighters.js @@ -1,24 +1,22 @@ 'use strict' const SourceHighlighter = require('./sourceHighlighter') -import { ApiFactory } from 'remix-plugin' +import { EditorApi } from 'remix-plugin' -class SourceHighlighters extends ApiFactory { +const profile = { + displayName: 'source highlighters', + name: 'sourceHighlighters', + methods: ['highlight', 'discardHighlight'], + description: 'service - highlight source code' +} + +class SourceHighlighters extends EditorApi { constructor () { - super() + super(profile) this.highlighters = {} } - get profile () { - return { - displayName: 'source highlighters', - name: 'sourceHighlighters', - methods: ['highlight', 'discardHighlight'], - description: 'service - highlight source code' - } - } - highlight (lineColumnPos, filePath, hexColor) { const { from } = this.currentRequest try { diff --git a/src/app/files/browser-files-tree.js b/src/app/files/browser-files-tree.js index 3c8eecf991..12e7f1cbc3 100644 --- a/src/app/files/browser-files-tree.js +++ b/src/app/files/browser-files-tree.js @@ -2,12 +2,16 @@ var EventManager = require('../../lib/events') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' -class FilesTree extends ApiFactory { + class FilesTree extends BaseApi { constructor (name, storage) { - super() + super({ + name: name, + methods: ['get', 'set', 'remove'], + description: 'service - read/write file to the `config` explorer without need of additionnal permission.' + }) this.event = new EventManager() this.storage = storage this.type = name @@ -15,15 +19,6 @@ class FilesTree extends ApiFactory { this.tree = {} } - get profile () { - // TODO should make them promisable - return { - name: this.type, - methods: ['get', 'set', 'remove'], - description: 'service - read/write file to the `config` explorer without need of additionnal permission.' - } - } - exists (path, cb) { cb(null, this._exists(path)) } diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 0ed8a3395d..627c0c062b 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -6,15 +6,25 @@ const EventEmitter = require('events') var globalRegistry = require('../../global/registry') var CompilerImport = require('../compiler/compiler-imports') var toaster = require('../ui/tooltip') +import { FileSystemApi } from 'remix-plugin' /* attach to files event (removed renamed) trigger: currentFileChanged */ -class FileManager extends ApiFactory { +const profile = { + displayName: 'file manager', + name: 'fileManager', + methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], + events: ['currentFileChanged'], + description: 'service - read/write to any files or folders, require giving permissions', + permission: true +} + +class FileManager extends FileSystemApi { constructor (localRegistry) { - super() + super(profile) this.openedFiles = {} // list all opened files this.events = new EventEmitter() this._components = {} @@ -42,18 +52,6 @@ class FileManager extends ApiFactory { this._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) } - get profile () { - return { - displayName: 'file manager', - name: 'fileManager', - methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], - events: ['currentFileChanged'], - description: 'service - read/write to any files or folders, require giving permissions', - permission: true, - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=' - } - } - fileRenamedEvent (oldName, newName, isFolder) { if (!isFolder) { this._deps.config.set('currentFile', '') diff --git a/src/app/files/remixd-handle.js b/src/app/files/remixd-handle.js index f0cf7b8162..6787e2104d 100644 --- a/src/app/files/remixd-handle.js +++ b/src/app/files/remixd-handle.js @@ -1,5 +1,5 @@ -import { ApiFactory } from 'remix-plugin' let globalRegistry = require('../../global/registry') +import { BaseApi } from 'remix-plugin' var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') @@ -18,23 +18,21 @@ var css = csjs` } ` -export class RemixdHandle extends ApiFactory { +const profile = { + name: 'remixd', + methods: [], + events: [], + description: 'using Remixd daemon, allow to access file system', + kind: 'other' +} + +export class RemixdHandle extends BaseApi { constructor (fileSystemExplorer, locahostProvider) { - super() + super(profile) this.fileSystemExplorer = fileSystemExplorer this.locahostProvider = locahostProvider } - get profile () { - return { - name: 'remixd', - methods: [], - events: [], - description: 'using Remixd daemon, allow to access file system', - kind: 'other' - } - } - deactivate () { this.locahostProvider.close((error) => { if (error) console.log(error) diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index 5a42d28a2f..4388de2d69 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -6,7 +6,7 @@ var { RemixdHandle } = require('../files/remixd-handle.js') var globalRegistry = require('../../global/registry') var css = require('./styles/file-panel-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' var canUpload = window.File || window.FileReader || window.FileList || window.Blob @@ -27,10 +27,20 @@ var canUpload = window.File || window.FileReader || window.FileList || window.Bl - call fileProvider API */ -module.exports = class Filepanel extends ApiFactory { +const profile = { + name: 'fileExplorers', + displayName: 'file explorers', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', + description: ' - ', + kind: 'fileexplorer' +} + +module.exports = class Filepanel extends BaseApi { constructor (localRegistry) { - super() + super(profile) var self = this self._components = {} self._components.registry = localRegistry || globalRegistry @@ -132,18 +142,5 @@ module.exports = class Filepanel extends ApiFactory { self.render = function render () { return element } } - - get profile () { - return { - name: 'fileExplorers', - displayName: 'file explorers', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', - description: ' - ', - kind: 'fileexplorer', - location: 'swapPanel' - } - } } diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 321189e0ea..54760b43e7 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -3,31 +3,28 @@ var StaticAnalysis = require('../staticanalysis/staticAnalysisView') var EventManager = require('../../lib/events') var css = require('./styles/analysis-tab-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' -class AnalysisTab extends ApiFactory { +const profile = { + name: 'solidityStaticAnalysis', + displayName: 'solidity static analysis', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', + description: ' - ', + kind: 'analysis' +} + +class AnalysisTab extends BaseApi { constructor (registry) { - super() + super(profile) this.event = new EventManager() this.events = new EventEmitter() this.registry = registry } - get profile () { - return { - name: 'solidityStaticAnalysis', - displayName: 'solidity static analysis', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', - description: ' - ', - kind: 'analysis', - location: 'swapPanel' - } - } - render () { var staticanalysis = new StaticAnalysis() staticanalysis.event.register('staticAnaysisWarning', (count) => { diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 4e5680b838..fdd53f82da 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -17,12 +17,23 @@ var css = require('./styles/compile-tab-styles') const CompileTabLogic = require('./compileTab/compileTab.js') const CompilerContainer = require('./compileTab/compilerContainer.js') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + displayName: 'solidity compiler', + name: 'solidity', + methods: ['getCompilationResult'], + events: ['compilationFinished'], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczL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2Ny42MWgyNjEuMzE4TDM3MS43NzIsMTM1LjMwOEgxMTAuNDU2CgkJCQlMMjQxLjA2OCwzNjcuNjF6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8yXyIgb3BhY2l0eT0iMC44IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3ICAgICIgZD0iTTExMC40NTYsNTk5LjgyMkwyNDEuMDY4LDM2Ny42MUwxMTAuNDU2LDEzNS4zMDgKCQkJCUwtMjAuMTU4LDM2Ny42MUwxMTAuNDU2LDU5OS44MjJ6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8zXyIgb3BhY2l0eT0iMC40NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0xMTEuNzIxLDk0OC4yNzVsMTMwLjcwNC0yMzIuMzAzaDI2MS4zMThMMzczLjAzOCw5NDguMjc1CgkJCQlIMTExLjcyMSIvPgoJCQk8cGF0aCBpZD0iU2hhcGVfNF8iIG9wYWNpdHk9IjAuNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0yNDIuNDI0LDcxNS45NzNILTE4Ljg5M2wxMzAuNjEzLDIzMi4zMDNoMjYxLjMxNwoJCQkJTDI0Mi40MjQsNzE1Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', + description: 'compile solidity contracts', + kind: 'compile', + permission: true +} -class CompileTab extends ApiFactory { +class CompileTab extends BaseApi { constructor (editor, config, renderer, swarmfileProvider, fileManager, fileProviders, pluginManager) { - super() + super(profile) this.events = new EventEmitter() this._view = { el: null, @@ -57,20 +68,6 @@ class CompileTab extends ApiFactory { ) } - get profile () { - return { - displayName: 'solidity compiler', - name: 'solidity', - methods: ['getCompilationResult'], - events: ['compilationFinished'], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iMTMwMHB4IiBoZWlnaHQ9IjEzMDBweCIKCSB2aWV3Qm94PSIwIDAgMTMwMCAxMzAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMzAwIDEzMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8dGl0bGU+VmVjdG9yIDE8L3RpdGxlPgo8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KPGcgaWQ9IlBhZ2UtMSIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+Cgk8ZyBpZD0ic29saWRpdHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQwMi4wMDAwMDAsIDExOC4wMDAwMDApIiBza2V0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Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', - description: 'compile solidity contracts', - kind: 'compile', - permission: true, - location: 'swapPanel' - } - } - /************ * EVENTS */ diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index 5e1c3cb4ac..3486f7fc42 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -3,28 +3,25 @@ var css = require('./styles/debugger-tab-styles') var DebuggerUI = require('../debugger/debuggerUI') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + displayName: 'debugger', + name: 'debugger', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', + description: 'debug transactions', + kind: 'debugging' +} -class DebuggerTab extends ApiFactory { +class DebuggerTab extends BaseApi { constructor () { - super() + super(profile) this.el = null } - get profile () { - return { - displayName: 'debugger', - name: 'debugger', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', - description: 'debug transactions', - kind: 'debugging', - location: 'swapPanel' - } - } - render () { if (this.el) return this.el diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index ca6ebc8765..e2fe378bd8 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -12,12 +12,22 @@ var ContractDropdownUI = require('./runTab/contractDropdown.js') var Recorder = require('./runTab/model/recorder.js') var RecorderUI = require('./runTab/recorder.js') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' + +const profile = { + name: 'run', + displayName: 'run transactions', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', + description: 'execute and save transactions', + kind: 'run' +} -class RunTab extends ApiFactory { +class RunTab extends BaseApi { constructor (udapp, udappUI, config, fileManager, editor, logCallback, filePanel, pluginManager, compilersArtefacts) { - super() + super(profile) this.event = new EventManager() this.renderInstanceContainer() @@ -28,19 +38,6 @@ class RunTab extends ApiFactory { this.renderContainer() } - get profile () { - return { - name: 'run', - displayName: 'run transactions', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', - description: 'execute and save transactions', - kind: 'run', - location: 'swapPanel' - } - } - renderContainer () { this.container = yo`
` diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index a3a7c31fea..f013829dba 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -4,11 +4,22 @@ var tooltip = require('../ui/tooltip') var copyToClipboard = require('../ui/copy-to-clipboard') var EventManager = require('../../lib/events') var css = require('./styles/settings-tab-styles') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' -module.exports = class SettingsTab extends ApiFactory { +const profile = { + displayName: 'settings', + name: 'settings', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIx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MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==', + description: ' - ', + kind: 'settings', + location: 'swapPanel' +} + +module.exports = class SettingsTab extends BaseApi { constructor (config, editor, appManager) { - super() + super(profile) this.config = config this.editor = editor this.appManager = appManager @@ -30,18 +41,7 @@ module.exports = class SettingsTab extends ApiFactory { initTheme () { this.currentTheme = this._deps.themeModule.currentTheme() } - get profile () { - return { - displayName: 'settings', - name: 'settings', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMTUyIDg5NnEwLTEwNi03NS0xODF0LTE4MS03NS0xODEgNzUtNzUgMTgxIDc1IDE4MSAxODEgNzUgMTgxLTc1IDc1LTE4MXptNTEyLTEwOXYyMjJxMCAxMi04IDIzdC0yMCAxM2wtMTg1IDI4cS0xOSA1NC0zOSA5MSAzNSA1MCAxMDcgMTM4IDEwIDEyIDEwIDI1dC05IDIzcS0yNyAzNy05OSAxMDh0LTk0IDcxcS0xMiAwLTI2LTlsLTEzOC0xMDhxLTQ0IDIzLTkxIDM4LTE2IDEzNi0yOSAxODYtNyAyOC0zNiAyOGgtMjIycS0xNCAwLTI0LjUtOC41dC0xMS41LTIxLjVsLTI4LTE4NHEtNDktMTYtOTAtMzdsLTE0MSAxMDdxLTEwIDktMjUgOS0xNCAwLTI1LTExLTEyNi0xMTQtMTY1LTE2OC03LTEwLTctMjMgMC0xMiA4LTIzIDE1LTIxIDUxLTY2LjV0NTQtNzAuNXEtMjctNTAtNDEtOTlsLTE4My0yN3EtMTMtMi0yMS0xMi41dC04LTIzLjV2LTIyMnEwLTEyIDgtMjN0MTktMTNsMTg2LTI4cTE0LTQ2IDM5LTkyLTQwLTU3LTEwNy0xMzgtMTAtMTItMTAtMjQgMC0xMCA5LTIzIDI2LTM2IDk4LjUtMTA3LjV0OTQuNS03MS41cTEzIDAgMjYgMTBsMTM4IDEwN3E0NC0yMyA5MS0zOCAxNi0xMzYgMjktMTg2IDctMjggMzYtMjhoMjIycTE0IDAgMjQuNSA4LjV0MTEuNSAyMS41bDI4IDE4NHE0OSAxNiA5MCAzN2wxNDItMTA3cTktOSAyNC05IDEzIDAgMjUgMTAgMTI5IDExOSAxNjUgMTcwIDcgOCA3IDIyIDAgMTItOCAyMy0xNSAyMS01MSA2Ni41dC01NCA3MC41cTI2IDUwIDQxIDk4bDE4MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==', - description: ' - ', - kind: 'settings', - location: 'swapPanel' - } - } + createThemeCheckies () { let themes = this._deps.themeModule.getThemes() const onswitchTheme = (event, name) => { diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 97efc68c93..15a05750ba 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -3,13 +3,22 @@ var async = require('async') var tooltip = require('../ui/tooltip') var css = require('./styles/test-tab-styles') var remixTests = require('remix-tests') -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' const TestTabLogic = require('./testTab/testTab') -module.exports = class TestTab extends ApiFactory { +const profile = { + name: 'solidityUnitTesting', + displayName: 'solidity unit testing', + methods: [], + events: [], + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDR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Lz48L3N2Zz4=', + description: ' - ' +} + +module.exports = class TestTab extends BaseApi { constructor (fileManager, filePanel, compileTab) { - super() + super(profile) this.compileTab = compileTab this._view = { el: null } this.compileTab = compileTab @@ -20,18 +29,6 @@ module.exports = class TestTab extends ApiFactory { this.testList = yo`
` } - get profile () { - return { - name: 'solidityUnitTesting', - displayName: 'solidity unit testing', - methods: [], - events: [], - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=', - description: ' - ', - location: 'swapPanel' - } - } - activate () { this.listenToEvents() } diff --git a/src/app/tabs/theme-module.js b/src/app/tabs/theme-module.js index a334a35d95..406c36ddee 100644 --- a/src/app/tabs/theme-module.js +++ b/src/app/tabs/theme-module.js @@ -1,4 +1,4 @@ -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' const Storage = require('remix-lib').Storage @@ -17,24 +17,22 @@ const themes = [ {name: 'Superhero', quality: 'dark', url: 'https://stackpath.bootstrapcdn.com/bootswatch/4.3.1/superhero/bootstrap.min.css'} ] -export class ThemeModule extends ApiFactory { +const profile = { + name: 'theme', + events: ['themeChanged'], + methods: ['switchTheme', 'getThemes', 'currentTheme'] +} + +export class ThemeModule extends BaseApi { constructor () { - super() + super(profile) this.events = new EventEmitter() this.storage = new Storage('style:') this.themes = themes.reduce((acc, theme) => ({ ...acc, [theme.name]: theme }), {}) this.active = this.storage.exists('theme') ? this.storage.get('theme') : 'Cerulean' } - get profile () { - return { - name: 'theme', - events: ['themeChanged'], - methods: ['switchTheme', 'getThemes', 'currentTheme'] - } - } - /** Return the active theme */ currentTheme () { return this.themes[this.active] diff --git a/src/app/tabs/txlistener-module.js b/src/app/tabs/txlistener-module.js index fb872dd5da..a6a17f6289 100644 --- a/src/app/tabs/txlistener-module.js +++ b/src/app/tabs/txlistener-module.js @@ -1,23 +1,21 @@ -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import { EventEmitter } from 'events' -export class TxListenerModule extends ApiFactory { +const profile = { + name: 'txListener', + displayName: 'transaction listener', + events: ['newTransaction'], + description: 'service - notify new transactions', + permission: true +} + +export class TxListenerModule extends BaseApi { constructor (txlistener) { - super() + super(profile) this.events = new EventEmitter() txlistener.event.register('newTransaction', (tx) => { this.events.emit('newTransaction', tx) }) } - - get profile () { - return { - name: 'txListener', - displayName: 'transaction listener', - events: ['newTransaction'], - description: 'service - notify new transactions', - permission: true - } - } } diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 6569a7bcee..9c918d9099 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -56,13 +56,23 @@ let css = csjs` ` import { defaultWorkspaces } from './workspace' -import { ApiFactory } from 'remix-plugin' +import { BaseApi } from 'remix-plugin' import Section from './section' -export class LandingPage extends ApiFactory { +const profile = { + displayName: 'Home', + name: 'home', + methods: [], + events: [], + description: ' - ', + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MC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i4wNTgzIi8+PHBhdGggZD0iICBNMS44NTIsMjIuOTMyYzAsMCw2LjQ5Myw2LjIzMiwyMy4xNDgsNi4yMzJzMjMuNDM4LTYuMjQ2LDIzLjQzOC02LjI0NiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyLjA1ODMiLz48cGF0aCBkPSIgIE0yNS42NDgsMS41NDhjMCwwLTYuODk1LDcuOTM1LTYuODk1LDIzLjQ1MkMxOC43NTQsNDAuNTE4LDI1LDQ4LjYyNSwyNSw0OC42MjUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMi4wNTgzIi8+PC9zdmc+', + location: 'mainPanel' +} + +export class LandingPage extends BaseApi { constructor (appManager, appStore) { - super() + super(profile) this.appStore = appStore this.sections = [] let load = function (item) { @@ -178,18 +188,6 @@ export class LandingPage extends ApiFactory { this.sections.push(sectionResources) } - get profile () { - return { - displayName: 'Home', - name: 'home', - methods: [], - events: [], - description: ' - ', - icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgM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OCAzNjEuMjA0LDE3NC42MTEgCQkJCSIvPg0KCQkJPC9nPg0KCQk8L2c+DQoJCTxnIG9wYWNpdHk9IjAuNDUiPg0KCQkJPGc+DQoJCQkJPHBvbHlnb24gZmlsbD0iIzAxMDEwMSIgcG9pbnRzPSIxNTAuNzM0LDE3NC42MTIgMjU1Ljk2OSwyMzYuODE4IDI1NS45NjksMTI2Ljc4MiAyNTUuOTY5LDAuMDAxIAkJCQkiLz4NCgkJCTwvZz4NCgkJPC9nPg0KCQk8ZyBvcGFjaXR5PSIwLjgiPg0KCQkJPGc+DQoJCQkJPHBvbHlnb24gZmlsbD0iIzAxMDEwMSIgcG9pbnRzPSIyNTUuOTY5LDAgMjU1Ljk2OSwxMjYuNzgxIDI1NS45NjksMjM2LjgxOCAzNjEuMjA0LDE3NC42MTEgCQkJCSIvPg0KCQkJPC9nPg0KCQk8L2c+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=' let totalLook = yo` diff --git a/src/universal-dapp.js b/src/universal-dapp.js index a36e1f87ff..b57489d9c9 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -7,12 +7,19 @@ var TxRunner = remixLib.execution.txRunner var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext -import { ApiFactory } from 'remix-plugin' +import { UdappApi } from 'remix-plugin' -module.exports = class UniversalDApp extends ApiFactory { +const profile = { + name: 'udapp', + displayName: 'universal dapp', + methods: ['runTestTx', 'getAccounts', 'createVMAccount'], + description: 'service - run transaction and access account' +} + +module.exports = class UniversalDApp extends UdappApi { constructor (registry) { - super() + super(profile) this.event = new EventManager() this._deps = { config: registry.get('config').api @@ -32,15 +39,6 @@ module.exports = class UniversalDApp extends ApiFactory { executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) } - get profile () { - return { - name: 'udapp', - displayName: 'universal dapp', - methods: ['runTestTx', 'getAccounts', 'createVMAccount'], - description: 'service - run transaction and access account' - } - } - resetEnvironment () { this.accounts = {} if (executionContext.isVM()) { From e8454407dde0dcd1e34e9a7a2f275f9b1d42bfaf Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:11:56 +0200 Subject: [PATCH 13/31] Use `Udapp` instead of `TxListener` --- src/app.js | 31 ++++++++++++------------------- src/app/tabs/txlistener-module.js | 21 --------------------- src/universal-dapp.js | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 44 deletions(-) delete mode 100644 src/app/tabs/txlistener-module.js diff --git a/src/app.js b/src/app.js index d6428fda3a..4fc93f3c3d 100644 --- a/src/app.js +++ b/src/app.js @@ -55,7 +55,6 @@ import { RemixAppManager } from './remixAppManager' import { LandingPage } from './app/ui/landing-page/landing-page' import framingService from './framingService' import { BaseApi } from 'remix-plugin' -import { TxListenerModule } from './app/tabs/txlistener-module' import { ThemeModule } from './app/tabs/theme-module' var css = csjs` @@ -327,7 +326,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'}) // ----------------- UniversalDApp ----------------- - var udapp = new UniversalDApp(registry) + const udapp = new UniversalDApp(registry) // TODO: to remove when possible registry.put({api: udapp, name: 'udapp'}) udapp.event.register('transactionBroadcasted', (txhash, networkName) => { @@ -335,14 +334,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org if (txLink) registry.get('logCallback').api.logCallback(yo`${txLink}`) }) - var udappUI = new UniversalDAppUI(udapp, registry) + const udappUI = new UniversalDAppUI(udapp, registry) // TODO: to remove when possible registry.put({api: udappUI, name: 'udappUI'}) // ----------------- Tx listener ----------------- - var transactionReceiptResolver = new TransactionReceiptResolver() + const transactionReceiptResolver = new TransactionReceiptResolver() - var txlistener = new Txlistener({ + const txlistener = new Txlistener({ api: { contracts: function () { if (self._components.compilersArtefacts['__last']) return self._components.compilersArtefacts['__last'].getContracts() @@ -357,7 +356,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org }}) registry.put({api: txlistener, name: 'txlistener'}) - var eventsDecoder = new EventsDecoder({ + const eventsDecoder = new EventsDecoder({ api: { resolveReceipt: function (tx, cb) { transactionReceiptResolver.resolve(tx, cb) @@ -366,11 +365,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org }) registry.put({api: eventsDecoder, name: 'eventsdecoder'}) - /* - that proxy is used by appManager to broadcast new transaction event - */ - const txListenerModule = new TxListenerModule(txlistener) - txlistener.startListening() // TODO: There are still a lot of dep between editorpanel and filemanager @@ -383,7 +377,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // ----------------- file manager ---------------------------- self._components.fileManager = new FileManager() - var fileManager = self._components.fileManager + const fileManager = self._components.fileManager registry.put({api: fileManager, name: 'filemanager'}) // ----------------- theme module ---------------------------- @@ -395,7 +389,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.put({ api: self._components.editorpanel, name: 'editorpanel' }) // ----------------- Renderer ----------------- - var renderer = new Renderer() + const renderer = new Renderer() registry.put({api: renderer, name: 'renderer'}) // ----------------- app manager ---------------------------- @@ -472,7 +466,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org udapp.api(), fileManager.api(), sourceHighlighters.api(), - txListenerModule.api(), filePanel.api(), // { profile: support.profile(), api: support }, settings.api(), @@ -494,8 +487,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // The event listener needs to be registered as early as possible, because the // parent will send the message upon the "load" event. - var filesToLoad = null - var loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later + let filesToLoad = null + const loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later window.addEventListener('message', function (ev) { if (typeof ev.data === typeof [] && ev.data[0] === 'loadFiles') { @@ -513,7 +506,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org self.loadFiles(filesToLoad) } - var txLogger = new TxLogger() // eslint-disable-line + const txLogger = new TxLogger() // eslint-disable-line txLogger.event.register('debuggingRequested', (hash) => { if (!appStore.isActive('debugger')) appManager.activateOne('debugger') debug.debugger().debug(hash) @@ -545,9 +538,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org } udapp.resetAPI(transactionContextAPI) - var queryParams = new QueryParams() + const queryParams = new QueryParams() - var loadingFromGist = self.loadFromGist(queryParams.get()) + const loadingFromGist = self.loadFromGist(queryParams.get()) if (!loadingFromGist) { // insert ballot contract if there are no files to show self._components.filesProviders['browser'].resolveDirectory('browser', (error, filesList) => { diff --git a/src/app/tabs/txlistener-module.js b/src/app/tabs/txlistener-module.js deleted file mode 100644 index a6a17f6289..0000000000 --- a/src/app/tabs/txlistener-module.js +++ /dev/null @@ -1,21 +0,0 @@ -import { BaseApi } from 'remix-plugin' -import { EventEmitter } from 'events' - -const profile = { - name: 'txListener', - displayName: 'transaction listener', - events: ['newTransaction'], - description: 'service - notify new transactions', - permission: true -} - -export class TxListenerModule extends BaseApi { - - constructor (txlistener) { - super(profile) - this.events = new EventEmitter() - txlistener.event.register('newTransaction', (tx) => { - this.events.emit('newTransaction', tx) - }) - } -} diff --git a/src/universal-dapp.js b/src/universal-dapp.js index b57489d9c9..0cbd80a604 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -8,22 +8,32 @@ var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext import { UdappApi } from 'remix-plugin' +import { EventEmitter } from 'events'; const profile = { name: 'udapp', displayName: 'universal dapp', - methods: ['runTestTx', 'getAccounts', 'createVMAccount'], - description: 'service - run transaction and access account' + events: ['newTransaction'], + methods: ['sendTransaction', 'getAccounts', 'createVMAccount'], + description: 'service - run transaction and access account', + permission: true } + module.exports = class UniversalDApp extends UdappApi { constructor (registry) { super(profile) + this.events = new EventEmitter() this.event = new EventManager() this._deps = { - config: registry.get('config').api + config: registry.get('config').api, + txlistener: registry.get('txlistener').api } + this._deps.txlistener.event.register('newTransaction', (tx) => { + this.events.emit('newTransaction', tx) + }) + this._txRunnerAPI = { config: this._deps.config, detectNetwork: (cb) => { @@ -240,7 +250,7 @@ module.exports = class UniversalDApp extends UdappApi { * * @param {Object} tx - transaction. */ - runTestTx (tx) { + sendTransaction (tx) { return new Promise((resolve, reject) => { executionContext.detectNetwork((error, network) => { if (error) return reject(error) From c4d99d477503da1a8e0b9ba09b1168e78c8bd0bf Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:36:57 +0200 Subject: [PATCH 14/31] standard --- src/app.js | 2 +- src/app/files/browser-files-tree.js | 15 +++++++++------ src/universal-dapp.js | 5 +---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app.js b/src/app.js index 4fc93f3c3d..c3c5694e1a 100644 --- a/src/app.js +++ b/src/app.js @@ -488,7 +488,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // The event listener needs to be registered as early as possible, because the // parent will send the message upon the "load" event. let filesToLoad = null - const loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later + let loadFilesCallback = function (files) { filesToLoad = files } // will be replaced later window.addEventListener('message', function (ev) { if (typeof ev.data === typeof [] && ev.data[0] === 'loadFiles') { diff --git a/src/app/files/browser-files-tree.js b/src/app/files/browser-files-tree.js index 12e7f1cbc3..34df82b5db 100644 --- a/src/app/files/browser-files-tree.js +++ b/src/app/files/browser-files-tree.js @@ -4,13 +4,13 @@ var EventManager = require('../../lib/events') import { BaseApi } from 'remix-plugin' - class FilesTree extends BaseApi { - +class FilesTree extends BaseApi { constructor (name, storage) { super({ name: name, methods: ['get', 'set', 'remove'], - description: 'service - read/write file to the `config` explorer without need of additionnal permission.' + description: + 'service - read/write file to the `config` explorer without need of additionnal permission.' }) this.event = new EventManager() this.storage = storage @@ -109,7 +109,11 @@ import { BaseApi } from 'remix-plugin' if (!this.storage.rename(unprefixedoldPath, unprefixednewPath)) { return false } - this.event.trigger('fileRenamed', [this.type + '/' + unprefixedoldPath, this.type + '/' + unprefixednewPath, isFolder]) + this.event.trigger('fileRenamed', [ + this.type + '/' + unprefixedoldPath, + this.type + '/' + unprefixednewPath, + isFolder + ]) return true } return false @@ -117,7 +121,7 @@ import { BaseApi } from 'remix-plugin' resolveDirectory (path, callback) { if (path[0] === '/') path = path.substring(1) - if (!path) return callback(null, { [this.type]: { } }) + if (!path) return callback(null, { [this.type]: {} }) var tree = {} path = this.removePrefix(path) @@ -138,7 +142,6 @@ import { BaseApi } from 'remix-plugin' if (path[0] === '/') return path.substring(1) return path } - } module.exports = FilesTree diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 0cbd80a604..ca8ab12a5b 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -8,18 +8,15 @@ var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext import { UdappApi } from 'remix-plugin' -import { EventEmitter } from 'events'; +import { EventEmitter } from 'events' const profile = { name: 'udapp', displayName: 'universal dapp', - events: ['newTransaction'], - methods: ['sendTransaction', 'getAccounts', 'createVMAccount'], description: 'service - run transaction and access account', permission: true } - module.exports = class UniversalDApp extends UdappApi { constructor (registry) { From 29027496fca59fe3283e609464cc31de219f73f2 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 16:49:06 +0200 Subject: [PATCH 15/31] Remove plugin folder --- src/app/plugin/bundle.js | 94 ----------------- src/app/plugin/index.js | 55 ---------- src/app/plugin/package.json | 71 ------------- src/app/plugin/plugin.md | 53 ---------- src/app/plugin/pluginAPI.js | 150 -------------------------- src/app/plugin/pluginManager.js | 179 -------------------------------- src/app/plugin/plugins.js | 38 ------- 7 files changed, 640 deletions(-) delete mode 100644 src/app/plugin/bundle.js delete mode 100644 src/app/plugin/index.js delete mode 100644 src/app/plugin/package.json delete mode 100644 src/app/plugin/plugin.md delete mode 100644 src/app/plugin/pluginAPI.js delete mode 100644 src/app/plugin/pluginManager.js delete mode 100644 src/app/plugin/plugins.js diff --git a/src/app/plugin/bundle.js b/src/app/plugin/bundle.js deleted file mode 100644 index 8888bc1f06..0000000000 --- a/src/app/plugin/bundle.js +++ /dev/null @@ -1,94 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o this._newMessage(event), false) - } - - listen (key, type, callback) { - if (!this._notifications[key]) this._notifications[key] = {} - this._notifications[key][type] = callback - } - - call (key, type, params, callback) { - this._id++ - this._pendingRequests[this._id] = callback - window.parent.postMessage(JSON.stringify({ - action: 'request', - key, - type, - value: params, - id: this._id - }), '*') - } - - _newMessage (event) { - if (!event.data) return - if (typeof event.data !== 'string') return - - var msg - try { - msg = JSON.parse(event.data) - } catch (e) { - return console.log('unable to parse data') - } - const {action, key, type, value} = msg - if (action === 'notification') { - if (this._notifications[key] && this._notifications[key][type]) { - this._notifications[key][type](value) - } - } else if (action === 'response') { - const {id, error} = msg - if (this._pendingRequests[id]) { - this._pendingRequests[id](error, value) - delete this._pendingRequests[id] - } - } - } -} - -if (window) window.RemixExtension = RemixExtension -if (module && module.exports) module.exports = RemixExtension - diff --git a/src/app/plugin/package.json b/src/app/plugin/package.json deleted file mode 100644 index ae2bbda9a0..0000000000 --- a/src/app/plugin/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "remix-extension", - "version": "0.0.1", - "description": "Ethereum IDE and tools for the web", - "contributors": [ - { - "name": "Yann Levreau", - "email": "yann@ethdev.com" - } - ], - "main": "./index.js", - "dependencies": { - "babel-eslint": "^7.1.1", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-preset-es2015": "^6.24.0", - "babelify": "^7.3.0", - "standard": "^7.0.1", - "tape": "^4.6.0" - }, - "scripts": { - "browserify": "browserify index.js -o bundle.js" - }, - "standard": { - "ignore": [ - "node_modules/*" - ], - "parser": "babel-eslint" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ethereum/remix-ide.git" - }, - "author": "cpp-ethereum team", - "license": "MIT", - "bugs": { - "url": "https://github.com/ethereum/remix-ide/issues" - }, - "homepage": "https://github.com/ethereum/remix-ide#readme", - "browserify": { - "transform": [ - [ - "babelify", - { - "plugins": [ - [ - "fast-async", - { - "runtimePatten": null, - "compiler": { - "promises": true, - "es7": true, - "noRuntime": true, - "wrapAwait": true - } - } - ], - "transform-object-assign" - ] - } - ], - [ - "babelify", - { - "presets": [ - "es2015" - ] - } - ] - ] - } -} diff --git a/src/app/plugin/plugin.md b/src/app/plugin/plugin.md deleted file mode 100644 index 67cb3cfa20..0000000000 --- a/src/app/plugin/plugin.md +++ /dev/null @@ -1,53 +0,0 @@ -plugin api - -# current APIs: - -## 1) notifications - -### app (key: app) - - - unfocus `[]` - - focus `[]` - -### compiler (key: compiler) - - - compilationFinished `[success (bool), data (obj), source (obj)]` - - compilationData `[compilationResult]` - -### transaction listener (key: txlistener) - - - newTransaction `tx (obj)` - -## 2) interactions - -### app - - - getExecutionContextProvider `@return {String} provider (injected | web3 | vm)` - - getProviderEndpoint `@return {String} url` - - updateTitle `@param {String} title` - - detectNetWork `@return {Object} {name, id}` - - addProvider `@param {String} name, @param {String} url` - - removeProvider `@return {String} name` - -### config - - - setConfig `@param {String} path, @param {String} content` - - getConfig `@param {String} path` - - removeConfig `@param {String} path` - -### compiler - - getCompilationResult `@return {Object} compilation result` - -### udapp (only VM) - - runTx `@param {Object} tx` - - getAccounts `@return {Array} acccounts` - - createVMAccount `@param {String} privateKey, @param {String} balance (hex)` - -### editor - - getFilesFromPath `@param {Array} [path]` - - getCurrentFile `@return {String} path` - - getFile `@param {String} path` - - setFile `@param {String} path, @param {String} content` - - highlight `@param {Object} lineColumnPos {start: {line, column}, end: {line, column}}, @param {String} path, @param {String} hexColor` - - discardHighlight - diff --git a/src/app/plugin/pluginAPI.js b/src/app/plugin/pluginAPI.js deleted file mode 100644 index cf708523e0..0000000000 --- a/src/app/plugin/pluginAPI.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict' -var executionContext = require('../../execution-context') -var SourceHighlighter = require('../editor/sourceHighlighter') -/* - Defines available API. `key` / `type` -*/ -module.exports = (pluginManager, fileProviders, fileManager, compilesrArtefacts, udapp) => { - let highlighters = {} - return { - app: { - getExecutionContextProvider: (mod, cb) => { - cb(null, executionContext.getProvider()) - }, - getProviderEndpoint: (mod, cb) => { - if (executionContext.getProvider() === 'web3') { - cb(null, executionContext.web3().currentProvider.host) - } else { - cb('no endpoint: current provider is either injected or vm') - } - }, - updateTitle: (mod, title, cb) => { - pluginManager.plugins[mod].modal.setTitle(title) - if (cb) cb() - }, - detectNetWork: (mod, cb) => { - executionContext.detectNetwork((error, network) => { - cb(error, network) - }) - }, - addProvider: (mod, name, url, cb) => { - executionContext.addProvider({ name, url }) - cb() - }, - removeProvider: (mod, name, cb) => { - executionContext.removeProvider(name) - cb() - } - }, - config: { - setConfig: (mod, path, content, cb) => { - fileProviders['config'].set(mod + '/' + path, content) - cb() - }, - getConfig: (mod, path, cb) => { - cb(null, fileProviders['config'].get(mod + '/' + path)) - }, - removeConfig: (mod, path, cb) => { - cb(null, fileProviders['config'].remove(mod + '/' + path)) - if (cb) cb() - } - }, - compiler: { - getCompilationResult: (mod, cb) => { - cb(null, compilesrArtefacts['__last']) - }, - sendCompilationResult: (mod, file, source, languageVersion, data, cb) => { - pluginManager.receivedDataFrom('sendCompilationResult', mod, [file, source, languageVersion, data]) - } - }, - udapp: { - runTx: (mod, tx, cb) => { - executionContext.detectNetwork((error, network) => { - if (error) return cb(error) - if (network.name === 'Main' && network.id === '1') { - return cb('It is not allowed to make this action against mainnet') - } - udapp.silentRunTx(tx, (error, result) => { - if (error) return cb(error) - cb(null, { - transactionHash: result.transactionHash, - status: result.result.status, - gasUsed: '0x' + result.result.gasUsed.toString('hex'), - error: result.result.vm.exceptionError, - return: result.result.vm.return ? '0x' + result.result.vm.return.toString('hex') : '0x', - createdAddress: result.result.createdAddress ? '0x' + result.result.createdAddress.toString('hex') : undefined - }) - }) - }) - }, - getAccounts: (mod, cb) => { - executionContext.detectNetwork((error, network) => { - if (error) return cb(error) - if (network.name === 'Main' && network.id === '1') { - return cb('It is not allowed to make this action against mainnet') - } - udapp.getAccounts(cb) - }) - }, - createVMAccount: (mod, privateKey, balance, cb) => { - if (executionContext.getProvider() !== 'vm') return cb('plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed') - udapp.createVMAccount(privateKey, balance, (error, address) => { - cb(error, address) - }) - } - }, - editor: { - getFilesFromPath: (mod, path, cb) => { - fileManager.filesFromPath(path, cb) - }, - getCurrentFile: (mod, cb) => { - var path = fileManager.currentFile() - if (!path) { - cb('no file selected') - } else { - cb(null, path) - } - }, - getFile: (mod, path, cb) => { - var provider = fileManager.fileProviderOf(path) - if (provider) { - // TODO add approval to user for external plugin to get the content of the given `path` - provider.get(path, (error, content) => { - cb(error, content) - }) - } else { - cb(path + ' not available') - } - }, - setFile: (mod, path, content, cb) => { - var provider = fileManager.fileProviderOf(path) - if (provider) { - // TODO add approval to user for external plugin to set the content of the given `path` - provider.set(path, content, (error) => { - if (error) return cb(error) - fileManager.syncEditor(path) - cb() - }) - } else { - cb(path + ' not available') - } - }, - highlight: (mod, lineColumnPos, filePath, hexColor, cb) => { - var position - try { - position = JSON.parse(lineColumnPos) - } catch (e) { - return cb(e.message) - } - if (!highlighters[mod]) highlighters[mod] = new SourceHighlighter() - highlighters[mod].currentSourceLocation(null) - highlighters[mod].currentSourceLocationFromfileName(position, filePath, hexColor) - cb() - }, - discardHighlight: (mod, cb) => { - if (highlighters[mod]) highlighters[mod].currentSourceLocation(null) - cb() - } - } - } -} diff --git a/src/app/plugin/pluginManager.js b/src/app/plugin/pluginManager.js deleted file mode 100644 index 98b865537c..0000000000 --- a/src/app/plugin/pluginManager.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict' -var remixLib = require('remix-lib') -var EventManager = remixLib.EventManager -const PluginAPI = require('./pluginAPI') -/** - * Register and Manage plugin: - * - * Plugin registration is done in the settings tab, - * using the following format: - * { - * "title": "", - * "url": "" - * } - * - * structure of messages: - * - * - Notification sent by Remix: - *{ - * action: 'notification', - * key: , - * type: , - * value: - *} - * - * - Request sent by the plugin: - *{ - * id: , - * action: 'request', - * key: , - * type: , - * value: - *} - * - * - Response sent by Remix and receive by the plugin: - *{ - * id: , - * action: 'response', - * key: , - * type: , - * value: , - * error: (see below) - *} - * => The `error` property is `undefined` if no error happened. - * => In case of error (due to permission, system error, API error, etc...): - * error: { code, msg (optional), data (optional), stack (optional) - * => possible error code are still to be defined, but the generic one would be 500. - * - * Plugin receive 4 types of message: - * - focus (when he get focus) - * - unfocus (when he loose focus - is hidden) - * - compilationData (that is triggered just after a focus - and send the current compilation data or null) - * - compilationFinished (that is only sent to the plugin that has focus) - * - * Plugin can emit messages and receive response. - * - * CONFIG: - * - getConfig(filename). The data to send should be formatted like: - * { - * id: , - * action: 'request', - * key: 'config', - * type: 'getConfig', - * value: ['filename.ext'] - * } - * the plugin will reveice a response like: - * { - * id: , - * action: 'response', - * key: 'config', - * type: 'getConfig', - * error, - * value: ['content of filename.ext'] - * } - * same apply for the other call - * - setConfig(filename, content) - * - removeConfig - * - * See index.html and remix.js in test-browser folder for sample - * - */ -module.exports = class PluginManager { - constructor (app, compilersArtefacts, txlistener, fileProviders, fileManager, udapp) { - const self = this - self.event = new EventManager() - var pluginAPI = new PluginAPI( - this, - fileProviders, - fileManager, - compilersArtefacts, - udapp - ) - self._components = { pluginAPI } - self.plugins = {} - self.origins = {} - self.inFocus - fileManager.events.on('currentFileChanged', (file) => { - self.broadcast(JSON.stringify({ - action: 'notification', - key: 'editor', - type: 'currentFileChanged', - value: [ file ] - })) - }) - - txlistener.event.register('newTransaction', (tx) => { - self.broadcast(JSON.stringify({ - action: 'notification', - key: 'txlistener', - type: 'newTransaction', - value: [tx] - })) - }) - - window.addEventListener('message', (event) => { - if (event.type !== 'message') return - var extension = self.origins[event.origin] - if (!extension) return - - function response (key, type, callid, error, result) { - self.postToOrigin(event.origin, JSON.stringify({ - id: callid, - action: 'response', - key: key, - type: type, - error: error, - value: [ result ] - })) - } - var data = JSON.parse(event.data) - data.value.unshift(extension) - data.value.push((error, result) => { - response(data.key, data.type, data.id, error, result) - }) - if (pluginAPI[data.key] && pluginAPI[data.key][data.type]) { - pluginAPI[data.key][data.type].apply({}, data.value) - } else { - response(data.key, data.type, data.id, `Endpoint ${data.key}/${data.type} not present`, null) - } - }, false) - } - unregister (desc) { - const self = this - self._components.pluginAPI.editor.discardHighlight(desc.title, () => {}) - delete self.plugins[desc.title] - delete self.origins[desc.url] - } - register (desc, modal, content) { - const self = this - self.plugins[desc.title] = { content, modal, origin: desc.url } - self.origins[desc.url] = desc.title - } - broadcast (value) { - for (var plugin in this.plugins) { - this.post(plugin, value) - } - } - postToOrigin (origin, value) { - if (this.origins[origin]) { - this.post(this.origins[origin], value) - } - } - receivedDataFrom (methodName, mod, argumentsArray) { - // TODO check whether 'mod' as right to do that - console.log(argumentsArray) - this.event.trigger(methodName, argumentsArray) // forward to internal modules - this.broadcast(JSON.stringify({ // forward to plugins - action: 'notification', - key: mod, - type: methodName, - value: argumentsArray - })) - } - post (name, value) { - const self = this - if (self.plugins[name]) { - self.plugins[name].content.querySelector('iframe').contentWindow.postMessage(value, self.plugins[name].origin) - } - } -} diff --git a/src/app/plugin/plugins.js b/src/app/plugin/plugins.js deleted file mode 100644 index 2768c4e279..0000000000 --- a/src/app/plugin/plugins.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -module.exports = { - 'oraclize': { - url: 'https://remix-plugin.oraclize.it', - title: 'Oraclize' - }, - 'solium': { - url: 'https://two-water.surge.sh', - title: 'Solium' - }, - 'ethdoc': { - url: 'https://30400.swarm-gateways.net/bzz:/ethdoc.remixide.eth', - title: 'Ethdoc' - }, - 'openzeppelin snippet': { - url: 'https://left-edge.surge.sh', - title: 'Openzeppelin snippet' - }, - 'vyper': { - url: 'https://plugin.vyper.live', - title: 'Vyper' - }, - 'slither/mythril': { - url: 'http://jittery-space.surge.sh', - title: 'Slither/Mythril' - }, - 'pipeline': { - url: 'https://pipeline.pipeos.one', - title: 'Pipeline' - } - /* - 'etherscan-general': { - url: 'http://127.0.0.1:8081', - title: 'Etherscan-general' - } - */ -} From 5652af37aa7f31b6bb4c53c46ad493d371e85020 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Tue, 9 Apr 2019 17:04:59 +0200 Subject: [PATCH 16/31] Udapp listen on TxListener --- src/app.js | 1 + src/universal-dapp.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index c3c5694e1a..b7ae5a1a3f 100644 --- a/src/app.js +++ b/src/app.js @@ -355,6 +355,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org udapp: udapp.event }}) registry.put({api: txlistener, name: 'txlistener'}) + udapp.startListening(txlistener) const eventsDecoder = new EventsDecoder({ api: { diff --git a/src/universal-dapp.js b/src/universal-dapp.js index ca8ab12a5b..f5ab1a44ec 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -24,12 +24,8 @@ module.exports = class UniversalDApp extends UdappApi { this.events = new EventEmitter() this.event = new EventManager() this._deps = { - config: registry.get('config').api, - txlistener: registry.get('txlistener').api + config: registry.get('config').api } - this._deps.txlistener.event.register('newTransaction', (tx) => { - this.events.emit('newTransaction', tx) - }) this._txRunnerAPI = { config: this._deps.config, @@ -46,6 +42,14 @@ module.exports = class UniversalDApp extends UdappApi { executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) } + // TODO : event should be triggered by Udapp instead of TxListener + /** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */ + startListening (txlistener) { + txlistener.event.register('newTransaction', (tx) => { + this.events.emit('newTransaction', tx) + }) + } + resetEnvironment () { this.accounts = {} if (executionContext.isVM()) { From 1bb179108440f5b6481e3896c0cf24d8116f9198 Mon Sep 17 00:00:00 2001 From: Shei Date: Tue, 9 Apr 2019 12:13:52 -0700 Subject: [PATCH 17/31] removing ctrl-t from the list --- src/app/editor/editor.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index 9304cffd9e..b0123f6a08 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.js @@ -99,9 +99,8 @@ class Editor { this.editor = ace.edit(el) ace.acequire('ace/ext/language_tools') - // Unmap ctrl-t & ctrl-f & ctrl-l & cmd-l + // Unmap ctrl-l & cmd-l this.editor.commands.bindKeys({ - 'ctrl-t': null, 'ctrl-L': null, 'Command-L': null }) From 9c9267c586a971f2b7c99cbb0d61cff59acdc809 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Apr 2019 11:33:53 +0200 Subject: [PATCH 18/31] fix test file generation && don't switch to a File upon workspace loads --- src/app/tabs/test-tab.js | 2 +- src/app/ui/landing-page/workspace.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 97efc68c93..ae921aa6e3 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -173,7 +173,7 @@ module.exports = class TestTab extends ApiFactory {
For more details, see How to test smart contracts guide in our documentation. -
Generate test file
+
Generate test file
diff --git a/src/app/ui/landing-page/workspace.js b/src/app/ui/landing-page/workspace.js index ed8b3f2d57..b2b8044812 100644 --- a/src/app/ui/landing-page/workspace.js +++ b/src/app/ui/landing-page/workspace.js @@ -21,7 +21,6 @@ export const defaultWorkspaces = (appManager) => { appManager.ensureActivated('run') appManager.ensureActivated('solidityStaticAnalysis') appManager.ensureActivated('solidityUnitTesting') - globalRegistry.get('filemanager').api.switchFile() globalRegistry.get('verticalicon').api.select('solidity') }, () => {}), new Workspace( @@ -31,7 +30,6 @@ export const defaultWorkspaces = (appManager) => { () => { appManager.ensureActivated('vyper') appManager.ensureActivated('run') - globalRegistry.get('filemanager').api.switchFile() globalRegistry.get('verticalicon').api.select('vyper') }, () => {}), new Workspace('Debugger', 'Debug transactions with remix', false, () => { From 04516fbf3ebc1f6c590395621fd95ed3951e01e4 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 10 Apr 2019 13:55:26 +0200 Subject: [PATCH 19/31] fixed tab remove. Authors: @yann300, @lianahus --- src/app/panels/tab-proxy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index dbe0183ac4..4927c9d808 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -105,6 +105,8 @@ export class TabProxy { } addTab (name, switchTo, close, kind) { + if (this._handlers[name]) return + var slash = name.split('/') let title = name.indexOf('/') !== -1 ? slash[slash.length - 1] : name this._view.filetabs.addTab({ @@ -117,7 +119,7 @@ export class TabProxy { } removeTab (name) { - this._view.filetabs.closeTab(name) + this._view.filetabs.removeTab(name) delete this._handlers[name] } From d93e0090ef142ab6863cbe033706c3fedc7636b2 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 13:43:15 +0200 Subject: [PATCH 20/31] Create Network out of App --- extensions/etherscan-general/index.js | 2 +- src/app.js | 68 +++++---------------------- src/app/files/fileManager.js | 1 - src/app/tabs/network-module.js | 66 ++++++++++++++++++++++++++ test-browser/plugin/plugin.js | 6 +-- 5 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 src/app/tabs/network-module.js diff --git a/extensions/etherscan-general/index.js b/extensions/etherscan-general/index.js index f5a8ffd17c..cb189cdf8d 100644 --- a/extensions/etherscan-general/index.js +++ b/extensions/etherscan-general/index.js @@ -40,7 +40,7 @@ function load () { } }) setInterval(function () { - remix.call('app', 'detectNetWork', [], function (error, result) { + remix.call('network', 'detectNetWork', [], function (error, result) { if (error) console.log(error) if (network.innerHTML !== result[0].name + ' - ' + result[0].id) { currentNetWork = result[0].name diff --git a/src/app.js b/src/app.js index b7ae5a1a3f..5aa4092b5d 100644 --- a/src/app.js +++ b/src/app.js @@ -6,7 +6,6 @@ var yo = require('yo-yo') var async = require('async') var request = require('request') var remixLib = require('remix-lib') -var EventManager = require('./lib/events') var registry = require('./global/registry') var UniversalDApp = require('./universal-dapp.js') var UniversalDAppUI = require('./universal-dapp-ui.js') @@ -54,8 +53,8 @@ import { EntityStore } from './lib/store' import { RemixAppManager } from './remixAppManager' import { LandingPage } from './app/ui/landing-page/landing-page' import framingService from './framingService' -import { BaseApi } from 'remix-plugin' import { ThemeModule } from './app/tabs/theme-module' +import { NetworkModule } from './app/tabs/network-module' var css = csjs` html { box-sizing: border-box; } @@ -115,17 +114,9 @@ var css = csjs` } ` -const profile = { - name: 'app', - description: 'service - provides information about current context (network).', - methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] -} - -class App extends BaseApi { +class App { constructor (api = {}, events = {}, opts = {}) { - super(profile) var self = this - this.event = new EventManager() self._components = {} registry.put({api: self, name: 'app'}) @@ -247,45 +238,6 @@ class App extends BaseApi { if (callback) callback(error) }) } - - getExecutionContextProvider () { - return new Promise((resolve, reject) => { - resolve(executionContext.getProvider()) - }) - } - - getProviderEndpoint () { - return new Promise((resolve, reject) => { - if (executionContext.getProvider() === 'web3') { - resolve(executionContext.web3().currentProvider.host) - } else { - reject('no endpoint: current provider is either injected or vm') - } - }) - } - - detectNetWork () { - return new Promise((resolve, reject) => { - executionContext.detectNetwork((error, network) => { - if (error) return reject(error) - resolve(network) - }) - }) - } - - addProvider (name, url) { - return new Promise((resolve, reject) => { - executionContext.addProvider({ name, url }) - resolve() - }) - } - - removeProvider (name) { - return new Promise((resolve, reject) => { - executionContext.removeProvider(name) - resolve() - }) - } } module.exports = App @@ -381,6 +333,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const fileManager = self._components.fileManager registry.put({api: fileManager, name: 'filemanager'}) + // ----------------- Network ---------------------------- + const networkModule = new NetworkModule() + registry.put({api: networkModule, name: 'network'}) + // ----------------- theme module ---------------------------- const themeModule = new ThemeModule() registry.put({api: themeModule, name: 'themeModule'}) @@ -406,17 +362,18 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const pluginManagerComponent = new PluginManagerComponent() const swapPanelComponent = new SwapPanelComponent('swapPanel', appStore, appManager, { default: true, displayHeader: true }) + registry.put({api: appManager.proxy(), name: 'pluginmanager'}) + + pluginManagerComponent.setApp(appManager) + pluginManagerComponent.setStore(appStore) + + // ----------------- Vertical Icon ---------------------------- const verticalIconsComponent = new VerticalIconsComponent('swapPanel', appStore) const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconsComponent) // eslint-disable-line const mainPanelApi = new SwapPanelApi(mainPanelComponent, verticalIconsComponent) // eslint-disable-line const verticalIconsApi = new VerticalIconsApi(verticalIconsComponent) // eslint-disable-line - - registry.put({api: appManager.proxy(), name: 'pluginmanager'}) registry.put({api: verticalIconsApi, name: 'verticalicon'}) - pluginManagerComponent.setApp(appManager) - pluginManagerComponent.setStore(appStore) - self._components.editorpanel.init() self._components.fileManager.init() @@ -471,6 +428,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org // { profile: support.profile(), api: support }, settings.api(), pluginManagerComponent.api(), + networkModule.api(), themeModule.api() ]) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 627c0c062b..da1f7204df 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -1,6 +1,5 @@ 'use strict' -import { ApiFactory } from 'remix-plugin' import yo from 'yo-yo' const EventEmitter = require('events') var globalRegistry = require('../../global/registry') diff --git a/src/app/tabs/network-module.js b/src/app/tabs/network-module.js new file mode 100644 index 0000000000..e6ff7ec0f6 --- /dev/null +++ b/src/app/tabs/network-module.js @@ -0,0 +1,66 @@ +const executionContext = require('../../execution-context') +import { NetworkApi } from 'remix-plugin' + +export const profile = { + name: 'network', + description: 'Manage the network (mainnet, ropsten, goerli...) and the provider (web3, vm, injected)' +} + +// Network API has : +// - events: ['providerChanged'] +// - methods: ['getNetworkProvider', 'getEndpoint', 'detectNetwork', 'addNetwork', 'removeNetwork'] + +export class NetworkModule extends NetworkApi { + constructor () { + super(profile) + // TODO: See with remix-lib to make sementic coherent + executionContext.event.register('contextChanged', (provider) => { + this.events.emit('providerChanged', provider) + }) + /* + // Events that could be implemented later + executionContext.event.register('removeProvider', (provider) => { + this.events.emit('networkRemoved', provider) + }) + executionContext.event.register('addProvider', (provider) => { + this.events.emit('networkAdded', provider) + }) + executionContext.event.register('web3EndpointChanged', (provider) => { + this.events.emit('web3EndpointChanged', provider) + }) + */ + } + + /** Return the current network provider (web3, vm, injected) */ + getNetworkProvider () { + return executionContext.getProvider() + } + + /** Return the current network */ + detectNetwork () { + return new Promise((resolve, reject) => { + executionContext.detectNetwork((error, network) => { + error ? reject(error) : resolve(network) + }) + }) + } + + /** Return the url only if network provider is 'web3' */ + getEndpoint () { + const provider = executionContext.getProvider() + if (provider !== 'web3') { + throw new Error('no endpoint: current provider is either injected or vm') + } + return provider.web3().currentProvider.host + } + + /** Add a custom network to the list of available networks */ + addNetwork (customNetwork) { + executionContext.addProvider(customNetwork) + } + + /** Remove a network to the list of availble networks */ + removeNetwork (name) { + executionContext.removeProvider(name) + } +} diff --git a/test-browser/plugin/plugin.js b/test-browser/plugin/plugin.js index cb7481a134..1226446c22 100644 --- a/test-browser/plugin/plugin.js +++ b/test-browser/plugin/plugin.js @@ -18,7 +18,7 @@ window.onload = function () { }) setInterval(function () { - extension.call('app', 'detectNetWork', [], function (error, result) { + extension.call('network', 'detectNetWork', [], function (error, result) { console.log(error, result) }) }, 5000) @@ -80,12 +80,12 @@ window.onload = function () { }) document.querySelector('input#addnetwork').addEventListener('click', function () { - extension.call('app', 'addProvider', [document.getElementById('filename').value, document.getElementById('valuetosend').value], + extension.call('network', 'addProvider', [document.getElementById('filename').value, document.getElementById('valuetosend').value], function (error, result) { console.log(error, result) }) }) document.querySelector('input#removenetwork').addEventListener('click', function () { - extension.call('app', 'removeProvider', [document.getElementById('filename').value], + extension.call('network', 'removeProvider', [document.getElementById('filename').value], function (error, result) { console.log(error, result) }) }) } From 9ccd6f0d942444890d8e6574fcb22009609c84a7 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 13:58:18 +0200 Subject: [PATCH 21/31] Update FileManager --- src/app/files/fileManager.js | 8 +++++--- src/app/tabs/testTab/testTab.js | 2 +- test-browser/plugin/index.html | 2 +- test-browser/plugin/plugin.js | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index da1f7204df..373f6451e3 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -15,12 +15,14 @@ import { FileSystemApi } from 'remix-plugin' const profile = { displayName: 'file manager', name: 'fileManager', - methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], - events: ['currentFileChanged'], description: 'service - read/write to any files or folders, require giving permissions', permission: true } +// File System profile +// - events: ['currentFileChanged'] +// - methods: ['getFolder', 'getCurrentFile', 'getFile', 'setFile'] + class FileManager extends FileSystemApi { constructor (localRegistry) { super(profile) @@ -220,7 +222,7 @@ class FileManager extends FileSystemApi { } } - getFilesFromPath (path) { + getFolder (path) { // TODO : Change provider with promise return new Promise((resolve, reject) => { const provider = this.fileProviderOf(path) diff --git a/src/app/tabs/testTab/testTab.js b/src/app/tabs/testTab/testTab.js index 1fb04e19e1..620b40aa57 100644 --- a/src/app/tabs/testTab/testTab.js +++ b/src/app/tabs/testTab/testTab.js @@ -26,7 +26,7 @@ class TestTabLogic { var tests = [] let files try { - files = await this.fileManager.getFilesFromPath(path) + files = await this.fileManager.getFolder(path) } catch (e) { cb(e.message) } diff --git a/test-browser/plugin/index.html b/test-browser/plugin/index.html index 62cac2d321..a5a861d9cc 100644 --- a/test-browser/plugin/index.html +++ b/test-browser/plugin/index.html @@ -48,7 +48,7 @@ get content of
get current
set highlight
- get files from path
+ get files from path
add network
remove network

diff --git a/test-browser/plugin/plugin.js b/test-browser/plugin/plugin.js index 1226446c22..62bb971037 100644 --- a/test-browser/plugin/plugin.js +++ b/test-browser/plugin/plugin.js @@ -74,8 +74,8 @@ window.onload = function () { function (error, result) { console.log(error, result) }) }) - document.querySelector('input#getfilesfrompath').addEventListener('click', function () { - extension.call('editor', 'getFilesFromPath', [document.getElementById('filename').value], + document.querySelector('input#getFolder').addEventListener('click', function () { + extension.call('fileManager', 'getFolder', [document.getElementById('filename').value], function (error, result) { console.log(error, result) }) }) From 39ed530b1d67a2d2dc25a9e0503723defbee3576 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 14:02:34 +0200 Subject: [PATCH 22/31] update compiler --- src/app/tabs/compile-tab.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index fdd53f82da..8e1fb9672c 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -17,20 +17,18 @@ var css = require('./styles/compile-tab-styles') const CompileTabLogic = require('./compileTab/compileTab.js') const CompilerContainer = require('./compileTab/compilerContainer.js') -import { BaseApi } from 'remix-plugin' +import { CompilerApi } from 'remix-plugin' const profile = { displayName: 'solidity compiler', name: 'solidity', - methods: ['getCompilationResult'], - events: ['compilationFinished'], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxM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gxMTAuNDU2CgkJCQlMMjQxLjA2OCwzNjcuNjF6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8yXyIgb3BhY2l0eT0iMC44IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3ICAgICIgZD0iTTExMC40NTYsNTk5LjgyMkwyNDEuMDY4LDM2Ny42MUwxMTAuNDU2LDEzNS4zMDgKCQkJCUwtMjAuMTU4LDM2Ny42MUwxMTAuNDU2LDU5OS44MjJ6Ii8+CgkJCTxwYXRoIGlkPSJTaGFwZV8zXyIgb3BhY2l0eT0iMC40NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0xMTEuNzIxLDk0OC4yNzVsMTMwLjcwNC0yMzIuMzAzaDI2MS4zMThMMzczLjAzOCw5NDguMjc1CgkJCQlIMTExLjcyMSIvPgoJCQk8cGF0aCBpZD0iU2hhcGVfNF8iIG9wYWNpdHk9IjAuNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0yNDIuNDI0LDcxNS45NzNILTE4Ljg5M2wxMzAuNjEzLDIzMi4zMDNoMjYxLjMxNwoJCQkJTDI0Mi40MjQsNzE1Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', description: 'compile solidity contracts', kind: 'compile', permission: true } -class CompileTab extends BaseApi { +class CompileTab extends CompilerApi { constructor (editor, config, renderer, swarmfileProvider, fileManager, fileProviders, pluginManager) { super(profile) From a0b82cc87220a3450a83bfda1169e414ef69f5f5 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 14:10:05 +0200 Subject: [PATCH 23/31] Update SourceHightlighters --- src/app/editor/SourceHighlighters.js | 4 +++- src/app/tabs/compile-tab.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/editor/SourceHighlighters.js b/src/app/editor/SourceHighlighters.js index fc8e119839..e7378ec7d2 100644 --- a/src/app/editor/SourceHighlighters.js +++ b/src/app/editor/SourceHighlighters.js @@ -6,10 +6,12 @@ import { EditorApi } from 'remix-plugin' const profile = { displayName: 'source highlighters', name: 'sourceHighlighters', - methods: ['highlight', 'discardHighlight'], description: 'service - highlight source code' } +// EditorApi: +// - methods: ['highlight', 'discardHighlight'], + class SourceHighlighters extends EditorApi { constructor () { diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 8e1fb9672c..d9970b6cff 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -28,6 +28,10 @@ const profile = { permission: true } +// EditorApi: +// - events: ['compilationFinished'], +// - methods: ['getCompilationResult'] + class CompileTab extends CompilerApi { constructor (editor, config, renderer, swarmfileProvider, fileManager, fileProviders, pluginManager) { From ac689bb0f0fab3c6062c7aae4278eab7cb4de712 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 14:12:23 +0200 Subject: [PATCH 24/31] standard --- src/app/editor/SourceHighlighters.js | 4 ++-- src/app/tabs/compile-tab.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/editor/SourceHighlighters.js b/src/app/editor/SourceHighlighters.js index e7378ec7d2..e2ea39bb76 100644 --- a/src/app/editor/SourceHighlighters.js +++ b/src/app/editor/SourceHighlighters.js @@ -5,11 +5,11 @@ import { EditorApi } from 'remix-plugin' const profile = { displayName: 'source highlighters', - name: 'sourceHighlighters', + name: 'editor', description: 'service - highlight source code' } -// EditorApi: +// EditorApi: // - methods: ['highlight', 'discardHighlight'], class SourceHighlighters extends EditorApi { diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index d9970b6cff..5c57bd47a3 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -28,7 +28,7 @@ const profile = { permission: true } -// EditorApi: +// EditorApi: // - events: ['compilationFinished'], // - methods: ['getCompilationResult'] From 7e49641ac791ff25d7f01a7d21cb53dc903208fe Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 17:04:35 +0200 Subject: [PATCH 25/31] update remix-plugin version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a2957f12d..f2e5a76d0a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "http-server": "0.9.0", - "remix-plugin": "0.0.1-alpha.43", + "remix-plugin": "0.0.2-alpha.3", "remixd": "0.1.8-alpha.6" }, "repository": { From 4c743602a135de577881d8f6ef938d02a6812da4 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 17:05:01 +0200 Subject: [PATCH 26/31] App is no longer a module --- src/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app.js b/src/app.js index 5aa4092b5d..6633a93926 100644 --- a/src/app.js +++ b/src/app.js @@ -419,7 +419,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org let sourceHighlighters = registry.get('editor').api.sourceHighlighters appManager.init([ - this.api(), landingPage.api(), udapp.api(), fileManager.api(), From 9987248abf0d280dbd07d642954a2452a02fe794 Mon Sep 17 00:00:00 2001 From: Grandschtroumpf Date: Thu, 11 Apr 2019 17:05:13 +0200 Subject: [PATCH 27/31] Set location in profiles --- src/app/components/plugin-manager-component.js | 3 ++- src/app/panels/file-panel.js | 3 ++- src/app/tabs/analysis-tab.js | 3 ++- src/app/tabs/compile-tab.js | 3 ++- src/app/tabs/debugger-tab.js | 3 ++- src/app/tabs/run-tab.js | 3 ++- src/app/tabs/test-tab.js | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/components/plugin-manager-component.js b/src/app/components/plugin-manager-component.js index df31814660..91c2912215 100644 --- a/src/app/components/plugin-manager-component.js +++ b/src/app/components/plugin-manager-component.js @@ -41,7 +41,8 @@ const profile = { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzU1IDQ1M3EzNyAzOCAzNyA5MC41dC0zNyA5MC41bC00MDEgNDAwIDE1MCAxNTAtMTYwIDE2MHEtMTYzIDE2My0zODkuNSAxODYuNXQtNDExLjUtMTAwLjVsLTM2MiAzNjJoLTE4MXYtMTgxbDM2Mi0zNjJxLTEyNC0xODUtMTAwLjUtNDExLjV0MTg2LjUtMzg5LjVsMTYwLTE2MCAxNTAgMTUwIDQwMC00MDFxMzgtMzcgOTEtMzd0OTAgMzcgMzcgOTAuNS0zNyA5MC41bC00MDAgNDAxIDIzNCAyMzQgNDAxLTQwMHEzOC0zNyA5MS0zN3Q5MCAzN3oiLz48L3N2Zz4=', description: 'start/stop services, modules and plugins', - kind: 'settings' + kind: 'settings', + location: 'swapPanel' } class PluginManagerComponent extends BaseApi { diff --git a/src/app/panels/file-panel.js b/src/app/panels/file-panel.js index 4388de2d69..5042ca2943 100644 --- a/src/app/panels/file-panel.js +++ b/src/app/panels/file-panel.js @@ -34,7 +34,8 @@ const profile = { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDM4NHE0MCAwIDY4IDI4dDI4IDY4djEyMTZxMCA0MC0yOCA2OHQtNjggMjhoLTk2MHEtNDAgMC02OC0yOHQtMjgtNjh2LTI4OGgtNTQ0cS00MCAwLTY4LTI4dC0yOC02OHYtNjcycTAtNDAgMjAtODh0NDgtNzZsNDA4LTQwOHEyOC0yOCA3Ni00OHQ4OC0yMGg0MTZxNDAgMCA2OCAyOHQyOCA2OHYzMjhxNjgtNDAgMTI4LTQwaDQxNnptLTU0NCAyMTNsLTI5OSAyOTloMjk5di0yOTl6bS02NDAtMzg0bC0yOTkgMjk5aDI5OXYtMjk5em0xOTYgNjQ3bDMxNi0zMTZ2LTQxNmgtMzg0djQxNnEwIDQwLTI4IDY4dC02OCAyOGgtNDE2djY0MGg1MTJ2LTI1NnEwLTQwIDIwLTg4dDQ4LTc2em05NTYgODA0di0xMTUyaC0zODR2NDE2cTAgNDAtMjggNjh0LTY4IDI4aC00MTZ2NjQwaDg5NnoiLz48L3N2Zz4=', description: ' - ', - kind: 'fileexplorer' + kind: 'fileexplorer', + location: 'swapPanel' } module.exports = class Filepanel extends BaseApi { diff --git a/src/app/tabs/analysis-tab.js b/src/app/tabs/analysis-tab.js index 54760b43e7..4dfab7e930 100644 --- a/src/app/tabs/analysis-tab.js +++ b/src/app/tabs/analysis-tab.js @@ -13,7 +13,8 @@ const profile = { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjA0OCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0yMDQ4IDE1MzZ2MTI4aC0yMDQ4di0xNTM2aDEyOHYxNDA4aDE5MjB6bS0xMjgtMTI0OHY0MzVxMCAyMS0xOS41IDI5LjV0LTM1LjUtNy41bC0xMjEtMTIxLTYzMyA2MzNxLTEwIDEwLTIzIDEwdC0yMy0xMGwtMjMzLTIzMy00MTYgNDE2LTE5Mi0xOTIgNTg1LTU4NXExMC0xMCAyMy0xMHQyMyAxMGwyMzMgMjMzIDQ2NC00NjQtMTIxLTEyMXEtMTYtMTYtNy41LTM1LjV0MjkuNS0xOS41aDQzNXExNCAwIDIzIDl0OSAyM3oiLz48L3N2Zz4=', description: ' - ', - kind: 'analysis' + kind: 'analysis', + location: 'swapPanel' } class AnalysisTab extends BaseApi { diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 5c57bd47a3..f57c18cf04 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -25,7 +25,8 @@ const profile = { icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMywgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iMTMwMHB4IiBoZWlnaHQ9IjEzMDBweCIKCSB2aW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iMC40NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0xMTEuNzIxLDk0OC4yNzVsMTMwLjcwNC0yMzIuMzAzaDI2MS4zMThMMzczLjAzOCw5NDguMjc1CgkJCQlIMTExLjcyMSIvPgoJCQk8cGF0aCBpZD0iU2hhcGVfNF8iIG9wYWNpdHk9IjAuNiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiIGQ9Ik0yNDIuNDI0LDcxNS45NzNILTE4Ljg5M2wxMzAuNjEzLDIzMi4zMDNoMjYxLjMxNwoJCQkJTDI0Mi40MjQsNzE1Ljk3M3oiLz4KCQkJPHBhdGggaWQ9IlNoYXBlXzVfIiBvcGFjaXR5PSIwLjgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIiBkPSJNMzczLjAzOCw0ODMuNzYxTDI0Mi40MjQsNzE1Ljk3M2wxMzAuNjE0LDIzMi4zMDMKCQkJCWwxMzAuNzA0LTIzMi4zMDNMMzczLjAzOCw0ODMuNzYxeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8L3N2Zz4K', description: 'compile solidity contracts', kind: 'compile', - permission: true + permission: true, + location: 'swapPanel' } // EditorApi: diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index 3486f7fc42..1587aadcbd 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -12,7 +12,8 @@ const profile = { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNjk2IDk2MHEwIDI2LTE5IDQ1dC00NSAxOWgtMjI0cTAgMTcxLTY3IDI5MGwyMDggMjA5cTE5IDE5IDE5IDQ1dC0xOSA0NXEtMTggMTktNDUgMTl0LTQ1LTE5bC0xOTgtMTk3cS01IDUtMTUgMTN0LTQyIDI4LjUtNjUgMzYuNS04MiAyOS05NyAxM3YtODk2aC0xMjh2ODk2cS01MSAwLTEwMS41LTEzLjV0LTg3LTMzLTY2LTM5LTQzLjUtMzIuNWwtMTUtMTQtMTgzIDIwN3EtMjAgMjEtNDggMjEtMjQgMC00My0xNi0xOS0xOC0yMC41LTQ0LjV0MTUuNS00Ni41bDIwMi0yMjdxLTU4LTExNC01OC0yNzRoLTIyNHEtMjYgMC00NS0xOXQtMTktNDUgMTktNDUgNDUtMTloMjI0di0yOTRsLTE3My0xNzNxLTE5LTE5LTE5LTQ1dDE5LTQ1IDQ1LTE5IDQ1IDE5bDE3MyAxNzNoODQ0bDE3My0xNzNxMTktMTkgNDUtMTl0NDUgMTkgMTkgNDUtMTkgNDVsLTE3MyAxNzN2Mjk0aDIyNHEyNiAwIDQ1IDE5dDE5IDQ1em0tNDgwLTU3NmgtNjQwcTAtMTMzIDkzLjUtMjI2LjV0MjI2LjUtOTMuNSAyMjYuNSA5My41IDkzLjUgMjI2LjV6Ii8+PC9zdmc+', description: 'debug transactions', - kind: 'debugging' + kind: 'debugging', + location: 'swapPanel' } class DebuggerTab extends BaseApi { diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index e2fe378bd8..0ab61e97cf 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -21,7 +21,8 @@ const profile = { events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNTc2IDkyN2wtMTMyOCA3MzhxLTIzIDEzLTM5LjUgM3QtMTYuNS0zNnYtMTQ3MnEwLTI2IDE2LjUtMzZ0MzkuNSAzbDEzMjggNzM4cTIzIDEzIDIzIDMxdC0yMyAzMXoiLz48L3N2Zz4=', description: 'execute and save transactions', - kind: 'run' + kind: 'run', + location: 'swapPanel' } class RunTab extends BaseApi { diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 15a05750ba..ac3cd9b6b6 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -13,7 +13,8 @@ const profile = { methods: [], events: [], icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMjMwNCIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMjMwNCAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xNzI4IDQ0OGwtMzg0IDcwNGg3Njh6bS0xMjgwIDBsLTM4NCA3MDRoNzY4em04MjEtMTkycS0xNCA0MC00NS41IDcxLjV0LTcxLjUgNDUuNXYxMjkxaDYwOHExNCAwIDIzIDl0OSAyM3Y2NHEwIDE0LTkgMjN0LTIzIDloLTEzNDRxLTE0IDAtMjMtOXQtOS0yM3YtNjRxMC0xNCA5LTIzdDIzLTloNjA4di0xMjkxcS00MC0xNC03MS41LTQ1LjV0LTQ1LjUtNzEuNWgtNDkxcS0xNCAwLTIzLTl0LTktMjN2LTY0cTAtMTQgOS0yM3QyMy05aDQ5MXEyMS01NyA3MC05Mi41dDExMS0zNS41IDExMSAzNS41IDcwIDkyLjVoNDkxcTE0IDAgMjMgOXQ5IDIzdjY0cTAgMTQtOSAyM3QtMjMgOWgtNDkxem0tMTgxIDE2cTMzIDAgNTYuNS0yMy41dDIzLjUtNTYuNS0yMy41LTU2LjUtNTYuNS0yMy41LTU2LjUgMjMuNS0yMy41IDU2LjUgMjMuNSA1Ni41IDU2LjUgMjMuNXptMTA4OCA4ODBxMCA3My00Ni41IDEzMXQtMTE3LjUgOTEtMTQ0LjUgNDkuNS0xMzkuNSAxNi41LTEzOS41LTE2LjUtMTQ0LjUtNDkuNS0xMTcuNS05MS00Ni41LTEzMXEwLTExIDM1LTgxdDkyLTE3NC41IDEwNy0xOTUuNSAxMDItMTg0IDU2LTEwMHExOC0zMyA1Ni0zM3Q1NiAzM3E0IDcgNTYgMTAwdDEwMiAxODQgMTA3IDE5NS41IDkyIDE3NC41IDM1IDgxem0tMTI4MCAwcTAgNzMtNDYuNSAxMzF0LTExNy41IDkxLTE0NC41IDQ5LjUtMTM5LjUgMTYuNS0xMzkuNS0xNi41LTE0NC41LTQ5LjUtMTE3LjUtOTEtNDYuNS0xMzFxMC0xMSAzNS04MXQ5Mi0xNzQuNSAxMDctMTk1LjUgMTAyLTE4NCA1Ni0xMDBxMTgtMzMgNTYtMzN0NTYgMzNxNCA3IDU2IDEwMHQxMDIgMTg0IDEwNyAxOTUuNSA5MiAxNzQuNSAzNSA4MXoiLz48L3N2Zz4=', - description: ' - ' + description: ' - ', + location: 'swapPanel' } module.exports = class TestTab extends BaseApi { From 24687e2ae83a0adde7f9320d11d6819ec8ce6f93 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 9 Apr 2019 18:00:23 +0200 Subject: [PATCH 28/31] landing page design --- src/app/ui/landing-page/landing-page.js | 254 ++++++++++-------------- 1 file changed, 106 insertions(+), 148 deletions(-) diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 9c918d9099..394c8eb1d3 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -15,7 +15,6 @@ let css = csjs` max-width : 300px; min-height : 200px; background-color: var(--light); - font-family : "Lucida Console", Monaco, monospace; } .landingPage { height : 100%; @@ -55,9 +54,7 @@ let css = csjs` } ` -import { defaultWorkspaces } from './workspace' import { BaseApi } from 'remix-plugin' -import Section from './section' const profile = { displayName: 'Home', @@ -74,7 +71,22 @@ export class LandingPage extends BaseApi { constructor (appManager, appStore) { super(profile) this.appStore = appStore - this.sections = [] + this.appManager = appManager + } + + get profile () { + return { + displayName: 'Home', + name: 'home', + methods: [], + events: [], + description: ' - ', + icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxnPjxwYXRoIGQ9IiAgIE0yNSwxQzExLjc0NSwxLDEsMTEuNzQ1LDEsMjVzMTAuNzQ1LDI0LDI0LDI0czI0LTEwLjc0NSwyNC0yNFMzOC4yNTUsMSwyNSwxTDI1LDF6IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2Utd2lkdGg9IjIiLz48L2c+PHBhdGggZD0iICBNNDAuNjk2LDYuODMyYzAsMC0xMy4xNjksOC4yMTItMTEuNTMyLDIyLjMzMmMxLjE0Miw5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+ } + + render () { let load = function (item) { let compilerImport = new CompilerImport() let fileProviders = globalRegistry.get('fileproviders').api @@ -96,162 +108,108 @@ export class LandingPage extends BaseApi { } }) } - let fileExplorer = globalRegistry.get('fileexplorer/browser').api - var actionsStart = [ - { label: 'New file', - type: 'callback', - payload: () => { - fileExplorer.createNewFile() - } - }, - { - // Open a file - label: yo` -