From 44abcdee679b25caa4a1cac1e0664c96eaac75b5 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Tue, 20 Jul 2021 13:59:41 +0200 Subject: [PATCH] Allow passing ENS names in function --- src/profile.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/profile.ts b/src/profile.ts index cb591c83c..b988bc9b6 100644 --- a/src/profile.ts +++ b/src/profile.ts @@ -1,3 +1,4 @@ +import { ethers } from "ethers"; import type { Registration } from "@app/base/registrations/registrar"; import type { BasicProfile } from "@ceramicstudio/idx-constants"; import { @@ -63,6 +64,12 @@ export class Profile { private static async lookupAddress(address: string, config: Config): Promise<[IProfile, string]> { const profile: IProfile = { ens: null, idx: null }; + try { + address = ethers.utils.getAddress(address); + } catch { + address = await config.provider.resolveName(address); + } + try { const [ens, idx] = await Promise.allSettled([ resolveEnsProfile(address, config),