-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a new codec to avoid sdk imports in modules
- Loading branch information
1 parent
6e59ad0
commit beec467
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |