Allow passing ENS names in function

This commit is contained in:
Alexis Sellier
2021-07-20 14:00:04 +02:00
parent cb130474bc
commit 44abcdee67
+7
View File
@@ -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),