forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtxinner_wrapper.go
46 lines (36 loc) · 955 Bytes
/
txinner_wrapper.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
39
40
41
42
43
44
45
46
// Generated by: main
// TypeWriter: wrapper
// Directive: +gen on TxInner
package sdk
import (
"github.com/tendermint/go-wire/data"
)
// Auto-generated adapters for happily unmarshaling interfaces
// Apache License 2.0
// Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com)
type Tx struct {
TxInner "json:\"unwrap\""
}
var TxMapper = data.NewMapper(Tx{})
func (h Tx) MarshalJSON() ([]byte, error) {
return TxMapper.ToJSON(h.TxInner)
}
func (h *Tx) UnmarshalJSON(data []byte) (err error) {
parsed, err := TxMapper.FromJSON(data)
if err == nil && parsed != nil {
h.TxInner = parsed.(TxInner)
}
return err
}
// Unwrap recovers the concrete interface safely (regardless of levels of embeds)
func (h Tx) Unwrap() TxInner {
hi := h.TxInner
for wrap, ok := hi.(Tx); ok; wrap, ok = hi.(Tx) {
hi = wrap.TxInner
}
return hi
}
func (h Tx) Empty() bool {
return h.TxInner == nil
}
/*** below are bindings for each implementation ***/