import { UpdateChannelParams , CreateChannelParams , SyncChannelParams , CloseChannelParams , GetStateParams , ChannelId , ChannelResult , } from '@statechannels/client-api-schema' ; import { Config } from 'knex' ; import { ChainRequest } from '../chain-service' ; import { WalletObjective } from '../models/objective' ; import { Outgoing } from '../protocols/actions' ; import { Bytes32 } from '../type-aliases' ; import { MetricsConfiguration } from '.' ; export type SingleChannelOutput = { outbox : Outgoing [ ] ; channelResult : ChannelResult ; newObjective : WalletObjective | undefined ; chainRequests : ChainRequest [ ] ; } ; export type MultipleChannelOutput = { outbox : Outgoing [ ] ; channelResults : ChannelResult [ ] ; newObjectives : WalletObjective [ ] ; completedObjectives : WalletObjective [ ] ; chainRequests : ChainRequest [ ] ; } ; export type Output = SingleChannelOutput | MultipleChannelOutput ; export interface EngineInterface { createChannels ( args , numberOfChannels ) : Promise < MultipleChannelOutput > ; joinChannels ( channelIds ) : Promise < MultipleChannelOutput > ; updateChannel ( args ) : Promise < SingleChannelOutput > ; closeChannel ( args ) : Promise < SingleChannelOutput > ; getChannels ( ) : Promise < MultipleChannelOutput > ; getState ( args ) : Promise < SingleChannelOutput > ; syncChannels ( chanelIds ) : Promise < MultipleChannelOutput > ; syncChannel ( args ) : Promise < SingleChannelOutput > ; challenge ( channelId ) : Promise < SingleChannelOutput > ; pushMessage ( m ) : Promise < MultipleChannelOutput > ; pushUpdate ( m ) : Promise < SingleChannelOutput > ; crank ( channelIds ) : Promise < MultipleChannelOutput > ; } export function isMultipleChannelOutput ( output ) { return 'newObjectives' in output ; } export function hasNewObjective ( response ) { return ! ! response . newObjective ; } export type EngineConfig = { skipEvmValidation : boolean ; metrics : MetricsConfiguration ; dbConfig : Config ; chainNetworkID : string ; workerThreadAmount : number ; } ;