Skip to content

Commit

Permalink
chore: remove redundant ln functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thevaibhav-dixit committed Jan 8, 2024
1 parent 31e84ac commit d5bfae7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 87 deletions.
53 changes: 0 additions & 53 deletions bitfinex-client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,59 +307,6 @@ impl BitfinexClient {
Ok(details.address)
}

#[instrument(name = "bitfinex_client.get_ln_deposit_address", skip(self), err)]
pub async fn get_ln_deposit_address(&self) -> Result<DepositAddress, BitfinexClientError> {
let mut body: HashMap<String, String> = HashMap::new();
body.insert("wallet".to_string(), Wallet::EXCHANGE.to_string());
body.insert("method".to_string(), AddressMethod::LNX.to_string());
let request_body = serde_json::to_string(&body)?;

let endpoint = "/deposit/address";
let params = "";
let headers = self.post_w_request_headers(endpoint, params, &request_body)?;

let response = self
.rate_limit_client(endpoint)
.await
.post(Self::url_for_auth_w_path(endpoint, params))
.headers(headers)
.body(request_body)
.send()
.await?;

let details = Self::extract_response_data::<DepositAddressDetails>(response).await?;
Ok(details.address)
}

#[instrument(name = "bitfinex_client.get_ln_invoice", skip(self), err)]
pub async fn get_ln_invoice(
&self,
client_id: ClientId,
amount: Decimal,
) -> Result<InvoiceDetails, BitfinexClientError> {
let mut body: HashMap<String, String> = HashMap::new();
body.insert("wallet".to_string(), Wallet::EXCHANGE.to_string());
body.insert("currency".to_string(), Currency::LNX.to_string());
body.insert("amount".to_string(), amount.to_string());
let request_body = serde_json::to_string(&body)?;

let endpoint = "/deposit/invoice";
let params = "";
let headers = self.post_w_request_headers(endpoint, params, &request_body)?;

let response = self
.rate_limit_client(endpoint)
.await
.post(Self::url_for_auth_w_path(endpoint, params))
.headers(headers)
.body(request_body)
.send()
.await?;

let invoice = Self::extract_response_data::<InvoiceDetails>(response).await?;
Ok(invoice)
}

#[instrument(name = "bitfinex_client.transfer_funding_to_trading", skip(self), err)]
pub async fn transfer_funding_to_trading(
&self,
Expand Down
34 changes: 0 additions & 34 deletions bitfinex-client/tests/bitfinex_client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::env;

use bitfinex_client::*;

use rust_decimal_macros::dec;
use serial_test::serial;

async fn configured_client() -> anyhow::Result<BitfinexClient> {
Expand Down Expand Up @@ -104,39 +103,6 @@ async fn get_funding_deposit_address() -> anyhow::Result<()> {
Ok(())
}

#[tokio::test]
#[serial]
async fn get_ln_deposit_address() -> anyhow::Result<()> {
if let Ok(client) = configured_client().await {
let _address = client.get_ln_deposit_address().await?;
}

Ok(())
}

#[tokio::test]
#[serial]
async fn get_ln_invoice() -> anyhow::Result<()> {
if let Ok(client) = configured_client().await {
let client_id = ClientId::new();
let amount = dec!(0.001);
let _invoice = client.get_ln_invoice(client_id, amount).await?;
}

Ok(())
}

#[tokio::test]
#[serial]
async fn get_ln_transactions() -> anyhow::Result<()> {
if let Ok(client) = configured_client().await {
let client_id = ClientId::new();
let _invoice = client.get_ln_transactions(client_id).await?;
}

Ok(())
}

#[tokio::test]
#[serial]
async fn get_btc_on_chain_transactions() -> anyhow::Result<()> {
Expand Down

0 comments on commit d5bfae7

Please sign in to comment.