/// import { ethers, providers } from 'ethers'; import { Buffer } from 'buffer'; import { Network } from './types/common'; type NameConfig = { name: string; provider: providers.BaseProvider; registry: ethers.Contract; network: Network; signer?: ethers.Signer; }; type Feature = 'address' | 'contentHash' | 'dns' | 'txt'; export default class DWEBName { readonly name: string; readonly namehash: string; readonly network: Network; /** * Contains flags for features supported by the name on the network where it is located. */ readonly features: Record; private readonly provider; private readonly registryContract; private readonly signer?; private resolverAddress?; constructor(options: NameConfig); getOwner(): Promise; hasResolver(): Promise; /** * Get expiration date of the domain. Returns null if the domain has no expiration date. */ getExpirationDate(): Promise; /** * Get time to live for the records in seconds. * Note that DNS records have TTL specified in the records themselves. */ getTTL(): Promise; /** * Return resolver contract address * @param forceRefresh - if true will query blockchain for address even if we have it */ getResolverAddr(forceRefresh?: boolean): Promise; /** * Get resolver contract instance * @param writable - writable instance will allow calling methods that change data */ getResolver(writable?: boolean): Promise; /** * Get Ethereum or other blockchain address associated with name * @param coinId */ getAddress(coinId?: string): Promise; setAddress(coinId: string, address: string): Promise; /** * Get multiple coin addresses associated with name * @param coinIds - array of coinIds `['ETH', 'BTC']` */ getAddressBatch(coinIds: string[]): Promise<{ id: string; type: number; success: boolean; address: string; }[]>; /** * Set multiple coin addresses associated with name in a single transaction. * @param data - map of coinId to address `{'ETH': '0x1234', 'BTC': 'bc1q...'}` */ setAddressBatch(data: Record): Promise; getText(key: string): Promise; setText(key: string, value: string): Promise; hasDNS(): Promise; /** * Write DNS data in binary wire format * @param data - DNS records encoded in binary format */ setDNS(data: Buffer): Promise; /** * Get DNS records of given type. Records are in binary format. * @param type */ getDNS(type: number): Promise; /** * Remove all DNS records for name */ clearDNS(): Promise; /** * Samples: * 1. IPFS ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4 * 2. Swarm bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162 * * @param contentUrl */ setContenthash(contentUrl: string | null): Promise; getContenthash(): Promise; } export {};