resolve input parameter that might contain created{adress} like token

pull/1/head
yann300 7 years ago
parent 968f2bbaa0
commit bd6e4adccf
  1. 20
      src/recorder.js

@ -212,6 +212,26 @@ class Recorder {
cb('cannot resolve abi') cb('cannot resolve abi')
return 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) var data = format.encodeData(fnABI, tx.record.parameters, tx.record.bytecode)
if (data.error) { if (data.error) {
modal.alert(data.error + '. Record:' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index) modal.alert(data.error + '. Record:' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index)

Loading…
Cancel
Save