Skip to content

chore: unstoppable domain proxy#404

Merged
cgilbe27 merged 1 commit intodevelopfrom
feat/unstoppable-domain-proxies
Apr 2, 2025
Merged

chore: unstoppable domain proxy#404
cgilbe27 merged 1 commit intodevelopfrom
feat/unstoppable-domain-proxies

Conversation

@cgilbe27
Copy link
Contributor

@cgilbe27 cgilbe27 commented Apr 2, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 2, 2025

📝 Walkthrough

Walkthrough

The changes introduce an optional domainName parameter across multiple GraphQL proxy functions and tests. The testProxies and proxies methods are updated to accept this parameter, influencing which fields are checked. The GraphQL query construction now conditionally includes a query for Unstoppable Domains when a domainName is provided. Additional modifications include syntax updates in the user query function, specialized handling for domainName in argument processing, and the addition of new types and constants (e.g., defaultBybit) to support Unstoppable Domains in both the client and schema.

Changes

File(s) Change Summary
src/gql/heart-monitor/heart-monitor.test.ts
src/gql/heart-monitor/heart-monitor.ts
Updated the testProxies function and the proxies method (in both interface and implementation) to include an optional domainName parameter. This enhances the test flow by conditionally checking for "unstoppableDomains" when a domain name is provided.
src/gql/query/proxies.ts Modified the proxiesQueryString and proxies functions to remove the excludeParentObject parameter and include an optional domainName parameter. The query string now dynamically includes a query for "unstoppableDomains" if present in the fields.
src/gql/query/user.ts Converted the userQueryString function to use an arrow function syntax while preserving its internal logic.
src/gql/utils/consts.ts Changed argument processing in the gqlQuery function to conditionally handle the "domainName" key, allowing quotes when needed, and added clarifying comments for this special case.
src/gql/utils/defaultObjects.ts Introduced a new constant defaultBybit to encapsulate market data and replaced an inline object reference with this constant in the defaultProxy declaration.
src/gql/utils/generated.ts Expanded the GQLProxies type by making bybit optional and adding a new unstoppableDomains field. New types (GQLProxiesGqlUnstoppableDomainsArgs, GQLRecords, GQLUnstoppableDomainsMeta, and GQLUnstoppableDomainsResponse) are added to support structured responses for Unstoppable Domains.
src/gql/utils/schema.graphql Updated the Proxies type by making bybit nullable and adding a new query field unstoppableDomains(domainName: String!): UnstoppableDomainsResponse. New types (Records, UnstoppableDomainsMeta, and UnstoppableDomainsResponse) are introduced, enhancing the schema for Unstoppable Domains data.

Sequence Diagram(s)

sequenceDiagram
    actor Test
    participant HM as HeartMonitor
    participant PQ as ProxiesQuery
    participant G as GraphQLEndpoint

    Test->>HM: Call testProxies(fields, domainName)
    HM->>PQ: Call proxies(fields, domainName)
    PQ->>G: Build & send query (includes domainName if provided)
    G-->>PQ: Return query response
    PQ-->>HM: Return proxies result
    HM-->>Test: Return final test result
Loading

Possibly related PRs

  • chore: updating to latest gql schema #399: Involves similar modifications to the GraphQL schema and functionality adjustments by introducing and utilizing the domainName parameter in proxy methods and tests.

Suggested reviewers

  • CalicoNino

Poem

Hopping through code with a joyful beat,
I found new paths where domains meet.
With domainName now in the mix,
My queries dance—no more old tricks!
A carrot of change in every line,
CodeRabbit hops, feeling just fine!
🥕🐇 Happy code days!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cef670b and 3d6bccd.

📒 Files selected for processing (8)
  • src/gql/heart-monitor/heart-monitor.test.ts (2 hunks)
  • src/gql/heart-monitor/heart-monitor.ts (2 hunks)
  • src/gql/query/proxies.ts (1 hunks)
  • src/gql/query/user.ts (1 hunks)
  • src/gql/utils/consts.ts (1 hunks)
  • src/gql/utils/defaultObjects.ts (2 hunks)
  • src/gql/utils/generated.ts (3 hunks)
  • src/gql/utils/schema.graphql (3 hunks)
🧰 Additional context used
🧬 Code Definitions (5)
src/gql/query/user.ts (1)
src/gql/utils/consts.ts (1)
  • gqlQuery (148-177)
src/gql/utils/defaultObjects.ts (1)
src/gql/utils/generated.ts (2)
  • GQLBybitResponse (32-46)
  • GQLProxies (513-517)
src/gql/heart-monitor/heart-monitor.test.ts (4)
src/gql/utils/generated.ts (1)
  • GQLProxies (513-517)
src/gql/utils/consts.ts (1)
  • checkFields (53-59)
