remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/libs/remix-debug/test.ts

110 lines
2.9 KiB

9 months ago
// TODO: this file should be removed at some point
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const CmdLine = require('./src/cmdline/index')
// var compilation = require('./compilation.json')
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const solc = require('solc')
const fs = require('fs')
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const filename = 'test/sol/simple_storage.sol'
const shortFilename = 'simple_storage.sol'
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const inputJson = {
language: 'Solidity',
sources: {},
settings: {
optimizer: {
enabled: true,
runs: 200
},
outputSelection: {
'*': {
'': ['ast'],
'*': ['abi', 'metadata', 'devdoc', 'userdoc', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates']
}
}
}
}
inputJson.sources[shortFilename] = {
content: fs.readFileSync(filename).toString()
}
console.dir(inputJson)
console.log('compiling...')
const compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(inputJson)))
console.dir(Object.keys(compilationData))
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const compilation = {}
4 years ago
compilation['data'] = compilationData
compilation['source'] = { sources: inputJson.sources }
console.dir(compilation)
4 years ago
console.dir(compilation['data'].errors)
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const cmdLine = new CmdLine()
cmdLine.connect('http', 'http://localhost:8545')
cmdLine.loadCompilationResult(compilation)
cmdLine.initDebugger()
// var deployContract = function (cb) {
// let _web3 = cmdLine.debugger.debugger.web3
//
// let blockNumber = null
// let txNumber = null
// let tx = null
//
// let code = compilation.data.contracts[shortFilename].SimpleStorage.evm.bytecode.object
// console.dir('deploying...')
// console.dir(code)
// _web3.eth.sendTransaction({data: '0x' + code, from: _web3.eth.accounts[0], gas: 800000}, cb)
// }
// let _web3 = cmdLine.debugger.debugger.web3
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const tx = '0xf510c4f0b1d9ee262d7b9e9e87b4262f275fe029c2c733feef7dfa1e2b1e32aa'
6 years ago
// deployContract((err, tx) => {
cmdLine.startDebug(tx, shortFilename)
6 years ago
cmdLine.events.on('source', () => {
cmdLine.getSource().forEach(console.dir)
6 years ago
})
// })
// })
const repl = require('repl')
repl.start({
prompt: '> ',
eval: (cmd, context, filename, cb) => {
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const command = cmd.trim()
if (command === 'next' || command === 'n') {
cmdLine.stepOverForward(true)
}
if (command === 'previous' || command === 'p' || command === 'prev') {
cmdLine.stepOverBack(true)
}
if (command === 'step' || command === 's') {
cmdLine.stepIntoForward(true)
}
if (command === 'stepback' || command === 'sb') {
cmdLine.stepIntoBack(true)
}
if (command === 'exit' || command === 'quit') {
process.exit(0)
}
if (command === 'var local' || command === 'v l' || command === 'vl') {
cmdLine.displayLocals()
}
if (command === 'var global' || command === 'v g' || command === 'vg') {
cmdLine.displayGlobals()
}
if (command.split(' ')[0] === 'jump') {
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const stepIndex = parseInt(command.split(' ')[1], 10)
cmdLine.jumpTo(stepIndex)
}
cb(null, '')
}
})
module.exports = cmdLine