diff --git a/src/recorder.js b/src/recorder.js index 12a521f145..1f863568cb 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -212,6 +212,26 @@ class Recorder { cb('cannot resolve abi') return } + if (tx.record.parameters) { + /* check if we have some params to resolve */ + try { + tx.record.parameters.forEach((value, index) => { + var isString = true + if (typeof value !== 'string') { + isString = false + value = JSON.stringify(value) + } + for (var timestamp in self.data._createdContractsReverse) { + value = value.replace(new RegExp('created\\{' + timestamp + '\\}', 'g'), self.data._createdContractsReverse[timestamp]) + } + if (!isString) value = JSON.parse(value) + tx.record.parameters[index] = value + }) + } catch (e) { + modal.alert('cannot resolve input parameters ' + JSON.stringify(tx.record.parameters) + '. Execution stopped at ' + index) + return + } + } var data = format.encodeData(fnABI, tx.record.parameters, tx.record.bytecode) if (data.error) { modal.alert(data.error + '. Record:' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index) diff --git a/test-browser/tests/units/testRecorder.js b/test-browser/tests/units/testRecorder.js index d83675bfcc..dc1ab43aa0 100644 --- a/test-browser/tests/units/testRecorder.js +++ b/test-browser/tests/units/testRecorder.js @@ -16,7 +16,7 @@ module.exports = { .clickFunction('getFromLib - call') .waitForElementPresent('div[class^="contractProperty"] div[class^="value"]') .perform((client, done) => { - contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0xca35b7d915458ef540ade6068dfe2f44e8fa733c'], () => { + contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35ef07393b57464e93deb59175ff72e6499450cf'], () => { done() }) }) @@ -115,7 +115,7 @@ var records = `{ "value": "1000000000000000000", "parameters": [ 1, - "0xca35b7d915458ef540ade6068dfe2f44e8fa733c" + "created{1512830015080}" ], "to": "created{1512830015080}", "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",