move call data logic into caller

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent c639f31f8b
commit f9bfd8bf85
  1. 13
      src/app/debugger/debuggerUI/VmDebugger.js
  2. 22
      src/app/debugger/debuggerUI/vmDebugger/CalldataPanel.js

@ -39,6 +39,19 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
}) })
this.calldataPanel = new CalldataPanel(_parentUI, _traceManager) this.calldataPanel = new CalldataPanel(_parentUI, _traceManager)
_parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (_parentUI.currentStepIndex !== index) return
_traceManager.getCallDataAt(index, function (error, calldata) {
if (error) {
console.log(error)
self.calldataPanel.update({})
} else if (_parentUI.currentStepIndex === index) {
self.calldataPanel.update(calldata)
}
})
})
this.stackPanel = new StackPanel(_parentUI, _traceManager) this.stackPanel = new StackPanel(_parentUI, _traceManager)
this.storagePanel = new StoragePanel(_parentUI, _traceManager) this.storagePanel = new StoragePanel(_parentUI, _traceManager)

@ -6,28 +6,14 @@ function CalldataPanel (_parentUI, _traceManager) {
this._parentUI = _parentUI this._parentUI = _parentUI
this.traceManager = _traceManager this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Call Data', {json: true}) this.basicPanel = new DropdownPanel('Call Data', {json: true})
this.init()
} }
CalldataPanel.prototype.render = function () { CalldataPanel.prototype.update = function (calldata) {
return yo`<div id='calldatapanel' >${this.basicPanel.render()}</div>` this.basicPanel.update(calldata)
} }
CalldataPanel.prototype.init = function () { CalldataPanel.prototype.render = function () {
var self = this return yo`<div id='calldatapanel' >${this.basicPanel.render()}</div>`
this._parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self._parentUI.currentStepIndex !== index) return
self.traceManager.getCallDataAt(index, function (error, calldata) {
if (error) {
self.basicPanel.update({})
console.log(error)
} else if (self._parentUI.currentStepIndex === index) {
self.basicPanel.update(calldata)
}
})
})
} }
module.exports = CalldataPanel module.exports = CalldataPanel

Loading…
Cancel
Save