move call data logic into caller

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 6926147663
commit 374e090531
  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)
_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.storagePanel = new StoragePanel(_parentUI, _traceManager)

@ -6,28 +6,14 @@ function CalldataPanel (_parentUI, _traceManager) {
this._parentUI = _parentUI
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Call Data', {json: true})
this.init()
}
CalldataPanel.prototype.render = function () {
return yo`<div id='calldatapanel' >${this.basicPanel.render()}</div>`
CalldataPanel.prototype.update = function (calldata) {
this.basicPanel.update(calldata)
}
CalldataPanel.prototype.init = function () {
var self = this
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)
}
})
})
CalldataPanel.prototype.render = function () {
return yo`<div id='calldatapanel' >${this.basicPanel.render()}</div>`
}
module.exports = CalldataPanel

Loading…
Cancel
Save