github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/client/keys/codec.go (about)

     1  package keys
     2  
     3  import (
     4  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
     5  )
     6  
     7  // KeysCdc defines codec to be used with key operations
     8  var KeysCdc *codec.Codec
     9  
    10  func init() {
    11  	KeysCdc = codec.New()
    12  	codec.RegisterCrypto(KeysCdc)
    13  	KeysCdc.Seal()
    14  }
    15  
    16  // marshal keys
    17  func MarshalJSON(o interface{}) ([]byte, error) {
    18  	return KeysCdc.MarshalJSON(o)
    19  }
    20  
    21  // unmarshal json
    22  func UnmarshalJSON(bz []byte, ptr interface{}) error {
    23  	return KeysCdc.UnmarshalJSON(bz, ptr)
    24  }