From 64f39d9529e9d60bbe57347f4ca16b7d017b17d4 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 2 Feb 2018 12:21:25 -0500 Subject: [PATCH 1/3] use js owns JSON.parse instead of using jquery --- src/app/execution/txFormat.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/execution/txFormat.js b/src/app/execution/txFormat.js index d69446380a..f529167963 100644 --- a/src/app/execution/txFormat.js +++ b/src/app/execution/txFormat.js @@ -1,5 +1,4 @@ 'use strict' -var $ = require('jquery') var ethJSABI = require('ethereumjs-abi') var ethJSUtil = require('ethereumjs-util') var BN = ethJSUtil.BN @@ -55,7 +54,7 @@ module.exports = { data = Buffer.from(dataHex, 'hex') } else { try { - funArgs = $.parseJSON('[' + params + ']') + funArgs = JSON.parse('[' + params + ']') } catch (e) { callback('Error encoding arguments: ' + e) return From c15e48d102eb38c808f220382ae95cde8f5d230e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 2 Feb 2018 12:24:29 -0500 Subject: [PATCH 2/3] use forEach instead of jquery each --- src/app/execution/txHelper.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/execution/txHelper.js b/src/app/execution/txHelper.js index 81275a835c..b00f565537 100644 --- a/src/app/execution/txHelper.js +++ b/src/app/execution/txHelper.js @@ -1,6 +1,5 @@ 'use strict' var ethJSABI = require('ethereumjs-abi') -var $ = require('jquery') module.exports = { encodeParams: function (funABI, args) { @@ -117,7 +116,7 @@ module.exports = { inputParametersDeclarationToString: function (abiinputs) { var inputs = '' if (abiinputs) { - $.each(abiinputs, function (i, inp) { + abiinputs.forEach(function (i, inp) { if (inputs !== '') { inputs += ', ' } From 9ed744a7a444df7b3595266254bd8eec6213bf81 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 2 Feb 2018 12:41:58 -0500 Subject: [PATCH 3/3] simplify inputParametersDeclarationToString code by using array.map --- src/app/execution/txHelper.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/app/execution/txHelper.js b/src/app/execution/txHelper.js index b00f565537..f11a9247e9 100644 --- a/src/app/execution/txHelper.js +++ b/src/app/execution/txHelper.js @@ -114,15 +114,8 @@ module.exports = { }, inputParametersDeclarationToString: function (abiinputs) { - var inputs = '' - if (abiinputs) { - abiinputs.forEach(function (i, inp) { - if (inputs !== '') { - inputs += ', ' - } - inputs += inp.type + ' ' + inp.name - }) - } - return inputs + var inputs = (abiinputs || []).map((inp) => inp.type + ' ' + inp.name) + return inputs.join(', ') } + }