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

16 lines
416 B
TypeScript
Raw Normal View History

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