FIX recorder bugs

pull/1/head
serapath 7 years ago committed by yann300
parent 042199393e
commit ea2988ac7b
  1. 28
      src/app/tabs/run-tab.js
  2. 9
      src/recorder.js
  3. 4
      src/universal-dapp.js

@ -296,16 +296,26 @@ function makeRecorder (appAPI, appEvents) {
}
}, function cancel () { })
}
function CALLBACK (...args) {
console.log(args)
/*
at each callback call, if the transaction succeed and if this is a creation transaction,
we should call
function CALLBACK (err, result) {
if (err) console.error(err)
else {
console.log(result)
// {
// "result": {
// "gasUsed": "5318",
// "vm": { "exception": 1, "selfdestruct": {} },
// "bloom": { "bitvector": { "type": "Buffer", "data": [0, /* ... */ 0, 0] } },
// "amountSpent": "5318"
// },
// "transactionHash": "0x84f68f96944a47b27af4b4ed1986637aa1bc05fd7a6f5cb1d6a53f68058276d8"
// }
/*
at each callback call, if the transaction succeed and if this is a creation transaction, we should call
runtab.addInstance( ... ) // which basically do:
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value))
*/
runtab.addInstance( ... ) // which basically does:
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value))
*/
}
}
return el
}

@ -24,8 +24,8 @@ class Recorder {
self._api.getAccounts(function (err, accounts = []) {
if (err) console.error(err)
record.from = self._addressCache[from] || (self._addressCache[from] = `<account - ${getIndex(accounts, from)}>`)
if (to === null) self.data._pendingCreation[timestamp] = record
else record.to = self._addressCache[to] || (self._addressCache[to] = `<account - ${getIndex(accounts, to)}>`)
if (to) record.to = self._addressCache[to] || (self._addressCache[to] = `<account - ${getIndex(accounts, to)}>`)
else self.data._pendingCreation[timestamp] = record
self.append(timestamp, record)
})
})
@ -38,7 +38,10 @@ class Recorder {
delete self.data._pendingCreation[timestamp]
if (!record) return
var to = args[2]
record.to = self._addressCache[to] || (self._addressCache[to] = `<contract -${++counter}>`)
self._api.getAccounts(function (err, accounts = []) {
if (err) console.error(err)
if (to) record.to = self._addressCache[to] || (self._addressCache[to] = `<contract - ${getIndex(accounts, to)}>`)
})
})
}
append (timestamp, record) {

@ -471,9 +471,9 @@ UniversalDApp.prototype.replayTx = function (args, cb) {
var self = this
self.getAccounts(function (err, accounts = []) {
if (err) console.error(err)
if (args.to[0] === '<') args.to = accounts[args.to.split('>')[0].slice(11)]
if (args.to && args.to[0] === '<') args.to = accounts[args.to.split('>')[0].slice(11)]
if (args.from && args.from[0] === '<') args.from = accounts[args.from.split('>')[0].slice(11)]
var pipeline = [runTransaction]
var pipeline = [queryGasLimit, runTransaction]
var env = { self, args, tx: { to: args.to, from: args.from, data: args.data, useCall: args.useCall } }
execute(pipeline, env, cb)
})

Loading…
Cancel
Save