decred.org/dcrwallet/v3@v3.1.0/rpc/jsonrpc/types/results.go (about) 1 // Copyright (c) 2014 The btcsuite developers 2 // Copyright (c) 2015-2021 The Decred developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 package types 7 8 // FundRawTransactionResult models the data from the fundrawtransaction command. 9 type FundRawTransactionResult struct { 10 Hex string `json:"hex"` 11 Fee float64 `json:"fee"` 12 } 13 14 // GetAccountBalanceResult models the account data from the getbalance command. 15 type GetAccountBalanceResult struct { 16 AccountName string `json:"accountname"` 17 ImmatureCoinbaseRewards float64 `json:"immaturecoinbaserewards"` 18 ImmatureStakeGeneration float64 `json:"immaturestakegeneration"` 19 LockedByTickets float64 `json:"lockedbytickets"` 20 Spendable float64 `json:"spendable"` 21 Total float64 `json:"total"` 22 Unconfirmed float64 `json:"unconfirmed"` 23 VotingAuthority float64 `json:"votingauthority"` 24 } 25 26 // GetBalanceResult models the data from the getbalance command. 27 type GetBalanceResult struct { 28 Balances []GetAccountBalanceResult `json:"balances"` 29 BlockHash string `json:"blockhash"` 30 TotalImmatureCoinbaseRewards float64 `json:"totalimmaturecoinbaserewards,omitempty"` 31 TotalImmatureStakeGeneration float64 `json:"totalimmaturestakegeneration,omitempty"` 32 TotalLockedByTickets float64 `json:"totallockedbytickets,omitempty"` 33 TotalSpendable float64 `json:"totalspendable,omitempty"` 34 CumulativeTotal float64 `json:"cumulativetotal,omitempty"` 35 TotalUnconfirmed float64 `json:"totalunconfirmed,omitempty"` 36 TotalVotingAuthority float64 `json:"totalvotingauthority,omitempty"` 37 } 38 39 // GetMultisigOutInfoResult models the data returned from the getmultisigoutinfo 40 // command. 41 type GetMultisigOutInfoResult struct { 42 Address string `json:"address"` 43 RedeemScript string `json:"redeemscript"` 44 M uint8 `json:"m"` 45 N uint8 `json:"n"` 46 Pubkeys []string `json:"pubkeys"` 47 TxHash string `json:"txhash"` 48 BlockHeight uint32 `json:"blockheight"` 49 BlockHash string `json:"blockhash"` 50 Spent bool `json:"spent"` 51 SpentBy string `json:"spentby"` 52 SpentByIndex uint32 `json:"spentbyindex"` 53 Amount float64 `json:"amount"` 54 } 55 56 // CreateMultiSigResult models the data returned from the createmultisig 57 // command. 58 type CreateMultiSigResult struct { 59 Address string `json:"address"` 60 RedeemScript string `json:"redeemScript"` 61 } 62 63 // CreateSignatureResult models the data returned from the createsignature 64 // command. 65 type CreateSignatureResult struct { 66 Signature string `json:"signature"` 67 PublicKey string `json:"publickey"` 68 } 69 70 // GetPeerInfoResult models the data returned from the getpeerinfo command. 71 type GetPeerInfoResult struct { 72 ID int32 `json:"id"` 73 Addr string `json:"addr"` 74 AddrLocal string `json:"addrlocal"` 75 Services string `json:"services"` 76 Version uint32 `json:"version"` 77 SubVer string `json:"subver"` 78 StartingHeight int64 `json:"startingheight"` 79 BanScore int32 `json:"banscore"` 80 } 81 82 // GetStakeInfoResult models the data returned from the getstakeinfo 83 // command. 84 type GetStakeInfoResult struct { 85 BlockHeight int64 `json:"blockheight"` 86 Difficulty float64 `json:"difficulty"` 87 TotalSubsidy float64 `json:"totalsubsidy"` 88 89 OwnMempoolTix uint32 `json:"ownmempooltix"` 90 Immature uint32 `json:"immature"` 91 Unspent uint32 `json:"unspent"` 92 Voted uint32 `json:"voted"` 93 Revoked uint32 `json:"revoked"` 94 UnspentExpired uint32 `json:"unspentexpired"` 95 96 // Not available to SPV wallets 97 PoolSize uint32 `json:"poolsize,omitempty"` 98 AllMempoolTix uint32 `json:"allmempooltix,omitempty"` 99 Live uint32 `json:"live,omitempty"` 100 ProportionLive float64 `json:"proportionlive,omitempty"` 101 Missed uint32 `json:"missed,omitempty"` 102 ProportionMissed float64 `json:"proportionmissed,omitempty"` 103 Expired uint32 `json:"expired,omitempty"` 104 } 105 106 // GetTicketsResult models the data returned from the gettickets 107 // command. 108 type GetTicketsResult struct { 109 Hashes []string `json:"hashes"` 110 } 111 112 // GetTransactionDetailsResult models the details data from the gettransaction command. 113 // 114 // This models the "short" version of the ListTransactionsResult type, which 115 // excludes fields common to the transaction. These common fields are instead 116 // part of the GetTransactionResult. 117 type GetTransactionDetailsResult struct { 118 Account string `json:"account"` 119 Address string `json:"address,omitempty"` 120 Amount float64 `json:"amount"` 121 Category string `json:"category"` 122 InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"` 123 Fee *float64 `json:"fee,omitempty"` 124 Vout uint32 `json:"vout"` 125 } 126 127 // GetTransactionResult models the data from the gettransaction command. 128 type GetTransactionResult struct { 129 Amount float64 `json:"amount"` 130 Fee float64 `json:"fee,omitempty"` 131 Confirmations int64 `json:"confirmations"` 132 BlockHash string `json:"blockhash"` 133 BlockIndex int64 `json:"blockindex"` 134 BlockTime int64 `json:"blocktime"` 135 TxID string `json:"txid"` 136 WalletConflicts []string `json:"walletconflicts"` 137 Time int64 `json:"time"` 138 TimeReceived int64 `json:"timereceived"` 139 Details []GetTransactionDetailsResult `json:"details"` 140 Hex string `json:"hex"` 141 Type string `json:"type"` 142 TicketStatus string `json:"ticketstatus,omitempty"` 143 } 144 145 // GetCFilterV2Result models the data returned from the getcfilterv2 command. 146 type GetCFilterV2Result struct { 147 BlockHash string `json:"blockhash"` 148 Filter string `json:"filter"` 149 Key string `json:"key"` 150 } 151 152 // VoteChoice models the data for a vote choice in the getvotechoices result. 153 type VoteChoice struct { 154 AgendaID string `json:"agendaid"` 155 AgendaDescription string `json:"agendadescription,omitempty"` 156 ChoiceID string `json:"choiceid"` 157 ChoiceDescription string `json:"choicedescription,omitempty"` 158 } 159 160 // GetVoteChoicesResult models the data returned by the getvotechoices command. 161 type GetVoteChoicesResult struct { 162 Version uint32 `json:"version"` 163 Choices []VoteChoice `json:"choices"` 164 } 165 166 // SyncStatusResult models the data returned by the syncstatus command. 167 type SyncStatusResult struct { 168 Synced bool `json:"synced"` 169 InitialBlockDownload bool `json:"initialblockdownload"` 170 HeadersFetchProgress float32 `json:"headersfetchprogress"` 171 } 172 173 // InfoResult models the data returned by the wallet server getinfo 174 // command. 175 type InfoResult struct { 176 Version int32 `json:"version"` 177 ProtocolVersion int32 `json:"protocolversion"` 178 WalletVersion int32 `json:"walletversion"` 179 Balance float64 `json:"balance"` 180 Blocks int32 `json:"blocks"` 181 TimeOffset int64 `json:"timeoffset"` 182 Connections int32 `json:"connections"` 183 Proxy string `json:"proxy"` 184 Difficulty float64 `json:"difficulty"` 185 TestNet bool `json:"testnet"` 186 KeypoolOldest int64 `json:"keypoololdest"` 187 KeypoolSize int32 `json:"keypoolsize"` 188 UnlockedUntil int64 `json:"unlocked_until"` 189 PaytxFee float64 `json:"paytxfee"` 190 RelayFee float64 `json:"relayfee"` 191 Errors string `json:"errors"` 192 } 193 194 // InfoWalletResult aliases InfoResult. 195 type InfoWalletResult = InfoResult 196 197 // ListTransactionsTxType defines the type used in the listtransactions JSON-RPC 198 // result for the TxType command field. 199 type ListTransactionsTxType string 200 201 const ( 202 // LTTTRegular indicates a regular transaction. 203 LTTTRegular ListTransactionsTxType = "regular" 204 205 // LTTTTicket indicates a ticket. 206 LTTTTicket ListTransactionsTxType = "ticket" 207 208 // LTTTVote indicates a vote. 209 LTTTVote ListTransactionsTxType = "vote" 210 211 // LTTTRevocation indicates a revocation. 212 LTTTRevocation ListTransactionsTxType = "revocation" 213 ) 214 215 // ListTransactionsResult models the data from the listtransactions command. 216 type ListTransactionsResult struct { 217 Account string `json:"account"` 218 Address string `json:"address,omitempty"` 219 Amount float64 `json:"amount"` 220 BlockHash string `json:"blockhash,omitempty"` 221 BlockIndex *int64 `json:"blockindex,omitempty"` 222 BlockTime int64 `json:"blocktime,omitempty"` 223 Category string `json:"category"` 224 Confirmations int64 `json:"confirmations"` 225 Fee *float64 `json:"fee,omitempty"` 226 Generated bool `json:"generated,omitempty"` 227 InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"` 228 Time int64 `json:"time"` 229 TimeReceived int64 `json:"timereceived"` 230 TxID string `json:"txid"` 231 TxType *ListTransactionsTxType `json:"txtype,omitempty"` 232 Vout uint32 `json:"vout"` 233 WalletConflicts []string `json:"walletconflicts"` 234 Comment string `json:"comment,omitempty"` 235 OtherAccount string `json:"otheraccount,omitempty"` 236 } 237 238 // ListReceivedByAccountResult models the data from the listreceivedbyaccount 239 // command. 240 type ListReceivedByAccountResult struct { 241 Account string `json:"account"` 242 Amount float64 `json:"amount"` 243 Confirmations uint64 `json:"confirmations"` 244 } 245 246 // ListReceivedByAddressResult models the data from the listreceivedbyaddress 247 // command. 248 type ListReceivedByAddressResult struct { 249 Account string `json:"account"` 250 Address string `json:"address"` 251 Amount float64 `json:"amount"` 252 Confirmations uint64 `json:"confirmations"` 253 TxIDs []string `json:"txids,omitempty"` 254 InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"` 255 } 256 257 // ListSinceBlockResult models the data from the listsinceblock command. 258 type ListSinceBlockResult struct { 259 Transactions []ListTransactionsResult `json:"transactions"` 260 LastBlock string `json:"lastblock"` 261 } 262 263 // ListUnspentResult models a successful response from the listunspent request. 264 // Contains Decred additions. 265 type ListUnspentResult struct { 266 TxID string `json:"txid"` 267 Vout uint32 `json:"vout"` 268 Tree int8 `json:"tree"` 269 TxType int `json:"txtype"` 270 Address string `json:"address"` 271 Account string `json:"account"` 272 ScriptPubKey string `json:"scriptPubKey"` 273 RedeemScript string `json:"redeemScript,omitempty"` 274 Amount float64 `json:"amount"` 275 Confirmations int64 `json:"confirmations"` 276 Spendable bool `json:"spendable"` 277 } 278 279 // RedeemMultiSigOutResult models the data returned from the redeemmultisigout 280 // command. 281 type RedeemMultiSigOutResult struct { 282 Hex string `json:"hex"` 283 Complete bool `json:"complete"` 284 Errors []SignRawTransactionError `json:"errors,omitempty"` 285 } 286 287 // RedeemMultiSigOutsResult models the data returned from the redeemmultisigouts 288 // command. 289 type RedeemMultiSigOutsResult struct { 290 Results []RedeemMultiSigOutResult `json:"results"` 291 } 292 293 // SendToMultiSigResult models the data returned from the sendtomultisig 294 // command. 295 type SendToMultiSigResult struct { 296 TxHash string `json:"txhash"` 297 Address string `json:"address"` 298 RedeemScript string `json:"redeemscript"` 299 } 300 301 // SignRawTransactionError models the data that contains script verification 302 // errors from the signrawtransaction request. 303 type SignRawTransactionError struct { 304 TxID string `json:"txid"` 305 Vout uint32 `json:"vout"` 306 ScriptSig string `json:"scriptSig"` 307 Sequence uint32 `json:"sequence"` 308 Error string `json:"error"` 309 } 310 311 // SignRawTransactionResult models the data from the signrawtransaction 312 // command. 313 type SignRawTransactionResult struct { 314 Hex string `json:"hex"` 315 Complete bool `json:"complete"` 316 Errors []SignRawTransactionError `json:"errors,omitempty"` 317 } 318 319 // SignedTransaction is a signed transaction resulting from a signrawtransactions 320 // command. 321 type SignedTransaction struct { 322 SigningResult SignRawTransactionResult `json:"signingresult"` 323 Sent bool `json:"sent"` 324 TxHash *string `json:"txhash,omitempty"` 325 } 326 327 // SignRawTransactionsResult models the data returned from the signrawtransactions 328 // command. 329 type SignRawTransactionsResult struct { 330 Results []SignedTransaction `json:"results"` 331 } 332 333 // PoolUserTicket is the JSON struct corresponding to a stake pool user ticket 334 // object. 335 type PoolUserTicket struct { 336 Status string `json:"status"` 337 Ticket string `json:"ticket"` 338 TicketHeight uint32 `json:"ticketheight"` 339 SpentBy string `json:"spentby"` 340 SpentByHeight uint32 `json:"spentbyheight"` 341 } 342 343 // StakePoolUserInfoResult models the data returned from the stakepooluserinfo 344 // command. 345 type StakePoolUserInfoResult struct { 346 Tickets []PoolUserTicket `json:"tickets"` 347 InvalidTickets []string `json:"invalid"` 348 } 349 350 // SweepAccountResult models the data returned from the sweepaccount 351 // command. 352 type SweepAccountResult struct { 353 UnsignedTransaction string `json:"unsignedtransaction"` 354 TotalPreviousOutputAmount float64 `json:"totalpreviousoutputamount"` 355 TotalOutputAmount float64 `json:"totaloutputamount"` 356 EstimatedSignedSize uint32 `json:"estimatedsignedsize"` 357 } 358 359 // TicketInfoResult models the data returned from the ticketinfo command. 360 type TicketInfoResult struct { 361 Hash string `json:"hash"` 362 Cost float64 `json:"cost"` 363 VotingAddress string `json:"votingaddress"` 364 Status string `json:"status"` 365 BlockHash string `json:"blockhash,omitempty"` 366 BlockHeight int32 `json:"blockheight"` 367 Vote string `json:"vote,omitempty"` 368 Revocation string `json:"revocation,omitempty"` 369 Choices []VoteChoice `json:"choices,omitempty"` 370 VSPHost string `json:"vsphost,omitempty"` 371 } 372 373 // TreasuryPolicyResult models objects returned by the treasurypolicy command. 374 type TreasuryPolicyResult struct { 375 Key string `json:"key"` 376 Policy string `json:"policy"` 377 Ticket string `json:"ticket,omitempty"` 378 } 379 380 // TSpendPolicyResult models objects returned by the tspendpolicy command. 381 type TSpendPolicyResult struct { 382 Hash string `json:"hash"` 383 Policy string `json:"policy"` 384 Ticket string `json:"ticket,omitempty"` 385 } 386 387 // ValidateAddressResult models the data returned by the wallet server 388 // validateaddress command. 389 type ValidateAddressResult struct { 390 IsValid bool `json:"isvalid"` 391 Address string `json:"address,omitempty"` 392 IsMine bool `json:"ismine,omitempty"` 393 IsWatchOnly bool `json:"iswatchonly,omitempty"` 394 IsScript bool `json:"isscript,omitempty"` 395 PubKeyAddr string `json:"pubkeyaddr,omitempty"` 396 PubKey string `json:"pubkey,omitempty"` 397 IsCompressed bool `json:"iscompressed,omitempty"` 398 Account string `json:"account,omitempty"` 399 Addresses []string `json:"addresses,omitempty"` 400 Hex string `json:"hex,omitempty"` 401 Script string `json:"script,omitempty"` 402 SigsRequired int32 `json:"sigsrequired,omitempty"` 403 AccountN *uint32 `json:"accountn,omitempty"` 404 Branch *uint32 `json:"branch,omitempty"` 405 Index *uint32 `json:"index,omitempty"` 406 } 407 408 // ValidateAddressWalletResult aliases ValidateAddressResult. 409 type ValidateAddressWalletResult = ValidateAddressResult 410 411 // WalletInfoResult models the data returned from the walletinfo command. 412 type WalletInfoResult struct { 413 DaemonConnected bool `json:"daemonconnected"` 414 SPV bool `json:"spv"` 415 Unlocked bool `json:"unlocked"` 416 CoinType uint32 `json:"cointype,omitempty"` 417 TxFee float64 `json:"txfee"` 418 VoteBits uint16 `json:"votebits"` 419 VoteBitsExtended string `json:"votebitsextended"` 420 VoteVersion uint32 `json:"voteversion"` 421 Voting bool `json:"voting"` 422 ManualTickets bool `json:"manualtickets"` 423 } 424 425 // AccountUnlockedResult models the data returned by the accountunlocked 426 // command. When Encrypted is false, Unlocked should be nil. 427 type AccountUnlockedResult struct { 428 Encrypted bool `json:"encrypted"` 429 Unlocked *bool `json:"unlocked,omitempty"` 430 }