feat(core): add a new codec to core (#22326)

This commit is contained in:
Marko
2024-10-28 13:08:08 +00:00
committed by GitHub
parent 94919dc99a
commit 6e3b2df7f9
10 changed files with 527 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package codec
import "cosmossdk.io/core/transaction"
// 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(transaction.Msg) ([]byte, error)
Unmarshal([]byte, transaction.Msg) error
}
// JSONCodec defines a JSON encoding and decoding interface for modules to encode and decode data.
type JSONCodec interface {
MarshalJSON(transaction.Msg) ([]byte, error)
UnmarshalJSON([]byte, transaction.Msg) error
}