-
-
Notifications
You must be signed in to change notification settings - Fork 14
feat: break out address checksum encoding to erc55EncodeAddress function #113
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
feat: break out address checksum encoding to erc55EncodeAddress function #113
Conversation
Mrtenz
left a comment
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.
Can you add tests for this function? EIP-55 has some test cases which we can use.
|
The only significant difference I can note is that we now calculate the entire hash and then we compare it, instead of early terminating the function on the first wrong char. But that isn't necessarily a bad thing |
The difference in performance is probably negligible? |
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
* feat: add isValidHexAddress function * fix: accept only prefixed addresses * fix: remove case insensitive flag * test: add test case for 0X * feat: validate checksum addresses * feat: break out address checksum encoding to erc55EncodeAddress function (#113) * feat: break out address checksum encoding to erc55EncodeAddress function * deps: ethereum-cryptography@2.0.0->2.1.0; dedupe @noble/hashes * Update jsdoc Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com> * refactor: rename erc55EncodeAddress function * test: add test cases for getChecksumAddress --------- Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com> Co-authored-by: Michele Esposito <michele@esposito.codes> * docs: edit isValidHexAddress jsdoc description * Update src/hex.ts Co-authored-by: Mark Stacey <markjstacey@gmail.com> * fix: add validation assertions --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com> Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Targeting #112
IMO this improves readability.