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

chore: hydraDX renamed to hydration #1582

Merged
merged 2 commits into from
Oct 7, 2024
Merged

chore: hydraDX renamed to hydration #1582

merged 2 commits into from
Oct 7, 2024

Conversation

Nick-1979
Copy link
Member

@Nick-1979 Nick-1979 commented Oct 6, 2024

closes #1573

Summary by CodeRabbit

  • New Features

    • Added support for the "Hydration" chain in various components and constants.
    • Introduced a new price ID mapping for the "hydration" chain.
  • Bug Fixes

    • Corrected comments and logging related to the "Hydration" chain for clarity.
  • Documentation

    • Updated comments in the code to reflect the new naming conventions and improve understanding.
  • Refactor

    • Exported the isUpToDate function for broader accessibility across the application.

Copy link
Contributor

coderabbitai bot commented Oct 6, 2024

Walkthrough

The pull request includes updates to multiple package.json files across various packages, focusing on dependency version upgrades for several @polkadot libraries. Key changes involve upgrading dependencies from version ^12.6.2 to ^13.1.1 for @polkadot/util, @polkadot/util-crypto, and others. Additionally, the SUBSQUARE_SUPPORTED_CHAINS constant in the ExternalLinks component has been modified to replace "HydraDX" with "Hydration". Other minor updates include the export of the isUpToDate function and adjustments to comments for clarity.

Changes

File Path Change Summary
package.json, packages/extension-base/package.json, packages/extension-chains/package.json Dependency versions updated from ^12.6.2 to ^13.1.1 for @polkadot/util, @polkadot/util-crypto, and @polkadot/networks.
packages/extension-polkagate/src/fullscreen/accountDetails/components/ExternalLinks.tsx Updated SUBSQUARE_SUPPORTED_CHAINS to replace "HydraDX" with "Hydration".
packages/extension-polkagate/src/hooks/useAssetsBalances.ts Exported isUpToDate function and updated comments for clarity.
packages/extension-polkagate/src/util/api/getPrices.ts Added entry hydration: 'hydradx' to EXTRA_PRICE_IDS.
packages/extension-polkagate/src/util/constants.tsx Updated comment for IDENTITY_CHAINS from "HydraDx" to "Hydration".
packages/extension-polkagate/src/util/defaultSelectedChains.tsx Changed text property for HydraDX in DEFAULT_SELECTED_CHAINS to "Hydration".

Assessment against linked issues

