Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENSUtils.normalize does not follow ENSIP-15 #9

Open
bobwith2bees opened this issue Mar 20, 2024 · 0 comments
Open

ENSUtils.normalize does not follow ENSIP-15 #9

bobwith2bees opened this issue Mar 20, 2024 · 0 comments

Comments

@bobwith2bees
Copy link

In lib/src/utils.dart, the existing normalize method returns the same string passed. This could lead to failed lookups. I've included the suggested revisions below. Since this requires adding a package dependency, I will defer to the project owner on whether to include the change. This could be captured in documentation (for users to do their own normalizations) before calling ens_dart.

lib/src/utils.dart

   static String normalize(String name) {
    // ENS names are validated and normalized using the ENSIP-15 normalization algorithm.
    // https://docs.ens.domains/ensip/15
    // Provided by package ens_normalize: ^1.0.4
    ENSNormalize ensn = ENSNormalize();
    return (ensn.normalize(name));
  }

test/ens_dart_test.dart (showing how it could be used in a call)

    test('.getname on non-normalized name', () async {
      final address = await ens.withName(ENSUtils.normalize('CoinBase.eTh')).getAddress();      
    expect(address, EthereumAddress.fromHex('0x17f74532a45e7b16a9620e4bc84924916a9cf45a'));
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant