1
1
/* eslint-disable complexity */
2
2
/* eslint-disable sonarjs/cognitive-complexity */
3
- import {
4
- AssetHttpService ,
5
- CardanoTokenRegistry ,
6
- DbSyncAssetProvider ,
7
- DbSyncNftMetadataService ,
8
- StubTokenMetadataService
9
- } from '../../Asset' ;
3
+ import { AssetHttpService } from '../../Asset/AssetHttpService' ;
10
4
import { CardanoNode } from '@cardano-sdk/core' ;
5
+ import { CardanoTokenRegistry } from '../../Asset/CardanoTokenRegistry' ;
11
6
import { ChainHistoryHttpService , DbSyncChainHistoryProvider } from '../../ChainHistory' ;
12
- import {
13
- CommonProgramOptions ,
14
- OgmiosProgramOptions ,
15
- PosgresProgramOptions ,
16
- PostgresOptionDescriptions ,
17
- RabbitMqProgramOptions
18
- } from '../options' ;
7
+ import { DbSyncAssetProvider } from '../../Asset/DbSyncAssetProvider' ;
19
8
import { DbSyncEpochPollService , loadGenesisData } from '../../util' ;
20
9
import { DbSyncNetworkInfoProvider , NetworkInfoHttpService } from '../../NetworkInfo' ;
10
+ import { DbSyncNftMetadataService , StubTokenMetadataService } from '../../Asset' ;
21
11
import { DbSyncRewardsProvider , RewardsHttpService } from '../../Rewards' ;
22
12
import { DbSyncStakePoolProvider , StakePoolHttpService , createHttpStakePoolMetadataService } from '../../StakePool' ;
23
13
import { DbSyncUtxoProvider , UtxoHttpService } from '../../Utxo' ;
@@ -28,6 +18,8 @@ import { InMemoryCache, NoCache } from '../../InMemoryCache';
28
18
import { Logger } from 'ts-log' ;
29
19
import { MissingProgramOption , MissingServiceDependency , RunnableDependencies , UnknownServiceName } from '../errors' ;
30
20
import { OgmiosCardanoNode } from '@cardano-sdk/ogmios' ;
21
+ import { PostgresOptionDescriptions } from '../options/postgres' ;
22
+ import { ProviderServerArgs , ProviderServerOptionDescriptions , ServiceNames } from './types' ;
31
23
import { SrvRecord } from 'dns' ;
32
24
import { TxSubmitHttpService } from '../../TxSubmit' ;
33
25
import { URL } from 'url' ;
@@ -45,20 +37,6 @@ export const PAGINATION_PAGE_SIZE_LIMIT_DEFAULT = 25;
45
37
export const USE_BLOCKFROST_DEFAULT = false ;
46
38
export const USE_QUEUE_DEFAULT = false ;
47
39
48
- /**
49
- * Used as mount segments, so must be URL-friendly
50
- *
51
- */
52
- export enum ServiceNames {
53
- Asset = 'asset' ,
54
- StakePool = 'stake-pool' ,
55
- NetworkInfo = 'network-info' ,
56
- TxSubmit = 'tx-submit' ,
57
- Utxo = 'utxo' ,
58
- ChainHistory = 'chain-history' ,
59
- Rewards = 'rewards'
60
- }
61
-
62
40
export const cardanoNodeDependantServices = new Set ( [
63
41
ServiceNames . NetworkInfo ,
64
42
ServiceNames . StakePool ,
@@ -68,37 +46,6 @@ export const cardanoNodeDependantServices = new Set([
68
46
ServiceNames . ChainHistory
69
47
] ) ;
70
48
71
- export enum ProviderServerOptionDescriptions {
72
- CardanoNodeConfigPath = 'Cardano node config path' ,
73
- DbCacheTtl = 'Cache TTL in seconds between 60 and 172800 (two days), an option for database related operations' ,
74
- DisableDbCache = 'Disable DB cache' ,
75
- DisableStakePoolMetricApy = 'Omit this metric for improved query performance' ,
76
- EpochPollInterval = 'Epoch poll interval' ,
77
- TokenMetadataCacheTtl = 'Token Metadata API cache TTL in minutes' ,
78
- TokenMetadataServerUrl = 'Token Metadata API server URL' ,
79
- UseBlockfrost = 'Enables Blockfrost cached data DB' ,
80
- UseQueue = 'Enables RabbitMQ' ,
81
- PaginationPageSizeLimit = 'Pagination page size limit shared across all providers'
82
- }
83
-
84
- export type ProviderServerArgs = CommonProgramOptions &
85
- PosgresProgramOptions &
86
- OgmiosProgramOptions &
87
- RabbitMqProgramOptions & {
88
- cardanoNodeConfigPath ?: string ;
89
- disableDbCache ?: boolean ;
90
- disableStakePoolMetricApy ?: boolean ;
91
- tokenMetadataCacheTTL ?: number ;
92
- tokenMetadataServerUrl ?: string ;
93
- tokenMetadataRequestTimeout ?: number ;
94
- epochPollInterval : number ;
95
- dbCacheTtl : number ;
96
- useBlockfrost ?: boolean ;
97
- useQueue ?: boolean ;
98
- paginationPageSizeLimit ?: number ;
99
- serviceNames : ServiceNames [ ] ;
100
- } ;
101
-
102
49
export interface LoadProviderServerDependencies {
103
50
dnsResolver ?: ( serviceName : string ) => Promise < SrvRecord > ;
104
51
logger ?: Logger ;
0 commit comments