ENSUtils.normalize does not follow ENSIP-15
Opened this issue · 0 comments
bobwith2bees commented
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'));
});