diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js
index c3c38876d2..ad45927786 100644
--- a/apps/remix-ide/src/app/panels/terminal.js
+++ b/apps/remix-ide/src/app/panels/terminal.js
@@ -447,7 +447,7 @@ class Terminal extends Plugin {
- Welcome to Remix ${packageJson.version} -
You can use this terminal for:
- - Checking transactions details and start debugging.
+ - Check transactions details and start debugging.
- Running JavaScript scripts. The following libraries are accessible:
- web3 version 1.0.0
@@ -456,9 +456,10 @@ class Terminal extends Plugin {
- remix (run remix.help() for more info)
- - Executing common command to interact with the Remix interface (see list of commands above). Note that these commands can also be included and run from a JavaScript script.
- - Use exports/.register(key, obj)/.remove(key)/.clear() to register and reuse object across script executions.
+
- Directly input a script in the command line interface
+
- Select a Javascript file in the file explorer and run \`remix.execute()\`
+
- Right click on a JavaScript file in the file explorer and click \`Run Script\`
`
diff --git a/apps/remix-ide/src/lib/cmdInterpreterAPI.js b/apps/remix-ide/src/lib/cmdInterpreterAPI.js
index 8f609c279a..9a1b47919f 100644
--- a/apps/remix-ide/src/lib/cmdInterpreterAPI.js
+++ b/apps/remix-ide/src/lib/cmdInterpreterAPI.js
@@ -31,112 +31,14 @@ class CmdInterpreterAPI {
offsetToLineColumnConverter: self._components.registry.get('offsettolinecolumnconverter').api
}
self.commandHelp = {
- 'remix.call(message: {name, key, payload})': 'Call a registered plugins',
- 'remix.getFile(path)': 'Returns the content of the file located at the given path',
- 'remix.setFile(path, content)': 'set the content of the file located at the given path',
- 'remix.debug(hash)': 'Start debugging a transaction.',
'remix.loadgist(id)': 'Load a gist in the file explorer.',
'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm, ipfs or raw http',
- 'remix.setproviderurl(url)': 'Change the current provider to Web3 provider and set the url endpoint.',
'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.',
'remix.exeCurrent()': 'Run the script currently displayed in the editor',
'remix.help()': 'Display this help message',
- 'remix.debugHelp()': 'Display help message for debugging'
}
}
- call (message) {
- return this._components.terminal.externalApi.request(message)
- }
log () { arguments[0] != null ? this._components.terminal.commands.html(arguments[0]) : this._components.terminal.commands.html(arguments[1]) }
- highlight (rawLocation) {
- var self = this
- if (!rawLocation) {
- self._components.sourceHighlighter.currentSourceLocation(null)
- return
- }
- var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file,
- self._deps.compilersArtefacts['__last'].getSourceCode().sources,
- self._deps.compilersArtefacts['__last'].getAsts())
- self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation)
- }
- debug (hash, cb) {
- var self = this
- delete self.d
- self.blockchain.web3().eth.getTransaction(hash, (error, tx) => {
- if (error) return cb(error)
- var debugSession = new RemixDebug({
- compilationResult: () => {
- return self._deps.compilersArtefacts['__last'].getData()
- }
- })
- debugSession.addProvider('web3', self.blockchain.web3())
- debugSession.switchProvider('web3')
- debugSession.debug(tx)
- self.d = debugSession
- this._components.terminal.commands.log('A new debugging session is available at remix.d')
- if (cb) cb(null, debugSession)
- // helpers
- self.d.highlight = (address, vmtraceIndex) => {
- if (!address) return self.highlight()
- self.d.sourceLocationFromVMTraceIndex(address, vmtraceIndex, (error, rawLocation) => {
- if (!error && rawLocation) {
- self.highlight(rawLocation)
- }
- })
- }
- self.d.stateAt = (vmTraceIndex) => {
- self.d.extractStateAt(vmTraceIndex, (error, state) => {
- if (error) return self.log(error)
- self.d.decodeStateAt(vmTraceIndex, state, (error, state) => {
- if (error) return this._components.terminal.commands.html(error)
- var treeView = new TreeView({
- json: true,
- formatSelf: solidityTypeFormatter.formatSelf,
- extractData: solidityTypeFormatter.extractData
- })
- self.log('State at ' + vmTraceIndex)
- self._components.terminal.commands.html(treeView.render(state, true))
- })
- })
- }
- self.d.localsAt = (contractAddress, vmTraceIndex) => {
- debugSession.sourceLocationFromVMTraceIndex(contractAddress, vmTraceIndex, (error, location) => {
- if (error) return self.log(error)
- debugSession.decodeLocalsAt(23, location, (error, locals) => {
- if (error) return this._components.terminal.commands.html(error)
- var treeView = new TreeView({
- json: true,
- formatSelf: solidityTypeFormatter.formatSelf,
- extractData: solidityTypeFormatter.extractData
- })
- self.log('Locals at ' + vmTraceIndex)
- self._components.terminal.commands.html(treeView.render(locals, true))
- })
- })
- }
- self.d.goTo = (row) => {
- if (self._deps.editor.current()) {
- var breakPoint = new remixDebug.BreakpointManager(self.d, (sourceLocation) => {
- return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file,
- self._deps.compilersArtefacts['__last'].getSourceCode().sources,
- self._deps.compilersArtefacts['__last'].getAsts())
- })
- breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => {
- self.log(null, 'step index ' + currentStep)
- self.highlight(sourceLocation)
- self.d.stateAt(currentStep)
- self.d.traceManager.getCurrentCalledAddressAt(currentStep, (error, address) => {
- if (error) return self.log(address)
- self.d.localsAt(address, currentStep)
- })
- })
- breakPoint.event.register('NoBreakpointHit', () => { self.log('line ' + row + ' is not part of the current execution') })
- breakPoint.add({fileName: self._deps.editor.current(), row: row - 1})
- breakPoint.jumpNextBreakpoint(0, true)
- }
- }
- })
- }
loadgist (id, cb) {
const self = this
self._components.gistHandler.loadFromGist({gist: id}, this._deps.fileManager)
@@ -179,36 +81,9 @@ class CmdInterpreterAPI {
}
})
}
- setproviderurl (url, cb) {
- this.blockchain.setProviderFromEndpoint(url, 'web3', (error) => {
- if (error) toolTip(error)
- if (cb) cb()
- })
- }
exeCurrent (cb) {
return this.execute(undefined, cb)
}
- getFile (path, cb) {
- var provider = this._deps.fileManager.fileProviderOf(path)
- if (provider) {
- provider.get(path, cb)
- } else {
- cb('file not found')
- }
- }
- setFile (path, content, cb) {
- cb = cb || function () {}
- var provider = this._deps.fileManager.fileProviderOf(path)
- if (provider) {
- provider.set(path, content, (error) => {
- if (error) return cb(error)
- this._deps.fileManager.syncEditor(path)
- cb()
- })
- } else {
- cb('file not found')
- }
- }
execute (file, cb) {
const self = this
@@ -257,37 +132,6 @@ class CmdInterpreterAPI {
if (cb) cb()
return ''
}
- debugHelp (cb) {
- const self = this
- var help = yo`Here are some examples of scripts that can be run (using remix.exeCurrent() or directly from the console)
`
- help.appendChild(yo`
`)
- help.appendChild(yo`
`)
- help.appendChild(yo`remix.debug('0x3c247ac268afb9a9c183feb9d4e83df51efbc8a2f4624c740789b788dac43029', function (error, debugSession) {
- remix.log = function () { arguments[0] != null ? console.log(arguments[0]) : console.log(arguments[1]) }
-
- remix.d.traceManager.getLength(remix.log)
- remix.storageView = remix.d.storageViewAt(97, '0x692a70d2e424a56d2c6c27aa97d1a86395877b3a')
- console.log('storage at 97 :')
- remix.storageView.storageRange(remix.log)
-})
`)
- help.appendChild(yo`remix.log = function () { arguments[0] != null ? console.log(arguments[0]) : console.log(arguments[1]) }
- remix.d.extractStateAt(2, function (error, state) {
- remix.d.decodeStateAt(97, state, remix.log)
- })
`)
- help.appendChild(yo`
`)
- help.appendChild(yo`remix.highlight(contractAddress, vmTraceIndex)
`)
- help.appendChild(yo`
`)
- help.appendChild(yo`remix.goTo(row) (this log the index in the vm trace, state and local variables)
`)
- help.appendChild(yo`
`)
- help.appendChild(yo`remix.stateAt(vmTraceIndex)
`)
- help.appendChild(yo`
`)
- help.appendChild(yo`remix.localsAt(vmTraceIndex)
`)
- help.appendChild(yo`
`)
- help.appendChild(yo``)
- self._components.terminal.commands.html(help)
- if (cb) cb()
- return ''
- }
}
module.exports = CmdInterpreterAPI
diff --git a/apps/remix-ide/src/lib/commands.js b/apps/remix-ide/src/lib/commands.js
index fe579ee037..a52f259ef8 100644
--- a/apps/remix-ide/src/lib/commands.js
+++ b/apps/remix-ide/src/lib/commands.js
@@ -6,16 +6,11 @@ const allPrograms = [
]
const allCommands = [
- {'remix.debug(hash)': 'Start debugging a transaction.'},
- {'remix.debugHelp()': 'Display help message for debugging'},
{'remix.execute(filepath)': 'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.'},
{'remix.exeCurrent()': 'Run the script currently displayed in the editor.'},
- {'remix.getFile(path)': 'Returns the content of the file located at the given path'},
{'remix.help()': 'Display this help message.'},
{'remix.loadgist(id)': 'Load a gist in the file explorer.'},
{'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.'},
- {'remix.setFile(path, content)': 'set the content of the file located at the given path'},
- {'remix.setproviderurl(url)': 'Change the current provider to Web3 provider and set the url endpoint.'},
{'swarmgw.get(url, cb)': 'Download files from Swarm via https://swarm-gateways.net/'},
{'swarmgw.put(content, cb)': 'Upload files to Swarm via https://swarm-gateways.net/'},
@@ -30,8 +25,7 @@ const allCommands = [
{'ethers.utils.RLP': 'This encoding method is used internally for several aspects of Ethereum, such as encoding transactions and determining contract addresses.'},
{'ethers.Wallet': 'A wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.'},
{'ethers.version': 'Contains the version of the ethers container object.'},
-
- {'web3.bzz': 'Bzz module for interacting with the swarm network.'},
+
{'web3.eth': 'Eth module for interacting with the Ethereum network.'},
{'web3.eth.accounts': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.'},
{'web3.eth.abi': 'The web3.eth.abi functions let you de- and encode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).'},
@@ -50,6 +44,11 @@ const allCommands = [
{'web3.eth.clearSubscriptions();': 'Resets subscriptions.'},
{'web3.eth.Contract(jsonInterface[, address][, options])': 'The web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain.'},
{'web3.eth.accounts.create([entropy]);': 'The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.'}
+ {'web3.eth.getAccounts();': 'Retrieve the list of accounts'},
+ {'web3.eth.accounts.privateKeyToAccount(privateKey [, ignoreLength ]);': 'Get the account from the private key'},
+ {'web3.eth.accounts.signTransaction(tx, privateKey [, callback]);': 'Sign Transaction'},
+ {'web3.eth.accounts.recoverTransaction(rawTransaction);': 'Sign Transaction'},
+ {'web3.eth.accounts.hashMessage(message);': 'Hash message'},
]
module.exports = {