diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index dbdda17f90..ddc50177c1 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.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 } diff --git a/src/recorder.js b/src/recorder.js index 13bc87d5d9..07e4a24dc4 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -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] = ``) - if (to === null) self.data._pendingCreation[timestamp] = record - else record.to = self._addressCache[to] || (self._addressCache[to] = ``) + if (to) record.to = self._addressCache[to] || (self._addressCache[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] = ``) + self._api.getAccounts(function (err, accounts = []) { + if (err) console.error(err) + if (to) record.to = self._addressCache[to] || (self._addressCache[to] = ``) + }) }) } append (timestamp, record) { diff --git a/src/universal-dapp.js b/src/universal-dapp.js index a00dfd1dc8..eb6a9a1860 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -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) })