Skip to content

Commit 274e71e

Browse files
EOS account name should be less than 12 characters, and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz
1 parent c1ac682 commit 274e71e

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

dist/wallet-address-validator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12575,8 +12575,10 @@ module.exports = {
1257512575

1257612576
},{"./crypto/utils":52}],55:[function(require,module,exports){
1257712577
function isValidEOSAddress (address, currency, networkType) {
12578-
var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only
12579-
if (address.search(regex) !== -1 && address.length === 12) {
12578+
// EOS account name should be less than 12 characters,
12579+
// and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz
12580+
var regex = /^[.1-5a-z]{1,12}$/g
12581+
if (address.search(regex) !== -1) {
1258012582
return true
1258112583
} else {
1258212584
return false

dist/wallet-address-validator.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/eos_validator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
function isValidEOSAddress (address, currency, networkType) {
2-
var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only
3-
if (address.search(regex) !== -1 && address.length === 12) {
2+
// EOS account name should be less than 12 characters,
3+
// and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz
4+
var regex = /^[.1-5a-z]{1,12}$/g
5+
if (address.search(regex) !== -1) {
46
return true
57
} else {
68
return false

test/wallet_address_validator.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,9 @@ describe('WAValidator.validate()', function () {
625625
it('should return true for correct eos addresses', function () {
626626
valid('bittrexacct1', 'eos');
627627
valid('binancecleos', 'eos');
628-
valid('123456789012', 'eos');
629-
valid('12345678.012', 'eos');
628+
valid('abcdefz12345', 'eos');
629+
valid('abcdefz.123', 'eos');
630+
valid('abcdefz.123', 'eos');
630631
});
631632

632633
it('should return true for correct vet addresses', function () {
@@ -1201,6 +1202,10 @@ describe('WAValidator.validate()', function () {
12011202
invalid('1234567890123', 'eos');
12021203
invalid('12345678901', 'eos');
12031204
invalid('12345678901@', 'eos');
1205+
invalid('Abcdefg12345', 'eos');
1206+
invalid('Zbcdefg12345', 'eos');
1207+
invalid('abcdefg0234', 'eos');
1208+
invalid('abcdefg1236', 'eos');
12041209
});
12051210

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

0 commit comments

Comments
 (0)