Closed debris closed 9 years ago
The Solidity implementation uses sha3("Incremented(bool,uint256)") as event signature. Might that be a misalignment? Also I see that "signatureFromAscii" removes the two first characters while "eventSignatureFromAscii" does not.
Works fine in AZ.
Please try following code:
<html>
<head>
<script>
var Contract = web3.eth.contractFromAbi([{"constant":true,"inputs":[],"name":"x","outputs":[{"name":"x","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[],"name":"inc","outputs":[],"type":"function"},{"inputs":[{"indexed":true,"name":"odd","type":"bool"},{"indexed":false,"name":"x","type":"uint256"}],"name":"Incremented","type":"event"}]);
var contract = Contract("0x8a62a76a62d4da0cc242134e896f1086962bbe23");
</script>
</head>
<body>
<div>
<button type="button" onClick="contract.inc()">inc!</button>
</div>
<div id="x"></div>
<script>
contract.Incremented({odd: true}).changed(function (res) {
console.log(JSON.stringify(res));
document.getElementById('x').innerHTML = contract.x();
});
</script>
</body>
</html>
and
contract Contract {
event Incremented(bool indexed odd, uint x);
function Contract() {
x = 69;
}
function inc() {
++x;
Incremented(x % 2 == 0, x);
}
uint x;
}
but replace the HTML's 0x8a62...be23
with the address of the created contract.
@debris please check this is working and if so, close.
Works for me in AZ. @debris please check CLI and close if good.
i'm having an issue with events. When I run following contract inside mix IDE everything is working, but when I run this example with ethereum headless client (
eth -j -b
), I do get only 1 callback in update function (just after starting watch).code snippets: