cosmos-sdk/collections/corecompat/codec.go
Aaron Craelius 2ccf08a3fe
refactor(collections): remove core dependency (#24081)
Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
2025-03-28 22:22:27 +00:00

27 lines
703 B
Go

package corecompat
// Codec defines a Binary Codec and JSON Codec for modules to encode and decode data.
type Codec interface {
BinaryCodec
JSONCodec
}
// BinaryCodec defines a binary encoding and decoding interface for modules to encode and decode data.
type BinaryCodec interface {
Marshal(ProtoMsg) ([]byte, error)
Unmarshal([]byte, ProtoMsg) error
}
// JSONCodec defines a JSON encoding and decoding interface for modules to encode and decode data.
type JSONCodec interface {
MarshalJSON(ProtoMsg) ([]byte, error)
UnmarshalJSON([]byte, ProtoMsg) error
}
// ProtoMsg defines the legacy golang proto message interface.
type ProtoMsg = interface {
Reset()
String() string
ProtoMessage()
}