Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 3, 2026

Does what it says on the box

Web fren in shapeshift/web#11563, though, as MegaETH is currently in testnet (we're whitelisted for mainnet and will need to update web PR once ready), worth merging this as-is, this only add support flags.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added MegaEth support capability detection for wallet integrations, enabling the system to identify which wallets support MegaEth functionality.
    • Enhanced wallet compatibility layer with MegaEth support indicators across multiple wallet providers.
    • Select wallet implementations now include MegaEth support.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hdwallet Ready Ready Preview, Comment Jan 3, 2026 0:03am

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

📝 Walkthrough

Walkthrough

A new _supportsMegaEth capability flag is added to the HDWallet ecosystem across multiple wallet implementations and interfaces. The flag defaults to false for most wallets (Coinbase, KeepKey, Phantom, Portis, Vultisig, WalletConnect) and true for others (GridPlus, Ledger, MetaMaskMultiChain, Native, Trezor, WalletConnectV2). A corresponding type guard function and interface property are introduced in the core package.

Changes

Cohort / File(s) Summary
Core interfaces and type guards
packages/hdwallet-core/src/ethereum.ts, packages/hdwallet-core/src/wallet.ts
Added _supportsMegaEth: boolean property to ETHWallet interface; introduced new supportsMegaEth() type guard function to detect MegaEth support on HDWallet instances.
Implementations enabling MegaEth support
packages/hdwallet-gridplus/src/gridplus.ts, packages/hdwallet-ledger/src/ledger.ts, packages/hdwallet-native/src/ethereum.ts, packages/hdwallet-trezor/src/trezor.ts, packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
Added _supportsMegaEth = true capability flag to wallet classes and info classes; GridPlus also updated _supportsMonad, _supportsPlasma, and _supportsHyperEvm from false to true.
MetaMask multichain implementation
packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
Added _supportsMegaEth = true to both MetaMaskMultiChainHDWalletInfo and MetaMaskMultiChainHDWallet classes.
Implementations without MegaEth support
packages/hdwallet-coinbase/src/coinbase.ts, packages/hdwallet-keepkey/src/keepkey.ts, packages/hdwallet-phantom/src/phantom.ts, packages/hdwallet-portis/src/portis.ts, packages/hdwallet-vultisig/src/vultisig.ts, packages/hdwallet-walletconnect/src/walletconnect.ts
Added _supportsMegaEth = false capability flag to wallet classes and info classes as appropriate.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • NeOMakinG

Poem

🐰 A flag for MegaEth hops across the land,
True here, false there—we've got it all planned,
Ledger and Trezor, they're ready to shine,
While others hold steady, drawn by design,
Type guards now guard what wallets can do! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: megaeth support' accurately and directly describes the main change: adding MegaETH support flags across multiple wallet implementations.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_megaEth

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@gomesalexandre gomesalexandre force-pushed the feat_megaEth branch 2 times, most recently from 2d04b0e to 8c6bf3e Compare January 3, 2026 11:56
Comment on lines +313 to +316
readonly _supportsMonad = true;
readonly _supportsPlasma = true;
readonly _supportsHyperEvm = true;
readonly _supportsMegaEth = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because why not - those are all EVM chains

@gomesalexandre gomesalexandre marked this pull request as ready for review January 3, 2026 11:57
@gomesalexandre gomesalexandre requested a review from a team as a code owner January 3, 2026 11:57
- Add _supportsMegaEth flag to ETHWallet interface
- Add supportsMegaEth() function to wallet.ts
- Enable MegaETH for: native, ledger, trezor, walletconnectV2, metamask-multichain, gridplus, walletconnect (v1)
- Disable MegaETH for: portis, keepkey, vultisig, coinbase, phantom
- Enable all second-class EVM chains for GridPlus and WalletConnect v1
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: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c716c4c and 1a893ea.

📒 Files selected for processing (14)
  • packages/hdwallet-coinbase/src/coinbase.ts
  • packages/hdwallet-core/src/ethereum.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-gridplus/src/gridplus.ts
  • packages/hdwallet-keepkey/src/keepkey.ts
  • packages/hdwallet-ledger/src/ledger.ts
  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
  • packages/hdwallet-native/src/ethereum.ts
  • packages/hdwallet-phantom/src/phantom.ts
  • packages/hdwallet-portis/src/portis.ts
  • packages/hdwallet-trezor/src/trezor.ts
  • packages/hdwallet-vultisig/src/vultisig.ts
  • packages/hdwallet-walletconnect/src/walletconnect.ts
  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-ledger/src/ledger.ts:403-405
Timestamp: 2025-12-12T11:19:53.179Z
Learning: In packages/hdwallet-ledger/src/ethereum.ts, the ethSupportsNetwork function is a legacy/unused function that only returns true for chainId === 1. The Ledger ETH module does not call ethSupportsNetwork to validate chain support during signing operations - it accepts any chainId passed in the ETHSignTx message directly, so chain support flags can be enabled without needing to update ethSupportsNetwork.
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.
📚 Learning: 2025-12-12T11:19:53.263Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:19:53.263Z
Learning: In the shapeshift/hdwallet monorepo, remove reliance on ethSupportsNetwork() across wallet implementations. This legacy method is no longer used to determine chain support. Instead, rely on the wallet class flags like _supportsMonad, _supportsPlasma, _supportsHyperEvm. Review all wallet implementations for ethSupportsNetwork() usage and migrate checks to the corresponding _supports* flags, updating tests and any affected logic accordingly.

Applied to files:

  • packages/hdwallet-walletconnect/src/walletconnect.ts
  • packages/hdwallet-phantom/src/phantom.ts
  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
  • packages/hdwallet-gridplus/src/gridplus.ts
  • packages/hdwallet-core/src/ethereum.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-native/src/ethereum.ts
  • packages/hdwallet-portis/src/portis.ts
  • packages/hdwallet-keepkey/src/keepkey.ts
  • packages/hdwallet-coinbase/src/coinbase.ts
  • packages/hdwallet-ledger/src/ledger.ts
  • packages/hdwallet-vultisig/src/vultisig.ts
  • packages/hdwallet-trezor/src/trezor.ts
📚 Learning: 2025-12-12T11:19:53.179Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-ledger/src/ledger.ts:403-405
Timestamp: 2025-12-12T11:19:53.179Z
Learning: In packages/hdwallet-ledger/src/ethereum.ts, the ethSupportsNetwork function is a legacy/unused function that only returns true for chainId === 1. The Ledger ETH module does not call ethSupportsNetwork to validate chain support during signing operations - it accepts any chainId passed in the ETHSignTx message directly, so chain support flags can be enabled without needing to update ethSupportsNetwork.

Applied to files:

  • packages/hdwallet-walletconnect/src/walletconnect.ts
  • packages/hdwallet-phantom/src/phantom.ts
  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
  • packages/hdwallet-gridplus/src/gridplus.ts
  • packages/hdwallet-core/src/ethereum.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-native/src/ethereum.ts
  • packages/hdwallet-portis/src/portis.ts
  • packages/hdwallet-keepkey/src/keepkey.ts
  • packages/hdwallet-coinbase/src/coinbase.ts
  • packages/hdwallet-vultisig/src/vultisig.ts
  • packages/hdwallet-trezor/src/trezor.ts
📚 Learning: 2025-08-07T15:47:29.207Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger/src/transport.ts:10-10
Timestamp: 2025-08-07T15:47:29.207Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the code works locally without TypeScript errors but has issues in CI environment. Using ts-expect-error would fail locally since there are no actual errors to suppress.

Applied to files:

  • packages/hdwallet-walletconnect/src/walletconnect.ts
  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-ledger/src/ledger.ts
