Skip to content

Add HEMI Network#688

Merged
kvhnuke merged 2 commits intoenkryptcom:devop/packeupdates-0512from
0xJonHoldsCrypto:main
May 13, 2025
Merged

Add HEMI Network#688
kvhnuke merged 2 commits intoenkryptcom:devop/packeupdates-0512from
0xJonHoldsCrypto:main

Conversation

@0xJonHoldsCrypto
Copy link
Contributor

@0xJonHoldsCrypto 0xJonHoldsCrypto commented May 13, 2025

PR - Add Hemi Network

Summary by CodeRabbit

  • New Features

    • Added support for the Hemi Ethereum-compatible network, including network selection, configuration, and integration with activity tracking and block explorer.
  • Chores

    • Updated network lists and configuration options to include Hemi.

PR - Add Hemi Network
@coderabbitai
Copy link

coderabbitai bot commented May 13, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • develop
  • devop/vite-migrate

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A new Ethereum-compatible network called "Hemi" is added. This includes updating the network enumeration, defining its configuration and endpoints, integrating it into the networks index, and ensuring its block explorer is supported.

Changes

File(s) Change Summary
packages/types/src/networks.ts Added Hemi to the NetworkNames enum.
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts Added Hemi's block explorer API endpoint to the NetworkEndpoints mapping.
packages/extension/src/providers/ethereum/networks/hemi.ts Introduced new network configuration for Hemi, exporting it as the default EvmNetwork instance.
packages/extension/src/providers/ethereum/networks/index.ts Imported and included the Hemi network in the default export of Ethereum network nodes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Extension
    participant HemiNetwork
    participant HemiExplorer

    User->>Extension: Selects Hemi network
    Extension->>HemiNetwork: Loads network configuration
    Extension->>HemiExplorer: Queries via API endpoint (e.g., activity, explorer)
    HemiExplorer-->>Extension: Returns data
    Extension-->>User: Displays Hemi network info/activity
Loading

Possibly related PRs

Suggested reviewers

  • kvhnuke

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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.

@kvhnuke kvhnuke changed the base branch from main to devop/packeupdates-0512 May 13, 2025 19:47
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: 2

🧹 Nitpick comments (2)
packages/extension/src/providers/ethereum/networks/index.ts (1)

74-74: Consider following the naming convention for imported network modules.

The import name doesn't follow the project's naming convention. Other networks use the pattern <name>Node.

-import hemi from './hemi';
+import hemiNode from './hemi';
packages/extension/src/providers/ethereum/networks/hemi.ts (1)

3-17:

Details

❓ Verification inconclusive

Verify the Hemi network configuration details.

Please verify the following network details are correct:

  • Chain ID: 0xa867 (decimal: 43111)
  • RPC WebSocket URL: wss://rpc.hemi.network/wsrpc
  • Explorer URLs

Also, there's inconsistent indentation in the code block.

const netOptions: EvmNetworkOptions = {
  name: NetworkNames.Hemi,
  name_long: 'Hemi',
  homePage: 'https://hemi.xyz/',
  blockExplorerTX: 'https://explorer.hemi.xyz/tx/[[txHash]]',
  blockExplorerAddr: 'https://explorer.hemi.xyz/address/[[address]]',
  chainID: '0xa867',
  isTestNetwork: false,
  currencyName: 'ETH',
  currencyNameLong: 'Ethereum',
  node: 'wss://rpc.hemi.network/wsrpc',
  icon,
-    
  activityHandler: wrapActivityHandler(EtherscanActivity),
};
  
const net = new EvmNetwork(netOptions);
  
export default net;

🌐 Web query:

What is the correct chain ID for Hemi Network?

💡 Result:

Hemi Network Chain ID

Mainnet:

Testnet (Hemi Sepolia):

For most wallet and dApp integrations, use 43111 for Hemi Mainnet and 743111 for the testnet. Always verify details against the official Hemi documentation when configuring your wallet or application[1][6].

Citations:


Confirm Hemi Mainnet Configuration

