UNPKG

@iota/iota-names-sdk

Version:
46 lines (45 loc) 1.84 kB
import { IotaGraphQLClient } from '@iota/iota-sdk/graphql'; import type { Coupon, CouponHouse, IotaNamesClientConfig, IotaNamesCoreConfig, IotaNamesPriceList, NameRecord, PackageInfo } from './types.js'; export declare class IotaNamesClient { graphQlClient: IotaGraphQLClient; config: PackageInfo; constructor(config: IotaNamesClientConfig); /** * Returns the core config of IOTA Names. */ getCoreConfig(): Promise<IotaNamesCoreConfig>; /** * Returns the price list for IOTA names in the base asset. */ getPriceList(): Promise<IotaNamesPriceList>; /** * Returns the renewal price list for IOTA names in the base asset. */ getRenewalPriceList(): Promise<IotaNamesPriceList>; getDefaultName(address: string): Promise<string | null>; getNameRecord(name: string): Promise<NameRecord | null>; getCouponHouse(): Promise<CouponHouse>; resolveCoupon(couponCode: string): Promise<Coupon | null>; /** * Calculates the registration or renewal price for an SLN (Second Level Name). * It expects a name, the number of years and a `IotaNamesPriceList` object, * as returned from `iotaNamesClient.getPriceList()` function, or `iotaNames.getRenewalPriceList()` function. * * It throws an error: * 1. if the name is a subname * 2. if the name is not a valid IOTA name * 3. if the years are not between 1 and 5 */ calculatePrice({ name, years, isRegistration, }: { name: string; years: number; isRegistration?: boolean; }): Promise<number>; calculateDiscountedPrice({ coupons, name, years, isRegistration, address, }: { coupons: Coupon[] | string[]; name: string; years: number; isRegistration?: boolean; address?: string; }): Promise<number>; }