Merge pull request #2064 from ethereum/fix_linting

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

@ -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) => { return new Promise((resolve) => {
browser.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100) browser.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).pause(100)
.click(`//*[@data-id='${buttonText}']`, async () => { .click(`//*[@data-id='${buttonText}']`, async () => {
@ -107,7 +107,7 @@ const checkForAcceptAndRemember = async function (browser: NightwatchBrowser) {
* @return {Promise} * @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) { if (payload) {
await setPayload(browser, payload) await setPayload(browser, payload)
} else { } else {

@ -11,6 +11,7 @@ import { VerticalIcons } from './app/components/vertical-icons'
import { LandingPage } from './app/ui/landing-page/landing-page' import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel' import { MainPanel } from './app/components/main-panel'
import { PermissionHandlerPlugin } from './app/plugins/permission-handler-plugin' import { PermissionHandlerPlugin } from './app/plugins/permission-handler-plugin'
import { AstWalker } from '@remix-project/remix-astwalker'
import { WalkthroughService } from './walkthroughService' import { WalkthroughService } from './walkthroughService'
@ -27,7 +28,7 @@ const isElectron = require('is-electron')
const remixLib = require('@remix-project/remix-lib') 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 Storage = remixLib.Storage
const RemixDProvider = require('./app/files/remixDProvider') const RemixDProvider = require('./app/files/remixDProvider')
const Config = require('./config') const Config = require('./config')
@ -51,10 +52,9 @@ const { TabProxy } = require('./app/panels/tab-proxy.js')
class AppComponent { class AppComponent {
constructor () { constructor () {
const self = this this.appManager = new RemixAppManager({})
self.appManager = new RemixAppManager({}) this.queryParams = new QueryParams()
self.queryParams = new QueryParams() this._components = {}
self._components = {}
// setup storage // setup storage
const configStorage = new Storage('config-v0.8:') const configStorage = new Storage('config-v0.8:')
@ -63,54 +63,55 @@ class AppComponent {
Registry.getInstance().put({ api: config, name: 'config' }) Registry.getInstance().put({ api: config, name: 'config' })
// load file system // load file system
self._components.filesProviders = {} this._components.filesProviders = {}
self._components.filesProviders.browser = new FileProvider('browser') this._components.filesProviders.browser = new FileProvider('browser')
Registry.getInstance().put({ Registry.getInstance().put({
api: self._components.filesProviders.browser, api: this._components.filesProviders.browser,
name: 'fileproviders/browser' name: 'fileproviders/browser'
}) })
self._components.filesProviders.localhost = new RemixDProvider( this._components.filesProviders.localhost = new RemixDProvider(
self.appManager this.appManager
) )
Registry.getInstance().put({ Registry.getInstance().put({
api: self._components.filesProviders.localhost, api: this._components.filesProviders.localhost,
name: 'fileproviders/localhost' name: 'fileproviders/localhost'
}) })
self._components.filesProviders.workspace = new WorkspaceFileProvider() this._components.filesProviders.workspace = new WorkspaceFileProvider()
Registry.getInstance().put({ Registry.getInstance().put({
api: self._components.filesProviders.workspace, api: this._components.filesProviders.workspace,
name: 'fileproviders/workspace' name: 'fileproviders/workspace'
}) })
Registry.getInstance().put({ Registry.getInstance().put({
api: self._components.filesProviders, api: this._components.filesProviders,
name: 'fileproviders' name: 'fileproviders'
}) })
} }
async run () { async run () {
const self = this
// APP_MANAGER // APP_MANAGER
const appManager = self.appManager const appManager = this.appManager
const pluginLoader = self.appManager.pluginLoader const pluginLoader = this.appManager.pluginLoader
self.panels = {} this.panels = {}
self.workspace = pluginLoader.get() this.workspace = pluginLoader.get()
self.engine = new RemixEngine() this.engine = new RemixEngine()
self.engine.register(appManager) this.engine.register(appManager);
const matomoDomains = { const matomoDomains = {
'remix-alpha.ethereum.org': 27, 'remix-alpha.ethereum.org': 27,
'remix-beta.ethereum.org': 25, 'remix-beta.ethereum.org': 25,
'remix.ethereum.org': 23 'remix.ethereum.org': 23
} }
self.showMatamo = this.showMatamo =
matomoDomains[window.location.hostname] && matomoDomains[window.location.hostname] &&
!Registry.getInstance() !Registry.getInstance()
.get('config') .get('config')
.api.exists('settings/matomo-analytics') .api.exists('settings/matomo-analytics')
self.walkthroughService = new WalkthroughService( this.walkthroughService = new WalkthroughService(
appManager, appManager,
self.showMatamo this.showMatamo
) )
const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080'] const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
@ -124,10 +125,10 @@ class AppComponent {
// SERVICES // SERVICES
// ----------------- gist service --------------------------------- // ----------------- gist service ---------------------------------
self.gistHandler = new GistHandler() this.gistHandler = new GistHandler()
// ----------------- theme service --------------------------------- // ----------------- theme service ---------------------------------
self.themeModule = new ThemeModule() this.themeModule = new ThemeModule()
Registry.getInstance().put({ api: self.themeModule, name: 'themeModule' }) Registry.getInstance().put({ api: this.themeModule, name: 'themeModule' })
// ----------------- editor service ---------------------------- // ----------------- editor service ----------------------------
const editor = new Editor() // wrapper around ace editor const editor = new Editor() // wrapper around ace editor
@ -185,24 +186,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() const configPlugin = new ConfigPlugin()
self.layout = new Layout() this.layout = new Layout()
const permissionHandler = new PermissionHandlerPlugin() const permissionHandler = new PermissionHandlerPlugin()
self.engine.register([ this.engine.register([
permissionHandler, permissionHandler,
self.layout, this.layout,
self.notification, this.notification,
self.gistHandler, this.gistHandler,
configPlugin, configPlugin,
blockchain, blockchain,
contentImport, contentImport,
self.themeModule, this.themeModule,
editor, editor,
fileManager, fileManager,
compilerMetadataGenerator, compilerMetadataGenerator,
@ -215,46 +216,46 @@ class AppComponent {
fetchAndCompile, fetchAndCompile,
dGitProvider, dGitProvider,
hardhatProvider, hardhatProvider,
self.walkthroughService this.walkthroughService
]) ])
// LAYOUT & SYSTEM VIEWS // LAYOUT & SYSTEM VIEWS
const appPanel = new MainPanel() 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) const tabProxy = new TabProxy(fileManager, editor)
self.engine.register([appPanel, tabProxy]) this.engine.register([appPanel, tabProxy])
// those views depend on app_manager // those views depend on app_manager
self.menuicons = new VerticalIcons() this.menuicons = new VerticalIcons()
self.sidePanel = new SidePanel() this.sidePanel = new SidePanel()
self.hiddenPanel = new HiddenPanel() this.hiddenPanel = new HiddenPanel()
const pluginManagerComponent = new PluginManagerComponent( const pluginManagerComponent = new PluginManagerComponent(
appManager, appManager,
self.engine this.engine
) )
const filePanel = new FilePanel(appManager) const filePanel = new FilePanel(appManager)
const landingPage = new LandingPage( const landingPage = new LandingPage(
appManager, appManager,
self.menuicons, this.menuicons,
fileManager, fileManager,
filePanel, filePanel,
contentImport contentImport
) )
self.settings = new SettingsTab( this.settings = new SettingsTab(
Registry.getInstance().get('config').api, Registry.getInstance().get('config').api,
editor, editor,
appManager appManager
) )
self.engine.register([ this.engine.register([
self.menuicons, this.menuicons,
landingPage, landingPage,
self.hiddenPanel, this.hiddenPanel,
self.sidePanel, this.sidePanel,
filePanel, filePanel,
pluginManagerComponent, pluginManagerComponent,
self.settings this.settings
]) ])
// CONTENT VIEWS & DEFAULT PLUGINS // CONTENT VIEWS & DEFAULT PLUGINS
@ -283,7 +284,7 @@ class AppComponent {
contentImport contentImport
) )
self.engine.register([ this.engine.register([
compileTab, compileTab,
run, run,
debug, debug,
@ -295,7 +296,7 @@ class AppComponent {
filePanel.slitherHandle filePanel.slitherHandle
]) ])
self.layout.panels = { this.layout.panels = {
tabs: { plugin: tabProxy, active: true }, tabs: { plugin: tabProxy, active: true },
editor: { plugin: editor, active: true }, editor: { plugin: editor, active: true },
main: { plugin: appPanel, active: false }, main: { plugin: appPanel, active: false },
@ -306,47 +307,46 @@ class AppComponent {
async activate () { async activate () {
const queryParams = new QueryParams() const queryParams = new QueryParams()
const params = queryParams.get() const params = queryParams.get()
const self = this
if (isElectron()) { if (isElectron()) {
self.appManager.activatePlugin('remixd') this.appManager.activatePlugin('remixd')
} }
try { try {
self.engine.register(await self.appManager.registeredPlugins()) this.engine.register(await this.appManager.registeredPlugins())
} catch (e) { } catch (e) {
console.log("couldn't register iframe plugins", e.message) console.log("couldn't register iframe plugins", e.message)
} }
await self.appManager.activatePlugin(['layout']) await this.appManager.activatePlugin(['layout'])
await self.appManager.activatePlugin(['notification']) await this.appManager.activatePlugin(['notification'])
await self.appManager.activatePlugin(['editor']) await this.appManager.activatePlugin(['editor'])
await self.appManager.activatePlugin(['permissionhandler', 'theme', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter']) await this.appManager.activatePlugin(['permissionhandler', 'theme', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter'])
await self.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs']) await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs'])
await self.appManager.activatePlugin(['sidePanel']) // activating host plugin separately await this.appManager.activatePlugin(['sidePanel']) // activating host plugin separately
await self.appManager.activatePlugin(['home']) await this.appManager.activatePlugin(['home'])
await self.appManager.activatePlugin(['settings', 'config']) await this.appManager.activatePlugin(['settings', 'config'])
await self.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler']) await this.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler'])
await self.appManager.activatePlugin(['settings']) await this.appManager.activatePlugin(['settings'])
await self.appManager.activatePlugin(['walkthrough']) await this.appManager.activatePlugin(['walkthrough'])
self.appManager.on( this.appManager.on(
'filePanel', 'filePanel',
'workspaceInitializationCompleted', 'workspaceInitializationCompleted',
async () => { async () => {
await self.appManager.registerContextMenuItems() await this.appManager.registerContextMenuItems()
} }
) )
await self.appManager.activatePlugin(['filePanel']) await this.appManager.activatePlugin(['filePanel'])
// Set workspace after initial activation // Set workspace after initial activation
self.appManager.on('editor', 'editorMounted', () => { this.appManager.on('editor', 'editorMounted', () => {
if (Array.isArray(self.workspace)) { if (Array.isArray(this.workspace)) {
self.appManager this.appManager
.activatePlugin(self.workspace) .activatePlugin(this.workspace)
.then(async () => { .then(async () => {
try { try {
if (params.deactivate) { if (params.deactivate) {
await self.appManager.deactivatePlugin( await this.appManager.deactivatePlugin(
params.deactivate.split(',') params.deactivate.split(',')
) )
} }
@ -355,21 +355,21 @@ class AppComponent {
} }
if (params.code) { if (params.code) {
// if code is given in url we focus on solidity plugin // if code is given in url we focus on solidity plugin
self.menuicons.select('solidity') this.menuicons.select('solidity')
} else { } else {
// If plugins are loaded from the URL params, we focus on the last one. // If plugins are loaded from the URL params, we focus on the last one.
if ( if (
self.appManager.pluginLoader.current === 'queryParams' && this.appManager.pluginLoader.current === 'queryParams' &&
self.workspace.length > 0 this.workspace.length > 0
) { self.menuicons.select(self.workspace[self.workspace.length - 1]) } ) { this.menuicons.select(this.workspace[this.workspace.length - 1]) }
} }
if (params.call) { if (params.call) {
const callDetails = params.call.split('//') const callDetails = params.call.split('//')
if (callDetails.length > 1) { 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) // @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)
} }
} }
}) })
@ -377,7 +377,7 @@ class AppComponent {
} }
}) })
// activate solidity plugin // activate solidity plugin
self.appManager.activatePlugin(['solidity', 'udapp']) this.appManager.activatePlugin(['solidity', 'udapp'])
// Load and start the service who manager layout and frame // Load and start the service who manager layout and frame
} }
} }

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

@ -87,7 +87,7 @@ class FileProvider {
} }
get (path, cb) { get (path, cb) {
cb = cb || function () {} cb = cb || function () { /* do nothing. */ }
path = this.getPathFromUrl(path) || path // ensure we actually use the normalized path from here path = this.getPathFromUrl(path) || path // ensure we actually use the normalized path from here
var unprefixedpath = this.removePrefix(path) var unprefixedpath = this.removePrefix(path)
var exists = window.remixFileSystem.existsSync(unprefixedpath) var exists = window.remixFileSystem.existsSync(unprefixedpath)
@ -98,7 +98,7 @@ class FileProvider {
} }
set (path, content, cb) { set (path, content, cb) {
cb = cb || function () {} cb = cb || function () { /* do nothing. */ }
var unprefixedpath = this.removePrefix(path) var unprefixedpath = this.removePrefix(path)
var exists = window.remixFileSystem.existsSync(unprefixedpath) var exists = window.remixFileSystem.existsSync(unprefixedpath)
if (exists && window.remixFileSystem.readFileSync(unprefixedpath, 'utf8') === content) { if (exists && window.remixFileSystem.readFileSync(unprefixedpath, 'utf8') === content) {
@ -207,8 +207,8 @@ class FileProvider {
* @param {Function} visitFolder is a function called for each visited folders * @param {Function} visitFolder is a function called for each visited folders
*/ */
_copyFolderToJsonInternal (path, visitFile, visitFolder) { _copyFolderToJsonInternal (path, visitFile, visitFolder) {
visitFile = visitFile || (() => {}) visitFile = visitFile || function () { /* do nothing. */ }
visitFolder = visitFolder || (() => {}) visitFolder = visitFolder || function () { /* do nothing. */ }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const json = {} const json = {}
path = this.removePrefix(path) path = this.removePrefix(path)
@ -245,8 +245,8 @@ class FileProvider {
* @param {Function} visitFolder is a function called for each visited folders * @param {Function} visitFolder is a function called for each visited folders
*/ */
copyFolderToJson (path, visitFile, visitFolder) { copyFolderToJson (path, visitFile, visitFolder) {
visitFile = visitFile || (() => {}) visitFile = visitFile || function () { /* do nothing. */ }
visitFolder = visitFolder || (() => {}) visitFolder = visitFolder || function () { /* do nothing. */ }
return this._copyFolderToJsonInternal(path, visitFile, visitFolder) return this._copyFolderToJsonInternal(path, visitFile, visitFolder)
} }

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

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

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

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

@ -3,9 +3,9 @@ import React from 'react' // eslint-disable-line
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable-line import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable-line
import { CompileTabLogic } 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 { 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 { ICompilerApi } from '@remix-project/remix-lib-ts'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
import { compilerConfigChangedToastMsg, compileToastMsg } from '@remix-ui/helper' import { compilerConfigChangedToastMsg, compileToastMsg } from '@remix-ui/helper'

@ -1,5 +1,5 @@
import { DebuggerUI } from '@remix-ui/debugger-ui' // eslint-disable-line 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 { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line import React from 'react' // eslint-disable-line

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

@ -119,7 +119,7 @@ module.exports = class TestTab extends ViewPlugin {
usingWorker: canUseWorker(currentVersion), usingWorker: canUseWorker(currentVersion),
runs 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) if (error) return reject(error)
resolve(result) resolve(result)
}, (url, cb) => { }, (url, cb) => {

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

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

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

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

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

@ -15,6 +15,7 @@ function Config (storage) {
this.items = JSON.parse(config) this.items = JSON.parse(config)
} }
} catch (exception) { } catch (exception) {
/* Do nothing. */
} }
this.exists = function (key) { this.exists = function (key) {
@ -31,6 +32,7 @@ function Config (storage) {
storage.set(CONFIG_FILE, JSON.stringify(this.items)) storage.set(CONFIG_FILE, JSON.stringify(this.items))
this.events.emit(key + '_changed', content) this.events.emit(key + '_changed', content)
} catch (exception) { } 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 { PluginManager } from '@remixproject/engine'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import QueryParams from './lib/query-params' import { QueryParams } from '@remix-project/remix-lib'
import { IframePlugin } from '@remixproject/engine-web' import { IframePlugin } from '@remixproject/engine-web'
const _paq = window._paq = window._paq || [] const _paq = window._paq = window._paq || []
@ -174,7 +173,7 @@ class PluginLoader {
} }
this.loaders.queryParams = { this.loaders.queryParams = {
set: () => {}, set: () => { /* Do nothing. */ },
get: () => { get: () => {
const { activate } = queryParams.get() const { activate } = queryParams.get()
if (!activate) return [] if (!activate) return []

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

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

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

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

@ -2,8 +2,7 @@
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import { compile } from '@remix-project/remix-solidity' import { compile } from '@remix-project/remix-solidity'
import { util } from '@remix-project/remix-lib' import { util } from '@remix-project/remix-lib'
import { toChecksumAddress } from 'ethereumjs-util'
const ethutil = require('ethereumjs-util')
const profile = { const profile = {
name: 'fetchAndCompile', name: 'fetchAndCompile',
@ -32,7 +31,7 @@ export class FetchAndCompile extends Plugin {
* @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress * @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress
*/ */
async resolve (contractAddress, codeAtAddress, targetPath) { 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 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 () { onActivation () {
var self = this const self = this
this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data) => { this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data) => {
if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return if (!await this.call('settings', 'get', 'settings/generate-contract-metadata')) return
const compiler = new CompilerAbstract(languageVersion, data, source) const compiler = new CompilerAbstract(languageVersion, data, source)
var path = self._extractPathOf(source.target) const path = self._extractPathOf(source.target)
compiler.visitContracts((contract) => { compiler.visitContracts((contract) => {
if (contract.file !== source.target) return if (contract.file !== source.target) return
(async () => { (async () => {
@ -44,23 +44,23 @@ export class CompilerMetadata extends Plugin {
} }
_extractPathOf (file) { _extractPathOf (file) {
var reg = /(.*)(\/).*/ const reg = /(.*)(\/).*/
var path = reg.exec(file) const path = reg.exec(file)
return path ? path[1] : '/' return path ? path[1] : '/'
} }
async _setArtefacts (content, contract, path) { async _setArtefacts (content, contract, path) {
content = content || '{}' content = content || '{}'
var metadata let metadata
try { try {
metadata = JSON.parse(content) metadata = JSON.parse(content)
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
var fileName = this._JSONFileName(path, contract.name) const fileName = this._JSONFileName(path, contract.name)
var metadataFileName = this._MetadataFileName(path, contract.name) const metadataFileName = this._MetadataFileName(path, contract.name)
var deploy = metadata.deploy || {} const deploy = metadata.deploy || {}
this.networks.forEach((network) => { this.networks.forEach((network) => {
deploy[network] = this._syncContext(contract, deploy[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')) if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t'))
var data = { const data = {
deploy, deploy,
data: { data: {
bytecode: contract.object.evm.bytecode, bytecode: contract.object.evm.bytecode,
@ -87,14 +87,14 @@ export class CompilerMetadata extends Plugin {
} }
_syncContext (contract, metadata) { _syncContext (contract, metadata) {
var linkReferences = metadata.linkReferences let linkReferences = metadata.linkReferences
var autoDeployLib = metadata.autoDeployLib let autoDeployLib = metadata.autoDeployLib
if (!linkReferences) linkReferences = {} if (!linkReferences) linkReferences = {}
if (autoDeployLib === undefined) autoDeployLib = true 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] = {} 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]) { if (!linkReferences[libFile][lib]) {
linkReferences[libFile][lib] = '<address>' linkReferences[libFile][lib] = '<address>'
} }

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

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

@ -11,7 +11,7 @@ const profile = {
} }
export class OffsetToLineColumnConverter extends Plugin { export class OffsetToLineColumnConverter extends Plugin {
lineBreakPositionsByContent: {} lineBreakPositionsByContent: Record<number, Array<number>>
sourceMappingDecoder: any sourceMappingDecoder: any
constructor () { constructor () {
super(profile) 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) // 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) this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[sourcesArray[0]].content)
} else { } else {
for (var filename in asts) { for (const filename in asts) {
const source = asts[filename] const source = asts[filename]
if (source.id === file) { if (source.id === file) {
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[filename].content) this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[filename].content)

@ -64,7 +64,7 @@ export class CmdLine {
source.push('=> ' + (currentLineNumber + 1) + ': ' + currentLine) source.push('=> ' + (currentLineNumber + 1) + ': ' + currentLine)
const startLine = lineColumnPos.start.line const startLine = lineColumnPos.start.line
for (var i = 1; i < 4; i++) { for (let i = 1; i < 4; i++) {
const line = content[startLine + i] const line = content[startLine + i]
source.push(' ' + (startLine + i + 1) + ': ' + line) 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' } * @param {Object} sourceLocation - position of the breakpoint { file: '<file index>', row: '<line number' }
*/ */
remove (sourceLocation) { remove (sourceLocation) {
var sources = this.breakpoints[sourceLocation.fileName] const sources = this.breakpoints[sourceLocation.fileName]
if (!sources) { if (!sources) {
return return
} }

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

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

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

@ -81,7 +81,7 @@ export class Debugger {
sources[genSource.name] = { content: genSource.contents } 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]) this.event.trigger('newSourceLocation', [lineColumnPos, rawLocation, generatedSources, address])
} else { } else {
this.event.trigger('newSourceLocation', [null]) this.event.trigger('newSourceLocation', [null])

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

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

@ -27,7 +27,7 @@ function mapping (type, stateDefinitions, contractName) {
const keyType = parseType(keyTypeName, stateDefinitions, contractName, 'storage') const keyType = parseType(keyTypeName, stateDefinitions, contractName, 'storage')
const valueType = parseType(valueTypeName, stateDefinitions, contractName, 'storage') const valueType = parseType(valueTypeName, stateDefinitions, contractName, 'storage')
var underlyingTypes = { const underlyingTypes = {
keyType: keyType, keyType: keyType,
valueType: valueType valueType: valueType
} }
@ -329,9 +329,9 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
offset: 0, offset: 0,
slot: 0 slot: 0
} }
for (var i in types) { for (const i in types) {
var variable = types[i] const variable = types[i]
var type = parseType(variable.typeDescriptions.typeString, stateDefinitions, contractName, location) const type = parseType(variable.typeDescriptions.typeString, stateDefinitions, contractName, location)
if (!type) { if (!type) {
console.log('unable to retrieve decode info of ' + variable.typeDescriptions.typeString) console.log('unable to retrieve decode info of ' + variable.typeDescriptions.typeString)
return null 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. // so, either this is the direct value, or the offset in memory. That depends on the type.
if (variableDeclaration.name !== '') { if (variableDeclaration.name !== '') {
states = tree.solidityProxy.extractStatesDefinitions() states = tree.solidityProxy.extractStatesDefinitions()
var location = extractLocationFromAstVariable(variableDeclaration) let location = extractLocationFromAstVariable(variableDeclaration)
location = location === 'default' ? 'storage' : location location = location === 'default' ? 'storage' : location
// we push the new local variable in our tree // we push the new local variable in our tree
tree.scopes[scopeId].locals[variableDeclaration.name] = { tree.scopes[scopeId].locals[variableDeclaration.name] = {

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

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

@ -50,7 +50,7 @@ export class ArrayType extends RefType {
} else { } else {
size = new BN(this.arraySize) size = new BN(this.arraySize)
} }
var k = toBN(0) const k = toBN(0)
for (; k.lt(size) && k.ltn(300); k.iaddn(1)) { for (; k.lt(size) && k.ltn(300); k.iaddn(1)) {
try { try {
ret.push(await this.underlyingType.decodeFromStorage(currentLocation, storageResolver)) ret.push(await this.underlyingType.decodeFromStorage(currentLocation, storageResolver))
@ -92,8 +92,8 @@ export class ArrayType extends RefType {
if (skip) offset = offset + (32 * skip) if (skip) offset = offset + (32 * skip)
let limit = length - skip let limit = length - skip
if (limit > 10) limit = 10 if (limit > 10) limit = 10
for (var k = 0; k < limit; k++) { for (let k = 0; k < limit; k++) {
var contentOffset = offset const contentOffset = offset
ret.push(this.underlyingType.decodeFromMemory(contentOffset, memory)) ret.push(this.underlyingType.decodeFromMemory(contentOffset, memory))
offset += 32 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 } return { value: '0x' + ret.replace(/(00)+$/, ''), length: '0x' + length.toString(16), type: this.typeName }
} else { } 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 } 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) { async decodeFromStorage (location, storageResolver) {
const ret = {} const ret = {}
for (var item of this.members) { for (const item of this.members) {
const globalLocation = { const globalLocation = {
offset: location.offset + item.storagelocation.offset, offset: location.offset + item.storagelocation.offset,
slot: add(location.slot, item.storagelocation.slot) slot: add(location.slot, item.storagelocation.slot)
@ -31,8 +31,8 @@ export class Struct extends RefType {
decodeFromMemoryInternal (offset, memory) { decodeFromMemoryInternal (offset, memory) {
const ret = {} const ret = {}
this.members.map((item, i) => { this.members.map((item, i) => {
var contentOffset = offset const contentOffset = offset
var member = item.type.decodeFromMemory(contentOffset, memory) const member = item.type.decodeFromMemory(contentOffset, memory)
ret[item.name] = member ret[item.name] = member
if (!(item.type instanceof Mapping)) offset += 32 if (!(item.type instanceof Mapping)) offset += 32
}) })

@ -27,7 +27,7 @@ export class ValueType {
*/ */
async decodeFromStorage (location, storageResolver) { async decodeFromStorage (location, storageResolver) {
try { 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 } return { value: this.decodeValue(value), type: this.typeName }
} catch (e) { } catch (e) {
console.log(e) console.log(e)

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

@ -13,7 +13,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) {
const ret = {} const ret = {}
if (!corrections.length) corrections.push({ offset: 0, slot: 0 }) if (!corrections.length) corrections.push({ offset: 0, slot: 0 })
for (const hashedLoc in storage) { for (const hashedLoc in storage) {
var preimage let preimage
try { try {
const key = storage[hashedLoc].key const key = storage[hashedLoc].key
for (const k in corrections) { 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. * - If @arg slot is not cached, the corresponding value will be resolved and the next 1000 slots.
*/ */
async storageRangeInternal (self, slotKey, tx, stepIndex, address) { 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... if (cached && cached.storage[slotKey]) { // we have the current slot in the cache and maybe the next 1000...
return cached.storage return cached.storage
} }

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

@ -48,7 +48,7 @@ export class TraceManager {
this.isLoading = false this.isLoading = false
return true 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) console.log(mes)
this.isLoading = false this.isLoading = false
throw new Error(mes) throw new Error(mes)
@ -290,7 +290,7 @@ export class TraceManager {
waterfall (calls, stepindex, cb) { waterfall (calls, stepindex, cb) {
const ret = [] const ret = []
let retError = null let retError = null
for (var call in calls) { for (const call in calls) {
calls[call].apply(this, [stepindex, function (error, result) { calls[call].apply(this, [stepindex, function (error, result) {
retError = error retError = error
ret.push({ error: error, value: result }) ret.push({ error: error, value: result })

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

@ -37,7 +37,7 @@ export function encodeData (funABI, values, contractbyteCode) {
*/ */
export function encodeParams (params, funAbi, callback) { export function encodeParams (params, funAbi, callback) {
let data: Buffer | string = '' let data: Buffer | string = ''
let dataHex: string = '' let dataHex = ''
let funArgs let funArgs
if (params.indexOf('raw:0x') === 0) { if (params.indexOf('raw:0x') === 0) {
// in that case we consider that the input is already encoded and *does not* contain the method signature // 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) { export function buildData (contractName, contract, contracts, isConstructor, funAbi, params, callback, callbackStep, callbackDeployLibrary) {
let funArgs = [] let funArgs = []
let data: Buffer | string = '' let data: Buffer | string = ''
let dataHex: string = '' let dataHex = ''
if (params.indexOf('raw:0x') === 0) { if (params.indexOf('raw:0x') === 0) {
// in that case we consider that the input is already encoded and *does not* contain the method signature // 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 abiCoder = new ethers.utils.AbiCoder()
const decoded = abiCoder.decode(inputTypes, data) const decoded = abiCoder.decode(inputTypes, data)
const ret = {} 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] ret[abi.inputs[k].type + ' ' + abi.inputs[k].name] = decoded[k]
} }
return ret return ret

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

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

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

@ -45,13 +45,13 @@ export function tryConvertAsciiFormat (memorySlot) {
*/ */
export function formatCss (css1, css2) { export function formatCss (css1, css2) {
let ret = '' let ret = ''
for (const arg in arguments) { for (const arg in arguments) { // eslint-disable-line
for (const k in arguments[arg]) { for (const k in arguments[arg]) { // eslint-disable-line
if (arguments[arg][k] && ret.indexOf(k) === -1) { if (arguments[arg][k] && ret.indexOf(k) === -1) { // eslint-disable-line
if (k.indexOf('*') === 0) { if (k.indexOf('*') === 0) {
ret += arguments[arg][k] ret += arguments[arg][k] // eslint-disable-line
} else { } 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 { TxRunnerWeb3 } from './execution/txRunnerWeb3'
import * as txResultHelper from './helpers/txResultHelper' import * as txResultHelper from './helpers/txResultHelper'
export { ICompilerApi, ConfigurationSettings } from './types/ICompilerApi' export { ICompilerApi, ConfigurationSettings } from './types/ICompilerApi'
export { QueryParams } from './query-params'
const helpers = { const helpers = {
ui: uiHelper, 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') { if (typeof window !== 'undefined') {
this.safeKeys().forEach(function (name) { this.safeKeys().forEach(function (name) {
if (name.indexOf('sol-cache-file-', 0) === 0) { 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.setItem(name.replace(/^sol-cache-file-/, 'sol:'), content)
window.localStorage.removeItem(name) window.localStorage.removeItem(name)
} }

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

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

@ -35,7 +35,7 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac
} }
export function processTx (txRunnerInstance, payload, isCall, callback) { 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 gas = gas || 3000000
const callbacks = { const callbacks = {

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

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

@ -103,7 +103,7 @@ export class Compiler {
onInternalCompilerLoaded (): void { onInternalCompilerLoaded (): void {
if (this.state.worker === null) { 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) => { this.state.compileJSON = (source: SourceWithTarget) => {
const missingInputs: string[] = [] const missingInputs: string[] = []
const missingInputsCallback = (path: string) => { const missingInputsCallback = (path: string) => {
@ -170,7 +170,7 @@ export class Compiler {
loadRemoteVersion (version: string): void { loadRemoteVersion (version: string): void {
console.log(`Loading remote solc version ${version} ...`) 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) => { compiler.loadRemoteVersion(version, (err, remoteCompiler) => {
if (err) { if (err) {
console.error('Error in loading remote solc compiler: ', 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[]) { 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;` let body = `address[${accounts.length}] memory accounts;`
if (!accounts.length) body += ';' if (!accounts.length) body += ';'
else { else {
@ -152,7 +152,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
if (result.error) error.push(result.error) if (result.error) error.push(result.error)
const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error') const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) { if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors) if (!isBrowser) require('signale').fatal(errors) // eslint-disable-line
return cb(new CompilationErrors(errors)) return cb(new CompilationErrors(errors))
} }
cb(err, result.contracts, result.sources) // return callback with contract details & ASTs 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) if (result.error) error.push(result.error)
const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error') const errors = (result.errors || error).filter((e) => e.type === 'Error' || e.severity === 'error')
if (errors.length > 0) { if (errors.length > 0) {
if (!isBrowser) require('signale').fatal(errors) if (!isBrowser) require('signale').fatal(errors) // eslint-disable-line
return cb(new CompilationErrors(errors)) return cb(new CompilationErrors(errors))
} }
cb(err, result.contracts, result.sources) // return callback with contract details & ASTs cb(err, result.contracts, result.sources) // return callback with contract details & ASTs

@ -1,6 +1,6 @@
// Extend fs // Extend fs
import path from 'path' 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 // https://github.com/mikeal/node-utils/blob/master/file/lib/main.js
fs.walkSync = function (start: string, callback) { fs.walkSync = function (start: string, callback) {

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

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

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

@ -1,5 +1,5 @@
export { default as RemixApp } from './lib/remix-app/remix-app' 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 { ModalProvider } from './lib/remix-app/context/provider'
export { AppModal } from './lib/remix-app/interface/index' export { AppModal } from './lib/remix-app/interface/index'
export { AlertModal } 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 React, { useEffect, useRef, useState } from 'react'
import { ModalDialog } from '@remix-ui/modal-dialog' import { ModalDialog, ModalDialogProps } from '@remix-ui/modal-dialog'
import { ModalDialogProps } from 'libs/remix-ui/modal-dialog/src/lib/types'
import { ModalTypes } from '../../types' import { ModalTypes } from '../../types'
interface ModalWrapperProps extends ModalDialogProps { interface ModalWrapperProps extends ModalDialogProps {

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

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

@ -13,10 +13,11 @@ interface ICopyToClipboard {
className?: string, className?: string,
title?: string, title?: string,
children?: JSX.Element, children?: JSX.Element,
getContent?: () => {} getContent?: () => any
} }
export const CopyToClipboard = (props: ICopyToClipboard) => { 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 [message, setMessage] = useState(tip)
const copyData = () => { 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 { TransactionDebugger as Debugger } from '@remix-project/remix-debug' // eslint-disable-line
import { DebuggerUIProps } from './idebugger-api' // eslint-disable-line import { DebuggerUIProps } from './idebugger-api' // eslint-disable-line
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { isValidHash } from '@remix-ui/helper'
/* eslint-disable-next-line */ /* eslint-disable-next-line */
import './debugger-ui.css' import './debugger-ui.css'
const helper = require('../../../../../apps/remix-ide/src/lib/helper')
const _paq = (window as any)._paq = (window as any)._paq || [] const _paq = (window as any)._paq = (window as any)._paq || []
export const DebuggerUI = (props: DebuggerUIProps) => { export const DebuggerUI = (props: DebuggerUIProps) => {
@ -171,7 +171,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
txNumber: txNumber txNumber: txNumber
} }
}) })
if (!helper.isValidHash(txNumber)) { if (!isValidHash(txNumber)) {
setState(prevState => { setState(prevState => {
return { return {
...prevState, ...prevState,

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

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

@ -94,3 +94,15 @@ export const is0XPrefixed = (value) => {
export const isHexadecimal = (value) => { export const isHexadecimal = (value) => {
return /^[0-9a-fA-F]+$/.test(value) && (value.length % 2 === 0) 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 { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import PluginButton from './components/pluginButton' // 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' import { ThemeContext, themes } from './themeContext'
declare global { declare global {
interface Window { interface Window {
@ -186,7 +186,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
try { try {
node.dispatchEvent(new MouseEvent('click')) node.dispatchEvent(new MouseEvent('click'))
} catch (e) { } catch (e) {
var evt = document.createEvent('MouseEvents') const evt = document.createEvent('MouseEvents')
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,
20, false, false, false, false, 0, null) 20, false, false, false, false, 0, null)
node.dispatchEvent(evt) node.dispatchEvent(evt)
@ -202,9 +202,9 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
zip.file(path, content) zip.file(path, content)
}) })
zip.generateAsync({ type: 'blob' }).then(function (blob) { zip.generateAsync({ type: 'blob' }).then(function (blob) {
var today = new Date() const today = new Date()
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
var time = today.getHours() + 'h' + today.getMinutes() + 'min' const time = today.getHours() + 'h' + today.getMinutes() + 'min'
saveAs(blob, `remix-backup-at-${time}-${date}.zip`) saveAs(blob, `remix-backup-at-${time}-${date}.zip`)
}).catch((e) => { }).catch((e) => {
plugin.call('notification', 'toast', e.message) plugin.call('notification', 'toast', e.message)

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

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

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

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

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

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

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

@ -47,7 +47,7 @@ export function parseContracts (contractName, contract, source) {
} }
const retrieveMetadataHash = function (bytecode) { 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) { if (!match) {
match = /a265627a7a72305820([0-9a-f]{64})6c6578706572696d656e74616cf50037$/.exec(bytecode) match = /a265627a7a72305820([0-9a-f]{64})6c6578706572696d656e74616cf50037$/.exec(bytecode)
} }

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

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

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

@ -1,12 +1,10 @@
import React, { useState } from 'react' // eslint-disable-line import React from 'react' // eslint-disable-line
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import CheckTxStatus from './ChechTxStatus' // eslint-disable-line
import Context from './Context' // eslint-disable-line import Context from './Context' // eslint-disable-line
import showTable from './Table' import showTable from './Table'
import { execution } from '@remix-project/remix-lib'
const remixLib = require('@remix-project/remix-lib') const typeConversion = execution.typeConversion
const typeConversion = remixLib.execution.typeConversion
const RenderKnownTransactions = ({ tx, receipt, resolvedData, logs, index, plugin, showTableHash, txDetails, modal, provider }) => { const RenderKnownTransactions = ({ tx, receipt, resolvedData, logs, index, plugin, showTableHash, txDetails, modal, provider }) => {
const debug = (event, tx) => { 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 { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line
import helper from 'apps/remix-ide/src/lib/helper' import { shortenHexData } from '@remix-ui/helper'
import { execution } from '@remix-project/remix-lib'
const remixLib = require('@remix-project/remix-lib') const typeConversion = execution.typeConversion
const typeConversion = remixLib.execution.typeConversion
const showTable = (opts, showTableHash) => { const showTable = (opts, showTableHash) => {
let msg = '' let msg = ''
@ -184,7 +183,7 @@ const showTable = (opts, showTableHash) => {
data-id={`txLoggerTableHash${opts.hash}`} data-id={`txLoggerTableHash${opts.hash}`}
data-shared={`pair_${opts.hash}`} data-shared={`pair_${opts.hash}`}
> >
{helper.shortenHexData(opts.input)} {shortenHexData(opts.input)}
<CopyToClipboard content={opts.input} /> <CopyToClipboard content={opts.input} />
</td> </td>
</tr> </tr>

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

@ -14,9 +14,9 @@ export const matched = (arr, value) => arr.map(x => Object.keys(x).some(x => x.s
const findDeep = (object, fn, found = { break: false, value: undefined }) => { const findDeep = (object, fn, found = { break: false, value: undefined }) => {
if (typeof object !== 'object' || object === null) return if (typeof object !== 'object' || object === null) return
for (var i in object) { for (const i in object) {
if (found.break) break if (found.break) break
var el = object[i] let el = object[i]
if (el && el.innerText !== undefined && el.innerText !== null) el = el.innerText if (el && el.innerText !== undefined && el.innerText !== null) el = el.innerText
if (fn(el, i, object)) { if (fn(el, i, object)) {
found.value = el found.value = el

@ -1 +1,2 @@
export * from './lib/remix-ui-theme-module'; export * from './lib/remix-ui-theme-module';
export * from '../types/theme-module'

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Theme, ThemeModule } from '../../types/theme-module'; import { ThemeModule } from '../../types/theme-module';
import './remix-ui-theme-module.module.css'; import './remix-ui-theme-module.module.css';
/* eslint-disable-next-line */ /* eslint-disable-next-line */

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

Loading…
Cancel
Save