Remove comments

pull/1339/head
ioedeveloper 3 years ago
parent 241b334c4f
commit 926dd2fecd
  1. 1
      apps/remix-ide-e2e/src/tests/publishContract.test.ts
  2. 4
      apps/remix-ide/src/app/tabs/analysis-tab.js
  3. 1
      apps/remix-ide/src/app/tabs/compile-tab.js
  4. 234
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  5. 15
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  6. 2
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx

@ -26,7 +26,6 @@ module.exports = {
browser.perform((done) => {
if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed')
// if (value.indexOf('ipfs://') === -1) browser.assert.fail('ipfs deploy failed')
done()
})
})

@ -4,7 +4,7 @@ import ReactDOM from 'react-dom'
import { EventEmitter } from 'events'
import {RemixUiStaticAnalyser} from '@remix-ui/static-analyser' // eslint-disable-line
import * as packageJson from '../../../../../package.json'
// var Renderer = require('../ui/renderer')
var Renderer = require('../ui/renderer')
var EventManager = require('../../lib/events')
@ -30,7 +30,7 @@ class AnalysisTab extends ViewPlugin {
this.element = document.createElement('div')
this.element.setAttribute('id', 'staticAnalyserView')
this._components = {
// renderer: new Renderer(this)
renderer: new Renderer(this)
}
this._components.registry = this.registry
this._deps = {

@ -46,7 +46,6 @@ class CompileTab extends ViewPlugin {
// dependencies
this.editor = editor
this.config = config
// this.renderer = new Renderer(this)
this.fileManager = fileManager
this.contractsDetails = {}
this.data = {

@ -1,130 +1,130 @@
// import * as packageJson from '../../../../../../package.json'
// import { Plugin } from '@remixproject/engine'
// const EventEmitter = require('events')
// var Compiler = require('@remix-project/remix-solidity').Compiler
import * as packageJson from '../../../../../../package.json'
import { Plugin } from '@remixproject/engine'
const EventEmitter = require('events')
var Compiler = require('@remix-project/remix-solidity').Compiler
// const profile = {
// name: 'solidity-logic',
// displayName: 'Solidity compiler logic',
// description: 'Compile solidity contracts - Logic',
// version: packageJson.version
// }
const profile = {
name: 'solidity-logic',
displayName: 'Solidity compiler logic',
description: 'Compile solidity contracts - Logic',
version: packageJson.version
}
// class CompileTab extends Plugin {
// constructor (queryParams, fileManager, editor, config, fileProvider, contentImport) {
// super(profile)
// this.event = new EventEmitter()
// this.queryParams = queryParams
// this.compilerImport = contentImport
// this.compiler = new Compiler((url, cb) => this.compilerImport.resolveAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
// this.fileManager = fileManager
// this.editor = editor
// this.config = config
// this.fileProvider = fileProvider
// }
class CompileTab extends Plugin {
constructor (queryParams, fileManager, editor, config, fileProvider, contentImport) {
super(profile)
this.event = new EventEmitter()
this.queryParams = queryParams
this.compilerImport = contentImport
this.compiler = new Compiler((url, cb) => this.compilerImport.resolveAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
this.fileManager = fileManager
this.editor = editor
this.config = config
this.fileProvider = fileProvider
}
// init () {
// this.optimize = this.queryParams.get().optimize
// this.optimize = this.optimize === 'true'
// this.queryParams.update({ optimize: this.optimize })
// this.compiler.set('optimize', this.optimize)
init () {
this.optimize = this.queryParams.get().optimize
this.optimize = this.optimize === 'true'
this.queryParams.update({ optimize: this.optimize })
this.compiler.set('optimize', this.optimize)
// this.runs = this.queryParams.get().runs
// this.runs = this.runs || 200
// this.queryParams.update({ runs: this.runs })
// this.compiler.set('runs', this.runs)
this.runs = this.queryParams.get().runs
this.runs = this.runs || 200
this.queryParams.update({ runs: this.runs })
this.compiler.set('runs', this.runs)
// this.evmVersion = this.queryParams.get().evmVersion
// if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) {
// this.evmVersion = null
// }
// this.queryParams.update({ evmVersion: this.evmVersion })
// this.compiler.set('evmVersion', this.evmVersion)
// }
this.evmVersion = this.queryParams.get().evmVersion
if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) {
this.evmVersion = null
}
this.queryParams.update({ evmVersion: this.evmVersion })
this.compiler.set('evmVersion', this.evmVersion)
}
// setOptimize (newOptimizeValue) {
// this.optimize = newOptimizeValue
// this.queryParams.update({ optimize: this.optimize })
// this.compiler.set('optimize', this.optimize)
// }
setOptimize (newOptimizeValue) {
this.optimize = newOptimizeValue
this.queryParams.update({ optimize: this.optimize })
this.compiler.set('optimize', this.optimize)
}
// setRuns (runs) {
// this.runs = runs
// this.queryParams.update({ runs: this.runs })
// this.compiler.set('runs', this.runs)
// }
setRuns (runs) {
this.runs = runs
this.queryParams.update({ runs: this.runs })
this.compiler.set('runs', this.runs)
}
// setEvmVersion (newEvmVersion) {
// this.evmVersion = newEvmVersion
// this.queryParams.update({ evmVersion: this.evmVersion })
// this.compiler.set('evmVersion', this.evmVersion)
// }
setEvmVersion (newEvmVersion) {
this.evmVersion = newEvmVersion
this.queryParams.update({ evmVersion: this.evmVersion })
this.compiler.set('evmVersion', this.evmVersion)
}
// /**
// * Set the compiler to using Solidity or Yul (default to Solidity)
// * @params lang {'Solidity' | 'Yul'} ...
// */
// setLanguage (lang) {
// this.compiler.set('language', lang)
// }
/**
* Set the compiler to using Solidity or Yul (default to Solidity)
* @params lang {'Solidity' | 'Yul'} ...
*/
setLanguage (lang) {
this.compiler.set('language', lang)
}
// /**
// * Compile a specific file of the file manager
// * @param {string} target the path to the file to compile
// */
// compileFile (target) {
// if (!target) throw new Error('No target provided for compiliation')
// const provider = this.fileManager.fileProviderOf(target)
// if (!provider) throw new Error(`cannot compile ${target}. Does not belong to any explorer`)
// return new Promise((resolve, reject) => {
// provider.get(target, (error, content) => {
// if (error) return reject(error)
// const sources = { [target]: { content } }
// this.event.emit('startingCompilation')
// // setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
// setTimeout(() => { this.compiler.compile(sources, target); resolve() }, 100)
// })
// })
// }
/**
* Compile a specific file of the file manager
* @param {string} target the path to the file to compile
*/
compileFile (target) {
if (!target) throw new Error('No target provided for compiliation')
const provider = this.fileManager.fileProviderOf(target)
if (!provider) throw new Error(`cannot compile ${target}. Does not belong to any explorer`)
return new Promise((resolve, reject) => {
provider.get(target, (error, content) => {
if (error) return reject(error)
const sources = { [target]: { content } }
this.event.emit('startingCompilation')
// setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
setTimeout(() => { this.compiler.compile(sources, target); resolve() }, 100)
})
})
}
// async isHardhatProject () {
// if (this.fileManager.mode === 'localhost') {
// return await this.fileManager.exists('hardhat.config.js')
// } else return false
// }
async isHardhatProject () {
if (this.fileManager.mode === 'localhost') {
return await this.fileManager.exists('hardhat.config.js')
} else return false
}
// runCompiler (hhCompilation) {
// try {
// if (this.fileManager.mode === 'localhost' && hhCompilation) {
// const { currentVersion, optimize, runs } = this.compiler.state
// if (currentVersion) {
// const fileContent = `module.exports = {
// solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}',
// settings: {
// optimizer: {
// enabled: ${optimize},
// runs: ${runs}
// }
// }
// }
// `
// const configFilePath = 'remix-compiler.config.js'
// this.fileManager.setFileContent(configFilePath, fileContent)
// this.call('hardhat', 'compile', configFilePath).then((result) => {
// this.call('terminal', 'log', { type: 'info', value: result })
// }).catch((error) => {
// this.call('terminal', 'log', { type: 'error', value: error })
// })
// }
// }
// this.fileManager.saveCurrentFile()
// this.event.emit('removeAnnotations')
// var currentFile = this.config.get('currentFile')
// return this.compileFile(currentFile)
// } catch (err) {
// console.error(err)
// }
// }
// }
runCompiler (hhCompilation) {
try {
if (this.fileManager.mode === 'localhost' && hhCompilation) {
const { currentVersion, optimize, runs } = this.compiler.state
if (currentVersion) {
const fileContent = `module.exports = {
solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}',
settings: {
optimizer: {
enabled: ${optimize},
runs: ${runs}
}
}
}
`
const configFilePath = 'remix-compiler.config.js'
this.fileManager.setFileContent(configFilePath, fileContent)
this.call('hardhat', 'compile', configFilePath).then((result) => {
this.call('terminal', 'log', { type: 'info', value: result })
}).catch((error) => {
this.call('terminal', 'log', { type: 'error', value: error })
})
}
}
this.fileManager.saveCurrentFile()
this.event.emit('removeAnnotations')
var currentFile = this.config.get('currentFile')
return this.compileFile(currentFile)
} catch (err) {
console.error(err)
}
}
}
// module.exports = CompileTab
module.exports = CompileTab

@ -259,7 +259,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const loadingCompiler = () => {
if (!compileIcon.current) return
// _disableCompileBtn(true)
compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.')
compileIcon.current.classList.add('remixui_spinningIcon')
warningIcon.current.style.visibility = 'hidden'
@ -268,7 +267,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const compilerLoaded = () => {
if (!compileIcon.current) return
// _disableCompileBtn(false)
compileIcon.current.setAttribute('title', '')
compileIcon.current.classList.remove('remixui_spinningIcon')
if (state.autoCompile) compile()
@ -349,10 +347,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
// resort to non-worker version in that case.
if (selectedVersion !== 'builtin' && canUseWorker(selectedVersion)) {
compileTabLogic.compiler.loadVersion(true, url)
// setVersionText('(loading using worker)')
} else {
compileTabLogic.compiler.loadVersion(false, url)
// setVersionText('(loading)')
}
}
@ -361,10 +357,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
(version.includes('nightly') && state.includeNightlies)
}
// const setVersionText = (text) => {
// if (this._view.version) this._view.version.innerText = text
// }
const promptCompiler = () => {
// custom url https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js
modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => {})
@ -400,11 +392,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const _updateLanguageSelector = () => {
// This is the first version when Yul is available
if (!semver.valid(_retrieveVersion()) || semver.lt(_retrieveVersion(), 'v0.5.7+commit.6da8b019.js')) {
// this._view.languageSelector.setAttribute('disabled', '')
// this._view.languageSelector.value = 'Solidity'
// this.compileTabLogic.setLanguage('Solidity')
} else {
// this._view.languageSelector.removeAttribute('disabled')
handleLanguageChange('Solidity')
compileTabLogic.setLanguage('Solidity')
}
}

@ -48,7 +48,6 @@ export const ContractSelection = (props: ContractSelectionProps) => {
const copyContractProperty = (property) => {
let content = getContractProperty(property)
if (!content) {
// addTooltip('No content available for ' + property)
return
}
@ -59,7 +58,6 @@ export const ContractSelection = (props: ContractSelectionProps) => {
} catch (e) {}
return content
// addTooltip('Copied value to clipboard')
}
const getContractProperty = (property) => {

Loading…
Cancel
Save