Skip to content

Flip dependency relationship between the ens-referrals and ensnode-sdk packages #1519

@lightwalker-eth

Description

@lightwalker-eth

Background

  1. The ensnode-sdk package currently imports from the ens-referrals package in the ENSNode monorepo. This was done to accelerate shipping ENS Holiday Awards, but is now a key issue blocking next steps.
  2. The ens-referrals package in the ENSNode monorepo currently copy-pastes a number of ideas from the ensnode-sdk package. This code duplication is unfortunate but was done to accelerate shipping ENS Holiday Awards while avoiding a circular dependency between ensnode-sdk and ens-referrals.

Big picture goals

The following goals are NOT for this issue specifically. However they are the bigger goals we are working towards getting closer to enabling in this issue.

  1. The backend logic for fetching referral dashboards / referral data by the ENS Awards site should be transitioned out of ENSApi and instead into a completely new app that will be moved completely out of the ENSNode monorepo and will build on the ENSDbClient that Tomasz is advancing prerequisites for.
  2. The ens-referrals package needs to be fully transitioned out of the ENSNode monorepo.

Goals for this specific issue

  1. The ensnode-sdk package must remove its dependency on the ens-referrals package.
    1. All ideas that currently live in the ensnode-sdk package related to referrals need to move into the ens-referrals package.
    2. This will include a need for us to define an entirely new "client" in ens-referrals that replicates the overall design patterns from the "client" in ensnode-sdk (packages/ensnode-sdk/src/client.ts) but becomes the new home for implementing the following:
      1. getReferrerLeaderboardPage
      2. getReferrerDetail
    3. This will mean that the ENSAwards site will need to create both an ENSNodeClient from ensnode-sdk and a (new!) ENSReferralsClient from ens-referrals.
      1. ENSAwards will therefore have dependencies on both ensnode-sdk and ens-referrals.
    4. This will also mean that (for now!) the ENSApi app will have dependencies on both ensnode-sdk and ens-referrals. This is a temporary step until we can complete the big picture goals identified in the section above.
  2. The ens-referrals package should add a dependency on ensnode-sdk.
  3. Each of the following ideas that are currently defined in ens-referrals should be deleted from ens-referrals and instead be converted into imports from ensnode-sdk to remove code duplication and improve code maintainability moving forward:
    1. ChainId
    2. AccountId
    3. UnixTimestamp
    4. Duration
  4. Introduce zero changes that would break the ENSAwards site from the perspective of the network layer of API requests / responses. Breaks to the ENSAwards site at the code import / build layer are fully expected by this work and are ok 👍

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions