-
Notifications
You must be signed in to change notification settings - Fork 16
refactor(ensindexer): improve ENSIndexerConfig #763
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
Conversation
…ions This way, we can derive config params on already validated config.
🦋 Changeset detectedLatest commit: 7c29440 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
af727c8 to
b4c181c
Compare
| const derive_isSubgraphCompatible = < | ||
| CONFIG extends Pick< | ||
| ENSIndexerConfig, | ||
| "plugins" | "healReverseAddresses" | "indexAdditionalResolverRecords" | ||
| >, | ||
| >( | ||
| config: CONFIG, | ||
| ): CONFIG & { isSubgraphCompatible: boolean } => { | ||
| // 1. only the subgraph plugin is active | ||
| const onlySubgraphPluginActivated = | ||
| config.plugins.length === 1 && config.plugins[0] === PluginName.Subgraph; | ||
|
|
||
| // 2. healReverseAddresses = false | ||
| // 3. indexAdditionalResolverRecords = false | ||
| const indexingBehaviorIsSubgraphCompatible = | ||
| !config.healReverseAddresses && !config.indexAdditionalResolverRecords; | ||
|
|
||
| return { | ||
| ...config, | ||
| isSubgraphCompatible: onlySubgraphPluginActivated && indexingBehaviorIsSubgraphCompatible, | ||
| }; | ||
| }; |
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.
Moved to apps/ensindexer/src/config/derived-params.ts
|
Replaced with #765 which also solves for typescript type inference. |
This PR includes refactorings around
ENSIndexerConfigthat allow dropping unnecessary imports and replace them with new derived configuration parameters:ensDeployment.Suggested review order:
apps/ensindexer/src/plugins: all plugins read theensDeploymentdirectly from theappConfigobject.apps/ensindexer/src/plugins/basenames/basenames.plugin.ts:ensDeploymentincludes some ABIs, which I figured will be best not to be shown due to their lengthapps/ensindexer/src/config/types.ts: includingensDeploymentconfig paramapps/ensindexer/src/config/config.schema.ts: moved all derive functionality into its own fileapps/ensindexer/src/config/derived-params.ts: derive functionality forisSubgraphCompatible(moved), andensDeployment(newly added)Resolves: