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: staking extension and git submodules #360

Merged
merged 10 commits into from
Jun 24, 2024
Merged

Conversation

cgilbe27
Copy link
Contributor

@cgilbe27 cgilbe27 commented Jun 18, 2024

Related to but does not close: https://github.com/NibiruChain/web-app/issues/935

Build failure is due to: https://nibiruchain.slack.com/archives/C03GC05E37S/p1718804143575709

Summary by CodeRabbit

  • New Features

    • Introduced functionality to interact with staking-related operations, including methods for canceling unbonding delegations.
    • Added a test suite for staking extension setup.
  • Improvements

    • Simplified build and protogen scripts with streamlined submodule initialization and updates.
    • Enhanced ESLint and Prettier configurations for the new project structure.
  • Bug Fixes

    • Corrected import and type declarations in various query-related modules.
  • Documentation

    • Updated README with new initialization steps for git submodules.
  • Chores

    • Added submodule configurations for cosmos-sdk and nibiru repositories.

@cgilbe27 cgilbe27 self-assigned this Jun 18, 2024
@cgilbe27 cgilbe27 marked this pull request as draft June 18, 2024 20:17
Copy link
Contributor

coderabbitai bot commented Jun 18, 2024

Walkthrough

The recent changes primarily introduce submodules in the git repository, update ESLint, Prettier and Git ignore settings, modify CI/CD workflows, and implement new functionalities for staking extensions. The changes also focus on cancelling unstaking delegations, updating script files for generating TypeScript proto code, and modifying testing files.

Changes

Files/Paths Change Summary
.eslintrc.json Added ignorePatterns for nibiru/* and cosmos-sdk/*
.github/workflows/release.yaml Removed checkout step for nibiru and set submodules: true in actions/checkout@v4
.github/workflows/test-ts-sdk.yaml Removed cache-dependency-path: "**/yarn.lock" in the Node.js setup step
.gitignore Updated to ignore /nibiru and to stop ignoring /cosmos-sdk
.gitmodules Introduced submodule configurations for cosmos-sdk and nibiru
.prettierignore Added new directories and exclusions for generated files, logs, build outputs, and IDE settings
README.md Added initialization steps for git submodules
package.json Added packageManager field for a specific version of Yarn and its SHA hash
scripts/build.sh Simplified by directly initializing and updating submodules
scripts/protocgen.sh Modified to generate TypeScript proto code from nibiru and cosmos-sdk, removed unnecessary files
src/sdk/query/index.ts Added export * from "./staking"
src/sdk/query/query.ts Updated imports, modified extension setup functions, updated NibiruExtensions type
src/sdk/query/query.test.ts Removed explicit type annotations (: any)
src/sdk/query/staking.test.ts Introduced test suite for setupStakingExtension function
src/sdk/query/staking.ts Introduced functionality for interacting with staking-related operations
src/sdk/tx/txClient.ts Added setupStakeExtension function to imports and NibiruTxClient class
cosmos-sdk Introduced submodule commit with a specific hash
nibiru Introduced submodule commit with a specific hash

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Wallet
    participant Blockchain

    User->>Wallet: Initiate cancel unstaking
    Wallet->>Blockchain: Send CancelUnbondingDelegation tx msg
    Blockchain-->>Wallet: Confirm tx completion
    Wallet-->>User: Display confirmation message
Loading

Assessment Against Linked Issues

Objective (Issue #[935]) Addressed Explanation
feat(stake): cancel an unstaking delegation that's in-progress
Implement function to handle CancelUnbondingDelegation tx msg

Poem

In the code's fair land, where scripts now weave,
Submodules join, a web they cleave.
With ESLint guided, paths they hush,
Ensuring clean commits, no rush.
Staking tasks with grace and cheer,
For devs and wallets, changes near. 🌟


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.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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
Contributor

@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

Outside diff range and nitpick comments (3)
README.md (3)

Line range hint 64-64: The fenced code block for initializing the environment is missing a language identifier, which helps in syntax highlighting and readability in markdown renderers.

- ```
+ ```bash

Line range hint 2-2: Images used in the README lack alternative text descriptions. Adding alt text improves accessibility and SEO.

- <img src="https://raw.githubusercontent.com/NibiruChain/ts-sdk/develop/img/nibijs.png" width="100%">
+ <img src="https://raw.githubusercontent.com/NibiruChain/ts-sdk/develop/img/nibijs.png" alt="NibiJS Logo" width="100%">

Also applies to: 14-14, 19-19, 24-24, 29-29, 34-34, 276-276


Line range hint 52-52: The link to the documentation is broken or points to an invalid fragment. Ensure the link is correct to provide users with valid navigation.

- To learn more about Nibiru, see [nibiru.fi/docs](https://nibiru.fi/docs)
+ To learn more about Nibiru, ensure the link [nibiru.fi/docs](https://nibiru.fi/docs) is correct or update it.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f3dfa3a and c1421be.

Files selected for processing (11)
  • .github/workflows/test-ts-sdk.yaml (1 hunks)
  • .gitignore (1 hunks)
  • .gitmodules (1 hunks)
  • README.md (1 hunks)
  • package.json (1 hunks)
  • scripts/build.sh (1 hunks)
  • scripts/protocgen.sh (3 hunks)
  • src/sdk/query/index.ts (1 hunks)
  • src/sdk/query/query.ts (4 hunks)
  • src/sdk/query/staking.test.ts (1 hunks)
  • src/sdk/query/staking.ts (1 hunks)
Files skipped from review due to trivial changes (5)
  • .github/workflows/test-ts-sdk.yaml
  • .gitmodules
  • package.json
  • scripts/build.sh
  • src/sdk/query/index.ts
Additional context used
Shellcheck
scripts/protocgen.sh

[warning] 21-21: Use "${var:?}" to ensure this never expands to / . (SC2115)


[warning] 25-25: For loops over find output are fragile. Use find -exec or a while read loop. (SC2044)


[warning] 32-32: For loops over find output are fragile. Use find -exec or a while read loop. (SC2044)

Markdownlint
README.md

64-64: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


2-2: null (MD045, no-alt-text)
Images should have alternate text (alt text)


14-14: null (MD045, no-alt-text)
Images should have alternate text (alt text)


19-19: null (MD045, no-alt-text)
Images should have alternate text (alt text)


24-24: null (MD045, no-alt-text)
Images should have alternate text (alt text)


29-29: null (MD045, no-alt-text)
Images should have alternate text (alt text)


34-34: null (MD045, no-alt-text)
Images should have alternate text (alt text)


276-276: null (MD045, no-alt-text)
Images should have alternate text (alt text)


52-52: null (MD051, link-fragments)
Link fragments should be valid

Additional comments not posted (11)
src/sdk/query/staking.ts (3)

1-6: The import statements are correctly organized and relevant to the functionalities being implemented.


8-14: The StakeExtension interface is well-defined, promoting immutability and type safety with its readonly properties.


16-29: The setupStakingExtension function is correctly implemented, ensuring proper initialization of RPC clients and adherence to the defined interface.

src/sdk/query/staking.test.ts (3)

1-4: The import statements are correctly organized and appropriate for the testing functionalities implemented.


6-18: The main describe block for setupStakingExtension is well-structured with appropriate mocking and assertions.


20-39: The nested describe block thoroughly tests the cancelUnbondingDelegation function with appropriate setup and assertions.

scripts/protocgen.sh (1)

50-60: The cleanup commands are correctly implemented to ensure unnecessary files and directories are removed after the generation process.

.gitignore (1)

11-12: The updates to the .gitignore patterns are correctly set to ignore the appropriate directories for the project's needs.

src/sdk/query/query.ts (2)

30-36: The imports from the local directory are correctly added, ensuring that the StakeExtension and related functions are available within the file.


47-47: The NibiruExtensions type has been updated to include StakeExtension, aligning with the changes in the module's functionality.

README.md (1)

248-255: Instructions for initializing git submodules have been added, which is crucial for setting up the environment given the project's dependencies on submodules.

src/sdk/query/query.ts Outdated Show resolved Hide resolved
scripts/protocgen.sh Show resolved Hide resolved
@cgilbe27 cgilbe27 marked this pull request as ready for review June 19, 2024 13:36
@cgilbe27 cgilbe27 requested a review from CalicoNino June 19, 2024 13:37
Copy link
Contributor

@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 c1421be and 79a99f9.

Files selected for processing (13)
  • .eslintrc.json (1 hunks)
  • .github/workflows/release.yaml (1 hunks)
  • .github/workflows/test-ts-sdk.yaml (1 hunks)
  • .gitignore (2 hunks)
  • .prettierignore (1 hunks)
  • cosmos-sdk (1 hunks)
  • nibiru (1 hunks)
  • package.json (2 hunks)
  • src/sdk/query/query.test.ts (2 hunks)
  • src/sdk/query/query.ts (4 hunks)
  • src/sdk/query/staking.test.ts (1 hunks)
  • src/sdk/query/staking.ts (1 hunks)
  • src/sdk/tx/txClient.ts (2 hunks)
Files skipped from review due to trivial changes (6)
  • .eslintrc.json
  • .github/workflows/release.yaml
  • .prettierignore
  • cosmos-sdk
  • nibiru
  • src/sdk/query/query.test.ts
Files skipped from review as they are similar to previous changes (6)
  • .github/workflows/test-ts-sdk.yaml
  • .gitignore
  • package.json
  • src/sdk/query/query.ts
  • src/sdk/query/staking.test.ts
  • src/sdk/query/staking.ts
Additional comments not posted (2)
src/sdk/tx/txClient.ts (2)

27-27: Import of setupStakeExtension looks good and is correctly placed among other imports.


56-56: Integration of setupStakeExtension into NibiruTxClient is correctly implemented. Ensure it's thoroughly tested and does not interfere with other extensions.

Copy link
Contributor

@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 79a99f9 and 2307d77.

Files selected for processing (1)
  • scripts/protocgen.sh (3 hunks)
Additional context used
Shellcheck
scripts/protocgen.sh

[warning] 21-21: Use "${var:?}" to ensure this never expands to / . (SC2115)


[warning] 25-25: For loops over find output are fragile. Use find -exec or a while read loop. (SC2044)


[warning] 32-32: For loops over find output are fragile. Use find -exec or a while read loop. (SC2044)

Additional comments not posted (1)
scripts/protocgen.sh (1)

31-34: Apply the same robust handling of filenames as suggested for the Nibiru repository.

Tools
Shellcheck

[warning] 32-32: For loops over find output are fragile. Use find -exec or a while read loop. (SC2044)

scripts/protocgen.sh Show resolved Hide resolved
scripts/protocgen.sh Show resolved Hide resolved
.gitignore Show resolved Hide resolved
@cgilbe27 cgilbe27 merged commit 4251709 into develop Jun 24, 2024
2 of 3 checks passed
@cgilbe27 cgilbe27 deleted the feat/staking-extension branch June 24, 2024 19:41
github-actions bot pushed a commit that referenced this pull request Jun 28, 2024
## [4.5.0](v4.4.0...v4.5.0) (2024-06-28)

### Features

* add gql user query ([#356](#356)) ([f3dfa3a](f3dfa3a))
* staking extension and git submodules ([#360](#360)) ([4251709](4251709))

### Reverts

* cosmos submodule only ([#362](#362)) ([#363](#363)) ([c012a83](c012a83))

### Miscellaneous Chores

* develop -> main ([#365](#365)) ([7e513c6](7e513c6)), closes [#362](#362)

 [skip ci]
@nibibot
Copy link

nibibot commented Jun 28, 2024

🎉 This PR is included in version 4.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants