Skip to content

feat(ensapi): Registrar Actions with referrals#1302

Merged
tk-o merged 3 commits intomainfrom
feat/ensapi-registrar-actions-with-referral
Nov 24, 2025
Merged

feat(ensapi): Registrar Actions with referrals#1302
tk-o merged 3 commits intomainfrom
feat/ensapi-registrar-actions-with-referral

Conversation

@tk-o
Copy link
Copy Markdown
Contributor

@tk-o tk-o commented Nov 24, 2025

This PR includes withReferral query param in the Registrar Actions API route which allows to filter out all "logical registrar actions" records that have encodedReferrer set to null or zeroEncodedReferrer.

Suggested review order:

  • packages/ensnode-sdk/src/api/types.ts: added filterType field to distinguish among available filters and their params,
  • packages/ensnode-sdk/src/api/registrar-actions/filters.ts: defined helpers allowing to create a filter object for any available filter,
  • apps/ensapi/src/handlers/registrar-actions-api.ts: defined array of filters with conditional logic adding filters to the request object,
  • apps/ensapi/src/lib/registrar-actions/find-registrar-actions.ts: updated buildWhereClause function to be able to build Drizzle SQL objects describing selected filters,
  • packages/ensnode-sdk/src/client.ts: updated registrarActions method so it can map the selected filters into Registrar Actions request object.

Example use case:

// via vanilla ENSNodeClient
const registrarActionsResponse = client.registrarActions({
  order: RegistrarActionsOrders.LatestRegistrarActions,
  itemsPerPage,
  filters: [
    registrarActionsFilter.withReferral(true),
    registrarActionsFilter.byParentNode(namehash("eth")),
  ],
});

// via React hook
const registrarActionsQuery = useRegistrarActions({
  order: RegistrarActionsOrders.LatestRegistrarActions,
  itemsPerPage,
  filters: [
    registrarActionsFilter.withReferral(true),
    registrarActionsFilter.byParentNode(namehash("eth")),
  ],
  query: {
    enabled: isRegistrarActionsApiSupported,
  },
});

Includes `withReferral` query param in the Registrar Actions API route which allows to filter out all "logical registrar actions" records that have `encodedReferrer` set to `null` or `zeroEncodedReferrer`.
@tk-o tk-o requested a review from a team as a code owner November 24, 2025 16:13
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: f5778fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@ensnode/ensnode-sdk Minor
ensapi Minor
ensadmin Minor
ensindexer Minor
ensrainbow Minor
@ensnode/ensnode-react Minor
@ensnode/ensrainbow-sdk Minor
@ensnode/datasources Minor
@ensnode/ponder-metadata Minor
@ensnode/ensnode-schema Minor
@ensnode/ponder-subgraph Minor
@ensnode/shared-configs Minor
@docs/ensnode Minor
@docs/ensrainbow Minor

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

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
admin.ensnode.io Ready Ready Preview Comment Nov 24, 2025 8:14pm
ensnode.io Ready Ready Preview Comment Nov 24, 2025 8:14pm
ensrainbow.io Ready Ready Preview Comment Nov 24, 2025 8:14pm

Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tk-o Looks great! Nice work. Shared very small feedback. Please take the lead to merge and deploy a new RC (just of ENSApi maybe?) 👍

EqualsTo: "eq",
export const RegistrarActionsFilterTypes = {
BySubregistryNode: "bySubregistryNode",
WithReferralIncluded: "withReferralIncluded",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WithReferralIncluded: "withReferralIncluded",
WithEncodedReferral: "withEncodedReferral",

value: Node;
};

export type RegistrarActionsFilterWithReferralIncluded = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type RegistrarActionsFilterWithReferralIncluded = {
export type RegistrarActionsFilterWithEncodedReferral = {

Rename types
@tk-o tk-o merged commit 6659c57 into main Nov 24, 2025
10 checks passed
@tk-o tk-o deleted the feat/ensapi-registrar-actions-with-referral branch November 24, 2025 20:19
@github-actions github-actions bot mentioned this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants