@blockchain-lab-um/masca-connector
Version:
Library for using Masca on the frontend
23 lines (20 loc) • 527 B
JavaScript
import { createPublicClient, custom } from 'viem';
import { mainnet } from 'viem/chains';
// src/ViemClient.ts
var ViemClient = class {
constructor(params) {
const { provider } = params;
this.client = createPublicClient({
chain: mainnet,
transport: custom(provider)
});
}
async getEns(params) {
const { address } = params;
const name = await this.client.getEnsName({ address });
if (!name)
throw new Error("ENS name not found.");
return name;
}
};
export { ViemClient };