/
types.ts
119 lines (105 loc) · 2.65 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
export type Dictionary<T> = { [k: string]: T };
/**
* SourceDefinition object
* @typedef {Object} SourceDefinition
* @property {string} [url] - main blockchain api url
* @property {string | number} [network] - blockchain network
*/
export interface SourceDefinition {
url?: string;
network?: string | number;
registry?: string;
}
/**
* NamingServiceSource
* just an alias
* @typedef {string | boolean | SourceDefinition}
*/
export type NamingServiceSource = string | boolean | SourceDefinition;
/**
* EnsNetworkIdMap
* type represending the map between network number and network name
* @typedef
*/
export type EnsNetworkIdMap = {
[key: number]: string;
};
/**
* BlockcahinNetworkUrlMap
* type representing a map between network name such as
* - mainnet
* - ropsten
* and a corresponding url
* @typede
*/
export interface BlockhanNetworkUrlMap {
[key: string]: string;
}
/**
* RegistryMap
* type represending the map between network name and registry address for specific NamingService
*/
export interface RegistryMap {
[key: string]: string;
}
/**
* ResolutionResulution
* @typedef ResolutionResponse
* @property {Object} addresses - Resolution addresses for various currency addresses attached to the domain
* @property {Object} meta - meta information about the owner of the domain
*/
export type ResolutionResponse = {
addresses: {
[key: string]: string;
};
meta: {
owner: string;
type: string; //available domain
ttl: number;
};
};
/**
* @internal
* Used internally to map network number to a string
*/
export type NetworkIdMap = {
[key: number]: string;
};
/**
* Main configurational object for Resolution instance
*/
export type Blockchain =
| boolean
| {
ens?: NamingServiceSource;
zns?: NamingServiceSource;
cns?: NamingServiceSource;
};
/**
* Default structure of ZnsResolution records
* @typedef {object} ZnsResolution
*/
export type ZnsResolution = {
crypto?: Dictionary<{ address?: string; [key: string]: any }>;
ttl?: string;
[key: string]: any;
};
export type Bip44Constants = [number, string, string];
export type owner = string;
export type ttl = string;
export const NullAddress = '0x0000000000000000000000000000000000000000';
export const NullAddressExtended =
'0x0000000000000000000000000000000000000000000000000000000000000000';
export const EthCoinIndex = 60;
export const UnclaimedDomainResponse: ResolutionResponse = {
addresses: {},
meta: {
owner: null, //available domain
type: '',
ttl: 0,
},
};
/**
* @deprecated Use UnclaimedDomainResponse instead (deprecated since 0.3.4)
*/
export const UNCLAIMED_DOMAIN_RESPONSE = UnclaimedDomainResponse;