Fix: HDNodeWalleth创建方式错误导致钱包恢复地址不一致bug修复 #189
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #188
✅ 主要变更
1. 修复 HD 钱包路径设置
将原本错误的路径 "44'/60'/0'/0" 更正为符合 BIP44 标准的路径 "m/44'/60'/0'/0"。
2. 调整 fromPhrase 的使用方式
原代码未传入完整的路径参数,本次更新中通过 ethers.HDNodeWallet.fromPhrase(mnemonic, null, basePath) 显式传入路径,确保派生地址一致性。
3. ##优化加密钱包的创建与读取逻辑
使用 HDNodeWallet.fromPhrase(...) 代替 Wallet.fromPhrase(...) 创建主钱包,保持一致性。
📦 影响范围
• HDNodeWallet 创建与派生逻辑
• 加密钱包的导出与导入逻辑
🧪 测试说明
• 能正确导出加密 JSON,并用密码恢复钱包。
• 所有钱包地址与预期路径匹配。