ethers.js/src.ts/_tests/test-providers-wildcard.ts

35 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-09-16 05:20:48 +03:00
import assert from "assert";
import { connect, setupProviders } from "./create-provider.js";
setupProviders();
2022-09-16 05:20:48 +03:00
describe("Test EIP-2544 ENS wildcards", function() {
const provider = connect("sepolia");
2022-09-16 05:20:48 +03:00
it("Resolves recursively", async function() {
this.timeout(10000);
2022-09-16 05:20:48 +03:00
const resolver = await provider.getResolver("ricmoose.hatch.eth");
assert.ok(resolver, "failed to get resolver");
assert.equal(resolver.address, "0x657D81B1E647A56457ff035Af22898411673f7FD", "address");
2022-09-16 05:20:48 +03:00
assert.equal(await resolver.supportsWildcard(), true, "supportsWildcard()");
// Test pass-through avatar
assert.equal(await resolver.getAvatar(), "https:/\/static.ricmoo.com/uploads/profile-06cb9c3031c9.jpg", "getAvatar()");
assert.equal(await resolver.getAddress(), "0xF0d6e3fC0f5A23aAAA4933700438b6313Dd331bD", "getAddress()");
2022-09-16 05:20:48 +03:00
});
});
describe("Test ENS-DNS gasless resolver", function() {
it("Resolved almonit.org", async function() {
this.timeout(10000);
const provider = connect("mainnet");
const addr = await provider.resolveName("almonit.org");
assert.equal(addr, "0x0D59d0f7DcC0fBF0A3305cE0261863aAf7Ab685c", "addr");
});
});