type.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package bucash
  2. // rpc error struct
  3. type RpcError struct {
  4. Code int `json:"code"`
  5. Message string `json:"message"`
  6. }
  7. // rpc common result struct
  8. type RpcResult struct {
  9. Result string `json:"result"`
  10. Error RpcError `json:"error"`
  11. Id string `json:"id"`
  12. }
  13. // get block info result struct
  14. type BlockInfo struct {
  15. Hash string
  16. Confirmations uint64
  17. Size uint64
  18. Height uint64
  19. Version uint64
  20. VersionHex string
  21. Merkleroot string
  22. Tx []string
  23. Time uint64
  24. Mediantime uint64
  25. Nonce uint64
  26. Bits string
  27. Difficulty float64
  28. Chainwork string
  29. Previousblockhash string
  30. Nextblockhash string
  31. }
  32. type BlockResult struct {
  33. Result BlockInfo `json:"result"`
  34. Error RpcError `json:"error"`
  35. Id string `json:"id"`
  36. }
  37. // list transactions since blockhash result struct
  38. type Listtransactions struct {
  39. Account string `json:"account"`
  40. Address string `json:"address"`
  41. Category string `json:"category"`
  42. Amount float64 `json:"amount"`
  43. Vout uint64 `json:"vout"`
  44. Fee float64 `json:"fee":`
  45. Confirmations uint64 `json:"confirmations"`
  46. Blockhash string `json:"blockhash"`
  47. Blockindex uint64 `json:"blockindex"`
  48. Blocktime uint64 `json:"blocktime"`
  49. Txid string `json:"txid"`
  50. Time uint64 `json:"time"`
  51. Timereceived uint64 `json:"timereceived"`
  52. Abandoned bool `json:"abandoned"`
  53. Label string `json:"label"`
  54. Comment string `json:"comment"`
  55. To string `json:"to"`
  56. }
  57. type listtransactions struct {
  58. Transactions []Listtransactions `json: "transactions"`
  59. Lastblock string `json: "lastblock"`
  60. }
  61. type Listtransactionsresult struct {
  62. Result listtransactions `json:"result"`
  63. Error RpcError `json:"error"`
  64. Id string `json:"id"`
  65. }
  66. //get Balance result struct
  67. type BalanceResult struct {
  68. Result float64 `json:"result"`
  69. Error RpcError `json:"error"`
  70. Id string `json:"id"`
  71. }
  72. //get block count
  73. type Blockcountresult struct {
  74. Result uint64
  75. Error RpcError
  76. Id string
  77. }
  78. //set fee
  79. type Setfeeresult struct {
  80. Result bool
  81. Error RpcError
  82. Id string
  83. }
  84. //get wallet info result struct
  85. type walletInfo struct {
  86. Walletversion uint64
  87. Balance float64
  88. Unconfirmed_balance float64
  89. Immature_balance float64
  90. Txcount uint64
  91. Keypoololdest uint64
  92. Keypoolsize uint64
  93. Unlocked_until uint64
  94. Paytxfee float64
  95. }
  96. type WalletinfoResult struct {
  97. Result walletInfo `json:"result"`
  98. Error RpcError `json:"error"`
  99. Id string `json:"id"`
  100. }
  101. //list unspent info result struct
  102. type UnspentInfo struct {
  103. Txid string
  104. Vout uint64
  105. Address string
  106. Account string
  107. ScriptPubKey string
  108. Amount float64
  109. Confirmations uint64
  110. RedeemScript string
  111. Spendable bool
  112. Solvable bool
  113. }
  114. // RpcUnspentResult struct
  115. type RpcUnspentResult struct {
  116. Result []UnspentInfo `json:"result"`
  117. Error RpcError `json:"error"`
  118. Id string `json:"id"`
  119. }
  120. //simple listunspent
  121. type listunspent struct {
  122. amout float64
  123. spendable bool
  124. }