The chain ID 0xa867 (hex) equals decimal 43111, which matches the official Hemi mainnet chain ID. Please double-check the remaining endpoints and explorer URLs:

  • RPC WebSocket endpoint:
    • Configured as wss://rpc.hemi.network/wsrpc
    • Official docs list the HTTP RPC at https://rpc.hemi.network/rpc—ensure the WSS path is supported.
  • Block explorer URLs (mainnet):
    • TX: https://explorer.hemi.xyz/tx/[[txHash]]
    • Address: https://explorer.hemi.xyz/address/[[address]]

Also, clean up the inconsistent indentation/blank line before activityHandler:

 const netOptions: EvmNetworkOptions = {
   name: NetworkNames.Hemi,
   name_long: 'Hemi',
   homePage: 'https://hemi.xyz/',
   blockExplorerTX: 'https://explorer.hemi.xyz/tx/[[txHash]]',
   blockExplorerAddr: 'https://explorer.hemi.xyz/address/[[address]]',
   chainID: '0xa867',
   isTestNetwork: false,
   currencyName: 'ETH',
   currencyNameLong: 'Ethereum',
   node: 'wss://rpc.hemi.network/wsrpc',
   icon,
-    
   activityHandler: wrapActivityHandler(EtherscanActivity),
 };
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c6d81f2 and b9a19d2.

📒 Files selected for processing (4)
  • packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/hemi.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/index.ts (2 hunks)
  • packages/types/src/networks.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/extension/src/providers/ethereum/networks/hemi.ts (2)
packages/extension/src/providers/ethereum/types/evm-network.ts (2)
  • EvmNetworkOptions (25-56)
  • EvmNetwork (58-293)
packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts (1)
  • EtherscanActivity (10-10)
🪛 Biome (1.9.4)
packages/extension/src/providers/ethereum/networks/index.ts

[error] 159-159: expected , but instead found hemi

Remove hemi

(parse)

🔇 Additional comments (2)
packages/types/src/networks.ts (1)

109-109:

Details

❌ Incorrect review comment

Consider adding a corresponding entry in CoingeckoPlatform enum.

The Hemi network has been added to the NetworkNames enum, but there's no matching entry in the CoingeckoPlatform enum. This might be needed if price fetching from Coingecko is required for tokens on this network.

export enum CoingeckoPlatform {
  // ...existing entries
  Taraxa = "taraxa",
+ Hemi = "hemi",
}

🌐 Web query:

Does Coingecko support "Hemi" network for API calls?

💡 Result:

As of May 2025, CoinGecko's API supports on-chain data across over 200 blockchain networks, including Ethereum, Solana, BNB Chain, and more. (support.coingecko.com) However, there is no specific mention of the "Hemi" network in the available documentation. The Hemi Network (HEMI) is an ERC-20 token on the Ethereum blockchain, (etherscan.io) so its data may be accessible through CoinGecko's Ethereum-related endpoints. For the most accurate and up-to-date information, I recommend consulting CoinGecko's official API documentation or reaching out to their support team.

Citations:


No separate CoingeckoPlatform entry needed for Hemi

Hemi is an ERC-20 token on the Ethereum blockchain, not its own chain in CoinGecko’s API. Its price data can be fetched via the existing ethereum platform entry—there is no “hemi” network to add.

  • File: packages/types/src/networks.ts
    ­– Keep using CoingeckoPlatform.Ethereum for Hemi tokens.

Likely an incorrect or invalid review comment.

packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1)

74-74: LGTM: Proper endpoint for Hemi explorer.

The Etherscan-compatible API endpoint for Hemi network has been correctly added to the NetworkEndpoints mapping.

abstract: abstractNode,
ink: inkNode,
coti: coti
hemi: hemiNode
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Fix the missing comma in the default export object.

There's a syntax error due to a missing comma after the previous property.

  ink: inkNode,
  coti: coti,
+ hemi: hemi

🏁 Script executed:

#!/bin/bash
# Description: Verify that the imported module name matches the export name

# Check the import statement
echo "Import statement:"
grep -n "import hemi" packages/extension/src/providers/ethereum/networks/index.ts

# Check the export statement
echo -e "\nExport statement:"
grep -n "hemi: " packages/extension/src/providers/ethereum/networks/index.ts

Length of output: 309


Mismatch in import/export names for hemi

The export object is referencing hemiNode (line 159) but you’ve imported it as hemi on line 74. This will throw a ReferenceError at runtime. Please align the import and export names. For example:

