otterscan/src/api/address-resolver/ENSAddressResolver.ts

16 lines
424 B
TypeScript

import { BaseProvider } from "@ethersproject/providers";
import { IAddressResolver } from "./address-resolver";
export class ENSAddressResolver implements IAddressResolver<string> {
async resolveAddress(
provider: BaseProvider,
address: string
): Promise<string | undefined> {
const name = await provider.lookupAddress(address);
if (name === null) {
return undefined;
}
return name;
}
}