Filters a list of StateAndRef objects according to the type of the states
fun <T : ContractState> Iterable<StateAndRef<ContractState>>.filterStatesOfType(): List<StateAndRef<T>>