src/gql/query/proxies.ts (1)
  • proxies (44-49)
src/gql/utils/defaultObjects.ts (2)
  • defaultProxy (254-279)
  • defaultBybit (239-252)
src/gql/query/proxies.ts (2)
src/gql/utils/consts.ts (4)
  • DeepPartial (29-49)
  • gqlQuery (148-177)
  • convertObjectToPropertiesString (103-132)
  • doGqlQuery (179-190)
src/gql/utils/generated.ts (1)
  • GQLProxies (513-517)
src/gql/heart-monitor/heart-monitor.ts (3)
src/gql/utils/consts.ts (1)
  • DeepPartial (29-49)
src/gql/utils/generated.ts (1)
  • GQLProxies (513-517)
src/gql/query/proxies.ts (2)
  • GqlOutProxies (10-12)
  • proxies (44-49)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: checkout_cache_install_build_test
🔇 Additional comments (19)
src/gql/query/user.ts (1)

15-25: Arrow function syntax improvement.

The function has been updated to use modern arrow function syntax, making it more concise while maintaining the same functionality. This aligns with contemporary TypeScript coding practices.

src/gql/utils/consts.ts (1)

164-168:

Details

✅ Verification successful

Special case handling added for 'domainName' parameter.

The code now conditionally applies quotes to the 'domainName' parameter by setting ignoreQuotes to false specifically for this key. While this works for the current requirements, the comment correctly identifies a potential maintenance issue if more special cases arise in the future.

Consider exploring a more scalable approach for handling special parameters in the future, such as:


🏁 Script executed:

#!/bin/bash
# Check if this special case handling is used elsewhere in the codebase
rg -A 3 -B 3 "special case" --type ts

Length of output: 540


DomainName Handling Verified – Approved with Future Consideration

The code in src/gql/utils/consts.ts (lines 164-168) correctly implements special-case handling for the domainName parameter by conditionally setting the ignoreQuotes flag. Our search confirms this pattern is not replicated elsewhere in the codebase. The current solution meets the requirements but may need to be refactored into a more scalable approach should additional special cases emerge.

  • Confirmed instance of special-case handling for domainName in the snippet.
  • No other occurrences found in the codebase according to the search.
  • Consider abstracting the logic for future scalability.
src/gql/utils/defaultObjects.ts (2)

239-252: New defaultBybit constant introduced.

Creating a separate defaultBybit constant with default values for all fields in the GQLBybitResponse type improves code organization and makes it easier to reuse these default values elsewhere in the codebase.


254-256: Simplified defaultProxy using defaultBybit constant.

Replacing the inline bybit object with the newly created defaultBybit constant improves code readability and maintainability by eliminating duplication.

src/gql/heart-monitor/heart-monitor.test.ts (2)

364-376: Enhanced testProxies to support optional domainName parameter.

The testProxies function now accepts an optional domainName parameter and passes it to the heartMonitor.proxies method. Additionally, the checkFields call now conditionally includes "unstoppableDomains" in the fields to check only when a domainName is provided, ensuring that tests properly validate the expected behavior.


378-381: Updated test cases to cover domainName functionality.

The test now includes calls with and without the domainName parameter to ensure both code paths are tested. The first test uses "cameron.nibi" as a domain name, while the second test provides only the bybit field without a domain name.

src/gql/heart-monitor/heart-monitor.ts (2)

109-112: Interface update for Unstoppable Domains support

The proxies method signature in the IHeartMonitor interface has been correctly updated to include an optional domainName parameter that will be used for Unstoppable Domains queries.


204-205: Implementation updated to match interface

The implementation in the HeartMonitor class has been properly updated to pass the new domainName parameter to the underlying proxies function, maintaining consistency with the interface.

src/gql/query/proxies.ts (2)

14-42: Improved query construction with conditional fields

The proxiesQueryString function has been completely refactored to dynamically construct the GraphQL query based on the requested fields. This is a significant improvement as it:

  1. Only includes the fields that are actually requested in the query
  2. Properly handles the new domainName parameter for Unstoppable Domains
  3. Creates a more efficient query structure

The implementation uses a clean approach by:

  • Building queries in an array
  • Conditionally adding specific proxy types
  • Joining them together at the end

This results in cleaner, more targeted GraphQL queries.


44-49: Function signature updated to support domain name

The proxies function signature has been properly updated to include the optional domainName parameter, which is then passed through to proxiesQueryString. This maintains consistency throughout the proxy query chain.

src/gql/utils/schema.graphql (4)

395-398: Schema update for Unstoppable Domains integration

The Proxies type has been modified to:

  1. Make the bybit field nullable (removing the ! postfix)
  2. Add a new field unstoppableDomains that accepts a required domainName parameter

