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 | 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x | import { Command } from 'commander'; import { MissingProgramOption } from '../errors'; import { STAKE_POOL_METADATA_QUEUE } from '@cardano-sdk/projection-typeorm'; import { addOptions, newOption } from './util'; import { urlValidator } from '../../util/validators'; export enum StakePoolMetadataOptionDescriptions { Mode = 'This mode governs where the stake pool metadata is fetched from', Url = 'SMASH server api url' } export enum StakePoolMetadataFetchMode { /** * Use metadata available from the provided data by the projection. Projection reads its data directly from the certificate. */ DIRECT = 'direct', /** Use configured SMASH server to fetch stake pool metadata. */ SMASH = 'smash' } export interface StakePoolMetadataProgramOptions { smashUrl?: string; metadataFetchMode: StakePoolMetadataFetchMode; } export const withStakePoolMetadataOptions = (command: Command) => { addOptions(command, [ newOption( '--metadata-fetch-mode <metadataFetchMode>', StakePoolMetadataOptionDescriptions.Mode, 'METADATA_FETCH_MODE', (mode: string) => StakePoolMetadataFetchMode[mode.toUpperCase() as keyof typeof StakePoolMetadataFetchMode], 'direct' ).choices(['direct', 'smash']), newOption( '--smash-url <smashUrl>', StakePoolMetadataOptionDescriptions.Url, 'SMASH_URL', urlValidator(StakePoolMetadataOptionDescriptions.Url, true) ) ]); return command; }; export const checkProgramOptions = (metadataFetchMode: StakePoolMetadataFetchMode, smashUrl: string | undefined) => { Iif (metadataFetchMode === StakePoolMetadataFetchMode.SMASH && !smashUrl) throw new MissingProgramOption(STAKE_POOL_METADATA_QUEUE, 'smash-url to be set when metadata-fetch-mode is smash'); }; |