-
Notifications
You must be signed in to change notification settings - Fork 3
fix: dynamically support enabled chains based on networks url #17
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
Conversation
|
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 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. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis 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 Changes
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
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 |
There was a problem hiding this 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
forEachloops could become a performance bottleneck with large datasets. Consider using a more efficient approach likereduceor 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
📒 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 withundefinedornullvalues, as it only falls back to the right-hand value when the left-hand value is strictlynullorundefined.
329-345: Incorporated nibiruChains into local configuration sources.The code now includes the
nibiruChainsin 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
nibiruChainsis applied inloadLocalConfig, maintaining consistency with the approach inloadingFromLocal.
376-385: Improved loop readability with for...of syntax.The switch from a traditional
forloop to afor...ofloop improves readability while maintaining the same functionality.
284-287:Details
❓ Verification inconclusive
Removed async keyword from method that doesn't await.
The
initialmethod no longer has theasynckeyword since it doesn't useawait. 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 theasynckeyword 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.
|



No description provided.