refactor(server/v2/cometbft): add codec.Codec
and clean-up APIs
#22566
+174
−147
codec.Codec
and clean-up APIs
#22566