-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add EthKeyringWrapper for common Eth logic around KeyringV2 implementation
#404
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
Conversation
6944620 to
e75db9c
Compare
EthKeyringWrapper for common Eth logicEthKeyringWrapper for common Eth logic around KeyringV2 implementation
| * @returns The result of the signing operation. | ||
| */ | ||
| async submitRequest(request: KeyringRequest): Promise<Json> { | ||
| const { method, params } = request.request; |
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.
Bug: Missing default value for params may cause unexpected errors
The params destructuring lacks a default value. The previous implementation in HdKeyringV2.submitRequest used const { method, params = [] } = request.request; but EthKeyringWrapper uses const { method, params } = request.request;. Since params is defined as exactOptional in KeyringRequestStruct, requests without params are valid and will result in params being undefined. This could cause confusing validation errors when assert is called on undefined instead of an empty array.
Related to: https://consensyssoftware.atlassian.net/browse/MUL-1316
Examples
Note
Introduces
EthKeyringWrapperwith shared EthereumsubmitRequestlogic and updatesHdKeyringV2to extend it, adding RPC param structs, anEthKeyringalias, tests, and required deps.eth/v2/EthKeyringWrapperabstract class with common Ethereum request routing (submitRequest) andEthKeyringMethodenum.EthGetEncryptionPublicKeyOptionsStructandEthGetEncryptionPublicKeyParamsStruct(address, optional options).eth/v2and include new wrapper ineth/index.@ethereumjs/txand@metamask/eth-sig-util.HdKeyringV2now extendsEthKeyringWrapper; removes duplicate routing, uses shared methods list including encryption/app-key/EIP-7702.eth_getEncryptionPublicKeyand align with wrapper behavior.EthKeyringWrapper.EthKeyringtype alias for legacyKeyring.Written by Cursor Bugbot for commit 22051b5. This will update automatically on new commits. Configure here.