📚 Learning: 2025-08-07T15:47:26.835Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger-webusb/src/transport.ts:12-12
Timestamp: 2025-08-07T15:47:26.835Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the CI environment has different type checking behavior than local development. The code works locally without errors, but CI reports type issues, so ts-ignore is necessary to suppress the inconsistent type checking across environments.

Applied to files:

  • packages/hdwallet-walletconnect/src/walletconnect.ts
  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-ledger/src/ledger.ts
📚 Learning: 2025-11-20T11:04:44.808Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 737
File: packages/hdwallet-trezor/src/ethereum.ts:122-138
Timestamp: 2025-11-20T11:04:44.808Z
Learning: In packages/hdwallet-trezor/src/ethereum.ts, the ethSignTypedData function correctly returns the signature from res.payload.signature without adding a "0x" prefix. This works correctly in practice and has been tested, despite appearing inconsistent with ethSignMessage which does add the prefix. The Trezor Connect ethereumSignTypedData response already provides the signature in the correct format for consumption.

Applied to files:

  • packages/hdwallet-walletconnectV2/src/walletconnectV2.ts
  • packages/hdwallet-core/src/ethereum.ts
  • packages/hdwallet-core/src/wallet.ts
  • packages/hdwallet-ledger/src/ledger.ts
  • packages/hdwallet-vultisig/src/vultisig.ts
  • packages/hdwallet-trezor/src/trezor.ts
📚 Learning: 2025-12-24T17:35:53.100Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 774
File: packages/hdwallet-native/src/starknet.ts:16-18
Timestamp: 2025-12-24T17:35:53.100Z
Learning: In packages/hdwallet-native/src/ chain implementation files (e.g., tron.ts, sui.ts, solana.ts, starknet.ts), the `NextAccountPath()` methods in WalletInfo mixins conventionally throw `new Error("Method not implemented")`. This is an intentional pattern across chain families and these methods are unused.

Applied to files:

  • packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts
📚 Learning: 2025-10-15T23:22:26.842Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 731
File: packages/hdwallet-gridplus/src/thormaya.ts:99-105
Timestamp: 2025-10-15T23:22:26.842Z
Learning: In packages/hdwallet-gridplus/src/thormaya.ts, the GridPlus SDK (gridplus-sdk) automatically pads the r and s signature components to 32 bytes, so explicit padding in the code may be redundant but is not required. The thorchainSignTx implementation works without explicit padding because the SDK handles it.

Applied to files:

  • packages/hdwallet-gridplus/src/gridplus.ts
📚 Learning: 2025-10-14T20:59:48.768Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 731
File: packages/hdwallet-gridplus/src/ethereum.ts:117-124
Timestamp: 2025-10-14T20:59:48.768Z
Learning: In packages/hdwallet-gridplus/src/ethereum.ts, the GridPlus SDK's sign method returns v as a number (integer), not a Buffer, so the Buffer.isBuffer(v) check is always false and vRaw = v is used directly.

Applied to files:

  • packages/hdwallet-gridplus/src/gridplus.ts
  • packages/hdwallet-vultisig/src/vultisig.ts
📚 Learning: 2025-12-24T17:35:44.759Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 774
File: packages/hdwallet-native/src/starknet.ts:16-18
Timestamp: 2025-12-24T17:35:44.759Z
Learning: In the files under packages/hdwallet-native/src (e.g., tron.ts, sui.ts, solana.ts, starknet.ts), the NextAccountPath() methods in WalletInfo mixins intentionally throw new Error("Method not implemented"). These methods exist as placeholders and are not used by the chain implementations. Treat these methods as intentionally non-operational: do not call them, and consider removing or documenting them to avoid confusion. This guideline applies broadly to all chain implementation files in this directory.

Applied to files:

  • packages/hdwallet-native/src/ethereum.ts
