import { isValidRange , ZERO } from '@pigi/core-utils' ; import { StateObject , StateUpdate , Transaction , VerifiedStateUpdate , } from './state.interface' ; param stateObject returns export const isValidStateObject = ( stateObject ) : stateObject is StateObject => { return ! ! stateObject . predicateAddress && ! ! stateObject . data ; } ; param stateUpdate returns export const isValidStateUpdate = ( stateUpdate ) : stateUpdate is StateUpdate => { return ( ! ! stateUpdate && ! ! stateUpdate . stateObject && ! ! stateUpdate . range && ! ! stateUpdate . depositAddress && stateUpdate . plasmaBlockNumber . gt ( ZERO ) && isValidRange ( stateUpdate . range ) && isValidStateObject ( stateUpdate . stateObject ) ) ; } ; param transaction returns export const isValidTransaction = ( transaction ) : transaction is Transaction => { return ( ! ! transaction && ! ! transaction . range && ! ! transaction . depositAddress && isValidRange ( transaction . range ) ) ; } ; param verifiedUpdate returns export const isValidVerifiedStateUpdate = ( verifiedUpdate ) : verifiedUpdate is VerifiedStateUpdate => { return ( ! ! verifiedUpdate && ! ! verifiedUpdate . range && verifiedUpdate . verifiedBlockNumber . gte ( ZERO ) && isValidRange ( verifiedUpdate . range ) && isValidStateUpdate ( verifiedUpdate . stateUpdate ) ) ; } ;