-
Notifications
You must be signed in to change notification settings - Fork 0
/
codec.go
38 lines (32 loc) · 1.25 KB
/
codec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package common
import (
"github.com/brc20-collab/brczero/libs/cosmos-sdk/codec"
conntypes "github.com/brc20-collab/brczero/libs/ibc-go/modules/core/03-connection/types"
"github.com/brc20-collab/brczero/libs/ibc-go/modules/core/04-channel/types"
)
func MustMarshalChannel(cdc *codec.CodecProxy, c *types.Channel) []byte {
ret := cdc.GetProtocMarshal().MustMarshalBinaryBare(c)
return ret
}
func MarshalChannel(cdc *codec.CodecProxy, c *types.Channel) ([]byte, error) {
return cdc.GetProtocMarshal().MarshalBinaryBare(c)
}
func MustUnmarshalChannel(cdc *codec.CodecProxy, data []byte) *types.Channel {
var ret types.Channel
cdc.GetProtocMarshal().MustUnmarshalBinaryBare(data, &ret)
return &ret
}
func MustUnmarshalConnection(cdc *codec.CodecProxy, data []byte) *conntypes.ConnectionEnd {
var ret conntypes.ConnectionEnd
cdc.GetProtocMarshal().MustUnmarshalBinaryBare(data, &ret)
return &ret
}
func UnmarshalConnection(cdc *codec.CodecProxy, data []byte) (*conntypes.ConnectionEnd, error) {
var ret conntypes.ConnectionEnd
err := cdc.GetProtocMarshal().UnmarshalBinaryBare(data, &ret)
return &ret, err
}
func MustMarshalConnection(cdc *codec.CodecProxy, c *conntypes.ConnectionEnd) []byte {
ret := cdc.GetProtocMarshal().MustMarshalBinaryBare(c)
return ret
}