aboutsummaryrefslogtreecommitdiffstats
path: root/lib/abi.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-28 21:20:36 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-01-28 21:20:36 +0800
commitea7c2fc673db31f96583e4712aa0fb78f5d709eb (patch)
tree120cf378eec0bc7549fe8128d62766964cb0cf6b /lib/abi.js
parent63d9c070ef7637a3d570a5a45ea931c1680ebc02 (diff)
downloaddexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar.gz
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar.bz2
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar.lz
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar.xz
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.tar.zst
dexon-ea7c2fc673db31f96583e4712aa0fb78f5d709eb.zip
abi function type
Diffstat (limited to 'lib/abi.js')
-rw-r--r--lib/abi.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/abi.js b/lib/abi.js
index ba47dca73..a0752647f 100644
--- a/lib/abi.js
+++ b/lib/abi.js
@@ -65,6 +65,14 @@ var getMethodWithName = function (json, methodName) {
return json[index];
};
+/// Filters all function from input abi
+/// @returns abi array with filtered objects of type 'function'
+var filterFunctions = function (json) {
+ return json.filter(function (current) {
+ return current.type === 'function';
+ });
+};
+
/// @param string string to be padded
/// @param number of characters that result string should have
/// @param sign, by default 0
@@ -351,7 +359,7 @@ var methodTypeName = function (method) {
/// @returns input parser object for given json abi
var inputParser = function (json) {
var parser = {};
- json.forEach(function (method) {
+ filterFunctions(json).forEach(function (method) {
var displayName = methodDisplayName(method.name);
var typeName = methodTypeName(method.name);
@@ -374,7 +382,7 @@ var inputParser = function (json) {
/// @returns output parser for given json abi
var outputParser = function (json) {
var parser = {};
- json.forEach(function (method) {
+ filterFunctions(json).forEach(function (method) {
var displayName = methodDisplayName(method.name);
var typeName = methodTypeName(method.name);
@@ -405,6 +413,7 @@ module.exports = {
methodSignature: methodSignature,
methodDisplayName: methodDisplayName,
methodTypeName: methodTypeName,
- getMethodWithName: getMethodWithName
+ getMethodWithName: getMethodWithName,
+ filterFunctions: filterFunctions
};