fixed event signatures

This commit is contained in:
Marek Kotewicz 2015-01-31 19:07:59 +01:00
parent e6c0ec7278
commit d5166918e9
5 changed files with 20 additions and 10 deletions

11
dist/ethereum.js vendored
View File

@ -196,12 +196,17 @@ var signatureFromAscii = function (name) {
return web3.sha3(web3.fromAscii(name)).slice(0, 2 + c.ETH_SIGNATURE_LENGTH * 2); return web3.sha3(web3.fromAscii(name)).slice(0, 2 + c.ETH_SIGNATURE_LENGTH * 2);
}; };
var eventSignatureFromAscii = function (name) {
return web3.sha3(web3.fromAscii(name));
};
module.exports = { module.exports = {
inputParser: inputParser, inputParser: inputParser,
outputParser: outputParser, outputParser: outputParser,
formatInput: formatInput, formatInput: formatInput,
formatOutput: formatOutput, formatOutput: formatOutput,
signatureFromAscii: signatureFromAscii signatureFromAscii: signatureFromAscii,
eventSignatureFromAscii: eventSignatureFromAscii
}; };
@ -367,7 +372,7 @@ var addEventRelatedPropertiesToContract = function (contract, desc, address) {
Object.defineProperty(contract, 'topic', { Object.defineProperty(contract, 'topic', {
get: function() { get: function() {
return utils.filterEvents(desc).map(function (e) { return utils.filterEvents(desc).map(function (e) {
return abi.signatureFromAscii(e.name); return abi.eventSignatureFromAscii(e.name);
}); });
} }
}); });
@ -380,7 +385,7 @@ var addEventsToContract = function (contract, desc, address) {
var impl = function () { var impl = function () {
var params = Array.prototype.slice.call(arguments); var params = Array.prototype.slice.call(arguments);
var signature = abi.signatureFromAscii(e.name); var signature = abi.eventSignatureFromAscii(e.name);
var event = eventImpl(address, signature, e); var event = eventImpl(address, signature, e);
var o = event.apply(null, params); var o = event.apply(null, params);
return web3.eth.watch(o); return web3.eth.watch(o);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -195,11 +195,16 @@ var signatureFromAscii = function (name) {
return web3.sha3(web3.fromAscii(name)).slice(0, 2 + c.ETH_SIGNATURE_LENGTH * 2); return web3.sha3(web3.fromAscii(name)).slice(0, 2 + c.ETH_SIGNATURE_LENGTH * 2);
}; };
var eventSignatureFromAscii = function (name) {
return web3.sha3(web3.fromAscii(name));
};
module.exports = { module.exports = {
inputParser: inputParser, inputParser: inputParser,
outputParser: outputParser, outputParser: outputParser,
formatInput: formatInput, formatInput: formatInput,
formatOutput: formatOutput, formatOutput: formatOutput,
signatureFromAscii: signatureFromAscii signatureFromAscii: signatureFromAscii,
eventSignatureFromAscii: eventSignatureFromAscii
}; };

View File

@ -124,7 +124,7 @@ var addEventRelatedPropertiesToContract = function (contract, desc, address) {
Object.defineProperty(contract, 'topic', { Object.defineProperty(contract, 'topic', {
get: function() { get: function() {
return utils.filterEvents(desc).map(function (e) { return utils.filterEvents(desc).map(function (e) {
return abi.signatureFromAscii(e.name); return abi.eventSignatureFromAscii(e.name);
}); });
} }
}); });
@ -137,7 +137,7 @@ var addEventsToContract = function (contract, desc, address) {
var impl = function () { var impl = function () {
var params = Array.prototype.slice.call(arguments); var params = Array.prototype.slice.call(arguments);
var signature = abi.signatureFromAscii(e.name); var signature = abi.eventSignatureFromAscii(e.name);
var event = eventImpl(address, signature, e); var event = eventImpl(address, signature, e);
var o = event.apply(null, params); var o = event.apply(null, params);
return web3.eth.watch(o); return web3.eth.watch(o);