1

I don't think this is correct for standard names and also neglects premium names.

https://developers.eos.io/eosio-cpp/docs/naming-conventions

I came up with this, please let me know if it is incorrect:

Non Premium Account Names (gu3tambwg3ge):

Can only contain the characters abcdefghijklmnopqrstuvwxyz12345 a-z (lowercase), 1-5
Must be 12 characters

Excluded:

Must start with a letter - https://bloks.io/account/1b5gii3jjnz2
Must not end in a dot - cannot have a dot at all unless premium
and . (period) - cannot have a dot

Premium Account Names (xyz.xyz)

Can only contain the characters .abcdefghijklmnopqrstuvwxyz12345 a-z (lowercase), 1-5 and . (period)
12 characters max
1 characters min (Todd says premium names can start with a dot)
Must not end in a dot

This is a valid premium name: ....a..a.a ~ Todd

https://bloks.io/account/.a.p.p.l.e

https://bloks.io/account/e

1 Answer 1

1

You can use:

const validateEos = (address) => {
    // can make lowercase:
    if(address.match(/[A-Z]/)) address = address.toLowerCase();

    if(!/^[a-z1-5.]+$/.test(address)) {
        console.log('Contains an invalid character')
        return false;
    }
    if(address.match(/[.]/i)) {
        if(address.length !== 12) {
            console.log('Non premium name must be 12 characters')
            return false;
        }
    }
    if(address.slice(-1) === '.') {
        console.log('Premium name cannot end with "."')
        return false;
    }
    return true;
};

export default validateEos;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.