1

Here's an example from solidity docs:

[SOLIDITY]

contract ClientReceipt {
    event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );

    function deposit(bytes32 _id) {
        Deposit(msg.sender, _id, msg.value);
    }
}

[JAVASCRIPT]

var ClientReceipt = web3.eth.contract(abi);
var clientReceipt = ClientReceipt.at(address);

var event = clientReceipt.Deposit();

event.watch(function(error, result){
    if (!error)
        console.log(result);
});

Now I'm getting a log every time somebody invokes a deposit function. It all works and I don't have any questions about that. What I can't understand is how an example from web3 api docs would work with the code above:

var event = myContractInstance.MyEvent({valueA: 23} [, additionalFilterObject])    
event.watch(function(error, result){
  if (!error)
    console.log(result);
});

My questions:

What does the property name value1 represents? Is it the name of an indexed argument? What will I get in my console if I pass {_value: 100} as the first argument? Will I get in my console an event object only when someone triggers the event with the parameter named _value and the value 100?

jrbedard
  • 524
  • 1
  • 6
  • 15
manidos
  • 4,298
  • 3
  • 31
  • 55
  • See http://ethereum.stackexchange.com/questions/4452/how-do-i-retrieve-the-voted-events-from-the-dao for some working examples of using filters with events. – BokkyPooBah Aug 09 '16 at 16:43
  • 1
    @BokkyPooBah, that's exactly it! Thank you very much!!! – manidos Aug 09 '16 at 17:07

0 Answers0