sha3 method signature
This commit is contained in:
16
lib/abi.js
16
lib/abi.js
@ -140,7 +140,6 @@ var toAbiInput = function (json, methodName, params) {
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = "0x" + padLeft(index.toString(16), 2);
|
||||
var method = json[index];
|
||||
|
||||
for (var i = 0; i < method.inputs.length; i++) {
|
||||
@ -259,7 +258,20 @@ var outputParser = function (json) {
|
||||
return parser;
|
||||
};
|
||||
|
||||
var methodSignature = function (json, name) {
|
||||
var method = json[findMethodIndex(json, name)];
|
||||
var result = name + '(';
|
||||
var inputTypes = method.inputs.map(function (inp) {
|
||||
return inp.type;
|
||||
});
|
||||
result += inputTypes.join(',');
|
||||
result += ')';
|
||||
|
||||
return web3.sha3(result);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputParser: inputParser,
|
||||
outputParser: outputParser
|
||||
outputParser: outputParser,
|
||||
methodSignature: methodSignature
|
||||
};
|
||||
|
Reference in New Issue
Block a user