@0xsequence/indexer 1.4.4 → 1.4.6
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.
|
@@ -18,20 +18,20 @@ function _extends() {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/* eslint-disable */
|
|
21
|
-
// sequence-indexer v0.4.0
|
|
21
|
+
// sequence-indexer v0.4.0 5e8b22ffb607b0fef3e36af5e781229c03db68ac
|
|
22
22
|
// --
|
|
23
23
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
24
24
|
//
|
|
25
25
|
// webrpc-gen -schema=indexer.ridl -target=typescript@v0.10.0 -client -out=./clients/indexer.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 = "5e8b22ffb607b0fef3e36af5e781229c03db68ac";
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
@@ -18,20 +18,20 @@ function _extends() {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/* eslint-disable */
|
|
21
|
-
// sequence-indexer v0.4.0
|
|
21
|
+
// sequence-indexer v0.4.0 5e8b22ffb607b0fef3e36af5e781229c03db68ac
|
|
22
22
|
// --
|
|
23
23
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
24
24
|
//
|
|
25
25
|
// webrpc-gen -schema=indexer.ridl -target=typescript@v0.10.0 -client -out=./clients/indexer.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 = "5e8b22ffb607b0fef3e36af5e781229c03db68ac";
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
@@ -14,20 +14,20 @@ function _extends() {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/* eslint-disable */
|
|
17
|
-
// sequence-indexer v0.4.0
|
|
17
|
+
// sequence-indexer v0.4.0 5e8b22ffb607b0fef3e36af5e781229c03db68ac
|
|
18
18
|
// --
|
|
19
19
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
20
20
|
//
|
|
21
21
|
// webrpc-gen -schema=indexer.ridl -target=typescript@v0.10.0 -client -out=./clients/indexer.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 = "5e8b22ffb607b0fef3e36af5e781229c03db68ac";
|
|
31
31
|
|
|
32
32
|
//
|
|
33
33
|
// Types
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const WebRPCVersion = "v1";
|
|
2
2
|
export declare const WebRPCSchemaVersion = "v0.4.0";
|
|
3
|
-
export declare const WebRPCSchemaHash = "
|
|
3
|
+
export declare const WebRPCSchemaHash = "5e8b22ffb607b0fef3e36af5e781229c03db68ac";
|
|
4
4
|
export interface ContractInfo {
|
|
5
5
|
chainId: number;
|
|
6
6
|
address: string;
|
|
@@ -278,8 +278,8 @@ export interface WebhookEventFilter {
|
|
|
278
278
|
accounts?: Array<string>;
|
|
279
279
|
}
|
|
280
280
|
export interface MetadataOptions {
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
omitUnverified?: boolean;
|
|
282
|
+
includeContracts?: Array<string>;
|
|
283
283
|
}
|
|
284
284
|
export interface Indexer {
|
|
285
285
|
ping(headers?: object): Promise<PingReturn>;
|
package/package.json
CHANGED
package/src/indexer.gen.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-indexer v0.4.0
|
|
2
|
+
// sequence-indexer v0.4.0 5e8b22ffb607b0fef3e36af5e781229c03db68ac
|
|
3
3
|
// --
|
|
4
4
|
// Code generated by webrpc-gen@v0.12.x-dev with typescript@v0.10.0 generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
6
|
// webrpc-gen -schema=indexer.ridl -target=typescript@v0.10.0 -client -out=./clients/indexer.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 = "5e8b22ffb607b0fef3e36af5e781229c03db68ac"
|
|
16
16
|
|
|
17
17
|
//
|
|
18
18
|
// Types
|
|
19
19
|
//
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
export interface ContractInfo {
|
|
22
23
|
chainId: number
|
|
23
24
|
address: string
|
|
@@ -29,6 +30,7 @@ export interface ContractInfo {
|
|
|
29
30
|
deployed: boolean
|
|
30
31
|
bytecodeHash: string
|
|
31
32
|
extensions: ContractInfoExtensions
|
|
33
|
+
|
|
32
34
|
updatedAt: string
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -50,14 +52,14 @@ export interface TokenMetadata {
|
|
|
50
52
|
description: string
|
|
51
53
|
image: string
|
|
52
54
|
decimals: number
|
|
53
|
-
properties: {
|
|
55
|
+
properties: {[key: string]: any}
|
|
54
56
|
video: string
|
|
55
57
|
audio: string
|
|
56
58
|
image_data: string
|
|
57
59
|
external_url: string
|
|
58
60
|
background_color: string
|
|
59
61
|
animation_url: string
|
|
60
|
-
attributes: Array<{
|
|
62
|
+
attributes: Array<{[key: string]: any}>
|
|
61
63
|
updatedAt: string
|
|
62
64
|
}
|
|
63
65
|
export enum ContractType {
|
|
@@ -190,7 +192,7 @@ export interface TokenBalance {
|
|
|
190
192
|
blockHash: string
|
|
191
193
|
blockNumber: number
|
|
192
194
|
chainId: number
|
|
193
|
-
|
|
195
|
+
|
|
194
196
|
contractInfo?: ContractInfo
|
|
195
197
|
tokenMetadata?: TokenMetadata
|
|
196
198
|
}
|
|
@@ -240,7 +242,7 @@ export interface TxnTransfer {
|
|
|
240
242
|
amounts: Array<string>
|
|
241
243
|
logIndex: number
|
|
242
244
|
contractInfo?: ContractInfo
|
|
243
|
-
tokenMetadata?: {
|
|
245
|
+
tokenMetadata?: {[key: string]: TokenMetadata}
|
|
244
246
|
}
|
|
245
247
|
|
|
246
248
|
export interface TransactionHistoryFilter {
|
|
@@ -316,8 +318,8 @@ export interface WebhookEventFilter {
|
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
export interface MetadataOptions {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
+
omitUnverified?: boolean
|
|
322
|
+
includeContracts?: Array<string>
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
export interface Indexer {
|
|
@@ -333,10 +335,7 @@ export interface Indexer {
|
|
|
333
335
|
getTransactionHistory(args: GetTransactionHistoryArgs, headers?: object): Promise<GetTransactionHistoryReturn>
|
|
334
336
|
syncBalance(args: SyncBalanceArgs, headers?: object): Promise<SyncBalanceReturn>
|
|
335
337
|
fetchTransactionReceipt(args: FetchTransactionReceiptArgs, headers?: object): Promise<FetchTransactionReceiptReturn>
|
|
336
|
-
fetchTransactionReceiptWithFilter(
|
|
337
|
-
args: FetchTransactionReceiptWithFilterArgs,
|
|
338
|
-
headers?: object
|
|
339
|
-
): Promise<FetchTransactionReceiptWithFilterReturn>
|
|
338
|
+
fetchTransactionReceiptWithFilter(args: FetchTransactionReceiptWithFilterArgs, headers?: object): Promise<FetchTransactionReceiptWithFilterReturn>
|
|
340
339
|
getAllWebhookListeners(args: GetAllWebhookListenersArgs, headers?: object): Promise<GetAllWebhookListenersReturn>
|
|
341
340
|
getWebhookListener(args: GetWebhookListenerArgs, headers?: object): Promise<GetWebhookListenerReturn>
|
|
342
341
|
addWebhookListener(args: AddWebhookListenerArgs, headers?: object): Promise<AddWebhookListenerReturn>
|
|
@@ -344,32 +343,36 @@ export interface Indexer {
|
|
|
344
343
|
removeWebhookListener(args: RemoveWebhookListenerArgs, headers?: object): Promise<RemoveWebhookListenerReturn>
|
|
345
344
|
}
|
|
346
345
|
|
|
347
|
-
export interface PingArgs {
|
|
346
|
+
export interface PingArgs {
|
|
347
|
+
}
|
|
348
348
|
|
|
349
349
|
export interface PingReturn {
|
|
350
|
-
status: boolean
|
|
350
|
+
status: boolean
|
|
351
|
+
}
|
|
352
|
+
export interface VersionArgs {
|
|
351
353
|
}
|
|
352
|
-
export interface VersionArgs {}
|
|
353
354
|
|
|
354
355
|
export interface VersionReturn {
|
|
355
|
-
version: Version
|
|
356
|
+
version: Version
|
|
357
|
+
}
|
|
358
|
+
export interface RuntimeStatusArgs {
|
|
356
359
|
}
|
|
357
|
-
export interface RuntimeStatusArgs {}
|
|
358
360
|
|
|
359
361
|
export interface RuntimeStatusReturn {
|
|
360
|
-
status: RuntimeStatus
|
|
362
|
+
status: RuntimeStatus
|
|
363
|
+
}
|
|
364
|
+
export interface GetChainIDArgs {
|
|
361
365
|
}
|
|
362
|
-
export interface GetChainIDArgs {}
|
|
363
366
|
|
|
364
367
|
export interface GetChainIDReturn {
|
|
365
|
-
chainID: number
|
|
368
|
+
chainID: number
|
|
366
369
|
}
|
|
367
370
|
export interface GetEtherBalanceArgs {
|
|
368
371
|
accountAddress?: string
|
|
369
372
|
}
|
|
370
373
|
|
|
371
374
|
export interface GetEtherBalanceReturn {
|
|
372
|
-
balance: EtherBalance
|
|
375
|
+
balance: EtherBalance
|
|
373
376
|
}
|
|
374
377
|
export interface GetTokenBalancesArgs {
|
|
375
378
|
accountAddress?: string
|
|
@@ -382,7 +385,7 @@ export interface GetTokenBalancesArgs {
|
|
|
382
385
|
|
|
383
386
|
export interface GetTokenBalancesReturn {
|
|
384
387
|
page: Page
|
|
385
|
-
balances: Array<TokenBalance>
|
|
388
|
+
balances: Array<TokenBalance>
|
|
386
389
|
}
|
|
387
390
|
export interface GetTokenSuppliesArgs {
|
|
388
391
|
contractAddress: string
|
|
@@ -394,16 +397,16 @@ export interface GetTokenSuppliesArgs {
|
|
|
394
397
|
export interface GetTokenSuppliesReturn {
|
|
395
398
|
page: Page
|
|
396
399
|
contractType: ContractType
|
|
397
|
-
tokenIDs: Array<TokenSupply>
|
|
400
|
+
tokenIDs: Array<TokenSupply>
|
|
398
401
|
}
|
|
399
402
|
export interface GetTokenSuppliesMapArgs {
|
|
400
|
-
tokenMap: {
|
|
403
|
+
tokenMap: {[key: string]: Array<string>}
|
|
401
404
|
includeMetadata?: boolean
|
|
402
405
|
metadataOptions?: MetadataOptions
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
export interface GetTokenSuppliesMapReturn {
|
|
406
|
-
supplies: {
|
|
409
|
+
supplies: {[key: string]: Array<TokenSupply>}
|
|
407
410
|
}
|
|
408
411
|
export interface GetBalanceUpdatesArgs {
|
|
409
412
|
contractAddress: string
|
|
@@ -414,7 +417,7 @@ export interface GetBalanceUpdatesArgs {
|
|
|
414
417
|
|
|
415
418
|
export interface GetBalanceUpdatesReturn {
|
|
416
419
|
page: Page
|
|
417
|
-
balances: Array<TokenBalance>
|
|
420
|
+
balances: Array<TokenBalance>
|
|
418
421
|
}
|
|
419
422
|
export interface GetTransactionHistoryArgs {
|
|
420
423
|
filter: TransactionHistoryFilter
|
|
@@ -425,7 +428,7 @@ export interface GetTransactionHistoryArgs {
|
|
|
425
428
|
|
|
426
429
|
export interface GetTransactionHistoryReturn {
|
|
427
430
|
page: Page
|
|
428
|
-
transactions: Array<Transaction>
|
|
431
|
+
transactions: Array<Transaction>
|
|
429
432
|
}
|
|
430
433
|
export interface SyncBalanceArgs {
|
|
431
434
|
accountAddress: string
|
|
@@ -433,14 +436,15 @@ export interface SyncBalanceArgs {
|
|
|
433
436
|
tokenID?: string
|
|
434
437
|
}
|
|
435
438
|
|
|
436
|
-
export interface SyncBalanceReturn {
|
|
439
|
+
export interface SyncBalanceReturn {
|
|
440
|
+
}
|
|
437
441
|
export interface FetchTransactionReceiptArgs {
|
|
438
442
|
txnHash: string
|
|
439
443
|
maxBlockWait?: number
|
|
440
444
|
}
|
|
441
445
|
|
|
442
446
|
export interface FetchTransactionReceiptReturn {
|
|
443
|
-
receipt: TransactionReceipt
|
|
447
|
+
receipt: TransactionReceipt
|
|
444
448
|
}
|
|
445
449
|
export interface FetchTransactionReceiptWithFilterArgs {
|
|
446
450
|
filter: Filter
|
|
@@ -448,14 +452,14 @@ export interface FetchTransactionReceiptWithFilterArgs {
|
|
|
448
452
|
}
|
|
449
453
|
|
|
450
454
|
export interface FetchTransactionReceiptWithFilterReturn {
|
|
451
|
-
receipt: TransactionReceipt
|
|
455
|
+
receipt: TransactionReceipt
|
|
452
456
|
}
|
|
453
457
|
export interface GetAllWebhookListenersArgs {
|
|
454
458
|
projectId?: number
|
|
455
459
|
}
|
|
456
460
|
|
|
457
461
|
export interface GetAllWebhookListenersReturn {
|
|
458
|
-
listeners: Array<WebhookListener>
|
|
462
|
+
listeners: Array<WebhookListener>
|
|
459
463
|
}
|
|
460
464
|
export interface GetWebhookListenerArgs {
|
|
461
465
|
id: number
|
|
@@ -463,7 +467,7 @@ export interface GetWebhookListenerArgs {
|
|
|
463
467
|
}
|
|
464
468
|
|
|
465
469
|
export interface GetWebhookListenerReturn {
|
|
466
|
-
listener: WebhookListener
|
|
470
|
+
listener: WebhookListener
|
|
467
471
|
}
|
|
468
472
|
export interface AddWebhookListenerArgs {
|
|
469
473
|
url: string
|
|
@@ -473,7 +477,7 @@ export interface AddWebhookListenerArgs {
|
|
|
473
477
|
|
|
474
478
|
export interface AddWebhookListenerReturn {
|
|
475
479
|
status: boolean
|
|
476
|
-
listener: WebhookListener
|
|
480
|
+
listener: WebhookListener
|
|
477
481
|
}
|
|
478
482
|
export interface UpdateWebhookListenerArgs {
|
|
479
483
|
listener: WebhookListener
|
|
@@ -481,7 +485,7 @@ export interface UpdateWebhookListenerArgs {
|
|
|
481
485
|
}
|
|
482
486
|
|
|
483
487
|
export interface UpdateWebhookListenerReturn {
|
|
484
|
-
status: boolean
|
|
488
|
+
status: boolean
|
|
485
489
|
}
|
|
486
490
|
export interface RemoveWebhookListenerArgs {
|
|
487
491
|
id: number
|
|
@@ -489,9 +493,11 @@ export interface RemoveWebhookListenerArgs {
|
|
|
489
493
|
}
|
|
490
494
|
|
|
491
495
|
export interface RemoveWebhookListenerReturn {
|
|
492
|
-
status: boolean
|
|
496
|
+
status: boolean
|
|
493
497
|
}
|
|
494
498
|
|
|
499
|
+
|
|
500
|
+
|
|
495
501
|
//
|
|
496
502
|
// Client
|
|
497
503
|
//
|
|
@@ -508,199 +514,239 @@ export class Indexer implements Indexer {
|
|
|
508
514
|
private url(name: string): string {
|
|
509
515
|
return this.hostname + this.path + name
|
|
510
516
|
}
|
|
511
|
-
|
|
517
|
+
|
|
512
518
|
ping = (headers?: object): Promise<PingReturn> => {
|
|
513
|
-
return this.fetch(
|
|
519
|
+
return this.fetch(
|
|
520
|
+
this.url('Ping'),
|
|
521
|
+
createHTTPRequest({}, headers)
|
|
522
|
+
).then((res) => {
|
|
514
523
|
return buildResponse(res).then(_data => {
|
|
515
524
|
return {
|
|
516
|
-
status: <boolean>_data.status
|
|
525
|
+
status: <boolean>(_data.status)
|
|
517
526
|
}
|
|
518
527
|
})
|
|
519
528
|
})
|
|
520
529
|
}
|
|
521
|
-
|
|
530
|
+
|
|
522
531
|
version = (headers?: object): Promise<VersionReturn> => {
|
|
523
|
-
return this.fetch(
|
|
532
|
+
return this.fetch(
|
|
533
|
+
this.url('Version'),
|
|
534
|
+
createHTTPRequest({}, headers)
|
|
535
|
+
).then((res) => {
|
|
524
536
|
return buildResponse(res).then(_data => {
|
|
525
537
|
return {
|
|
526
|
-
version: <Version>_data.version
|
|
538
|
+
version: <Version>(_data.version)
|
|
527
539
|
}
|
|
528
540
|
})
|
|
529
541
|
})
|
|
530
542
|
}
|
|
531
|
-
|
|
543
|
+
|
|
532
544
|
runtimeStatus = (headers?: object): Promise<RuntimeStatusReturn> => {
|
|
533
|
-
return this.fetch(
|
|
545
|
+
return this.fetch(
|
|
546
|
+
this.url('RuntimeStatus'),
|
|
547
|
+
createHTTPRequest({}, headers)
|
|
548
|
+
).then((res) => {
|
|
534
549
|
return buildResponse(res).then(_data => {
|
|
535
550
|
return {
|
|
536
|
-
status: <RuntimeStatus>_data.status
|
|
551
|
+
status: <RuntimeStatus>(_data.status)
|
|
537
552
|
}
|
|
538
553
|
})
|
|
539
554
|
})
|
|
540
555
|
}
|
|
541
|
-
|
|
556
|
+
|
|
542
557
|
getChainID = (headers?: object): Promise<GetChainIDReturn> => {
|
|
543
|
-
return this.fetch(
|
|
558
|
+
return this.fetch(
|
|
559
|
+
this.url('GetChainID'),
|
|
560
|
+
createHTTPRequest({}, headers)
|
|
561
|
+
).then((res) => {
|
|
544
562
|
return buildResponse(res).then(_data => {
|
|
545
563
|
return {
|
|
546
|
-
chainID: <number>_data.chainID
|
|
564
|
+
chainID: <number>(_data.chainID)
|
|
547
565
|
}
|
|
548
566
|
})
|
|
549
567
|
})
|
|
550
568
|
}
|
|
551
|
-
|
|
569
|
+
|
|
552
570
|
getEtherBalance = (args: GetEtherBalanceArgs, headers?: object): Promise<GetEtherBalanceReturn> => {
|
|
553
|
-
return this.fetch(
|
|
571
|
+
return this.fetch(
|
|
572
|
+
this.url('GetEtherBalance'),
|
|
573
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
554
574
|
return buildResponse(res).then(_data => {
|
|
555
575
|
return {
|
|
556
|
-
balance: <EtherBalance>_data.balance
|
|
576
|
+
balance: <EtherBalance>(_data.balance)
|
|
557
577
|
}
|
|
558
578
|
})
|
|
559
579
|
})
|
|
560
580
|
}
|
|
561
|
-
|
|
581
|
+
|
|
562
582
|
getTokenBalances = (args: GetTokenBalancesArgs, headers?: object): Promise<GetTokenBalancesReturn> => {
|
|
563
|
-
return this.fetch(
|
|
583
|
+
return this.fetch(
|
|
584
|
+
this.url('GetTokenBalances'),
|
|
585
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
564
586
|
return buildResponse(res).then(_data => {
|
|
565
587
|
return {
|
|
566
|
-
page: <Page>_data.page,
|
|
567
|
-
balances: <Array<TokenBalance>>_data.balances
|
|
588
|
+
page: <Page>(_data.page),
|
|
589
|
+
balances: <Array<TokenBalance>>(_data.balances)
|
|
568
590
|
}
|
|
569
591
|
})
|
|
570
592
|
})
|
|
571
593
|
}
|
|
572
|
-
|
|
594
|
+
|
|
573
595
|
getTokenSupplies = (args: GetTokenSuppliesArgs, headers?: object): Promise<GetTokenSuppliesReturn> => {
|
|
574
|
-
return this.fetch(
|
|
596
|
+
return this.fetch(
|
|
597
|
+
this.url('GetTokenSupplies'),
|
|
598
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
575
599
|
return buildResponse(res).then(_data => {
|
|
576
600
|
return {
|
|
577
|
-
page: <Page>_data.page,
|
|
578
|
-
contractType: <ContractType>_data.contractType,
|
|
579
|
-
tokenIDs: <Array<TokenSupply>>_data.tokenIDs
|
|
601
|
+
page: <Page>(_data.page),
|
|
602
|
+
contractType: <ContractType>(_data.contractType),
|
|
603
|
+
tokenIDs: <Array<TokenSupply>>(_data.tokenIDs)
|
|
580
604
|
}
|
|
581
605
|
})
|
|
582
606
|
})
|
|
583
607
|
}
|
|
584
|
-
|
|
608
|
+
|
|
585
609
|
getTokenSuppliesMap = (args: GetTokenSuppliesMapArgs, headers?: object): Promise<GetTokenSuppliesMapReturn> => {
|
|
586
|
-
return this.fetch(
|
|
610
|
+
return this.fetch(
|
|
611
|
+
this.url('GetTokenSuppliesMap'),
|
|
612
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
587
613
|
return buildResponse(res).then(_data => {
|
|
588
614
|
return {
|
|
589
|
-
supplies: <{
|
|
615
|
+
supplies: <{[key: string]: Array<TokenSupply>}>(_data.supplies)
|
|
590
616
|
}
|
|
591
617
|
})
|
|
592
618
|
})
|
|
593
619
|
}
|
|
594
|
-
|
|
620
|
+
|
|
595
621
|
getBalanceUpdates = (args: GetBalanceUpdatesArgs, headers?: object): Promise<GetBalanceUpdatesReturn> => {
|
|
596
|
-
return this.fetch(
|
|
622
|
+
return this.fetch(
|
|
623
|
+
this.url('GetBalanceUpdates'),
|
|
624
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
597
625
|
return buildResponse(res).then(_data => {
|
|
598
626
|
return {
|
|
599
|
-
page: <Page>_data.page,
|
|
600
|
-
balances: <Array<TokenBalance>>_data.balances
|
|
627
|
+
page: <Page>(_data.page),
|
|
628
|
+
balances: <Array<TokenBalance>>(_data.balances)
|
|
601
629
|
}
|
|
602
630
|
})
|
|
603
631
|
})
|
|
604
632
|
}
|
|
605
|
-
|
|
633
|
+
|
|
606
634
|
getTransactionHistory = (args: GetTransactionHistoryArgs, headers?: object): Promise<GetTransactionHistoryReturn> => {
|
|
607
|
-
return this.fetch(
|
|
635
|
+
return this.fetch(
|
|
636
|
+
this.url('GetTransactionHistory'),
|
|
637
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
608
638
|
return buildResponse(res).then(_data => {
|
|
609
639
|
return {
|
|
610
|
-
page: <Page>_data.page,
|
|
611
|
-
transactions: <Array<Transaction>>_data.transactions
|
|
640
|
+
page: <Page>(_data.page),
|
|
641
|
+
transactions: <Array<Transaction>>(_data.transactions)
|
|
612
642
|
}
|
|
613
643
|
})
|
|
614
644
|
})
|
|
615
645
|
}
|
|
616
|
-
|
|
646
|
+
|
|
617
647
|
syncBalance = (args: SyncBalanceArgs, headers?: object): Promise<SyncBalanceReturn> => {
|
|
618
|
-
return this.fetch(
|
|
648
|
+
return this.fetch(
|
|
649
|
+
this.url('SyncBalance'),
|
|
650
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
619
651
|
return buildResponse(res).then(_data => {
|
|
620
|
-
return {
|
|
652
|
+
return {
|
|
653
|
+
}
|
|
621
654
|
})
|
|
622
655
|
})
|
|
623
656
|
}
|
|
624
|
-
|
|
657
|
+
|
|
625
658
|
fetchTransactionReceipt = (args: FetchTransactionReceiptArgs, headers?: object): Promise<FetchTransactionReceiptReturn> => {
|
|
626
|
-
return this.fetch(
|
|
659
|
+
return this.fetch(
|
|
660
|
+
this.url('FetchTransactionReceipt'),
|
|
661
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
627
662
|
return buildResponse(res).then(_data => {
|
|
628
663
|
return {
|
|
629
|
-
receipt: <TransactionReceipt>_data.receipt
|
|
664
|
+
receipt: <TransactionReceipt>(_data.receipt)
|
|
630
665
|
}
|
|
631
666
|
})
|
|
632
667
|
})
|
|
633
668
|
}
|
|
634
|
-
|
|
635
|
-
fetchTransactionReceiptWithFilter = (
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest(args, headers)).then(res => {
|
|
669
|
+
|
|
670
|
+
fetchTransactionReceiptWithFilter = (args: FetchTransactionReceiptWithFilterArgs, headers?: object): Promise<FetchTransactionReceiptWithFilterReturn> => {
|
|
671
|
+
return this.fetch(
|
|
672
|
+
this.url('FetchTransactionReceiptWithFilter'),
|
|
673
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
640
674
|
return buildResponse(res).then(_data => {
|
|
641
675
|
return {
|
|
642
|
-
receipt: <TransactionReceipt>_data.receipt
|
|
676
|
+
receipt: <TransactionReceipt>(_data.receipt)
|
|
643
677
|
}
|
|
644
678
|
})
|
|
645
679
|
})
|
|
646
680
|
}
|
|
647
|
-
|
|
681
|
+
|
|
648
682
|
getAllWebhookListeners = (args: GetAllWebhookListenersArgs, headers?: object): Promise<GetAllWebhookListenersReturn> => {
|
|
649
|
-
return this.fetch(
|
|
683
|
+
return this.fetch(
|
|
684
|
+
this.url('GetAllWebhookListeners'),
|
|
685
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
650
686
|
return buildResponse(res).then(_data => {
|
|
651
687
|
return {
|
|
652
|
-
listeners: <Array<WebhookListener>>_data.listeners
|
|
688
|
+
listeners: <Array<WebhookListener>>(_data.listeners)
|
|
653
689
|
}
|
|
654
690
|
})
|
|
655
691
|
})
|
|
656
692
|
}
|
|
657
|
-
|
|
693
|
+
|
|
658
694
|
getWebhookListener = (args: GetWebhookListenerArgs, headers?: object): Promise<GetWebhookListenerReturn> => {
|
|
659
|
-
return this.fetch(
|
|
695
|
+
return this.fetch(
|
|
696
|
+
this.url('GetWebhookListener'),
|
|
697
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
660
698
|
return buildResponse(res).then(_data => {
|
|
661
699
|
return {
|
|
662
|
-
listener: <WebhookListener>_data.listener
|
|
700
|
+
listener: <WebhookListener>(_data.listener)
|
|
663
701
|
}
|
|
664
702
|
})
|
|
665
703
|
})
|
|
666
704
|
}
|
|
667
|
-
|
|
705
|
+
|
|
668
706
|
addWebhookListener = (args: AddWebhookListenerArgs, headers?: object): Promise<AddWebhookListenerReturn> => {
|
|
669
|
-
return this.fetch(
|
|
707
|
+
return this.fetch(
|
|
708
|
+
this.url('AddWebhookListener'),
|
|
709
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
670
710
|
return buildResponse(res).then(_data => {
|
|
671
711
|
return {
|
|
672
|
-
status: <boolean>_data.status,
|
|
673
|
-
listener: <WebhookListener>_data.listener
|
|
712
|
+
status: <boolean>(_data.status),
|
|
713
|
+
listener: <WebhookListener>(_data.listener)
|
|
674
714
|
}
|
|
675
715
|
})
|
|
676
716
|
})
|
|
677
717
|
}
|
|
678
|
-
|
|
718
|
+
|
|
679
719
|
updateWebhookListener = (args: UpdateWebhookListenerArgs, headers?: object): Promise<UpdateWebhookListenerReturn> => {
|
|
680
|
-
return this.fetch(
|
|
720
|
+
return this.fetch(
|
|
721
|
+
this.url('UpdateWebhookListener'),
|
|
722
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
681
723
|
return buildResponse(res).then(_data => {
|
|
682
724
|
return {
|
|
683
|
-
status: <boolean>_data.status
|
|
725
|
+
status: <boolean>(_data.status)
|
|
684
726
|
}
|
|
685
727
|
})
|
|
686
728
|
})
|
|
687
729
|
}
|
|
688
|
-
|
|
730
|
+
|
|
689
731
|
removeWebhookListener = (args: RemoveWebhookListenerArgs, headers?: object): Promise<RemoveWebhookListenerReturn> => {
|
|
690
|
-
return this.fetch(
|
|
732
|
+
return this.fetch(
|
|
733
|
+
this.url('RemoveWebhookListener'),
|
|
734
|
+
createHTTPRequest(args, headers)).then((res) => {
|
|
691
735
|
return buildResponse(res).then(_data => {
|
|
692
736
|
return {
|
|
693
|
-
status: <boolean>_data.status
|
|
737
|
+
status: <boolean>(_data.status)
|
|
694
738
|
}
|
|
695
739
|
})
|
|
696
740
|
})
|
|
697
741
|
}
|
|
742
|
+
|
|
698
743
|
}
|
|
699
744
|
|
|
745
|
+
|
|
700
746
|
export interface WebRPCError extends Error {
|
|
701
747
|
code: string
|
|
702
748
|
msg: string
|
|
703
|
-
|
|
749
|
+
status: number
|
|
704
750
|
}
|
|
705
751
|
|
|
706
752
|
const createHTTPRequest = (body: object = {}, headers: object = {}): object => {
|
|
@@ -716,7 +762,7 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
716
762
|
let data
|
|
717
763
|
try {
|
|
718
764
|
data = JSON.parse(text)
|
|
719
|
-
} catch
|
|
765
|
+
} catch(err) {
|
|
720
766
|
throw { code: 'unknown', msg: `expecting JSON, got: ${text}`, status: res.status } as WebRPCError
|
|
721
767
|
}
|
|
722
768
|
if (!res.ok) {
|