@openocean.finance/widget-sdk
Version:
OpenOcean Any-to-Any Cross-Chain-Swap SDK
19 lines (17 loc) • 487 B
text/typescript
import { ChainId } from '@openocean.finance/widget-types'
import { getEnsAddress, normalize } from 'viem/ens'
import { getPublicClient } from './publicClient.js'
export const getENSAddress = async (
name: string
): Promise<string | undefined> => {
try {
const client = await getPublicClient(ChainId.ETH)
const address = await getEnsAddress(client, {
name: normalize(name),
})
return address as string | undefined
} catch (_) {
// ignore
return
}
}