From c9a70048ffa4277db50c11d269b1470b5ba3baf8 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 8 Jan 2020 18:41:02 -0500 Subject: [PATCH] refactor to make return value conversion in runTx instead of callers --- src/blockchain/blockchain.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/blockchain/blockchain.js b/src/blockchain/blockchain.js index a53456d863..5dc6e69a3b 100644 --- a/src/blockchain/blockchain.js +++ b/src/blockchain/blockchain.js @@ -251,12 +251,11 @@ class Blockchain { logCallback(`${logMsg}`) } if (funABI.type === 'fallback') data.dataHex = value - this.callFunction(address, data, funABI, confirmationCb, continueCb, promptCb, (error, txResult) => { + this.callFunction(address, data, funABI, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => { if (error) { return logCallback(`${logMsg} errored: ${error} `) } if (lookupOnly) { - const returnValue = (this.executionContext.isVM() ? txResult.result.execResult.returnValue : ethJSUtil.toBuffer(txResult.result)) outputCb(returnValue) } }) @@ -462,11 +461,13 @@ class Blockchain { } let address = null + let returnValue = null if (txResult && txResult.result) { address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress + returnValue = (txResult.result.execResult && isVM) ? txResult.result.execResult.returnValue : ethJSUtil.toBuffer(txResult.result) } - cb(error, txResult, address) + cb(error, txResult, address, returnValue) }) }