extract address from transaction result in transactionExecuted event

pull/1/head
Iuri Matias 5 years ago
parent 15e356c444
commit d27f2e6c2c
  1. 3
      src/app/tabs/runTab/model/recorder.js
  2. 4
      src/blockchain/blockchain.js

@ -67,11 +67,10 @@ class Recorder {
} }
}) })
this.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp) => { this.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp, _payload, rawAddress) => {
if (error) return console.log(error) if (error) return console.log(error)
if (call) return if (call) return
const rawAddress = this.blockchain.getAddressFromTransactionResult(txResult)
if (!rawAddress) return // not a contract creation if (!rawAddress) return // not a contract creation
const stringAddress = this.addressToString(rawAddress) const stringAddress = this.addressToString(rawAddress)
const address = ethutil.toChecksumAddress(stringAddress) const address = ethutil.toChecksumAddress(stringAddress)

@ -426,8 +426,10 @@ class Blockchain {
self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad]) self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad])
self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb,
function (error, result) { function (error, result) {
const rawAddress = self.getAddressFromTransactionResult(result)
let eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') let eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted')
self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad, rawAddress])
if (error && (typeof (error) !== 'string')) { if (error && (typeof (error) !== 'string')) {
if (error.message) error = error.message if (error.message) error = error.message

Loading…
Cancel
Save