-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscribe only to event signature #99
Comments
I tried by removing "address=contract_address" but it crashes even though address argument is optional in poll_logs. Fragment from PollingRunner: async for event in async_wrap_iter(
self.provider.poll_logs(
# NOTE: No start block because we should begin polling from head
address=contract_address,
new_block_timeout=new_block_timeout,
events=[event_abi],
)
):
await self._checkpoint(last_block_seen=event.block_number)
await self._handle_task(await event_log_task_kicker.kiq(event))
await self._checkpoint(last_block_processed=event.block_number) |
Hmm, would this look like the UX you are after? from ape import project
# Set up this dependendency in `ape-config.yaml`
UniswapV2Pair = project.dependencies["uniswap-v2"]["1.0.1"].UniswapV2Pair
@app.on_(UniswapV2Pair.Swap)
async def all_univ2_clone_swaps(log):
... Edit: this might be lower lift: from ethpm_types import EventABI
Swap: EventABI # ... = EventABI.parse_file("./uni-v2-swap.json")
@app.on_(Swap)
async def all_univ2_clone_swaps(log):
... |
Yes, that's the idea. I find both proposals valid. |
Option 1 would need all event definitions exposed in Option 2 is something we can try and ship sooner in |
I believe these are already available: In [1]: type(project.VyperContract)
Out[1]: ape.contracts.base.ContractContainer
In [3]: project.VyperContract.NumberChange
Out[3]: NumberChange(bytes32 b, uint256 prevNum, string dynData, uint256 indexed newNum, string indexed
dynIndexed)
In [4]: type(project.VyperContract.NumberChange)
Out[4]: ape.contracts.base.ContractEvent You can do |
Okay perfect, that means the non-silverback code is ready for a feature addition here |
Overview
I would like to subscribe to events independently of the contract address.
Specification
This is what is supported today to listen only to USDC_WETH swaps.
This is what I would like to do to listen to any swap:
The text was updated successfully, but these errors were encountered: