remove data from record and display decoed values

pull/3094/head
yann300 7 years ago
parent 2be92f5bb1
commit 4b4b06c048
  1. 12
      src/recorder.js
  2. 2
      src/universal-dapp.js

@ -2,7 +2,9 @@ var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager var EventManager = remixLib.EventManager
var ethutil = require('ethereumjs-util') var ethutil = require('ethereumjs-util')
var executionContext = require('./execution-context') var executionContext = require('./execution-context')
var format = require('./app/execution/txFormat')
var async = require('async') var async = require('async')
var modal = require('./app/ui/modal-dialog-custom')
/** /**
* Record transaction as long as the user create them. * Record transaction as long as the user create them.
@ -22,10 +24,10 @@ class Recorder {
opts.events.udapp.register('initiatingTransaction', (timestamp, tx, payLoad) => { opts.events.udapp.register('initiatingTransaction', (timestamp, tx, payLoad) => {
if (tx.useCall) return if (tx.useCall) return
var { from, to, value } = tx var { from, to, value } = tx
var record = { value, parameters: { definition: payLoad.funAbi, values: payLoad.funArgs } }
// convert to and from to tokens // convert to and from to tokens
if (this.data._listen) { if (this.data._listen) {
var record = { value, parameters: { definitions: payLoad.funAbi, values: payLoad.funArgs } }
if (!to) { if (!to) {
var selectedContract = self._api.getSelectedContract() var selectedContract = self._api.getSelectedContract()
if (selectedContract) { if (selectedContract) {
@ -33,6 +35,7 @@ class Recorder {
var sha3 = ethutil.bufferToHex(ethutil.sha3(abi)) var sha3 = ethutil.bufferToHex(ethutil.sha3(abi))
record.abi = sha3 record.abi = sha3
record.contractName = selectedContract.name record.contractName = selectedContract.name
record.bytecode = payLoad.contractBytecode
self.data._abis[sha3] = abi self.data._abis[sha3] = abi
} }
} else { } else {
@ -146,7 +149,12 @@ class Recorder {
self.setListen(false) self.setListen(false)
async.eachSeries(records, function (tx, cb) { async.eachSeries(records, function (tx, cb) {
var record = self.resolveAddress(tx.record, accounts, options) var record = self.resolveAddress(tx.record, accounts, options)
var data = format.encodeData(tx.record.parameters.definitions, tx.record.parameters.values, tx.record.bytecode)
if (data.error) {
modal.alert(data.error)
} else {
record.data = data.data
}
self._api.udapp().rerunTx(record, function (err, txResult) { self._api.udapp().rerunTx(record, function (err, txResult) {
if (err) { if (err) {
console.error(err) console.error(err)

@ -476,7 +476,7 @@ UniversalDApp.prototype.rerunTx = function (args, cb) {
UniversalDApp.prototype.runTx = function (args, cb) { UniversalDApp.prototype.runTx = function (args, cb) {
var self = this var self = this
var tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall } var tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall }
var payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs } // contains decoded parameters var payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode } // contains decoded parameters
var pipeline = [queryGasLimit, queryValue, queryAddress, runTransaction] var pipeline = [queryGasLimit, queryValue, queryAddress, runTransaction]
var env = { self, args, tx, payLoad } var env = { self, args, tx, payLoad }
execute(pipeline, env, cb) execute(pipeline, env, cb)

Loading…
Cancel
Save