/
queries.js
379 lines (337 loc) · 7.04 KB
/
queries.js
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
import { gql } from '@apollo/client'
import { NodeFields, SubDomainStateFields } from './fragments'
export const GET_PUBLIC_RESOLVER = gql`
query publicResolver {
publicResolver {
address
}
}
`
export const GET_REVERSE_RECORD = gql`
query getReverseRecord($address: String) {
getReverseRecord(address: $address) {
name
address
avatar
match
}
}
`
export const GET_NAME_WRAPPER_DATA = gql`
query getNameWrapperData($node: String) {
getNameWrapperData(node: $node) {
isWrapped
owner
}
}
`
export const GET_OWNER = gql`
query getOwner($name: String) {
getOwner(name: $name)
}
`
export const GET_TEXT = gql`
query getText($name: String, $key: String) {
getText(name: $name, key: $key)
}
`
export const GET_ADDRESSES = gql`
query getAddresses($name: String, $keys: [String]) {
getAddresses(name: $name, keys: $keys)
}
`
export const GET_TEXT_RECORDS = gql`
query getTextRecords($name: String, $keys: [String]) {
getTextRecords(name: $name, keys: $keys)
}
`
export const GET_SINGLE_NAME = gql`
query singleName($name: String) {
singleName(name: $name) {
...NodeFields
revealDate
registrationDate
migrationStartDate
currentBlockDate
transferEndDate
gracePeriodEndDate
value
highestBid
state
stateError
price
rent
referralFeePPM
available
expiryTime
deedOwner
registrant
isNewRegistrar
isDNSRegistrar
dnsOwner
}
}
${NodeFields}
`
export const GET_RESOLVER_MIGRATION_INFO = gql`
query getResolverMigrationInfo($name: String, $resolver: String) {
getResolverMigrationInfo(name: $name, resolver: $resolver) {
name
isDeprecatedResolver
isOldPublicResolver
isPublicResolverReady
}
}
`
export const GET_SUBDOMAINS = gql`
query getSubDomains($name: String!) {
getSubDomains(name: $name) {
subDomains
}
}
`
export const GET_META_BLOCK_NUMBER_FROM_GRAPH = gql`
query getMetaBlockNumber {
_meta {
block {
number
}
}
}
`
export const GET_RESOLVER_FROM_SUBGRAPH = gql`
query getResolverFromSubgraph($id: ID!) {
domain(id: $id) {
id
name
resolver {
coinTypes
texts
}
}
}
`
export const GET_REGISTRANT_FROM_SUBGRAPH = gql`
query getRegistrantFromSubgraph($id: ID!) {
registration(id: $id) {
id
domain {
name
}
registrant {
id
}
}
}
`
export const GET_SUBDOMAINS_FROM_SUBGRAPH = gql`
query getSubdomains($id: ID!) {
domain(id: $id) {
id
labelName
subdomains {
id
labelName
labelhash
isMigrated
name
owner {
id
}
}
}
}
`
export const GET_ETH_RECORD_AVAILABLE_NAMES_FROM_SUBGRAPH = gql`
query getNamesFromSubgraph($address: String!) {
domains(first: 1000, where: { resolvedAddress: $address }) {
name
}
}
`
export const GET_TRANSACTION_HISTORY = gql`
query getTransactionHistory @client {
transactionHistory
}
`
export const WAIT_BLOCK_TIMESTAMP = gql`
query waitBlockTimestamp($waitUntil: Int) {
waitBlockTimestamp(waitUntil: $waitUntil)
}
`
export const GET_BALANCE = gql`
query getBalance($address: String) {
getBalance(address: $address)
}
`
export const GET_FAVOURITES = gql`
query getFavourites {
favourites @client {
name
}
}
`
export const GET_SUBDOMAIN_FAVOURITES = gql`
query getSubDomainFavourites {
subDomainFavourites @client {
name
}
}
${SubDomainStateFields}
`
export const GET_ERRORS = gql`
query getErrors @client {
globalError
}
`
/* Subgraph only queries */
export const GET_REGISTRATIONS_SUBGRAPH = gql`
query getRegistrations(
$id: ID!
$first: Int
$skip: Int
$orderBy: Registration_orderBy
$orderDirection: OrderDirection
$expiryDate: Int
) {
account(id: $id) {
registrations(
first: $first
skip: $skip
orderBy: $orderBy
orderDirection: $orderDirection
where: { expiryDate_gt: $expiryDate }
) {
expiryDate
domain {
id
labelName
labelhash
name
isMigrated
parent {
name
}
}
}
}
}
`
export const GET_REGISTRATIONS_BY_IDS_SUBGRAPH = gql`
query getRegistrationsById($ids: [ID]) {
registrations(first: 1000, where: { domain_in: $ids }) {
expiryDate
registrant {
id
}
domain {
id
name
}
}
}
`
export const GET_DOMAINS_SUBGRAPH = gql`
query getDomains(
$id: ID!
$first: Int
$skip: Int
$orderBy: Domain_orderBy
) {
account(id: $id) {
domains(first: $first, skip: $skip, orderBy: $orderBy) {
labelName
labelhash
name
isMigrated
parent {
name
}
}
}
}
`
/* Permanent Registrar */
export const GET_ETH_PRICE = gql`
query getEthPrice {
getEthPrice
}
`
export const GET_PRICE_CURVE = gql`
query getPriceCurve {
getPriceCurve
}
`
export const GET_RENT_PRICE = gql`
query getRentPrice($label: String, $duration: Number) {
getRentPrice(label: $label, duration: $duration)
}
`
export const GET_RENT_PRICE_AND_PREMIUM = gql`
query getRentPriceAndPremium(
$name: String
$expires: Number
$duration: Number
) {
getRentPriceAndPremium(name: $name, expires: $expires, duration: $duration)
}
`
export const GET_RENT_PRICES = gql`
query getRentPrices($labels: String, $duration: Number) {
getRentPrices(labels: $labels, duration: $duration)
}
`
export const GET_PREMIUM = gql`
query getPremium($name: String, $expires: Number, $duration: Number) {
getPremium(name: $name, expires: $expires, duration: $duration)
}
`
export const GET_TIME_UNTIL_PREMIUM = gql`
query getTimeUntilPremium($expires: Number, $amount: Number) {
getTimeUntilPremium(expires: $expires, amount: $amount)
}
`
export const GET_MINIMUM_COMMITMENT_AGE = gql`
query getMinimumCommitmentAge {
getMinimumCommitmentAge
}
`
export const GET_MAXIMUM_COMMITMENT_AGE = gql`
query getMaximumCommitmentAge {
getMaximumCommitmentAge
}
`
export const CHECK_COMMITMENT = gql`
query checkCommitment(
$label: String
$secret: String
$commitmentTimerRunning: String
) {
checkCommitment(
label: $label
secret: $secret
commitmentTimerRunning: $commitmentTimerRunning
)
}
`
/* Registry Migration */
export const CAN_WRITE = gql`
query canWrite($name: String, $account: String) {
canWrite(name: $name, account: $account)
}
`
export const IS_MIGRATED = gql`
query isMigrated($name: String) {
isMigrated(name: $name)
}
`
export const IS_CONTRACT_CONTROLLER = gql`
query isContractController($address: String) {
isContractController(address: $address)
}
`
export const WILDCARD_RESOLVER_DOMAIN = gql`
query wildcardResolverDomain($name: String) {
wildcardResolverDomain(name: $name)
}
`