import { BlockService } from './block-service' ; import { Logger } from 'fastify' ; export interface ConstructionService { param relativeTtl calculateRelativeTtl ( relativeTtl ? ) : number ; param ttlOffset calculateTtl ( logger , ttlOffset ) : Promise < number > ; } const configure = ( blockService , defaultRelativeTTL ) : ConstructionService => ( { calculateRelativeTtl : relativeTtl => ( relativeTtl ? relativeTtl : defaultRelativeTTL ) , calculateTtl : async ( logger , ttlOffset ) => { const latestBlock = await blockService . getLatestBlock ( logger ) ; return latestBlock . slotNo + ttlOffset ; } } ) ; export default configure ;