|
|
@ -20,13 +20,14 @@ function TraceManager (_web3) { |
|
|
|
TraceManager.prototype.resolveTrace = function (tx, callback) { |
|
|
|
TraceManager.prototype.resolveTrace = function (tx, callback) { |
|
|
|
this.tx = tx |
|
|
|
this.tx = tx |
|
|
|
this.init() |
|
|
|
this.init() |
|
|
|
if (!this.web3) callback(false) |
|
|
|
if (!this.web3) callback('web3 not loaded', false) |
|
|
|
this.isLoading = true |
|
|
|
this.isLoading = true |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
this.traceRetriever.getTrace(tx.hash, function (error, result) { |
|
|
|
this.traceRetriever.getTrace(tx.hash, function (error, result) { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
console.log(error) |
|
|
|
console.log(error) |
|
|
|
self.isLoading = false |
|
|
|
self.isLoading = false |
|
|
|
|
|
|
|
callback(error, false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (result.structLogs.length > 0) { |
|
|
|
if (result.structLogs.length > 0) { |
|
|
|
self.trace = result.structLogs |
|
|
|
self.trace = result.structLogs |
|
|
@ -34,15 +35,17 @@ TraceManager.prototype.resolveTrace = function (tx, callback) { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
self.isLoading = false |
|
|
|
self.isLoading = false |
|
|
|
console.log(error) |
|
|
|
console.log(error) |
|
|
|
callback(false) |
|
|
|
callback(error, false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self.isLoading = false |
|
|
|
self.isLoading = false |
|
|
|
callback(true) |
|
|
|
callback(null, true) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(tx.hash + ' is not a contract invokation or contract creation.') |
|
|
|
var mes = tx.hash + ' is not a contract invokation or contract creation.' |
|
|
|
|
|
|
|
console.log(mes) |
|
|
|
self.isLoading = false |
|
|
|
self.isLoading = false |
|
|
|
|
|
|
|
callback(mes, false) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -77,6 +80,12 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback) { |
|
|
|
} |
|
|
|
} |
|
|
|
var stoChange = traceHelper.findLowerBound(stepIndex, this.traceCache.storageChanges) |
|
|
|
var stoChange = traceHelper.findLowerBound(stepIndex, this.traceCache.storageChanges) |
|
|
|
if (stoChange === undefined) return callback('no storage found', null) |
|
|
|
if (stoChange === undefined) return callback('no storage found', null) |
|
|
|
|
|
|
|
var address = this.traceCache.sstore[stoChange].address |
|
|
|
|
|
|
|
var storage = {} |
|
|
|
|
|
|
|
storage = this.traceCache.rebuildStorage(address, storage, stepIndex) |
|
|
|
|
|
|
|
callback(null, storage) |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
// TODO: use it if we need the full storage to be loaded
|
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
if (this.traceRetriever.debugStorageAtAvailable()) { |
|
|
|
if (this.traceRetriever.debugStorageAtAvailable()) { |
|
|
|
var address = this.traceCache.sstore[stoChange].address |
|
|
|
var address = this.traceCache.sstore[stoChange].address |
|
|
@ -92,6 +101,7 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
callback(null, this.trace[stoChange].storage) |
|
|
|
callback(null, this.trace[stoChange].storage) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) { |
|
|
|
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) { |
|
|
|