ethereum / pyethapp

MIT License
1.28k stars 604 forks source link

eth_newFilter doesnt support the full api #149

Open hackaugusto opened 8 years ago

hackaugusto commented 8 years ago

topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter

The current implementation doesnt support OR values

https://github.com/ethereum/pyethapp/blob/develop/pyethapp/jsonrpc.py#L542-L546


Example for testing the json rpc server:

contract Example {
    event Event1();
    event Event2();
    function () { throw; }
}
filter_ = {
   'fromBlock': 'latest',
   'toBlock': 'latest',
   'address': example_contract_address_hex,
   'topics': [
       [data_encoder(eventid1), data_encoder(eventid2)],
   ]
}
rpc_client = rpc_client.JSONRPCClient(privkey=privkey)
rpc_client.call('eth_newFilter', filter_)

Example for the json rpc client:

topics = [
   [eventid1, eventid2],
]
rpc_client = rpc_client.JSONRPCClient(privkey=privkey)
rpc_client.new_filter(
    fromBlock='latest',
    toBlock='latest',
    address=example_contract_address_hex,
    topics=topics
)
RomanZacharia commented 8 years ago

Resolved in https://github.com/ethereum/pyethapp/pull/160