-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add isEthereumAddress #1117
Add isEthereumAddress #1117
Conversation
@hizkifw if I get some time, I will review this work. |
Basic validation for Ethereum addresses
51e95ef
to
12cb8ee
Compare
@@ -0,0 +1,8 @@ | |||
import assertString from './util/assertString'; | |||
|
|||
const eth = /^(0x)[0-9a-f]{40}$/i; |
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.
I am just asking, don't we have any capitalize/uppercase for Ethereum Address
?
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.
Ethereum addresses can be either all-caps or all-lower, which is why I added the /i
flag to mark the regex as case insensitive. Addresses with mixed casing (e.g. 0xdAC17F958D2ee523a2206206994597C13D831ec7
) contain checksum information to make sure it's correct, but they require additional dependencies to compute and check.
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.
LGTM, thanks for the PR 🎉
Just fix the merge conflicts and we should be ready to land.
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.
So many unrelated changes, please unstage.
es/index.js
Outdated
@@ -23,6 +23,7 @@ import isFullWidth from './lib/isFullWidth'; | |||
import isHalfWidth from './lib/isHalfWidth'; | |||
import isVariableWidth from './lib/isVariableWidth'; | |||
import isMultibyte from './lib/isMultibyte'; | |||
import isSemVer from './lib/isSemVer'; |
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.
remove the unrelated changes...
07e5825
to
cef7a77
Compare
This PR adds basic validation for Ethereum addresses. Checksums are not validated to avoid dependencies.