import { type Network } from "../config/index.js"; import { type Account, type TransferResult } from "../transactions/builder.js"; export interface BnsLookupResult { name: string; address: string; namespace: string; expireBlock: number; zonefile?: string; } export interface BnsNameInfo { name: string; namespace: string; address: string; expireBlock: number; gracePeriod: number; status: string; zonefile?: string; zonefileHash?: string; lastTxId: string; } export interface BnsPrice { units: string; amount: string; amountStx: string; } export declare class BnsService { private network; private hiro; private bnsV2; private contracts; constructor(network: Network); /** * Lookup a BNS name and get the associated address * Uses BNS V2 API for .btc names, falls back to Hiro API for other namespaces */ lookupName(name: string): Promise; /** * Reverse lookup - get BNS names for an address * Combines results from both BNS V2 and Hiro API (V1) */ reverseLookup(address: string): Promise; /** * Get detailed info about a BNS name * Uses BNS V2 API for .btc names, falls back to Hiro API */ getNameInfo(name: string): Promise; /** * Check if a BNS name is available for registration * A name is available if it's not found in either BNS V2 or V1 */ checkAvailability(name: string): Promise; /** * Get the price of a BNS name * Uses appropriate contract based on namespace (V2 for .btc, V1 for others) */ getPrice(name: string): Promise; /** * Get all domains owned by an address */ getUserDomains(address: string): Promise; /** * Resolve a name to an address (convenient wrapper) */ resolve(name: string): Promise; /** * Get BNS contract based on namespace * - V2 for .btc namespace (active registry) * - V1 for other namespaces (legacy) */ private getBnsContract; /** * Create hash160 (RIPEMD160(SHA256(data))) - 20 bytes */ private hash160; /** * Claim a BNS V2 name in a single transaction using name-claim-fast. * This is the recommended method for BNS names — no preorder/register dance needed. * Burns the name price in STX and mints the BNS NFT in one atomic step. * * Works for all open namespaces (BNS V2). */ claimNameFast(account: Account, name: string, sendTo?: string): Promise; /** * Preorder a BNS name (Step 1 of 2) * Creates a commitment with hashed name+salt to prevent front-running * Auto-detects V1/V2 based on namespace (.btc uses V2, others use V1) * * NOTE: For name registration, consider using claimNameFast() instead — * it registers in a single transaction without the preorder/register wait. */ preorderName(account: Account, name: string, salt: string): Promise; /** * Register a BNS name (Step 2 of 2) * Must be called after preorder is confirmed on-chain * Auto-detects V1/V2 based on namespace (.btc uses V2, others use V1) * * @param zonefileHash - Required for V1, ignored for V2. 20-byte hash of zonefile content. */ registerName(account: Account, name: string, salt: string, zonefileHash?: string): Promise; /** * Update a name's zonefile */ updateZonefile(account: Account, name: string, zonefile: string): Promise; /** * Transfer a BNS name to a new owner */ transferName(account: Account, name: string, newOwner: string, zonefile?: string): Promise; /** * Renew a BNS name */ renewName(account: Account, name: string): Promise; } export declare function getBnsService(network: Network): BnsService; //# sourceMappingURL=bns.service.d.ts.map