File tree Expand file tree Collapse file tree 5 files changed +14
-6
lines changed
ibc/core/03-connection/types Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,21 @@ import (
1111 "github.com/gogo/protobuf/proto"
1212)
1313
14+ // ProtoCodecMarshaler defines an interface for codecs that utilize Protobuf for both
15+ // binary and JSON encoding.
16+ type ProtoCodecMarshaler interface {
17+ Marshaler
18+ InterfaceRegistry () types.InterfaceRegistry
19+ }
20+
1421// ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON
1522// encoding.
1623type ProtoCodec struct {
1724 interfaceRegistry types.InterfaceRegistry
1825}
1926
2027var _ Marshaler = & ProtoCodec {}
28+ var _ ProtoCodecMarshaler = & ProtoCodec {}
2129
2230// NewProtoCodec returns a reference to a new ProtoCodec
2331func NewProtoCodec (interfaceRegistry types.InterfaceRegistry ) * ProtoCodec {
Original file line number Diff line number Diff line change @@ -18,12 +18,12 @@ type config struct {
1818 encoder sdk.TxEncoder
1919 jsonDecoder sdk.TxDecoder
2020 jsonEncoder sdk.TxEncoder
21- protoCodec * codec.ProtoCodec
21+ protoCodec codec.ProtoCodecMarshaler
2222}
2323
2424// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The
2525// first enabled sign mode will become the default sign mode.
26- func NewTxConfig (protoCodec * codec.ProtoCodec , enabledSignModes []signingtypes.SignMode ) client.TxConfig {
26+ func NewTxConfig (protoCodec codec.ProtoCodecMarshaler , enabledSignModes []signingtypes.SignMode ) client.TxConfig {
2727 return & config {
2828 handler : makeSignModeHandler (enabledSignModes ),
2929 decoder : DefaultTxDecoder (protoCodec ),
Original file line number Diff line number Diff line change 99)
1010
1111// DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler.
12- func DefaultTxDecoder (cdc * codec.ProtoCodec ) sdk.TxDecoder {
12+ func DefaultTxDecoder (cdc codec.ProtoCodecMarshaler ) sdk.TxDecoder {
1313 return func (txBytes []byte ) (sdk.Tx , error ) {
1414 var raw tx.TxRaw
1515
@@ -66,7 +66,7 @@ func DefaultTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder {
6666}
6767
6868// DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler.
69- func DefaultJSONTxDecoder (cdc * codec.ProtoCodec ) sdk.TxDecoder {
69+ func DefaultJSONTxDecoder (cdc codec.ProtoCodecMarshaler ) sdk.TxDecoder {
7070 return func (txBytes []byte ) (sdk.Tx , error ) {
7171 var theTx tx.Tx
7272 err := cdc .UnmarshalJSON (txBytes , & theTx )
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ func DefaultTxEncoder() sdk.TxEncoder {
2929}
3030
3131// DefaultJSONTxEncoder returns a default protobuf JSON TxEncoder using the provided Marshaler.
32- func DefaultJSONTxEncoder (cdc * codec.ProtoCodec ) sdk.TxEncoder {
32+ func DefaultJSONTxEncoder (cdc codec.ProtoCodecMarshaler ) sdk.TxEncoder {
3333 return func (tx sdk.Tx ) ([]byte , error ) {
3434 txWrapper , ok := tx .(* wrapper )
3535 if ok {
Original file line number Diff line number Diff line change 3939 // SubModuleCdc references the global x/ibc/core/03-connection module codec. Note, the codec should
4040 // ONLY be used in certain instances of tests and for JSON encoding.
4141 //
42- // The actual codec used for serialization should be provided to x/ibc/core/03-connectionl and
42+ // The actual codec used for serialization should be provided to x/ibc/core/03-connection and
4343 // defined at the application level.
4444 SubModuleCdc = codec .NewProtoCodec (codectypes .NewInterfaceRegistry ())
4545)
You can’t perform that action at this time.
0 commit comments