Merge branch 'master' of https://github.com/ethereum/remix-project into newindexdb

pull/2035/head
filip mertens 3 years ago
commit 0d49f4b477
  1. 21
      .eslintrc
  2. 2
      .eslintrc.json
  3. 12
      apps/remix-ide-e2e/src/tests/gist.test.ts
  4. 4
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  5. 10
      apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
  6. 138
      apps/remix-ide/src/app.js
  7. 8
      apps/remix-ide/src/app/files/dgitProvider.js
  8. 10
      apps/remix-ide/src/app/files/fileProvider.js
  9. 4
      apps/remix-ide/src/app/files/workspaceFileProvider.js
  10. 10
      apps/remix-ide/src/app/panels/layout.ts
  11. 1
      apps/remix-ide/src/app/panels/terminal.js
  12. 2
      apps/remix-ide/src/app/plugins/config.ts
  13. 4
      apps/remix-ide/src/app/tabs/compile-tab.js
  14. 2
      apps/remix-ide/src/app/tabs/debugger-tab.js
  15. 77
      apps/remix-ide/src/app/tabs/runTab/model/recorder.js
  16. 2
      apps/remix-ide/src/app/tabs/test-tab.js
  17. 2
      apps/remix-ide/src/app/tabs/theme-module.js
  18. 40
      apps/remix-ide/src/blockchain/blockchain.js
  19. 6
      apps/remix-ide/src/blockchain/execution-context.js
  20. 1
      apps/remix-ide/src/blockchain/providers/injected.js
  21. 1
      apps/remix-ide/src/blockchain/providers/node.js
  22. 2
      apps/remix-ide/src/config.js
  23. 42
      apps/remix-ide/src/lib/query-params.js
  24. 5
      apps/remix-ide/src/remixAppManager.js
  25. 2
      libs/remix-astwalker/src/sourceMappings.ts
  26. 3
      libs/remix-astwalker/tsconfig.json
  27. 31
      libs/remix-astwalker/tsconfig.lib.json
  28. 12
      libs/remix-core-plugin/src/lib/compiler-content-imports.ts
  29. 5
      libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts
  30. 26
      libs/remix-core-plugin/src/lib/compiler-metadata.ts
  31. 7
      libs/remix-core-plugin/src/lib/editor-context-listener.ts
  32. 16
      libs/remix-core-plugin/src/lib/gist-handler.ts
  33. 4
      libs/remix-core-plugin/src/lib/offset-line-to-column-converter.ts
  34. 2
      libs/remix-debug/src/cmdline/index.ts
  35. 2
      libs/remix-debug/src/code/breakpointManager.ts
  36. 2
      libs/remix-debug/src/code/codeManager.ts
  37. 2
      libs/remix-debug/src/code/codeUtils.ts
  38. 12
      libs/remix-debug/src/debugger/VmDebugger.ts
  39. 2
      libs/remix-debug/src/debugger/debugger.ts
  40. 10
      libs/remix-debug/src/debugger/solidityLocals.ts
  41. 8
      libs/remix-debug/src/debugger/stepManager.ts
  42. 8
      libs/remix-debug/src/solidity-decoder/decodeInfo.ts
  43. 2
      libs/remix-debug/src/solidity-decoder/internalCallTree.ts
  44. 2
      libs/remix-debug/src/solidity-decoder/localDecoder.ts
  45. 4
      libs/remix-debug/src/solidity-decoder/stateDecoder.ts
  46. 6
      libs/remix-debug/src/solidity-decoder/types/ArrayType.ts
  47. 2
      libs/remix-debug/src/solidity-decoder/types/DynamicByteArray.ts
  48. 6
      libs/remix-debug/src/solidity-decoder/types/Struct.ts
  49. 2
      libs/remix-debug/src/solidity-decoder/types/ValueType.ts
  50. 2
      libs/remix-debug/src/source/sourceMappingDecoder.ts
  51. 2
      libs/remix-debug/src/storage/mappingPreimages.ts
  52. 2
      libs/remix-debug/src/storage/storageResolver.ts
  53. 6
      libs/remix-debug/src/trace/traceCache.ts
  54. 4
      libs/remix-debug/src/trace/traceManager.ts
  55. 2
      libs/remix-debug/src/trace/traceStepManager.ts
  56. 4
      libs/remix-lib/src/execution/txFormat.ts
  57. 2
      libs/remix-lib/src/execution/txListener.ts
  58. 2
      libs/remix-lib/src/execution/txRunnerVM.ts
  59. 2
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  60. 4
      libs/remix-lib/src/execution/typeConversion.ts
  61. 10
      libs/remix-lib/src/helpers/uiHelper.ts
  62. 1
      libs/remix-lib/src/index.ts
  63. 38
      libs/remix-lib/src/query-params.ts
  64. 2
      libs/remix-lib/src/storage.ts
  65. 2
      libs/remix-lib/src/types/ICompilerApi.ts
  66. 2
      libs/remix-lib/src/web3Provider/web3VmProvider.ts
  67. 2
      libs/remix-simulator/src/methods/txProcess.ts
  68. 4
      libs/remix-simulator/src/provider.ts
  69. 4
      libs/remix-solidity/src/compiler/compiler-utils.ts
  70. 4
      libs/remix-solidity/src/compiler/compiler.ts
  71. 6
      libs/remix-tests/src/compiler.ts
  72. 2
      libs/remix-tests/src/fileSystem.ts
  73. 2
      libs/remix-tests/src/index.ts
  74. 2
      libs/remix-tests/src/run.ts
  75. 2
      libs/remix-tests/src/runTestFiles.ts
  76. 2
      libs/remix-ui/app/src/index.ts
  77. 3
      libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx
  78. 1
      libs/remix-ui/app/src/lib/remix-app/context/context.tsx
  79. 3
      libs/remix-ui/app/src/lib/remix-app/remix-app.tsx
  80. 5
      libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx
  81. 4
      libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx
  82. 6
      libs/remix-ui/debugger-ui/src/types/index.ts
  83. 6
      libs/remix-ui/editor-context-view/src/lib/remix-ui-editor-context-view.tsx
  84. 12
      libs/remix-ui/helper/src/lib/remix-ui-helper.ts
  85. 10
      libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx
  86. 1
      libs/remix-ui/modal-dialog/src/index.ts
  87. 11
      libs/remix-ui/panel/src/lib/main/main-panel.tsx
  88. 12
      libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx
  89. 4
      libs/remix-ui/plugin-manager/src/types.d.ts
  90. 6
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  91. 3
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
  92. 8
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  93. 8
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts
  94. 2
      libs/remix-ui/solidity-compiler/src/lib/logic/contract-parser.ts
  95. 12
      libs/remix-ui/terminal/src/lib/actions/terminalAction.ts
  96. 17
      libs/remix-ui/terminal/src/lib/components/Context.tsx
  97. 11
      libs/remix-ui/terminal/src/lib/components/RenderCall.tsx
  98. 8
      libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx
  99. 11
      libs/remix-ui/terminal/src/lib/components/Table.tsx
  100. 4
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,21 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.base.json"
},
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": "standard",
"rules": {
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off"
}
}
]
}

