diff --git a/platforms/src/Ens/Providers/EnsProvider.ts b/platforms/src/Ens/Providers/EnsProvider.ts index 8acc0b96ec..a8cf86e950 100644 --- a/platforms/src/Ens/Providers/EnsProvider.ts +++ b/platforms/src/Ens/Providers/EnsProvider.ts @@ -5,7 +5,10 @@ import type { RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; // ----- Credential verification import { getRPCProvider } from "../../utils/signer"; -const ENS_PUBLIC_RESOLVER = "0x231b0ee14048e9dccd1d247744d114a4eb5e8e63"; +const ENS_PUBLIC_RESOLVERS = [ + "0x231b0ee14048e9dccd1d247744d114a4eb5e8e63", + "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41", +]; // Export a Ens Provider to carry out Ens name check and return a record object export class EnsProvider implements Provider { @@ -32,7 +35,7 @@ export class EnsProvider implements Provider { if (reportedName) { const resolver = await provider.getResolver(reportedName); - if (resolver?.address?.toLowerCase() === ENS_PUBLIC_RESOLVER) { + if (ENS_PUBLIC_RESOLVERS.includes(resolver?.address?.toLowerCase())) { valid = true; record = { ens: reportedName, diff --git a/platforms/src/Ens/__tests__/EnsProvider.test.ts b/platforms/src/Ens/__tests__/EnsProvider.test.ts index 036a1ff30f..c7a003a3cc 100644 --- a/platforms/src/Ens/__tests__/EnsProvider.test.ts +++ b/platforms/src/Ens/__tests__/EnsProvider.test.ts @@ -72,6 +72,30 @@ describe("Attempt verification", function () { }); }); + it("should return true for old public resolver", async () => { + EthersGetResolverMock.mockImplementation(async (_) => { + return Promise.resolve({ + address: "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41", + } as Resolver); + }); + + const ens = new EnsProvider(); + + const verifiedPayload = await ens.verify({ + address: MOCK_ADDRESS, + } as unknown as RequestPayload); + + expect(EthersLookupAddressMock).toBeCalledWith(MOCK_ADDRESS); + + expect(verifiedPayload).toEqual({ + valid: true, + record: { + ens: MOCK_ENS, + }, + errors: [], + }); + }); + it("should return false for invalid address", async () => { EthersLookupAddressMock.mockRejectedValueOnce("Invalid Address"); const ens = new EnsProvider();