type.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. package dcrcash
  2. // rpc error struct
  3. type RpcError struct {
  4. Code int `json:"code"`
  5. Message string `json:"message"`
  6. }
  7. //get wallet info result struct
  8. type WalletInfo struct {
  9. DaemonConnected bool `json:"daemonconnected"`
  10. Unlocked bool `json:"unlocked"`
  11. TxFee float64 `json:"txfee"`
  12. TicketFee float64 `json:"ticketfee"`
  13. TicketPurchasing bool `json:"ticketpurchasing"`
  14. VoteBits uint16 `json:"votebits"`
  15. VoteBitsExtended string `json:"votebitsextended"`
  16. VoteVersion uint32 `json:"voteversion"`
  17. Voting bool `json:"voting"`
  18. }
  19. // rpc common result struct
  20. type RpcResult struct {
  21. Result string `json:"result"`
  22. Error RpcError `json:"error"`
  23. Id int `json:"id"`
  24. }
  25. //set fee
  26. type Setfeeresult struct {
  27. Result bool `json:"result"`
  28. Error RpcError `json:"error"`
  29. Id int
  30. }
  31. type WalletinfoResult struct {
  32. Result WalletInfo `json:"result"`
  33. Error RpcError `json:"error"`
  34. Id int `json:"id"`
  35. }
  36. //get block count
  37. type Blockcountresult struct {
  38. Result uint64 `json:"result"`
  39. Error RpcError `json:"error"`
  40. Id int
  41. }
  42. type account struct {
  43. AccountName string `json:"accountname"`
  44. ImmatureCoinbaseRewards float64 `json:"immaturecoinbaserewards"`
  45. ImmatureStakeGeneration float64 `json:"immaturestakegeneration"`
  46. LockedByTickets float64 `json:"lockedbytickets"`
  47. Spendable float64 `json:"spendable"`
  48. Total float64 `json:"total"`
  49. Unconfirmed float64 `json:"unconfirmed"`
  50. VotingAuthority float64 `json:"votingauthority"`
  51. }
  52. type Accounts struct {
  53. Balances []account `json:"balances"`
  54. Blockhash string `json:"blockhash"`
  55. }
  56. //get Balance result struct
  57. type BalanceResult struct {
  58. Result Accounts `json:"result"`
  59. Error RpcError `json:"error"`
  60. Id int `json:"id"`
  61. }
  62. type Listtransactionsresult struct {
  63. Result listtransactions `json:"result"`
  64. Error RpcError `json:"error"`
  65. Id int `json:"id"`
  66. }
  67. // list transactions since blockhash result struct
  68. type Listtransactions struct {
  69. Account string `json:"account"`
  70. Address string `json:"address"`
  71. Amount float64 `json:"amount"`
  72. Blockhash string `json:"blockhash"`
  73. Blockindex uint64 `json:"blockindex"`
  74. Blocktime uint64 `json:"blocktime"`
  75. Category string `json:"category"`
  76. Confirmations uint64 `json:"confirmations"`
  77. Fee float64 `json:"fee"`
  78. Generated bool `json:generated`
  79. Involveswatchonly bool `json:"involveswatchonly"`
  80. Time uint64 `json:"time"`
  81. Timereceived uint64 `json:"timereceived"`
  82. Txid string `json:"txid"`
  83. Txtype string `json:"txtype"`
  84. Vout uint64 `json:"vout"`
  85. WalletConflicts []string `json:"walletconflicts"`
  86. Comment string `json:"comment"`
  87. Otheraccount string `json:"otheraccount"`
  88. }
  89. type listtransactions struct {
  90. Transactions []Listtransactions `json: "transactions"`
  91. Lastblock string `json: "lastblock"`
  92. }
  93. type scriptsig struct {
  94. Asm string
  95. Hex string
  96. }
  97. type scriptpubkey struct {
  98. Asm string
  99. Hex string
  100. ReqSigs uint64
  101. Type string
  102. Addresses []string
  103. Commitamt float64
  104. }
  105. type vin struct {
  106. Coinbase string
  107. Stakebase string
  108. Txid string
  109. vout uint64
  110. Tree uint64
  111. Sequese uint64
  112. Amountin float64
  113. Blockheighe uint64
  114. Blockindex uint64
  115. ScriptSig scriptsig
  116. }
  117. type vout struct {
  118. Value float64
  119. N uint64
  120. Version uint64
  121. ScriptPubkey scriptpubkey
  122. }
  123. type rawtx struct {
  124. Hex string
  125. Txid string
  126. Version uint64
  127. Locktime uint64
  128. Expiry uint64
  129. Vin []vin
  130. Vout []vout
  131. blockhash string
  132. blockheight uint64
  133. blockindex uint64
  134. tonfirmations uint64
  135. time uint64
  136. blocktime uint64
  137. }
  138. // get block info result struct
  139. type BlockInfo struct {
  140. Hash string
  141. Confirmations uint64
  142. Size uint64
  143. Height uint64
  144. Version uint64
  145. Merkleroot string
  146. Stakerroot string
  147. Tx []string
  148. Rawtx []rawtx
  149. Stx []string
  150. Rawstx []rawtx
  151. Time uint64
  152. Nonce uint64
  153. Votebits uint64
  154. Finalstate string
  155. Voters uint64
  156. Freshstake uint64
  157. Revocations uint64
  158. Poolsize uint64
  159. Bits string
  160. Sbits float64
  161. Difficulty float64
  162. Extradata string
  163. Stakeversion uint64
  164. Previousblockhash string
  165. Nextblockhash string
  166. }
  167. type BlockResult struct {
  168. Result BlockInfo `json:"result"`
  169. Error RpcError `json:"error"`
  170. Id int `json:"id"`
  171. }
  172. //list unspent info result struct
  173. type UnspentInfo struct {
  174. Txid string `json:"txid"`
  175. Vout uint64 `json:"vout"`
  176. Tree uint64 `json:"tree"`
  177. Txtype uint64 `json:"txtype"`
  178. Address string `json:"address"`
  179. Account string `json:"account"`
  180. ScriptPubKey string `json:"scriptpubkey"`
  181. RedeemScript string `json:"redeemscript"`
  182. Amount float64 `json:"amount"`
  183. Confirmations uint64 `json:"confirmations"`
  184. Spendable bool `json:"spendable"`
  185. }
  186. // RpcUnspentResult struct
  187. type RpcUnspentResult struct {
  188. Result []UnspentInfo `json:"result"`
  189. Error RpcError `json:"error"`
  190. Id int `json:"id"`
  191. }
  192. /*type AccountsOfvalue struct {
  193. Account string `json:"account"`
  194. Balance float64 `json:"balance"`
  195. }*/
  196. type AccountsOfvaluesResult struct {
  197. Result map[string]float64 `json:"result"`
  198. Error RpcError `json:"error"`
  199. Id int `json:"id"`
  200. }
  201. type OneaddressOfaccount struct {
  202. Result string `json:"result"`
  203. Error RpcError `json:"error"`
  204. Id int `json:"id"`
  205. }