github.com/Finschia/finschia-sdk@v0.48.1/client/keys/codec.go (about)

     1  package keys
     2  
     3  import (
     4  	"github.com/Finschia/finschia-sdk/codec"
     5  	cryptocodec "github.com/Finschia/finschia-sdk/crypto/codec"
     6  )
     7  
     8  // TODO: remove this file https://github.com/cosmos/cosmos-sdk/issues/8047
     9  
    10  // KeysCdc defines codec to be used with key operations
    11  var KeysCdc *codec.LegacyAmino
    12  
    13  func init() {
    14  	KeysCdc = codec.NewLegacyAmino()
    15  	cryptocodec.RegisterCrypto(KeysCdc)
    16  	KeysCdc.Seal()
    17  }
    18  
    19  // marshal keys
    20  func MarshalJSON(o interface{}) ([]byte, error) {
    21  	return KeysCdc.MarshalJSON(o)
    22  }
    23  
    24  // unmarshal json
    25  func UnmarshalJSON(bz []byte, ptr interface{}) error {
    26  	return KeysCdc.UnmarshalJSON(bz, ptr)
    27  }