parsing events output
This commit is contained in:
26
lib/event.js
26
lib/event.js
@ -90,14 +90,18 @@ var getArgumentsObject = function (inputs, indexed, notIndexed) {
|
||||
}, {});
|
||||
};
|
||||
|
||||
|
||||
var outputParser = function (event) {
|
||||
|
||||
return function (output) {
|
||||
var result = {
|
||||
event: utils.extractDisplayName(event.name),
|
||||
number: output.number
|
||||
number: output.number,
|
||||
args: {}
|
||||
};
|
||||
|
||||
if (!output.topic) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var indexedOutputs = filterInputs(event.inputs, true);
|
||||
var indexedData = "0x" + output.topic.slice(1, output.topic.length).map(function (topic) { return topic.slice(2); }).join("");
|
||||
@ -112,8 +116,20 @@ var outputParser = function (event) {
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputParser: inputParser,
|
||||
outputParser: outputParser
|
||||
var getMatchingEvent = function (events, payload) {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var signature = abi.eventSignatureFromAscii(events[i].name);
|
||||
if (signature === payload.topic[0]) {
|
||||
return events[i];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
inputParser: inputParser,
|
||||
outputParser: outputParser,
|
||||
getMatchingEvent: getMatchingEvent
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user