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

feat(kvindexer): add evm-nft submodule #133

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

Vritra4
Copy link
Contributor

@Vritra4 Vritra4 commented Dec 16, 2024

Description

Closes: -

added kvindexer's evm-nft submodule


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Introduced support for NFT operations in the indexer.
    • Added new API endpoints for querying NFT collections and tokens.
  • Bug Fixes

    • Corrected spelling errors in API documentation.
  • Documentation

    • Enhanced clarity of API parameter names and descriptions.
    • Updated Swagger documentation with new endpoints and response schemas.
  • Chores

    • Updated dependencies in the project configuration.

@Vritra4 Vritra4 requested a review from beer-1 December 16, 2024 07:20
@Vritra4 Vritra4 self-assigned this Dec 16, 2024
@Vritra4 Vritra4 requested a review from a team as a code owner December 16, 2024 07:20
Copy link

coderabbitai bot commented Dec 16, 2024

Walkthrough

This pull request introduces NFT (Non-Fungible Token) indexing functionality to the application. The changes primarily involve adding a new NFT submodule to the indexer in app/indexer.go, updating the documentation configuration files to include new NFT-related API endpoints, and modifying the Swagger documentation. The go.mod file is also updated to include a new dependency for the NFT indexer submodule and adjust some module versions.

Changes

File Change Summary
app/indexer.go Added NFT submodule initialization in setupIndexer function, importing nft package and registering smNft with kvIndexerKeeper
client/docs/config.json Renamed multiple Params operation IDs to more descriptive versions, added new NFT-related API endpoint
client/docs/swagger-ui/swagger.yaml Added new NFT-related endpoints, introduced new response schemas for NFT collections and tokens
go.mod Added new dependency github.com/initia-labs/kvindexer/submodules/evm-nft v0.1.6, updated replace directives for several modules

Sequence Diagram

sequenceDiagram
    participant App as MinitiaApp
    participant Indexer as KVIndexer
    participant NFTSubmodule as NFT Submodule
    
    App->>Indexer: Initialize Indexer
    Indexer->>NFTSubmodule: Create NFT Submodule
    NFTSubmodule-->>Indexer: Submodule Created
    Indexer->>Indexer: Register NFT Submodule
Loading

Possibly related PRs

Suggested reviewers

  • beer-1

Poem

🐰 Hop, hop, indexing NFTs with glee,
A rabbit's dance of blockchain revelry!
Submodules bloom like carrots in the code,
New endpoints sparkle on our digital road
Indexing magic, oh what a delight! 🦊🔗

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request.


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>, 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 57.03%. Comparing base (db00a17) to head (7936479).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
app/indexer.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
- Coverage   57.04%   57.03%   -0.02%     
==========================================
  Files         110      110              
  Lines       10045    10049       +4     
==========================================
+ Hits         5730     5731       +1     
- Misses       3493     3495       +2     
- Partials      822      823       +1     
Files with missing lines Coverage Δ
app/indexer.go 40.00% <40.00%> (-0.91%) ⬇️

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

🧹 Nitpick comments (2)
client/docs/swagger-ui/swagger.yaml (2)

43083-43642: LGTM: Well-designed NFT endpoints with standard pagination

The new NFT endpoints follow REST conventions and include standard cosmos-sdk pagination parameters.

Fix typo in the summary of TokensByAccount endpoint:

-      summary: TokensByACcount queries all the NFTs of an account
+      summary: TokensByAccount queries all the NFTs of an account

70832-71091: LGTM: Well-structured NFT data models

The NFT data models are well-organized and follow a clear hierarchy with appropriate relationships between collections and tokens.

Consider adding examples in the documentation for common use cases of these models.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between db00a17 and 7936479.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • app/indexer.go (2 hunks)
  • client/docs/config.json (1 hunks)
  • client/docs/swagger-ui/swagger.yaml (8 hunks)
  • go.mod (1 hunks)
🔇 Additional comments (7)
client/docs/swagger-ui/swagger.yaml (2)

37511-37511: LGTM: Documentation improvements

The description text improvements enhance clarity across multiple definitions.

Also applies to: 68008-68008, 68141-68141, 68919-68919


37226-37226: Breaking Change: Verify impact of base_denom endpoint modification

The endpoint /opinit/opchild/v1/base_denom/{denom} has been modified:

  • Path parameter denom is now a query parameter
  • Parameter is now optional (required: false)

This is a breaking change that will require updates to existing API clients.

Also applies to: 37436-37437

app/indexer.go (3)

16-16: LGTM!

The import follows the established pattern for submodule imports.


64-64: LGTM!

The submodule registration follows the established pattern and maintains proper error handling.


60-63: Verify NFT submodule dependencies

The initialization looks correct with proper error handling. However, let's verify the dependency on smPair.

✅ Verification successful

NFT submodule dependency on smPair is correctly initialized and registered

The verification shows that:

  • smPair is properly initialized before being passed to NewEvmNFTSubmodule
  • Both smPair and smNft are correctly registered with the kvIndexerKeeper
  • The dependency chain is maintained in the proper order: pair submodule is created first, then used in NFT submodule initialization
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how smPair is used within the NFT submodule

# Search for pair-related function calls in NFT submodule
ast-grep --pattern 'smPair.$_($$$)'

Length of output: 37


Script:

#!/bin/bash
# Let's try a different approach to understand the NFT submodule dependencies

# First, let's find the NFT submodule implementation
fd "nft" --type f --exec rg -l "NewEvmNFTSubmodule"

# Then look for any usage of pair-related functionality
fd "nft" --type f --exec rg -l "smPair"

# Finally, let's examine the NFT submodule implementation
ast-grep --pattern 'func NewEvmNFTSubmodule($$$) {
  $$$
}'

Length of output: 149


Script:

#!/bin/bash
# Let's search for the NFT module implementation files more broadly
fd -e go -e sol --type f --exec rg -l "NFTSubmodule"

# Then let's look at the actual implementation
rg -A 10 "NewEvmNFTSubmodule" 

# Also search for any pair-related dependencies
rg "smPair" -A 5 -B 5

Length of output: 1486

client/docs/config.json (1)

195-198: LGTM!

The NFT query API endpoint is properly added following the established pattern for indexer endpoints.

go.mod (1)

43-43: Verify version compatibility with other kvindexer submodules

The new dependency is properly added. Let's verify version compatibility with other kvindexer submodules.

Copy link
Collaborator

@beer-1 beer-1 left a comment

Choose a reason for hiding this comment

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

LGTM

@beer-1 beer-1 merged commit f0aa106 into main Dec 17, 2024
9 of 10 checks passed
@beer-1 beer-1 deleted the feat/add-nft-kvidnexer branch December 17, 2024 03:33
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