From 5663cb3655ef53e90ef424a9fd0f6c91874f4313 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 24 Dec 2018 11:54:27 -0500 Subject: [PATCH] move single function from util file into udapp --- src/app/ui/util.js | 23 ----------------------- src/universal-dapp.js | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 25 deletions(-) delete mode 100644 src/app/ui/util.js diff --git a/src/app/ui/util.js b/src/app/ui/util.js deleted file mode 100644 index 41f14324ec..0000000000 --- a/src/app/ui/util.js +++ /dev/null @@ -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)) - } -} diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 2f2ab1653c..fc9670fd21 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -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 {