coding standard

pull/7/head
yann300 9 years ago
parent 592cddcf85
commit 2ef943bd58
  1. 1
      .gitignore
  2. 6
      package.json
  3. 11
      src/assemblyItemsBrowser.js
  4. 1
      src/basicPanel.js
  5. 1
      src/basicStyles.js
  6. 1
      src/codeUtils.js
  7. 16
      src/debugger.js
  8. 12
      src/index.js
  9. 1
      src/opcodes.js
  10. 1
      src/slider.js
  11. 1
      src/sliderStyles.js
  12. 1
      src/sticker.js
  13. 7
      src/txBrowser.js
  14. 1
      src/vmTraceBrowser.js
  15. 1
      src/vmTraceButtonNavigator.js
  16. 3
      src/vmTraceManager.js
  17. 1
      src/web3Admin.js

1
.gitignore vendored

@ -1,2 +1,3 @@
build
node_modules
npm-debug.log

@ -39,6 +39,10 @@
},
"homepage": "https://github.com/ethereum/remix#readme",
"standard": {
"global": ["web3"]
"global": ["web3"],
"ignore": [
"node_modules/*",
"build/*"
]
}
}

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
var BasicPanel = require('./basicPanel')
var Sticker = require('./sticker')
@ -7,6 +8,10 @@ var style = require('./basicStyles')
var Slider = require('./slider')
module.exports = React.createClass({
contextTypes: {
web3: React.PropTypes.object
},
getInitialState: function () {
return {
currentSelected: -1, // current selected item in the vmTrace
@ -135,7 +140,7 @@ module.exports = React.createClass({
resolveAddress: function (address) {
if (!this.state.codes[address]) {
var hexCode = web3.eth.getCode(address)
var hexCode = this.context.web3.eth.getCode(address)
var code = codeUtils.nameOpCodes(new Buffer(hexCode.substring(2), 'hex'))
this.state.codes[address] = code[0]
this.state.instructionsIndexByBytesOffset[address] = code[1]
@ -341,7 +346,7 @@ module.exports = React.createClass({
for (var k = 0; k < mem.length; k += (width * 2)) {
var memory = mem.substr(k, width * 2)
ret.push({
address: web3.toHex(k),
address: this.context.web3.toHex(k),
content: this.tryAsciiFormat(memory)
})
}
@ -352,7 +357,7 @@ module.exports = React.createClass({
var ret = { ascii: '', raw: '' }
for (var k = 0; k < memorySlot.length; k += 2) {
var raw = memorySlot.substr(k, 2)
var ascii = web3.toAscii(raw)
var ascii = this.context.web3.toAscii(raw)
if (ascii === String.fromCharCode(0)) {
ret.ascii += '?'
} else {

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
var style = require('./basicStyles')

@ -1,3 +1,4 @@
'use strict'
module.exports = {
wrapper: {
'fontFamily': 'arial,sans-serif'

@ -1,3 +1,4 @@
'use strict'
var opcodes = require('./opcodes')
module.exports = {

@ -1,6 +1,6 @@
'use strict'
var React = require('react')
var TxBrowser = require('./txBrowser')
var VmTraceManager = require('./vmTraceManager')
var VmTraceBrowser = require('./vmTraceBrowser')
var style = require('./basicStyles')
@ -9,6 +9,14 @@ module.exports = React.createClass({
return {vmTrace: null, state: '', currentStep: -1}
},
childContextTypes: {
web3: React.PropTypes.object
},
getChildContext: function () {
return { web3: this.props.web3 }
},
render: function () {
return (
<div style={style.wrapper}>
@ -24,12 +32,12 @@ module.exports = React.createClass({
retrieveVmTrace: function (blockNumber, txNumber) {
this.setState({state: 'loading...'})
var deb = this
VmTraceManager.retrieveVmTrace(blockNumber, txNumber, function (error, result) {
var self = this
this.props.web3.debug.trace(blockNumber, parseInt(txNumber), function (error, result) {
if (error) {
console.log(error)
} else {
deb.setState({vmTrace: result, state: ''})
self.setState({vmTrace: result, state: ''})
}
})
}

@ -1,15 +1,19 @@
'use strict'
var ReactDOM = require('react-dom')
var React = require('react')
var Web3 = require('web3')
var Web3Admin = require('./web3Admin')
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
Web3Admin.extend(web3)
function loadWeb3 () {
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
Web3Admin.extend(web3)
return web3
}
var Debugger = require('./debugger')
ReactDOM.render(
<Debugger />,
<Debugger web3={loadWeb3()} />,
document.getElementById('app')
)

@ -1,3 +1,4 @@
'use strict'
const codes = {
// 0x0 range - arithmetic ops
// name, baseCost, off stack, on stack, dynamic

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
var style = require('./sliderStyles')

@ -1,3 +1,4 @@
'use strict'
module.exports = {
rule: {
'width': '600px'

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
module.exports = React.createClass({

@ -1,7 +1,12 @@
'use strict'
var React = require('react')
var style = require('./basicStyles')
module.exports = React.createClass({
contextTypes: {
web3: React.PropTypes.object
},
propTypes: {
onNewTxRequested: React.PropTypes.func.isRequired
},
@ -11,7 +16,7 @@ module.exports = React.createClass({
},
submit: function () {
var tx = web3.eth.getTransactionFromBlock(this.state.blockNumber, this.state.txNumber)
var tx = this.context.web3.eth.getTransactionFromBlock(this.state.blockNumber, this.state.txNumber)
if (tx) {
this.setState({from: tx.from, to: tx.to, hash: tx.hash})
}

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
var AssemblyItemsBrowser = require('./assemblyItemsBrowser')

@ -1,3 +1,4 @@
'use strict'
var React = require('react')
module.exports = React.createClass({

@ -1,6 +1,7 @@
'use strict'
module.exports = {
retrieveVmTrace: function (blockNumber, txNumber, callBack) {
web3.debug.trace(blockNumber, parseInt(txNumber), function (error, result) {
this.context.web3.debug.trace(blockNumber, parseInt(txNumber), function (error, result) {
callBack(error, result)
})
}

@ -1,3 +1,4 @@
'use strict'
module.exports = {
extend: function (web3) {
// ADMIN

Loading…
Cancel
Save