|
|
|
@ -103,14 +103,8 @@ class DebuggerUI { |
|
|
|
|
return this.isActive |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startDebugging (blockNumber, txNumber, tx) { |
|
|
|
|
const self = this |
|
|
|
|
if (this.debugger) this.unLoad() |
|
|
|
|
|
|
|
|
|
let compilers = this.registry.get('compilersartefacts').api |
|
|
|
|
let lastCompilationResult |
|
|
|
|
if (compilers['__last']) lastCompilationResult = compilers['__last'] |
|
|
|
|
|
|
|
|
|
async getDebugWeb3 () { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
executionContext.detectNetwork((error, network) => { |
|
|
|
|
let web3 |
|
|
|
|
if (error || !network) { |
|
|
|
@ -120,6 +114,20 @@ class DebuggerUI { |
|
|
|
|
web3 = (!webDebugNode ? executionContext.web3() : webDebugNode) |
|
|
|
|
} |
|
|
|
|
init.extendWeb3(web3) |
|
|
|
|
resolve(web3) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async startDebugging (blockNumber, txNumber, tx) { |
|
|
|
|
const self = this |
|
|
|
|
if (this.debugger) this.unLoad() |
|
|
|
|
|
|
|
|
|
let compilers = this.registry.get('compilersartefacts').api |
|
|
|
|
let lastCompilationResult |
|
|
|
|
if (compilers['__last']) lastCompilationResult = compilers['__last'] |
|
|
|
|
|
|
|
|
|
let web3 = await this.getDebugWeb3() |
|
|
|
|
this.debugger = new Debugger({ |
|
|
|
|
web3, |
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
@ -136,6 +144,25 @@ class DebuggerUI { |
|
|
|
|
toaster(error) |
|
|
|
|
this.unLoad() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async retrieveTrace (hash) { |
|
|
|
|
return new Promise(async (resolve, reject) => { |
|
|
|
|
let compilers = this.registry.get('compilersartefacts').api |
|
|
|
|
let lastCompilationResult |
|
|
|
|
if (compilers['__last']) lastCompilationResult = compilers['__last'] |
|
|
|
|
|
|
|
|
|
let web3 = await this.getDebugWeb3() |
|
|
|
|
|
|
|
|
|
let debug = new Debugger({ |
|
|
|
|
web3, |
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
|
compiler: { lastCompilationResult } |
|
|
|
|
}) |
|
|
|
|
debug.debugger.traceManager.traceRetriever.getTrace(hash, (error, trace) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
resolve(trace) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|