Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 9 commits into from
Oct 28, 2024
Merged
22 changes: 22 additions & 0 deletions core/codec/codec.go
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package codec

import "cosmossdk.io/core/transaction"

// Codec defines a Binary Codec and JSON Codec for modules to encode and decode data
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
type Codec interface {
BinaryCodec
JSONCodec
}

// BinaryCodec defines a binary encoding and decoding interface for modules to encode and decode data
// The Binary Codec uses protobuf
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
}
Loading