walletsvrresults.go 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. // Copyright (c) 2014 The btcsuite developers
  2. // Copyright (c) 2019 Caleb James DeLisle
  3. // Use of this source code is governed by an ISC
  4. // license that can be found in the LICENSE file.
  5. package btcjson
  6. import (
  7. "time"
  8. "github.com/pkt-cash/pktd/peer"
  9. )
  10. // GetTransactionDetailsResult models the details data from the gettransaction command.
  11. //
  12. // This models the "short" version of the ListTransactionsResult type, which
  13. // excludes fields common to the transaction. These common fields are instead
  14. // part of the GetTransactionResult.
  15. type GetTransactionDetailsResult struct {
  16. Account string `json:"account"`
  17. Address string `json:"address,omitempty"`
  18. Amount float64 `json:"amount"`
  19. Category string `json:"category"`
  20. InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
  21. Fee *float64 `json:"fee,omitempty"`
  22. Vout uint32 `json:"vout"`
  23. }
  24. // GetTransactionResult models the data from the gettransaction command.
  25. type GetTransactionResult struct {
  26. Amount float64 `json:"amount"`
  27. Fee float64 `json:"fee,omitempty"`
  28. Confirmations int64 `json:"confirmations"`
  29. BlockHash string `json:"blockhash"`
  30. BlockIndex int64 `json:"blockindex"`
  31. BlockTime int64 `json:"blocktime"`
  32. TxID string `json:"txid"`
  33. WalletConflicts []string `json:"walletconflicts"`
  34. Time int64 `json:"time"`
  35. TimeReceived int64 `json:"timereceived"`
  36. Details []GetTransactionDetailsResult `json:"details"`
  37. Hex string `json:"hex"`
  38. }
  39. // InfoWalletResult models the data returned by the wallet server getinfo
  40. // command.
  41. type InfoWalletResult struct {
  42. Version int32 `json:"version"`
  43. ProtocolVersion int32 `json:"protocolversion"`
  44. WalletVersion int32 `json:"walletversion"`
  45. Balance float64 `json:"balance"`
  46. Blocks int32 `json:"blocks"`
  47. TimeOffset int64 `json:"timeoffset"`
  48. Connections int32 `json:"connections"`
  49. Difficulty float64 `json:"difficulty"`
  50. TestNet bool `json:"testnet"`
  51. KeypoolOldest int64 `json:"keypoololdest"`
  52. KeypoolSize int32 `json:"keypoolsize"`
  53. UnlockedUntil int64 `json:"unlocked_until"`
  54. PaytxFee float64 `json:"paytxfee"`
  55. RelayFee float64 `json:"relayfee"`
  56. Errors string `json:"errors"`
  57. }
  58. type NeutrinoBan struct {
  59. Addr string
  60. Reason string
  61. EndTime string `json:"endtime"`
  62. }
  63. type NeutrinoQuery struct {
  64. Peer string
  65. Command string
  66. ReqNum uint32
  67. CreateTime uint32
  68. LastRequestTime uint32
  69. LastResponseTime uint32
  70. }
  71. type NeutrinoInfo struct {
  72. Peers []peer.PeerDesc
  73. Bans []NeutrinoBan
  74. Queries []NeutrinoQuery
  75. }
  76. type WalletStats struct {
  77. MaintenanceInProgress bool
  78. MaintenanceName string
  79. MaintenanceCycles int
  80. MaintenanceLastBlockVisited int
  81. TimeOfLastMaintenance time.Time
  82. // If we're currently in a resync
  83. Syncing bool
  84. SyncStarted *time.Time
  85. SyncRemainingSeconds int64
  86. SyncCurrentBlock int32
  87. SyncFrom int32
  88. SyncTo int32
  89. // General info
  90. BirthdayBlock int32
  91. }
  92. type WalletInfoResult struct {
  93. CurrentBlockHash string
  94. CurrentHeight int32
  95. CurrentBlockTimestamp time.Time
  96. BackendBlockHash string
  97. BackendHeight int32
  98. BackendBlockTimestamp time.Time
  99. IsSyncing bool
  100. Backend string
  101. WalletVersion int32
  102. WalletStats *WalletStats
  103. RPCInfo *InfoWalletResult
  104. NeutrinoInfo *NeutrinoInfo
  105. }
  106. // ListTransactionsResult models the data from the listtransactions command.
  107. type ListTransactionsResult struct {
  108. Abandoned bool `json:"abandoned"`
  109. Account string `json:"account"`
  110. Address string `json:"address,omitempty"`
  111. Amount float64 `json:"amount"`
  112. BIP125Replaceable string `json:"bip125-replaceable,omitempty"`
  113. BlockHash string `json:"blockhash,omitempty"`
  114. BlockIndex *int64 `json:"blockindex,omitempty"`
  115. BlockTime int64 `json:"blocktime,omitempty"`
  116. Category string `json:"category"`
  117. Confirmations int64 `json:"confirmations"`
  118. Fee *float64 `json:"fee,omitempty"`
  119. Generated bool `json:"generated,omitempty"`
  120. InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
  121. Time int64 `json:"time"`
  122. TimeReceived int64 `json:"timereceived"`
  123. Trusted bool `json:"trusted"`
  124. TxID string `json:"txid"`
  125. Vout uint32 `json:"vout"`
  126. WalletConflicts []string `json:"walletconflicts"`
  127. Comment string `json:"comment,omitempty"`
  128. OtherAccount string `json:"otheraccount,omitempty"`
  129. }
  130. // ListReceivedByAddressResult models the data from the listreceivedbyaddress
  131. // command.
  132. type ListReceivedByAddressResult struct {
  133. Account string `json:"account"`
  134. Address string `json:"address"`
  135. Amount float64 `json:"amount"`
  136. Confirmations uint64 `json:"confirmations"`
  137. TxIDs []string `json:"txids,omitempty"`
  138. InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"`
  139. }
  140. // ListSinceBlockResult models the data from the listsinceblock command.
  141. type ListSinceBlockResult struct {
  142. Transactions []ListTransactionsResult `json:"transactions"`
  143. LastBlock string `json:"lastblock"`
  144. }
  145. // ListUnspentResult models a successful response from the listunspent request.
  146. type ListUnspentResult struct {
  147. TxID string `json:"txid"`
  148. Vout uint32 `json:"vout"`
  149. Address string `json:"address"`
  150. Account string `json:"account"`
  151. ScriptPubKey string `json:"scriptPubKey"`
  152. RedeemScript string `json:"redeemScript,omitempty"`
  153. Amount float64 `json:"amount"`
  154. Confirmations int64 `json:"confirmations"`
  155. Height int64 `json:"height"`
  156. BlockHash string `json:"blockHash"`
  157. Spendable bool `json:"spendable"`
  158. }
  159. // SignRawTransactionError models the data that contains script verification
  160. // errors from the signrawtransaction request.
  161. type SignRawTransactionError struct {
  162. TxID string `json:"txid"`
  163. Vout uint32 `json:"vout"`
  164. ScriptSig string `json:"scriptSig"`
  165. Sequence uint32 `json:"sequence"`
  166. Error string `json:"error"`
  167. }
  168. // SignRawTransactionResult models the data from the signrawtransaction
  169. // command.
  170. type SignRawTransactionResult struct {
  171. Hex string `json:"hex"`
  172. Complete bool `json:"complete"`
  173. Errors []SignRawTransactionError `json:"errors,omitempty"`
  174. }
  175. // ValidateAddressWalletResult models the data returned by the wallet server
  176. // validateaddress command.
  177. type ValidateAddressWalletResult struct {
  178. IsValid bool `json:"isvalid"`
  179. Address string `json:"address,omitempty"`
  180. IsMine bool `json:"ismine,omitempty"`
  181. IsWatchOnly bool `json:"iswatchonly,omitempty"`
  182. IsScript bool `json:"isscript,omitempty"`
  183. PubKey string `json:"pubkey,omitempty"`
  184. IsCompressed bool `json:"iscompressed,omitempty"`
  185. Account string `json:"account,omitempty"`
  186. Addresses []string `json:"addresses,omitempty"`
  187. Hex string `json:"hex,omitempty"`
  188. Script string `json:"script,omitempty"`
  189. SigsRequired int32 `json:"sigsrequired,omitempty"`
  190. }
  191. // GetBestBlockResult models the data from the getbestblock command.
  192. type GetBestBlockResult struct {
  193. Hash string `json:"hash"`
  194. Height int32 `json:"height"`
  195. }
  196. // SetNetworkStewardVoteResult is the result of the wallet command setnetworkstewardvote
  197. type SetNetworkStewardVoteResult struct{}
  198. // GetNetworkStewardVoteResult is the result of the wallet command getnetworkstewardvote
  199. type GetNetworkStewardVoteResult struct {
  200. VoteFor string `json:"votefor,omitempty"`
  201. VoteAgainst string `json:"voteagainst,omitempty"`
  202. }
  203. type GetAddressBalancesResult struct {
  204. Address string `json:"address"`
  205. Total float64 `json:"total"`
  206. Stotal string `json:"stotal"`
  207. Spendable float64 `json:"spendable"`
  208. Sspendable string `json:"sspendable"`
  209. ImmatureReward float64 `json:"immaturereward"`
  210. SimmatureReward string `json:"simmaturereward"`
  211. Unconfirmed float64 `json:"unconfirmed"`
  212. Sunconfirmed string `json:"sunconfirmed"`
  213. OutputCount int32 `json:"outputcount"`
  214. }
  215. type MaintenanceStats struct {
  216. // Burned int
  217. // Orphaned int
  218. // VisitedUtxos int
  219. LastBlockVisited int
  220. Done bool
  221. Name string
  222. }
  223. type WalletMempoolItem struct {
  224. Txid string
  225. Received string
  226. }
  227. type WalletMempoolRes []WalletMempoolItem