1 | import { Dictionary, NamicornResolution, SourceDefinition, ZnsResolution } from './types';
|
2 | import NamingService from './namingService';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export default class Zns extends NamingService {
|
13 | readonly network: string;
|
14 | readonly url: string;
|
15 | readonly registryAddress?: string;
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | constructor(source?: string | boolean | SourceDefinition);
|
22 | /**
|
23 | * Resolves the domain name
|
24 | * @param domain - domain name to be resolved
|
25 | * @returns A promise that resolves in a detailed crypto resolution
|
26 | */
|
27 | resolve(domain: string): Promise<NamicornResolution | null>;
|
28 | /**
|
29 | * Resolves domain name to a particular crypto address associated with it
|
30 | * @param domain - domain name to be resolved
|
31 | * @param currencyTicker - specific currency ticker such as
|
32 | * - ZIL
|
33 | * - BTC
|
34 | * - ETH
|
35 | * @returns A promise that resolves in a string
|
36 | * @throws ResolutionError
|
37 | */
|
38 | address(domain: string, currencyTicker: string): Promise<string>;
|
39 | /**
|
40 | * Owner of the domain
|
41 | * @param domain - domain name
|
42 | * @returns An owner address of the domain
|
43 | */
|
44 | owner(domain: string): Promise<string | null>;
|
45 | /**
|
46 | * Resolves a domain
|
47 | * @param domain - domain name to be resolved
|
48 | * @returns Everything what is stored on specified domain
|
49 | */
|
50 | resolution(domain: string): Promise<ZnsResolution>;
|
51 | /**
|
52 | * Resolves a specific field from domain's record
|
53 | * @param domain - domain name
|
54 | * @param field - resolver record name to be queried
|
55 | * @returns Record field associated with the domain
|
56 | */
|
57 | record(domain: string, field: string): Promise<string>;
|
58 | /**
|
59 | * Resolver Records
|
60 | * @param domain - domain name to be resolved
|
61 | * @returns ZNS resolver records in an plain key-value format
|
62 | */
|
63 | records(domain: string): Promise<Dictionary<string>>;
|
64 | /**
|
65 | * Checks if domain is supported by zns
|
66 | */
|
67 | isSupportedDomain(domain: string): boolean;
|
68 | /**
|
69 | * Checks if zns is supported by current namicorn instance
|
70 | */
|
71 | isSupportedNetwork(): boolean;
|
72 | /**
|
73 | * Produces ZNS namehash of a domain
|
74 | * @param domain - domain name to be hashed
|
75 | * @returns ZNS namehash
|
76 | */
|
77 | namehash(domain: string): string;
|
78 | private getRecordFieldOrThrow;
|
79 | private getRecordsAddresses;
|
80 | private getResolverRecords;
|
81 | private structureResolverRecords;
|
82 | private resolverAddress;
|
83 | private fetchSubState;
|
84 | private getContractField;
|
85 | private getContractMapValue;
|
86 | }
|