github.com/deroproject/derosuite@v2.1.6-1.0.20200307070847-0f2e589c7a2b+incompatible/structures/daemon_rpc.go (about) 1 // Copyright 2017-2018 DERO Project. All rights reserved. 2 // Use of this source code in any form is governed by RESEARCH license. 3 // license can be found in the LICENSE file. 4 // GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8 5 // 6 // 7 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 8 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 9 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 10 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 12 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 13 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 14 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 15 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 17 // this package contains only struct definitions 18 // in order to avoid the dependency on block chain by any package requiring access to rpc 19 // and other structures 20 // having the structures was causing the build times of explorer/wallet to be more than couple of secs 21 // so separated the logic from the structures 22 23 package structures 24 25 import "github.com/deroproject/derosuite/globals" 26 27 //import "github.com/deroproject/derosuite/structures" 28 29 type ( 30 GetBlockHeaderByHeight_Params struct { 31 Height uint64 `json:"height"` 32 } // no params 33 GetBlockHeaderByHeight_Result struct { 34 Block_Header BlockHeader_Print `json:"block_header"` 35 Status string `json:"status"` 36 } 37 ) 38 39 type ( 40 GetBlockHeaderByTopoHeight_Params struct { 41 TopoHeight uint64 `json:"topoheight"` 42 } // no params 43 /* //reponse is same as GetBlockHeaderByHeight_Result 44 GetBlockHeaderByHeight_Result struct { 45 Block_Header BlockHeader_Print `json:"block_header"` 46 Status string `json:"status"` 47 }*/ 48 ) 49 50 // GetBlockHeaderByHash 51 type ( 52 GetBlockHeaderByHash_Params struct { 53 Hash string `json:"hash"` 54 } // no params 55 GetBlockHeaderByHash_Result struct { 56 Block_Header BlockHeader_Print `json:"block_header"` 57 Status string `json:"status"` 58 } 59 ) 60 61 // get block count 62 type ( 63 GetBlockCount_Params struct { 64 // NO params 65 } 66 GetBlockCount_Result struct { 67 Count uint64 `json:"count"` 68 Status string `json:"status"` 69 } 70 ) 71 72 // getblock 73 type ( 74 GetBlock_Params struct { 75 Hash string `json:"hash,omitempty"` // Monero Daemon breaks if both are provided 76 Height uint64 `json:"height,omitempty"` // Monero Daemon breaks if both are provided 77 } // no params 78 GetBlock_Result struct { 79 Blob string `json:"blob"` 80 Json string `json:"json"` 81 Block_Header BlockHeader_Print `json:"block_header"` 82 Status string `json:"status"` 83 } 84 ) 85 86 // get block template request response 87 type ( 88 GetBlockTemplate_Params struct { 89 Wallet_Address string `json:"wallet_address"` 90 Reserve_size uint64 `json:"reserve_size"` 91 } 92 GetBlockTemplate_Result struct { 93 Blocktemplate_blob string `json:"blocktemplate_blob"` 94 Blockhashing_blob string `json:"blockhashing_blob"` 95 Expected_reward uint64 `json:"expected_reward"` 96 Difficulty uint64 `json:"difficulty"` 97 Height uint64 `json:"height"` 98 Prev_Hash string `json:"prev_hash"` 99 Reserved_Offset uint64 `json:"reserved_offset"` 100 Epoch uint64 `json:"epoch"` // used to expire pool jobs 101 Status string `json:"status"` 102 } 103 ) 104 105 type ( // array without name containing block template in hex 106 SubmitBlock_Params struct { 107 X []string 108 } 109 SubmitBlock_Result struct { 110 BLID string `json:"blid"` 111 Status string `json:"status"` 112 } 113 ) 114 115 type ( 116 GetLastBlockHeader_Params struct{} // no params 117 GetLastBlockHeader_Result struct { 118 Block_Header BlockHeader_Print `json:"block_header"` 119 Status string `json:"status"` 120 } 121 ) 122 123 type ( 124 GetTxPool_Params struct{} // no params 125 GetTxPool_Result struct { 126 Tx_list []string `json:"txs,omitempty"` 127 Status string `json:"status"` 128 } 129 ) 130 131 // get height http response as json 132 type ( 133 Daemon_GetHeight_Result struct { 134 Height uint64 `json:"height"` 135 StableHeight int64 `json:"stableheight"` 136 TopoHeight int64 `json:"topoheight"` 137 138 Status string `json:"status"` 139 } 140 ) 141 142 type ( 143 On_GetBlockHash_Params struct { 144 X [1]uint64 145 } 146 On_GetBlockHash_Result struct{} 147 ) 148 149 type ( 150 GetTransaction_Params struct { 151 Tx_Hashes []string `json:"txs_hashes"` 152 Decode uint64 `json:"decode_as_json,omitempty"` // Monero Daemon breaks if this sent 153 } // no params 154 GetTransaction_Result struct { 155 Txs_as_hex []string `json:"txs_as_hex"` 156 Txs_as_json []string `json:"txs_as_json"` 157 Txs []Tx_Related_Info `json:"txs"` 158 Status string `json:"status"` 159 } 160 161 Tx_Related_Info struct { 162 As_Hex string `json:"as_hex"` 163 As_Json string `json:"as_json"` 164 Block_Height int64 `json:"block_height"` 165 Reward uint64 `json:"reward"` // miner tx rewards are decided by the protocol during execution 166 Ignored bool `json:"ignored"` // tell whether this tx is okau as per client protocol or bein ignored 167 In_pool bool `json:"in_pool"` 168 Output_Indices []uint64 `json:"output_indices"` 169 Tx_hash string `json:"tx_hash"` 170 ValidBlock string `json:"valid_block"` // TX is valid in this block 171 InvalidBlock []string `json:"invalid_block"` // TX is invalid in this block, 0 or more 172 Ring [][]globals.TX_Output_Data `json:"ring"` 173 } 174 ) 175 176 type ( 177 Is_Key_Image_Spent_Params struct { 178 Key_images []string `json:"key_images"` 179 } // no params 180 Is_Key_Image_Spent_Result struct { 181 Spent_Status []int `json:"spent_status"` // 0 if okay, 1 spent in block chain, 2 spent in pool 182 Status string `json:"status"` 183 } 184 ) 185 186 type ( 187 SendRawTransaction_Params struct { 188 Tx_as_hex string `json:"tx_as_hex"` 189 } 190 SendRawTransaction_Result struct { 191 Status string `json:"status"` 192 DoubleSpend bool `json:"double_spend"` 193 FeeTooLow bool `json:"fee_too_low"` 194 InvalidInput bool `json:"invalid_input"` 195 InvalidOutput bool `json:"invalid_output"` 196 Low_Mixin bool `json:"low_mixin"` 197 Non_rct bool `json:"not_rct"` 198 NotRelayed bool `json:"not_relayed"` 199 Overspend bool `json:"overspend"` 200 TooBig bool `json:"too_big"` 201 Reason string `json:"string"` 202 } 203 ) 204 205 /* 206 { 207 "id": "0", 208 "jsonrpc": "2.0", 209 "result": { 210 "alt_blocks_count": 5, 211 "difficulty": 972165250, 212 "grey_peerlist_size": 2280, 213 "height": 993145, 214 "incoming_connections_count": 0, 215 "outgoing_connections_count": 8, 216 "status": "OK", 217 "target": 60, 218 "target_height": 993137, 219 "testnet": false, 220 "top_block_hash": "", 221 "tx_count": 564287, 222 "tx_pool_size": 45, 223 "white_peerlist_size": 529 224 } 225 }*/ 226 type ( 227 GetInfo_Params struct{} // no params 228 GetInfo_Result struct { 229 Alt_Blocks_Count uint64 `json:"alt_blocks_count"` 230 Difficulty uint64 `json:"difficulty"` 231 Grey_PeerList_Size uint64 `json:"grey_peerlist_size"` 232 Height int64 `json:"height"` 233 StableHeight int64 `json:"stableheight"` 234 TopoHeight int64 `json:"topoheight"` 235 AverageBlockTime50 float32 `json:"averageblocktime50"` 236 Incoming_connections_count uint64 `json:"incoming_connections_count"` 237 Outgoing_connections_count uint64 `json:"outgoing_connections_count"` 238 Target uint64 `json:"target"` 239 Target_Height uint64 `json:"target_height"` 240 Testnet bool `json:"testnet"` 241 Top_block_hash string `json:"top_block_hash"` 242 Tx_count uint64 `json:"tx_count"` 243 Tx_pool_size uint64 `json:"tx_pool_size"` 244 Dynamic_fee_per_kb uint64 `json:"dynamic_fee_per_kb"` // our addition 245 Total_Supply uint64 `json:"total_supply"` // our addition 246 Median_Block_Size uint64 `json:"median_block_size"` // our addition 247 White_peerlist_size uint64 `json:"white_peerlist_size"` 248 Version string `json:"version"` 249 250 Status string `json:"status"` 251 } 252 )