@0xsequence/metadata 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,13 +25,13 @@ function _extends() {
|
|
|
25
25
|
// webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
|
|
26
26
|
|
|
27
27
|
// WebRPC description and code-gen version
|
|
28
|
-
const WebRPCVersion =
|
|
28
|
+
const WebRPCVersion = 'v1';
|
|
29
29
|
|
|
30
30
|
// Schema version of your RIDL schema
|
|
31
|
-
const WebRPCSchemaVersion =
|
|
31
|
+
const WebRPCSchemaVersion = 'v0.4.0';
|
|
32
32
|
|
|
33
33
|
// Schema hash generated from your RIDL schema
|
|
34
|
-
const WebRPCSchemaHash =
|
|
34
|
+
const WebRPCSchemaHash = '5d87d77b951c5d197544d97d75241bf3d02679d9';
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
@@ -25,13 +25,13 @@ function _extends() {
|
|
|
25
25
|
// webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
|
|
26
26
|
|
|
27
27
|
// WebRPC description and code-gen version
|
|
28
|
-
const WebRPCVersion =
|
|
28
|
+
const WebRPCVersion = 'v1';
|
|
29
29
|
|
|
30
30
|
// Schema version of your RIDL schema
|
|
31
|
-
const WebRPCSchemaVersion =
|
|
31
|
+
const WebRPCSchemaVersion = 'v0.4.0';
|
|
32
32
|
|
|
33
33
|
// Schema hash generated from your RIDL schema
|
|
34
|
-
const WebRPCSchemaHash =
|
|
34
|
+
const WebRPCSchemaHash = '5d87d77b951c5d197544d97d75241bf3d02679d9';
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
@@ -21,13 +21,13 @@ function _extends() {
|
|
|
21
21
|
// webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
|
|
22
22
|
|
|
23
23
|
// WebRPC description and code-gen version
|
|
24
|
-
const WebRPCVersion =
|
|
24
|
+
const WebRPCVersion = 'v1';
|
|
25
25
|
|
|
26
26
|
// Schema version of your RIDL schema
|
|
27
|
-
const WebRPCSchemaVersion =
|
|
27
|
+
const WebRPCSchemaVersion = 'v0.4.0';
|
|
28
28
|
|
|
29
29
|
// Schema hash generated from your RIDL schema
|
|
30
|
-
const WebRPCSchemaHash =
|
|
30
|
+
const WebRPCSchemaHash = '5d87d77b951c5d197544d97d75241bf3d02679d9';
|
|
31
31
|
|
|
32
32
|
//
|
|
33
33
|
// Types
|
package/package.json
CHANGED
package/src/metadata.gen.ts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
// webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
|
|
7
7
|
|
|
8
8
|
// WebRPC description and code-gen version
|
|
9
|
-
export const WebRPCVersion =
|
|
9
|
+
export const WebRPCVersion = 'v1'
|
|
10
10
|
|
|
11
11
|
// Schema version of your RIDL schema
|
|
12
|
-
export const WebRPCSchemaVersion =
|
|
12
|
+
export const WebRPCSchemaVersion = 'v0.4.0'
|
|
13
13
|
|
|
14
14
|
// Schema hash generated from your RIDL schema
|
|
15
|
-
export const WebRPCSchemaHash =
|
|
15
|
+
export const WebRPCSchemaHash = '5d87d77b951c5d197544d97d75241bf3d02679d9'
|
|
16
16
|
|
|
17
17
|
//
|
|
18
18
|
// Types
|
|
@@ -57,19 +57,17 @@ export interface RuntimeStatus {
|
|
|
57
57
|
checks: RuntimeChecks
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export interface RuntimeChecks {
|
|
61
|
-
}
|
|
60
|
+
export interface RuntimeChecks {}
|
|
62
61
|
|
|
63
62
|
export interface ContractIndex {
|
|
64
63
|
chainId: number
|
|
65
64
|
address: string
|
|
66
65
|
type: ContractType
|
|
67
|
-
metadata: {[key: string]: any}
|
|
66
|
+
metadata: { [key: string]: any }
|
|
68
67
|
contentHash: number
|
|
69
68
|
deployed: boolean
|
|
70
69
|
bytecodeHash: string
|
|
71
70
|
notFound: boolean
|
|
72
|
-
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
export interface TokenIndex {
|
|
@@ -77,8 +75,8 @@ export interface TokenIndex {
|
|
|
77
75
|
chainId: number
|
|
78
76
|
contractAddress: string
|
|
79
77
|
tokenId: string
|
|
80
|
-
metadata: {[key: string]: any}
|
|
81
|
-
|
|
78
|
+
metadata: { [key: string]: any }
|
|
79
|
+
|
|
82
80
|
notFound: boolean
|
|
83
81
|
}
|
|
84
82
|
|
|
@@ -93,7 +91,6 @@ export interface ContractInfo {
|
|
|
93
91
|
deployed: boolean
|
|
94
92
|
bytecodeHash: string
|
|
95
93
|
extensions: ContractInfoExtensions
|
|
96
|
-
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
export interface ContractInfoExtensions {
|
|
@@ -112,14 +109,14 @@ export interface TokenMetadata {
|
|
|
112
109
|
description: string
|
|
113
110
|
image: string
|
|
114
111
|
decimals: number
|
|
115
|
-
properties: {[key: string]: any}
|
|
112
|
+
properties: { [key: string]: any }
|
|
116
113
|
video: string
|
|
117
114
|
audio: string
|
|
118
115
|
image_data: string
|
|
119
116
|
external_url: string
|
|
120
117
|
background_color: string
|
|
121
118
|
animation_url: string
|
|
122
|
-
attributes: Array<{[key: string]: any}>
|
|
119
|
+
attributes: Array<{ [key: string]: any }>
|
|
123
120
|
}
|
|
124
121
|
|
|
125
122
|
export interface PropertyFilter {
|
|
@@ -174,26 +171,26 @@ export interface Metadata {
|
|
|
174
171
|
searchMetadata(args: SearchMetadataArgs, headers?: object): Promise<SearchMetadataReturn>
|
|
175
172
|
getNiftyswapTokenQuantity(args: GetNiftyswapTokenQuantityArgs, headers?: object): Promise<GetNiftyswapTokenQuantityReturn>
|
|
176
173
|
getNiftyswapUnitPrices(args: GetNiftyswapUnitPricesArgs, headers?: object): Promise<GetNiftyswapUnitPricesReturn>
|
|
177
|
-
getNiftyswapUnitPricesWithQuantities(
|
|
174
|
+
getNiftyswapUnitPricesWithQuantities(
|
|
175
|
+
args: GetNiftyswapUnitPricesWithQuantitiesArgs,
|
|
176
|
+
headers?: object
|
|
177
|
+
): Promise<GetNiftyswapUnitPricesWithQuantitiesReturn>
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
export interface PingArgs {
|
|
181
|
-
}
|
|
180
|
+
export interface PingArgs {}
|
|
182
181
|
|
|
183
182
|
export interface PingReturn {
|
|
184
|
-
status: boolean
|
|
185
|
-
}
|
|
186
|
-
export interface VersionArgs {
|
|
183
|
+
status: boolean
|
|
187
184
|
}
|
|
185
|
+
export interface VersionArgs {}
|
|
188
186
|
|
|
189
187
|
export interface VersionReturn {
|
|
190
|
-
version: Version
|
|
191
|
-
}
|
|
192
|
-
export interface RuntimeStatusArgs {
|
|
188
|
+
version: Version
|
|
193
189
|
}
|
|
190
|
+
export interface RuntimeStatusArgs {}
|
|
194
191
|
|
|
195
192
|
export interface RuntimeStatusReturn {
|
|
196
|
-
status: RuntimeStatus
|
|
193
|
+
status: RuntimeStatus
|
|
197
194
|
}
|
|
198
195
|
export interface GetTokenMetadataArgs {
|
|
199
196
|
chainID: string
|
|
@@ -202,7 +199,7 @@ export interface GetTokenMetadataArgs {
|
|
|
202
199
|
}
|
|
203
200
|
|
|
204
201
|
export interface GetTokenMetadataReturn {
|
|
205
|
-
tokenMetadata: Array<TokenMetadata>
|
|
202
|
+
tokenMetadata: Array<TokenMetadata>
|
|
206
203
|
}
|
|
207
204
|
export interface RefreshTokenMetadataArgs {
|
|
208
205
|
chainID: string
|
|
@@ -212,15 +209,15 @@ export interface RefreshTokenMetadataArgs {
|
|
|
212
209
|
}
|
|
213
210
|
|
|
214
211
|
export interface RefreshTokenMetadataReturn {
|
|
215
|
-
status: {[key: string]: boolean}
|
|
212
|
+
status: { [key: string]: boolean }
|
|
216
213
|
}
|
|
217
214
|
export interface GetTokenMetadataBatchArgs {
|
|
218
215
|
chainID: string
|
|
219
|
-
contractTokenMap: {[key: string]: Array<string>}
|
|
216
|
+
contractTokenMap: { [key: string]: Array<string> }
|
|
220
217
|
}
|
|
221
218
|
|
|
222
219
|
export interface GetTokenMetadataBatchReturn {
|
|
223
|
-
contractTokenMetadata: {[key: string]: Array<TokenMetadata>}
|
|
220
|
+
contractTokenMetadata: { [key: string]: Array<TokenMetadata> }
|
|
224
221
|
}
|
|
225
222
|
export interface SearchTokenMetadataArgs {
|
|
226
223
|
chainID: string
|
|
@@ -231,7 +228,7 @@ export interface SearchTokenMetadataArgs {
|
|
|
231
228
|
|
|
232
229
|
export interface SearchTokenMetadataReturn {
|
|
233
230
|
page: Page
|
|
234
|
-
tokenMetadata: Array<TokenMetadata>
|
|
231
|
+
tokenMetadata: Array<TokenMetadata>
|
|
235
232
|
}
|
|
236
233
|
export interface SearchTokenIDsArgs {
|
|
237
234
|
chainID: string
|
|
@@ -242,7 +239,7 @@ export interface SearchTokenIDsArgs {
|
|
|
242
239
|
|
|
243
240
|
export interface SearchTokenIDsReturn {
|
|
244
241
|
page: Page
|
|
245
|
-
tokenIds: Array<string>
|
|
242
|
+
tokenIds: Array<string>
|
|
246
243
|
}
|
|
247
244
|
export interface TokenCollectionFiltersArgs {
|
|
248
245
|
chainID: string
|
|
@@ -250,7 +247,7 @@ export interface TokenCollectionFiltersArgs {
|
|
|
250
247
|
}
|
|
251
248
|
|
|
252
249
|
export interface TokenCollectionFiltersReturn {
|
|
253
|
-
filters: Array<PropertyFilter>
|
|
250
|
+
filters: Array<PropertyFilter>
|
|
254
251
|
}
|
|
255
252
|
export interface GetContractInfoArgs {
|
|
256
253
|
chainID: string
|
|
@@ -258,7 +255,7 @@ export interface GetContractInfoArgs {
|
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
export interface GetContractInfoReturn {
|
|
261
|
-
contractInfo: ContractInfo
|
|
258
|
+
contractInfo: ContractInfo
|
|
262
259
|
}
|
|
263
260
|
export interface GetContractInfoBatchArgs {
|
|
264
261
|
chainID: string
|
|
@@ -266,21 +263,21 @@ export interface GetContractInfoBatchArgs {
|
|
|
266
263
|
}
|
|
267
264
|
|
|
268
265
|
export interface GetContractInfoBatchReturn {
|
|
269
|
-
contractInfoMap: {[key: string]: ContractInfo}
|
|
266
|
+
contractInfoMap: { [key: string]: ContractInfo }
|
|
270
267
|
}
|
|
271
268
|
export interface SearchContractInfoArgs {
|
|
272
269
|
contractAddress: string
|
|
273
270
|
}
|
|
274
271
|
|
|
275
272
|
export interface SearchContractInfoReturn {
|
|
276
|
-
contractInfoList: Array<ContractInfo>
|
|
273
|
+
contractInfoList: Array<ContractInfo>
|
|
277
274
|
}
|
|
278
275
|
export interface SearchContractInfoBatchArgs {
|
|
279
276
|
contractAddresses: Array<string>
|
|
280
277
|
}
|
|
281
278
|
|
|
282
279
|
export interface SearchContractInfoBatchReturn {
|
|
283
|
-
contractInfoByChain: {[key: string]: Array<ContractInfo>}
|
|
280
|
+
contractInfoByChain: { [key: string]: Array<ContractInfo> }
|
|
284
281
|
}
|
|
285
282
|
export interface SearchMetadataArgs {
|
|
286
283
|
filter: string
|
|
@@ -288,7 +285,7 @@ export interface SearchMetadataArgs {
|
|
|
288
285
|
|
|
289
286
|
export interface SearchMetadataReturn {
|
|
290
287
|
tokenMetadata: Array<TokenMetadata>
|
|
291
|
-
contractInfo: Array<ContractInfo>
|
|
288
|
+
contractInfo: Array<ContractInfo>
|
|
292
289
|
}
|
|
293
290
|
export interface GetNiftyswapTokenQuantityArgs {
|
|
294
291
|
chainID: string
|
|
@@ -297,7 +294,7 @@ export interface GetNiftyswapTokenQuantityArgs {
|
|
|
297
294
|
}
|
|
298
295
|
|
|
299
296
|
export interface GetNiftyswapTokenQuantityReturn {
|
|
300
|
-
quantity: {[key: string]: string}
|
|
297
|
+
quantity: { [key: string]: string }
|
|
301
298
|
}
|
|
302
299
|
export interface GetNiftyswapUnitPricesArgs {
|
|
303
300
|
chainID: string
|
|
@@ -307,7 +304,7 @@ export interface GetNiftyswapUnitPricesArgs {
|
|
|
307
304
|
}
|
|
308
305
|
|
|
309
306
|
export interface GetNiftyswapUnitPricesReturn {
|
|
310
|
-
prices: {[key: string]: string}
|
|
307
|
+
prices: { [key: string]: string }
|
|
311
308
|
}
|
|
312
309
|
export interface GetNiftyswapUnitPricesWithQuantitiesArgs {
|
|
313
310
|
chainID: string
|
|
@@ -317,11 +314,9 @@ export interface GetNiftyswapUnitPricesWithQuantitiesArgs {
|
|
|
317
314
|
}
|
|
318
315
|
|
|
319
316
|
export interface GetNiftyswapUnitPricesWithQuantitiesReturn {
|
|
320
|
-
prices: {[key: string]: GetNiftyswapUnitPricesResponse}
|
|
317
|
+
prices: { [key: string]: GetNiftyswapUnitPricesResponse }
|
|
321
318
|
}
|
|
322
319
|
|
|
323
|
-
|
|
324
|
-
|
|
325
320
|
//
|
|
326
321
|
// Client
|
|
327
322
|
//
|
|
@@ -338,224 +333,191 @@ export class Metadata implements Metadata {
|
|
|
338
333
|
private url(name: string): string {
|
|
339
334
|
return this.hostname + this.path + name
|
|
340
335
|
}
|
|
341
|
-
|
|
336
|
+
|
|
342
337
|
ping = (headers?: object): Promise<PingReturn> => {
|
|
343
|
-
return this.fetch(
|
|
344
|
-
this.url('Ping'),
|
|
345
|
-
createHTTPRequest({}, headers)
|
|
346
|
-
).then((res) => {
|
|
338
|
+
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
347
339
|
return buildResponse(res).then(_data => {
|
|
348
340
|
return {
|
|
349
|
-
status: <boolean>
|
|
341
|
+
status: <boolean>_data.status
|
|
350
342
|
}
|
|
351
343
|
})
|
|
352
344
|
})
|
|
353
345
|
}
|
|
354
|
-
|
|
346
|
+
|
|
355
347
|
version = (headers?: object): Promise<VersionReturn> => {
|
|
356
|
-
return this.fetch(
|
|
357
|
-
this.url('Version'),
|
|
358
|
-
createHTTPRequest({}, headers)
|
|
359
|
-
).then((res) => {
|
|
348
|
+
return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
|
|
360
349
|
return buildResponse(res).then(_data => {
|
|
361
350
|
return {
|
|
362
|
-
version: <Version>
|
|
351
|
+
version: <Version>_data.version
|
|
363
352
|
}
|
|
364
353
|
})
|
|
365
354
|
})
|
|
366
355
|
}
|
|
367
|
-
|
|
356
|
+
|
|
368
357
|
runtimeStatus = (headers?: object): Promise<RuntimeStatusReturn> => {
|
|
369
|
-
return this.fetch(
|
|
370
|
-
this.url('RuntimeStatus'),
|
|
371
|
-
createHTTPRequest({}, headers)
|
|
372
|
-
).then((res) => {
|
|
358
|
+
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
|
|
373
359
|
return buildResponse(res).then(_data => {
|
|
374
360
|
return {
|
|
375
|
-
status: <RuntimeStatus>
|
|
361
|
+
status: <RuntimeStatus>_data.status
|
|
376
362
|
}
|
|
377
363
|
})
|
|
378
364
|
})
|
|
379
365
|
}
|
|
380
|
-
|
|
366
|
+
|
|
381
367
|
getTokenMetadata = (args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn> => {
|
|
382
|
-
return this.fetch(
|
|
383
|
-
this.url('GetTokenMetadata'),
|
|
384
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
368
|
+
return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
|
|
385
369
|
return buildResponse(res).then(_data => {
|
|
386
370
|
return {
|
|
387
|
-
tokenMetadata: <Array<TokenMetadata>>
|
|
371
|
+
tokenMetadata: <Array<TokenMetadata>>_data.tokenMetadata
|
|
388
372
|
}
|
|
389
373
|
})
|
|
390
374
|
})
|
|
391
375
|
}
|
|
392
|
-
|
|
376
|
+
|
|
393
377
|
refreshTokenMetadata = (args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn> => {
|
|
394
|
-
return this.fetch(
|
|
395
|
-
this.url('RefreshTokenMetadata'),
|
|
396
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
378
|
+
return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
|
|
397
379
|
return buildResponse(res).then(_data => {
|
|
398
380
|
return {
|
|
399
|
-
status: <{[key: string]: boolean}>
|
|
381
|
+
status: <{ [key: string]: boolean }>_data.status
|
|
400
382
|
}
|
|
401
383
|
})
|
|
402
384
|
})
|
|
403
385
|
}
|
|
404
|
-
|
|
386
|
+
|
|
405
387
|
getTokenMetadataBatch = (args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn> => {
|
|
406
|
-
return this.fetch(
|
|
407
|
-
this.url('GetTokenMetadataBatch'),
|
|
408
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
388
|
+
return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
|
|
409
389
|
return buildResponse(res).then(_data => {
|
|
410
390
|
return {
|
|
411
|
-
contractTokenMetadata: <{[key: string]: Array<TokenMetadata>}>
|
|
391
|
+
contractTokenMetadata: <{ [key: string]: Array<TokenMetadata> }>_data.contractTokenMetadata
|
|
412
392
|
}
|
|
413
393
|
})
|
|
414
394
|
})
|
|
415
395
|
}
|
|
416
|
-
|
|
396
|
+
|
|
417
397
|
searchTokenMetadata = (args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn> => {
|
|
418
|
-
return this.fetch(
|
|
419
|
-
this.url('SearchTokenMetadata'),
|
|
420
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
398
|
+
return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
|
|
421
399
|
return buildResponse(res).then(_data => {
|
|
422
400
|
return {
|
|
423
|
-
page: <Page>
|
|
424
|
-
tokenMetadata: <Array<TokenMetadata>>
|
|
401
|
+
page: <Page>_data.page,
|
|
402
|
+
tokenMetadata: <Array<TokenMetadata>>_data.tokenMetadata
|
|
425
403
|
}
|
|
426
404
|
})
|
|
427
405
|
})
|
|
428
406
|
}
|
|
429
|
-
|
|
407
|
+
|
|
430
408
|
searchTokenIDs = (args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn> => {
|
|
431
|
-
return this.fetch(
|
|
432
|
-
this.url('SearchTokenIDs'),
|
|
433
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
409
|
+
return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
|
|
434
410
|
return buildResponse(res).then(_data => {
|
|
435
411
|
return {
|
|
436
|
-
page: <Page>
|
|
437
|
-
tokenIds: <Array<string>>
|
|
412
|
+
page: <Page>_data.page,
|
|
413
|
+
tokenIds: <Array<string>>_data.tokenIds
|
|
438
414
|
}
|
|
439
415
|
})
|
|
440
416
|
})
|
|
441
417
|
}
|
|
442
|
-
|
|
418
|
+
|
|
443
419
|
tokenCollectionFilters = (args: TokenCollectionFiltersArgs, headers?: object): Promise<TokenCollectionFiltersReturn> => {
|
|
444
|
-
return this.fetch(
|
|
445
|
-
this.url('TokenCollectionFilters'),
|
|
446
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
420
|
+
return this.fetch(this.url('TokenCollectionFilters'), createHTTPRequest(args, headers)).then(res => {
|
|
447
421
|
return buildResponse(res).then(_data => {
|
|
448
422
|
return {
|
|
449
|
-
filters: <Array<PropertyFilter>>
|
|
423
|
+
filters: <Array<PropertyFilter>>_data.filters
|
|
450
424
|
}
|
|
451
425
|
})
|
|
452
426
|
})
|
|
453
427
|
}
|
|
454
|
-
|
|
428
|
+
|
|
455
429
|
getContractInfo = (args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn> => {
|
|
456
|
-
return this.fetch(
|
|
457
|
-
this.url('GetContractInfo'),
|
|
458
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
430
|
+
return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
|
|
459
431
|
return buildResponse(res).then(_data => {
|
|
460
432
|
return {
|
|
461
|
-
contractInfo: <ContractInfo>
|
|
433
|
+
contractInfo: <ContractInfo>_data.contractInfo
|
|
462
434
|
}
|
|
463
435
|
})
|
|
464
436
|
})
|
|
465
437
|
}
|
|
466
|
-
|
|
438
|
+
|
|
467
439
|
getContractInfoBatch = (args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn> => {
|
|
468
|
-
return this.fetch(
|
|
469
|
-
this.url('GetContractInfoBatch'),
|
|
470
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
440
|
+
return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
|
|
471
441
|
return buildResponse(res).then(_data => {
|
|
472
442
|
return {
|
|
473
|
-
contractInfoMap: <{[key: string]: ContractInfo}>
|
|
443
|
+
contractInfoMap: <{ [key: string]: ContractInfo }>_data.contractInfoMap
|
|
474
444
|
}
|
|
475
445
|
})
|
|
476
446
|
})
|
|
477
447
|
}
|
|
478
|
-
|
|
448
|
+
|
|
479
449
|
searchContractInfo = (args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn> => {
|
|
480
|
-
return this.fetch(
|
|
481
|
-
this.url('SearchContractInfo'),
|
|
482
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
450
|
+
return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
|
|
483
451
|
return buildResponse(res).then(_data => {
|
|
484
452
|
return {
|
|
485
|
-
contractInfoList: <Array<ContractInfo>>
|
|
453
|
+
contractInfoList: <Array<ContractInfo>>_data.contractInfoList
|
|
486
454
|
}
|
|
487
455
|
})
|
|
488
456
|
})
|
|
489
457
|
}
|
|
490
|
-
|
|
458
|
+
|
|
491
459
|
searchContractInfoBatch = (args: SearchContractInfoBatchArgs, headers?: object): Promise<SearchContractInfoBatchReturn> => {
|
|
492
|
-
return this.fetch(
|
|
493
|
-
this.url('SearchContractInfoBatch'),
|
|
494
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
460
|
+
return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
|
|
495
461
|
return buildResponse(res).then(_data => {
|
|
496
462
|
return {
|
|
497
|
-
contractInfoByChain: <{[key: string]: Array<ContractInfo>}>
|
|
463
|
+
contractInfoByChain: <{ [key: string]: Array<ContractInfo> }>_data.contractInfoByChain
|
|
498
464
|
}
|
|
499
465
|
})
|
|
500
466
|
})
|
|
501
467
|
}
|
|
502
|
-
|
|
468
|
+
|
|
503
469
|
searchMetadata = (args: SearchMetadataArgs, headers?: object): Promise<SearchMetadataReturn> => {
|
|
504
|
-
return this.fetch(
|
|
505
|
-
this.url('SearchMetadata'),
|
|
506
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
470
|
+
return this.fetch(this.url('SearchMetadata'), createHTTPRequest(args, headers)).then(res => {
|
|
507
471
|
return buildResponse(res).then(_data => {
|
|
508
472
|
return {
|
|
509
|
-
tokenMetadata: <Array<TokenMetadata>>
|
|
510
|
-
contractInfo: <Array<ContractInfo>>
|
|
473
|
+
tokenMetadata: <Array<TokenMetadata>>_data.tokenMetadata,
|
|
474
|
+
contractInfo: <Array<ContractInfo>>_data.contractInfo
|
|
511
475
|
}
|
|
512
476
|
})
|
|
513
477
|
})
|
|
514
478
|
}
|
|
515
|
-
|
|
516
|
-
getNiftyswapTokenQuantity = (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
479
|
+
|
|
480
|
+
getNiftyswapTokenQuantity = (
|
|
481
|
+
args: GetNiftyswapTokenQuantityArgs,
|
|
482
|
+
headers?: object
|
|
483
|
+
): Promise<GetNiftyswapTokenQuantityReturn> => {
|
|
484
|
+
return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
|
|
520
485
|
return buildResponse(res).then(_data => {
|
|
521
486
|
return {
|
|
522
|
-
quantity: <{[key: string]: string}>
|
|
487
|
+
quantity: <{ [key: string]: string }>_data.quantity
|
|
523
488
|
}
|
|
524
489
|
})
|
|
525
490
|
})
|
|
526
491
|
}
|
|
527
|
-
|
|
492
|
+
|
|
528
493
|
getNiftyswapUnitPrices = (args: GetNiftyswapUnitPricesArgs, headers?: object): Promise<GetNiftyswapUnitPricesReturn> => {
|
|
529
|
-
return this.fetch(
|
|
530
|
-
this.url('GetNiftyswapUnitPrices'),
|
|
531
|
-
createHTTPRequest(args, headers)).then((res) => {
|
|
494
|
+
return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
|
|
532
495
|
return buildResponse(res).then(_data => {
|
|
533
496
|
return {
|
|
534
|
-
prices: <{[key: string]: string}>
|
|
497
|
+
prices: <{ [key: string]: string }>_data.prices
|
|
535
498
|
}
|
|
536
499
|
})
|
|
537
500
|
})
|
|
538
501
|
}
|
|
539
|
-
|
|
540
|
-
getNiftyswapUnitPricesWithQuantities = (
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
502
|
+
|
|
503
|
+
getNiftyswapUnitPricesWithQuantities = (
|
|
504
|
+
args: GetNiftyswapUnitPricesWithQuantitiesArgs,
|
|
505
|
+
headers?: object
|
|
506
|
+
): Promise<GetNiftyswapUnitPricesWithQuantitiesReturn> => {
|
|
507
|
+
return this.fetch(this.url('GetNiftyswapUnitPricesWithQuantities'), createHTTPRequest(args, headers)).then(res => {
|
|
544
508
|
return buildResponse(res).then(_data => {
|
|
545
509
|
return {
|
|
546
|
-
prices: <{[key: string]: GetNiftyswapUnitPricesResponse}>
|
|
510
|
+
prices: <{ [key: string]: GetNiftyswapUnitPricesResponse }>_data.prices
|
|
547
511
|
}
|
|
548
512
|
})
|
|
549
513
|
})
|
|
550
514
|
}
|
|
551
|
-
|
|
552
515
|
}
|
|
553
516
|
|
|
554
|
-
|
|
555
517
|
export interface WebRPCError extends Error {
|
|
556
518
|
code: string
|
|
557
519
|
msg: string
|
|
558
|
-
|
|
520
|
+
status: number
|
|
559
521
|
}
|
|
560
522
|
|
|
561
523
|
const createHTTPRequest = (body: object = {}, headers: object = {}): object => {
|
|
@@ -571,7 +533,7 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
571
533
|
let data
|
|
572
534
|
try {
|
|
573
535
|
data = JSON.parse(text)
|
|
574
|
-
} catch(err) {
|
|
536
|
+
} catch (err) {
|
|
575
537
|
throw { code: 'unknown', msg: `expecting JSON, got: ${text}`, status: res.status } as WebRPCError
|
|
576
538
|
}
|
|
577
539
|
if (!res.ok) {
|