Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

JS API web3.eth.filter documentation is inadequate. #15

Closed
Smithgift opened this issue Apr 18, 2015 · 2 comments
Closed

JS API web3.eth.filter documentation is inadequate. #15

Smithgift opened this issue Apr 18, 2015 · 2 comments
Labels

Comments

@Smithgift
Copy link

I've read it several times now, and I still have no idea how to use an event filter (Events are explained in another page entirely, linked elsewhere.) or the difference between it and a log filter or which account address under options is supposed to refer to (The contract? The account that sent the transaction to start it?) The lower example is unclear. I've only understood it after several readings. Actually, filterString's documentation is incomplete anyway, because it doesn't say what comes out of the callback.

@innovator256
Copy link
Contributor

In solidity::if you have an event defined like so :

event alertMe(byte32 indexed alertText)

you can activate it in a function body for when the function is called i:e

contract spender {

function spend( unit amount) returns (bool spent){

   ///blah blah blah

 //you are calling the event here which logged and will make it easy for filtering
    alertMe(byte32 indexed alertText);
    return true;

  }

}

then assuming you instantiated your contract as "spender" in your client, you can filter for events like :

web3.eth.filter({'max': 100, 'address': spender.address, 'topics': [ alertText]});

hope it helps...I know the docs are quirky!

@jamesray1
Copy link
Contributor

Please see https://github.com/ethereum/wiki/wiki#issues-and-pull-requests for why this was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants