monero.rs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* This file is part of DarkFi (https://dark.fi)
  2. *
  3. * Copyright (C) 2020-2023 Dyne.org foundation
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. use darkfi::rpc::{
  19. jsonrpc::{JsonRequest, JsonResult},
  20. util::JsonValue,
  21. };
  22. use log::{debug, error};
  23. use surf::http::mime;
  24. use super::MiningProxy;
  25. impl MiningProxy {
  26. pub async fn monero_get_block_count(&self, id: u16, params: JsonValue) -> JsonResult {
  27. debug!(target: "rpc::monero", "get_block_count()");
  28. let req_body = JsonRequest::new("get_block_count", vec![].into()).stringify().unwrap();
  29. let client = surf::Client::new();
  30. let mut response = client
  31. .get(&self.monerod_rpc)
  32. .header("Content-Type", "application/json")
  33. .body(req_body)
  34. .send()
  35. .await
  36. .unwrap();
  37. println!("{:?}", String::from_utf8_lossy(&response.body_bytes().await.unwrap()));
  38. todo!()
  39. }
  40. pub async fn monero_on_get_block_hash(&self, id: u16, params: JsonValue) -> JsonResult {
  41. todo!()
  42. }
  43. pub async fn monero_get_block_template(&self, id: u16, params: JsonValue) -> JsonResult {
  44. todo!()
  45. }
  46. pub async fn monero_submit_block(&self, id: u16, params: JsonValue) -> JsonResult {
  47. todo!()
  48. }
  49. pub async fn monero_generateblocks(&self, id: u16, params: JsonValue) -> JsonResult {
  50. todo!()
  51. }
  52. pub async fn monero_get_last_block_header(&self, id: u16, params: JsonValue) -> JsonResult {
  53. todo!()
  54. }
  55. pub async fn monero_get_block_header_by_hash(&self, id: u16, params: JsonValue) -> JsonResult {
  56. todo!()
  57. }
  58. pub async fn monero_get_block_header_by_height(
  59. &self,
  60. id: u16,
  61. params: JsonValue,
  62. ) -> JsonResult {
  63. todo!()
  64. }
  65. pub async fn monero_get_block_headers_range(&self, id: u16, params: JsonValue) -> JsonResult {
  66. todo!()
  67. }
  68. pub async fn monero_get_block(&self, id: u16, params: JsonValue) -> JsonResult {
  69. todo!()
  70. }
  71. pub async fn monero_get_connections(&self, id: u16, params: JsonValue) -> JsonResult {
  72. todo!()
  73. }
  74. pub async fn monero_get_info(&self, id: u16, params: JsonValue) -> JsonResult {
  75. todo!()
  76. }
  77. pub async fn monero_hard_fork_info(&self, id: u16, params: JsonValue) -> JsonResult {
  78. todo!()
  79. }
  80. pub async fn monero_set_bans(&self, id: u16, params: JsonValue) -> JsonResult {
  81. todo!()
  82. }
  83. pub async fn monero_get_bans(&self, id: u16, params: JsonValue) -> JsonResult {
  84. todo!()
  85. }
  86. pub async fn monero_banned(&self, id: u16, params: JsonValue) -> JsonResult {
  87. todo!()
  88. }
  89. pub async fn monero_flush_txpool(&self, id: u16, params: JsonValue) -> JsonResult {
  90. todo!()
  91. }
  92. pub async fn monero_get_output_histogram(&self, id: u16, params: JsonValue) -> JsonResult {
  93. todo!()
  94. }
  95. pub async fn monero_get_version(&self, id: u16, params: JsonValue) -> JsonResult {
  96. todo!()
  97. }
  98. pub async fn monero_get_coinbase_tx_sum(&self, id: u16, params: JsonValue) -> JsonResult {
  99. todo!()
  100. }
  101. pub async fn monero_get_fee_estimate(&self, id: u16, params: JsonValue) -> JsonResult {
  102. todo!()
  103. }
  104. pub async fn monero_get_alternate_chains(&self, id: u16, params: JsonValue) -> JsonResult {
  105. todo!()
  106. }
  107. pub async fn monero_relay_tx(&self, id: u16, params: JsonValue) -> JsonResult {
  108. todo!()
  109. }
  110. pub async fn monero_sync_info(&self, id: u16, params: JsonValue) -> JsonResult {
  111. todo!()
  112. }
  113. pub async fn monero_get_txpool_backlog(&self, id: u16, params: JsonValue) -> JsonResult {
  114. todo!()
  115. }
  116. pub async fn monero_get_output_distribution(&self, id: u16, params: JsonValue) -> JsonResult {
  117. todo!()
  118. }
  119. pub async fn monero_get_miner_data(&self, id: u16, params: JsonValue) -> JsonResult {
  120. todo!()
  121. }
  122. pub async fn monero_prune_blockchain(&self, id: u16, params: JsonValue) -> JsonResult {
  123. todo!()
  124. }
  125. pub async fn monero_calc_pow(&self, id: u16, params: JsonValue) -> JsonResult {
  126. todo!()
  127. }
  128. pub async fn monero_flush_cache(&self, id: u16, params: JsonValue) -> JsonResult {
  129. todo!()
  130. }
  131. pub async fn monero_add_aux_pow(&self, id: u16, params: JsonValue) -> JsonResult {
  132. todo!()
  133. }
  134. }