github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/ibc-go/modules/core/02-client/keeper/encoding.go (about) 1 package keeper 2 3 import ( 4 "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/02-client/types" 5 "github.com/fibonacci-chain/fbc/libs/ibc-go/modules/core/exported" 6 ) 7 8 // MustUnmarshalClientState attempts to decode and return an ClientState object from 9 // raw encoded bytes. It panics on error. 10 func (k Keeper) MustUnmarshalClientState(bz []byte) exported.ClientState { 11 return types.MustUnmarshalClientState(k.cdc, bz) 12 } 13 14 // UnmarshalClientState attempts to decode and return an ClientState object from 15 // raw encoded bytes. 16 func (k Keeper) UnmarshalClientState(bz []byte) (exported.ClientState, error) { 17 return types.UnmarshalClientState(k.cdc, bz) 18 } 19 20 // UnmarshalConsensusState attempts to decode and return an ConsensusState object from 21 // raw encoded bytes. 22 func (k Keeper) UnmarshalConsensusState(bz []byte) (exported.ConsensusState, error) { 23 return types.UnmarshalConsensusState(k.cdc, bz) 24 } 25 26 // MustMarshalClientState attempts to encode an ClientState object and returns the 27 // raw encoded bytes. It panics on error. 28 func (k Keeper) MustMarshalClientState(clientState exported.ClientState) []byte { 29 return types.MustMarshalClientState(k.cdc, clientState) 30 } 31 32 // MustUnmarshalConsensusState attempts to decode and return an ConsensusState object from 33 // raw encoded bytes. It panics on error. 34 func (k Keeper) MustUnmarshalConsensusState(bz []byte) exported.ConsensusState { 35 return types.MustUnmarshalConsensusState(k.cdc, bz) 36 } 37 38 // MustMarshalConsensusState attempts to encode an ConsensusState object and returns the 39 // raw encoded bytes. It panics on error. 40 func (k Keeper) MustMarshalConsensusState(consensusState exported.ConsensusState) []byte { 41 return types.MustMarshalConsensusState(k.cdc, consensusState) 42 }