ens_normalize 1.0.0 copy "ens_normalize: ^1.0.0" to clipboard
ens_normalize: ^1.0.0 copied to clipboard

Ethereum Name Service (ENS) Name Normalizer adapted from namehash/ens-normalize-python and adraffy/ens-normalize.js.

ENS Normalize Dart #

Contraints #

Uses Dart Isolates to spawn NORMALIZATION in a separate thread. Causing the use of Future for asynchronously declaring the base class.

Getting started #

dart pub add ens_normalize

Usage #

import 'package:ens_normalize/ens_normalize.dart';

void main() async {
    ENSNormalize ensn = await ENSNormalize.getInstance();

    ensn.ensNormalize('Nick.ETH')
    // 'nick.eth'

    ensn.isEnsNormalizable('Nick.ETH')
    // True

    ensn.ensCure('Ni‍ck?.ETH')
    // 'nick.eth'
    // ZWJ and '?' are removed, no error is raised

    ensn.ensBeautify('1⃣2⃣.eth')
    // '1️⃣2️⃣.eth'

    ensn.ensTokenize('Nàme‍🧙‍♂.eth')
    // [TokenMapped(cp=78, cps=[110], type='mapped'),
    //  TokenNFC(input=[97, 768], cps=[224], type='nfc'),
    //  TokenValid(cps=[109, 101], type='valid'),
    //  TokenDisallowed(cp=8205, type='disallowed'),
    //  TokenEmoji(emoji=[129497, 8205, 9794, 65039],
    //             input=[129497, 8205, 9794],
    //             cps=[129497, 8205, 9794],
    //             type='emoji'),
    //  TokenStop(cp=46, type='stop'),
    //  TokenValid(cps=[101, 116, 104], type='valid')]

    ensn.ensNormalizations('Nàme🧙‍♂️.eth')
    // [NormalizableSequence(code="MAPPED", index=0, sequence="N", suggested="n"),
    //  NormalizableSequence(code="FE0F", index=4, sequence="🧙‍♂️", suggested="🧙‍♂")]

    // use only the do_* flags you need
    ensn.ensProcess("Nàme🧙‍♂️1⃣.eth",
    doNormalize=True,
    doBeautify=True,
    doTokenize=True,
    doNormalizations=True,
    doCure=True,
    )
}
2
likes
0
pub points
55%
popularity

Publisher

verified publishervariance.space

Ethereum Name Service (ENS) Name Normalizer adapted from namehash/ens-normalize-python and adraffy/ens-normalize.js.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

tuple, unorm_dart

More

Packages that depend on ens_normalize