All files / src/Program/options providers.ts

90.9% Statements 10/11
100% Branches 2/2
50% Functions 1/2
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 7438x   38x 38x 38x 38x   38x 38x                       38x 38x 38x                                                                                                      
import { newOption } from './util';
 
export enum ProviderImplementation {
  TYPEORM = 'typeorm',
  BLOCKFROST = 'blockfrost',
  DBSYNC = 'dbsync',
  // Below ones are specific to TxSubmitProvider
  SUBMIT_NODE = 'submit-node',
  SUBMIT_API = 'submit-api'
}
 
export type ProviderImplementations = {
  assetProvider?: ProviderImplementation;
  rewardsProvider?: ProviderImplementation;
  networkInfoProvider?: ProviderImplementation;
  utxoProvider?: ProviderImplementation;
  txSubmitProvider?: ProviderImplementation;
  chainHistoryProvider?: ProviderImplementation;
  stakePoolProvider?: ProviderImplementation;
};
export const ProviderImplementationDescription = 'Select one of the available provider implementations';
const argParser = (impl: string) => ProviderImplementation[impl.toUpperCase() as keyof typeof ProviderImplementation];
export const providerSelectionOptions = [
  newOption(
    '--asset-provider <assetProvider>',
    ProviderImplementationDescription,
    'ASSET_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.DBSYNC, ProviderImplementation.TYPEORM]),
  newOption(
    '--stake-pool-provider <stakePoolProvider>',
    ProviderImplementationDescription,
    'STAKE_POOL_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.DBSYNC, ProviderImplementation.TYPEORM]),
  newOption(
    '--utxo-provider <utxoProvider>',
    ProviderImplementationDescription,
    'UTXO_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.DBSYNC]),
  newOption(
    '--chain-history-provider <chainHistoryProvider>',
    ProviderImplementationDescription,
    'CHAIN_HISTORY_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.DBSYNC]),
  newOption(
    '--rewards-provider <rewardsProvider>',
    ProviderImplementationDescription,
    'REWARDS_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.DBSYNC]),
  newOption(
    '--network-info-provider <networkInfoProvider>',
    ProviderImplementationDescription,
    'NETWORK_INFO_PROVIDER',
    argParser,
    ProviderImplementation.DBSYNC
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.DBSYNC]),
  newOption(
    '--tx-submit-provider <txSubmitProvider>',
    ProviderImplementationDescription,
    'TX_SUBMIT_PROVIDER',
    argParser,
    ProviderImplementation.SUBMIT_NODE
  ).choices([ProviderImplementation.BLOCKFROST, ProviderImplementation.SUBMIT_API, ProviderImplementation.SUBMIT_NODE])
];