abi function type
This commit is contained in:
15
lib/abi.js
15
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
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user