-
Notifications
You must be signed in to change notification settings - Fork 0
feat: events service private event support #5
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
base: feat/private-event-utilities
Are you sure you want to change the base?
feat: events service private event support #5
Conversation
| 'event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)', | ||
| 'event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster)', | ||
| // PrivateEvent: UserOperationEvent, AccountDeployed | ||
| 'event PrivateEvent(address[] allowedViewers, bytes32 indexed eventType, bytes payload)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pollEvents uses the regular publicClient, which doesn't have Silent Data auth headers, and private events doesn't work
|
|
||
| try { | ||
| // type cast to unwrap EventLog<UserOperationEventAbi | AccountDeployedAbi> | ||
| return unwrapPrivateEvent(abi, ev) as ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the other comment. We should use the existing parseEvent.
| import { EntryPoint__factory } from "@skandha/types/lib/contracts/EPv7/factories/core"; | ||
| import { GetContractReturnType, Hex, PublicClient, Log, parseAbi } from "viem"; | ||
|
|
||
| type UserOperationEventAbi = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't get rid of these events ABIs. When parsing a private event, the inner event follows this ABI.
| return null | ||
| } | ||
|
|
||
| const wrappedEventHashToAbi = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can live outside of the function scope.
Description
This PR integrates private event support into the EventsService, enabling it to watch and process private EntryPoint events.
Key Changes:
utils/abi-eventsinstead of local duplicateswatchContractEventsubscription forPrivateEventemissions, filtering by event type forUserOperationEventandAccountDeployedhandlePrivateEventUnwrap()method that decodes and reconstructs private events into standard event logshandleEvent()to transparently unwrap private events before processing, maintaining the same flow for both public and private eventsImplementation Details:
eventTypehashes to their corresponding ABIs (UserOperationEventAbi,AccountDeployedAbi) for proper decodingEventLog<ABI>helper typeTypes of changes
What types of changes does your code introduce?
Put an
xin the boxes that applyUserOperationEvent, andAccountDeployedFurther comments (optional)
PrivateEventwith specificeventTypefilters to only process relevant events (UserOperationEventandAccountDeployed)