move single function from util file into udapp

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 3eaa2583d8
commit 5663cb3655
  1. 23
      src/app/ui/util.js
  2. 21
      src/universal-dapp.js

@ -1,23 +0,0 @@
var TreeView = require('./TreeView')
var ethJSUtil = require('ethereumjs-util')
var BN = ethJSUtil.BN
var remixLib = require('remix-lib')
var txFormat = remixLib.execution.txFormat
module.exports = {
decodeResponseToTreeView: function (response, fnabi) {
var treeView = new TreeView({
extractData: (item, parent, key) => {
var ret = {}
if (BN.isBN(item)) {
ret.self = item.toString(10)
ret.children = []
} else {
ret = treeView.extractDataDefault(item, parent, key)
}
return ret
}
})
return treeView.render(txFormat.decodeResponse(response, fnabi))
}
}

@ -14,13 +14,30 @@ var txFormat = remixLib.execution.txFormat
var txHelper = remixLib.execution.txHelper
var executionContext = require('./execution-context')
var modalCustom = require('./app/ui/modal-dialog-custom')
var uiUtil = require('./app/ui/util')
var globalRegistry = require('./global/registry')
var modalDialog = require('./app/ui/modaldialog')
var typeConversion = remixLib.execution.typeConversion
var confirmDialog = require('./app/execution/confirmDialog')
var TreeView = require('./app/ui/TreeView')
function decodeResponseToTreeView (response, fnabi) {
var treeView = new TreeView({
extractData: (item, parent, key) => {
var ret = {}
if (BN.isBN(item)) {
ret.self = item.toString(10)
ret.children = []
} else {
ret = treeView.extractDataDefault(item, parent, key)
}
return ret
}
})
return treeView.render(txFormat.decodeResponse(response, fnabi))
}
function UniversalDApp () {
this.event = new EventManager()
var self = this
@ -219,7 +236,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
}
}
if (lookupOnly) {
var decoded = uiUtil.decodeResponseToTreeView(executionContext.isVM() ? txResult.result.vm.return : ethJSUtil.toBuffer(txResult.result), args.funABI)
var decoded = decodeResponseToTreeView(executionContext.isVM() ? txResult.result.vm.return : ethJSUtil.toBuffer(txResult.result), args.funABI)
outputCb(decoded)
}
} else {

Loading…
Cancel
Save