mirror of https://github.com/status-im/web3.js.git
fixed event signatures
This commit is contained in:
parent
e6c0ec7278
commit
d5166918e9
|
@ -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
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue