Skip to content

Add IBC Command and Fix typo in Comet Client variable #121

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

Merged
merged 5 commits into from
Feb 21, 2025

Conversation

SlayerAnsh
Copy link
Contributor

@SlayerAnsh SlayerAnsh commented Jan 13, 2025

Motivation

  • Add IBC client and cmds to query ibc. Ack command is not working however the process is same as documented. Issue is with proto enconding. This is still WIP.
  • Bug Fix - Typo in cometClient in ChainClient

Summary by CodeRabbit

  • New Features

    • Added IBC (Inter-Blockchain Communication) query capabilities to the Andromeda CLI and client.
    • Introduced new CLI commands for querying and decoding IBC packet acknowledgements.
    • Added support for querying IBC acknowledgements in the AndromedaClient.
  • Bug Fixes

    • Corrected a typo in the cometClient variable name.
    • Updated package versions to resolve minor issues.
  • Chores

    • Updated package versions for @andromedaprotocol/andromeda.js and @andromedaprotocol/cli.

@SlayerAnsh SlayerAnsh requested a review from crnbarr93 January 13, 2025 18:55
Copy link

coderabbitai bot commented Jan 13, 2025

Walkthrough

This pull request introduces a patch to fix a bug related to the variable name of the comet client in the @andromedaprotocol/andromeda.js file. Additionally, it enhances the Andromeda Protocol's JavaScript library and CLI by adding methods for querying and decoding IBC acknowledgements, updating client interfaces, and introducing new CLI commands for IBC interactions. The version has been incremented to 2.0.0-beta.4 for the Andromeda.js library and 2.0.0-beta.5 for the CLI package.

Changes

File Change Summary
@andromedaprotocol/andromeda.js Fixed bug related to comet client variable name
.changeset/pre.json Added "five-cobras-flow" to changesets array
packages/andrjs/CHANGELOG.md Added changelog entry for version 2.0.0-beta.4 documenting comet client fix
packages/andrjs/package.json Updated version to 2.0.0-beta.4
packages/andrjs/src/AndromedaClient.ts Added queryIbcAck and decodeAck methods for IBC acknowledgement handling
packages/andrjs/src/clients/ChainClient.ts Updated rawQueryClient type to include IbcExtension and fixed cometClient typo
packages/andrjs/src/clients/CosmClient.ts Added setupIbcExtension import for IBC functionality
packages/cli/CHANGELOG.md Added changelog entry for version 2.0.0-beta.5 with updated dependencies
packages/cli/package.json Updated version to 2.0.0-beta.5
packages/cli/src/cmd.ts Introduced new ibc command in base commands
packages/cli/src/handlers/ibc/index.ts Added packet-ack and decode-ack command handlers
packages/cli/src/handlers/index.ts Integrated IBC command handlers and exports

Possibly related PRs

Suggested reviewers

  • daniel-wehbe
  • leifasorensen

Poem

🐰 In the realm of blockchain, a dance we weave,
With IBC commands, new tricks up our sleeve!
A comet's name fixed, our paths now align,
Query and decode, oh how we shine!
Through chains we hop, with joy we believe! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 967bbbf and 3407191.

📒 Files selected for processing (1)
  • packages/cli/src/handlers/ibc/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/handlers/ibc/index.ts

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.

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: 3

🧹 Nitpick comments (2)
packages/andrjs/src/AndromedaClient.ts (2)

227-246: Add input validation for IBC parameters.

While the implementation is correct, consider adding validation for the input parameters:

  • portId and channelId should be non-empty strings
  • packetSequence should be a non-negative number
 async queryIbcAck(portId: string, channelId: string, packetSequence: number) {
+  if (!portId || !portId.trim()) {
+    throw new Error("portId must be a non-empty string");
+  }
+  if (!channelId || !channelId.trim()) {
+    throw new Error("channelId must be a non-empty string");
+  }
+  if (packetSequence < 0) {
+    throw new Error("packetSequence must be a non-negative number");
+  }
   this.preMessage();

248-254: Add JSDoc documentation for the decodeAck method.

Consider adding comprehensive documentation to improve code maintainability:

+/**
+ * Decodes an IBC acknowledgement from either a base64 string or Uint8Array
+ * @param acknowledgement - The acknowledgement to decode (base64 string or Uint8Array)
+ * @returns Decoded Acknowledgement object
+ * @throws Error if client is not connected
+ */
 async decodeAck(acknowledgement: Uint8Array | string) {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7eaeda1 and 1e66583.

📒 Files selected for processing (12)
  • .changeset/five-cobras-flow.md (1 hunks)
  • .changeset/pre.json (1 hunks)
  • packages/andrjs/CHANGELOG.md (1 hunks)
  • packages/andrjs/package.json (1 hunks)
  • packages/andrjs/src/AndromedaClient.ts (3 hunks)
  • packages/andrjs/src/clients/ChainClient.ts (2 hunks)
  • packages/andrjs/src/clients/CosmClient.ts (2 hunks)
  • packages/cli/CHANGELOG.md (1 hunks)
  • packages/cli/package.json (1 hunks)
  • packages/cli/src/cmd.ts (2 hunks)
  • packages/cli/src/handlers/ibc/index.ts (1 hunks)
  • packages/cli/src/handlers/index.ts (4 hunks)
✅ Files skipped from review due to trivial changes (5)
  • .changeset/five-cobras-flow.md
  • packages/andrjs/CHANGELOG.md
  • packages/andrjs/package.json
  • packages/cli/package.json
  • packages/cli/CHANGELOG.md
🧰 Additional context used
🪛 Biome (1.9.4)
packages/cli/src/handlers/ibc/index.ts

[error] 30-30: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

🔇 Additional comments (8)
.changeset/pre.json (1)

12-12: LGTM! Verify version increments.

The addition of the "five-cobras-flow" changeset for the Comet Client variable fix is appropriate.

Let's verify the version increments mentioned in the AI summary:

✅ Verification successful

✅ Version increments verified

The package versions match exactly:

  • andromeda.js: 2.0.0-beta.4
  • cli: 2.0.0-beta.5
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the version increments in package.json files

# Check andromeda.js version
echo "Checking andromeda.js version:"
fd --type f "package.json" --exec grep -l "@andromedaprotocol/andromeda.js" {} \; | xargs cat

# Check CLI version
echo "Checking CLI version:"
fd --type f "package.json" --exec grep -l "@andromedaprotocol/cli" {} \; | xargs cat

Length of output: 7894

packages/cli/src/handlers/index.ts (1)

11-11: LGTM! IBC command integration looks good.

The changes consistently follow the existing pattern for command registration and export.

Also applies to: 22-22, 36-36, 49-49

packages/andrjs/src/clients/ChainClient.ts (2)

36-36: LGTM! IBC extension added correctly.

The addition of IbcExtension to the rawQueryClient type is appropriate for supporting IBC functionality.


40-40: LGTM! Fixed typo in property name.

Corrected the property name from commectClient to cometClient.

packages/cli/src/cmd.ts (1)

78-84: LGTM! IBC command integration is consistent.

The IBC command follows the established pattern and includes appropriate disabled state handling.

packages/andrjs/src/AndromedaClient.ts (1)

23-25: LGTM! IBC-related imports are properly added.

The new imports are correctly scoped and necessary for implementing the IBC acknowledgment functionality.

packages/andrjs/src/clients/CosmClient.ts (2)

38-38: LGTM! IBC extension import is properly added.

The setupIbcExtension import is correctly placed alongside other setup extensions.


118-119: LGTM! IBC extension is properly integrated.

The setupIbcExtension is correctly added to the QueryClient extensions, following the established pattern.

@SlayerAnsh SlayerAnsh merged commit 109a6c3 into development Feb 21, 2025
3 checks passed
@SlayerAnsh SlayerAnsh deleted the feat/ibc-ack-and-raw-simulation branch February 21, 2025 14:32
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