-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtx.go
93 lines (75 loc) · 2.24 KB
/
tx.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package cosmosutils
import (
"github.com/cosmos/cosmos-sdk/codec"
cosmostypes "github.com/cosmos/cosmos-sdk/types"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)
type Tx struct {
cosmostypes.Tx
codec codec.ProtoCodecMarshaler
}
func (tx *Tx) MarshalToJSON() ([]byte, error) {
return authtx.DefaultJSONTxEncoder(tx.codec)(tx.Tx)
}
type CosmosTx struct {
Body Body `json:"body"`
AuthInfo AuthInfo `json:"auth_info"`
Signatures []string `json:"signatures"`
}
type Body struct {
Messages []map[string]interface{} `json:"messages"`
Memo string `json:"memo"`
TimeoutHeight string `json:"timeout_height"`
ExtensionOptions []interface{} `json:"extension_options"`
NonCriticalExtensionOptions []interface{} `json:"non_critical_extension_options"`
}
type Message struct {
Type string `json:"@type"`
}
type AuthInfo struct {
SignerInfos []SignerInfo `json:"signer_infos"`
Fee Fee `json:"fee"`
}
type Fee struct {
Amount []Amount `json:"amount"`
GasLimit string `json:"gas_limit"`
Payer string `json:"payer"`
Granter string `json:"granter"`
}
type Amount struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
}
type SignerInfo struct {
PublicKey SignerInfoPublicKey `json:"public_key"`
ModeInfo ModeInfo `json:"mode_info"`
Sequence string `json:"sequence"`
}
type SignerInfoPublicKey struct {
Type string `json:"@type"`
MaybeThreshold *int64 `json:"threshold,omitempty"`
MaybePublicKeys []PublicKey `json:"public_keys,omitempty"`
MaybeKey *string `json:"key,omitempty"`
}
type PublicKey struct {
Type string `json:"@type"`
Key string `json:"key"`
}
type ModeInfo struct {
MaybeSingle *Single `json:"single,omitempty"`
MaybeMulti *Multi `json:"multi,omitempty"`
}
type Single struct {
Mode string `json:"mode"`
}
type Multi struct {
Bitarray Bitarray `json:"bitarray"`
ModeInfos []SingleModeInfo `json:"mode_infos"`
}
type SingleModeInfo struct {
Single Single `json:"single"`
}
type Bitarray struct {
ExtraBitsStored int64 `json:"extra_bits_stored"`
Elems string `json:"elems"`
}