-
Notifications
You must be signed in to change notification settings - Fork 114
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
Contract source filter #1373
Contract source filter #1373
Conversation
* chore: add logs * chore: changeset --------- Co-authored-by: typedarray <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* chore: improve pg error handling for tests * chore: changeset * chore: use error prop --------- Co-authored-by: typedarray <[email protected]>
* typo: merge abis url * Update contracts-and-networks.mdx --------- Co-authored-by: Kevin <[email protected]>
* fix: raw sql sets fast path flag to false * test --------- Co-authored-by: typedarray <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
feat: future endBlock
chore: version packages
source.filter, | ||
).reduce( | ||
(acc, cur) => { | ||
if (acc.includes(cur) === false) { |
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.
Not sure if this .includes()
works how you expect on objects
topic2: null, | ||
topic3: null, | ||
}, | ||
]; | ||
|
||
if (source.filter !== undefined) { |
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'm finding this code block a little hard to follow. I think you have it right: multiple filters in the config should result to multiple sources. Might be helpful to try to limit the use of .reduce
export type GetEventFilter< | ||
abi extends Abi, | ||
contract, | ||
/// | ||
safeEventNames extends string = SafeEventNames<abi>, | ||
> = contract extends { | ||
filter: { | ||
event: infer event extends readonly string[] | string; | ||
event: infer event extends string; |
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.
Need to add a branch for array of filters
}); | ||
}); | ||
|
||
test("event filter with event and args", () => { | ||
test("event filters with event only filter", () => { |
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.
Nice test
Relates to #1372. Added a support for more flexible contract source filters in build. Currently, I am assuming the type of the filter as defined in #1372. If we land on this design for an api, the next step would be dealing with
GetEventFilter
type in the config.