Skip to content

Commit

Permalink
EOS name should be less than 12 characters, and only contain the foll…
Browse files Browse the repository at this point in the history
…owing symbols .12345abcdefghijklmnopqrstuvwxyz
  • Loading branch information
learnforpractice committed Mar 9, 2023
1 parent c1ac682 commit 8da7184
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
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 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 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

0 comments on commit 8da7184

Please sign in to comment.