diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-03 22:08:36 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-03 22:08:36 +0800 |
commit | 1860b3dff93e3a09cb7fba753b8531b11169f915 (patch) | |
tree | e5c495baa64c0d686d99b3d5d7c0de0b886552f1 /dist/ethereum.js | |
parent | 03faec9d41d631f9a4cc6bbe1e91e7cd1cf7b965 (diff) | |
download | go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar.gz go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar.bz2 go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar.lz go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar.xz go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.tar.zst go-tangerine-1860b3dff93e3a09cb7fba753b8531b11169f915.zip |
gulp
Diffstat (limited to 'dist/ethereum.js')
-rw-r--r-- | dist/ethereum.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/dist/ethereum.js b/dist/ethereum.js index 608a0622a..679eaabde 100644 --- a/dist/ethereum.js +++ b/dist/ethereum.js @@ -510,7 +510,7 @@ var utils = require('./utils'); /// @returns array of (not?) indexed params var filterInputs = function (inputs, indexed) { return inputs.filter(function (current) { - return inputs.indexed === indexed; + return current.indexed === indexed; }); }; @@ -556,10 +556,40 @@ var inputParser = function (address, signature, event) { }; }; +var getArgumentsObject = function (inputs, indexed, notIndexed) { + var indexedCopy = indexed.slice(); + var notIndexedCopy = notIndexed.slice(); + return inputs.reduce(function (acc, current) { + var value; + if (current.indexed) + value = indexed.splice(0, 1)[0]; + else + value = notIndexed.splice(0, 1)[0]; + + acc[current.name] = value; + return acc; + }, {}); +}; + + var outputParser = function (event) { return function (output) { - + var result = { + event: utils.extractDisplayName(event.name), + number: output.number + }; + + var indexedOutputs = filterInputs(event.inputs, true); + var indexedData = "0x" + output.topic.slice(1, output.topic.length).map(function (topic) { return topic.slice(2); }).join(""); + var indexedRes = abi.formatOutput(indexedOutputs, indexedData); + + var notIndexedOutputs = filterInputs(event.inputs, false); + var notIndexedRes = abi.formatOutput(notIndexedOutputs, output.data); + + result.args = getArgumentsObject(event.inputs, indexedRes, notIndexedRes); + + return result; }; }; |