@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"ignorePatterns": [],
"plugins": ["@nrwl/nx"],
"overrides": [
{

@ -36,9 +36,9 @@ module.exports = {
.addFile('File.sol', { content: '' })
.executeScript(`remix.loadgist('${gistid}')`)
// .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('gists') } done() })
.waitForElementVisible(`[data-id="treeViewLitreeViewItemgist-${gistid}"]`)
.click(`[data-id="treeViewLitreeViewItemgist-${gistid}"]`)
.openFile(`gist-${gistid}/README.txt`)
.waitForElementVisible(`[data-id="treeViewLitreeViewItem${gistid}"]`)
.click(`[data-id="treeViewLitreeViewItem${gistid}"]`)
.openFile(`${gistid}/README.txt`)
// Remix publish to gist
/* .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.pause(2000)
@ -140,9 +140,9 @@ module.exports = {
})
.setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.validGistId)
.modalFooterOKClick('gisthandler')
.openFile(`gist-${testData.validGistId}/README.txt`)
.waitForElementVisible(`div[title='default_workspace/gist-${testData.validGistId}/README.txt']`)
.assert.containsText(`div[title='default_workspace/gist-${testData.validGistId}/README.txt'] > span`, 'README.txt')
.openFile(`${testData.validGistId}/README.txt`)
.waitForElementVisible(`div[title='default_workspace/${testData.validGistId}/README.txt']`)
.assert.containsText(`div[title='default_workspace/${testData.validGistId}/README.txt'] > span`, 'README.txt')
.end()
}
}

@ -64,7 +64,7 @@ const clearPayLoad = async (browser: NightwatchBrowser) => {
})
}
const clickButton = async (browser: NightwatchBrowser, buttonText: string, waitResult: boolean = true) => {
const clickButton = async (browser: NightwatchBrowser, buttonText: string, waitResult: boolean = true) => { // eslint-disable-line
return new Promise((resolve) => {
browser.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
.click(`//*[@data-id='${buttonText}']`, async () => {
@ -107,7 +107,7 @@ const checkForAcceptAndRemember = async function (browser: NightwatchBrowser) {
* @return {Promise}
*/
const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string, methodResult: any, eventResult: any, payload: any, waitResult: boolean = true) => {
const clickAndCheckLog = async (browser: NightwatchBrowser, buttonText: string, methodResult: any, eventResult: any, payload: any, waitResult: boolean = true) => { // eslint-disable-line
if (payload) {
await setPayload(browser, payload)
} else {

@ -202,10 +202,10 @@ module.exports = {
.addFile('Storage.sol', sources[6]['Storage.sol'])
.addFile('Owner.sol', sources[6]['Owner.sol'])
.clickLaunchIcon('udapp')
.createContract('42')
.createContract('42, 24')
.openFile('Storage.sol')
.clickLaunchIcon('udapp')
.createContract('') // this creation will fail if the component hasn't been properly reset.
.createContract('102') // this creation will fail if the component hasn't been properly reset.
.clickInstance(1)
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '24' })
.testFunction('last', // we check if the contract is actually reachable.
@ -375,7 +375,7 @@ contract C {
/**
* @dev Set contract deployer as owner
*/
constructor(uint p) {
constructor(uint p, uint o) {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner);
}
@ -412,6 +412,10 @@ contract C {
uint256 number;
constructor(uint p) {
}
/**
* @dev Store value in variable
* @param num value to store

@ -11,6 +11,7 @@ import { VerticalIcons } from './app/components/vertical-icons'
import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel'
import { PermissionHandlerPlugin } from './app/plugins/permission-handler-plugin'
import { AstWalker } from '@remix-project/remix-astwalker'
import { WalkthroughService } from './walkthroughService'
@ -28,7 +29,7 @@ const isElectron = require('is-electron')
const remixLib = require('@remix-project/remix-lib')
const QueryParams = require('./lib/query-params')
import { QueryParams } from '@remix-project/remix-lib'
const Storage = remixLib.Storage
const RemixDProvider = require('./app/files/remixDProvider')
const Config = require('./config')
@ -52,10 +53,9 @@ const { TabProxy } = require('./app/panels/tab-proxy.js')
class AppComponent {
constructor () {
const self = this
self.appManager = new RemixAppManager({})
self.queryParams = new QueryParams()
self._components = {}
this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams()
this._components = {}
// setup storage
const configStorage = new Storage('config-v0.8:')
@ -64,54 +64,55 @@ class AppComponent {
Registry.getInstance().put({ api: config, name: 'config' })
// load file system
self._components.filesProviders = {}
self._components.filesProviders.browser = new FileProvider('browser')
this._components.filesProviders = {}
this._components.filesProviders.browser = new FileProvider('browser')
Registry.getInstance().put({
api: self._components.filesProviders.browser,
api: this._components.filesProviders.browser,
name: 'fileproviders/browser'
})
self._components.filesProviders.localhost = new RemixDProvider(
self.appManager
this._components.filesProviders.localhost = new RemixDProvider(
this.appManager
)
Registry.getInstance().put({
api: self._components.filesProviders.localhost,
api: this._components.filesProviders.localhost,
name: 'fileproviders/localhost'
})
self._components.filesProviders.workspace = new WorkspaceFileProvider()
this._components.filesProviders.workspace = new WorkspaceFileProvider()
Registry.getInstance().put({
api: self._components.filesProviders.workspace,
api: this._components.filesProviders.workspace,
name: 'fileproviders/workspace'
})
Registry.getInstance().put({
api: self._components.filesProviders,
api: this._components.filesProviders,
name: 'fileproviders'
})
}
async run () {
const self = this
// APP_MANAGER
const appManager = self.appManager
const pluginLoader = self.appManager.pluginLoader
self.panels = {}
self.workspace = pluginLoader.get()
self.engine = new RemixEngine()
self.engine.register(appManager)
const appManager = this.appManager
const pluginLoader = this.appManager.pluginLoader
this.panels = {}
this.workspace = pluginLoader.get()
this.engine = new RemixEngine()
this.engine.register(appManager);
const matomoDomains = {
'remix-alpha.ethereum.org': 27,
'remix-beta.ethereum.org': 25,
'remix.ethereum.org': 23
}
self.showMatamo =
this.showMatamo =
matomoDomains[window.location.hostname] &&
!Registry.getInstance()
.get('config')
.api.exists('settings/matomo-analytics')
self.walkthroughService = new WalkthroughService(
this.walkthroughService = new WalkthroughService(
appManager,
self.showMatamo
this.showMatamo
)
const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
@ -125,10 +126,10 @@ class AppComponent {
// SERVICES
// ----------------- gist service ---------------------------------
self.gistHandler = new GistHandler()
this.gistHandler = new GistHandler()
// ----------------- theme service ---------------------------------
self.themeModule = new ThemeModule()
Registry.getInstance().put({ api: self.themeModule, name: 'themeModule' })
this.themeModule = new ThemeModule()
Registry.getInstance().put({ api: this.themeModule, name: 'themeModule' })
// ----------------- editor service ----------------------------
const editor = new Editor() // wrapper around ace editor
@ -189,24 +190,24 @@ class AppComponent {
}
}
)
const contextualListener = new EditorContextListener()
const contextualListener = new EditorContextListener(new AstWalker())
self.notification = new NotificationPlugin()
this.notification = new NotificationPlugin()
const configPlugin = new ConfigPlugin()
self.layout = new Layout()
this.layout = new Layout()
const permissionHandler = new PermissionHandlerPlugin()
self.engine.register([
this.engine.register([
permissionHandler,
self.layout,
self.notification,
self.gistHandler,
this.layout,
this.notification,
this.gistHandler,
configPlugin,
blockchain,
contentImport,
self.themeModule,
this.themeModule,
editor,
fileManager,
compilerMetadataGenerator,
@ -220,46 +221,46 @@ class AppComponent {
dGitProvider,
storagePlugin,
hardhatProvider,
self.walkthroughService
this.walkthroughService
])
// LAYOUT & SYSTEM VIEWS
const appPanel = new MainPanel()
Registry.getInstance().put({ api: self.mainview, name: 'mainview' })
Registry.getInstance().put({ api: this.mainview, name: 'mainview' })
const tabProxy = new TabProxy(fileManager, editor)
self.engine.register([appPanel, tabProxy])
this.engine.register([appPanel, tabProxy])
// those views depend on app_manager
self.menuicons = new VerticalIcons()
self.sidePanel = new SidePanel()
self.hiddenPanel = new HiddenPanel()
this.menuicons = new VerticalIcons()
this.sidePanel = new SidePanel()
this.hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent(
appManager,
self.engine
this.engine
)
const filePanel = new FilePanel(appManager)
const landingPage = new LandingPage(
appManager,
self.menuicons,
this.menuicons,
fileManager,
filePanel,
contentImport
)
self.settings = new SettingsTab(
this.settings = new SettingsTab(
Registry.getInstance().get('config').api,
editor,
appManager
)
self.engine.register([
self.menuicons,
this.engine.register([
this.menuicons,
landingPage,
self.hiddenPanel,
self.sidePanel,
this.hiddenPanel,
this.sidePanel,
filePanel,
pluginManagerComponent,
self.settings
this.settings
])
// CONTENT VIEWS & DEFAULT PLUGINS
@ -288,7 +289,7 @@ class AppComponent {
contentImport
)
self.engine.register([
this.engine.register([
compileTab,
run,
debug,
@ -300,7 +301,7 @@ class AppComponent {
filePanel.slitherHandle
])
self.layout.panels = {
this.layout.panels = {
tabs: { plugin: tabProxy, active: true },
editor: { plugin: editor, active: true },
main: { plugin: appPanel, active: false },
@ -311,14 +312,13 @@ class AppComponent {
async activate () {
const queryParams = new QueryParams()
const params = queryParams.get()
const self = this
if (isElectron()) {
self.appManager.activatePlugin('remixd')
this.appManager.activatePlugin('remixd')
}
try {
self.engine.register(await self.appManager.registeredPlugins())
this.engine.register(await this.appManager.registeredPlugins())
} catch (e) {
console.log("couldn't register iframe plugins", e.message)
}
@ -338,20 +338,20 @@ class AppComponent {
'filePanel',
'workspaceInitializationCompleted',
async () => {
await self.appManager.registerContextMenuItems()
await this.appManager.registerContextMenuItems()
}
)
await self.appManager.activatePlugin(['filePanel'])
await this.appManager.activatePlugin(['filePanel'])
// Set workspace after initial activation
self.appManager.on('editor', 'editorMounted', () => {
if (Array.isArray(self.workspace)) {
self.appManager
.activatePlugin(self.workspace)
this.appManager.on('editor', 'editorMounted', () => {
if (Array.isArray(this.workspace)) {
this.appManager
.activatePlugin(this.workspace)
.then(async () => {
try {
if (params.deactivate) {
await self.appManager.deactivatePlugin(
await this.appManager.deactivatePlugin(
params.deactivate.split(',')
)
}
@ -360,21 +360,21 @@ class AppComponent {
}
if (params.code) {
// if code is given in url we focus on solidity plugin
self.menuicons.select('solidity')
this.menuicons.select('solidity')
} else {
// If plugins are loaded from the URL params, we focus on the last one.
if (
self.appManager.pluginLoader.current === 'queryParams' &&
self.workspace.length > 0
) { self.menuicons.select(self.workspace[self.workspace.length - 1]) }
this.appManager.pluginLoader.current === 'queryParams' &&
this.workspace.length > 0
) { this.menuicons.select(this.workspace[this.workspace.length - 1]) }
}
if (params.call) {
const callDetails = params.call.split('//')
if (callDetails.length > 1) {
self.appManager.call('notification', 'toast', `initiating ${callDetails[0]} ...`)
this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} ...`)
// @todo(remove the timeout when activatePlugin is on 0.3.0)
self.appManager.call(...callDetails).catch(console.error)
this.appManager.call(...callDetails).catch(console.error)
}
}
})
@ -382,7 +382,7 @@ class AppComponent {
}
})
// activate solidity plugin
self.appManager.activatePlugin(['solidity', 'udapp'])
this.appManager.activatePlugin(['solidity', 'udapp'])
// Load and start the service who manager layout and frame
}
}

@ -61,6 +61,7 @@ class DGitProvider extends Plugin {
corsProxy: 'https://corsproxy.remixproject.org/',
http,
onAuth: url => {
url
const auth = {
username: input.token,
password: ''
@ -131,6 +132,7 @@ class DGitProvider extends Plugin {
try {
remotes = await git.listRemotes({ ...await this.getGitConfig() })
} catch (e) {
console.log(e)
}
return remotes
}
@ -208,7 +210,7 @@ class DGitProvider extends Plugin {
async setIpfsConfig (config) {
this.ipfsconfig = config
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
resolve(this.checkIpfsConfig())
})
}
@ -430,7 +432,7 @@ class DGitProvider extends Plugin {
} catch (error) {
throw new Error(error)
}
};
}
async importIPFSFiles (config, cid, workspace) {
const ipfs = IpfsHttpClient(config)
@ -471,7 +473,7 @@ class DGitProvider extends Plugin {
}
_xLen = ((localStorage[_x].length + _x.length) * 2)
_lsTotal += _xLen
};
}
return (_lsTotal / 1024).toFixed(2)
}

@ -87,6 +87,7 @@ class FileProvider {
}
async get (path, cb) {
cb = cb || function () { /* do nothing. */ }
path = this.getPathFromUrl(path) || path // ensure we actually use the normalized path from here
var unprefixedpath = this.removePrefix(path)
try {
@ -100,6 +101,7 @@ class FileProvider {
}
async set (path, content, cb) {
cb = cb || function () { /* do nothing. */ }
var unprefixedpath = this.removePrefix(path)
const exists = await window.remixFileSystem.exists(unprefixedpath)
if (exists && await window.remixFileSystem.readFile(unprefixedpath, 'utf8') === content) {
@ -211,8 +213,8 @@ class FileProvider {
* @param {Function} visitFolder is a function called for each visited folders
*/
async _copyFolderToJsonInternal (path, visitFile, visitFolder) {
visitFile = visitFile || (() => { })
visitFolder = visitFolder || (() => { })
visitFile = visitFile || function () { /* do nothing. */ }
visitFolder = visitFolder || function () { /* do nothing. */ }
const json = {}
path = this.removePrefix(path)
@ -248,8 +250,8 @@ class FileProvider {
* @param {Function} visitFolder is a function called for each visited folders
*/
async copyFolderToJson (path, visitFile, visitFolder) {
visitFile = visitFile || (() => { })
visitFolder = visitFolder || (() => { })
visitFile = visitFile || function () { /* do nothing. */ }
visitFolder = visitFolder || function () { /* do nothing. */ }
return await this._copyFolderToJsonInternal(path, visitFile, visitFolder)
}

@ -68,8 +68,8 @@ class WorkspaceFileProvider extends FileProvider {
}
async copyFolderToJson (directory, visitFile, visitFolder) {
visitFile = visitFile || (() => {})
visitFolder = visitFolder || (() => {})
visitFile = visitFile || function () { /* do nothing. */ }
visitFolder = visitFolder || function () { /* do nothing. */ }
const regex = new RegExp(`.workspaces/${this.workspace}/`, 'g')
let json = await super._copyFolderToJsonInternal(directory, ({ path, content }) => {
visitFile({ path: path.replace(regex, ''), content })

@ -1,7 +1,7 @@
import { Plugin } from '@remixproject/engine'
import { Profile } from '@remixproject/plugin-utils'
import { EventEmitter } from 'events'
import QueryParams from '../../lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
const profile: Profile = {
name: 'layout',
@ -21,6 +21,12 @@ interface panels {
terminal: panelState
}
export type PanelConfiguration = {
minimizeterminal: boolean,
minimizesidepanel: boolean,
embed: boolean
}
export class Layout extends Plugin {
event: any
panels: panels
@ -77,7 +83,7 @@ export class Layout extends Plugin {
}
})
const queryParams = new QueryParams()
const params = queryParams.get()
const params = queryParams.get() as PanelConfiguration
if (params.minimizeterminal || params.embed) {
this.panels.terminal.minimized = true
this.event.emit('change', this.panels)

@ -117,6 +117,7 @@ class Terminal extends Plugin {
scroll2bottom () {
setTimeout(function () {
// do nothing.
}, 0)
}
}

@ -1,5 +1,5 @@
import { Plugin } from '@remixproject/engine'
import QueryParams from '../../lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
import Registry from '../state/registry'
const profile = {

@ -3,9 +3,9 @@ import React from 'react' // eslint-disable-line
import ReactDOM from 'react-dom'
import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable-line
import { CompileTabLogic } from '@remix-ui/solidity-compiler' // eslint-disable-line
import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin'
import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin' // eslint-disable-line
import { ViewPlugin } from '@remixproject/engine-web'
import QueryParams from '../../lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
// import { ICompilerApi } from '@remix-project/remix-lib-ts'
import * as packageJson from '../../../../../package.json'
import { compilerConfigChangedToastMsg, compileToastMsg } from '@remix-ui/helper'

@ -1,5 +1,5 @@
import { DebuggerUI } from '@remix-ui/debugger-ui' // eslint-disable-line
import { DebuggerApiMixin } from '@remixproject/debugger-plugin'
import { DebuggerApiMixin } from '@remixproject/debugger-plugin' // eslint-disable-line
import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line

@ -11,10 +11,9 @@ const helper = require('../../../../lib/helper')
*/
class Recorder {
constructor (blockchain) {
var self = this
self.event = new EventManager()
self.blockchain = blockchain
self.data = { _listen: true, _replay: false, journal: [], _createdContracts: {}, _createdContractsReverse: {}, _usedAccounts: {}, _abis: {}, _contractABIReferences: {}, _linkReferences: {} }
this.event = new EventManager()
this.blockchain = blockchain
this.data = { _listen: true, _replay: false, journal: [], _createdContracts: {}, _createdContractsReverse: {}, _usedAccounts: {}, _abis: {}, _contractABIReferences: {}, _linkReferences: {} }
this.blockchain.event.register('initiatingTransaction', (timestamp, tx, payLoad) => {
if (tx.useCall) return
@ -33,11 +32,11 @@ class Recorder {
if (record.linkReferences && Object.keys(record.linkReferences).length) {
for (var file in record.linkReferences) {
for (var lib in record.linkReferences[file]) {
self.data._linkReferences[lib] = '<address>'
this.data._linkReferences[lib] = '<address>'
}
}
}
self.data._abis[keccak] = abi
this.data._abis[keccak] = abi
this.data._contractABIReferences[timestamp] = keccak
} else {
@ -57,8 +56,8 @@ class Recorder {
this.blockchain.getAccounts((error, accounts) => {
if (error) return console.log(error)
record.from = `account{${accounts.indexOf(from)}}`
self.data._usedAccounts[record.from] = from
self.append(timestamp, record)
this.data._usedAccounts[record.from] = from
this.append(timestamp, record)
})
}
})
@ -128,9 +127,8 @@ class Recorder {
*
*/
append (timestamp, record) {
var self = this
self.data.journal.push({ timestamp, record })
self.event.trigger('newTxRecorded', [self.data.journal.length])
this.data.journal.push({ timestamp, record })
this.event.trigger('newTxRecorded', [this.data.journal.length])
}
/**
@ -138,17 +136,16 @@ class Recorder {
*
*/
getAll () {
var self = this
var records = [].concat(self.data.journal)
var records = [].concat(this.data.journal)
return {
accounts: self.data._usedAccounts,
linkReferences: self.data._linkReferences,
accounts: this.data._usedAccounts,
linkReferences: this.data._linkReferences,
transactions: records.sort((A, B) => {
var stampA = A.timestamp
var stampB = B.timestamp
return stampA - stampB
}),
abis: self.data._abis
abis: this.data._abis
}
}
@ -157,17 +154,16 @@ class Recorder {
*
*/
clearAll () {
var self = this
self.data._listen = true
self.data._replay = false
self.data.journal = []
self.data._createdContracts = {}
self.data._createdContractsReverse = {}
self.data._usedAccounts = {}
self.data._abis = {}
self.data._contractABIReferences = {}
self.data._linkReferences = {}
self.event.trigger('cleared', [])
this.data._listen = true
this.data._replay = false
this.data.journal = []
this.data._createdContracts = {}
this.data._createdContractsReverse = {}
this.data._usedAccounts = {}
this.data._abis = {}
this.data._contractABIReferences = {}
this.data._linkReferences = {}
this.event.trigger('cleared', [])
}
/**
@ -180,11 +176,10 @@ class Recorder {
*
*/
run (records, accounts, options, abis, linkReferences, confirmationCb, continueCb, promptCb, alertCb, logCallBack, newContractFn) {
var self = this
self.setListen(false)
this.setListen(false)
logCallBack(`Running ${records.length} transaction(s) ...`)
async.eachOfSeries(records, function (tx, index, cb) {
var record = self.resolveAddress(tx.record, accounts, options)
async.eachOfSeries(records, (tx, index, cb) => {
var record = this.resolveAddress(tx.record, accounts, options)
var abi = abis[tx.record.abi]
if (!abi) {
return alertCb('cannot find ABI for ' + tx.record.abi + '. Execution stopped at ' + index)
@ -193,9 +188,9 @@ class Recorder {
if (record.linkReferences && Object.keys(record.linkReferences).length) {
for (var k in linkReferences) {
var link = linkReferences[k]
var timestamp = self.extractTimestamp(link)
if (timestamp && self.data._createdContractsReverse[timestamp]) {
link = self.data._createdContractsReverse[timestamp]
var timestamp = this.extractTimestamp(link)
if (timestamp && this.data._createdContractsReverse[timestamp]) {
link = this.data._createdContractsReverse[timestamp]
}
tx.record.bytecode = format.linkLibraryStandardFromlinkReferences(k, link.replace('0x', ''), tx.record.bytecode, tx.record.linkReferences)
}
@ -224,8 +219,8 @@ class Recorder {
isString = false
value = JSON.stringify(value)
}
for (var timestamp in self.data._createdContractsReverse) {
value = value.replace(new RegExp('created\\{' + timestamp + '\\}', 'g'), self.data._createdContractsReverse[timestamp])
for (var timestamp in this.data._createdContractsReverse) {
value = value.replace(new RegExp('created\\{' + timestamp + '\\}', 'g'), this.data._createdContractsReverse[timestamp])
}
if (!isString) value = JSON.parse(value)
tx.record.parameters[index] = value
@ -243,8 +238,8 @@ class Recorder {
logCallBack(`(${index}) data: ${data.data}`)
record.data = { dataHex: data.data, funArgs: tx.record.parameters, funAbi: fnABI, contractBytecode: tx.record.bytecode, contractName: tx.record.contractName, timestamp: tx.timestamp }
self.blockchain.runTx(record, confirmationCb, continueCb, promptCb,
function (err, txResult, rawAddress) {
this.blockchain.runTx(record, confirmationCb, continueCb, promptCb,
(err, txResult, rawAddress) => {
if (err) {
console.error(err)
return logCallBack(err + '. Execution failed at ' + index)
@ -252,14 +247,14 @@ class Recorder {
if (rawAddress) {
const address = helper.addressToString(rawAddress)
// save back created addresses for the convertion from tokens to real adresses
self.data._createdContracts[address] = tx.timestamp
self.data._createdContractsReverse[tx.timestamp] = address
this.data._createdContracts[address] = tx.timestamp
this.data._createdContractsReverse[tx.timestamp] = address
newContractFn(abi, address, record.contractName)
}
cb(err)
}
)
}, () => { self.setListen(true) })
}, () => { this.setListen(true) })
}
runScenario (json, continueCb, promptCb, alertCb, confirmationCb, logCallBack, cb) {

@ -119,7 +119,7 @@ module.exports = class TestTab extends ViewPlugin {
usingWorker: canUseWorker(currentVersion),
runs
}
this.testRunner.runTestSources(runningTest, compilerConfig, () => {}, () => {}, null, (error, result) => {
this.testRunner.runTestSources(runningTest, compilerConfig, () => { /* Do nothing. */ }, () => { /* Do nothing. */ }, null, (error, result) => {
if (error) return reject(error)
resolve(result)
}, (url, cb) => {

@ -1,6 +1,6 @@
import { Plugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import QueryParams from '../../lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
import * as packageJson from '../../../../../package.json'
import Registry from '../state/registry'
const _paq = window._paq = window._paq || []

@ -303,7 +303,7 @@ export class Blockchain extends Plugin {
},
(data, runTxCallback) => {
// called for libraries deployment
this.runTx(data, confirmationCb, runTxCallback, promptCb, () => {})
this.runTx(data, confirmationCb, runTxCallback, promptCb, () => { /* Do nothing. */ })
})
}
@ -422,72 +422,70 @@ export class Blockchain extends Plugin {
}
runTx (args, confirmationCb, continueCb, promptCb, cb) {
const self = this
waterfall([
function getGasLimit (next) {
if (self.transactionContextAPI.getGasLimit) {
return self.transactionContextAPI.getGasLimit(next)
(next) => { // getGasLimit
if (this.transactionContextAPI.getGasLimit) {
return this.transactionContextAPI.getGasLimit(next)
}
next(null, 3000000)
},
function queryValue (gasLimit, next) {
(gasLimit, next) => { // queryValue
if (args.value) {
return next(null, args.value, gasLimit)
}
if (args.useCall || !self.transactionContextAPI.getValue) {
if (args.useCall || !this.transactionContextAPI.getValue) {
return next(null, 0, gasLimit)
}
self.transactionContextAPI.getValue(function (err, value) {
this.transactionContextAPI.getValue(function (err, value) {
next(err, value, gasLimit)
})
},
function getAccount (value, gasLimit, next) {
(value, gasLimit, next) => { // getAccount
if (args.from) {
return next(null, args.from, value, gasLimit)
}
if (self.transactionContextAPI.getAddress) {
return self.transactionContextAPI.getAddress(function (err, address) {
if (this.transactionContextAPI.getAddress) {
return this.transactionContextAPI.getAddress(function (err, address) {
next(err, address, value, gasLimit)
})
}
self.getAccounts(function (err, accounts) {
this.getAccounts(function (err, accounts) {
const address = accounts[0]
if (err) return next(err)
if (!address) return next('No accounts available')
// if (self.executionContext.isVM() && !self.providers.vm.accounts[address]) {
if (self.executionContext.isVM() && !self.providers.vm.RemixSimulatorProvider.Accounts.accounts[address]) {
if (this.executionContext.isVM() && !this.providers.vm.RemixSimulatorProvider.Accounts.accounts[address]) {
return next('Invalid account selected')
}
next(null, address, value, gasLimit)
})
},
function runTransaction (fromAddress, value, gasLimit, next) {
(fromAddress, value, gasLimit, next) => { // runTransaction
const tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: fromAddress, value: value, gasLimit: gasLimit, timestamp: args.data.timestamp }
const payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName, contractABI: args.data.contractABI, linkReferences: args.data.linkReferences }
if (!tx.timestamp) tx.timestamp = Date.now()
const timestamp = tx.timestamp
self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad])
self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb,
this.event.trigger('initiatingTransaction', [timestamp, tx, payLoad])
this.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb,
async (error, result) => {
if (error) return next(error)
const isVM = self.executionContext.isVM()
const isVM = this.executionContext.isVM()
if (isVM && tx.useCall) {
try {
result.transactionHash = await self.web3().eth.getHashFromTagBySimulator(timestamp)
result.transactionHash = await this.web3().eth.getHashFromTagBySimulator(timestamp)
} catch (e) {
console.log('unable to retrieve back the "call" hash', e)
}
}
const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted')
self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad])
this.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad])
if (error && (typeof (error) !== 'string')) {
if (error.message) error = error.message
else {
try { error = 'error: ' + JSON.stringify(error) } catch (e) {}
try { error = 'error: ' + JSON.stringify(error) } catch (e) { console.log(e) }
}
}
next(error, result, tx)

@ -129,9 +129,9 @@ export class ExecutionContext {
async executionContextChange (value, endPointUrl, confirmCb, infoCb, cb) {
const context = value.context
if (!cb) cb = () => {}
if (!confirmCb) confirmCb = () => {}
if (!infoCb) infoCb = () => {}
if (!cb) cb = () => { /* Do nothing. */ }
if (!confirmCb) confirmCb = () => { /* Do nothing. */ }
if (!infoCb) infoCb = () => { /* Do nothing. */ }
if (context === 'vm') {
this.executionContext = context
this.currentFork = value.fork

@ -17,6 +17,7 @@ class InjectedProvider {
}
resetEnvironment () {
/* Do nothing. */
}
getBalanceInEther (address, cb) {

@ -25,6 +25,7 @@ class NodeProvider {
}
resetEnvironment () {
/* Do nothing. */
}
getBalanceInEther (address, cb) {

@ -15,6 +15,7 @@ function Config (storage) {
this.items = JSON.parse(config)
}
} catch (exception) {
/* Do nothing. */
}
this.exists = function (key) {
@ -31,6 +32,7 @@ function Config (storage) {
storage.set(CONFIG_FILE, JSON.stringify(this.items))
this.events.emit(key + '_changed', content)
} catch (exception) {
/* Do nothing. */
}
}

@ -1,42 +0,0 @@
'use strict'
// Allowing window to be overriden for testing
function QueryParams (_window) {
if (_window === undefined) _window = window
this.get = function () {
var qs = _window.location.hash.substr(1)
if (_window.location.search.length > 0) {
// use legacy query params instead of hash
_window.location.hash = _window.location.search.substr(1)
_window.location.search = ''
}
var params = {}
var parts = qs.split('&')
for (var x in parts) {
var keyValue = parts[x].split('=')
if (keyValue[0] !== '') {
params[keyValue[0]] = keyValue[1]
}
}
return params
}
this.update = function (params) {
var currentParams = this.get()
var keys = Object.keys(params)
for (var x in keys) {
currentParams[keys[x]] = params[keys[x]]
}
var queryString = '#'
var updatedKeys = Object.keys(currentParams)
for (var y in updatedKeys) {
queryString += updatedKeys[y] + '=' + currentParams[updatedKeys[y]] + '&'
}
_window.location.hash = queryString.slice(0, -1)
}
}
module.exports = QueryParams

@ -1,7 +1,6 @@
/* global localStorage, fetch */
import { PluginManager } from '@remixproject/engine'
import { EventEmitter } from 'events'
import QueryParams from './lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
import { IframePlugin } from '@remixproject/engine-web'
const _paq = window._paq = window._paq || []
@ -174,7 +173,7 @@ class PluginLoader {
}
this.loaders.queryParams = {
set: () => {},
set: () => { /* Do nothing. */ },
get: () => {
const { activate } = queryParams.get()
if (!activate) return []

@ -73,7 +73,7 @@ export class SourceMappings {
lineBreaks.push(pos)
}
this.lineBreaks = lineBreaks
};
}
/**
* Get a list of nodes that are at the given "position".

@ -2,8 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"],
"module": "commonjs",
"esModuleInterop": true
"esModuleInterop": true
},
"include": ["**/*.ts"]
}

@ -1,16 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"rootDir": "./src",
"types": ["node"]
},
"exclude": [
"**/*.spec.ts",
"tests/"
],
"include": ["**/*.ts"]
}
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"declaration": true,
"rootDir": "./src",
"types": ["node"]
},
"exclude": [
"**/*.spec.ts",
"tests/"
],
"include": ["**/*.ts"]
}

@ -9,8 +9,14 @@ const profile = {
methods: ['resolve', 'resolveAndSave', 'isExternalUrl']
}
export type ResolvedImport = {
content: string,
cleanUrl: string
type: string
}
export class CompilerImports extends Plugin {
previouslyHandled: {}
previouslyHandled: Record<string, ResolvedImport>
urlResolver: any
constructor () {
super(profile)
@ -64,9 +70,9 @@ export class CompilerImports extends Plugin {
if (!loadingCb) loadingCb = () => {}
if (!cb) cb = () => {}
var self = this
const self = this
if (force) delete this.previouslyHandled[url]
var imported = this.previouslyHandled[url]
const imported = this.previouslyHandled[url]
if (imported) {
return cb(null, imported.content, imported.cleanUrl, imported.type, url)
}

@ -2,8 +2,7 @@
import { Plugin } from '@remixproject/engine'
import { compile } from '@remix-project/remix-solidity'
import { util } from '@remix-project/remix-lib'
const ethutil = require('ethereumjs-util')
import { toChecksumAddress } from 'ethereumjs-util'
const profile = {
name: 'fetchAndCompile',
@ -32,7 +31,7 @@ export class FetchAndCompile extends Plugin {
* @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress
*/
async resolve (contractAddress, codeAtAddress, targetPath) {
contractAddress = ethutil.toChecksumAddress(contractAddress)
contractAddress = toChecksumAddress(contractAddress)
const localCompilation = async () => await this.call('compilerArtefacts', 'get', contractAddress) ? await this.call('compilerArtefacts', 'get', contractAddress) : await this.call('compilerArtefacts', 'get', '__last') ? await this.call('compilerArtefacts', 'get', '__last') : null

@ -27,11 +27,11 @@ export class CompilerMetadata extends Plugin {
}
onActivation () {
var self = this
const self = this
this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data) => {
if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return
const compiler = new CompilerAbstract(languageVersion, data, source)
var path = self._extractPathOf(source.target)
const path = self._extractPathOf(source.target)
compiler.visitContracts((contract) => {
if (contract.file !== source.target) return
(async () => {
@ -44,23 +44,23 @@ export class CompilerMetadata extends Plugin {
}
_extractPathOf (file) {
var reg = /(.*)(\/).*/
var path = reg.exec(file)
const reg = /(.*)(\/).*/
const path = reg.exec(file)
return path ? path[1] : '/'
}
async _setArtefacts (content, contract, path) {
content = content || '{}'
var metadata
let metadata
try {
metadata = JSON.parse(content)
} catch (e) {
console.log(e)
}
var fileName = this._JSONFileName(path, contract.name)
var metadataFileName = this._MetadataFileName(path, contract.name)
const fileName = this._JSONFileName(path, contract.name)
const metadataFileName = this._MetadataFileName(path, contract.name)
var deploy = metadata.deploy || {}
const deploy = metadata.deploy || {}
this.networks.forEach((network) => {
deploy[network] = this._syncContext(contract, deploy[network] || {})
})
@ -73,7 +73,7 @@ export class CompilerMetadata extends Plugin {
}
if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t'))
var data = {
const data = {
deploy,
data: {
bytecode: contract.object.evm.bytecode,
@ -87,14 +87,14 @@ export class CompilerMetadata extends Plugin {
}
_syncContext (contract, metadata) {
var linkReferences = metadata.linkReferences
var autoDeployLib = metadata.autoDeployLib
let linkReferences = metadata.linkReferences
let autoDeployLib = metadata.autoDeployLib
if (!linkReferences) linkReferences = {}
if (autoDeployLib === undefined) autoDeployLib = true
for (var libFile in contract.object.evm.bytecode.linkReferences) {
for (const libFile in contract.object.evm.bytecode.linkReferences) {
if (!linkReferences[libFile]) linkReferences[libFile] = {}
for (var lib in contract.object.evm.bytecode.linkReferences[libFile]) {
for (const lib in contract.object.evm.bytecode.linkReferences[libFile]) {
if (!linkReferences[libFile][lib]) {
linkReferences[libFile][lib] = '<address>'
}

@ -2,7 +2,6 @@
import { Plugin } from '@remixproject/engine'
import { sourceMappingDecoder } from '@remix-project/remix-debug'
const { AstWalker } = require('@remix-project/remix-astwalker')
const profile = {
name: 'contextualListener',
@ -19,7 +18,7 @@ export class EditorContextListener extends Plugin {
_activeHighlights: Array<any>
astWalker: any
currentPosition: any
currentFile: String
currentFile: string
nodes: Array<any>
results: any
estimationObj: any
@ -28,7 +27,7 @@ export class EditorContextListener extends Plugin {
contract: any
activated: boolean
constructor () {
constructor (astWalker) {
super(profile)
this.activated = false
this._index = {
@ -37,7 +36,7 @@ export class EditorContextListener extends Plugin {
}
this._activeHighlights = []
this.astWalker = new AstWalker()
this.astWalker = astWalker
}
onActivation () {

@ -13,15 +13,17 @@ const profile = {
version: '0.0.1'
}
type GistCallBackFn = (gistId: string) => void
export class GistHandler extends Plugin {
constructor () {
super(profile)
}
async handleLoad (gistId: String | null, cb: Function) {
async handleLoad (gistId: string | null, cb: GistCallBackFn) {
if (!cb) cb = () => {}
var loadingFromGist = false
let loadingFromGist = false
if (!gistId) {
loadingFromGist = true
let value
@ -83,9 +85,9 @@ export class GistHandler extends Plugin {
return loadingFromGist
}
load (gistId: String | null) {
load (gistId: string | null) {
const self = this
return self.handleLoad(gistId, async (gistId: String | null) => {
return self.handleLoad(gistId, async (gistId: string | null) => {
let data: any
try {
data = await (await fetch(`https://api.github.com/gists/${gistId}`)).json() as any
@ -114,7 +116,7 @@ export class GistHandler extends Plugin {
const obj: StringByString = {}
Object.keys(data.files).forEach((element) => {
const path = element.replace(/\.\.\./g, '/')
obj['/' + 'gist-' + gistId + '/' + path] = data.files[element]
obj['/' + gistId + '/' + path] = data.files[element]
})
this.call('fileManager', 'setBatchFiles', obj, 'workspace', true, async (errorSavingFiles: any) => {
if (errorSavingFiles) {
@ -132,7 +134,7 @@ export class GistHandler extends Plugin {
}
const getGistId = (str) => {
var idr = /[0-9A-Fa-f]{8,}/
var match = idr.exec(str)
const idr = /[0-9A-Fa-f]{8,}/
const match = idr.exec(str)
return match ? match[0] : null
}

@ -11,7 +11,7 @@ const profile = {
}
export class OffsetToLineColumnConverter extends Plugin {
lineBreakPositionsByContent: {}
lineBreakPositionsByContent: Record<number, Array<number>>
sourceMappingDecoder: any
constructor () {
super(profile)
@ -36,7 +36,7 @@ export class OffsetToLineColumnConverter extends Plugin {
// if we don't have ast, we process the only one available content (applicable also for compiler older than 0.4.12)
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[sourcesArray[0]].content)
} else {
for (var filename in asts) {
for (const filename in asts) {
const source = asts[filename]
if (source.id === file) {
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[filename].content)

@ -64,7 +64,7 @@ export class CmdLine {
source.push('=> ' + (currentLineNumber + 1) + ': ' + currentLine)
const startLine = lineColumnPos.start.line
for (var i = 1; i < 4; i++) {
for (let i = 1; i < 4; i++) {
const line = content[startLine + i]
source.push(' ' + (startLine + i + 1) + ': ' + line)
}

@ -185,7 +185,7 @@ export class BreakpointManager {
* @param {Object} sourceLocation - position of the breakpoint { file: '<file index>', row: '<line number' }
*/
remove (sourceLocation) {
var sources = this.breakpoints[sourceLocation.fileName]
const sources = this.breakpoints[sourceLocation.fileName]
if (!sources) {
return
}

@ -77,7 +77,7 @@ export class CodeManager {
const code = await this.codeResolver.resolveCode(address)
return code
}
var codes = this.codeResolver.getExecutingCodeFromCache(address)
let codes = this.codeResolver.getExecutingCodeFromCache(address)
if (codes) {
return codes
}

@ -36,7 +36,7 @@ export function nameOpCodes (raw, hardfork) {
}
type Opcode = {
name: String,
name: string,
pushData?: Array<number>
in?: number
out?: number

@ -113,11 +113,11 @@ export class VmDebuggerLogic {
const address = this._traceManager.getCurrentCalledAddressAt(index)
if (!this.storageResolver) return
var 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)
storageViewer.storageRange().then((storage) => {
if (this.stepManager.currentStepIndex === index) {
var header = storageViewer.isComplete(address) ? '[Completely Loaded]' : '[Partially Loaded]'
const header = storageViewer.isComplete(address) ? '[Completely Loaded]' : '[Partially Loaded]'
this.event.trigger('traceManagerStorageUpdate', [storage, header])
}
}).catch((_error) => {
@ -197,10 +197,10 @@ export class VmDebuggerLogic {
if (index === this.traceLength - 1) {
return this.event.trigger('traceStorageUpdate', [{}])
}
var storageJSON = {}
for (var k in this.addresses) {
var address = this.addresses[k]
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this._traceManager)
const storageJSON = {}
for (const k in this.addresses) {
const address = this.addresses[k]
const storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this._traceManager)
try {
storageJSON[address] = await storageViewer.storageRange()
} catch (e) {

@ -81,7 +81,7 @@ export class Debugger {
sources[genSource.name] = { content: genSource.contents }
}
}
var lineColumnPos = await this.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, sources, astSources)
const lineColumnPos = await this.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, sources, astSources)
this.event.trigger('newSourceLocation', [lineColumnPos, rawLocation, generatedSources, address])
} else {
this.event.trigger('newSourceLocation', [null])

@ -22,7 +22,7 @@ export class DebuggerSolidityLocals {
init (sourceLocation) {
this._sourceLocation = sourceLocation
var decodeTimeout = null
let decodeTimeout = null
if (!this.storageResolver) {
return this.event.trigger('solidityLocalsMessage', ['storage not ready'])
}
@ -76,11 +76,11 @@ export class DebuggerSolidityLocals {
if (error) {
return error
}
var stack = result[0].value
var memory = result[1].value
var calldata = result[3].value
const stack = result[0].value
const memory = result[1].value
const calldata = result[3].value
try {
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: result[2].value }, this.storageResolver, this.traceManager)
const storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: result[2].value }, this.storageResolver, this.traceManager)
solidityLocals(this.stepManager.currentStepIndex, this.internalTreeCall, stack, memory, storageViewer, calldata, sourceLocation, cursor).then((locals) => {
if (!cursor) {
if (!locals['error']) {

@ -55,8 +55,8 @@ export class DebuggerStepManager {
this.revertionPoint = this.currentCall.return
return this.event.trigger('revertWarning', [revertedReason])
}
for (var k = callsPath.length - 2; k >= 0; k--) {
var parent = callsPath[k]
for (let k = callsPath.length - 2; k >= 0; k--) {
const parent = callsPath[k]
if (!parent.reverted) continue
this.revertionPoint = parent.return
this.event.trigger('revertWarning', ['parenthasthrown'])
@ -139,7 +139,7 @@ export class DebuggerStepManager {
jumpOut (solidityMode) {
if (!this.traceManager.isLoaded()) return
var step = this.traceManager.findStepOut(this.currentStepIndex)
let step = this.traceManager.findStepOut(this.currentStepIndex)
if (solidityMode) {
step = this.resolveToReducedTrace(step, 0)
}
@ -200,7 +200,7 @@ export class DebuggerStepManager {
if (!this.debugger.callTree.reducedTrace.length) {
return value
}
var nextSource = util.findClosestIndex(value, this.debugger.callTree.reducedTrace)
let nextSource = util.findClosestIndex(value, this.debugger.callTree.reducedTrace)
nextSource = nextSource + incr
if (nextSource <= 0) {
nextSource = 0

@ -27,7 +27,7 @@ function mapping (type, stateDefinitions, contractName) {
const keyType = parseType(keyTypeName, stateDefinitions, contractName, 'storage')
const valueType = parseType(valueTypeName, stateDefinitions, contractName, 'storage')
var underlyingTypes = {
const underlyingTypes = {
keyType: keyType,
valueType: valueType
}
@ -329,9 +329,9 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
offset: 0,
slot: 0
}
for (var i in types) {
var variable = types[i]
var type = parseType(variable.typeDescriptions.typeString, stateDefinitions, contractName, location)
for (const i in types) {
const variable = types[i]
const type = parseType(variable.typeDescriptions.typeString, stateDefinitions, contractName, location)
if (!type) {
console.log('unable to retrieve decode info of ' + variable.typeDescriptions.typeString)
return null

@ -262,7 +262,7 @@ async function includeVariableDeclaration (tree, step, sourceLocation, scopeId,
// so, either this is the direct value, or the offset in memory. That depends on the type.
if (variableDeclaration.name !== '') {
states = tree.solidityProxy.extractStatesDefinitions()
var location = extractLocationFromAstVariable(variableDeclaration)
let location = extractLocationFromAstVariable(variableDeclaration)
location = location === 'default' ? 'storage' : location
// we push the new local variable in our tree
tree.scopes[scopeId].locals[variableDeclaration.name] = {

@ -10,7 +10,7 @@ export async function solidityLocals (vmtraceIndex, internalTreeCall, stack, mem
memory = formatMemory(memory)
let anonymousIncr = 1
for (const local in scope.locals) {
var variable = scope.locals[local]
const variable = scope.locals[local]
if (variable.stackDepth < stack.length && variable.sourceLocation.start <= currentSourceLocation.start) {
let name = variable.name
if (name.indexOf('$') !== -1) {

@ -10,8 +10,8 @@ import { computeOffsets } from './decodeInfo'
*/
export async function decodeState (stateVars, storageResolver) {
const ret = {}
for (var k in stateVars) {
var stateVar = stateVars[k]
for (const k in stateVars) {
const stateVar = stateVars[k]
try {
const decoded = await stateVar.type.decodeFromStorage(stateVar.storagelocation, storageResolver)
decoded.constant = stateVar.constant

@ -50,7 +50,7 @@ export class ArrayType extends RefType {
} else {
size = new BN(this.arraySize)
}
var k = toBN(0)
const k = toBN(0)
for (; k.lt(size) && k.ltn(300); k.iaddn(1)) {
try {
ret.push(await this.underlyingType.decodeFromStorage(currentLocation, storageResolver))
@ -92,8 +92,8 @@ export class ArrayType extends RefType {
if (skip) offset = offset + (32 * skip)
let limit = length - skip
if (limit > 10) limit = 10
for (var k = 0; k < limit; k++) {
var contentOffset = offset
for (let k = 0; k < limit; k++) {
const contentOffset = offset
ret.push(this.underlyingType.decodeFromMemory(contentOffset, memory))
offset += 32
}

@ -42,7 +42,7 @@ export class DynamicByteArray extends RefType {
}
return { value: '0x' + ret.replace(/(00)+$/, ''), length: '0x' + length.toString(16), type: this.typeName }
} else {
var size = parseInt(value.substr(value.length - 2, 2), 16) / 2
const size = parseInt(value.substr(value.length - 2, 2), 16) / 2
return { value: '0x' + value.substr(0, size * 2), length: '0x' + size.toString(16), type: this.typeName }
}
}

@ -13,7 +13,7 @@ export class Struct extends RefType {
async decodeFromStorage (location, storageResolver) {
const ret = {}
for (var item of this.members) {
for (const item of this.members) {
const globalLocation = {
offset: location.offset + item.storagelocation.offset,
slot: add(location.slot, item.storagelocation.slot)
@ -31,8 +31,8 @@ export class Struct extends RefType {
decodeFromMemoryInternal (offset, memory) {
const ret = {}
this.members.map((item, i) => {
var contentOffset = offset
var member = item.type.decodeFromMemory(contentOffset, memory)
const contentOffset = offset
const member = item.type.decodeFromMemory(contentOffset, memory)
ret[item.name] = member
if (!(item.type instanceof Mapping)) offset += 32
})

@ -27,7 +27,7 @@ export class ValueType {
*/
async decodeFromStorage (location, storageResolver) {
try {
var value = await extractHexValue(location, storageResolver, this.storageBytes)
const value = await extractHexValue(location, storageResolver, this.storageBytes)
return { value: this.decodeValue(value), type: this.typeName }
} catch (e) {
console.log(e)

@ -142,7 +142,7 @@ export function nodesAtPosition (astNodeType, position, ast) {
const astWalker = new AstWalker()
const found = []
const callback = function (node) {
var nodeLocation = sourceLocationFromAstNode(node)
const nodeLocation = sourceLocationFromAstNode(node)
if (!nodeLocation) {
return
}

@ -13,7 +13,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) {
const ret = {}
if (!corrections.length) corrections.push({ offset: 0, slot: 0 })
for (const hashedLoc in storage) {
var preimage
let preimage
try {
const key = storage[hashedLoc].key
for (const k in corrections) {

@ -85,7 +85,7 @@ export class StorageResolver {
* - If @arg slot is not cached, the corresponding value will be resolved and the next 1000 slots.
*/
async storageRangeInternal (self, slotKey, tx, stepIndex, address) {
var cached = this.fromCache(self, address)
const cached = this.fromCache(self, address)
if (cached && cached.storage[slotKey]) { // we have the current slot in the cache and maybe the next 1000...
return cached.storage
}

@ -62,7 +62,7 @@ export class TraceCache {
if (!validReturnStep) {
this.currentCall.call.reverted = reverted
}
var parent = this.currentCall.parent
const parent = this.currentCall.parent
if (parent) this.currentCall = { call: parent.call, parent: parent.parent }
return
}
@ -123,12 +123,12 @@ export class TraceCache {
accumulateStorageChanges (index, address, storage) {
const ret = Object.assign({}, storage)
for (var k in this.storageChanges) {
for (const k in this.storageChanges) {
const changesIndex = this.storageChanges[k]
if (changesIndex > index) {
return ret
}
var sstore = this.sstore[changesIndex]
const sstore = this.sstore[changesIndex]
if (sstore.address === address && sstore.key) {
ret[sstore.hashedKey] = {
key: sstore.key,

@ -48,7 +48,7 @@ export class TraceManager {
this.isLoading = false
return true
}
var mes = tx.hash + ' is not a contract invocation or contract creation.'
const mes = tx.hash + ' is not a contract invocation or contract creation.'
console.log(mes)
this.isLoading = false
throw new Error(mes)
@ -290,7 +290,7 @@ export class TraceManager {
waterfall (calls, stepindex, cb) {
const ret = []
let retError = null
for (var call in calls) {
for (const call in calls) {
calls[call].apply(this, [stepindex, function (error, result) {
retError = error
ret.push({ error: error, value: result })

@ -40,7 +40,7 @@ export class TraceStepManager {
const call = util.findCall(currentStep, this.traceAnalyser.traceCache.callsTree.call)
const subCalls = Object.keys(call.calls)
if (subCalls.length) {
var callStart = util.findLowerBound(currentStep, subCalls) + 1
const callStart = util.findLowerBound(currentStep, subCalls) + 1
if (subCalls.length > callStart) {
return parseInt(subCalls[callStart]) - 1
}

@ -37,7 +37,7 @@ export function encodeData (funABI, values, contractbyteCode) {
*/
export function encodeParams (params, funAbi, callback) {
let data: Buffer | string = ''
let dataHex: string = ''
let dataHex = ''
let funArgs
if (params.indexOf('raw:0x') === 0) {
// in that case we consider that the input is already encoded and *does not* contain the method signature
@ -167,7 +167,7 @@ export function encodeConstructorCallAndDeployLibraries (contractName, contract,
export function buildData (contractName, contract, contracts, isConstructor, funAbi, params, callback, callbackStep, callbackDeployLibrary) {
let funArgs = []
let data: Buffer | string = ''
let dataHex: string = ''
let dataHex = ''
if (params.indexOf('raw:0x') === 0) {
// in that case we consider that the input is already encoded and *does not* contain the method signature

@ -369,7 +369,7 @@ export class TxListener {
const abiCoder = new ethers.utils.AbiCoder()
const decoded = abiCoder.decode(inputTypes, data)
const ret = {}
for (var k in abi.inputs) {
for (const k in abi.inputs) {
ret[abi.inputs[k].type + ' ' + abi.inputs[k].name] = decoded[k]
}
return ret

@ -106,7 +106,7 @@ export class TxRunnerVM {
const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e']
const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)]
var block = Block.fromBlockData({
const block = Block.fromBlockData({
header: {
timestamp: timestamp || (new Date().getTime() / 1000 | 0),
number: self.blockNumber,

@ -52,7 +52,7 @@ export class TxRunnerWeb3 {
return callback(err, resp)
}
this.event.trigger('transactionBroadcasted', [resp])
var listenOnResponse = () => {
const listenOnResponse = () => {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
const receipt = await tryTillReceiptAvailable(resp, this.getWeb3())

@ -10,13 +10,13 @@ export function toInt (h) {
return h
}
export var stringify = convertToString
export const stringify = convertToString
function convertToString (v) {
try {
if (v instanceof Array) {
const ret = []
for (var k in v) {
for (const k in v) {
ret.push(convertToString(v[k]))
}
return ret

@ -45,13 +45,13 @@ export function tryConvertAsciiFormat (memorySlot) {
*/
export function formatCss (css1, css2) {
let ret = ''
for (const arg in arguments) {
for (const k in arguments[arg]) {
if (arguments[arg][k] && ret.indexOf(k) === -1) {
for (const arg in arguments) { // eslint-disable-line
for (const k in arguments[arg]) { // eslint-disable-line
if (arguments[arg][k] && ret.indexOf(k) === -1) { // eslint-disable-line
if (k.indexOf('*') === 0) {
ret += arguments[arg][k]
ret += arguments[arg][k] // eslint-disable-line
} else {
ret += k + ':' + arguments[arg][k] + ';'
ret += k + ':' + arguments[arg][k] + ';' // eslint-disable-line
}
}
}

@ -19,6 +19,7 @@ import { TxRunnerVM } from './execution/txRunnerVM'
import { TxRunnerWeb3 } from './execution/txRunnerWeb3'
import * as txResultHelper from './helpers/txResultHelper'
export { ICompilerApi, ConfigurationSettings } from './types/ICompilerApi'
export { QueryParams } from './query-params'
const helpers = {
ui: uiHelper,

@ -0,0 +1,38 @@
'use strict'
export class QueryParams {
update (params) {
const currentParams = this.get()
const keys = Object.keys(params)
for (const x in keys) {
currentParams[keys[x]] = params[keys[x]]
}
let queryString = '#'
const updatedKeys = Object.keys(currentParams)
for (const y in updatedKeys) {
queryString += updatedKeys[y] + '=' + currentParams[updatedKeys[y]] + '&'
}
window.location.hash = queryString.slice(0, -1)
}
get () {
const qs = window.location.hash.substr(1)
if (window.location.search.length > 0) {
// use legacy query params instead of hash
window.location.hash = window.location.search.substr(1)
window.location.search = ''
}
const params = {}
const parts = qs.split('&')
for (const x in parts) {
const keyValue = parts[x].split('=')
if (keyValue[0] !== '') {
params[keyValue[0]] = keyValue[1]
}
}
return params
}
}

@ -10,7 +10,7 @@ export class Storage {
if (typeof window !== 'undefined') {
this.safeKeys().forEach(function (name) {
if (name.indexOf('sol-cache-file-', 0) === 0) {
var content = window.localStorage.getItem(name)
const content = window.localStorage.getItem(name)
window.localStorage.setItem(name.replace(/^sol-cache-file-/, 'sol:'), content)
window.localStorage.removeItem(name)
}

@ -34,7 +34,7 @@ export interface ICompilerApi {
open: (file: string) => void
saveCurrentFile: () => void
logToTerminal: (log: terminalLog) => {}
logToTerminal: (log: terminalLog) => void
compileWithHardhat: (configPath: string) => Promise<string>
}

@ -152,7 +152,7 @@ export class Web3VmProvider {
const log = data.execResult.logs[l]
const topics = []
if (log[1].length > 0) {
for (var k in log[1]) {
for (const k in log[1]) {
topics.push('0x' + log[1][k].toString('hex'))
}
} else {

@ -35,7 +35,7 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac
}
export function processTx (txRunnerInstance, payload, isCall, callback) {
let { from, to, data, value, gas } = payload.params[0]
let { from, to, data, value, gas } = payload.params[0] // eslint-disable-line
gas = gas || 3000000
const callbacks = {

@ -77,11 +77,11 @@ export class Provider {
disconnect () {
return false
};
}
supportsSubscriptions () {
return true
};
}
on (type, cb) {
this.vmContext.logsManager.addListener(type, cb)

@ -1,5 +1,5 @@
const semver = require('semver')
const minixhr = require('minixhr')
import * as semver from 'semver'
import * as minixhr from 'minixhr'
/* global Worker */
export const baseURLBin = 'https://binaries.soliditylang.org/bin'

@ -103,7 +103,7 @@ export class Compiler {
onInternalCompilerLoaded (): void {
if (this.state.worker === null) {
const compiler: any = typeof (window) !== 'undefined' && window['Module'] ? require('solc/wrapper')(window['Module']) : require('solc')
const compiler: any = typeof (window) !== 'undefined' && window['Module'] ? require('solc/wrapper')(window['Module']) : require('solc') // eslint-disable-line
this.state.compileJSON = (source: SourceWithTarget) => {
const missingInputs: string[] = []
const missingInputsCallback = (path: string) => {
@ -170,7 +170,7 @@ export class Compiler {
loadRemoteVersion (version: string): void {
console.log(`Loading remote solc version ${version} ...`)
const compiler: any = require('solc')
const compiler: any = require('solc') // eslint-disable-line
compiler.loadRemoteVersion(version, (err, remoteCompiler) => {
if (err) {
console.error('Error in loading remote solc compiler: ', err)

@ -14,7 +14,7 @@ function regexIndexOf (inputString: string, regex: RegExp, startpos = 0) {
}
export function writeTestAccountsContract (accounts: string[]) {
const testAccountContract = require('../sol/tests_accounts.sol')
const testAccountContract = require('../sol/tests_accounts.sol') // eslint-disable-line
let body = `address[${accounts.length}] memory accounts;`
if (!accounts.length) body += ';'
else {
@ -152,7 +152,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
if (result.error) error.push(result.error)
const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors)
if (!isBrowser) require('signale').fatal(errors) // eslint-disable-line
return cb(new CompilationErrors(errors))
}
cb(err, result.contracts, result.sources) // return callback with contract details & ASTs
@ -217,7 +217,7 @@ export function compileContractSources (sources: SrcIfc, newCompConfig: any, imp
if (result.error) error.push(result.error)
const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors)
if (!isBrowser) require('signale').fatal(errors) // eslint-disable-line
return cb(new CompilationErrors(errors))
}
cb(err, result.contracts, result.sources) // return callback with contract details & ASTs

@ -1,6 +1,6 @@
// Extend fs
import path from 'path'
const fs: any = require('fs')
const fs: any = require('fs') // eslint-disable-line
// https://github.com/mikeal/node-utils/blob/master/file/lib/main.js
fs.walkSync = function (start: string, callback) {

@ -2,5 +2,5 @@ export { runTestFiles } from './runTestFiles'
export { UnitTestRunner } from './runTestSources'
export { runTest } from './testRunner'
export * from './types'
export const assertLibCode = require('../sol/tests.sol')
export const assertLibCode = require('../sol/tests.sol') // eslint-disable-line
export { writeTestAccountsContract } from './compiler'

@ -32,7 +32,7 @@ function mapOptimize (v: string) {
return optimize[v]
}
const version = require('../package.json').version
const version = require('../package.json').version // eslint-disable-line
commander.version(version)

@ -22,7 +22,7 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3
opts = opts || {}
compilerConfig = compilerConfig || {} as CompilerConfiguration
const sourceASTs: any = {}
const { Signale } = require('signale')
const { Signale } = require('signale') // eslint-disable-line
// signale configuration
const options = {
types: {

@ -1,5 +1,5 @@
export { default as RemixApp } from './lib/remix-app/remix-app'
export { dispatchModalContext } from './lib/remix-app/context/context'
export { dispatchModalContext, AppContext } from './lib/remix-app/context/context'
export { ModalProvider } from './lib/remix-app/context/provider'
export { AppModal } from './lib/remix-app/interface/index'
export { AlertModal } from './lib/remix-app/interface/index'

@ -1,6 +1,5 @@
import React, { useEffect, useRef, useState } from 'react'
import { ModalDialog } from '@remix-ui/modal-dialog'
import { ModalDialogProps } from 'libs/remix-ui/modal-dialog/src/lib/types'
import { ModalDialog, ModalDialogProps } from '@remix-ui/modal-dialog'
import { ModalTypes } from '../../types'
interface ModalWrapperProps extends ModalDialogProps {

@ -1,7 +1,6 @@
import React from 'react'
import { AlertModal, AppModal } from '../interface'
import { ModalInitialState } from '../state/modals'
import { ModalTypes } from '../types'
export const AppContext = React.createContext<any>(null)

@ -7,6 +7,7 @@ import DragBar from './components/dragbar/dragbar'
import { AppProvider } from './context/provider'
import AppDialogs from './components/modals/dialogs'
import DialogViewPlugin from './components/modals/dialogViewPlugin'
import { AppContext } from './context/context'
interface IRemixAppUi {
app: any
@ -96,7 +97,7 @@ const RemixApp = (props: IRemixAppUi) => {
{components.sidePanel}
<DragBar minWidth={250} refObject={sidePanelRef} hidden={hideSidePanel} setHideStatus={setHideSidePanel}></DragBar>
<div id="main-panel" data-id="remixIdeMainPanel" className='mainpanel'>
<RemixUIMainPanel></RemixUIMainPanel>
<RemixUIMainPanel Context={AppContext}></RemixUIMainPanel>
</div>
</div>
{components.hiddenPanel}

@ -13,10 +13,11 @@ interface ICopyToClipboard {
className?: string,
title?: string,
children?: JSX.Element,
getContent?: () => {}
getContent?: () => any
}
export const CopyToClipboard = (props: ICopyToClipboard) => {
let { content, tip = 'Copy', icon = 'fa-copy', direction = 'right', children, getContent, ...otherProps } = props
const { tip = 'Copy', icon = 'fa-copy', direction = 'right', getContent, children, ...otherProps } = props
let { content } = props
const [message, setMessage] = useState(tip)
const copyData = () => {

@ -6,9 +6,9 @@ import VmDebuggerHead from './vm-debugger/vm-debugger-head' // eslint-disable-li
import { TransactionDebugger as Debugger } from '@remix-project/remix-debug' // eslint-disable-line
import { DebuggerUIProps } from './idebugger-api' // eslint-disable-line
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { isValidHash } from '@remix-ui/helper'
/* eslint-disable-next-line */
import './debugger-ui.css'
const helper = require('../../../../../apps/remix-ide/src/lib/helper')
const _paq = (window as any)._paq = (window as any)._paq || []
export const DebuggerUI = (props: DebuggerUIProps) => {
@ -171,7 +171,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
txNumber: txNumber
}
})
if (!helper.isValidHash(txNumber)) {
if (!isValidHash(txNumber)) {
setState(prevState => {
return {
...prevState,

@ -16,6 +16,8 @@ export interface ExtractData {
export type ExtractFunc = (json: any, parent?: any) => ExtractData
export type FormatSelfFunc = (key: string | number, data: ExtractData) => JSX.Element
export type RegisterEventType = (type: string, listener: any) => void // listener is a function
export type TriggerEventType = (type: string, payload: Array<any>) => void
export interface DropdownPanelProps {
dropdownName: string,
dropdownMessage?: string,
@ -26,8 +28,8 @@ export interface DropdownPanelProps {
loading?: boolean,
extractFunc?: ExtractFunc,
formatSelfFunc?: FormatSelfFunc,
registerEvent?: Function,
triggerEvent?: Function,
registerEvent?: RegisterEventType,
triggerEvent?: TriggerEventType,
loadMoreEvent?: string,
loadMoreCompletedEvent?: string,
bodyStyle?: React.CSSProperties,

@ -10,7 +10,7 @@ export type astNode = {
id: number,
children?: Array<any>,
typeDescriptions: any,
nodeType: String,
nodeType: string,
src: string // e.g "142:1361:0"
}
@ -21,7 +21,7 @@ export type nodePositionLight = {
}
export type astNodeLight = {
fileTarget: String,
fileTarget: string,
nodeId: number,
position: nodePositionLight
}
@ -39,7 +39,7 @@ export interface RemixUiEditorContextViewProps {
openFile: (fileName: string) => void,
getLastCompilationResult: () => any,
offsetToLineColumn: (position: any, file: any, sources: any, asts: any) => any,
getCurrentFileName: () => String
getCurrentFileName: () => string
onContextListenerChanged: (listener: onContextListenerChangedListener) => void
onCurrentFileChanged: (listener: ononCurrentFileChangedListener) => void
referencesOf: (nodes: astNode) => Array<astNode>

@ -94,3 +94,15 @@ export const is0XPrefixed = (value) => {
export const isHexadecimal = (value) => {
return /^[0-9a-fA-F]+$/.test(value) && (value.length % 2 === 0)
}
export const isValidHash = (hash) => { // 0x prefixed, hexadecimal, 64digit
const hexValue = hash.slice(2, hash.length)
return is0XPrefixed(hash) && /^[0-9a-fA-F]{64}$/.test(hexValue)
}
export const shortenHexData = (data) => {
if (!data) return ''
if (data.length < 5) return data
const len = data.length
return data.slice(0, 5) + '...' + data.slice(len - 5, len)
}

@ -5,7 +5,7 @@ import JSZip from 'jszip'
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import PluginButton from './components/pluginButton' // eslint-disable-line
import QueryParams from '../../../../../apps/remix-ide/src/lib/query-params'
import { QueryParams } from '@remix-project/remix-lib'
import { ThemeContext, themes } from './themeContext'
declare global {
interface Window {
@ -186,7 +186,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
try {
node.dispatchEvent(new MouseEvent('click'))
} catch (e) {
var evt = document.createEvent('MouseEvents')
const evt = document.createEvent('MouseEvents')
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,
20, false, false, false, false, 0, null)
node.dispatchEvent(evt)
@ -202,9 +202,9 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
zip.file(path, content)
})
zip.generateAsync({ type: 'blob' }).then(function (blob) {
var today = new Date()
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
var time = today.getHours() + 'h' + today.getMinutes() + 'min'
const today = new Date()
const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
const time = today.getHours() + 'h' + today.getMinutes() + 'min'
saveAs(blob, `remix-backup-at-${time}-${date}.zip`)
}).catch((e) => {
plugin.call('notification', 'toast', e.message)

@ -1,2 +1,3 @@
export * from './lib/modal-dialog-custom'
export * from './lib/remix-ui-modal-dialog'
export * from './lib/types/index'

@ -1,13 +1,16 @@
/* eslint-disable no-unused-expressions */
import { AppContext } from 'libs/remix-ui/app/src/lib/remix-app/context/context'
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react' // eslint-disable-line
import React, { useContext, useEffect, useRef, useState } from 'react' // eslint-disable-line
import DragBar from '../dragbar/dragbar'
import RemixUIPanelPlugin from '../plugins/panel-plugin'
import { PluginRecord } from '../types'
import './main-panel.css'
const RemixUIMainPanel = () => {
const appContext = useContext(AppContext)
export type RemixUIMainPanelProps = {
Context: React.Context<any>
}
const RemixUIMainPanel = (props: RemixUIMainPanelProps) => {
const appContext = useContext(props.Context)
const [plugins, setPlugins] = useState<PluginRecord[]>([])
const editorRef = useRef<HTMLDivElement>(null)
const mainPanelRef = useRef<HTMLDivElement>(null)

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Profile } from '@remixproject/plugin-utils'
import React from 'react' // eslint-disable-line no-use-before-define
import { PluginManagerComponent, PluginManagerProfile } from '../../types'
import { PluginManagerComponent } from '../../types'
import InactivePluginCard from './InactivePluginCard'
import ModuleHeading from './moduleHeading'
@ -11,16 +11,6 @@ interface InactivePluginCardContainerProps {
inactiveProfiles: Profile<any>[]
}
interface LocalPluginInterface {
profile: Partial<PluginManagerProfile>
activateService: {}
requestQueue: []
options: { queueTimeout: number }
id: number
pendingRequest: {}
listener: []
iframe: {}
}
function InactivePluginCardContainer ({ pluginComponent }: InactivePluginCardContainerProps) {
const activatePlugin = (pluginName: string) => {
pluginComponent.activateP(pluginName)

@ -74,7 +74,7 @@ export class PluginManagerComponent extends ViewPlugin extends Plugin implements
app: PluginApi<any> // eslint-disable-line no-undef
engine: Engine
htmlElement: HTMLDivElement
views: { root: null, items: {} }
views: { root: null, items: Record<any, any> }
localPlugin: LocalPlugin // eslint-disable-line no-use-before-define
pluginNames: string[]
inactivePlugins: Profile[]
@ -149,7 +149,7 @@ export interface RemixUiPluginManagerProps {
declare class PluginLoader {
get currentLoader(): any
donotAutoReload: string[]
loaders: {}
loaders: Record<any, any>
current: string
set(plugin: any, actives: any): void
get(): any

@ -16,6 +16,7 @@ export function ContractGUI (props: ContractGUIProps) {
dataId: string
}>({ title: '', content: '', classList: '', dataId: '' })
const multiFields = useRef<Array<HTMLInputElement | null>>([])
const basicInputRef = useRef<HTMLInputElement>()
useEffect(() => {
if (props.title) {
@ -26,6 +27,10 @@ export function ContractGUI (props: ContractGUIProps) {
setTitle(props.funcABI.type === 'receive' ? '(receive)' : '(fallback)')
}
setBasicInput('')
// we have the reset the fields before reseting the previous references.
basicInputRef.current.value = ''
multiFields.current.filter((el) => el !== null && el !== undefined).forEach((el) => el.value = '')
multiFields.current = []
}, [props.title, props.funcABI])
useEffect(() => {
@ -166,6 +171,7 @@ export function ContractGUI (props: ContractGUIProps) {
placeholder={props.inputs}
title={props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? `'(${props.funcABI.type}')` : props.inputs}
onChange={handleBasicInput}
ref={basicInputRef}
style={{ visibility: !((props.funcABI.inputs && props.funcABI.inputs.length > 0) || (props.funcABI.type === 'fallback') || (props.funcABI.type === 'receive')) ? 'hidden' : 'visible' }} />
<i
className="fas fa-angle-down udapp_methCaret"

@ -7,8 +7,7 @@ import './remix-ui-settings.css'
import { ethereumVM, generateContractMetadat, personal, textWrapEventAction, useMatomoAnalytics, saveTokenToast, removeTokenToast } from './settingsAction'
import { initialState, toastInitialState, toastReducer, settingReducer } from './settingsReducer'
import { Toaster } from '@remix-ui/toaster'// eslint-disable-line
import { RemixUiThemeModule } from '@remix-ui/theme-module'
import { ThemeModule } from 'libs/remix-ui/theme-module/types/theme-module'
import { RemixUiThemeModule, ThemeModule} from '@remix-ui/theme-module'
/* eslint-disable-next-line */
export interface RemixUiSettingsProps {

@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef, useReducer } from 'react' // eslint
import semver from 'semver'
import { CompilerContainerProps } from './types'
import { ConfigurationSettings } from '@remix-project/remix-lib-ts'
import * as helper from '../../../../../apps/remix-ide/src/lib/helper'
import { checkSpecialChars, extractNameFromKey } from '@remix-ui/helper'
import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promisedMiniXhr } from '@remix-project/remix-solidity'
import { compilerReducer, compilerInitialState } from './reducers/compiler'
import { resetEditorMode, listenToEvents } from './actions/compiler'
@ -243,7 +243,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
})
}
const isSolFileSelected = (currentFile: string = '') => {
const isSolFileSelected = (currentFile = '') => {
if (!currentFile) currentFile = api.currentFile
if (!currentFile) return false
const extention = currentFile.substr(currentFile.length - 3, currentFile.length)
@ -350,7 +350,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
url = customUrl
api.setCompilerParameters({ version: selectedVersion })
} else {
if (helper.checkSpecialChars(selectedVersion)) {
if (checkSpecialChars(selectedVersion)) {
return console.log('loading ' + selectedVersion + ' not allowed, special chars not allowed.')
}
if (selectedVersion === 'builtin' || selectedVersion.indexOf('soljson') === 0) {
@ -606,7 +606,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<button id="compileBtn" data-id="compilerContainerCompileBtn" className="btn btn-primary btn-block remixui_disabled mt-3" title="Compile" onClick={compile} disabled={disableCompileButton}>
<span>
{ <i ref={compileIcon} className="fas fa-sync remixui_iconbtn" aria-hidden="true"></i> }
Compile { typeof state.compiledFileName === 'string' ? helper.extractNameFromKey(state.compiledFileName) || '<no file selected>' : '<no file selected>' }
Compile { typeof state.compiledFileName === 'string' ? extractNameFromKey(state.compiledFileName) || '<no file selected>' : '<no file selected>' }
</span>
</button>
</header>

@ -1,8 +1,6 @@
import { ICompilerApi } from '@remix-project/remix-lib-ts'
import { getValidLanguage } from '@remix-project/remix-solidity'
const Compiler = require('@remix-project/remix-solidity').Compiler
const EventEmitter = require('events')
import { getValidLanguage, Compiler} from '@remix-project/remix-solidity'
import { EventEmitter } from 'events'
declare global {
interface Window {
@ -132,7 +130,7 @@ export class CompileTabLogic {
}
// TODO readd saving current file
this.api.saveCurrentFile()
var currentFile = this.api.currentFile
const currentFile = this.api.currentFile
return this.compileFile(currentFile)
} catch (err) {
console.error(err)

@ -47,7 +47,7 @@ export function parseContracts (contractName, contract, source) {
}
const retrieveMetadataHash = function (bytecode) {
var match = /a165627a7a72305820([0-9a-f]{64})0029$/.exec(bytecode)
let match = /a165627a7a72305820([0-9a-f]{64})0029$/.exec(bytecode)
if (!match) {
match = /a265627a7a72305820([0-9a-f]{64})6c6578706572696d656e74616cf50037$/.exec(bytecode)
}

@ -22,7 +22,7 @@ export const registerCommandAction = (name: string, command, activate, dispatch:
}
commands[name] = function () {
const args = [...arguments]
const args = [...arguments] // eslint-disable-line
const steps = []
const root = { steps, cmd: name, gidx: 0, idx: 0 }
const ITEM = { root, cmd: name }
@ -62,7 +62,7 @@ export const registerCommandAction = (name: string, command, activate, dispatch:
Object.keys(commands).forEach(function makeScopedCommand (cmd) {
const command = _commands[cmd]
scopedCommands[cmd] = function _command () {
const args = [...arguments]
const args = [...arguments] // eslint-disable-line
command(args, scopedCommands, el => append(cmd, args, el))
}
})
@ -80,28 +80,28 @@ export const filterFnAction = (name: string, filterFn, dispatch: React.Dispatch<
export const registerLogScriptRunnerAction = (on, commandName, commandFn, dispatch: React.Dispatch<any>) => {
on('scriptRunner', commandName, (msg) => {
commandFn.log.apply(commandFn, msg.data)
commandFn.log.apply(commandFn, msg.data) // eslint-disable-line
dispatch({ type: commandName, payload: { commandFn, message: msg.data } })
})
}
export const registerInfoScriptRunnerAction = (on, commandName, commandFn, dispatch: React.Dispatch<any>) => {
on('scriptRunner', commandName, (msg) => {
commandFn.info.apply(commandFn, msg.data)
commandFn.info.apply(commandFn, msg.data) // eslint-disable-line
dispatch({ type: commandName, payload: { commandFn, message: msg.data } })
})
}
export const registerWarnScriptRunnerAction = (on, commandName, commandFn, dispatch: React.Dispatch<any>) => {
on('scriptRunner', commandName, (msg) => {
commandFn.warn.apply(commandFn, msg.data)
commandFn.warn.apply(commandFn, msg.data) // eslint-disable-line
dispatch({ type: commandName, payload: { commandFn, message: msg.data } })
})
}
export const registerErrorScriptRunnerAction = (on, commandName, commandFn, dispatch: React.Dispatch<any>) => {
on('scriptRunner', commandName, (msg) => {
commandFn.error.apply(commandFn, msg.data)
commandFn.error.apply(commandFn, msg.data) // eslint-disable-line
dispatch({ type: commandName, payload: { commandFn, message: msg.data } })
})
}

@ -1,17 +1,16 @@
import React from 'react' // eslint-disable-line
import helper from 'apps/remix-ide/src/lib/helper'
const remixLib = require('@remix-project/remix-lib')
const typeConversion = remixLib.execution.typeConversion
import { shortenHexData } from '@remix-ui/helper'
import { execution } from '@remix-project/remix-lib'
const typeConversion = execution.typeConversion
const Context = ({ opts, provider }: { opts, provider: string }) => {
const data = opts.tx || ''
const from = opts.from ? helper.shortenHexData(opts.from) : ''
const from = opts.from ? shortenHexData(opts.from) : ''
let to = opts.to
if (data.to) to = to + ' ' + helper.shortenHexData(data.to)
if (data.to) to = to + ' ' + shortenHexData(data.to)
const val = data.value
let hash = data.hash ? helper.shortenHexData(data.hash) : ''
const input = data.input ? helper.shortenHexData(data.input) : ''
let hash = data.hash ? shortenHexData(data.hash) : ''
const input = data.input ? shortenHexData(data.input) : ''
const logs = opts.logs && opts.logs.decoded && opts.logs.decoded.length ? opts.logs.decoded.length : 0
const block = data.receipt ? data.receipt.blockNumber : data.blockNumber || ''
const i = data.receipt ? data.transactionIndex : data.transactionIndex
@ -44,7 +43,7 @@ const Context = ({ opts, provider }: { opts, provider: string }) => {
</span>
</div>)
} else {
hash = helper.shortenHexData(data.blockHash)
hash = shortenHexData(data.blockHash)
return (
<div>
<span>

@ -1,16 +1,15 @@
import React, { useState } from 'react' // eslint-disable-line
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import helper from 'apps/remix-ide/src/lib/helper'
import React from 'react' // eslint-disable-line
import { shortenHexData } from '@remix-ui/helper'
import CheckTxStatus from './ChechTxStatus' // eslint-disable-line
import showTable from './Table'
import { execution } from '@remix-project/remix-lib'
const remixLib = require('@remix-project/remix-lib')
const typeConversion = remixLib.execution.typeConversion
const typeConversion = execution.typeConversion
const RenderCall = ({ tx, resolvedData, logs, index, plugin, showTableHash, txDetails, modal }) => {
const to = resolvedData.contractName + '.' + resolvedData.fn
const from = tx.from ? tx.from : ' - '
const input = tx.input ? helper.shortenHexData(tx.input) : ''
const input = tx.input ? shortenHexData(tx.input) : ''
const txType = 'call'
const debug = (event, tx) => {

@ -1,12 +1,10 @@
import React, { useState } from 'react' // eslint-disable-line
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import React from 'react' // eslint-disable-line
import CheckTxStatus from './ChechTxStatus' // eslint-disable-line
import Context from './Context' // eslint-disable-line
import showTable from './Table'
const remixLib = require('@remix-project/remix-lib')
const typeConversion = remixLib.execution.typeConversion
import { execution } from '@remix-project/remix-lib'
const typeConversion = execution.typeConversion
const RenderKnownTransactions = ({ tx, receipt, resolvedData, logs, index, plugin, showTableHash, txDetails, modal, provider }) => {
const debug = (event, tx) => {

@ -1,9 +1,8 @@
import React, { useState } from 'react' // eslint-disable-line
import React from 'react' // eslint-disable-line
import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line
import helper from 'apps/remix-ide/src/lib/helper'
const remixLib = require('@remix-project/remix-lib')
const typeConversion = remixLib.execution.typeConversion
import { shortenHexData } from '@remix-ui/helper'
import { execution } from '@remix-project/remix-lib'
const typeConversion = execution.typeConversion
const showTable = (opts, showTableHash) => {
let msg = ''
@ -184,7 +183,7 @@ const showTable = (opts, showTableHash) => {
data-id={`txLoggerTableHash${opts.hash}`}
data-shared={`pair_${opts.hash}`}
>
{helper.shortenHexData(opts.input)}
{shortenHexData(opts.input)}
<CopyToClipboard content={opts.input} />
</td>
</tr>

@ -105,7 +105,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
registerCommandAction('error', _blocksRenderer('error'), { activate: true }, dispatch)
registerCommandAction('script', function execute (args, scopedCommands) {
var script = String(args[0])
const script = String(args[0])
_shell(script, scopedCommands, function (error, output) {
if (error) scriptRunnerDispatch({ type: 'error', payload: { message: error } })
if (output) scriptRunnerDispatch({ type: 'script', payload: { message: '5' } })
@ -281,7 +281,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
const filterUndefined = (el) => el !== undefined && el !== null
return function logger (args) {
const types = args.filter(filterUndefined).map(type => type)
const values = javascriptserialize.apply(null, args.filter(filterUndefined)).map(function (val, idx) {
const values = javascriptserialize.apply(null, args.filter(filterUndefined)).map(function (val, idx) { // eslint-disable-line
if (typeof args[idx] === 'string') {
const el = document.createElement('div')
el.innerHTML = args[idx].replace(/(\r\n|\n|\r)/gm, '<br>')

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save