import { StateVariables } from '@statechannels/wallet-core' ; import { ChannelState , ChannelStateWithSupported , ChannelStateWithMe } from '../protocols/state' ; export const hasStateSignedByMe = ( cs ) : cs is ChannelStateWithMe => ! ! cs . latestSignedByMe ; export const hasSupportedState = ( cs ) : cs is ChannelStateWithSupported => ! ! cs . supported ; export const isMyTurn = ( cs ) : boolean => ( cs . supported . turnNum + 1 ) % cs . supported . participants . length === cs . myIndex ; export const latest = ( cs ) : StateVariables => cs . latest ; export const supported = ( cs ) : StateVariables => cs . supported ; export const latestSignedByMe = ( cs ) : StateVariables => cs . latestSignedByMe ;