-
Notifications
You must be signed in to change notification settings - Fork 153
/
results.go
433 lines (386 loc) · 16.9 KB
/
results.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2021 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package types
// FundRawTransactionResult models the data from the fundrawtransaction command.
type FundRawTransactionResult struct {
Hex string `json:"hex"`
Fee float64 `json:"fee"`
}
// GetAccountBalanceResult models the account data from the getbalance command.
type GetAccountBalanceResult struct {
AccountName string `json:"accountname"`
ImmatureCoinbaseRewards float64 `json:"immaturecoinbaserewards"`
ImmatureStakeGeneration float64 `json:"immaturestakegeneration"`
LockedByTickets float64 `json:"lockedbytickets"`
Spendable float64 `json:"spendable"`
Total float64 `json:"total"`
Unconfirmed float64 `json:"unconfirmed"`
VotingAuthority float64 `json:"votingauthority"`
}
// GetBalanceResult models the data from the getbalance command.
type GetBalanceResult struct {
Balances []GetAccountBalanceResult `json:"balances"`
BlockHash string `json:"blockhash"`
TotalImmatureCoinbaseRewards float64 `json:"totalimmaturecoinbaserewards,omitempty"`
TotalImmatureStakeGeneration float64 `json:"totalimmaturestakegeneration,omitempty"`
TotalLockedByTickets float64 `json:"totallockedbytickets,omitempty"`
TotalSpendable float64 `json:"totalspendable,omitempty"`
CumulativeTotal float64 `json:"cumulativetotal,omitempty"`
TotalUnconfirmed float64 `json:"totalunconfirmed,omitempty"`
TotalVotingAuthority float64 `json:"totalvotingauthority,omitempty"`
}
// GetMultisigOutInfoResult models the data returned from the getmultisigoutinfo
// command.
type GetMultisigOutInfoResult struct {
Address string `json:"address"`
RedeemScript string `json:"redeemscript"`
M uint8 `json:"m"`
N uint8 `json:"n"`
Pubkeys []string `json:"pubkeys"`
TxHash string `json:"txhash"`
BlockHeight uint32 `json:"blockheight"`
BlockHash string `json:"blockhash"`
Spent bool `json:"spent"`
SpentBy string `json:"spentby"`
SpentByIndex uint32 `json:"spentbyindex"`
Amount float64 `json:"amount"`
}
// CreateMultiSigResult models the data returned from the createmultisig
// command.
type CreateMultiSigResult struct {
Address string `json:"address"`
RedeemScript string `json:"redeemScript"`
}
// CreateSignatureResult models the data returned from the createsignature
// command.
type CreateSignatureResult struct {
Signature string `json:"signature"`
PublicKey string `json:"publickey"`
}
// GetPeerInfoResult models the data returned from the getpeerinfo command.
type GetPeerInfoResult struct {
ID int32 `json:"id"`
Addr string `json:"addr"`
AddrLocal string `json:"addrlocal"`
Services string `json:"services"`
Version uint32 `json:"version"`
SubVer string `json:"subver"`
StartingHeight int64 `json:"startingheight"`
BanScore int32 `json:"banscore"`
}
// GetStakeInfoResult models the data returned from the getstakeinfo
// command.
type GetStakeInfoResult struct {
BlockHeight int64 `json:"blockheight"`
Difficulty float64 `json:"difficulty"`
TotalSubsidy float64 `json:"totalsubsidy"`
OwnMempoolTix uint32 `json:"ownmempooltix"`
Immature uint32 `json:"immature"`
Unspent uint32 `json:"unspent"`
Voted uint32 `json:"voted"`
Revoked uint32 `json:"revoked"`
UnspentExpired uint32 `json:"unspentexpired"`
// Not available to SPV wallets
PoolSize uint32 `json:"poolsize,omitempty"`
AllMempoolTix uint32 `json:"allmempooltix,omitempty"`
Live uint32 `json:"live,omitempty"`
ProportionLive float64 `json:"proportionlive,omitempty"`
Missed uint32 `json:"missed,omitempty"`
ProportionMissed float64 `json:"proportionmissed,omitempty"`
Expired uint32 `json:"expired,omitempty"`
}
// GetTicketsResult models the data returned from the gettickets
// command.
type GetTicketsResult struct {
Hashes []string `json:"hashes"`
}
// GetTransactionDetailsResult models the details data from the gettransaction command.
//
// This models the "short" version of the ListTransactionsResult type, which
// excludes fields common to the transaction. These common fields are instead
// part of the GetTransactionResult.
type GetTransactionDetailsResult struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
Category string `json:"category"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
Fee *float64 `json:"fee,omitempty"`
Vout uint32 `json:"vout"`
}
// GetTransactionResult models the data from the gettransaction command.
type GetTransactionResult struct {
Amount float64 `json:"amount"`
Fee float64 `json:"fee,omitempty"`
Confirmations int64 `json:"confirmations"`
BlockHash string `json:"blockhash"`
BlockIndex int64 `json:"blockindex"`
BlockTime int64 `json:"blocktime"`
TxID string `json:"txid"`
WalletConflicts []string `json:"walletconflicts"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
Details []GetTransactionDetailsResult `json:"details"`
Hex string `json:"hex"`
Type string `json:"type"`
TicketStatus string `json:"ticketstatus,omitempty"`
}
// GetCFilterV2Result models the data returned from the getcfilterv2 command.
type GetCFilterV2Result struct {
BlockHash string `json:"blockhash"`
Filter string `json:"filter"`
Key string `json:"key"`
}
// VoteChoice models the data for a vote choice in the getvotechoices result.
type VoteChoice struct {
AgendaID string `json:"agendaid"`
AgendaDescription string `json:"agendadescription,omitempty"`
ChoiceID string `json:"choiceid"`
ChoiceDescription string `json:"choicedescription,omitempty"`
}
// GetVoteChoicesResult models the data returned by the getvotechoices command.
type GetVoteChoicesResult struct {
Version uint32 `json:"version"`
Choices []VoteChoice `json:"choices"`
}
// SyncStatusResult models the data returned by the syncstatus command.
type SyncStatusResult struct {
Synced bool `json:"synced"`
InitialBlockDownload bool `json:"initialblockdownload"`
HeadersFetchProgress float32 `json:"headersfetchprogress"`
}
// InfoResult models the data returned by the wallet server getinfo
// command.
type InfoResult struct {
Version int32 `json:"version"`
ProtocolVersion int32 `json:"protocolversion"`
WalletVersion int32 `json:"walletversion"`
Balance float64 `json:"balance"`
Blocks int32 `json:"blocks"`
TimeOffset int64 `json:"timeoffset"`
Connections int32 `json:"connections"`
Proxy string `json:"proxy"`
Difficulty float64 `json:"difficulty"`
TestNet bool `json:"testnet"`
KeypoolOldest int64 `json:"keypoololdest"`
KeypoolSize int32 `json:"keypoolsize"`
UnlockedUntil int64 `json:"unlocked_until"`
PaytxFee float64 `json:"paytxfee"`
RelayFee float64 `json:"relayfee"`
Errors string `json:"errors"`
}
// InfoWalletResult aliases InfoResult.
type InfoWalletResult = InfoResult
// ListTransactionsTxType defines the type used in the listtransactions JSON-RPC
// result for the TxType command field.
type ListTransactionsTxType string
const (
// LTTTRegular indicates a regular transaction.
LTTTRegular ListTransactionsTxType = "regular"
// LTTTTicket indicates a ticket.
LTTTTicket ListTransactionsTxType = "ticket"
// LTTTVote indicates a vote.
LTTTVote ListTransactionsTxType = "vote"
// LTTTRevocation indicates a revocation.
LTTTRevocation ListTransactionsTxType = "revocation"
)
// ListTransactionsResult models the data from the listtransactions command.
type ListTransactionsResult struct {
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
BlockHash string `json:"blockhash,omitempty"`
BlockIndex *int64 `json:"blockindex,omitempty"`
BlockTime int64 `json:"blocktime,omitempty"`
Category string `json:"category"`
Confirmations int64 `json:"confirmations"`
Fee *float64 `json:"fee,omitempty"`
Generated bool `json:"generated,omitempty"`
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
TxID string `json:"txid"`
TxType *ListTransactionsTxType `json:"txtype,omitempty"`
Vout uint32 `json:"vout"`
WalletConflicts []string `json:"walletconflicts"`
Comment string `json:"comment,omitempty"`
OtherAccount string `json:"otheraccount,omitempty"`
}
// ListReceivedByAccountResult models the data from the listreceivedbyaccount
// command.
type ListReceivedByAccountResult struct {
Account string `json:"account"`
Amount float64 `json:"amount"`
Confirmations uint64 `json:"confirmations"`
}
// ListReceivedByAddressResult models the data from the listreceivedbyaddress
// command.
type ListReceivedByAddressResult struct {
Account string `json:"account"`
Address string `json:"address"`
Amount float64 `json:"amount"`
Confirmations uint64 `json:"confirmations"`
TxIDs []string `json:"txids,omitempty"`
InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"`
}
// ListSinceBlockResult models the data from the listsinceblock command.
type ListSinceBlockResult struct {
Transactions []ListTransactionsResult `json:"transactions"`
LastBlock string `json:"lastblock"`
}
// ListUnspentResult models a successful response from the listunspent request.
// Contains Decred additions.
type ListUnspentResult struct {
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
Tree int8 `json:"tree"`
TxType int `json:"txtype"`
Address string `json:"address"`
Account string `json:"account"`
ScriptPubKey string `json:"scriptPubKey"`
RedeemScript string `json:"redeemScript,omitempty"`
Amount float64 `json:"amount"`
Confirmations int64 `json:"confirmations"`
Spendable bool `json:"spendable"`
}
// RedeemMultiSigOutResult models the data returned from the redeemmultisigout
// command.
type RedeemMultiSigOutResult struct {
Hex string `json:"hex"`
Complete bool `json:"complete"`
Errors []SignRawTransactionError `json:"errors,omitempty"`
}
// RedeemMultiSigOutsResult models the data returned from the redeemmultisigouts
// command.
type RedeemMultiSigOutsResult struct {
Results []RedeemMultiSigOutResult `json:"results"`
}
// SendToMultiSigResult models the data returned from the sendtomultisig
// command.
type SendToMultiSigResult struct {
TxHash string `json:"txhash"`
Address string `json:"address"`
RedeemScript string `json:"redeemscript"`
}
// SignRawTransactionError models the data that contains script verification
// errors from the signrawtransaction request.
type SignRawTransactionError struct {
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
ScriptSig string `json:"scriptSig"`
Sequence uint32 `json:"sequence"`
Error string `json:"error"`
}
// SignRawTransactionResult models the data from the signrawtransaction
// command.
type SignRawTransactionResult struct {
Hex string `json:"hex"`
Complete bool `json:"complete"`
Errors []SignRawTransactionError `json:"errors,omitempty"`
}
// SignedTransaction is a signed transaction resulting from a signrawtransactions
// command.
type SignedTransaction struct {
SigningResult SignRawTransactionResult `json:"signingresult"`
Sent bool `json:"sent"`
TxHash *string `json:"txhash,omitempty"`
}
// SignRawTransactionsResult models the data returned from the signrawtransactions
// command.
type SignRawTransactionsResult struct {
Results []SignedTransaction `json:"results"`
}
// PoolUserTicket is the JSON struct corresponding to a stake pool user ticket
// object.
type PoolUserTicket struct {
Status string `json:"status"`
Ticket string `json:"ticket"`
TicketHeight uint32 `json:"ticketheight"`
SpentBy string `json:"spentby"`
SpentByHeight uint32 `json:"spentbyheight"`
}
// StakePoolUserInfoResult models the data returned from the stakepooluserinfo
// command.
type StakePoolUserInfoResult struct {
Tickets []PoolUserTicket `json:"tickets"`
InvalidTickets []string `json:"invalid"`
}
// SweepAccountResult models the data returned from the sweepaccount
// command.
type SweepAccountResult struct {
UnsignedTransaction string `json:"unsignedtransaction"`
TotalPreviousOutputAmount float64 `json:"totalpreviousoutputamount"`
TotalOutputAmount float64 `json:"totaloutputamount"`
EstimatedSignedSize uint32 `json:"estimatedsignedsize"`
}
// TicketInfoResult models the data returned from the ticketinfo command.
type TicketInfoResult struct {
Hash string `json:"hash"`
Cost float64 `json:"cost"`
VotingAddress string `json:"votingaddress"`
Status string `json:"status"`
BlockHash string `json:"blockhash,omitempty"`
BlockHeight int32 `json:"blockheight"`
Vote string `json:"vote,omitempty"`
Revocation string `json:"revocation,omitempty"`
Choices []VoteChoice `json:"choices,omitempty"`
VSPHost string `json:"vsphost,omitempty"`
}
// TreasuryPolicyResult models objects returned by the treasurypolicy command.
type TreasuryPolicyResult struct {
Key string `json:"key"`
Policy string `json:"policy"`
Ticket string `json:"ticket,omitempty"`
}
// TSpendPolicyResult models objects returned by the tspendpolicy command.
type TSpendPolicyResult struct {
Hash string `json:"hash"`
Policy string `json:"policy"`
Ticket string `json:"ticket,omitempty"`
}
// ValidateAddressResult models the data returned by the wallet server
// validateaddress command.
type ValidateAddressResult struct {
IsValid bool `json:"isvalid"`
Address string `json:"address,omitempty"`
IsMine bool `json:"ismine,omitempty"`
IsWatchOnly bool `json:"iswatchonly,omitempty"`
IsScript bool `json:"isscript,omitempty"`
PubKeyAddr string `json:"pubkeyaddr,omitempty"`
PubKey string `json:"pubkey,omitempty"`
IsCompressed bool `json:"iscompressed,omitempty"`
Account string `json:"account,omitempty"`
Addresses []string `json:"addresses,omitempty"`
Hex string `json:"hex,omitempty"`
Script string `json:"script,omitempty"`
SigsRequired int32 `json:"sigsrequired,omitempty"`
AccountN *uint32 `json:"accountn,omitempty"`
Branch *uint32 `json:"branch,omitempty"`
Index *uint32 `json:"index,omitempty"`
}
// ValidateAddressWalletResult aliases ValidateAddressResult.
type ValidateAddressWalletResult = ValidateAddressResult
// WalletInfoResult models the data returned from the walletinfo command.
type WalletInfoResult struct {
DaemonConnected bool `json:"daemonconnected"`
SPV bool `json:"spv"`
Unlocked bool `json:"unlocked"`
CoinType uint32 `json:"cointype,omitempty"`
TxFee float64 `json:"txfee"`
VoteBits uint16 `json:"votebits"`
VoteBitsExtended string `json:"votebitsextended"`
VoteVersion uint32 `json:"voteversion"`
Voting bool `json:"voting"`
VSP string `json:"vsp"`
ManualTickets bool `json:"manualtickets"`
BirthHash string `json:"birthhash"`
BirthHeight uint32 `json:"birthheight"`
}
// AccountUnlockedResult models the data returned by the accountunlocked
// command. When Encrypted is false, Unlocked should be nil.
type AccountUnlockedResult struct {
Encrypted bool `json:"encrypted"`
Unlocked *bool `json:"unlocked,omitempty"`
}