3 // Directive: +gen on PubKeyInner
8 "github.com/tendermint/go-wire/data"
11 // Auto-generated adapters for happily unmarshaling interfaces
13 // Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com)
16 PubKeyInner "json:\"unwrap\""
19 var PubKeyMapper = data.NewMapper(PubKey{})
21 func (h PubKey) MarshalJSON() ([]byte, error) {
22 return PubKeyMapper.ToJSON(h.PubKeyInner)
25 func (h *PubKey) UnmarshalJSON(data []byte) (err error) {
26 parsed, err := PubKeyMapper.FromJSON(data)
27 if err == nil && parsed != nil {
28 h.PubKeyInner = parsed.(PubKeyInner)
33 // Unwrap recovers the concrete interface safely (regardless of levels of embeds)
34 func (h PubKey) Unwrap() PubKeyInner {
36 for wrap, ok := hi.(PubKey); ok; wrap, ok = hi.(PubKey) {
42 /*** below are bindings for each implementation ***/
45 PubKeyMapper.RegisterImplementation(PubKeyEd25519{}, "ed25519", 0x1)
48 func (hi PubKeyEd25519) Wrap() PubKey {