|
|
|
@ -617,9 +617,18 @@ export class Blockchain extends Plugin { |
|
|
|
|
const timestamp = tx.timestamp |
|
|
|
|
|
|
|
|
|
this.event.trigger('initiatingTransaction', [timestamp, tx, payLoad]) |
|
|
|
|
try { |
|
|
|
|
this.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, |
|
|
|
|
async (error, result) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
if (error) { |
|
|
|
|
if (typeof (error) !== 'string') { |
|
|
|
|
if (error.message) error = error.message |
|
|
|
|
else { |
|
|
|
|
try { error = 'error: ' + JSON.stringify(error) } catch (e) { console.log(e) } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return reject(error) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const isVM = this.executionContext.isVM() |
|
|
|
|
if (isVM && tx.useCall) { |
|
|
|
@ -630,17 +639,21 @@ export class Blockchain extends Plugin { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') |
|
|
|
|
this.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) |
|
|
|
|
|
|
|
|
|
this.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) |
|
|
|
|
return resolve({ result, tx }) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} catch (err) { |
|
|
|
|
let error = err |
|
|
|
|
if (error && (typeof (error) !== 'string')) { |
|
|
|
|
if (error.message) error = error.message |
|
|
|
|
else { |
|
|
|
|
try { error = 'error: ' + JSON.stringify(error) } catch (e) { console.log(e) } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return resolve({ result, tx }) |
|
|
|
|
return reject(error) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|