Skip to content
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

Indexer Resurrection #100

Merged
merged 2 commits into from
May 22, 2024
Merged

Indexer Resurrection #100

merged 2 commits into from
May 22, 2024

Conversation

mvpoyatt
Copy link
Collaborator

@mvpoyatt mvpoyatt commented May 21, 2024

  • Adapted graphql requests to subsquid and tweaked packet details
  • Some of these files were changed just because I renamed source/destChannel to source/destClient

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a new function to map client strings to display values.
  • Improvements

    • Renamed fields and accessors from sourceChain and destChain to sourceClient and destClient for improved clarity.
    • Enhanced query structures for more efficient data retrieval in packet and channel-related functions.
  • Bug Fixes

    • Added checks for null or empty values in chain-related components to prevent errors.
  • UI Adjustments

    • Updated CSS classes for better alignment in the status bar.

@mvpoyatt mvpoyatt requested review from Inkvi and dshiell May 21, 2024 15:58
Copy link

coderabbitai bot commented May 21, 2024

Walkthrough

The recent updates involve restructuring and refining various aspects of the codebase to enhance clarity and consistency. Changes include renaming fields for better understanding, updating query structures for improved data handling, and adding utility functions to enhance display features. These modifications aim to streamline the codebase and make it more maintainable.

Changes

File Change Summary
app/(routes)/packets/packet-details.tsx, app/(routes)/packets/page.tsx Renamed sourceChain to sourceClient, destChain to destClient, and adjusted imports and references accordingly.
app/api/packets/helpers.ts Restructured packet data processing, updated query structures, and refined timestamp handling.
app/api/channels/helpers.ts, app/utils/types/packet.ts Renamed and updated functions and interfaces for consistency.
app/api/metrics/helpers.ts, app/api/metrics/route.ts Modified query structures and function calls for improved data retrieval.
app/components/chain-cell.tsx, app/components/ibc-table.tsx Updated components to reflect changes in field names.
app/utils/chains/configs.ts Added utility function for client display mapping.

In the code where chains align,
Clients now take their place to shine.
Functions renamed, queries refined,
Data flows clearer, all redefined.
🐇✨ CodeRabbit hops with glee,
For a cleaner, brighter code we see!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between d0bc07d and 0c8cbd0.
Files selected for processing (10)
  • app/(routes)/packets/packet-details.tsx (4 hunks)
  • app/(routes)/packets/page.tsx (2 hunks)
  • app/api/channels/helpers.ts (3 hunks)
  • app/api/metrics/helpers.ts (2 hunks)
  • app/api/metrics/route.ts (1 hunks)
  • app/api/packets/helpers.ts (3 hunks)
  • app/components/chain-cell.tsx (1 hunks)
  • app/components/ibc-table.tsx (3 hunks)
  • app/utils/chains/configs.ts (1 hunks)
  • app/utils/types/packet.ts (1 hunks)
Additional comments not posted (10)
app/utils/types/packet.ts (1)

16-17: Field renaming from sourceChain and destChain to sourceClient and destClient is clear and aligns with the PR objectives for better data representation.

app/components/chain-cell.tsx (1)

5-6: Adding a null or empty check for the chain parameter in ChainCell enhances robustness and prevents potential rendering errors.

app/api/metrics/helpers.ts (1)

12-32: The adjustments in getPackets to handle from and to as BigInt and converting them to milliseconds are appropriate for handling larger time values and align with the PR objectives.

app/utils/chains/configs.ts (1)

59-65: The addition of the clientToDisplay function enhances data representation by mapping client strings to display values based on chain configurations.

app/api/channels/helpers.ts (1)

Line range hint 15-90: Renaming getChannelByGQQuery to processChannelRequest and adjusting the GraphQL queries enhance clarity and efficiency in handling channel data.

app/api/packets/helpers.ts (2)

69-105: The updated GraphQL query is well-structured and optimized for fetching packet data based on transaction hash.


114-147: The GraphQL query for fetching recent packets is appropriately structured and uses good practices like variable limits.

app/(routes)/packets/page.tsx (1)

39-39: The updates to the column helpers correctly reflect the renaming from sourceChain to sourceClient and destChain to destClient. Good alignment with PR objectives.

Also applies to: 49-49

app/(routes)/packets/packet-details.tsx (1)

3-3: The use of clientToDisplay enhances the clarity and functionality of the component by converting client identifiers to display names. The URL construction logic is correctly updated.

Also applies to: 6-6, 15-15, 18-18, 35-35, 37-37, 102-102, 104-104

app/components/ibc-table.tsx (1)

126-126: The updates to the padding logic and the addition of a filter for sourceClient, destClient, and chain enhance the functionality and user experience of the table.

Also applies to: 175-175, 241-241

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0c8cbd0 and 908c745.
Files selected for processing (2)
  • app/(routes)/packets/packet-details.tsx (4 hunks)
  • app/api/packets/helpers.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/(routes)/packets/packet-details.tsx
Additional Context Used
Learnings (1)
app/api/packets/helpers.ts (1)
User: mvpoyatt
URL: https://github.com/polymerdao/ibc-explorer/pull/85

Timestamp: 2024-04-10T15:57:41.445Z
Learning: Error handling for external calls in the `getPacket` function within `app/api/packets/helpers.ts` is managed by the parent function, as clarified by the user mvpyatt.
Additional comments not posted (4)
app/api/packets/helpers.ts (4)

27-38: Proper error handling added to processPacketRequest.

The addition of error handling for both the fetch operation and the response validation improves the robustness of the function.


49-69: Timestamp conversion and field renaming handled correctly.

The conversion of timestamps from milliseconds to seconds is accurate, and the renaming of fields from sourceChannel to sourceClient and destChannel to destClient is consistent with the PR objectives.


80-127: Updated GraphQL query and error handling in getPacket.

The GraphQL query has been updated to reflect the new field names, and error handling is implemented effectively to manage potential exceptions.


130-174: Updated GraphQL query and error handling in getRecentPackets.

The query structure is correctly updated to fetch recent packets, and comprehensive error handling ensures robustness.

Copy link
Member

@dshiell dshiell left a comment

Choose a reason for hiding this comment

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

lgtm

@mvpoyatt mvpoyatt merged commit aa10dbe into main May 22, 2024
2 checks passed
@mvpoyatt mvpoyatt deleted the mp/subsquid-update branch May 22, 2024 19:00
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