Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions core/codec/codec.go
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
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
}