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