• Option 1 (follow the existing *Node naming convention):

-import hemi from './hemi';
+import hemiNode from './hemi';

• Option 2 (keep the default import name):

-  hemi: hemiNode
+  hemi: hemi

Also, if you’re adding more properties after hemi, don’t forget to include a trailing comma:

  coti: coti,
+ hemi: hemiNode,

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (1.9.4)

[error] 159-159: expected , but instead found hemi

Remove hemi

(parse)

Comment on lines +1 to +2
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";

Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Add missing import statements.

Several variables used in this file are not imported:

  • NetworkNames (used on line 4)
  • icon (used on line 14)
  • wrapActivityHandler and EtherscanActivity (used on line 16)
import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
+import { NetworkNames } from "@enkryptcom/types";
+import { wrapActivityHandler } from "../libs/activity-handlers";
+import { EtherscanActivity } from "../libs/activity-handlers";
+import icon from "@/providers/icons/hemi.svg";

🏁 Script executed:

#!/bin/bash
# Description: Verify if required icons and utilities are available

# Check if the NetworkNames import is available
echo "Checking NetworkNames import location:"
find packages -name "*.ts" -exec grep -l "export enum NetworkNames" {} \;

# Check if hemi icon exists
echo -e "\nChecking for hemi icon:"
find packages -path "*/providers/icons/hemi.svg" 2>/dev/null || echo "Icon not found"

# Check for wrapActivityHandler and EtherscanActivity
echo -e "\nChecking for activity handlers:"
find packages -name "*.ts" -exec grep -l "export.*wrapActivityHandler" {} \;
find packages -name "*.ts" -exec grep -l "export.*EtherscanActivity" {} \;

Length of output: 551


🏁 Script executed:

#!/bin/bash
# Inspect hemi.ts imports and usage
echo "===== packages/extension/src/providers/ethereum/networks/hemi.ts (first 80 lines) ====="
sed -n '1,80p' packages/extension/src/providers/ethereum/networks/hemi.ts

# Inspect a similar network file (mainnet.ts) for import patterns
MAINNET=$(find packages/extension/src/providers/ethereum/networks -maxdepth 1 -type f -name "*mainnet*.ts" | head -n1)
if [ -n "$MAINNET" ]; then
  echo "===== $MAINNET (first 80 lines) ====="
  sed -n '1,80p' "$MAINNET"
else
  echo "No mainnet.ts file found under the networks directory"
fi

Length of output: 1148


🏁 Script executed:

#!/bin/bash
# List all network files
echo "=== Network definition files ==="
find packages/extension/src/providers/ethereum/networks -maxdepth 1 -type f -name "*.ts"

# Search for icon imports in these files
echo -e "\n=== Icon imports in network files ==="
rg --color=never "icon" -N packages/extension/src/providers/ethereum/networks

Length of output: 19205


🏁 Script executed:

#!/bin/bash
# Locate activity-handlers.ts and inspect definitions
echo "=== Searching for activity-handlers.ts ==="
find packages -type f -name "activity-handlers.ts" -print -exec sed -n '1,50p' {} \;

echo -e "\n=== Searching for wrapActivityHandler and EtherscanActivity usages ==="
rg -n "wrapActivityHandler" -N packages
rg -n "EtherscanActivity" -N packages

echo -e "\n=== Searching for hemi icon files ==="
find packages/extension/src/providers/ethereum/networks -type f | grep -i "hemi"

Length of output: 39004


Add missing imports and icon asset

The following identifiers are used but not imported in packages/extension/src/providers/ethereum/networks/hemi.ts:

  • NetworkNames
  • icon
  • wrapActivityHandler
  • EtherscanActivity

Update the top of the file accordingly:

 import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network";
+import { NetworkNames } from "@enkryptcom/types";
+import icon from "./icons/hemi.webp";
+import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler";
+import { EtherscanActivity } from "../libs/activity-handlers";

• Ensure the icon asset exists at
packages/extension/src/providers/ethereum/networks/icons/hemi.webp

Committable suggestion skipped: line range outside the PR's diff.

@kvhnuke kvhnuke merged commit f48b2b8 into enkryptcom:devop/packeupdates-0512 May 13, 2025
2 checks passed
This was referenced May 29, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jun 14, 2025
5 tasks
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