Commit f8f965ec authored by Iuri Matias's avatar Iuri Matias

fix resolveTrace method

parent d3207060
...@@ -18,31 +18,29 @@ function TraceManager (options) { ...@@ -18,31 +18,29 @@ function TraceManager (options) {
// init section // init section
TraceManager.prototype.resolveTrace = async function (tx) { TraceManager.prototype.resolveTrace = async function (tx) {
return new Promise(async (resolve, reject) => { this.tx = tx
this.tx = tx this.init()
this.init() if (!this.web3) throw new Error('web3 not loaded')
if (!this.web3) reject('web3 not loaded') this.isLoading = true
this.isLoading = true try {
try { const result = await this.getTrace(tx.hash)
const result = await this.getTrace(tx.hash)
if (result.structLogs.length > 0) {
if (result.structLogs.length > 0) { this.trace = result.structLogs
this.trace = result.structLogs
this.traceAnalyser.analyse(result.structLogs, tx)
this.traceAnalyser.analyse(result.structLogs, tx)
this.isLoading = false
return resolve(true)
}
var mes = tx.hash + ' is not a contract invocation or contract creation.'
console.log(mes)
this.isLoading = false
reject(mes)
} catch (error) {
console.log(error)
this.isLoading = false this.isLoading = false
reject(error) return true
} }
}) var mes = tx.hash + ' is not a contract invocation or contract creation.'
console.log(mes)
this.isLoading = false
throw new Error(mes)
} catch (error) {
console.log(error)
this.isLoading = false
throw new Error(error)
}
} }
TraceManager.prototype.getTrace = function (txHash) { TraceManager.prototype.getTrace = function (txHash) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment