forked from decred/dcrd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dcrdresults.go
194 lines (171 loc) · 6.04 KB
/
dcrdresults.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package dcrjson
// GetStakeDifficultyResult models the data returned from the
// getstakedifficulty command.
type GetStakeDifficultyResult struct {
CurrentStakeDifficulty float64 `json:"current"`
NextStakeDifficulty float64 `json:"next"`
}
// VersionCount models a generic version:count tuple.
type VersionCount struct {
Version uint32 `json:"version"`
Count uint32 `json:"count"`
}
// VersionInterval models a cooked version count for an interval.
type VersionInterval struct {
StartHeight int64 `json:"startheight"`
EndHeight int64 `json:"endheight"`
PoSVersions []VersionCount `json:"posversions"`
VoteVersions []VersionCount `json:"voteversions"`
}
// GetStakeVersionInfoResult models the resulting data for getstakeversioninfo
// command.
type GetStakeVersionInfoResult struct {
CurrentHeight int64 `json:"currentheight"`
Hash string `json:"hash"`
Intervals []VersionInterval `json:"intervals"`
}
// VersionBits models a generic version:bits tuple.
type VersionBits struct {
Version uint32 `json:"version"`
Bits uint16 `json:"bits"`
}
// StakeVersions models the data for GetStakeVersionsResult.
type StakeVersions struct {
Hash string `json:"hash"`
Height int64 `json:"height"`
BlockVersion int32 `json:"blockversion"`
StakeVersion uint32 `json:"stakeversion"`
Votes []VersionBits `json:"votes"`
}
// GetStakeVersionsResult models the data returned from the getstakeversions
// command.
type GetStakeVersionsResult struct {
StakeVersions []StakeVersions `json:"stakeversions"`
}
// Choice models an individual choice inside an Agenda.
type Choice struct {
Id string `json:"id"`
Description string `json:"description"`
Bits uint16 `json:"bits"`
IsAbstain bool `json:"isabstain"`
IsNo bool `json:"isno"`
Count uint32 `json:"count"`
Progress float64 `json:"progress"`
}
// Agenda models an individual agenda including its choices.
type Agenda struct {
Id string `json:"id"`
Description string `json:"description"`
Mask uint16 `json:"mask"`
StartTime uint64 `json:"starttime"`
ExpireTime uint64 `json:"expiretime"`
Status string `json:"status"`
QuorumProgress float64 `json:"quorumprogress"`
Choices []Choice `json:"choices"`
}
// GetVoteInfoResult models the data returned from the getvoteinfo command.
type GetVoteInfoResult struct {
CurrentHeight int64 `json:"currentheight"`
StartHeight int64 `json:"startheight"`
EndHeight int64 `json:"endheight"`
Hash string `json:"hash"`
VoteVersion uint32 `json:"voteversion"`
Quorum uint32 `json:"quorum"`
TotalVotes uint32 `json:"totalvotes"`
Agendas []Agenda `json:"agendas,omitempty"`
}
// EstimateStakeDiffResult models the data returned from the estimatestakediff
// command.
type EstimateStakeDiffResult struct {
Min float64 `json:"min"`
Max float64 `json:"max"`
Expected float64 `json:"expected"`
User *float64 `json:"user,omitempty"`
}
// LiveTicketsResult models the data returned from the livetickets
// command.
type LiveTicketsResult struct {
Tickets []string `json:"tickets"`
}
// MissedTicketsResult models the data returned from the missedtickets
// command.
type MissedTicketsResult struct {
Tickets []string `json:"tickets"`
}
// Ticket is the structure representing a ticket.
type Ticket struct {
Hash string `json:"hash"`
Owner string `json:"owner"`
}
// FeeInfoBlock is ticket fee information about a block.
type FeeInfoBlock struct {
Height uint32 `json:"height"`
Number uint32 `json:"number"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
StdDev float64 `json:"stddev"`
}
// FeeInfoMempool is ticket fee information about the mempool.
type FeeInfoMempool struct {
Number uint32 `json:"number"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
StdDev float64 `json:"stddev"`
}
// FeeInfoRange is ticket fee information about a range.
type FeeInfoRange struct {
Number uint32 `json:"number"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
StdDev float64 `json:"stddev"`
}
// FeeInfoWindow is ticket fee information about an adjustment window.
type FeeInfoWindow struct {
StartHeight uint32 `json:"startheight"`
EndHeight uint32 `json:"endheight"`
Number uint32 `json:"number"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
StdDev float64 `json:"stddev"`
}
// TicketFeeInfoResult models the data returned from the ticketfeeinfo command.
// command.
type TicketFeeInfoResult struct {
FeeInfoMempool FeeInfoMempool `json:"feeinfomempool"`
FeeInfoBlocks []FeeInfoBlock `json:"feeinfoblocks"`
FeeInfoWindows []FeeInfoWindow `json:"feeinfowindows"`
}
// TicketsForAddressResult models the data returned from the ticketforaddress
// command.
type TicketsForAddressResult struct {
Tickets []string `json:"tickets"`
}
// TxFeeInfoResult models the data returned from the ticketfeeinfo command.
// command.
type TxFeeInfoResult struct {
FeeInfoMempool FeeInfoMempool `json:"feeinfomempool"`
FeeInfoBlocks []FeeInfoBlock `json:"feeinfoblocks"`
FeeInfoRange FeeInfoRange `json:"feeinforange"`
}
// VersionResult models objects included in the version response. In the actual
// result, these objects are keyed by the program or API name.
type VersionResult struct {
VersionString string `json:"versionstring"`
Major uint32 `json:"major"`
Minor uint32 `json:"minor"`
Patch uint32 `json:"patch"`
Prerelease string `json:"prerelease"`
BuildMetadata string `json:"buildmetadata"`
}