Objective Addressed Explanation
Rename hydradx to hydration (#1573)

Possibly related PRs

Suggested reviewers

  • AMIRKHANEF

🐰 In the garden, changes bloom,
Dependencies shift, making room.
HydraDX now Hydration's name,
In code we dance, a joyful game.
With every update, we leap and play,
Hopping forward, come what may! 🌼


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 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
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 (1)
packages/extension-polkagate/src/util/api/getPrices.ts (1)

Line range hint 18-38: Consider improving error handling in the API request

While the current implementation works correctly, it might benefit from improved error handling, especially for the API request to CoinGecko. Consider wrapping the API call in a try-catch block to handle potential network errors or API failures gracefully.

Here's a suggested improvement for the getPrices function:

export default async function getPrices (priceIds: string[], currencyCode = 'usd') {
  console.log(' getting prices for:', priceIds.sort());

  const revisedPriceIds = priceIds.map((item) => (EXTRA_PRICE_IDS[item] || item));

  try {
    const prices = await getReq(`https://api.coingecko.com/api/v3/simple/price?ids=${revisedPriceIds}&vs_currencies=${currencyCode}&include_24hr_change=true`, {});

    const outputObjectPrices: PricesType = {};

    for (const [key, value] of Object.entries(prices)) {
      outputObjectPrices[key] = { change: value[`${currencyCode}_24h_change`] as number, value: value[currencyCode] as number };
    }

    return { currencyCode, date: Date.now(), prices: outputObjectPrices };
  } catch (error) {
    console.error('Error fetching prices:', error);
    throw new Error('Failed to fetch prices from CoinGecko');
  }
}

This change adds error handling to log any issues with the API request and throws a more informative error, which can be caught and handled by the calling function.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2aa580c and 62f1dbf.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • package.json (2 hunks)
  • packages/extension-base/package.json (1 hunks)
  • packages/extension-chains/package.json (1 hunks)
  • packages/extension-polkagate/src/fullscreen/accountDetails/components/ExternalLinks.tsx (1 hunks)
  • packages/extension-polkagate/src/hooks/useAssetsBalances.ts (3 hunks)
  • packages/extension-polkagate/src/util/api/getPrices.ts (1 hunks)
  • packages/extension-polkagate/src/util/constants.tsx (1 hunks)
  • packages/extension-polkagate/src/util/defaultSelectedChains.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/extension-polkagate/src/util/constants.tsx
🧰 Additional context used
🔇 Additional comments (7)
packages/extension-base/package.json (1)

29-29: LGTM! Dependency versions updated consistently.

The updates to @polkadot/networks, @polkadot/util, and @polkadot/util-crypto from ^12.6.2 to ^13.1.1 appear to be a coordinated update of related Polkadot packages. This is a good practice for maintaining consistency across dependencies.

To ensure these updates don't introduce any breaking changes, please run the following verification script:

If any breaking changes are found or compatibility issues are detected, please ensure that the necessary adjustments have been made in the codebase to accommodate these changes.

Also applies to: 35-36

packages/extension-polkagate/src/util/api/getPrices.ts (1)

13-13: LGTM! The renaming from "hydraDX" to "hydration" is correctly implemented.

The addition of hydration: 'hydradx' to the EXTRA_PRICE_IDS constant ensures that the correct price ID is used when fetching prices from the CoinGecko API. This change aligns with the PR objectives and should resolve the issue mentioned in #1573.

To ensure this change is consistently applied throughout the codebase, let's run the following script:

This script will help us identify any remaining instances of "hydraDX" that might need to be updated, verify the correct usage of "hydration", and check for any inconsistencies in price ID usage across the codebase.

✅ Verification successful

Verified: Renaming from "hydraDX" to "hydration" is successfully implemented.

All instances have been appropriately updated, and the usage of 'hydration' aligns with the PR objectives. The mapping hydration: 'hydradx' ensures correct price ID retrieval from the CoinGecko API without inconsistencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the renaming from "hydraDX" to "hydration" across the codebase

# Test 1: Check for any remaining instances of "hydraDX" (case-insensitive)
echo "Checking for remaining instances of 'hydraDX':"
rg -i 'hydraDX' --type-not json

# Test 2: Verify the usage of "hydration" in relevant files
echo "Verifying usage of 'hydration':"
rg -i 'hydration' --type-not json

# Test 3: Check for any inconsistencies in price ID usage
echo "Checking for inconsistencies in price ID usage:"
rg -i 'hydradx|hydration' --type typescript

Length of output: 1353


Script:

#!/bin/bash
# Description: Re-verify inconsistencies in price ID usage after correcting file type specification

# Test 3: Check for any inconsistencies in price ID usage by searching TypeScript files
echo "Re-running Test 3: Checking for inconsistencies in price ID usage:"
rg -i 'hydradx|hydration' --type ts

Length of output: 1015

package.json (3)

Line range hint 1-131: Verify implementation of "hydraDX" to "hydration" renaming.

While the dependency updates in this file are appropriate, I noticed that the PR objectives mention renaming "hydraDX" to "hydration". However, this package.json file doesn't contain any changes related to this renaming.

To ensure that the renaming has been implemented as intended, please run the following commands to check for the renaming across the project:

#!/bin/bash
# Description: Check for "hydraDX" to "hydration" renaming across the project

# Test: Search for remaining instances of "hydraDX" (case-insensitive)
rg -i "hydraDX"

# Test: Search for new instances of "hydration" (case-insensitive)
rg -i "hydration"

# Test: Check for any files that might contain the renaming
rg -i -l "hydraDX|hydration"

If the renaming is not found, please ensure that it has been implemented in the appropriate files to meet the PR objectives.


68-70: Dependency updates look good, but verify compatibility.

The updates to @polkadot/util, @polkadot/util-crypto, and @polkagate/apps-config are consistent with keeping dependencies up-to-date. However, the significant version jump for the @PolkaDot packages (from ^12.6.2 to ^13.1.1) might introduce breaking changes.

Please ensure that the application is compatible with these new versions. Run the following commands to check for any breaking changes or deprecations:


119-120: Resolutions updates are consistent with dependency changes.

The updates to @polkadot/keyring, @polkadot/networks, @polkadot/util, @polkadot/util-crypto, and @polkadot/x-fetch in the resolutions section are consistent with the changes made in the dependencies section. This ensures version consistency across the project's dependency tree.

To verify that these updates don't cause any conflicts or issues in the build process, please run the following commands:

Also applies to: 124-126

packages/extension-polkagate/src/hooks/useAssetsBalances.ts (2)

106-106: LGTM: Exporting isUpToDate function enhances reusability.

The isUpToDate function is now exported, which allows it to be used in other modules. This change promotes code reuse and modularity without introducing any functional changes or side effects.


502-502: LGTM: Comment updated to reflect renaming from "HydraDX" to "Hydration".

This comment update aligns with the PR objective of renaming "hydraDX" to "hydration". The change improves code documentation consistency without affecting functionality.

@Nick-1979 Nick-1979 requested review from AMIRKHANEF and removed request for AMIRKHANEF October 7, 2024 07:07
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 62f1dbf and 11c2400.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json (2 hunks)
  • packages/extension-inject/package.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
packages/extension-inject/package.json (1)

24-26: Dependency updates look good, but package version should be updated.

The consistent update of @polkadot/util, @polkadot/util-crypto, and @polkadot/x-global from ^12.6.2 to ^13.1.1 is appropriate. However, I have a few suggestions:

  1. Consider updating the package version (currently 0.47.5) to reflect these dependency changes. This helps track significant updates to the package.

  2. Verify compatibility with the updated dependencies, especially since this is a minor version bump (12.x to 13.x).

  3. Note that these changes don't seem directly related to the PR objective of renaming "hydraDX" to "hydration". Ensure that this PR includes all necessary changes to meet its stated objectives.

To verify the impact of these dependency updates, you can run:

This will help identify any potential breaking changes in the updated dependencies and usage of this package in the project.

package.json (2)

68-70: Verify alignment with PR objectives

While the dependency updates, especially for @polkagate/apps-config, likely support the PR objective of renaming "hydraDX" to "hydration", there's no direct evidence of the renaming in this file.

To ensure full alignment with the PR objectives:

  1. Verify that the updated @polkagate/apps-config version (0.140.7) includes the necessary changes for the "hydraDX" to "hydration" renaming.
  2. Check other files in the project where the renaming should be reflected.

To verify the renaming across the project, you can run the following script:

#!/bin/bash
# Description: Check for "hydraDX" references and "hydration" updates

# Test: Search for any remaining "hydraDX" references
rg --type typescript --type javascript 'hydraDX' packages

# Test: Search for new "hydration" references
rg --type typescript --type javascript 'hydration' packages

# Test: Check the contents of the updated @polkagate/apps-config
rg --type typescript --type javascript 'hydration' node_modules/@polkagate/apps-config

Also applies to: 119-120, 124-126


119-120: Consistent updates in resolutions section

The resolutions have been updated consistently with the dependencies:

  • @polkadot/keyring, @polkadot/networks, @polkadot/util, @polkadot/util-crypto, and @polkadot/x-fetch: ^12.6.2 -> ^13.1.1

This consistency is good practice and helps prevent version conflicts. However:

  1. The major version change (12 to 13) across multiple @PolkaDot libraries might introduce breaking changes throughout the project.
  2. Ensure that all parts of your codebase using these libraries are thoroughly tested with the new versions.

To verify the impact of these changes across the project, you can run the following script:

Also applies to: 124-126

Comment on lines +68 to +70
"@polkadot/util": "^13.1.1",
"@polkadot/util-crypto": "^13.1.1",
"@polkagate/apps-config": "^0.140.7",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Deprecated API usages detected in updated @PolkaDot libraries

The following deprecated APIs were found after updating @polkadot/util and @polkadot/util-crypto to version ^13.1.1:

  • packages/extension-polkagate/src/util/workers/getStakingConsts.js: apiAt.consts.staking.maxNominatorRewardedPerValidator is deprecated.
  • packages/extension-polkagate/src/util/types.ts: Controller is deprecated.
  • packages/extension-polkagate/src/util/ledger/base.ts: u2f is deprecated.
  • packages/extension-polkagate/src/fullscreen/stake/type.ts: amount is deprecated and moved to extraInfo.

Please address these deprecated API usages to ensure compatibility with the updated library versions.

🔗 Analysis chain

Verify compatibility with updated @PolkaDot libraries

The dependencies have been updated as follows:

  • @polkadot/util and @polkadot/util-crypto: ^12.6.2 -> ^13.1.1
  • @polkagate/apps-config: ^0.140.5 -> ^0.140.7

While these updates align with the PR objective and likely include necessary changes for renaming "hydraDX" to "hydration", please note the following:

  1. The major version change (12 to 13) for @PolkaDot libraries might introduce breaking changes.
  2. Ensure that your code is compatible with these new versions and that all functionality remains intact after the update.

To verify the impact of these changes, you can run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in @polkadot libraries

# Test: Search for any usage of deprecated or removed APIs
rg --type typescript --type javascript 'deprecated|removed' packages

# Test: Check if there are any TypeScript errors after the update
tsc --noEmit

Length of output: 191


Script:

#!/bin/bash
# Description: Check for breaking changes in @polkadot libraries

# Test: Search for any usage of deprecated or removed APIs in .ts and .js files
rg --glob '*.ts' --glob '*.js' 'deprecated|removed' packages

Length of output: 498

@Nick-1979 Nick-1979 merged commit 9903f45 into main Oct 7, 2024
8 checks passed
@Nick-1979 Nick-1979 deleted the hydrationUPdate branch October 7, 2024 07:30
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.

rename hydradx to hydration
2 participants