mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-01 04:56:41 -05:00
updating wip
This commit is contained in:
parent
22deb6b47e
commit
da3307d4d6
5 changed files with 151 additions and 61 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use jsonrpsee::http_server::{RpcModule};
|
||||
use crate::api::{Request, Params};
|
||||
use crate::api::{Request, Init, Params};
|
||||
use crate::env::{Config, GetConfig, Testnet};
|
||||
use crate::fs::system_data_dir;
|
||||
use url::Url;
|
||||
|
|
@ -7,9 +7,10 @@ use crate::cli::command::{Command, Options};
|
|||
use std::str::FromStr;
|
||||
use crate::cli::command::{DEFAULT_ELECTRUM_RPC_URL_TESTNET, DEFAULT_BITCOIN_CONFIRMATION_TARGET_TESTNET};
|
||||
use crate::rpc::Error;
|
||||
use crate::{bitcoin, cli, monero};
|
||||
|
||||
|
||||
pub fn register_modules() -> RpcModule<()> {
|
||||
pub fn register_modules(api_init: &Init) -> RpcModule<()> {
|
||||
let mut module = RpcModule::new(());
|
||||
module
|
||||
.register_async_method("get_bitcoin_balance", |_, _| async {
|
||||
|
|
@ -21,22 +22,11 @@ pub fn register_modules() -> RpcModule<()> {
|
|||
}
|
||||
|
||||
async fn get_bitcoin_balance() -> anyhow::Result<(), Error> {
|
||||
// let api = InternalApi {
|
||||
// opts: Options {
|
||||
// env_config: Testnet::get_config(),
|
||||
// debug: false,
|
||||
// json: true,
|
||||
// data_dir: system_data_dir().unwrap().join("cli")
|
||||
//
|
||||
// },
|
||||
// params: Params {
|
||||
// bitcoin_electrum_rpc_url: Some(Url::from_str(DEFAULT_ELECTRUM_RPC_URL_TESTNET).unwrap()),
|
||||
// bitcoin_target_block: Some(DEFAULT_BITCOIN_CONFIRMATION_TARGET_TESTNET),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// cmd: Command::Balance,
|
||||
// };
|
||||
// api.call().await;
|
||||
let request = Request {
|
||||
params: Params::default(),
|
||||
cmd: Command::Balance,
|
||||
};
|
||||
// request.call(api_init).await;
|
||||
Ok(())
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue