Skip to content

Conversation

@cgilbe27
Copy link

@cgilbe27 cgilbe27 commented Mar 3, 2025

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2025

Warning

Rate limit exceeded

@cgilbe27 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0a6680d and 8095478.

📒 Files selected for processing (1)
  • src/stores/useDashboard.ts (13 hunks)
📝 Walkthrough

Walkthrough

This pull request updates the configuration for a blockchain testnet in the JSON file. The modifications change the testnet identifiers and endpoint URLs from "nibiru-testnet-1" to "nibiru-testnet-2". Both the chain's name and registry name are updated, as well as the API and RPC addresses, ensuring they now point to the new testnet endpoints. Additionally, changes are made to the src/stores/useDashboard.ts file to enhance type definitions, simplify logic, and improve code readability.

Changes

File Change Summary
chains/.../nibiru-testnet-2.json Updated chain_name and registry_name from "nibiru-testnet-1" to "nibiru-testnet-2"; changed API and RPC address URLs from testnet-1 to testnet-2 endpoints.
src/stores/useDashboard.ts Added import for getNibiruChains; modified DirectoryChain and ChainConfig interfaces; simplified fromLocal, loadingPrices, loadingFromLocal, and loadLocalConfig methods; changed loop style in setupDefault; removed async from initial.

Poem

I'm a little bunny, hopping with delight,
Upgrading testnets in the digital night.
From one world to two, I nibble and play,
Chasing new endpoints along the way.
With twitching whiskers and a joyful cheer,
I celebrate updates that bring change 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>, 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 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 Mar 3, 2025

Visit the preview URL for this PR (updated for commit 8095478):

https://nibiru-explorer--pr17-chore-enable-testnet-htp3wfm0.web.app

(expires Tue, 18 Mar 2025 17:53:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0653a911498be5ff7b1517207d84ddca0bcce10b

@cgilbe27 cgilbe27 changed the title fix: deprecate testnet-1 and add testnet-2 fix: dynamically support enabled chains based on networks url Mar 4, 2025
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 (1)
src/stores/useDashboard.ts (1)

289-306: Consider performance optimization for nested loops.

The nested forEach loops could become a performance bottleneck with large datasets. Consider using a more efficient approach like reduce or memoization for better performance.

- const keys = Object.keys(this.chains); // load all blockchain
- keys.forEach((k) => {
-   if (this.chains[k])
-     this.chains[k].assets.forEach((a) => {
-       if (a.coingecko_id !== undefined && a.coingecko_id.length > 0) {
-         coinIds.push(a.coingecko_id);
-         a.denom_units.forEach((u) => {
-           this.coingecko[u.denom] = {
-             coinId: a.coingecko_id ?? '',
-             exponent: u.exponent,
-             symbol: a.symbol,
-           };
-         });
-       }
-     });
- });
+ // Reduce chained operations for better performance
+ const chains = Object.values(this.chains).filter(Boolean);
+ for (const chain of chains) {
+   for (const asset of chain.assets) {
+     if (asset.coingecko_id && asset.coingecko_id.length > 0) {
+       coinIds.push(asset.coingecko_id);
+       for (const unit of asset.denom_units) {
+         this.coingecko[unit.denom] = {
+           coinId: asset.coingecko_id,
+           exponent: unit.exponent,
+           symbol: asset.symbol,
+         };
+       }
+     }
+   }
+ }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fef7980 and 5b6bd8f.

📒 Files selected for processing (1)
  • src/stores/useDashboard.ts (13 hunks)
🔇 Additional comments (8)
src/stores/useDashboard.ts (8)

5-5: Added import for updated Nibiru chains functionality.

The new import supports the PR's objective to update from testnet-1 to testnet-2 by providing access to the Nibiru chains configuration.


37-43: Improved type definitions for explorers property.

The type definition has been improved by making all fields optional with ? syntax, which clarifies that these properties might not be present.


140-152: Improved asset mapping with explicit structure.

The asset mapping has been simplified and made more explicit by directly mapping the properties without conditional checks, which improves code clarity.


159-159: Enhanced null safety with nullish coalescing operator.

Replacing the logical OR (||) with the nullish coalescing operator (??) is a better approach when dealing with undefined or null values, as it only falls back to the right-hand value when the left-hand value is strictly null or undefined.


329-345: Incorporated nibiruChains into local configuration sources.

The code now includes the nibiruChains in both mainnet and testnet configurations, supporting the PR's objective to update testnet configuration.


353-367: Consistent integration of nibiruChains across methods.

The same pattern of including nibiruChains is applied in loadLocalConfig, maintaining consistency with the approach in loadingFromLocal.


376-385: Improved loop readability with for...of syntax.

The switch from a traditional for loop to a for...of loop improves readability while maintaining the same functionality.


284-287:

Details

❓ Verification inconclusive

Removed async keyword from method that doesn't await.

The initial method no longer has the async keyword since it doesn't use await. This is appropriate but ensure any code calling this method doesn't expect it to return a Promise.


🏁 Script executed:

#!/bin/bash
# Check for any usages of the initial method that might expect a Promise
rg -A 3 -B 3 "initial\(\)" --glob "*.{ts,js,vue}"

Length of output: 6425


Action: Verify Consistent Return Expectations for initial()

  • In src/stores/useDashboard.ts, the removal of the async keyword is appropriate since the method no longer performs any asynchronous operations.
  • However, note that there is an await call on this method in src/stores/useBlockchain.ts (e.g., await this.dashboard.initial()). While awaiting a synchronous function is technically valid (it will wrap the return value in a resolved promise), please confirm that this behavior is intentional and consistent with the design of other store methods.
  • Ensure that none of the callers are relying on the method returning a genuine Promise for any additional asynchronous handling.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2025

@cgilbe27 cgilbe27 merged commit 116c0ff into master Mar 4, 2025
6 checks passed
@cgilbe27 cgilbe27 deleted the chore/enable-testnet-2-explorer branch March 4, 2025 19:11
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.

3 participants