4import { DateTime } from 'luxon' 7const formatFailedSources = (failedSources: string[] | undefined, source: string | undefined) => 8 failedSources?.length ? ` ${chalkYellow(`(${failedSources.join(', ')} unreachable, fell back to ${source})`)}` : '' 10export const mkValidatorCheck = ({ethValidatorNum}: {ethValidatorNum: number}) => async ({ethStatusCfgs}: {ethStatusCfgs?: any[]} = {}) => { 11 const v: any = await lastValidatedAt({ethValidatorNum, beaconFallbackCfgs: ethStatusCfgs}) 12 const srcWarn = formatFailedSources(v.failedSources, v.source) 13 const prefix = `\n${chalkCyan('Validator')} ${v.ethValidatorNum}` 15 console.log(`${prefix}: ${chalkYellow(v.error)}${srcWarn ? '\n' + srcWarn : ''}`) 18 console.log(`${prefix}: last attested ${chalkGreen(ago)} ago (slot ${v.slot}) via ${v.source}${srcWarn ? '\n' + srcWarn : ''}`)