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

Ethereum Name Service (ENS) Name Normalizer adapted from namehash labs and adraffy.

ENS Normalize Dart #

Getting started #

dart pub add ens_normalize

Usage #

import 'package:ens_normalize/ens_normalize.dart';


void main() async {
  ENSNormalize ensn = await ENSNormalize.getInstance(); // parses normalization in separate Isolate
  // OR
  ENSNormalize ensn = ENSNormalize(); // Passes normalization synchronously

  ensn.normalize('Nick.ETH');
  // nick.eth

  ensn.isNormalizable('Nick.ETH');
  // true

  ensn.cure('Ni‍ck?.ETH');
  // nick.eth

  ensn.beautify('1⃣2⃣.eth');
// 1️⃣2️⃣.eth

  ensn.tokenize('Nàme‍🧙‍♂.eth');
// [
// Instance of 'TokenMapped',
// Instance of 'TokenNFC',
// Instance of 'TokenValid',
// Instance of 'TokenDisallowed',
// Instance of 'TokenEmoji',
// Instance of 'TokenStop',
// Instance of 'TokenValid']

  ensn.normalizations('Nàme🧙‍♂️.eth');
  // [
  // NormalizableSequence(code="NormalizableSequenceType", index=0, sequence="N", suggested="n"),
  // NormalizableSequence(code="NormalizableSequenceType", index=1, sequence="🧙‍♂️", suggested="🧙‍♂")
  // ]

  ensn.ensProcess(
    "Nàme🧙‍♂️1⃣.eth",
    doNormalize: true,
    doBeautify: true,
    doTokenize: true,
    doNormalizations: true,
    doCure: true,
  );
  // Instance of 'ENSProcessResult'
}
2
likes
0
pub points
55%
popularity

Publisher

verified publishervariance.space

Ethereum Name Service (ENS) Name Normalizer adapted from namehash labs and adraffy.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

freezed_annotation, json_annotation, tuple, unorm_dart

More

Packages that depend on ens_normalize