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

@ -476,7 +476,7 @@ UniversalDApp.prototype.rerunTx = function (args, cb) {
UniversalDApp.prototype.runTx = function (args, cb) {
var self = this
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 env = { self, args, tx, payLoad }
execute(pipeline, env, cb)

Loading…
Cancel
Save