📚 Learning: 2025-12-12T11:19:46.121Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-ledger/src/ledger.ts:403-405
Timestamp: 2025-12-12T11:19:46.121Z
Learning: In packages/hdwallet-ledger/src/ledger.ts, the ethSupportsNetwork function is a legacy/unused helper that only returns true for chainId === 1. The Ledger ETH module does not validate chain support during signing; it accepts any chainId provided in the ETHSignTx message. Therefore, consider removing ethSupportsNetwork or deprecating it, and avoid relying on it to gate chain support. If kept for compatibility, add a clear comment and update tests to reflect that chain support is determined elsewhere (e.g., in the signing path) instead of this function.

Applied to files:

  • packages/hdwallet-ledger/src/ledger.ts
🧬 Code graph analysis (1)
packages/hdwallet-core/src/wallet.ts (1)
packages/hdwallet-core/src/ethereum.ts (1)
  • ETHWallet (197-220)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Release
🔇 Additional comments (13)
packages/hdwallet-core/src/wallet.ts (1)

183-186: LGTM!

The supportsMegaEth type guard follows the established pattern used by other chain support checks (e.g., supportsMonad, supportsPlasma, supportsHyperEvm). Implementation is consistent and correct.

packages/hdwallet-trezor/src/trezor.ts (1)

290-290: LGTM!

MegaETH support flag correctly added to TrezorHDWallet. Based on learnings, the _supports* flags are the canonical way to indicate chain support, making this change sufficient for enabling MegaETH on Trezor.

packages/hdwallet-coinbase/src/coinbase.ts (1)

113-113: LGTM!

MegaETH support correctly disabled for Coinbase wallet, consistent with other second-class EVM chain flags (_supportsMonad, _supportsPlasma, _supportsHyperEvm) which are also false.

packages/hdwallet-keepkey/src/keepkey.ts (1)

549-549: LGTM!

MegaETH support correctly disabled for KeepKey wallet, aligning with other second-class EVM chains (_supportsMonad, _supportsPlasma, _supportsHyperEvm) which are also disabled.

packages/hdwallet-core/src/ethereum.ts (1)

211-211: LGTM!

The _supportsMegaEth property is correctly added to the ETHWallet interface, following the established pattern for other EVM chain capability flags. This provides type safety ensuring all implementing wallets declare their MegaETH support status.

packages/hdwallet-walletconnectV2/src/walletconnectV2.ts (1)

153-153: LGTM!

MegaETH support correctly enabled for WalletConnectV2, consistent with other second-class EVM chain support flags which are all true for this wallet implementation.

packages/hdwallet-portis/src/portis.ts (1)

138-138: LGTM!

MegaETH support correctly disabled for Portis wallet, consistent with other second-class EVM chain flags which are all false.

packages/hdwallet-native/src/ethereum.ts (1)

67-67: LGTM!

The MegaETH support flag is correctly enabled for the Native wallet, consistent with the PR objectives.

packages/hdwallet-ledger/src/ledger.ts (1)

420-420: LGTM!

The MegaETH support flag is correctly enabled for the Ledger wallet, consistent with the PR objectives.

packages/hdwallet-vultisig/src/vultisig.ts (1)

215-215: LGTM!

The MegaETH support flag is correctly disabled for the Vultisig wallet, consistent with the PR objectives.

packages/hdwallet-phantom/src/phantom.ts (1)

204-204: LGTM!

The MegaETH support flag is correctly disabled for the Phantom wallet, consistent with the PR objectives.

packages/hdwallet-metamask-multichain/src/shapeshift-multichain.ts (1)

290-290: LGTM! MegaETH support flag added correctly.

The addition of _supportsMegaEth = true follows the established pattern for EVM chain support flags and is placed appropriately alongside other second-class EVM chain flags.

packages/hdwallet-gridplus/src/gridplus.ts (1)

313-316: LGTM! Second-class EVM chain support enabled for GridPlus.

The addition of MegaETH support alongside enabling Monad, Plasma, and HyperEVM is consistent with the PR's objective. As noted previously, GridPlus can support these EVM chains.

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