Add HEMI Network#688
Conversation
PR - Add Hemi Network
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (3)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA 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
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
Possibly related PRs
Suggested reviewers
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
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:
- The correct chain ID for the Hemi Network mainnet is 43111[1][2][3][5][6][7].
- Currency symbol: ETH
- RPC URL: https://rpc.hemi.network/rpc
Testnet (Hemi Sepolia):
- The chain ID for the Hemi Network testnet (Hemi Sepolia) is 743111[1][4][6].
- Currency symbol: ETH
- RPC URL: https://testnet.rpc.hemi.network/rpc
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:
- 1: https://docs.hemi.xyz/main/network-details
- 2: https://metaschool.so/rpc/hemiNetwork
- 3: https://chainlist.org
- 4: https://chainid.network/chain/743111/
- 5: https://www.datawallet.com/crypto/add-hemi-to-metamask
- 6: https://docs.hemi.xyz/how-to-tutorials/using-hemi/wallet-setup/metamask-wallet-setup
- 7: https://chainlist.wtf
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 aswss://rpc.hemi.network/wsrpc
• Official docs list the HTTP RPC athttps://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
📒 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:
- 1: https://support.coingecko.com/hc/en-us/articles/42662329362585-What-blockchain-network-do-you-support-in-the-CoinGecko-API?utm_source=openai
- 2: https://etherscan.io/token/0x5dc4cf402e19a47b9378fe0fafc650444c174dbd?utm_source=openai
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
ethereumplatform entry—there is no “hemi” network to add.
- File:
packages/types/src/networks.ts
– Keep usingCoingeckoPlatform.Ethereumfor 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 |
There was a problem hiding this comment.
💡 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.tsLength 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: hemiAlso, 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)
| import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; | ||
|
|
There was a problem hiding this comment.
💡 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)wrapActivityHandlerandEtherscanActivity(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"
fiLength 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/networksLength 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:
NetworkNamesiconwrapActivityHandlerEtherscanActivity
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.
PR - Add Hemi Network
Summary by CodeRabbit
New Features
Chores