-
Notifications
You must be signed in to change notification settings - Fork 90
feat: megaeth support #778
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
2d04b0e to
8c6bf3e
Compare
| readonly _supportsMonad = true; | ||
| readonly _supportsPlasma = true; | ||
| readonly _supportsHyperEvm = true; | ||
| readonly _supportsMegaEth = true; |
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.
Because why not - those are all EVM chains
- 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
8c6bf3e to
1a893ea
Compare
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: 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.
📒 Files selected for processing (14)
packages/hdwallet-coinbase/src/coinbase.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-gridplus/src/gridplus.tspackages/hdwallet-keepkey/src/keepkey.tspackages/hdwallet-ledger/src/ledger.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-native/src/ethereum.tspackages/hdwallet-phantom/src/phantom.tspackages/hdwallet-portis/src/portis.tspackages/hdwallet-trezor/src/trezor.tspackages/hdwallet-vultisig/src/vultisig.tspackages/hdwallet-walletconnect/src/walletconnect.tspackages/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.tspackages/hdwallet-phantom/src/phantom.tspackages/hdwallet-walletconnectV2/src/walletconnectV2.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-gridplus/src/gridplus.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-native/src/ethereum.tspackages/hdwallet-portis/src/portis.tspackages/hdwallet-keepkey/src/keepkey.tspackages/hdwallet-coinbase/src/coinbase.tspackages/hdwallet-ledger/src/ledger.tspackages/hdwallet-vultisig/src/vultisig.tspackages/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.tspackages/hdwallet-phantom/src/phantom.tspackages/hdwallet-walletconnectV2/src/walletconnectV2.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-gridplus/src/gridplus.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-native/src/ethereum.tspackages/hdwallet-portis/src/portis.tspackages/hdwallet-keepkey/src/keepkey.tspackages/hdwallet-coinbase/src/coinbase.tspackages/hdwallet-vultisig/src/vultisig.tspackages/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.tspackages/hdwallet-walletconnectV2/src/walletconnectV2.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-core/src/wallet.tspackages/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.tspackages/hdwallet-walletconnectV2/src/walletconnectV2.tspackages/hdwallet-metamask-multichain/src/shapeshift-multichain.tspackages/hdwallet-core/src/wallet.tspackages/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.tspackages/hdwallet-core/src/ethereum.tspackages/hdwallet-core/src/wallet.tspackages/hdwallet-ledger/src/ledger.tspackages/hdwallet-vultisig/src/vultisig.tspackages/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.tspackages/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
supportsMegaEthtype 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 alsofalse.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
_supportsMegaEthproperty is correctly added to theETHWalletinterface, 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
truefor 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 = truefollows 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.
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
✏️ Tip: You can customize this high-level summary in your review settings.