github.com/deroproject/derosuite@v2.1.6-1.0.20200307070847-0f2e589c7a2b+incompatible/structures/wallet_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 required to implement wallet rpc (compatible with C daemon) 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 type ( 26 GetBalance_Params struct{} // no params 27 GetBalance_Result struct { 28 Balance uint64 `json:"balance"` 29 Unlocked_Balance uint64 `json:"unlocked_balance"` 30 } 31 ) 32 33 type ( 34 GetAddress_Params struct{} // no params 35 GetAddress_Result struct { 36 Address string `json:"address"` 37 } 38 ) 39 40 type ( 41 GetHeight_Params struct{} // no params 42 GetHeight_Result struct { 43 Height uint64 `json:"height"` 44 } 45 ) 46 47 type ( 48 Destination struct { 49 Amount uint64 `json:"amount"` 50 Address string `json:"address"` 51 } 52 53 Transfer_Params struct { 54 Destinations []Destination `json:"destinations"` 55 Fee uint64 `json:"fee"` 56 Mixin uint64 `json:"mixin"` 57 Unlock_time uint64 `json:"unlock_time"` 58 Payment_ID string `json:"payment_id"` 59 Get_tx_key bool `json:"get_tx_key"` 60 Priority uint64 `json:"priority"` 61 Do_not_relay bool `json:"do_not_relay"` 62 Get_tx_hex bool `json:"get_tx_hex"` 63 } // no params 64 Transfer_Result struct { 65 Fee uint64 `json:"fee"` 66 Tx_key string `json:"tx_key"` 67 Tx_hash string `json:"tx_hash"` 68 Tx_blob string `json:"tx_blob"` 69 } 70 ) 71 72 //transfer split 73 type ( 74 TransferSplit_Params Transfer_Params 75 TransferSplit_Result struct { 76 Fee_list []uint64 `json:"fee_list"` 77 Amount_list []uint64 `json:"amount_list"` 78 Tx_key_list []string `json:"tx_key_list"` 79 Tx_hash_list []string `json:"tx_hash_list"` 80 Tx_blob_list []string `json:"tx_blob_list"` 81 } 82 ) 83 84 // each outgoing transaction will have this detail, 85 // if the wallet is recreated from scratch this information will be lost 86 type Outgoing_Transfer_Details struct { 87 TXID string `json:"txid,omitempty"` 88 PaymentID string `json:"paymentid,omitempty"` // actual payment id 89 Fees uint64 `json:"fees,omitempty"` // fees 90 Amount []uint64 `json:"amount,omitempty"` // amount sent 91 Daddress []string `json:"to,omitempty"`// taken from address 92 TXsecretkey string `json:"tx_secret_key,omitempty"` //secret key for transaction 93 } 94 95 96 type ( 97 Transfer_Details struct { 98 TXID string `json:"tx_hash"` 99 Payment_ID string `json:"payment_id,omitempty"` 100 Height uint64 `json:"block_height"` 101 Timestamp uint64 `json:"timestamp,omitempty"` 102 Amount uint64 `json:"amount"` 103 Fees uint64 `json:"fee,omitempty"` 104 Unlock_time uint64 `json:"unlock_time"` 105 Destinations []Destination `json:"destinations"` 106 Note string `json:"note,omitempty"` 107 Type string `json:"type,omitempty"` 108 } 109 110 Get_Transfers_Params struct { 111 In bool `json:"in"` 112 Out bool `json:"out"` 113 Pending bool `json:"pending"` 114 Failed bool `json:"failed"` 115 Pool bool `json:"pool"` 116 Filter_by_Height bool `json:"filter_by_height"` 117 Min_Height uint64 `json:"min_height"` 118 Max_Height uint64 `json:"max_height"` 119 } 120 Get_Transfers_Result struct { 121 In []Transfer_Details `json:"in,omitempty"` 122 Out []Transfer_Details `json:"out,omitempty"` 123 Pending []Transfer_Details `json:"pending,omitempty"` 124 Failed []Transfer_Details `json:"failed,omitempty"` 125 Pool []Transfer_Details `json:"pool,omitempty"` 126 } 127 ) 128 129 // Get_Bulk_Payments 130 type ( 131 Get_Bulk_Payments_Params struct { 132 Payment_IDs []string `json:"payment_ids"` 133 Min_block_height uint64 `json:"min_block_height"` 134 } // no params 135 Get_Bulk_Payments_Result struct { 136 Payments []Transfer_Details `json:"payments,omitempty"` 137 } 138 ) 139 140 // query_key 141 type ( 142 Query_Key_Params struct { 143 Key_type string `json:"key_type"` 144 } // no params 145 Query_Key_Result struct { 146 Key string `json:"key"` 147 } 148 ) 149 150 // make_integrated_address_handler 151 type ( 152 Make_Integrated_Address_Params struct { 153 Payment_id string `json:"payment_id"` // 16 or 64 hex encoded payment ID 154 } // no params 155 Make_Integrated_Address_Result struct { 156 Integrated_Address string `json:"integrated_address"` 157 Payment_id string `json:"payment_id"` 158 } 159 ) 160 161 // split_integrated_address_handler 162 type ( 163 Split_Integrated_Address_Params struct { 164 Integrated_Address string `json:"integrated_address"` 165 } // no params 166 Split_Integrated_Address_Result struct { 167 Standard_Address string `json:"standard_address"` 168 Payment_id string `json:"payment_id"` 169 } 170 ) 171 172 // Get_Transfer_By_TXID 173 type ( 174 Get_Transfer_By_TXID_Params struct { 175 TXID string `json:"txid"` 176 } 177 Get_Transfer_By_TXID_Result struct { 178 Transfer Transfer_Details `json:"payments,omitempty"` 179 } 180 ) 181 182 /* 183 // GetBlockHeaderByHash 184 type ( 185 186 GetBlockHeaderByHash_Params struct { 187 Hash string `json:"hash"` 188 } // no params 189 GetBlockHeaderByHash_Result struct { 190 Block_Header BlockHeader_Print `json:"block_header"` 191 Status string `json:"status"` 192 } 193 ) 194 195 // get block count 196 type ( 197 GetBlockCount_Params struct { 198 // NO params 199 } 200 GetBlockCount_Result struct { 201 Count uint64 `json:"count"` 202 Status string `json:"status"` 203 } 204 ) 205 206 // getblock 207 type ( 208 209 GetBlock_Params struct { 210 Hash string `json:"hash,omitempty"` // Monero Daemon breaks if both are provided 211 Height uint64 `json:"height,omitempty"` // Monero Daemon breaks if both are provided 212 } // no params 213 GetBlock_Result struct { 214 Blob string `json:"blob"` 215 Json string `json:"json"` 216 Block_Header BlockHeader_Print `json:"block_header"` 217 Status string `json:"status"` 218 } 219 ) 220 221 222 // get block template request response 223 type ( 224 225 GetBlockTemplate_Params struct { 226 Wallet_Address string `json:"wallet_address"` 227 Reserve_size uint64 `json:"reserve_size"` 228 } 229 GetBlockTemplate_Result struct { 230 Blocktemplate_blob string `json:"blocktemplate_blob"` 231 Expected_reward uint64 `json:"expected_reward"` 232 Difficulty uint64 `json:"difficulty"` 233 Height uint64 `json:"height"` 234 Prev_Hash string `json:"prev_hash"` 235 Reserved_Offset uint64 `json:"reserved_offset"` 236 Status string `json:"status"` 237 } 238 ) 239 240 type (// array without name containing block template in hex 241 SubmitBlock_Params struct { 242 X []string 243 } 244 SubmitBlock_Result struct { 245 Status string `json:"status"` 246 } 247 ) 248 249 250 type ( 251 252 GetLastBlockHeader_Params struct{} // no params 253 GetLastBlockHeader_Result struct { 254 Block_Header BlockHeader_Print `json:"block_header"` 255 Status string `json:"status"` 256 } 257 ) 258 259 260 type ( 261 262 GetTxPool_Params struct{} // no params 263 GetTxPool_Result struct { 264 Tx_list []string `json:"txs,omitempty"` 265 Status string `json:"status"` 266 } 267 ) 268 269 type ( 270 271 On_GetBlockHash_Params struct { 272 X [1]uint64 273 } 274 On_GetBlockHash_Result struct{} 275 ) 276 277 278 279 280 type ( 281 282 GetTransaction_Params struct { 283 Tx_Hashes []string `json:"txs_hashes"` 284 Decode uint64 `json:"decode_as_json,omitempty"` // Monero Daemon breaks if this sent 285 } // no params 286 GetTransaction_Result struct { 287 Txs_as_hex []string `json:"txs_as_hex"` 288 Txs_as_json []string `json:"txs_as_json"` 289 Txs []Tx_Related_Info `json:"txs"` 290 Status string `json:"status"` 291 } 292 293 Tx_Related_Info struct { 294 As_Hex string `json:"as_hex"` 295 As_Json string `json:"as_json"` 296 Block_Height int64 `json:"block_height"` 297 In_pool bool `json:"in_pool"` 298 Output_Indices []uint64 `json:"output_indices"` 299 Tx_hash string `json:"tx_hash"` 300 } 301 ) 302 303 type ( 304 305 SendRawTransaction_Params struct { 306 Tx_as_hex string `json:"tx_as_hex"` 307 308 } 309 SendRawTransaction_Result struct { 310 Status string `json:"status"` 311 DoubleSpend bool `json:"double_spend"` 312 FeeTooLow bool `json:"fee_too_low"` 313 InvalidInput bool `json:"invalid_input"` 314 InvalidOutput bool `json:"invalid_output"` 315 Low_Mixin bool `json:"low_mixin"` 316 Non_rct bool `json:"not_rct"` 317 NotRelayed bool `json:"not_relayed"` 318 Overspend bool `json:"overspend"` 319 TooBig bool `json:"too_big"` 320 Reason string `json:"string"` 321 322 } 323 324 ) 325 326 327 */