This change ensures backward compatibility while adding support for the new Unstoppable Domains feature.


423-431: New Records type for Unstoppable Domains

The new Records type is well-structured with fields for various blockchain addresses and values that can be retrieved from an Unstoppable Domain. All fields are appropriately marked as optional.


579-590: Meta information type for Unstoppable Domains

The UnstoppableDomainsMeta type provides comprehensive metadata for an Unstoppable Domain, including blockchain information, ownership details, and domain properties. All fields are properly marked as required with the ! postfix.


592-595: Response type for Unstoppable Domains queries

The UnstoppableDomainsResponse type combines the metadata and records into a complete response structure, with both fields marked as required. This provides a well-defined contract for clients consuming this data.

src/gql/utils/generated.ts (5)

513-517: Updated TypeScript types for Proxies

The GQLProxies type has been updated to match the GraphQL schema changes:

  1. bybit is now optional with Maybe<GQLBybitResponse>
  2. Added support for unstoppableDomains as an optional field

This ensures type safety when working with the updated GraphQL schema.


519-522: Arguments type for unstoppableDomains queries

The new GQLProxiesGqlUnstoppableDomainsArgs type properly defines the required domainName parameter for Unstoppable Domains queries, ensuring that API consumers provide this required information.


623-632: TypeScript type for Records

The GQLRecords type matches the GraphQL schema definition with appropriate TypeScript types for each field. All fields are correctly marked as optional using Maybe<>.


844-856: TypeScript type for UnstoppableDomainsMeta

The GQLUnstoppableDomainsMeta type accurately reflects the GraphQL schema with all required fields. The types are appropriately mapped from the GraphQL scalar types to TypeScript types.


858-862: TypeScript type for UnstoppableDomainsResponse

The GQLUnstoppableDomainsResponse type correctly composes the meta and records types into a complete response structure, matching the GraphQL schema definition.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Apr 2, 2025

Lines Statements Branches Functions
Coverage: 95%
95.6% (913/955) 80.84% (173/214) 89.97% (305/339)

@cgilbe27 cgilbe27 merged commit 9f7b358 into develop Apr 2, 2025
3 checks passed
@cgilbe27 cgilbe27 deleted the feat/unstoppable-domain-proxies branch April 2, 2025 19:36
cgilbe27 added a commit that referenced this pull request Apr 2, 2025
github-actions bot pushed a commit that referenced this pull request Apr 2, 2025
### [6.1.3](v6.1.2...v6.1.3) (2025-04-02)

### Miscellaneous Chores

* unstoppable domain proxy ([#404](#404)) ([#405](#405)) ([ace44cb](ace44cb))

 [skip ci]
cgilbe27 added a commit that referenced this pull request Apr 4, 2025
* chore: unstoppable domain proxy (#404)

* fix: move curly braces
github-actions bot pushed a commit that referenced this pull request Apr 4, 2025
## [6.2.0](v6.1.3...v6.2.0) (2025-04-04)

### Features

* develop -> main ([#406](#406)) ([3635152](3635152)), closes [#404](#404)

 [skip ci]
cgilbe27 added a commit that referenced this pull request Apr 10, 2025
* chore: unstoppable domain proxy (#404)

* fix: move curly braces
cgilbe27 added a commit that referenced this pull request Apr 10, 2025
* chore: unstoppable domain proxy (#404)

* fix: move curly braces

* refactor: adding custom amino messages (#407)

* refactor: adding custom amino converter for convert to evm msg

* chore: comment and linting

* chore: new file instead of index

* chore: linting

---------

Co-authored-by: Calico Nino <54007257+CalicoNino@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Apr 10, 2025
## [6.3.0](v6.2.0...v6.3.0) (2025-04-10)

### Features

* develop -> main ([#408](#408)) ([7e79c5f](7e79c5f)), closes [#404](#404) [#407](#407)

 [skip ci]
cgilbe27 added a commit that referenced this pull request Oct 15, 2025
* chore: unstoppable domain proxy (#404)

* fix: move curly braces

* refactor: adding custom amino messages (#407)

* refactor: adding custom amino converter for convert to evm msg

* chore: comment and linting

* chore: new file instead of index

* chore: linting

* chore: pull latest protos

* chore: update protos and gql (#412)

* chore: update protos

* chore: add gql updates

* fix: small issue

---------

Co-authored-by: Calico Nino <54007257+CalicoNino@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Oct 15, 2025
### [6.3.1](v6.3.0...v6.3.1) (2025-10-15)

### Miscellaneous Chores

* develop -> main ([#413](#413)) ([1a4d173](1a4d173)), closes [#404](#404) [#407](#407) [#412](#412)

 [skip ci]
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.

1 participant