UNPKG

@authereum/resolution

Version:
33 lines (32 loc) 1.96 kB
import { ResolutionMethod, Provider, ResolutionResponse, SourceDefinition, NamingServiceName } from '.'; import BaseConnection from './BaseConnection'; import { ResolutionErrorCode } from './errors/resolutionError'; import { nodeHash } from './types'; import { CryptoRecords } from './publicTypes'; export default abstract class NamingService extends BaseConnection { readonly name: ResolutionMethod; readonly network: number; readonly url: string | undefined; readonly registryAddress?: string; protected provider: Provider; abstract isSupportedDomain(domain: string): boolean; abstract isSupportedNetwork(): boolean; abstract owner(domain: string): Promise<string | null>; abstract records(domain: string, keys: string[]): Promise<CryptoRecords>; abstract resolve(domain: string): Promise<ResolutionResponse | null>; abstract resolver(domain: string): Promise<string>; abstract twitter(domain: string): Promise<string>; abstract childhash(parent: nodeHash, label: string): nodeHash; abstract allRecords(domain: string): Promise<CryptoRecords>; constructor(source: SourceDefinition, name: ResolutionMethod); serviceName(domain: string): NamingServiceName; namehash(domain: string): string; record(domain: string, key: string): Promise<string>; protected abstract normalizeSource(source: SourceDefinition | undefined): SourceDefinition; protected ensureSupportedDomain(domain: string): void; protected ignoreResolutionErrors<T>(codes: ResolutionErrorCode[], promise: Promise<T>): Promise<T | undefined>; protected isResolutionError(error: any, code?: ResolutionErrorCode): boolean; static ensureRecordPresence(domain: string, key: string, value: string | undefined | null): string; protected ensureConfigured(source: SourceDefinition): void; protected constructRecords(keys: string[], values: undefined | (string | undefined)[] | CryptoRecords): CryptoRecords; }