Uh oh!
There was an error while loading. Please reload this page.
feat: break out address checksum encoding to erc55EncodeAddress function - #113
Conversation
Mrtenz
left a comment
There was a problem hiding this comment.
Can you add tests for this function? EIP-55 has some test cases which we can use.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mikesposito
commented
Jul 11, 2023
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 |
Mrtenz
commented
Jul 11, 2023
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.