Skip to content
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

EOS name should be less than 12 characters, and only contain the foll… #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dist/wallet-address-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12575,8 +12575,10 @@ module.exports = {

},{"./crypto/utils":52}],55:[function(require,module,exports){
function isValidEOSAddress (address, currency, networkType) {
var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only
if (address.search(regex) !== -1 && address.length === 12) {
// EOS account name should be less than 12 characters,
// and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz
var regex = /^[.1-5a-z]{1,12}$/g
if (address.search(regex) !== -1) {
return true
} else {
return false
Expand Down
2 changes: 1 addition & 1 deletion dist/wallet-address-validator.min.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/eos_validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
function isValidEOSAddress (address, currency, networkType) {
var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only
if (address.search(regex) !== -1 && address.length === 12) {
// EOS account name should be less than 12 characters,
// and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz
var regex = /^[.1-5a-z]{1,12}$/g
if (address.search(regex) !== -1) {
return true
} else {
return false
Expand Down
9 changes: 7 additions & 2 deletions test/wallet_address_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,9 @@ describe('WAValidator.validate()', function () {
it('should return true for correct eos addresses', function () {
valid('bittrexacct1', 'eos');
valid('binancecleos', 'eos');
valid('123456789012', 'eos');
valid('12345678.012', 'eos');
valid('abcdefz12345', 'eos');
valid('abcdefz.123', 'eos');
valid('abcdefz.123', 'eos');
});

it('should return true for correct vet addresses', function () {
Expand Down Expand Up @@ -1201,6 +1202,10 @@ describe('WAValidator.validate()', function () {
invalid('1234567890123', 'eos');
invalid('12345678901', 'eos');
invalid('12345678901@', 'eos');
invalid('Abcdefg12345', 'eos');
invalid('Zbcdefg12345', 'eos');
invalid('abcdefg0234', 'eos');
invalid('abcdefg1236', 'eos');
});

it('should return false for incorrect solana addresses', function () {
Expand Down