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