use eslint-standard

standard
yann300 4 years ago
parent ba6b2b2263
commit 1af16b14f1
  1. 34
      .eslintrc
  2. 15
      apps/remix-ide/.eslintrc
  3. 88
      apps/remix-ide/src/app.js
  4. 12
      apps/remix-ide/src/app/compiler/compiler-artefacts.js
  5. 46
      apps/remix-ide/src/app/compiler/compiler-imports.js
  6. 21
      apps/remix-ide/src/app/compiler/compiler-input.js
  7. 9
      apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
  8. 2
      apps/remix-ide/src/app/compiler/compiler-utils.js
  9. 1
      apps/remix-ide/src/app/components/hidden-panel.js
  10. 6
      apps/remix-ide/src/app/components/local-plugin.js
  11. 4
      apps/remix-ide/src/app/components/panel.js
  12. 11
      apps/remix-ide/src/app/components/plugin-manager-component.js
  13. 4
      apps/remix-ide/src/app/components/plugin-manager-settings.js
  14. 1
      apps/remix-ide/src/app/components/side-panel.js
  15. 67
      apps/remix-ide/src/app/components/vertical-icons.js
  16. 3
      apps/remix-ide/src/app/editor/SourceHighlighters.js
  17. 8
      apps/remix-ide/src/app/editor/contextView.js
  18. 35
      apps/remix-ide/src/app/editor/contextualListener.js
  19. 24
      apps/remix-ide/src/app/editor/editor.js
  20. 4
      apps/remix-ide/src/app/editor/sourceHighlighter.js
  21. 14
      apps/remix-ide/src/app/files/compiler-metadata.js
  22. 50
      apps/remix-ide/src/app/files/file-explorer.js
  23. 36
      apps/remix-ide/src/app/files/fileManager.js
  24. 106
      apps/remix-ide/src/app/files/remixDProvider.js
  25. 8
      apps/remix-ide/src/app/files/remixd-handle.js
  26. 18
      apps/remix-ide/src/app/panels/file-panel.js
  27. 23
      apps/remix-ide/src/app/panels/main-view.js
  28. 9
      apps/remix-ide/src/app/panels/tab-proxy.js
  29. 31
      apps/remix-ide/src/app/panels/terminal.js
  30. 18
      apps/remix-ide/src/app/tabs/analysis-tab.js
  31. 76
      apps/remix-ide/src/app/tabs/compile-tab.js
  32. 10
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  33. 11
      apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
  34. 18
      apps/remix-ide/src/app/tabs/compileTab/contractParser.js
  35. 10
      apps/remix-ide/src/app/tabs/debugger-tab.js
  36. 2
      apps/remix-ide/src/app/tabs/plugin-tab.js
  37. 68
      apps/remix-ide/src/app/tabs/runTab/contractDropdown.js
  38. 9
      apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js
  39. 9
      apps/remix-ide/src/app/tabs/runTab/model/recorder.js
  40. 50
      apps/remix-ide/src/app/tabs/runTab/recorder.js
  41. 33
      apps/remix-ide/src/app/tabs/runTab/settings.js
  42. 16
      apps/remix-ide/src/app/tabs/settings-tab.js
  43. 7
      apps/remix-ide/src/app/tabs/staticanalysis/staticAnalysisView.js
  44. 33
      apps/remix-ide/src/app/tabs/test-tab.js
  45. 4
      apps/remix-ide/src/app/tabs/testTab/testTab.js
  46. 21
      apps/remix-ide/src/app/tabs/theme-module.js
  47. 18
      apps/remix-ide/src/app/udapp/make-udapp.js
  48. 1
      apps/remix-ide/src/app/udapp/run-tab.js
  49. 5
      apps/remix-ide/src/app/ui/TreeView.js
  50. 10
      apps/remix-ide/src/app/ui/auto-complete-popup.js
  51. 2
      apps/remix-ide/src/app/ui/card.js
  52. 2
      apps/remix-ide/src/app/ui/copy-to-clipboard.js
  53. 6
      apps/remix-ide/src/app/ui/draggableContent.js
  54. 5
      apps/remix-ide/src/app/ui/dropdown.js
  55. 32
      apps/remix-ide/src/app/ui/landing-page/landing-page.js
  56. 6
      apps/remix-ide/src/app/ui/modal-dialog-custom.js
  57. 14
      apps/remix-ide/src/app/ui/modaldialog.js
  58. 7
      apps/remix-ide/src/app/ui/multiParamManager.js
  59. 9
      apps/remix-ide/src/app/ui/persmission-handler.js
  60. 7
      apps/remix-ide/src/app/ui/renderer.js
  61. 7
      apps/remix-ide/src/app/ui/sendTxCallbacks.js
  62. 19
      apps/remix-ide/src/app/ui/tooltip.js
  63. 18
      apps/remix-ide/src/app/ui/txLogger.js
  64. 16
      apps/remix-ide/src/app/ui/universal-dapp-ui.js
  65. 10
      apps/remix-ide/src/blockchain/blockchain.js
  66. 2
      apps/remix-ide/src/blockchain/pluginUDapp.js
  67. 1
      apps/remix-ide/src/blockchain/providers/injected.js
  68. 1
      apps/remix-ide/src/blockchain/providers/node.js
  69. 3
      apps/remix-ide/src/blockchain/providers/vm.js
  70. 3
      apps/remix-ide/src/framingService.js
  71. 9
      apps/remix-ide/src/lib/cmdInterpreterAPI.js
  72. 86
      apps/remix-ide/src/lib/commands.js
  73. 6
      apps/remix-ide/src/lib/gist-handler.js
  74. 1
      apps/remix-ide/src/lib/panels-resize.js
  75. 4
      apps/remix-ide/src/lib/remixd.js
  76. 4
      apps/remix-ide/src/polyfills.js
  77. 2
      apps/remix-ide/src/registry.js
  78. 27
      apps/remix-ide/src/remixAppManager.js
  79. 54
      libs/remix-debug/src/debugger/solidityLocals.js
  80. 4
      libs/remix-debug/src/debugger/solidityState.js
  81. 32
      package-lock.json
  82. 2
      package.json

@ -7,27 +7,21 @@
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"extends": "standard",
"rules": {
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
]
}
]
// "@typescript-eslint/explicit-member-accessibility": "off",
// "@typescript-eslint/explicit-function-return-type": "off",
// "@typescript-eslint/no-parameter-properties": "off",
// "@nrwl/nx/enforce-module-boundaries": [
// "error",
// {
// "enforceBuildableLibDependency": true,
// "allow": [],
// "depConstraints": [
// { "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
// ]
// }
// ]
},
"overrides": [
{

@ -13,17 +13,6 @@
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-this-alias": "off",
"no-unused-vars": "off",
"no-redeclare": "off",
"no-empty": "off",
"no-constant-condition": "off",
"no-async-promise-executor": "off",
"no-useless-catch": "off",
"no-extra-semi": "off",
"no-undef": "off"
"standard/no-callback-literal": "off"
}
}
}

@ -1,4 +1,24 @@
'use strict'
import { basicLogo } from './app/ui/svgLogo'
import { RunTab, makeUdapp } from './app/udapp'
import PanelsResize from './lib/panels-resize'
import { Engine } from '@remixproject/engine'
import { RemixAppManager } from './remixAppManager'
import { FramingService } from './framingService'
import { MainView } from './app/panels/main-view'
import { ThemeModule } from './app/tabs/theme-module'
import { NetworkModule } from './app/tabs/network-module'
import { Web3ProviderModule } from './app/tabs/web3-provider'
import { SidePanel } from './app/components/side-panel'
import { HiddenPanel } from './app/components/hidden-panel'
import { VerticalIcons } from './app/components/vertical-icons'
import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel'
import FetchAndCompile from './app/compiler/compiler-sourceVerifier-fetchAndCompile'
import migrateFileSystem from './migrateFileSystem'
var isElectron = require('is-electron')
var csjs = require('csjs-inject')
@ -36,26 +56,6 @@ const FilePanel = require('./app/panels/file-panel')
const Editor = require('./app/editor/editor')
const Terminal = require('./app/panels/terminal')
const ContextualListener = require('./app/editor/contextualListener')
import { basicLogo } from './app/ui/svgLogo'
import { RunTab, makeUdapp } from './app/udapp'
import PanelsResize from './lib/panels-resize'
import { Engine } from '@remixproject/engine'
import { RemixAppManager } from './remixAppManager'
import { FramingService } from './framingService'
import { MainView } from './app/panels/main-view'
import { ThemeModule } from './app/tabs/theme-module'
import { NetworkModule } from './app/tabs/network-module'
import { Web3ProviderModule } from './app/tabs/web3-provider'
import { SidePanel } from './app/components/side-panel'
import { HiddenPanel } from './app/components/hidden-panel'
import { VerticalIcons } from './app/components/vertical-icons'
import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel'
import FetchAndCompile from './app/compiler/compiler-sourceVerifier-fetchAndCompile'
import migrateFileSystem from './migrateFileSystem'
var css = csjs`
html { box-sizing: border-box; }
@ -139,17 +139,17 @@ class App {
// load app config
const config = new Config(configStorage)
registry.put({api: config, name: 'config'})
registry.put({ api: config, name: 'config' })
// load file system
self._components.filesProviders = {}
self._components.filesProviders['browser'] = new FileProvider('browser')
registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'})
self._components.filesProviders['localhost'] = new RemixDProvider(self.appManager)
registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'})
registry.put({api: self._components.filesProviders, name: 'fileproviders'})
self._components.filesProviders.browser = new FileProvider('browser')
registry.put({ api: self._components.filesProviders.browser, name: 'fileproviders/browser' })
self._components.filesProviders.localhost = new RemixDProvider(self.appManager)
registry.put({ api: self._components.filesProviders.localhost, name: 'fileproviders/localhost' })
registry.put({ api: self._components.filesProviders, name: 'fileproviders' })
migrateFileSystem(self._components.filesProviders['browser'])
migrateFileSystem(self._components.filesProviders.browser)
}
init () {
@ -205,7 +205,7 @@ async function run () {
modalDialogCustom.alert('This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.')
} else if (window.location.hostname === 'remix-alpha.ethereum.org' ||
(window.location.hostname === 'ethereum.github.io' && window.location.pathname.indexOf('/remix-live-alpha') === 0)) {
modalDialogCustom.alert(`Welcome to the Remix alpha instance. Please use it to try out latest features. But use preferably https://remix.ethereum.org for any production work.`)
modalDialogCustom.alert('Welcome to the Remix alpha instance. Please use it to try out latest features. But use preferably https://remix.ethereum.org for any production work.')
} else if (window.location.protocol.indexOf('http') === 0 &&
window.location.hostname !== 'remix.ethereum.org' &&
window.location.hostname !== 'localhost' &&
@ -233,9 +233,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const workspace = pluginLoader.get()
const engine = new Engine(appManager)
engine.setPluginOption = ({ name, kind }) => {
if (kind === 'provider') return {queueTimeout: 60000 * 2}
if (name === 'LearnEth') return {queueTimeout: 60000}
return {queueTimeout: 10000}
if (kind === 'provider') return { queueTimeout: 60000 * 2 }
if (name === 'LearnEth') return { queueTimeout: 60000 }
return { queueTimeout: 10000 }
}
await engine.onload()
@ -244,7 +244,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const contentImport = new CompilerImport()
// ----------------- theme servive ---------------------------------
const themeModule = new ThemeModule(registry)
registry.put({api: themeModule, name: 'themeModule'})
registry.put({ api: themeModule, name: 'themeModule' })
themeModule.initTheme(() => {
setTimeout(() => {
document.body.removeChild(self._view.splashScreen)
@ -253,12 +253,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
})
// ----------------- editor servive ----------------------------
const editor = new Editor({}, themeModule) // wrapper around ace editor
registry.put({api: editor, name: 'editor'})
registry.put({ api: editor, name: 'editor' })
editor.event.register('requiringToSaveCurrentfile', () => fileManager.saveCurrentFile())
// ----------------- fileManager servive ----------------------------
const fileManager = new FileManager(editor, appManager)
registry.put({api: fileManager, name: 'filemanager'})
registry.put({ api: fileManager, name: 'filemanager' })
const blockchain = new Blockchain(registry.get('config').api)
const pluginUdapp = new PluginUDapp(blockchain)
@ -267,7 +267,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const compilerMetadataGenerator = new CompilerMetadata(blockchain, fileManager, registry.get('config').api)
// ----------------- compilation result service (can keep track of compilation results) ----------------------------
const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name)
registry.put({api: compilersArtefacts, name: 'compilersartefacts'})
registry.put({ api: compilersArtefacts, name: 'compilersartefacts' })
// service which fetch contract artifacts from sourve-verify, put artifacts in remix and compile it
const fetchAndCompile = new FetchAndCompile()
@ -277,7 +277,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const web3Provider = new Web3ProviderModule(blockchain)
// ----------------- convert offset to line/column service -----------
const offsetToLineColumnConverter = new OffsetToLineColumnConverter()
registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'})
registry.put({ api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter' })
// -------------------Terminal----------------------------------------
@ -296,7 +296,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
)
makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl))
const contextualListener = new ContextualListener({editor})
const contextualListener = new ContextualListener({ editor })
engine.register([
contentImport,
@ -327,7 +327,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent(appManager, engine)
const filePanel = new FilePanel(appManager)
let settings = new SettingsTab(
const settings = new SettingsTab(
registry.get('config').api,
editor,
appManager
@ -367,7 +367,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.get('compilersartefacts').api,
networkModule,
mainview,
registry.get('fileproviders/browser').api,
registry.get('fileproviders/browser').api
)
const analysis = new AnalysisTab(registry)
const debug = new DebuggerTab(
@ -407,7 +407,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const params = queryParams.get()
// Set workspace after initial activation
if (Array.isArray(workspace)) {
if (Array.isArray(workspace)) {
appManager.activatePlugin(workspace).then(() => {
try {
if (params.deactivate) {
@ -416,7 +416,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
} catch (e) {
console.log(e)
}
// If plugins are loaded from the URL params, we focus on the last one.
if (pluginLoader.current === 'queryParams' && workspace.length > 0) menuicons.select(workspace[workspace.length - 1])
@ -430,7 +430,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}, 5000)
}
}
}).catch(console.error)
}).catch(console.error)
} else {
// activate solidity plugin
appManager.ensureActivated('solidity')
@ -449,10 +449,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const loadedFromGist = gistHandler.loadFromGist(params, fileManager)
if (!loadedFromGist) {
// insert example contracts if there are no files to show
self._components.filesProviders['browser'].resolveDirectory('/', (error, filesList) => {
self._components.filesProviders.browser.resolveDirectory('/', (error, filesList) => {
if (error) console.error(error)
if (Object.keys(filesList).length === 0) {
for (let file in examples) {
for (const file in examples) {
fileManager.writeFile(examples[file].name, examples[file].content)
}
}

@ -28,22 +28,22 @@ module.exports = class CompilerArtefacts extends Plugin {
}
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
saveCompilationPerFileResult(file, source, languageVersion, data)
})
this.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
saveCompilationPerFileResult(file, source, languageVersion, data)
})
this.on('lexon', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
saveCompilationPerFileResult(file, source, languageVersion, data)
})
this.on('yulp', 'compilationFinished', (file, source, languageVersion, data) => {
this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts.__last = new CompilerAbstract(languageVersion, data, source)
saveCompilationPerFileResult(file, source, languageVersion, data)
})
}
@ -55,8 +55,8 @@ module.exports = class CompilerArtefacts extends Plugin {
Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] })
})
// making sure we save last compilation result in there
if (this.compilersArtefacts['__last']) {
const contracts = this.compilersArtefacts['__last'].getContracts()
if (this.compilersArtefacts.__last) {
const contracts = this.compilersArtefacts.__last.getContracts()
Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] })
}
return contractsData

@ -1,11 +1,11 @@
'use strict'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const globalRegistry = require('../../global/registry')
var base64 = require('js-base64').Base64
var swarmgw = require('swarmgw')()
var resolver = require('@resolver-engine/imports').ImportsEngine()
var request = require('request')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const profile = {
name: 'contentImport',
@ -79,12 +79,12 @@ module.exports = class CompilerImports extends Plugin {
{
url
},
(err, r, data) => {
if (err) {
return cb(err || 'Unknown transport error')
}
cb(null, data, cleanUrl)
})
(err, r, data) => {
if (err) {
return cb(err || 'Unknown transport error')
}
cb(null, data, cleanUrl)
})
}
handlers () {
@ -112,7 +112,7 @@ module.exports = class CompilerImports extends Plugin {
import (url, force, loadingCb, cb) {
if (typeof force !== 'boolean') {
let temp = loadingCb
const temp = loadingCb
loadingCb = force
cb = temp
force = false
@ -156,19 +156,19 @@ module.exports = class CompilerImports extends Plugin {
if (found) return
resolver
.resolve(url)
.then(result => {
return resolver.require(url)
})
.then(result => {
if (url.indexOf(result.provider + ':') === 0) {
url = url.substring(result.provider.length + 1) // remove the github prefix
}
cb(null, result.source, url, result.provider, result.url)
})
.catch(err => {
err
cb('Unable to import "' + url + '": File not found')
})
.resolve(url)
.then(result => {
return resolver.require(url)
})
.then(result => {
if (url.indexOf(result.provider + ':') === 0) {
url = url.substring(result.provider.length + 1) // remove the github prefix
}
cb(null, result.source, url, result.provider, result.url)
})
.catch(err => {
console.error(err)
cb('Unable to import "' + url + '": File not found')
})
}
}

@ -0,0 +1,21 @@
'use strict'
module.exports = (sources, opts) => {
return JSON.stringify({
language: 'Solidity',
sources: sources,
settings: {
optimizer: {
enabled: opts.optimize === true || opts.optimize === 1,
runs: 200
},
libraries: opts.libraries,
outputSelection: {
'*': {
'': ['ast'],
'*': ['abi', 'metadata', 'devdoc', 'userdoc', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates']
}
}
}
})
}

@ -1,10 +1,10 @@
const ethutil = require('ethereumjs-util')
import * as packageJson from '../../../../../package.json'
import { Plugin } from '@remixproject/engine'
import { compile } from './compiler-helpers'
import globalRegistry from '../../global/registry'
import remixLib from '@remix-project/remix-lib'
const ethutil = require('ethereumjs-util')
const profile = {
name: 'fetchAndCompile',
@ -13,7 +13,6 @@ const profile = {
}
export default class FetchAndCompile extends Plugin {
constructor () {
super(profile)
this.unresolvedAddresses = []
@ -86,12 +85,12 @@ export default class FetchAndCompile extends Plugin {
// set the solidity contract code using metadata
await this.call('fileManager', 'setFile', `${targetPath}/${name}/${contractAddress}/metadata.json`, JSON.stringify(data.metadata, null, '\t'))
let compilationTargets = {}
const compilationTargets = {}
for (let file in data.metadata.sources) {
const urls = data.metadata.sources[file].urls
for (let url of urls) {
for (const url of urls) {
if (url.includes('ipfs')) {
let stdUrl = `ipfs://${url.split('/')[2]}`
const stdUrl = `ipfs://${url.split('/')[2]}`
const source = await this.call('contentImport', 'resolve', stdUrl)
file = file.replace('browser/', '') // should be fixed in the remix IDE end.
const path = `${targetPath}/${name}/${contractAddress}/${file}`

@ -26,7 +26,7 @@ export function canUseWorker (selectedVersion) {
const isNightly = selectedVersion.includes('nightly')
return browserSupportWorker() && (
semver.gt(version, '0.6.3') ||
semver.gt(version, '0.3.6') && !isNightly
(semver.gt(version, '0.3.6') && !isNightly)
)
}

@ -18,7 +18,6 @@ const profile = {
}
export class HiddenPanel extends AbstractPanel {
constructor () {
super(profile)
}

@ -51,15 +51,15 @@ module.exports = class LocalPlugin {
return profile
}
updateName ({target}) {
updateName ({ target }) {
this.profile.name = target.value
}
updateUrl ({target}) {
updateUrl ({ target }) {
this.profile.url = target.value
}
updateDisplayName ({target}) {
updateDisplayName ({ target }) {
this.profile.displayName = target.value
}

@ -1,7 +1,7 @@
import { EventEmitter } from 'events'
import { HostPlugin } from '@remixproject/engine'
const csjs = require('csjs-inject')
const yo = require('yo-yo')
import { HostPlugin } from '@remixproject/engine'
const css = csjs`
.plugins {
@ -27,7 +27,6 @@ const css = csjs`
/** Abstract class used for hosting the view of a plugin */
export class AbstractPanel extends HostPlugin {
constructor (profile) {
super(profile)
this.events = new EventEmitter()
@ -109,4 +108,3 @@ export class AbstractPanel extends HostPlugin {
this.showContent(name)
}
}

@ -1,10 +1,10 @@
import { ViewPlugin, IframePlugin, WebsocketPlugin } from '@remixproject/engine'
import { PluginManagerSettings } from './plugin-manager-settings'
import * as packageJson from '../../../../../package.json'
const yo = require('yo-yo')
const csjs = require('csjs-inject')
const EventEmitter = require('events')
const LocalPlugin = require('./local-plugin')
import { ViewPlugin, IframePlugin, WebsocketPlugin } from '@remixproject/engine'
import { PluginManagerSettings } from './plugin-manager-settings'
import * as packageJson from '../../../../../package.json'
const addToolTip = require('../ui/tooltip')
const css = csjs`
@ -71,7 +71,6 @@ const profile = {
}
class PluginManagerComponent extends ViewPlugin {
constructor (appManager, engine) {
super(profile)
this.event = new EventEmitter()
@ -172,12 +171,12 @@ class PluginManagerComponent extends ViewPlugin {
}
// Filter all active and inactive modules that are not required
const {actives, inactives} = this.appManager.getAll()
const { actives, inactives } = this.appManager.getAll()
.filter(isFiltered)
.filter(isNotRequired)
.filter(isNotHome)
.sort(sortByName)
.reduce(({actives, inactives}, profile) => {
.reduce(({ actives, inactives }, profile) => {
return this.isActive(profile.name)
? { actives: [...actives, profile], inactives }
: { inactives: [...inactives, profile], actives }

@ -44,13 +44,12 @@ const css = csjs`
`
export class PluginManagerSettings {
openDialog () {
const fromLocal = window.localStorage.getItem('plugins/permissions')
this.permissions = JSON.parse(fromLocal || '{}')
this.currentSetting = this.settings()
modalDialog('Plugin Manager Permissions', this.currentSetting,
{ fn: () => this.onValidation() },
{ fn: () => this.onValidation() }
)
}
@ -138,5 +137,4 @@ export class PluginManagerSettings {
<button onclick="${() => this.openDialog()}" class="btn btn-primary settings-button" data-id="pluginManagerPermissionsButton">Permissions</button>
</footer>`
}
}

@ -59,7 +59,6 @@ const sidePanel = {
// TODO merge with vertical-icons.js
export class SidePanel extends AbstractPanel {
constructor (appManager, verticalIcons) {
super(sidePanel)
this.appManager = appManager

@ -1,10 +1,10 @@
import * as packageJson from '../../../../../package.json'
import { basicLogo } from '../ui/svgLogo'
var yo = require('yo-yo')
var csjs = require('csjs-inject')
var helper = require('../../lib/helper')
let globalRegistry = require('../../global/registry')
const globalRegistry = require('../../global/registry')
const { Plugin } = require('@remixproject/engine')
import * as packageJson from '../../../../../package.json'
import { basicLogo } from '../ui/svgLogo'
const EventEmitter = require('events')
@ -18,7 +18,6 @@ const profile = {
// TODO merge with side-panel.js. VerticalIcons should not be a plugin
export class VerticalIcons extends Plugin {
constructor (appManager) {
super(profile)
this.events = new EventEmitter()
@ -27,7 +26,7 @@ export class VerticalIcons extends Plugin {
this.iconKind = {}
this.iconStatus = {}
let themeModule = globalRegistry.get('themeModule').api
const themeModule = globalRegistry.get('themeModule').api
themeModule.events.on('themeChanged', (theme) => {
this.onThemeChanged(theme.quality)
})
@ -49,7 +48,7 @@ export class VerticalIcons extends Plugin {
const types = ['error', 'warning', 'success', 'info', '']
const fn = (status) => {
if (!types.includes(status.type) && status.type) throw new Error(`type should be ${keys.join()}`)
if (status.key === undefined) throw new Error(`status key should be defined`)
if (status.key === undefined) throw new Error('status key should be defined')
if (typeof status.key === 'string' && (!keys.includes(status.key))) {
throw new Error('key should contain either number or ' + keys.join())
@ -64,7 +63,7 @@ export class VerticalIcons extends Plugin {
* Add an icon to the map
* @param {ModuleProfile} profile The profile of the module
*/
addIcon ({kind, name, icon, displayName, tooltip}) {
addIcon ({ kind, name, icon, displayName, tooltip }) {
let title = (tooltip || displayName || name)
title = title.replace(/^\w/, c => c.toUpperCase())
this.icons[name] = yo`
@ -114,7 +113,7 @@ export class VerticalIcons extends Plugin {
setIconStatus (name, status) {
const el = this.icons[name]
if (!el) return
let statusEl = el.querySelector('span')
const statusEl = el.querySelector('span')
if (statusEl) {
el.removeChild(statusEl)
}
@ -131,7 +130,7 @@ export class VerticalIcons extends Plugin {
if (status.type === 'error') {
type = 'danger' // to use with bootstrap
} else type = helper.checkSpecialChars(status.type) ? '' : status.type
let title = helper.checkSpecialChars(status.title) ? '' : status.title
const title = helper.checkSpecialChars(status.title) ? '' : status.title
el.appendChild(yo`<span
title="${title}"
@ -148,7 +147,7 @@ export class VerticalIcons extends Plugin {
* Remove an icon from the map
* @param {ModuleProfile} profile The profile of the module
*/
removeIcon ({kind, name}) {
removeIcon ({ kind, name }) {
if (this.icons[name]) this.iconKind[kind || 'none'].removeChild(this.icons[name])
}
@ -157,15 +156,15 @@ export class VerticalIcons extends Plugin {
*/
removeActive () {
// reset filters
const images = this.view.querySelectorAll(`.image`)
const images = this.view.querySelectorAll('.image')
images.forEach(function (im) {
im.style.setProperty('filter', 'invert(0.5)')
})
// remove active
const currentActive = this.view.querySelector(`.active`)
const currentActive = this.view.querySelector('.active')
if (currentActive) {
currentActive.classList.remove(`active`)
currentActive.classList.remove('active')
}
}
@ -180,8 +179,8 @@ export class VerticalIcons extends Plugin {
const brightness = themeType === 'dark' ? '150' : '0' // should be >100 for icons with color
const nextActive = this.view.querySelector(`[plugin="${name}"]`)
if (nextActive) {
let image = nextActive.querySelector('.image')
nextActive.classList.add(`active`)
const image = nextActive.querySelector('.image')
nextActive.classList.add('active')
image.style.setProperty('filter', `invert(${invert}) grayscale(1) brightness(${brightness}%)`)
}
}
@ -215,15 +214,15 @@ export class VerticalIcons extends Plugin {
onThemeChanged (themeType) {
const invert = themeType === 'dark' ? 1 : 0
const active = this.view.querySelector(`.active`)
const active = this.view.querySelector('.active')
if (active) {
let image = active.querySelector('.image')
const image = active.querySelector('.image')
image.style.setProperty('filter', `invert(${invert})`)
}
}
render () {
let home = yo`
const home = yo`
<div
class="${css.homeIcon}"
onclick="${(e) => {
@ -235,26 +234,26 @@ export class VerticalIcons extends Plugin {
${basicLogo()}
</div>
`
this.iconKind['fileexplorer'] = yo`<div id='fileExplorerIcons' data-id="verticalIconsFileExplorerIcons"></div>`
this.iconKind['compiler'] = yo`<div id='compileIcons'></div>`
this.iconKind['udapp'] = yo`<div id='runIcons'></div>`
this.iconKind['testing'] = yo`<div id='testingIcons'></div>`
this.iconKind['analysis'] = yo`<div id='analysisIcons'></div>`
this.iconKind['debugging'] = yo`<div id='debuggingIcons' data-id="verticalIconsDebuggingIcons"></div>`
this.iconKind['none'] = yo`<div id='otherIcons'></div>`
this.iconKind['settings'] = yo`<div id='settingsIcons' data-id="verticalIconsSettingsIcons"></div>`
this.iconKind.fileexplorer = yo`<div id='fileExplorerIcons' data-id="verticalIconsFileExplorerIcons"></div>`
this.iconKind.compiler = yo`<div id='compileIcons'></div>`
this.iconKind.udapp = yo`<div id='runIcons'></div>`
this.iconKind.testing = yo`<div id='testingIcons'></div>`
this.iconKind.analysis = yo`<div id='analysisIcons'></div>`
this.iconKind.debugging = yo`<div id='debuggingIcons' data-id="verticalIconsDebuggingIcons"></div>`
this.iconKind.none = yo`<div id='otherIcons'></div>`
this.iconKind.settings = yo`<div id='settingsIcons' data-id="verticalIconsSettingsIcons"></div>`
this.view = yo`
<div class=${css.icons}>
${home}
${this.iconKind['fileexplorer']}
${this.iconKind['compiler']}
${this.iconKind['udapp']}
${this.iconKind['testing']}
${this.iconKind['analysis']}
${this.iconKind['debugging']}
${this.iconKind['none']}
${this.iconKind['settings']}
${this.iconKind.fileexplorer}
${this.iconKind.compiler}
${this.iconKind.udapp}
${this.iconKind.testing}
${this.iconKind.analysis}
${this.iconKind.debugging}
${this.iconKind.none}
${this.iconKind.settings}
</div>
`
return this.view

@ -2,12 +2,12 @@
const SourceHighlighter = require('./sourceHighlighter')
class SourceHighlighters {
constructor () {
this.highlighters = {}
}
highlight (position, filePath, hexColor, from) {
// eslint-disable-next-line
try {
if (!this.highlighters[from]) this.highlighters[from] = []
const sourceHighlight = new SourceHighlighter()
@ -27,6 +27,7 @@ class SourceHighlighters {
// highlights all locations for @from plugin
highlightAllFrom (from) {
// eslint-disable-next-line
try {
if (!this.highlighters[from]) return
const sourceHighlight = new SourceHighlighter()

@ -25,9 +25,9 @@ class ContextView {
config: this._components.registry.get('config').api,
fileManager: this._components.registry.get('filemanager').api
}
this._view
this._nodes
this._current
this._view = null
this._nodes = null
this._current = null
this.sourceMappingDecoder = new SourceMappingDecoder()
this.previousElement = null
this.contextualListener.event.register('contextChanged', nodes => {
@ -98,7 +98,7 @@ class ContextView {
this.editor.gotoLine(lineColumn.start.line, lineColumn.end.column + 1)
}
}
let lastCompilationResult = this._deps.compilersArtefacts['__last']
const lastCompilationResult = this._deps.compilersArtefacts.__last
if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0 && lastCompilationResult.data) {
const lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(
position,

@ -1,12 +1,13 @@
'use strict'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const remixdebug = require('@remix-project/remix-debug')
const { AstWalker } = require('@remix-project/remix-astwalker')
const csjs = require('csjs-inject')
const SourceMappingDecoder = remixdebug.SourceMappingDecoder
const EventManager = require('../../lib/events')
const globalRegistry = require('../../global/registry')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const profile = {
name: 'contextualListener',
@ -54,8 +55,8 @@ class ContextualListener extends Plugin {
})
setInterval(() => {
if (this._deps.compilersArtefacts['__last'] && this._deps.compilersArtefacts['__last'].languageversion.indexOf('soljson') === 0) {
this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts['__last'], this._deps.config.get('currentFile'))
if (this._deps.compilersArtefacts.__last && this._deps.compilersArtefacts.__last.languageversion.indexOf('soljson') === 0) {
this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts.__last, this._deps.config.get('currentFile'))
}
}, 1000)
}
@ -66,13 +67,13 @@ class ContextualListener extends Plugin {
declarationOf (node) {
if (node && node.referencedDeclaration) {
return this._index['FlatReferences'][node.referencedDeclaration]
return this._index.FlatReferences[node.referencedDeclaration]
}
return null
}
referencesOf (node) {
return this._index['Declarations'][node.id]
return this._index.Declarations[node.id]
}
_highlightItems (cursorPosition, compilationResult, file) {
@ -99,12 +100,12 @@ class ContextualListener extends Plugin {
if (compilationResult && compilationResult.sources) {
const callback = (node) => {
if (node && node.referencedDeclaration) {
if (!this._index['Declarations'][node.referencedDeclaration]) {
this._index['Declarations'][node.referencedDeclaration] = []
if (!this._index.Declarations[node.referencedDeclaration]) {
this._index.Declarations[node.referencedDeclaration] = []
}
this._index['Declarations'][node.referencedDeclaration].push(node)
this._index.Declarations[node.referencedDeclaration].push(node)
}
this._index['FlatReferences'][node.id] = node
this._index.FlatReferences[node.id] = node
}
for (const s in compilationResult.sources) {
this.astWalker.walkFull(compilationResult.sources[s].ast, callback)
@ -116,7 +117,7 @@ class ContextualListener extends Plugin {
if (!node) return
const position = this.sourceMappingDecoder.decode(node.src)
const eventId = this._highlightInternal(position, node)
let lastCompilationResult = this._deps.compilersArtefacts['__last']
const lastCompilationResult = this._deps.compilersArtefacts.__last
if (eventId && lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
this._activeHighlights.push({ eventId, position, fileTarget: lastCompilationResult.getSourceName(position.file), nodeId: node.id })
}
@ -124,7 +125,7 @@ class ContextualListener extends Plugin {
_highlightInternal (position, node) {
if (node.nodeType === 'Block') return
let lastCompilationResult = this._deps.compilersArtefacts['__last']
const lastCompilationResult = this._deps.compilersArtefacts.__last
if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
let lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts())
const css = csjs`
@ -158,8 +159,8 @@ class ContextualListener extends Plugin {
_highlightExpressions (node, compilationResult) {
const highlights = (id) => {
if (this._index['Declarations'] && this._index['Declarations'][id]) {
const refs = this._index['Declarations'][id]
if (this._index.Declarations && this._index.Declarations[id]) {
const refs = this._index.Declarations[id]
for (const ref in refs) {
const node = refs[ref]
this._highlight(node, compilationResult)
@ -168,7 +169,7 @@ class ContextualListener extends Plugin {
}
if (node && node.referencedDeclaration) {
highlights(node.referencedDeclaration)
const current = this._index['FlatReferences'][node.referencedDeclaration]
const current = this._index.FlatReferences[node.referencedDeclaration]
this._highlight(current, compilationResult)
} else {
highlights(node.id)
@ -206,7 +207,7 @@ class ContextualListener extends Plugin {
} else {
executionCost = '-'
}
return {executionCost, codeDepositCost}
return { executionCost, codeDepositCost }
}
_loadContractInfos (node) {
@ -223,7 +224,7 @@ class ContextualListener extends Plugin {
_getInputParams (node) {
const params = []
let target = node.parameters
const target = node.parameters
// for (const i in node.children) {
// if (node.children[i].name === 'ParameterList') {
// target = node.children[i]

@ -1,10 +1,11 @@
'use strict'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const EventManager = require('../../lib/events')
const yo = require('yo-yo')
const csjs = require('csjs-inject')
const ace = require('brace')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const globalRegistry = require('../../global/registry')
const SourceHighlighters = require('./SourceHighlighters')
@ -52,7 +53,6 @@ const profile = {
}
class Editor extends Plugin {
constructor (opts = {}, themeModule) {
super(profile)
// Dependancies
@ -63,9 +63,9 @@ class Editor extends Plugin {
}
this._themes = {
'light': 'chrome',
'dark': 'chaos',
'remixDark': 'remixDark'
light: 'chrome',
dark: 'chaos',
remixDark: 'remixDark'
}
themeModule.events.on('themeChanged', (theme) => {
this.setTheme(theme.name === 'Dark' ? 'remixDark' : theme.quality)
@ -110,7 +110,7 @@ class Editor extends Plugin {
// shortcuts for "Ctrl-"" and "Ctrl+"" to increase/decrease font size of the editor
this.editor.commands.addCommand({
name: 'increasefontsizeEqual',
bindKey: {win: 'Ctrl-=', mac: 'Command-='},
bindKey: { win: 'Ctrl-=', mac: 'Command-=' },
exec: (editor) => {
this.editorFontSize(1)
},
@ -119,7 +119,7 @@ class Editor extends Plugin {
this.editor.commands.addCommand({
name: 'increasefontsizePlus',
bindKey: {win: 'Ctrl-+', mac: 'Command-+'},
bindKey: { win: 'Ctrl-+', mac: 'Command-+' },
exec: (editor) => {
this.editorFontSize(1)
},
@ -128,7 +128,7 @@ class Editor extends Plugin {
this.editor.commands.addCommand({
name: 'decreasefontsize',
bindKey: {win: 'Ctrl--', mac: 'Command--'},
bindKey: { win: 'Ctrl--', mac: 'Command--' },
exec: (editor) => {
this.editorFontSize(-1)
},
@ -263,12 +263,12 @@ class Editor extends Plugin {
* @param {string} path Path of the file
*/
_getMode (path) {
if (!path) return this.modes['txt']
if (!path) return this.modes.txt
const root = path.split('#')[0].split('?')[0]
let ext = root.indexOf('.') !== -1 ? /[^.]+$/.exec(root) : null
if (ext) ext = ext[0]
else ext = 'txt'
return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt']
return ext && this.modes[ext] ? this.modes[ext] : this.modes.txt
}
/**
@ -316,7 +316,7 @@ class Editor extends Plugin {
* @param {number} incr The amount of pixels to add to the font.
*/
editorFontSize (incr) {
let newSize = this.editor.getFontSize() + incr
const newSize = this.editor.getFontSize() + incr
if (newSize >= 6) {
this.editor.setFontSize(newSize)
}

@ -22,7 +22,7 @@ class SourceHighlighter {
currentSourceLocation (lineColumnPos, location) {
if (this.statementMarker) this._deps.editor.removeMarker(this.statementMarker, this.source)
if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source)
let lastCompilationResult = this._deps.compilerArtefacts['__last']
const lastCompilationResult = this._deps.compilerArtefacts.__last
if (location && location.file !== undefined && lastCompilationResult) {
const path = lastCompilationResult.getSourceName(location.file)
if (path) {
@ -40,7 +40,7 @@ class SourceHighlighter {
if (lineColumnPos) {
this.source = filePath
this.style = style || 'var(--info)'
//if (!this.source) this.source = this._deps.fileManager.currentFile()
// if (!this.source) this.source = this._deps.fileManager.currentFile()
if (this._deps.fileManager.currentFile() !== this.source) {
await this._deps.fileManager.open(this.source)
this.source = this._deps.fileManager.currentFile()

@ -1,7 +1,7 @@
'use strict'
var CompilerAbstract = require('../compiler/compiler-abstract')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
var CompilerAbstract = require('../compiler/compiler-abstract')
const profile = {
name: 'compilerMetadata',
@ -32,7 +32,7 @@ class CompilerMetadata extends Plugin {
var self = this
this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
if (!self.config.get('settings/generate-contract-metadata')) return
let compiler = new CompilerAbstract(languageVersion, data, source)
const compiler = new CompilerAbstract(languageVersion, data, source)
var provider = self.fileManager.currentFileProvider()
var path = self.fileManager.currentPath()
if (provider && path) {
@ -84,8 +84,8 @@ class CompilerMetadata extends Plugin {
}
_syncContext (contract, metadata) {
var linkReferences = metadata['linkReferences']
var autoDeployLib = metadata['autoDeployLib']
var linkReferences = metadata.linkReferences
var autoDeployLib = metadata.autoDeployLib
if (!linkReferences) linkReferences = {}
if (autoDeployLib === undefined) autoDeployLib = true
@ -97,8 +97,8 @@ class CompilerMetadata extends Plugin {
}
}
}
metadata['linkReferences'] = linkReferences
metadata['autoDeployLib'] = autoDeployLib
metadata.linkReferences = linkReferences
metadata.autoDeployLib = autoDeployLib
return metadata
}
@ -138,7 +138,7 @@ class CompilerMetadata extends Plugin {
}
})
} else {
reject(`Please select the folder in the file explorer where the metadata of ${contractName} can be found`)
reject(new Error(`Please select the folder in the file explorer where the metadata of ${contractName} can be found`))
}
})
}

@ -25,21 +25,25 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
this.focusElement = null
// path currently focused on
this.focusPath = null
let allItems =
const allItems =
[
{ action: 'createNewFile',
{
action: 'createNewFile',
title: 'Create New File',
icon: 'fas fa-plus-circle'
},
{ action: 'publishToGist',
{
action: 'publishToGist',
title: 'Publish all [browser] explorer files to a github gist',
icon: 'fab fa-github'
},
{ action: 'uploadFile',
{
action: 'uploadFile',
title: 'Add Local file to the Browser Storage Explorer',
icon: 'far fa-folder-open'
},
{ action: 'updateGist',
{
action: 'updateGist',
title: 'Update the current [gist] explorer',
icon: 'fab fa-github'
}
@ -213,7 +217,7 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
if (self.files.readonly) return
if (key === self.files.type) return
MENU_HANDLE && MENU_HANDLE.hide(null, true)
let actions = {}
const actions = {}
const provider = self._deps.fileManager.fileProviderOf(key)
actions['Create File'] = () => self.createNewFile(key)
actions['Create Folder'] = () => self.createNewFolder(key)
@ -229,16 +233,16 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
} */
} else {
const folderPath = extractExternalFolder(key)
actions['Rename'] = () => {
actions.Rename = () => {
if (self.files.isReadOnly(key)) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') }
var name = label.querySelector('span[data-path="' + key + '"]')
if (name) editModeOn(name)
}
actions['Delete'] = () => {
actions.Delete = () => {
if (self.files.isReadOnly(key)) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') }
const currentFoldername = extractNameFromKey(key)
modalDialogCustom.confirm(`Confirm to delete folder`, `Are you sure you want to delete ${currentFoldername} folder?`,
modalDialogCustom.confirm('Confirm to delete folder', `Are you sure you want to delete ${currentFoldername} folder?`,
async () => {
const fileManager = self._deps.fileManager
const removeFolder = await fileManager.remove(key)
@ -266,21 +270,21 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
self.treeView.event.register('leafRightClick', function (key, data, label, event) {
if (key === self.files.type) return
MENU_HANDLE && MENU_HANDLE.hide(null, true)
let actions = {}
const actions = {}
const provider = self._deps.fileManager.fileProviderOf(key)
if (!provider.isExternalFolder(key)) {
actions['Create Folder'] = () => self.createNewFolder(self._deps.fileManager.extractPathOf(key))
actions['Rename'] = () => {
actions.Rename = () => {
if (self.files.isReadOnly(key)) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') }
var name = label.querySelector('span[data-path="' + key + '"]')
if (name) editModeOn(name)
}
actions['Delete'] = () => {
actions.Delete = () => {
if (self.files.isReadOnly(key)) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') }
const currentFilename = extractNameFromKey(key)
modalDialogCustom.confirm(
`Delete file`, `Are you sure you want to delete ${currentFilename} file?`,
'Delete file', `Are you sure you want to delete ${currentFilename} file?`,
async () => {
const fileManager = self._deps.fileManager
const removeFile = await fileManager.remove(key)
@ -293,7 +297,7 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
)
}
if (key.endsWith('.js')) {
actions['Run'] = async () => {
actions.Run = async () => {
provider.get(key, (error, content) => {
if (error) return console.log(error)
plugin.call('scriptRunner', 'execute', content)
@ -358,7 +362,7 @@ function fileExplorer (localRegistry, files, menuItems, plugin) {
}
function editModeOff (event) {
let label = this
const label = this
const isFolder = label.className.indexOf('folder') !== -1
function rename () {
@ -438,10 +442,10 @@ fileExplorer.prototype.uploadFile = function (event) {
// a file and then just use `files.add`. The file explorer will
// pick that up via the 'fileAdded' event from the files module.
let self = this
const self = this
;[...event.target.files].forEach((file) => {
let files = this.files
const files = this.files
function loadFile () {
var fileReader = new FileReader()
fileReader.onload = async function (event) {
@ -471,7 +475,7 @@ fileExplorer.prototype.uploadFile = function (event) {
}
fileExplorer.prototype.toGist = function (id) {
let proccedResult = function (error, data) {
const proccedResult = function (error, data) {
if (error) {
modalDialogCustom.alert('Failed to manage gist: ' + error)
console.log('Failed to manage gist: ' + error)
@ -568,7 +572,7 @@ fileExplorer.prototype.toGist = function (id) {
// return all the files, except the temporary/readonly ones..
fileExplorer.prototype.packageFiles = function (filesProvider, directory, callback) {
let ret = {}
const ret = {}
filesProvider.resolveDirectory(directory, (error, files) => {
if (error) callback(error)
else {
@ -593,7 +597,7 @@ fileExplorer.prototype.packageFiles = function (filesProvider, directory, callba
}
fileExplorer.prototype.createNewFile = function (parentFolder = 'browser') {
let self = this
const self = this
modalDialogCustom.prompt('Create new file', 'File Name (e.g Untitled.sol)', 'Untitled.sol', (input) => {
if (!input) input = 'New file'
helper.createNonClashingName(parentFolder + '/' + input, self.files, async (error, newName) => {
@ -614,7 +618,7 @@ fileExplorer.prototype.createNewFile = function (parentFolder = 'browser') {
}
fileExplorer.prototype.createNewFolder = function (parentFolder) {
let self = this
const self = this
modalDialogCustom.prompt('Create new folder', '', 'New folder', (input) => {
if (!input) {
return tooltip('Failed to create folder. The name can not be empty')
@ -638,7 +642,7 @@ fileExplorer.prototype.createNewFolder = function (parentFolder) {
fileExplorer.prototype.renderMenuItems = function () {
let items = ''
if (this.menuItems) {
items = this.menuItems.map(({action, title, icon}) => {
items = this.menuItems.map(({ action, title, icon }) => {
if (action === 'uploadFile') {
return yo`
<label
@ -658,7 +662,7 @@ fileExplorer.prototype.renderMenuItems = function () {
<span
id=${action}
data-id="fileExplorerNewFile${action}"
onclick=${(event) => { event.stopPropagation(); this[ action ]() }}
onclick=${(event) => { event.stopPropagation(); this[action]() }}
class="newFile ${icon} ${css.newFile}"
title=${title}
>

@ -2,14 +2,14 @@
import yo from 'yo-yo'
import async from 'async'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const EventEmitter = require('events')
const globalRegistry = require('../../global/registry')
const CompilerImport = require('../compiler/compiler-imports')
const toaster = require('../ui/tooltip')
const modalDialogCustom = require('../ui/modal-dialog-custom')
const helper = require('../../lib/helper.js')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
/*
attach to files event (removed renamed)
@ -50,7 +50,7 @@ class FileManager extends Plugin {
this.init()
}
/**
/**
* Emit error if path doesn't exist
* @param {string} path path of the file/directory
* @param {string} message message to display if path doesn't exist.
@ -124,7 +124,7 @@ class FileManager extends Plugin {
return result
}
/**
/**
* Verify if the path provided is a directory
* @param {string} path path of the directory
* @returns {boolean} true if path is a directory.
@ -468,7 +468,7 @@ class FileManager extends Plugin {
}
if (file) return _openFile(file)
else {
var browserProvider = this._deps.filesProviders['browser']
var browserProvider = this._deps.filesProviders.browser
browserProvider.resolveDirectory('browser', (error, filesProvider) => {
if (error) console.error(error)
var fileList = Object.keys(filesProvider)
@ -489,9 +489,9 @@ class FileManager extends Plugin {
fileProviderOf (file) {
if (file.indexOf('localhost') === 0) {
return this._deps.filesProviders['localhost']
return this._deps.filesProviders.localhost
}
return this._deps.filesProviders['browser']
return this._deps.filesProviders.browser
}
// returns the list of directories inside path
@ -563,17 +563,17 @@ class FileManager extends Plugin {
}
helper.createNonClashingName(file, self._deps.filesProviders[fileProvider],
(error, name) => {
if (error) {
modalDialogCustom.alert('Unexpected error loading the file ' + error)
} else if (helper.checkSpecialChars(name)) {
modalDialogCustom.alert('Special characters are not allowed')
} else {
self._deps.filesProviders[fileProvider].set(name, filesSet[file].content)
self.syncEditor(fileProvider + name)
}
callback()
})
(error, name) => {
if (error) {
modalDialogCustom.alert('Unexpected error loading the file ' + error)
} else if (helper.checkSpecialChars(name)) {
modalDialogCustom.alert('Special characters are not allowed')
} else {
self._deps.filesProviders[fileProvider].set(name, filesSet[file].content)
self.syncEditor(fileProvider + name)
}
callback()
})
}, (error) => {
if (callback) callback(error)
})

@ -6,7 +6,7 @@ module.exports = class RemixDProvider {
this.event = new EventManager()
this._appManager = appManager
this.type = 'localhost'
this.error = { 'EEXIST': 'File already exists' }
this.error = { EEXIST: 'File already exists' }
this._isReady = false
this._readOnlyFiles = {}
this._readOnlyMode = false
@ -55,14 +55,14 @@ module.exports = class RemixDProvider {
init (cb) {
if (this._isReady) return cb && cb()
this._appManager.call('remixd', 'folderIsReadOnly', {})
.then((result) => {
this._isReady = true
this._readOnlyMode = result
this._registerEvent()
cb && cb()
}).catch((error) => {
cb && cb(error)
})
.then((result) => {
this._isReady = true
this._readOnlyMode = result
this._registerEvent()
cb && cb()
}).catch((error) => {
cb && cb(error)
})
}
exists (path, cb) {
@ -70,13 +70,13 @@ module.exports = class RemixDProvider {
const unprefixedpath = this.removePrefix(path)
return this._appManager.call('remixd', 'exists', { path: unprefixedpath })
.then((result) => {
if (cb) return cb(null, result)
return result
}).catch((error) => {
if (cb) return cb(error)
throw new Error(error)
})
.then((result) => {
if (cb) return cb(null, result)
return result
}).catch((error) => {
if (cb) return cb(error)
throw new Error(error)
})
}
getNormalizedName (path) {
@ -91,16 +91,16 @@ module.exports = class RemixDProvider {
if (!this._isReady) return cb && cb('provider not ready')
var unprefixedpath = this.removePrefix(path)
this._appManager.call('remixd', 'get', { path: unprefixedpath })
.then((file) => {
this.filesContent[path] = file.content
if (file.readonly) { this._readOnlyFiles[path] = 1 }
cb(null, file.content)
}).catch((error) => {
if (error) console.log(error)
// display the last known content.
// TODO should perhaps better warn the user that the file is not synced.
return cb(null, this.filesContent[path])
})
.then((file) => {
this.filesContent[path] = file.content
if (file.readonly) { this._readOnlyFiles[path] = 1 }
cb(null, file.content)
}).catch((error) => {
if (error) console.log(error)
// display the last known content.
// TODO should perhaps better warn the user that the file is not synced.
return cb(null, this.filesContent[path])
})
}
async set (path, content, cb) {
@ -121,42 +121,42 @@ module.exports = class RemixDProvider {
remove (path) {
return new Promise((resolve, reject) => {
if (!this._isReady) return reject('provider not ready')
if (!this._isReady) return reject(new Error('provider not ready'))
const unprefixedpath = this.removePrefix(path)
this._appManager.call('remixd', 'remove', { path: unprefixedpath })
.then(result => {
const path = this.type + '/' + unprefixedpath
delete this.filesContent[path]
resolve(true)
this.init()
}).catch(error => {
if (error) console.log(error)
resolve(false)
})
.then(result => {
const path = this.type + '/' + unprefixedpath
delete this.filesContent[path]
resolve(true)
this.init()
}).catch(error => {
if (error) console.log(error)
resolve(false)
})
})
}
rename (oldPath, newPath, isFolder) {
const unprefixedoldPath = this.removePrefix(oldPath)
const unprefixednewPath = this.removePrefix(newPath)
if (!this._isReady) return new Promise((resolve, reject) => reject('provider not ready'))
if (!this._isReady) return new Promise((resolve, reject) => reject(new Error('provider not ready')))
return this._appManager.call('remixd', 'rename', { oldPath: unprefixedoldPath, newPath: unprefixednewPath })
.then(result => {
const newPath = this.type + '/' + unprefixednewPath
const oldPath = this.type + '/' + unprefixedoldPath
this.filesContent[newPath] = this.filesContent[oldPath]
delete this.filesContent[oldPath]
this.init(() => {
this.event.trigger('fileRenamed', [oldPath, newPath, isFolder])
.then(result => {
const newPath = this.type + '/' + unprefixednewPath
const oldPath = this.type + '/' + unprefixedoldPath
this.filesContent[newPath] = this.filesContent[oldPath]
delete this.filesContent[oldPath]
this.init(() => {
this.event.trigger('fileRenamed', [oldPath, newPath, isFolder])
})
return result
}).catch(error => {
console.log(error)
if (this.error[error.code]) error = this.error[error.code]
this.event.trigger('fileRenamedError', [this.error[error.code]])
})
return result
}).catch(error => {
console.log(error)
if (this.error[error.code]) error = this.error[error.code]
this.event.trigger('fileRenamedError', [this.error[error.code]])
})
}
isExternalFolder (path) {
@ -190,7 +190,7 @@ module.exports = class RemixDProvider {
async isDirectory (path) {
const unprefixedpath = this.removePrefix(path)
if (!this._isReady) throw new Error('provider not ready')
return await this._appManager.call('remixd', 'isDirectory', {path: unprefixedpath})
return await this._appManager.call('remixd', 'isDirectory', { path: unprefixedpath })
}
async isFile (path) {

@ -61,7 +61,7 @@ export class RemixdHandle extends WebsocketPlugin {
* @param {String} txHash - hash of the transaction
*/
async connectToLocalhost () {
let connection = (error) => {
const connection = (error) => {
if (error) {
console.log(error)
modalDialogCustom.alert(
@ -91,7 +91,8 @@ export class RemixdHandle extends WebsocketPlugin {
modalDialog(
'Connect to localhost',
remixdDialog(),
{ label: 'Connect',
{
label: 'Connect',
fn: () => {
try {
super.activate()
@ -107,7 +108,8 @@ export class RemixdHandle extends WebsocketPlugin {
}
}
},
{ label: 'Cancel',
{
label: 'Cancel',
fn: () => {
this.canceled()
}

@ -1,12 +1,12 @@
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
var yo = require('yo-yo')
var EventManager = require('../../lib/events')
var FileExplorer = require('../files/file-explorer')
var { RemixdHandle } = require('../files/remixd-handle.js')
var globalRegistry = require('../../global/registry')
var css = require('./styles/file-panel-styles')
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
var canUpload = window.File || window.FileReader || window.FileList || window.Blob
@ -41,7 +41,6 @@ const profile = {
}
module.exports = class Filepanel extends ViewPlugin {
constructor (appManager) {
super(profile)
var self = this
@ -60,7 +59,7 @@ module.exports = class Filepanel extends ViewPlugin {
var fileExplorer = createProvider('browser', ['createNewFile', 'publishToGist', canUpload ? 'uploadFile' : ''])
var fileSystemExplorer = createProvider('localhost')
self.remixdHandle = new RemixdHandle(fileSystemExplorer, self._deps.fileProviders['localhost'], appManager)
self.remixdHandle = new RemixdHandle(fileSystemExplorer, self._deps.fileProviders.localhost, appManager)
const explorers = yo`
<div>
@ -85,22 +84,21 @@ module.exports = class Filepanel extends ViewPlugin {
self.event = event
var element = template()
fileExplorer.ensureRoot()
self._deps.fileProviders['localhost'].event.register('connecting', (event) => {
self._deps.fileProviders.localhost.event.register('connecting', (event) => {
})
self._deps.fileProviders['localhost'].event.register('connected', (event) => {
self._deps.fileProviders.localhost.event.register('connected', (event) => {
fileSystemExplorer.show()
})
self._deps.fileProviders['localhost'].event.register('errored', (event) => {
self._deps.fileProviders.localhost.event.register('errored', (event) => {
fileSystemExplorer.hide()
})
self._deps.fileProviders['localhost'].event.register('closed', (event) => {
self._deps.fileProviders.localhost.event.register('closed', (event) => {
fileSystemExplorer.hide()
})
self.render = function render () { return element }
}
}

@ -33,6 +33,7 @@ export class MainView {
this.appManager = appManager
this.init()
}
showApp (name) {
this.fileManager.unselectCurrentFile()
this.mainPanel.showContent(name)
@ -40,9 +41,11 @@ export class MainView {
this._components.contextView.hide()
this._view.mainPanel.style.display = 'block'
}
getAppPanel () {
return this.mainPanel
}
init () {
var self = this
self._deps = {
@ -86,7 +89,7 @@ export class MainView {
}
}
const contextView = new ContextView({contextualListener: self._components.contextualListener, editor: self.editor})
const contextView = new ContextView({ contextualListener: self._components.contextualListener, editor: self.editor })
self._components.contextView = contextView
@ -97,9 +100,11 @@ export class MainView {
})
}
}
_terminalTopOffset () {
return this._deps.config.get('terminal-top-offset') || 150
}
_adjustLayout (direction, delta) {
var limitUp = 0
var limitDown = 32
@ -129,36 +134,45 @@ export class MainView {
self._components.terminal.scroll2bottom()
}
}
minimizeTerminal () {
this._adjustLayout('top')
}
showTerminal (offset) {
this._adjustLayout('top', offset || this._terminalTopOffset())
}
getTerminal () {
return this._components.terminal
}
getEditor () {
var self = this
return self.editor
}
refresh () {
var self = this
self._view.tabs.onmouseenter()
}
log (data = {}) {
var self = this
var command = self._components.terminal.commands[data.type]
if (typeof command === 'function') command(data.value)
}
logMessage (msg) {
var self = this
self.log({type: 'log', value: msg})
self.log({ type: 'log', value: msg })
}
logHtmlMessage (msg) {
var self = this
self.log({type: 'html', value: msg})
self.log({ type: 'html', value: msg })
}
render () {
var self = this
if (self._view.mainview) return self._view.mainview
@ -184,12 +198,13 @@ export class MainView {
return self._view.mainview
}
registerCommand (name, command, opts) {
var self = this
return self._components.terminal.registerCommand(name, command, opts)
}
updateTerminalFilter (filter) {
this._components.terminal.updateJournal(filter)
}
}

@ -93,10 +93,11 @@ export class TabProxy {
}
})
}
updateImgStyles () {
const images = this._view.filetabs.getElementsByClassName('image')
if (images.length !== 0) {
for (let element of images) {
for (const element of images) {
globalRegistry.get('themeModule').api.fixInvert(element)
};
}
@ -147,8 +148,8 @@ export class TabProxy {
const tabPath = slash.reverse()
const tempTitle = []
if(!title) {
for(let i = 0; i < tabPath.length; i++) {
if (!title) {
for (let i = 0; i < tabPath.length; i++) {
tempTitle.push(tabPath[i])
const formatPath = [...tempTitle].reverse()
const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/'))
@ -179,7 +180,7 @@ export class TabProxy {
tooltip: duplicateTabName
})
}
break;
break
}
}
} else {

@ -51,7 +51,7 @@ class Terminal extends Plugin {
self._components.cmdInterpreter = new CommandInterpreterAPI(this, null, self.blockchain)
self._components.autoCompletePopup = new AutoCompletePopup(self._opts)
self._components.autoCompletePopup.event.register('handleSelect', function (input) {
let textList = self._view.input.innerText.split(' ')
const textList = self._view.input.innerText.split(' ')
textList.pop()
textList.push(input)
self._view.input.innerText = textList
@ -90,33 +90,38 @@ class Terminal extends Plugin {
if (opts.shell) self._shell = opts.shell // ???
register(self)
}
onActivation () {
this.on('scriptRunner', 'log', (msg) => {
this.commands['log'].apply(this.commands, msg.data)
this.commands.log.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'info', (msg) => {
this.commands['info'].apply(this.commands, msg.data)
this.commands.info.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'warn', (msg) => {
this.commands['warn'].apply(this.commands, msg.data)
this.commands.warn.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'error', (msg) => {
this.commands['error'].apply(this.commands, msg.data)
this.commands.error.apply(this.commands, msg.data)
})
}
onDeactivation () {
this.off('scriptRunner', 'log')
this.off('scriptRunner', 'info')
this.off('scriptRunner', 'warn')
this.off('scriptRunner', 'error')
}
logHtml (html) {
var command = this.commands['html']
var command = this.commands.html
if (typeof command === 'function') command(html)
}
focus () {
if (this._view.input) this._view.input.focus()
}
render () {
var self = this
if (self._view.el) return self._view.el
@ -311,7 +316,7 @@ class Terminal extends Plugin {
event.key === 'ArrowRight' ||
event.key === 'Esc' ||
event.key === 'Escape'
) return
) return
refocus()
}
@ -538,6 +543,7 @@ class Terminal extends Plugin {
}
}
}
putCursor2End (editable) {
var range = document.createRange()
range.selectNode(editable)
@ -565,6 +571,7 @@ class Terminal extends Plugin {
editable.focus()
}
updateJournal (filterEvent) {
var self = this
var commands = self.data.activeFilters.commands
@ -605,6 +612,7 @@ class Terminal extends Plugin {
self._view.journal.appendChild(df)
})
}
_appendItem (item) {
var self = this
var { el, gidx } = item
@ -618,12 +626,14 @@ class Terminal extends Plugin {
}
if (self.data.activeFilters.commands[item.cmd]) self._jobs.push(el)
}
scroll2bottom () {
var self = this
setTimeout(function () {
self._view.term.scrollTop = self._view.term.scrollHeight
}, 0)
}
_blocksRenderer (mode) {
if (mode === 'html') {
return function logger (args, scopedCommands, append) {
@ -634,7 +644,8 @@ class Terminal extends Plugin {
log: 'text-info',
info: 'text-info',
warn: 'text-warning',
error: 'text-danger' }[mode] // defaults
error: 'text-danger'
}[mode] // defaults
if (mode) {
const filterUndefined = (el) => el !== undefined && el !== null
@ -653,6 +664,7 @@ class Terminal extends Plugin {
throw new Error('mode is not supported')
}
}
_scopeCommands (append) {
var self = this
var scopedCommands = {}
@ -665,9 +677,11 @@ class Terminal extends Plugin {
})
return scopedCommands
}
registerFilter (commandName, filterFn) {
this.data.filterFns[commandName] = filterFn
}
registerCommand (name, command, opts) {
var self = this
name = String(name)
@ -713,6 +727,7 @@ class Terminal extends Plugin {
}
return self.commands[name]
}
async _shell (script, scopedCommands, done) { // default shell
if (script.indexOf('remix:') === 0) {
return done(null, 'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.')

@ -1,11 +1,11 @@
var yo = require('yo-yo')
var StaticAnalysis = require('./staticanalysis/staticAnalysisView')
var EventManager = require('../../lib/events')
import { ViewPlugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import * as packageJson from '../../../../../package.json'
var yo = require('yo-yo')
var StaticAnalysis = require('./staticanalysis/staticAnalysisView')
var EventManager = require('../../lib/events')
const profile = {
name: 'solidityStaticAnalysis',
displayName: 'Solidity static analysis',
@ -20,7 +20,6 @@ const profile = {
}
class AnalysisTab extends ViewPlugin {
constructor (registry) {
super(profile)
this.event = new EventManager()
@ -32,19 +31,18 @@ class AnalysisTab extends ViewPlugin {
if (!this.staticanalysis) this.staticanalysis = new StaticAnalysis(this.registry, this)
this.staticanalysis.event.register('staticAnaysisWarning', (count) => {
if (count > 0) {
this.emit('statusChanged', {key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning'})
this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' })
} else if (count === 0) {
this.emit('statusChanged', {key: 'succeed', title: 'no warning', type: 'success'})
this.emit('statusChanged', { key: 'succeed', title: 'no warning', type: 'success' })
} else {
// count ==-1 no compilation result
this.emit('statusChanged', {key: 'none'})
this.emit('statusChanged', { key: 'none' })
}
})
this.registry.put({api: this.staticanalysis, name: 'staticanalysis'})
this.registry.put({ api: this.staticanalysis, name: 'staticanalysis' })
return yo`<div class="px-3 pb-1" id="staticanalysisView">${this.staticanalysis.render()}</div>`
}
}
module.exports = AnalysisTab

@ -1,4 +1,9 @@
/* global */
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import publishToStorage from '../../publishToStorage'
import { compile } from '../compiler/compiler-helpers'
const EventEmitter = require('events')
const $ = require('jquery')
const yo = require('yo-yo')
@ -17,11 +22,6 @@ var css = require('./styles/compile-tab-styles')
const CompileTabLogic = require('./compileTab/compileTab.js')
const CompilerContainer = require('./compileTab/compilerContainer.js')
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import publishToStorage from '../../publishToStorage'
import { compile } from '../compiler/compiler-helpers'
const profile = {
name: 'solidity',
displayName: 'Solidity compiler',
@ -41,7 +41,6 @@ const profile = {
// - methods: ['getCompilationResult']
class CompileTab extends ViewPlugin {
constructor (editor, config, renderer, fileProvider, fileManager) {
super(profile)
this.events = new EventEmitter()
@ -85,19 +84,19 @@ class CompileTab extends ViewPlugin {
listenToEvents () {
this.data.eventHandlers.onContentChanged = () => {
this.emit('statusChanged', {key: 'edited', title: 'the content has changed, needs recompilation', type: 'info'})
this.emit('statusChanged', { key: 'edited', title: 'the content has changed, needs recompilation', type: 'info' })
}
this.editor.event.register('contentChanged', this.data.eventHandlers.onContentChanged)
this.data.eventHandlers.onLoadingCompiler = () => {
this.data.loading = true
this.emit('statusChanged', {key: 'loading', title: 'loading compiler...', type: 'info'})
this.emit('statusChanged', { key: 'loading', title: 'loading compiler...', type: 'info' })
}
this.compiler.event.register('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
this.data.eventHandlers.onCompilerLoaded = () => {
this.data.loading = false
this.emit('statusChanged', {key: 'none'})
this.emit('statusChanged', { key: 'none' })
}
this.compiler.event.register('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
@ -105,7 +104,7 @@ class CompileTab extends ViewPlugin {
if (this._view.errorContainer) {
this._view.errorContainer.innerHTML = ''
}
this.emit('statusChanged', {key: 'loading', title: 'compiling...', type: 'info'})
this.emit('statusChanged', { key: 'loading', title: 'compiling...', type: 'info' })
}
this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)
@ -130,7 +129,7 @@ class CompileTab extends ViewPlugin {
title: `compilation finished successful with warning${data.errors.length > 1 ? 's' : ''}`,
type: 'warning'
})
} else this.emit('statusChanged', {key: 'succeed', title: 'compilation successful', type: 'success'})
} else this.emit('statusChanged', { key: 'succeed', title: 'compilation successful', type: 'success' })
// Store the contracts
this.data.contractsDetails = {}
this.compiler.visitContracts((contract) => {
@ -142,24 +141,24 @@ class CompileTab extends ViewPlugin {
})
} else {
const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + data.error ? 1 : 0)
this.emit('statusChanged', {key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error'})
this.emit('statusChanged', { key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error' })
}
// Update contract Selection
let contractMap = {}
const contractMap = {}
if (success) this.compiler.visitContracts((contract) => { contractMap[contract.name] = contract })
let contractSelection = this.contractSelection(contractMap)
const contractSelection = this.contractSelection(contractMap)
yo.update(this._view.contractSelection, contractSelection)
if (data['error']) {
if (data.error) {
this.renderer.error(
data['error'].formattedMessage || data['error'],
data.error.formattedMessage || data.error,
this._view.errorContainer,
{type: data['error'].severity || 'error'}
{ type: data.error.severity || 'error' }
)
if (data['error'].mode === 'panic') {
if (data.error.mode === 'panic') {
return modalDialogCustom.alert(yo`
<div><i class="fas fa-exclamation-circle ${css.panicError}" aria-hidden="true"></i>
The compiler returned with the following internal error: <br> <b>${data['error'].formattedMessage}.<br>
The compiler returned with the following internal error: <br> <b>${data.error.formattedMessage}.<br>
The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet.
It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected).</b><br>
Please join <a href="https://gitter.im/ethereum/remix" target="blank" >remix gitter channel</a> for more information.</div>`)
@ -169,10 +168,10 @@ class CompileTab extends ViewPlugin {
data.errors.forEach((err) => {
if (this.config.get('hideWarnings')) {
if (err.severity !== 'warning') {
this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
this.renderer.error(err.formattedMessage, this._view.errorContainer, { type: err.severity })
}
} else {
this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
this.renderer.error(err.formattedMessage, this._view.errorContainer, { type: err.severity })
}
})
}
@ -280,18 +279,18 @@ class CompileTab extends ViewPlugin {
name: key,
file: getFileName(contractMap[key].file)
})) : []
let selectEl = yo`
const selectEl = yo`
<select
onchange="${e => this.selectContract(e.target.value)}"
data-id="compiledContracts" id="compiledContracts" class="custom-select"
>
${contractList.map(({name, file}) => yo`<option value="${name}">${name} (${file})</option>`)}
${contractList.map(({ name, file }) => yo`<option value="${name}">${name} (${file})</option>`)}
</select>
`
// define swarm logo
let result = contractList.length
? yo`<section class="${css.compilerSection} pt-3">
const result = contractList.length
? yo`<section class="${css.compilerSection} pt-3">
<!-- Select Compiler Version -->
<div class="mb-3">
<label class="${css.compilerLabel} form-check-label" for="compiledContracts">Contract</label>
@ -326,7 +325,7 @@ class CompileTab extends ViewPlugin {
</div>
</div>
</section>`
: yo`<section class="${css.container} clearfix"><article class="px-2 mt-2 pb-0 d-flex">
: yo`<section class="${css.container} clearfix"><article class="px-2 mt-2 pb-0 d-flex">
<span class="mt-2 mx-3 w-100 alert alert-warning" role="alert">No Contract Compiled Yet</span>
</article></section>`
@ -342,6 +341,7 @@ class CompileTab extends ViewPlugin {
contractCompiledSuccess () {
return yo`<div></div>`
}
// TODO : Add error alert when compilation failed
contractCompiledError () {
return yo`<div></div>`
@ -357,18 +357,18 @@ class CompileTab extends ViewPlugin {
details () {
const help = {
'Assembly': 'Assembly opcodes describing the contract including corresponding solidity source code',
'Opcodes': 'Assembly opcodes describing the contract',
Assembly: 'Assembly opcodes describing the contract including corresponding solidity source code',
Opcodes: 'Assembly opcodes describing the contract',
'Runtime Bytecode': 'Bytecode storing the state and being executed during normal contract call',
'bytecode': 'Bytecode being executed during contract creation',
'functionHashes': 'List of declared function and their corresponding hash',
'gasEstimates': 'Gas estimation for each function call',
'metadata': 'Contains all informations related to the compilation',
'metadataHash': 'Hash representing all metadata information',
'abi': 'ABI: describing all the functions (input/output params, scope, ...)',
'name': 'Name of the compiled contract',
'swarmLocation': 'Swarm url where all metadata information can be found (contract needs to be published first)',
'web3Deploy': 'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
bytecode: 'Bytecode being executed during contract creation',
functionHashes: 'List of declared function and their corresponding hash',
gasEstimates: 'Gas estimation for each function call',
metadata: 'Contains all informations related to the compilation',
metadataHash: 'Hash representing all metadata information',
abi: 'ABI: describing all the functions (input/output params, scope, ...)',
name: 'Name of the compiled contract',
swarmLocation: 'Swarm url where all metadata information can be found (contract needs to be published first)',
web3Deploy: 'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
}
if (!this.selectedContract) throw new Error('No contract compiled yet')
const contractProperties = this.data.contractsDetails[this.selectedContract]
@ -396,7 +396,7 @@ class CompileTab extends ViewPlugin {
ret.children = item.map((item, index) => ({ key: index, value: item }))
ret.self = ''
} else if (item instanceof Object) {
ret.children = Object.keys(item).map((key) => ({key: key, value: item[key]}))
ret.children = Object.keys(item).map((key) => ({ key: key, value: item[key] }))
ret.self = ''
} else {
ret.self = item

@ -8,7 +8,6 @@ var CompilerImport = require('../../compiler/compiler-imports')
const addTooltip = require('../../ui/tooltip')
class CompileTab {
constructor (queryParams, fileManager, editor, config, fileProvider) {
this.event = new EventEmitter()
this.queryParams = queryParams
@ -149,10 +148,10 @@ class CompileTab {
(cb) => { if (!splitted) { cb('URL not parseable: ' + url) } else { this.importFileCb('localhost/installed_contracts/' + splitted[1] + '/contracts/' + splitted[2], cb) } },
(cb) => { this.importFileCb('localhost/node_modules/' + url, cb) },
(cb) => { if (!splitted) { cb('URL not parseable: ' + url) } else { this.importFileCb('localhost/node_modules/' + splitted[1] + '/contracts/' + splitted[2], cb) } }],
(error, result) => {
if (error) return this.importExternal(url, filecb)
filecb(null, result)
}
(error, result) => {
if (error) return this.importExternal(url, filecb)
filecb(null, result)
}
)
} else {
// try to resolve external content
@ -161,7 +160,6 @@ class CompileTab {
})
}
}
}
module.exports = CompileTab

@ -1,14 +1,13 @@
import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promisedMiniXhr } from '../../compiler/compiler-utils'
const yo = require('yo-yo')
const helper = require('../../../lib/helper')
const addTooltip = require('../../ui/tooltip')
const semver = require('semver')
const modalDialogCustom = require('../../ui/modal-dialog-custom')
const css = require('../styles/compile-tab-styles')
import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promisedMiniXhr } from '../../compiler/compiler-utils'
class CompilerContainer {
constructor (compileTabLogic, editor, config, queryParams) {
this._view = {}
this.compileTabLogic = compileTabLogic
@ -127,7 +126,7 @@ class CompilerContainer {
}
_disableCompileBtn (shouldDisable) {
let btn = document.getElementById('compileBtn')
const btn = document.getElementById('compileBtn')
if (!btn) return
if (shouldDisable) {
btn.classList.add('disabled')
@ -230,7 +229,7 @@ class CompilerContainer {
<option>homestead</option>
</select>`
if (this.compileTabLogic.evmVersion) {
let s = this._view.evmVersionSelector
const s = this._view.evmVersionSelector
let i
for (i = 0; i < s.options.length; i++) {
if (s.options[i].value === this.compileTabLogic.evmVersion) {
@ -363,7 +362,7 @@ class CompilerContainer {
}
onchangeEvmVersion () {
let s = this._view.evmVersionSelector
const s = this._view.evmVersionSelector
let v = s.value
if (v === 'default') {
v = null
@ -527,12 +526,12 @@ class CompilerContainer {
}
callback(allVersions, selectedVersion, isURL)
}
scheduleCompilation () {
if (!this.config.get('autoCompile')) return
if (this.data.compileTimeout) window.clearTimeout(this.data.compileTimeout)
this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout)
}
}
module.exports = CompilerContainer

@ -43,7 +43,7 @@ var getDetails = function (contractName, contract, source) {
}
if (source && contract.assembly !== null) {
detail['Assembly'] = solcTranslate.prettyPrintLegacyAssemblyJSON(contract.evm.legacyAssembly, source.content)
detail.Assembly = solcTranslate.prettyPrintLegacyAssemblyJSON(contract.evm.legacyAssembly, source.content)
}
return detail
@ -69,9 +69,9 @@ var gethDeploy = function (contractName, jsonInterface, bytecode) {
contractName = contractName.replace(/[:./]/g, '_')
code += 'var ' + contractName + 'Contract = new web3.eth.Contract(' + JSON.stringify(jsonInterface).replace('\n', '') + ');' +
'\nvar ' + contractName + ' = ' + contractName + 'Contract.deploy({'
"\n data: '0x" + bytecode + "', " +
"\n arguments: [";
'\nvar ' + contractName + ' = ' + contractName + 'Contract.deploy({' +
"\n data: '0x" + bytecode + "', " +
'\n arguments: ['
funABI.inputs.forEach(function (inp) {
code += '\n ' + inp.name + ','
@ -102,20 +102,20 @@ var formatGasEstimates = function (data) {
var ret = {}
var fun
if ('creation' in data) {
ret['Creation'] = data.creation
ret.Creation = data.creation
}
if ('external' in data) {
ret['External'] = {}
ret.External = {}
for (fun in data.external) {
ret['External'][fun] = gasToText(data.external[fun])
ret.External[fun] = gasToText(data.external[fun])
}
}
if ('internal' in data) {
ret['Internal'] = {}
ret.Internal = {}
for (fun in data.internal) {
ret['Internal'][fun] = gasToText(data.internal[fun])
ret.Internal[fun] = gasToText(data.internal[fun])
}
}
return ret

@ -1,12 +1,12 @@
const yo = require('yo-yo')
const css = require('./styles/debugger-tab-styles')
import toaster from '../ui/tooltip'
import { DebuggerUI } from '@remix-ui/debugger-ui'
import { DebuggerUI } from '@remix-ui/debugger-ui' // eslint-disable-line
import { ViewPlugin } from '@remixproject/engine'
import remixDebug, { TransactionDebugger as Debugger } from '@remix-project/remix-debug'
import * as packageJson from '../../../../../package.json'
import React from 'react'
import React from 'react' // eslint-disable-line
import ReactDOM from 'react-dom'
const yo = require('yo-yo')
const css = require('./styles/debugger-tab-styles')
const profile = {
name: 'debugger',
@ -73,7 +73,7 @@ class DebuggerTab extends ViewPlugin {
renderComponent () {
ReactDOM.render(
<DebuggerUI debuggerModule={this} />
, this.el)
, this.el)
}
deactivate () {

@ -2,7 +2,6 @@ var yo = require('yo-yo')
var css = require('./styles/plugin-tab-styles')
class PluginTab {
constructor (json) {
this.el = null
this.data = { json }
@ -18,7 +17,6 @@ class PluginTab {
return this.el
}
}
module.exports = PluginTab

@ -1,3 +1,5 @@
import publishToStorage from '../../../publishToStorage'
var yo = require('yo-yo')
var css = require('../styles/run-tab-styles')
var modalDialogCustom = require('../../ui/modal-dialog-custom')
@ -7,8 +9,6 @@ var confirmDialog = require('../../ui/confirmDialog')
var modalDialog = require('../../ui/modaldialog')
var MultiParamManager = require('../../ui/multiParamManager')
import publishToStorage from '../../../publishToStorage'
class ContractDropdownUI {
constructor (blockchain, dropdownLogic, logCallback, runView) {
this.blockchain = blockchain
@ -48,9 +48,9 @@ class ContractDropdownUI {
listenToContextChange () {
this.blockchain.event.register('contextChanged', () => {
this.blockchain.updateNetwork((err, {name} = {}) => {
this.blockchain.updateNetwork((err, { name } = {}) => {
if (err) {
console.log(`can't detect network`)
console.log('can\'t detect network')
return
}
this.exEnvironment = this.blockchain.getProvider()
@ -119,7 +119,7 @@ class ContractDropdownUI {
this.createPanel = yo`<div class="${css.deployDropdown}"></div>`
this.orLabel = yo`<div class="${css.orLabel} mt-2">or</div>`
let el = yo`
const el = yo`
<div class="${css.container}" data-id="contractDropdownContainer">
<label class="${css.settingsLabel}">Contract</label>
<div class="${css.subcontainer}">
@ -211,16 +211,17 @@ class ContractDropdownUI {
The transaction execution will likely fail. Do you want to force sending? <br>
${msg}
</div>`,
{
label: 'Send Transaction',
fn: () => {
continueTxExecution()
}}, {
label: 'Cancel Transaction',
fn: () => {
cancelCb()
}
})
{
label: 'Send Transaction',
fn: () => {
continueTxExecution()
}
}, {
label: 'Cancel Transaction',
fn: () => {
cancelCb()
}
})
} else {
continueTxExecution()
}
@ -261,18 +262,19 @@ class ContractDropdownUI {
return modalDialog('Contract code size over limit', yo`<div>Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails. <br>
More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank">eip-170</a>
</div>`,
{
label: 'Force Send',
fn: () => {
this.deployContract(selectedContract, args, contractMetadata, compilerContracts, {continueCb, promptCb, statusCb, finalCb}, confirmationCb)
}}, {
label: 'Cancel',
fn: () => {
this.logCallback(`creation of ${selectedContract.name} canceled by user.`)
}
})
{
label: 'Force Send',
fn: () => {
this.deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb)
}
}, {
label: 'Cancel',
fn: () => {
this.logCallback(`creation of ${selectedContract.name} canceled by user.`)
}
})
}
this.deployContract(selectedContract, args, contractMetadata, compilerContracts, {continueCb, promptCb, statusCb, finalCb}, confirmationCb)
this.deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb)
}
deployContract (selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) {
@ -294,7 +296,8 @@ class ContractDropdownUI {
const content = confirmDialog(tx, amount, gasEstimation, null, this.blockchain.determineGasFees(tx), this.blockchain.determineGasPrice.bind(this.blockchain))
modalDialog('Confirm transaction', content,
{ label: 'Confirm',
{
label: 'Confirm',
fn: () => {
this.blockchain.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked)
// TODO: check if this is check is still valid given the refactor
@ -304,12 +307,13 @@ class ContractDropdownUI {
var gasPrice = this.blockchain.toWei(content.querySelector('#gasprice').value, 'gwei')
continueTxExecution(gasPrice)
}
}}, {
label: 'Cancel',
fn: () => {
return cancelCb('Transaction canceled by user.')
}
}
}, {
label: 'Cancel',
fn: () => {
return cancelCb('Transaction canceled by user.')
}
}
)
}

@ -18,11 +18,11 @@ class DropdownLogic {
// TODO: can be moved up; the event in contractDropdown will have to refactored a method instead
listenToCompilationEvents () {
let broadcastCompilationResult = (file, source, languageVersion, data) => {
const broadcastCompilationResult = (file, source, languageVersion, data) => {
// TODO check whether the tab is configured
let compiler = new CompilerAbstract(languageVersion, data, source)
const compiler = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts[languageVersion] = compiler
this.compilersArtefacts['__last'] = compiler
this.compilersArtefacts.__last = compiler
this.event.trigger('newlyCompiled', [true, data, source, compiler, languageVersion, file])
}
this.runView.on('solidity', 'compilationFinished', (file, source, languageVersion, data) =>
@ -102,9 +102,8 @@ class DropdownLogic {
}
getCompilerContracts () {
return this.compilersArtefacts['__last'].getData().contracts
return this.compilersArtefacts.__last.getData().contracts
}
}
module.exports = DropdownLogic

@ -16,7 +16,7 @@ class Recorder {
self.event = new EventManager()
self.blockchain = blockchain
self.data = { _listen: true, _replay: false, journal: [], _createdContracts: {}, _createdContractsReverse: {}, _usedAccounts: {}, _abis: {}, _contractABIReferences: {}, _linkReferences: {} }
this.blockchain.event.register('initiatingTransaction', (timestamp, tx, payLoad) => {
if (tx.useCall) return
var { from, to, value } = tx
@ -285,10 +285,10 @@ class Recorder {
json = JSON.parse(json)
} catch (e) {
return cb('A scenario file is required. It must be json formatted')
}
}
}
try {
try {
var txArray = json.transactions || []
var accounts = json.accounts || []
var options = json.options || {}
@ -304,8 +304,7 @@ class Recorder {
this.run(txArray, accounts, options, abis, linkReferences, confirmationCb, continueCb, promptCb, alertCb, logCallBack, (abi, address, contractName) => {
cb(null, abi, address, contractName)
})
})
}
}

@ -1,12 +1,12 @@
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../../package.json'
var yo = require('yo-yo')
var remixLib = require('@remix-project/remix-lib')
var EventManager = remixLib.EventManager
import { Plugin } from '@remixproject/engine'
var csjs = require('csjs-inject')
var css = require('../styles/run-tab-styles')
import * as packageJson from '../../../../../../package.json'
var modalDialogCustom = require('../../ui/modal-dialog-custom')
var modalDialog = require('../../ui/modaldialog')
var confirmDialog = require('../../ui/confirmDialog')
@ -20,7 +20,6 @@ const profile = {
}
class RecorderUI extends Plugin {
constructor (blockchain, fileManager, recorder, logCallBack, config) {
super(profile)
this.fileManager = fileManager
@ -51,8 +50,7 @@ class RecorderUI extends Plugin {
}
}
runScenario (file) {
runScenario (file) {
if (!file) return modalDialogCustom.alert('Unable to run scenerio, no specified scenario file')
var continueCb = (error, continueTxExecution, cancelCb) => {
if (error) {
@ -61,16 +59,17 @@ class RecorderUI extends Plugin {
The transaction execution will likely fail. Do you want to force sending? <br>
${msg}
</div>`,
{
label: 'Send Transaction',
fn: () => {
continueTxExecution()
}}, {
label: 'Cancel Transaction',
fn: () => {
cancelCb()
}
})
{
label: 'Send Transaction',
fn: () => {
continueTxExecution()
}
}, {
label: 'Cancel Transaction',
fn: () => {
cancelCb()
}
})
} else {
continueTxExecution()
}
@ -94,8 +93,8 @@ class RecorderUI extends Plugin {
}
this.event.trigger('newScenario', [abi, address, contractName])
})
}).catch((error) => modalDialogCustom.alert(error))
})
}).catch((error) => modalDialogCustom.alert(error))
}
getConfirmationCb (modalDialog, confirmDialog) {
@ -108,7 +107,8 @@ class RecorderUI extends Plugin {
const content = confirmDialog(tx, amount, gasEstimation, null, this.blockchain.determineGasFees(tx), this.blockchain.determineGasPrice.bind(this.blockchain))
modalDialog('Confirm transaction', content,
{ label: 'Confirm',
{
label: 'Confirm',
fn: () => {
this.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked)
// TODO: check if this is check is still valid given the refactor
@ -118,12 +118,13 @@ class RecorderUI extends Plugin {
var gasPrice = this.blockchain.toWei(content.querySelector('#gasprice').value, 'gwei')
continueTxExecution(gasPrice)
}
}}, {
label: 'Cancel',
fn: () => {
return cancelCb('Transaction canceled by user.')
}
}
}, {
label: 'Cancel',
fn: () => {
return cancelCb('Transaction canceled by user.')
}
}
)
}
@ -155,7 +156,6 @@ class RecorderUI extends Plugin {
})
})
}
}
module.exports = RecorderUI

@ -10,7 +10,6 @@ const helper = require('../../../lib/helper.js')
const globalRegistry = require('../../../global/registry')
class SettingsUI {
constructor (blockchain, networkModule) {
this.blockchain = blockchain
this.event = new EventManager()
@ -181,7 +180,7 @@ class SettingsUI {
this.blockchain.event.register('removeProvider', name => removeProvider(name))
selectExEnv.addEventListener('change', (event) => {
let context = selectExEnv.options[selectExEnv.selectedIndex].value
const context = selectExEnv.options[selectExEnv.selectedIndex].value
this.blockchain.changeExecutionContext(context, () => {
modalDialogCustom.prompt('External node request', this.web3ProviderDialogBody(), 'http://127.0.0.1:8545', (target) => {
this.blockchain.setProviderFromEndpoint(target, context, (alertMsg) => {
@ -229,22 +228,23 @@ class SettingsUI {
updatePlusButton () {
// enable/disable + button
let plusBtn = document.getElementById('remixRunPlus')
let plusTitle = document.getElementById('remixRunPlusWraper')
const plusBtn = document.getElementById('remixRunPlus')
const plusTitle = document.getElementById('remixRunPlusWraper')
switch (this.selectExEnv.value) {
case 'injected': {
case 'injected':
plusBtn.classList.add(css.disableMouseEvents)
plusTitle.title = "Unfortunately it's not possible to create an account using injected web3. Please create the account directly from your provider (i.e metamask or other of the same type)."
}
break
case 'vm': {
case 'vm':
plusBtn.classList.remove(css.disableMouseEvents)
plusTitle.title = 'Create a new account'
}
break
case 'web3': {
case 'web3':
this.onPersonalChange()
}
break
default: {
plusBtn.classList.add(css.disableMouseEvents)
@ -254,8 +254,8 @@ class SettingsUI {
}
onPersonalChange () {
let plusBtn = document.getElementById('remixRunPlus')
let plusTitle = document.getElementById('remixRunPlusWraper')
const plusBtn = document.getElementById('remixRunPlus')
const plusTitle = document.getElementById('remixRunPlusWraper')
if (!this._deps.config.get('settings/personal-mode')) {
plusBtn.classList.add(css.disableMouseEvents)
plusTitle.title = 'Creating an account is possible only in Personal mode. Please go to Settings to enable it.'
@ -291,10 +291,10 @@ class SettingsUI {
return addTooltip(`Cannot get account list: ${err}`)
}
var signMessageDialog = { 'title': 'Sign a message', 'text': 'Enter a message to sign', 'inputvalue': 'Message to sign' }
var signMessageDialog = { title: 'Sign a message', text: 'Enter a message to sign', inputvalue: 'Message to sign' }
var $txOrigin = this.el.querySelector('#txorigin')
if (!$txOrigin.selectedOptions[0] && (this.blockchain.isInjectedWeb3() || this.blockchain.isWeb3Provider())) {
return addTooltip(`Account list is empty, please make sure the current provider is properly connected to remix`)
return addTooltip('Account list is empty, please make sure the current provider is properly connected to remix')
}
var account = $txOrigin.selectedOptions[0].value
@ -332,12 +332,12 @@ class SettingsUI {
}
updateNetwork () {
this.blockchain.updateNetwork((err, {id, name} = {}) => {
this.blockchain.updateNetwork((err, { id, name } = {}) => {
if (err) {
this.netUI.innerHTML = 'can\'t detect network '
return
}
let network = this._components.networkModule.getNetworkProvider.bind(this._components.networkModule)
const network = this._components.networkModule.getNetworkProvider.bind(this._components.networkModule)
this.netUI.innerHTML = (network() !== 'vm') ? `${name} (${id || '-'}) network` : ''
})
this.fillAccountsList()
@ -368,7 +368,6 @@ class SettingsUI {
txOrigin.setAttribute('value', accounts[0])
})
}
}
module.exports = SettingsUI

@ -1,11 +1,11 @@
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const yo = require('yo-yo')
const globalRegistry = require('../../global/registry')
const tooltip = require('../ui/tooltip')
const copyToClipboard = require('../ui/copy-to-clipboard')
const EventManager = require('../../lib/events')
const css = require('./styles/settings-tab-styles')
import { ViewPlugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
const profile = {
name: 'settings',
@ -50,14 +50,14 @@ module.exports = class SettingsTab extends ViewPlugin {
}
createThemeCheckies () {
let themes = this._deps.themeModule.getThemes()
const themes = this._deps.themeModule.getThemes()
const onswitchTheme = (event, name) => {
this._deps.themeModule.switchTheme(name)
}
if (themes) {
return yo`<div class="card-text themes-container">
${themes.map((aTheme) => {
let el = yo`<div class="radio custom-control custom-radio mb-1 form-check ${css.crow}">
const el = yo`<div class="radio custom-control custom-radio mb-1 form-check ${css.crow}">
<input type="radio" onchange=${event => { onswitchTheme(event, aTheme.name) }} class="align-middle custom-control-input" name="theme" id="${aTheme.name}" data-id="settingsTabTheme${aTheme.name}">
<label class="form-check-label custom-control-label" data-id="settingsTabThemeLabel${aTheme.name}" for="${aTheme.name}">${aTheme.name} (${aTheme.quality})</label>
</div>`
@ -188,11 +188,11 @@ module.exports = class SettingsTab extends ViewPlugin {
}
function elementStateChanged (el, isChanged) {
if (isChanged) {
el.classList.remove("text-dark")
el.classList.add("text-secondary")
el.classList.remove('text-dark')
el.classList.add('text-secondary')
} else {
el.classList.add("text-dark")
el.classList.remove("text-secondary")
el.classList.add('text-dark')
el.classList.remove('text-secondary')
}
}

@ -99,7 +99,7 @@ staticAnalysisView.prototype.selectedModules = function () {
const selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
var toRun = []
for (var i = 0; i < selected.length; i++) {
toRun.push(selected[i].attributes['index'].value)
toRun.push(selected[i].attributes.index.value)
}
return toRun
}
@ -128,11 +128,10 @@ staticAnalysisView.prototype.run = function () {
groupedModules[key].forEach((el) => {
if (el.name === result.name) {
moduleName = groupedModules[key][0].categoryDisplayName
return
}
})
})
let alreadyExistedEl = this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`)
const alreadyExistedEl = this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`)
if (!alreadyExistedEl) {
warningContainer.append(`
<div class="mb-4" name="staticAnalysisModules" id="staticAnalysisModule${moduleName}">
@ -292,7 +291,7 @@ module.exports = staticAnalysisView
function preProcessModules (arr) {
return arr.map((Item, i) => {
const itemObj = new Item()
itemObj['_index'] = i
itemObj._index = i
itemObj.categoryDisplayName = itemObj.category.displayName
itemObj.categoryId = itemObj.category.id
return itemObj

@ -1,10 +1,10 @@
import { ViewPlugin } from '@remixproject/engine'
import { canUseWorker, urlFromVersion } from '../compiler/compiler-utils'
var yo = require('yo-yo')
var async = require('async')
var tooltip = require('../ui/tooltip')
var css = require('./styles/test-tab-styles')
var remixTests = require('@remix-project/remix-tests')
import { ViewPlugin } from '@remixproject/engine'
import { canUseWorker, urlFromVersion } from '../compiler/compiler-utils'
const TestTabLogic = require('./testTab/testTab')
@ -72,7 +72,7 @@ module.exports = class TestTab extends ViewPlugin {
this.data.allTests = tests
this.data.selectedTests = [...this.data.allTests]
this.updateTestFileList(tests)
if (!this.testsOutput) return
if (!this.testsOutput) return // eslint-disable-line
})
}
@ -99,7 +99,7 @@ module.exports = class TestTab extends ViewPlugin {
let selectedTests = this.data.selectedTests
selectedTests = eChecked ? [...selectedTests, test] : selectedTests.filter(el => el !== test)
this.data.selectedTests = selectedTests
let checkAll = this._view.el.querySelector('[id="checkAllTests"]')
const checkAll = this._view.el.querySelector('[id="checkAllTests"]')
const runBtn = document.getElementById('runTestsTabRunAction')
if (eChecked) {
@ -192,7 +192,7 @@ module.exports = class TestTab extends ViewPlugin {
} else {
const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : ''
const method = result.assertMethod === 'ok' ? '' : result.assertMethod
const expected = result.assertMethod === 'ok' ? `'true'` : result.expected
const expected = result.assertMethod === 'ok' ? '\'true\'' : result.expected
this.testsOutput.appendChild(yo`
<div
class="bg-light mb-2 ${css.testFailure} ${css.testLog} d-flex flex-column text-danger border-0"
@ -266,17 +266,17 @@ module.exports = class TestTab extends ViewPlugin {
updateFinalResult (_errors, result, filename) {
++this.readyTestsNumber
this.testsOutput.hidden = false
if (!result && (_errors || _errors.errors || Array.isArray(_errors) && (_errors[0].message || _errors[0].formattedMessage))) {
if (!result && (_errors && (_errors.errors || (Array.isArray(_errors) && (_errors[0].message || _errors[0].formattedMessage))))) {
this.testCallback({ type: 'contract', filename })
this.setHeader(false)
}
if (_errors && _errors.errors) {
_errors.errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, {type: err.severity}))
_errors.errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, { type: err.severity }))
} else if (_errors && Array.isArray(_errors) && (_errors[0].message || _errors[0].formattedMessage)) {
_errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, {type: err.severity}))
_errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, { type: err.severity }))
} else if (_errors && !_errors.errors && !Array.isArray(_errors)) {
// To track error like this: https://github.com/ethereum/remix/pull/1438
this.renderer.error(_errors.formattedMessage || _errors.message, this.testsOutput, {type: 'error'})
this.renderer.error(_errors.formattedMessage || _errors.message, this.testsOutput, { type: 'error' })
}
yo.update(this.resultStatistics, this.createResultLabel())
if (result) {
@ -358,9 +358,9 @@ module.exports = class TestTab extends ViewPlugin {
*/
testFromSource (content, path = 'browser/unit_test.sol') {
return new Promise((resolve, reject) => {
let runningTest = {}
const runningTest = {}
runningTest[path] = { content }
const {currentVersion, evmVersion, optimize, runs} = this.compileTab.getCurrentCompilerConfig()
const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCurrentCompilerConfig()
const currentCompilerUrl = urlFromVersion(currentVersion)
const compilerConfig = {
currentCompilerUrl,
@ -387,7 +387,7 @@ module.exports = class TestTab extends ViewPlugin {
this.fileManager.readFile(testFilePath).then((content) => {
const runningTests = {}
runningTests[testFilePath] = { content }
const {currentVersion, evmVersion, optimize, runs} = this.compileTab.getCurrentCompilerConfig()
const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCurrentCompilerConfig()
const currentCompilerUrl = urlFromVersion(currentVersion)
const compilerConfig = {
currentCompilerUrl,
@ -409,7 +409,7 @@ module.exports = class TestTab extends ViewPlugin {
}
)
}).catch((error) => {
if (error) return
if (error) return // eslint-disable-line
})
}
@ -455,7 +455,7 @@ module.exports = class TestTab extends ViewPlugin {
}
updateGenerateFileAction (currentFile) {
let el = yo`
const el = yo`
<button
class="btn border w-50"
data-id="testTabGenerateTestFile"
@ -474,7 +474,7 @@ module.exports = class TestTab extends ViewPlugin {
}
updateRunAction (currentFile) {
let el = yo`
const el = yo`
<button id="runTestsTabRunAction" title="Run tests" data-id="testTabRunTestsTabRunAction" class="w-50 btn btn-primary" onclick="${() => this.runTests()}">
<span class="fas fa-play ml-2"></span>
<label class="${css.labelOnBtn} btn btn-primary p-1 ml-2 m-0">Run</label>
@ -509,7 +509,7 @@ module.exports = class TestTab extends ViewPlugin {
updateTestFileList (tests) {
const testsMessage = (tests && tests.length ? this.listTests() : 'No test file available')
let el = yo`<div class="${css.testList} py-2 mt-0 border-bottom">${testsMessage}</div>`
const el = yo`<div class="${css.testList} py-2 mt-0 border-bottom">${testsMessage}</div>`
if (!this.testFilesListElement) {
this.testFilesListElement = el
} else {
@ -618,5 +618,4 @@ module.exports = class TestTab extends ViewPlugin {
this.updateForNewCurrent(this.fileManager.currentFile())
return el
}
}

@ -3,7 +3,6 @@ const modalDialogCustom = require('../../ui/modal-dialog-custom')
const remixPath = require('path')
class TestTabLogic {
constructor (fileManager) {
this.fileManager = fileManager
this.currentPath = 'browser/tests'
@ -23,7 +22,7 @@ class TestTabLogic {
const fileProvider = this.fileManager.fileProviderOf(this.currentPath)
if (!fileProvider) return
const splittedFileName = fileName.split('/')
let fileNameToImport = (!hasCurrent) ? fileName : this.currentPath + '/' + splittedFileName[splittedFileName.length - 1]
const fileNameToImport = (!hasCurrent) ? fileName : this.currentPath + '/' + splittedFileName[splittedFileName.length - 1]
helper.createNonClashingNameWithPrefix(fileNameToImport, fileProvider, '_test', (error, newFile) => {
if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error)
if (!fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName))) return modalDialogCustom.alert('Failed to create test file ' + newFile)
@ -106,7 +105,6 @@ contract ${contractName} {
}
`
}
}
module.exports = TestTabLogic

@ -5,16 +5,16 @@ import * as packageJson from '../../../../../package.json'
import yo from 'yo-yo'
const themes = [
{name: 'Dark', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-dark_tvx1s2.css'},
{name: 'Light', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-light_powaqg.css'},
{name: 'Midcentury', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-midcentury_hrzph3.css'},
{name: 'Black', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-black_undtds.css'},
{name: 'Candy', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014799/remix-themes/PR365/remix-candy_ikhg4m.css'},
{ name: 'Dark', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-dark_tvx1s2.css' },
{ name: 'Light', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-light_powaqg.css' },
{ name: 'Midcentury', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-midcentury_hrzph3.css' },
{ name: 'Black', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-black_undtds.css' },
{ name: 'Candy', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014799/remix-themes/PR365/remix-candy_ikhg4m.css' },
{name: 'Cerulean', quality: 'light', url: 'https://bootswatch.com/4/cerulean/bootstrap.min.css'},
{name: 'Flatly', quality: 'light', url: 'https://bootswatch.com/4/flatly/bootstrap.min.css'},
{name: 'Spacelab', quality: 'light', url: 'https://bootswatch.com/4/spacelab/bootstrap.min.css'},
{name: 'Cyborg', quality: 'dark', url: 'https://bootswatch.com/4/cyborg/bootstrap.min.css'}
{ name: 'Cerulean', quality: 'light', url: 'https://bootswatch.com/4/cerulean/bootstrap.min.css' },
{ name: 'Flatly', quality: 'light', url: 'https://bootswatch.com/4/flatly/bootstrap.min.css' },
{ name: 'Spacelab', quality: 'light', url: 'https://bootswatch.com/4/spacelab/bootstrap.min.css' },
{ name: 'Cyborg', quality: 'dark', url: 'https://bootswatch.com/4/cyborg/bootstrap.min.css' }
]
const profile = {
@ -26,7 +26,6 @@ const profile = {
}
export class ThemeModule extends Plugin {
constructor (registry) {
super(profile)
this.events = new EventEmitter()
@ -75,7 +74,7 @@ export class ThemeModule extends Plugin {
if (themeName && !Object.keys(this.themes).includes(themeName)) {
throw new Error(`Theme ${themeName} doesn't exist`)
}
const next = themeName || this.active // Name
const next = themeName || this.active // Name
const nextTheme = this.themes[next] // Theme
if (!this.forced) this._deps.config.set('settings/theme', next)
document.getElementById('theme-link').setAttribute('href', nextTheme.url)

@ -4,11 +4,11 @@ var yo = require('yo-yo')
var EventsDecoder = remixLib.execution.EventsDecoder
const transactionDetailsLinks = {
'Main': 'https://www.etherscan.io/tx/',
'Rinkeby': 'https://rinkeby.etherscan.io/tx/',
'Ropsten': 'https://ropsten.etherscan.io/tx/',
'Kovan': 'https://kovan.etherscan.io/tx/',
'Goerli': 'https://goerli.etherscan.io/tx/'
Main: 'https://www.etherscan.io/tx/',
Rinkeby: 'https://rinkeby.etherscan.io/tx/',
Ropsten: 'https://ropsten.etherscan.io/tx/',
Kovan: 'https://kovan.etherscan.io/tx/',
Goerli: 'https://goerli.etherscan.io/tx/'
}
function txDetailsLink (network, hash) {
@ -26,7 +26,7 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) {
})
// ----------------- Tx listener -----------------
let _transactionReceipts = {}
const _transactionReceipts = {}
const transactionReceiptResolver = (tx, cb) => {
if (_transactionReceipts[tx.hash]) {
return cb(null, _transactionReceipts[tx.hash])
@ -43,19 +43,19 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) {
const txlistener = blockchain.getTxListener({
api: {
contracts: function () {
if (compilersArtefacts['__last']) return compilersArtefacts.getAllContractDatas()
if (compilersArtefacts.__last) return compilersArtefacts.getAllContractDatas()
return null
},
resolveReceipt: transactionReceiptResolver
}
})
registry.put({api: txlistener, name: 'txlistener'})
registry.put({ api: txlistener, name: 'txlistener' })
blockchain.startListening(txlistener)
const eventsDecoder = new EventsDecoder({
resolveReceipt: transactionReceiptResolver
})
txlistener.startListening()
registry.put({api: eventsDecoder, name: 'eventsDecoder'})
registry.put({ api: eventsDecoder, name: 'eventsDecoder' })
}

@ -32,7 +32,6 @@ const profile = {
}
export class RunTab extends LibraryPlugin {
constructor (blockchain, pluginUDapp, config, fileManager, editor, filePanel, compilersArtefacts, networkModule, mainView, fileProvider) {
super(pluginUDapp, profile)
this.event = new EventManager()

@ -47,7 +47,6 @@ var EventManager = require('../../lib/events')
* - trigger `nodeClick` and `leafClick`
*/
class TreeView {
constructor (opts) {
this.event = new EventManager()
this.extractData = opts.extractData || this.extractDataDefault
@ -188,14 +187,14 @@ class TreeView {
var ret = {}
if (item instanceof Array) {
ret.children = item.map((item, index) => {
return {key: index, value: item}
return { key: index, value: item }
})
ret.self = 'Array'
ret.isNode = true
ret.isLeaf = false
} else if (item instanceof Object) {
ret.children = Object.keys(item).map((key) => {
return {key: key, value: item[key]}
return { key: key, value: item[key] }
})
ret.self = 'Object'
ret.isNode = true

@ -26,7 +26,7 @@ class AutoCompletePopup {
_options: []
}
self._components = {}
self._view
self._view = null
self._startingElement = 0
self._elementsToShow = 4
self._selectedElement = 0
@ -36,7 +36,7 @@ class AutoCompletePopup {
render () {
var self = this
let autoComplete = yo`
const autoComplete = yo`
<div class="${css.popup} alert alert-secondary">
<div>
${self.data._options.map((item, index) => {
@ -69,7 +69,7 @@ class AutoCompletePopup {
function handleListSize (autoComplete) {
if (self.data._options.length >= self._startingElement) {
for (let i = self._startingElement; i < (self._elementsToShow + self._startingElement); i++) {
let el = autoComplete.querySelectorAll('.item')[i]
const el = autoComplete.querySelectorAll('.item')[i]
if (el) {
el.classList.remove(css.listHandlerHide)
el.classList.add(css.listHandlerShow)
@ -136,8 +136,8 @@ class AutoCompletePopup {
// enter || tab and autocompletion is off, just returning false
return false
}
let textList = inputString.split(' ')
let autoCompleteInput = textList.length > 1 ? textList[textList.length - 1] : textList[0]
const textList = inputString.split(' ')
const autoCompleteInput = textList.length > 1 ? textList[textList.length - 1] : textList[0]
if (inputString.length >= 2) {
// more than 2 letters, start completion
this.data._options = []

@ -11,6 +11,7 @@ module.exports = class Card {
self._view = {}
self.event = new EventManager()
}
render () {
const self = this
if (self._view.el) return self._view.el
@ -50,7 +51,6 @@ module.exports = class Card {
return self._view.el
}
}
const css = csjs`

@ -23,7 +23,7 @@ module.exports = function copyToClipboard (getContent, tip = 'Copy value to clip
addTooltip(e.message)
return
}
if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
try {
if (typeof copiableContent !== 'string') {
copiableContent = JSON.stringify(copiableContent, null, '\t')

@ -58,9 +58,11 @@ module.exports =
this.el = el
return el
}
setTitle (title) {
this.el.querySelector('.title span').innerHTML = title
}
minimize () {
this.isMaximised = false
this.content.style.display = 'none'
@ -68,6 +70,7 @@ module.exports =
this.el.style.width = '150px'
this.el.querySelector('.title').style.width = '146px'
}
maximise () {
this.content.style.display = 'block'
var body = document.querySelector('body')
@ -78,13 +81,14 @@ module.exports =
this.el.style.left = this.isMaximised ? '0%' : '50%'
this.el.querySelector('.title').style.width = 'inherit'
}
close () {
if (this.closeCb) this.closeCb()
if (this.el.parentElement) {
this.el.parentElement.removeChild(this.el)
}
}
}
}
function dragElement (elmnt) {
var pos1 = 0

@ -35,6 +35,7 @@ class Dropdown {
self._api = opts.api
self._events = opts.events
}
render () {
var self = this
if (self._view.el) return self._view.el
@ -49,7 +50,7 @@ class Dropdown {
${self._view.selected}
<div class="${css.options} bg-light" style="display: none;}">
${self.data._options.map(label => {
let index = self.data._elements.length
const index = self.data._elements.length
var input = yo`
<input
data-idx=${index}
@ -99,7 +100,7 @@ class Dropdown {
var label = self.data._dependencies[changed][dep]
var el = self.data._elements[self.data._options.indexOf(label)]
el.checked = !el.checked
emit({currentTarget: el, type: 'changeDependencies'})
emit({ currentTarget: el, type: 'changeDependencies' })
}
}
}

@ -1,16 +1,16 @@
import * as packageJson from '../../../../../../package.json'
import { ViewPlugin } from '@remixproject/engine'
let yo = require('yo-yo')
let csjs = require('csjs-inject')
let globalRegistry = require('../../../global/registry')
let CompilerImport = require('../../compiler/compiler-imports')
const yo = require('yo-yo')
const csjs = require('csjs-inject')
const globalRegistry = require('../../../global/registry')
const CompilerImport = require('../../compiler/compiler-imports')
var modalDialogCustom = require('../modal-dialog-custom')
var tooltip = require('../tooltip')
var GistHandler = require('../../../lib/gist-handler')
var QueryParams = require('../../../lib/query-params.js')
let css = csjs`
const css = csjs`
.text {
cursor: pointer;
font-weight: normal;
@ -106,7 +106,6 @@ const profile = {
}
export class LandingPage extends ViewPlugin {
constructor (appManager, verticalIcons) {
super(profile)
this.profile = profile
@ -184,7 +183,7 @@ export class LandingPage extends ViewPlugin {
}
onThemeChanged (themeQuality) {
let twitterFrame = yo`
const twitterFrame = yo`
<div class="px-2 ${css.media}">
<a class="twitter-timeline"
data-width="350"
@ -211,10 +210,11 @@ export class LandingPage extends ViewPlugin {
this.mediumPanel.classList.toggle('d-block')
}
}
render () {
let load = (service, item, examples, info) => {
let compilerImport = new CompilerImport()
let fileProviders = globalRegistry.get('fileproviders').api
const load = (service, item, examples, info) => {
const compilerImport = new CompilerImport()
const fileProviders = globalRegistry.get('fileproviders').api
const msg = yo`
<div class="p-2">
<span>Enter the ${item} you would like to load.</span>
@ -231,7 +231,7 @@ export class LandingPage extends ViewPlugin {
if (error) {
modalDialogCustom.alert(error)
} else {
fileProviders['browser'].addExternal(type + '/' + cleanUrl, content, url)
fileProviders.browser.addExternal(type + '/' + cleanUrl, content, url)
this.verticalIcons.select('fileExplorers')
}
}
@ -282,14 +282,14 @@ export class LandingPage extends ViewPlugin {
}
const createNewFile = () => {
let fileExplorer = globalRegistry.get('fileexplorer/browser').api
const fileExplorer = globalRegistry.get('fileexplorer/browser').api
fileExplorer.createNewFile()
}
const connectToLocalhost = () => {
this.appManager.ensureActivated('remixd')
}
const importFromGist = () => {
this.gistHandler.loadFromGist({gist: ''}, globalRegistry.get('filemanager').api)
this.gistHandler.loadFromGist({ gist: '' }, globalRegistry.get('filemanager').api)
this.verticalIcons.select('fileExplorers')
}
@ -333,9 +333,9 @@ export class LandingPage extends ViewPlugin {
sourceVerifyEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
moreEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
let switchToPreviousVersion = () => {
const switchToPreviousVersion = () => {
const query = new QueryParams()
query.update({appVersion: '0.7.7'})
query.update({ appVersion: '0.7.7' })
document.location.reload()
}
const img = yo`<img class=${css.logoImg} src="assets/img/guitarRemiCroped.webp" onclick="${() => playRemi()}"></img>`
@ -380,7 +380,7 @@ export class LandingPage extends ViewPlugin {
<input title="open file" type="file" onchange="${
(event) => {
event.stopPropagation()
let fileExplorer = globalRegistry.get('fileexplorer/browser').api
const fileExplorer = globalRegistry.get('fileexplorer/browser').api
fileExplorer.uploadFile(event)
}
}" multiple />

@ -17,10 +17,10 @@ module.exports = {
var text = 'Please provide a Passphrase for the account creation'
var input = yo`
<div>
<input id="prompt1" type="password" name='prompt_text' class="${css['prompt_text']}" oninput="${(e) => validateInput(e)}">
<input id="prompt1" type="password" name='prompt_text' class="${css.prompt_text}" oninput="${(e) => validateInput(e)}">
<br>
<br>
<input id="prompt2" type="password" name='prompt_text' class="${css['prompt_text']}" oninput="${(e) => validateInput(e)}">
<input id="prompt2" type="password" name='prompt_text' class="${css.prompt_text}" oninput="${(e) => validateInput(e)}">
</div>
`
return modal(null, yo`<div>${text}<div>${input}</div></div>`,
@ -96,7 +96,7 @@ function prompt (title, text, hidden, inputValue, ok, cancel, focus) {
type=${type}
name='prompt_text'
id='prompt_text'
class="${css['prompt_text']} form-control"
class="${css.prompt_text} form-control"
value='${inputValue}'
data-id="modalDialogCustomPromptText"
oninput="${(e) => validateInput(e)}"

@ -6,10 +6,10 @@ module.exports = (title, content, ok, cancel, focusSelector, opts) => {
let agreed = true
let footerIsActive = false
opts = opts || {}
var container = document.querySelector(`.modal`)
var container = document.querySelector('.modal')
if (!container) {
document.querySelector('body').appendChild(html(opts))
container = document.querySelector(`.modal`)
container = document.querySelector('.modal')
incomingModal = false
} else incomingModal = true
@ -24,8 +24,8 @@ module.exports = (title, content, ok, cancel, focusSelector, opts) => {
cancelDiv.innerHTML = (cancel && cancel.label !== undefined) ? cancel.label : 'Cancel'
cancelDiv.style.display = cancelDiv.innerHTML === '' ? 'none' : 'inline-block'
var modal = document.querySelector(`.modal-body`)
var modalTitle = document.querySelector(`.modal-header h6`)
var modal = document.querySelector('.modal-body')
var modalTitle = document.querySelector('.modal-header h6')
modalTitle.innerHTML = ''
if (title) modalTitle.innerText = title
@ -116,7 +116,7 @@ module.exports = (title, content, ok, cancel, focusSelector, opts) => {
closeDiv.addEventListener('click', cancelListener)
document.addEventListener('keydown', modalKeyEvent)
let modalDialog = document.getElementById('modal-dialog')
const modalDialog = document.getElementById('modal-dialog')
if (modalDialog) {
modalDialog.addEventListener('click', (e) => {
footerIsActive = document.activeElement === modalDialog
@ -141,8 +141,8 @@ function html (opts) {
</div>
<div class="modal-body ${css.modalBody}" data-id="modalDialogModalBody"> - </div>
<div class="modal-footer" data-id="modalDialogModalFooter" autofocus>
<span id="modal-footer-ok" class="${css['modalFooterOk']} modal-ok btn btn-sm btn-light" tabindex='5'>OK</span>
<span id="modal-footer-cancel" class="${css['modalFooterCancel']} modal-cancel btn btn-sm btn-light" tabindex='10' data-dismiss="modal">Cancel</span>
<span id="modal-footer-ok" class="${css.modalFooterOk} modal-ok btn btn-sm btn-light" tabindex='5'>OK</span>
<span id="modal-footer-cancel" class="${css.modalFooterCancel} modal-cancel btn btn-sm btn-light" tabindex='10' data-dismiss="modal">Cancel</span>
</div>
</div>
</div>

@ -7,7 +7,6 @@ var remixLib = require('@remix-project/remix-lib')
var txFormat = remixLib.execution.txFormat
class MultiParamManager {
/**
*
* @param {bool} lookupOnly
@ -25,8 +24,8 @@ class MultiParamManager {
this.inputs = inputs
this.title = title
this.evmBC = evmBC
this.basicInputField
this.multiFields
this.basicInputField = null
this.multiFields = null
this.isDeploy = isDeploy
}
@ -126,7 +125,7 @@ class MultiParamManager {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
}
const width = this.isDeploy ? '' : 'w-50'
let funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} ${width} btn btn-sm" data-id="multiParamManagerFuncButton">${title}</button>`
const funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} ${width} btn btn-sm" data-id="multiParamManagerFuncButton">${title}</button>`
this.contractActionsContainerSingle = yo`
<div class="${css.contractActionsContainerSingle} pt-2">
${funcButton}

@ -38,7 +38,6 @@ function notAllowWarning (from, to, method) {
}
export class PermissionHandler {
constructor () {
this.permissions = this._getFromLocal()
this.currentVersion = 1
@ -130,8 +129,8 @@ export class PermissionHandler {
return false
}
return hash === from.hash
? true // Allow
: this.openPermission(from, to, method, message) // New version of a plugin
? true // Allow
: this.openPermission(from, to, method, message) // New version of a plugin
} catch (err) {
throw new Error(err)
}
@ -157,7 +156,7 @@ export class PermissionHandler {
const rememberSwitch = remember
? yo`<input type="checkbox" onchange="${switchMode}" checkbox class="form-check-input" id="remember" data-id="permissionHandlerRememberChecked">`
: yo`<input type="checkbox" onchange="${switchMode}" class="form-check-input" id="remember" data-id="permissionHandlerRememberUnchecked">`
const text = `"${fromName}" ${(remember ? `has changed and` : ``)} would like to access to "${method}" of "${toName}"`
const text = `"${fromName}" ${(remember ? 'has changed and' : '')} would like to access to "${method}" of "${toName}"`
const imgFrom = yo`<img id="permissionModalImagesFrom" src="${from.icon}" />`
const imgTo = yo`<img id="permissionModalImagesTo" src="${to.icon}" />`
const pluginsImages = yo`
@ -176,7 +175,7 @@ export class PermissionHandler {
<h6>Description</h6>
<p>${message}</p>
</div>
` : ``
` : ''
return yo`
<section class="${css.permission}">
${pluginsImages}

@ -86,15 +86,14 @@ Renderer.prototype.error = function (message, container, opt) {
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0/contracts/introspection/IERC1820Registry.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.7.4+commit.3f05b770.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
// extract line / column
let position = text.match(/^(.*?):([0-9]*?):([0-9]*?)?/)
let position = text.match(/^(.*?):([0-9]*?):([0-9]*?)?/)
opt.errLine = position ? parseInt(position[2]) - 1 : -1
opt.errCol = position ? parseInt(position[3]) : -1
// extract file
position = text.match(/^(https:.*?|http:.*?|.*?):/)
opt.errFile = position ? position[1] : ''
if (!opt.noAnnotations && opt.errFile) {
this._error(opt.errFile, {
row: opt.errLine,
@ -106,7 +105,7 @@ Renderer.prototype.error = function (message, container, opt) {
var $pre = $(opt.useSpan ? yo`<span></span>` : yo`<pre></pre>`).html(message)
let classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning'
const classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning'
var $error = $(yo`<div class="sol ${opt.type} ${classList}"><div class="close" data-id="renderer"><i class="fas fa-times"></i></div></div>`).prepend($pre)
$(container).append($error)

@ -8,7 +8,7 @@ const Web3 = require('web3')
module.exports = {
getCallBacksWithContext: (udappUI, blockchain) => {
let callbacks = {}
const callbacks = {}
callbacks.confirmationCb = confirmationCb
callbacks.continueCb = continueCb
callbacks.promptCb = promptCb
@ -46,7 +46,7 @@ const promptCb = function (okCb, cancelCb) {
}
const confirmationCb = function (network, tx, gasEstimation, continueTxExecution, cancelCb) {
let self = this
const self = this
if (network.name !== 'Main') {
return continueTxExecution(null)
}
@ -84,7 +84,8 @@ const confirmationCb = function (network, tx, gasEstimation, continueTxExecution
modalDialog(
'Confirm transaction',
content,
{ label: 'Confirm',
{
label: 'Confirm',
fn: () => {
self.blockchain.config.setUnpersistedProperty(
'doNotShowTransactionConfirmationAgain',

@ -10,7 +10,7 @@ var modal = require('./modal-dialog-custom')
*/
module.exports = function addTooltip (tooltipText, action, opts) {
action = action || function () { return yo`<div></div>` }
let t = new Toaster()
const t = new Toaster()
return t.render(tooltipText, action(t), opts)
}
@ -24,7 +24,7 @@ class Toaster {
animation(this.tooltip, css.animateTop.className)
}
/**
/**
* Force resolve the promise to close
* the toaster ignoring timeout
*/
@ -64,9 +64,9 @@ class Toaster {
over()
resolve()
}
let button = tooltipText.length > 201 ? yo`
const button = tooltipText.length > 201 ? yo`
<button class="btn btn-secondary btn-sm mx-3" style="white-space: nowrap;" onclick=${() => showFullMessage()}>Show full message</button>
` : ``
` : ''
this.tooltip = yo`
<div data-shared="tooltipPopup" class="${css.tooltip} alert alert-info p-2" onmouseenter=${() => { over() }} onmouseleave=${() => { out() }}>
@ -79,7 +79,7 @@ class Toaster {
<button data-id="tooltipCloseButton" class="fas fa-times btn-info mx-1 p-0" onclick=${() => closeTheToaster(this)}></button>
</span>
</div>`
let timeOut = () => {
const timeOut = () => {
return setTimeout(() => {
if (this.id) {
this.hide()
@ -87,13 +87,13 @@ class Toaster {
}
}, opts.time)
}
let over = () => {
const over = () => {
if (this.id) {
clearTimeout(this.id)
this.id = null
}
}
let out = () => {
const out = () => {
if (!this.id) this.id = timeOut()
}
this.id = timeOut()
@ -103,16 +103,17 @@ class Toaster {
}
}
let defaultOptions = (opts) => {
const defaultOptions = (opts) => {
opts = opts || {}
return {
time: opts.time || 7000
}
}
let animation = (tooltip, anim) => {
const animation = (tooltip, anim) => {
tooltip.classList.remove(css.animateTop.className)
tooltip.classList.remove(css.animateBottom.className)
// eslint-disable-next-line
void tooltip.offsetWidth // trick for restarting the animation
tooltip.classList.add(anim)
}

@ -159,7 +159,7 @@ class TxLogger {
}, { activate: true })
this.txListener.event.register('newBlock', (block) => {
if (!block.transactions || block.transactions && !block.transactions.length) {
if (!block.transactions || (block.transactions && !block.transactions.length)) {
this.logEmptyBlock({ block: block })
}
})
@ -190,8 +190,8 @@ function log (self, tx, receipt) {
var resolvedTransaction = self.txListener.resolvedTransaction(tx.hash)
if (resolvedTransaction) {
var compiledContracts = null
if (self._deps.compilersArtefacts['__last']) {
compiledContracts = self._deps.compilersArtefacts['__last'].getContracts()
if (self._deps.compilersArtefacts.__last) {
compiledContracts = self._deps.compilersArtefacts.__last.getContracts()
}
self.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, (error, logs) => {
if (!error) {
@ -207,13 +207,13 @@ function log (self, tx, receipt) {
function renderKnownTransaction (self, data, blockchain) {
var from = data.tx.from
var to = data.resolvedData.contractName + '.' + data.resolvedData.fn
var obj = {from, to}
var obj = { from, to }
var txType = 'knownTx'
var tx = yo`
<span id="tx${data.tx.hash}" data-id="txLogger${data.tx.hash}">
<div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}>
${checkTxStatus(data.receipt, txType)}
${context(self, {from, to, data}, blockchain)}
${context(self, { from, to, data }, blockchain)}
<div class=${css.buttons}>
<button class="${css.debug} btn btn-primary btn-sm" data-shared="txLoggerDebugButton" data-id="txLoggerDebugButton${data.tx.hash}" onclick=${(e) => debug(e, data, self)}>Debug</div>
</div>
@ -228,7 +228,7 @@ function renderCall (self, data) {
var to = data.resolvedData.contractName + '.' + data.resolvedData.fn
var from = data.tx.from ? data.tx.from : ' - '
var input = data.tx.input ? helper.shortenHexData(data.tx.input) : ''
var obj = {from, to}
var obj = { from, to }
var txType = 'call'
var tx = yo`
<span id="tx${data.tx.hash}">
@ -253,13 +253,13 @@ function renderCall (self, data) {
function renderUnknownTransaction (self, data, blockchain) {
var from = data.tx.from
var to = data.tx.to
var obj = {from, to}
var obj = { from, to }
var txType = 'unknown' + (data.tx.isCall ? 'Call' : 'Tx')
var tx = yo`
<span id="tx${data.tx.hash}">
<div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}>
${checkTxStatus(data.receipt || data.tx, txType)}
${context(self, {from, to, data}, blockchain)}
${context(self, { from, to, data }, blockchain)}
<div class=${css.buttons}>
<div class="${css.debug} btn btn-primary btn-sm" onclick=${(e) => debug(e, data, self)}>Debug</div>
</div>
@ -444,7 +444,7 @@ function createTable (opts) {
if (opts.from) table.appendChild(from)
var toHash
var data = opts.data // opts.data = data.tx
var data = opts.data // opts.data = data.tx
if (data.to) {
toHash = opts.to + ' ' + data.to
} else {

@ -18,7 +18,7 @@ var txCallBacks = require('./sendTxCallbacks')
function UniversalDAppUI (blockchain, logCallback) {
this.blockchain = blockchain
this.logCallback = logCallback
this.compilerData = {contractsDetails: {}}
this.compilerData = { contractsDetails: {} }
}
function decodeResponseToTreeView (response, fnabi) {
@ -51,7 +51,7 @@ UniversalDAppUI.prototype.renderInstance = function (contract, address, contract
// basically this has to be called for the "atAddress" (line 393) and when a contract creation succeed
// this returns a DOM element
UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address, contractName) {
let self = this
const self = this
address = (address.slice(0, 2) === '0x' ? '' : '0x') + address.toString('hex')
address = ethJSUtil.toChecksumAddress(address)
var instance = yo`<div class="instance run-instance border-dark ${css.instance} ${css.hidesub}" id="instance${address}" data-shared="universalDappUiInstance"></div>`
@ -100,8 +100,8 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
function toggleClass (e) {
$(instance).toggleClass(`${css.hidesub} bg-light`)
// e.currentTarget.querySelector('i')
e.currentTarget.querySelector('i').classList.toggle(`fa-angle-right`)
e.currentTarget.querySelector('i').classList.toggle(`fa-angle-down`)
e.currentTarget.querySelector('i').classList.toggle('fa-angle-right')
e.currentTarget.querySelector('i').classList.toggle('fa-angle-down')
}
instance.appendChild(title)
@ -179,7 +179,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
}
let calldata = calldataInput.value
if (calldata) {
if (calldata.length < 2 || calldata.length < 4 && helper.is0XPrefixed(calldata)) {
if (calldata.length < 4 && helper.is0XPrefixed(calldata)) {
return setLLIError('The calldata should be a valid hexadecimal value with size of at least one byte.')
} else {
if (helper.is0XPrefixed(calldata)) {
@ -194,7 +194,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
}
}
if (!receive && !fallback) return setLLIError(`Both 'receive' and 'fallback' functions are not defined`)
if (!receive && !fallback) return setLLIError('Both \'receive\' and \'fallback\' functions are not defined')
// we have to put the right function ABI:
// if receive is defined and that there is no calldata => receive function is called
@ -202,7 +202,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
if (receive && !calldata) args.funABI = receive
else if (fallback) args.funABI = fallback
if (!args.funABI) return setLLIError(`Please define a 'Fallback' function to send calldata and a either 'Receive' or payable 'Fallback' to send ethers`)
if (!args.funABI) return setLLIError('Please define a \'Fallback\' function to send calldata and a either \'Receive\' or payable \'Fallback\' to send ethers')
self.runTransaction(false, args, null, calldataInput.value, null)
}
@ -213,7 +213,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
// TODO this is used by renderInstance when a new instance is displayed.
// this returns a DOM element.
UniversalDAppUI.prototype.getCallButton = function (args) {
let self = this
const self = this
var outputOverride = yo`<div class=${css.value}></div>` // show return value
const isConstant = args.funABI.constant !== undefined ? args.funABI.constant : false
const lookupOnly = args.funABI.stateMutability === 'view' || args.funABI.stateMutability === 'pure' || isConstant

@ -19,7 +19,6 @@ const InjectedProvider = require('./providers/injected.js')
const NodeProvider = require('./providers/node.js')
class Blockchain {
// NOTE: the config object will need to be refactored out in remix-lib
constructor (config) {
this.event = new EventManager()
@ -201,7 +200,7 @@ class Blockchain {
if (err) {
return cb(err)
}
cb(null, {id, name})
cb(null, { id, name })
})
}
@ -259,7 +258,7 @@ class Blockchain {
if (funABI.type === 'fallback') data.dataHex = value
const useCall = funABI.stateMutability === 'view' || funABI.stateMutability === 'pure'
this.runTx({to: address, data, useCall}, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => {
this.runTx({ to: address, data, useCall }, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => {
if (error) {
return logCallback(`${logMsg} errored: ${error} `)
}
@ -416,7 +415,7 @@ class Blockchain {
})
}
self.getAccounts(function (err, accounts) {
let address = accounts[0]
const address = accounts[0]
if (err) return next(err)
if (!address) return next('No accounts available')
@ -441,7 +440,7 @@ class Blockchain {
if (error) return next(error)
const rawAddress = self.executionContext.isVM() ? result.result.createdAddress : result.result.contractAddress
let eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted')
const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted')
self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad, rawAddress])
if (error && (typeof (error) !== 'string')) {
@ -479,7 +478,6 @@ class Blockchain {
cb(error, txResult, address, returnValue)
})
}
}
module.exports = Blockchain

@ -1,7 +1,6 @@
const { EventEmitter } = require('events')
class PluginUdapp {
constructor (blockchain) {
this.blockchain = blockchain
this.events = new EventEmitter()
@ -29,7 +28,6 @@ class PluginUdapp {
pendingTransactionsCount () {
return this.blockchain.pendingTransactionsCount()
}
}
module.exports = PluginUdapp

@ -2,7 +2,6 @@ const Web3 = require('web3')
const { stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util')
class InjectedProvider {
constructor (executionContext) {
this.executionContext = executionContext
}

@ -3,7 +3,6 @@ const { stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util')
const Personal = require('web3-eth-personal')
class NodeProvider {
constructor (executionContext, config) {
this.executionContext = executionContext
this.config = config

@ -3,10 +3,9 @@ const { BN, privateToAddress, stripHexPrefix, hashPersonalMessage } = require('e
const RemixSimulator = require('@remix-project/remix-simulator')
class VMProvider {
constructor (executionContext) {
this.executionContext = executionContext
this.RemixSimulatorProvider = new RemixSimulator.Provider({executionContext: this.executionContext})
this.RemixSimulatorProvider = new RemixSimulator.Provider({ executionContext: this.executionContext })
this.RemixSimulatorProvider.init()
this.web3 = new Web3(this.RemixSimulatorProvider)
this.accounts = {}

@ -1,5 +1,4 @@
export class FramingService {
constructor (sidePanel, verticalIcon, mainView, resizeFeature) {
this.sidePanel = sidePanel
this.verticalIcon = verticalIcon
@ -13,7 +12,7 @@ export class FramingService {
this.resizeFeature.panel.clientWidth !== 0 ? this.resizeFeature.hidePanel() : this.resizeFeature.showPanel()
})
this.sidePanel.events.on('showing', () => {
this.resizeFeature.panel.clientWidth === 0 ? this.resizeFeature.showPanel() : ''
if (this.resizeFeature.panel.clientWidth === 0) this.resizeFeature.showPanel()
})
this.mainPanel.events.on('toggle', () => {
this.resizeFeature.showPanel()

@ -31,15 +31,17 @@ class CmdInterpreterAPI {
'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm, ipfs or raw http',
'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.',
'remix.exeCurrent()': 'Run the script currently displayed in the editor',
'remix.help()': 'Display this help message',
'remix.help()': 'Display this help message'
}
}
log () { arguments[0] != null ? this._components.terminal.commands.html(arguments[0]) : this._components.terminal.commands.html(arguments[1]) }
loadgist (id, cb) {
const self = this
self._components.gistHandler.loadFromGist({gist: id}, this._deps.fileManager)
self._components.gistHandler.loadFromGist({ gist: id }, this._deps.fileManager)
if (cb) cb()
}
loadurl (url, cb) {
const self = this
self._components.fileImport.import(url,
@ -77,9 +79,11 @@ class CmdInterpreterAPI {
}
})
}
exeCurrent (cb) {
return this.execute(undefined, cb)
}
execute (file, cb) {
const self = this
@ -117,6 +121,7 @@ class CmdInterpreterAPI {
_execute(content, cb)
})
}
help (cb) {
const self = this
var help = yo`<div></div>`

@ -1,54 +1,54 @@
const allPrograms = [
{'ethers': 'The ethers.js library is a compact and complete JavaScript library for Ethereum.'},
{'remix': 'Ethereum IDE and tools for the web.'},
{'web3': 'The web3.js library is a collection of modules which contain specific functionality for the ethereum ecosystem.'},
{'swarmgw': 'This library can be used to upload/download files to Swarm via https://swarm-gateways.net/.'}
{ ethers: 'The ethers.js library is a compact and complete JavaScript library for Ethereum.' },
{ remix: 'Ethereum IDE and tools for the web.' },
{ web3: 'The web3.js library is a collection of modules which contain specific functionality for the ethereum ecosystem.' },
{ swarmgw: 'This library can be used to upload/download files to Swarm via https://swarm-gateways.net/.' }
]
const allCommands = [
{'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.'},
{'remix.exeCurrent()': 'Run the script currently displayed in the editor.'},
{'remix.help()': 'Display this help message.'},
{'remix.loadgist(id)': 'Load a gist in the file explorer.'},
{'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.'},
{ 'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.' },
{ 'remix.exeCurrent()': 'Run the script currently displayed in the editor.' },
{ 'remix.help()': 'Display this help message.' },
{ 'remix.loadgist(id)': 'Load a gist in the file explorer.' },
{ 'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.' },
{'swarmgw.get(url, cb)': 'Download files from Swarm via https://swarm-gateways.net/'},
{'swarmgw.put(content, cb)': 'Upload files to Swarm via https://swarm-gateways.net/'},
{ 'swarmgw.get(url, cb)': 'Download files from Swarm via https://swarm-gateways.net/' },
{ 'swarmgw.put(content, cb)': 'Upload files to Swarm via https://swarm-gateways.net/' },
{'ethers.Contract': 'This API provides a graceful connection to a contract deployed on the blockchain, simplifying calling and querying its functions and handling all the binary protocol and conversion as necessarily.'},
{'ethers.HDNode': 'A Hierarchical Deterministic Wallet represents a large tree of private keys which can reliably be reproduced from an initial seed.'},
{'ethers.Interface': 'The Interface Object is a meta-class that accepts a Solidity (or compatible) Application Binary Interface (ABI) and populates functions to deal with encoding and decoding the parameters to pass in and results returned.'},
{'ethers.providers': 'A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and sending state changing transactions.'},
{'ethers.SigningKey': 'The SigningKey interface provides an abstraction around the secp256k1 elliptic curve cryptography library.'},
{'ethers.utils': 'The utility functions exposed in both the ethers umbrella package and the ethers-utils.'},
{'ethers.utils.AbiCoder': 'Create a new ABI Coder object'},
{'ethers.utils.RLP': 'This encoding method is used internally for several aspects of Ethereum, such as encoding transactions and determining contract addresses.'},
{'ethers.Wallet': 'A wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.'},
{'ethers.version': 'Contains the version of the ethers container object.'},
{ 'ethers.Contract': 'This API provides a graceful connection to a contract deployed on the blockchain, simplifying calling and querying its functions and handling all the binary protocol and conversion as necessarily.' },
{ 'ethers.HDNode': 'A Hierarchical Deterministic Wallet represents a large tree of private keys which can reliably be reproduced from an initial seed.' },
{ 'ethers.Interface': 'The Interface Object is a meta-class that accepts a Solidity (or compatible) Application Binary Interface (ABI) and populates functions to deal with encoding and decoding the parameters to pass in and results returned.' },
{ 'ethers.providers': 'A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and sending state changing transactions.' },
{ 'ethers.SigningKey': 'The SigningKey interface provides an abstraction around the secp256k1 elliptic curve cryptography library.' },
{ 'ethers.utils': 'The utility functions exposed in both the ethers umbrella package and the ethers-utils.' },
{ 'ethers.utils.AbiCoder': 'Create a new ABI Coder object' },
{ 'ethers.utils.RLP': 'This encoding method is used internally for several aspects of Ethereum, such as encoding transactions and determining contract addresses.' },
{ 'ethers.Wallet': 'A wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.' },
{ 'ethers.version': 'Contains the version of the ethers container object.' },
{'web3.eth': 'Eth module for interacting with the Ethereum network.'},
{'web3.eth.accounts': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.'},
{'web3.eth.abi': 'The web3.eth.abi functions let you de- and encode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).'},
{'web3.eth.ens': 'The web3.eth.ens functions let you interacting with ENS.'},
{'web3.eth.Iban': 'The web3.eth.Iban function lets convert Ethereum addresses from and to IBAN and BBAN.'},
{'web3.eth.net': 'Net module for interacting with network properties.'},
{'web3.eth.personal': 'Personal module for interacting with the Ethereum accounts.'},
{'web3.eth.subscribe': 'The web3.eth.subscribe function lets you subscribe to specific events in the blockchain.'},
{'web3.givenProvider': 'When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise null.'},
{'web3.modules': 'Contains the version of the web3 container object.'},
{'web3.providers': 'Contains the current available providers.'},
{'web3.shh': 'Shh module for interacting with the whisper protocol'},
{'web3.utils': 'This package provides utility functions for Ethereum dapps and other web3.js packages.'},
{'web3.version': 'Contains the version of the web3 container object.'},
{ 'web3.eth': 'Eth module for interacting with the Ethereum network.' },
{ 'web3.eth.accounts': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.' },
{ 'web3.eth.abi': 'The web3.eth.abi functions let you de- and encode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).' },
{ 'web3.eth.ens': 'The web3.eth.ens functions let you interacting with ENS.' },
{ 'web3.eth.Iban': 'The web3.eth.Iban function lets convert Ethereum addresses from and to IBAN and BBAN.' },
{ 'web3.eth.net': 'Net module for interacting with network properties.' },
{ 'web3.eth.personal': 'Personal module for interacting with the Ethereum accounts.' },
{ 'web3.eth.subscribe': 'The web3.eth.subscribe function lets you subscribe to specific events in the blockchain.' },
{ 'web3.givenProvider': 'When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise null.' },
{ 'web3.modules': 'Contains the version of the web3 container object.' },
{ 'web3.providers': 'Contains the current available providers.' },
{ 'web3.shh': 'Shh module for interacting with the whisper protocol' },
{ 'web3.utils': 'This package provides utility functions for Ethereum dapps and other web3.js packages.' },
{ 'web3.version': 'Contains the version of the web3 container object.' },
{'web3.eth.clearSubscriptions();': 'Resets subscriptions.'},
{'web3.eth.Contract(jsonInterface[, address][, options])': 'The web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain.'},
{'web3.eth.accounts.create([entropy]);': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.'},
{'web3.eth.getAccounts();': 'Retrieve the list of accounts'},
{'web3.eth.accounts.privateKeyToAccount(privateKey [, ignoreLength ]);': 'Get the account from the private key'},
{'web3.eth.accounts.signTransaction(tx, privateKey [, callback]);': 'Sign Transaction'},
{'web3.eth.accounts.recoverTransaction(rawTransaction);': 'Sign Transaction'},
{'web3.eth.accounts.hashMessage(message);': 'Hash message'},
{ 'web3.eth.clearSubscriptions();': 'Resets subscriptions.' },
{ 'web3.eth.Contract(jsonInterface[, address][, options])': 'The web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain.' },
{ 'web3.eth.accounts.create([entropy]);': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.' },
{ 'web3.eth.getAccounts();': 'Retrieve the list of accounts' },
{ 'web3.eth.accounts.privateKeyToAccount(privateKey [, ignoreLength ]);': 'Get the account from the private key' },
{ 'web3.eth.accounts.signTransaction(tx, privateKey [, callback]);': 'Sign Transaction' },
{ 'web3.eth.accounts.recoverTransaction(rawTransaction);': 'Sign Transaction' },
{ 'web3.eth.accounts.hashMessage(message);': 'Hash message' }
]
module.exports = {

@ -12,7 +12,7 @@ function GistHandler (_window) {
if (!cb) cb = () => {}
var loadingFromGist = false
var gistId
if (params['gist'] === '') {
if (params.gist === '') {
loadingFromGist = true
modalDialogCustom.prompt('Load a Gist', 'Enter the ID of the Gist or URL you would like to load.', null, (target) => {
if (target !== '') {
@ -26,7 +26,7 @@ function GistHandler (_window) {
})
return loadingFromGist
} else {
gistId = params['gist']
gistId = params.gist
loadingFromGist = !!gistId
}
if (loadingFromGist) {
@ -53,7 +53,7 @@ function GistHandler (_window) {
modalDialogCustom.alert(`Gist load error: ${error || data.message}`)
return
}
let obj = {}
const obj = {}
Object.keys(data.files).forEach((element) => {
obj['/gists/' + gistId + '/' + element] = data.files[element]
})

@ -86,4 +86,3 @@ export default class PanelsResize {
this.panel.style.display = 'flex'
}
}

@ -91,7 +91,7 @@ class Remixd {
return yo`<div>Connection to Remixd closed. Localhost connection not available anymore.</div>`
}
if (this.connected) {
modalDialog('Lost connection to Remixd!', remixdDialog(), {}, {label: ''})
modalDialog('Lost connection to Remixd!', remixdDialog(), {}, { label: '' })
}
this.connected = false
this.socket = null
@ -113,7 +113,7 @@ class Remixd {
resolve(data.id)
} else {
callback && typeof callback === 'function' && callback('Socket not ready. state:' + this.socket.readyState)
reject('Socket not ready. state:' + this.socket.readyState)
reject(new Error('Socket not ready. state:' + this.socket.readyState))
}
})
})

@ -3,5 +3,5 @@
*
* See: https://github.com/zloirock/core-js#babel
*/
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'core-js/stable'
import 'regenerator-runtime/runtime'

@ -4,6 +4,7 @@ module.exports = class registry {
constructor () {
this.state = {}
}
put ({ api, name }) {
// const serveruid = moduleID() + '.' + (name || '')
if (this.state[name]) return this.state[name]
@ -14,6 +15,7 @@ module.exports = class registry {
this.state[name] = { server }
return server
}
get (name) {
// const clientuid = moduleID()
const state = this.state[name]

@ -19,7 +19,6 @@ export function canActivate (name) {
}
export class RemixAppManager extends PluginManager {
constructor () {
super()
this.event = new EventEmitter()
@ -94,17 +93,17 @@ export class RemixAppManager extends PluginManager {
async registeredPlugins () {
const res = await fetch(this.pluginsDirectory)
let plugins = await res.json()
const plugins = await res.json()
plugins.push({
'name': 'walletconnect',
'kind': 'provider',
'displayName': 'Wallet Connect',
'events': [],
'methods': ['sendAsync'],
'url': 'ipfs://QmUD93rF9RKaDabCM5jFTHraBKd72HApbv7m9Vd5i5EHZe',
'description': 'Use an external wallet for transacting',
'icon': 'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHdpZHRoPSI1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyYWRpYWxHcmFkaWVudCBpZD0iYSIgY3g9IjAlIiBjeT0iNTAlIiByPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1ZDlkZjYiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMDZmZmYiLz48L3JhZGlhbEdyYWRpZW50PjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PHBhdGggZD0ibTI1NiAwYzE0MS4zODQ4OTYgMCAyNTYgMTE0LjYxNTEwNCAyNTYgMjU2cy0xMTQuNjE1MTA0IDI1Ni0yNTYgMjU2LTI1Ni0xMTQuNjE1MTA0LTI1Ni0yNTYgMTE0LjYxNTEwNC0yNTYgMjU2LTI1NnoiIGZpbGw9InVybCgjYSkiLz48cGF0aCBkPSJtNjQuNjkxNzU1OCAzNy43MDg4Mjk4YzUxLjUzMjgwNzItNTAuMjc4NDM5NyAxMzUuMDgzOTk0Mi01MC4yNzg0Mzk3IDE4Ni42MTY3OTkyIDBsNi4yMDIwNTcgNi4wNTEwOTA2YzIuNTc2NjQgMi41MTM5MjE4IDIuNTc2NjQgNi41ODk3OTQ4IDAgOS4xMDM3MTc3bC0yMS4yMTU5OTggMjAuNjk5NTc1OWMtMS4yODgzMjEgMS4yNTY5NjE5LTMuMzc3MSAxLjI1Njk2MTktNC42NjU0MjEgMGwtOC41MzQ3NjYtOC4zMjcwMjA1Yy0zNS45NTA1NzMtMzUuMDc1NDk2Mi05NC4yMzc5NjktMzUuMDc1NDk2Mi0xMzAuMTg4NTQ0IDBsLTkuMTQwMDI4MiA4LjkxNzU1MTljLTEuMjg4MzIxNyAxLjI1Njk2MDktMy4zNzcxMDE2IDEuMjU2OTYwOS00LjY2NTQyMDggMGwtMjEuMjE1OTk3My0yMC42OTk1NzU5Yy0yLjU3NjY0MDMtMi41MTM5MjI5LTIuNTc2NjQwMy02LjU4OTc5NTggMC05LjEwMzcxNzd6bTIzMC40OTM0ODUyIDQyLjgwODkxMTcgMTguODgyMjc5IDE4LjQyMjcyNjJjMi41NzY2MjcgMi41MTM5MTAzIDIuNTc2NjQyIDYuNTg5NzU5My4wMDAwMzIgOS4xMDM2ODYzbC04NS4xNDE0OTggODMuMDcwMzU4Yy0yLjU3NjYyMyAyLjUxMzk0MS02Ljc1NDE4MiAyLjUxMzk2OS05LjMzMDg0LjAwMDA2Ni0uMDAwMDEtLjAwMDAxLS4wMDAwMjMtLjAwMDAyMy0uMDAwMDMzLS4wMDAwMzRsLTYwLjQyODI1Ni01OC45NTc0NTFjLS42NDQxNi0uNjI4NDgxLTEuNjg4NTUtLjYyODQ4MS0yLjMzMjcxIDAtLjAwMDAwNC4wMDAwMDQtLjAwMDAwOC4wMDAwMDctLjAwMDAxMi4wMDAwMTFsLTYwLjQyNjk2ODMgNTguOTU3NDA4Yy0yLjU3NjYxNDEgMi41MTM5NDctNi43NTQxNzQ2IDIuNTEzOTktOS4zMzA4NDA4LjAwMDA5Mi0uMDAwMDE1MS0uMDAwMDE0LS4wMDAwMzA5LS4wMDAwMjktLjAwMDA0NjctLjAwMDA0NmwtODUuMTQzODY3NzQtODMuMDcxNDYzYy0yLjU3NjYzOTI4LTIuNTEzOTIxLTIuNTc2NjM5MjgtNi41ODk3OTUgMC05LjEwMzcxNjNsMTguODgyMzEyNjQtMTguNDIyNjk1NWMyLjU3NjYzOTMtMi41MTM5MjIyIDYuNzU0MTk5My0yLjUxMzkyMjIgOS4zMzA4Mzk3IDBsNjAuNDI5MTM0NyA1OC45NTgyNzU4Yy42NDQxNjA4LjYyODQ4IDEuNjg4NTQ5NS42Mjg0OCAyLjMzMjcxMDMgMCAuMDAwMDA5NS0uMDAwMDA5LjAwMDAxODItLjAwMDAxOC4wMDAwMjc3LS4wMDAwMjVsNjAuNDI2MTA2NS01OC45NTgyNTA4YzIuNTc2NTgxLTIuNTEzOTggNi43NTQxNDItMi41MTQwNzQzIDkuMzMwODQtLjAwMDIxMDMuMDAwMDM3LjAwMDAzNTQuMDAwMDcyLjAwMDA3MDkuMDAwMTA3LjAwMDEwNjNsNjAuNDI5MDU2IDU4Ljk1ODM1NDhjLjY0NDE1OS42Mjg0NzkgMS42ODg1NDkuNjI4NDc5IDIuMzMyNzA5IDBsNjAuNDI4MDc5LTU4Ljk1NzE5MjVjMi41NzY2NC0yLjUxMzkyMzEgNi43NTQxOTktMi41MTM5MjMxIDkuMzMwODM5IDB6IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDk4IDE2MCkiLz48L2c+PC9zdmc+',
'location': 'mainPanel'
name: 'walletconnect',
kind: 'provider',
displayName: 'Wallet Connect',
events: [],
methods: ['sendAsync'],
url: 'ipfs://QmUD93rF9RKaDabCM5jFTHraBKd72HApbv7m9Vd5i5EHZe',
description: 'Use an external wallet for transacting',
icon: 'data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHdpZHRoPSI1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyYWRpYWxHcmFkaWVudCBpZD0iYSIgY3g9IjAlIiBjeT0iNTAlIiByPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM1ZDlkZjYiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMDZmZmYiLz48L3JhZGlhbEdyYWRpZW50PjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PHBhdGggZD0ibTI1NiAwYzE0MS4zODQ4OTYgMCAyNTYgMTE0LjYxNTEwNCAyNTYgMjU2cy0xMTQuNjE1MTA0IDI1Ni0yNTYgMjU2LTI1Ni0xMTQuNjE1MTA0LTI1Ni0yNTYgMTE0LjYxNTEwNC0yNTYgMjU2LTI1NnoiIGZpbGw9InVybCgjYSkiLz48cGF0aCBkPSJtNjQuNjkxNzU1OCAzNy43MDg4Mjk4YzUxLjUzMjgwNzItNTAuMjc4NDM5NyAxMzUuMDgzOTk0Mi01MC4yNzg0Mzk3IDE4Ni42MTY3OTkyIDBsNi4yMDIwNTcgNi4wNTEwOTA2YzIuNTc2NjQgMi41MTM5MjE4IDIuNTc2NjQgNi41ODk3OTQ4IDAgOS4xMDM3MTc3bC0yMS4yMTU5OTggMjAuNjk5NTc1OWMtMS4yODgzMjEgMS4yNTY5NjE5LTMuMzc3MSAxLjI1Njk2MTktNC42NjU0MjEgMGwtOC41MzQ3NjYtOC4zMjcwMjA1Yy0zNS45NTA1NzMtMzUuMDc1NDk2Mi05NC4yMzc5NjktMzUuMDc1NDk2Mi0xMzAuMTg4NTQ0IDBsLTkuMTQwMDI4MiA4LjkxNzU1MTljLTEuMjg4MzIxNyAxLjI1Njk2MDktMy4zNzcxMDE2IDEuMjU2OTYwOS00LjY2NTQyMDggMGwtMjEuMjE1OTk3My0yMC42OTk1NzU5Yy0yLjU3NjY0MDMtMi41MTM5MjI5LTIuNTc2NjQwMy02LjU4OTc5NTggMC05LjEwMzcxNzd6bTIzMC40OTM0ODUyIDQyLjgwODkxMTcgMTguODgyMjc5IDE4LjQyMjcyNjJjMi41NzY2MjcgMi41MTM5MTAzIDIuNTc2NjQyIDYuNTg5NzU5My4wMDAwMzIgOS4xMDM2ODYzbC04NS4xNDE0OTggODMuMDcwMzU4Yy0yLjU3NjYyMyAyLjUxMzk0MS02Ljc1NDE4MiAyLjUxMzk2OS05LjMzMDg0LjAwMDA2Ni0uMDAwMDEtLjAwMDAxLS4wMDAwMjMtLjAwMDAyMy0uMDAwMDMzLS4wMDAwMzRsLTYwLjQyODI1Ni01OC45NTc0NTFjLS42NDQxNi0uNjI4NDgxLTEuNjg4NTUtLjYyODQ4MS0yLjMzMjcxIDAtLjAwMDAwNC4wMDAwMDQtLjAwMDAwOC4wMDAwMDctLjAwMDAxMi4wMDAwMTFsLTYwLjQyNjk2ODMgNTguOTU3NDA4Yy0yLjU3NjYxNDEgMi41MTM5NDctNi43NTQxNzQ2IDIuNTEzOTktOS4zMzA4NDA4LjAwMDA5Mi0uMDAwMDE1MS0uMDAwMDE0LS4wMDAwMzA5LS4wMDAwMjktLjAwMDA0NjctLjAwMDA0NmwtODUuMTQzODY3NzQtODMuMDcxNDYzYy0yLjU3NjYzOTI4LTIuNTEzOTIxLTIuNTc2NjM5MjgtNi41ODk3OTUgMC05LjEwMzcxNjNsMTguODgyMzEyNjQtMTguNDIyNjk1NWMyLjU3NjYzOTMtMi41MTM5MjIyIDYuNzU0MTk5My0yLjUxMzkyMjIgOS4zMzA4Mzk3IDBsNjAuNDI5MTM0NyA1OC45NTgyNzU4Yy42NDQxNjA4LjYyODQ4IDEuNjg4NTQ5NS42Mjg0OCAyLjMzMjcxMDMgMCAuMDAwMDA5NS0uMDAwMDA5LjAwMDAxODItLjAwMDAxOC4wMDAwMjc3LS4wMDAwMjVsNjAuNDI2MTA2NS01OC45NTgyNTA4YzIuNTc2NTgxLTIuNTEzOTggNi43NTQxNDItMi41MTQwNzQzIDkuMzMwODQtLjAwMDIxMDMuMDAwMDM3LjAwMDAzNTQuMDAwMDcyLjAwMDA3MDkuMDAwMTA3LjAwMDEwNjNsNjAuNDI5MDU2IDU4Ljk1ODM1NDhjLjY0NDE1OS42Mjg0NzkgMS42ODg1NDkuNjI4NDc5IDIuMzMyNzA5IDBsNjAuNDI4MDc5LTU4Ljk1NzE5MjVjMi41NzY2NC0yLjUxMzkyMzEgNi43NTQxOTktMi41MTM5MjMxIDkuMzMwODM5IDB6IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDk4IDE2MCkiLz48L2c+PC9zdmc+',
location: 'mainPanel'
})
return plugins.map(plugin => new IframePlugin(plugin))
}
@ -123,7 +122,7 @@ class PluginLoader {
const queryParams = new QueryParams()
this.donotAutoReload = ['remixd'] // that would be a bad practice to force loading some plugins at page load.
this.loaders = {}
this.loaders['localStorage'] = {
this.loaders.localStorage = {
set: (plugin, actives) => {
if (!this.donotAutoReload.includes(plugin.name)) {
localStorage.setItem('workspace', JSON.stringify(actives))
@ -132,7 +131,7 @@ class PluginLoader {
get: () => { return JSON.parse(localStorage.getItem('workspace')) }
}
this.loaders['queryParams'] = {
this.loaders.queryParams = {
set: () => {},
get: () => {
const { activate } = queryParams.get()
@ -141,7 +140,7 @@ class PluginLoader {
}
}
this.current = queryParams.get()['activate'] ? 'queryParams' : 'localStorage'
this.current = queryParams.get().activate ? 'queryParams' : 'localStorage'
}
set (plugin, actives) {

@ -4,7 +4,6 @@ const localDecoder = require('../solidity-decoder/localDecoder')
const StorageViewer = require('../storage/storageViewer')
class DebuggerSolidityLocals {
constructor (tx, _stepManager, _traceManager, _internalTreeCall) {
this.event = new EventManager()
this.stepManager = _stepManager
@ -57,33 +56,33 @@ class DebuggerSolidityLocals {
next(error)
}
}],
this.stepManager.currentStepIndex,
(error, result) => {
if (error) {
return error
}
var stack = result[0].value
var memory = result[1].value
try {
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: result[2].value }, this.storageResolver, this.traceManager)
localDecoder.solidityLocals(this.stepManager.currentStepIndex, this.internalTreeCall, stack, memory, storageViewer, sourceLocation, cursor).then((locals) => {
if (!cursor) {
if (!locals.error) {
this.event.trigger('solidityLocals', [locals])
}
if (!Object.keys(locals).length) {
this.event.trigger('solidityLocalsMessage', ['no locals'])
}
} else {
if (!locals.error) {
this.event.trigger('solidityLocalsLoadMoreCompleted', [locals])
}
this.stepManager.currentStepIndex,
(error, result) => {
if (error) {
return error
}
var stack = result[0].value
var memory = result[1].value
try {
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: result[2].value }, this.storageResolver, this.traceManager)
localDecoder.solidityLocals(this.stepManager.currentStepIndex, this.internalTreeCall, stack, memory, storageViewer, sourceLocation, cursor).then((locals) => {
if (!cursor) {
if (!locals.error) {
this.event.trigger('solidityLocals', [locals])
}
})
} catch (e) {
this.event.trigger('solidityLocalsMessage', [e.message])
}
})
if (!Object.keys(locals).length) {
this.event.trigger('solidityLocalsMessage', ['no locals'])
}
} else {
if (!locals.error) {
this.event.trigger('solidityLocalsLoadMoreCompleted', [locals])
}
}
})
} catch (e) {
this.event.trigger('solidityLocalsMessage', [e.message])
}
})
}
decodeMore (cursor) {
@ -94,7 +93,6 @@ class DebuggerSolidityLocals {
this.decode(this._sourceLocation, cursor)
}, 500)
}
}
module.exports = DebuggerSolidityLocals

@ -3,7 +3,6 @@ const stateDecoder = require('../solidity-decoder/stateDecoder')
const StorageViewer = require('../storage/storageViewer')
class DebuggerSolidityState {
constructor (tx, _stepManager, _traceManager, _codeManager, _solidityProxy) {
this.event = new EventManager()
this.storageResolver = null
@ -66,7 +65,7 @@ class DebuggerSolidityState {
}
extractStateVariables (stateVars, address) {
let storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this.traceManager)
const storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this.traceManager)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
this.event.trigger('solidityStateMessage', [''])
if (result.error) {
@ -75,7 +74,6 @@ class DebuggerSolidityState {
this.event.trigger('solidityState', [result])
})
}
}
module.exports = DebuggerSolidityState

32
package-lock.json generated

@ -27067,6 +27067,38 @@
"integrity": "sha1-Ws7HI3WFblx2yDvSGmjXE+tfG6Q=",
"dev": true
},
"ndjson": {
"version": "github:hugomrdias/ndjson#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11",
"from": "github:hugomrdias/ndjson#feat/readable-stream3",
"dev": true,
"requires": {
"json-stringify-safe": "^5.0.1",
"minimist": "^1.2.0",
"split2": "^3.1.0",
"through2": "^3.0.0"
},
"dependencies": {
"split2": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz",
"integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==",
"dev": true,
"requires": {
"readable-stream": "^3.0.0"
}
},
"through2": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
"integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
"dev": true,
"requires": {
"inherits": "^2.0.4",
"readable-stream": "2 || 3"
}
}
}
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",

@ -219,7 +219,7 @@
"dotenv": "^8.2.0",
"eslint": "6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "14.1.1",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",

Loading…
Cancel
Save