mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-26 18:34:26 +01:00
Bump boltz-client, fix fee calculation (#68)
* Bump boltz-client, fix fee calculation * Cargo fmt
This commit is contained in:
2
cli/Cargo.lock
generated
2
cli/Cargo.lock
generated
@@ -286,7 +286,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "boltz-client"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/hydra-yse/boltz-rust?branch=yse-breez-latest#ff836fe766421738e7f05cbed8a2fbe65245ef03"
|
||||
source = "git+https://github.com/SatoshiPortal/boltz-rust?rev=e55b8439f3311be7fcd18ec14a5747d0f3dbd74f#e55b8439f3311be7fcd18ec14a5747d0f3dbd74f"
|
||||
dependencies = [
|
||||
"bip39",
|
||||
"bitcoin 0.31.1",
|
||||
|
||||
2
lib/Cargo.lock
generated
2
lib/Cargo.lock
generated
@@ -238,7 +238,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "boltz-client"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/hydra-yse/boltz-rust?branch=yse-breez-latest#ff836fe766421738e7f05cbed8a2fbe65245ef03"
|
||||
source = "git+https://github.com/SatoshiPortal/boltz-rust?rev=e55b8439f3311be7fcd18ec14a5747d0f3dbd74f#e55b8439f3311be7fcd18ec14a5747d0f3dbd74f"
|
||||
dependencies = [
|
||||
"bip39",
|
||||
"bitcoin 0.31.1",
|
||||
|
||||
@@ -10,9 +10,7 @@ crate-type = ["staticlib", "cdylib", "lib"]
|
||||
[dependencies]
|
||||
anyhow = "1.0.80"
|
||||
bip39 = { version = "2.0.0", features = ["serde"] }
|
||||
#boltz-client = "0.1.2"
|
||||
#boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "61592bcf0ad2e9bd68c593bc87c5a487805b6d00" }
|
||||
boltz-client = { git = "https://github.com/hydra-yse/boltz-rust", branch = "yse-breez-latest" }
|
||||
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "e55b8439f3311be7fcd18ec14a5747d0f3dbd74f" }
|
||||
log = "0.4.20"
|
||||
lwk_common = "0.3.0"
|
||||
lwk_signer = "0.3.0"
|
||||
|
||||
@@ -305,17 +305,16 @@ impl Wallet {
|
||||
let (onchain_amount_sat, invoice_amount_sat) =
|
||||
match (req.onchain_amount_sat, req.invoice_amount_sat) {
|
||||
(Some(onchain_amount_sat), None) => {
|
||||
// TODO Calculate correct fees, once these PRs are merged and published
|
||||
// https://github.com/SatoshiPortal/boltz-rust/pull/31
|
||||
// https://github.com/SatoshiPortal/boltz-rust/pull/32
|
||||
|
||||
// TODO Until above is fixed, this is only an approximation (using onchain instead of invoice amount to calc. fees)
|
||||
let fees_boltz = lbtc_pair.fees.reverse_boltz(onchain_amount_sat);
|
||||
let fees_lockup = lbtc_pair.fees.reverse_lockup();
|
||||
let fees_claim = CLAIM_ABSOLUTE_FEES; // lbtc_pair.fees.reverse_claim_estimate();
|
||||
let fees_total = fees_boltz + fees_lockup + fees_claim;
|
||||
let p = lbtc_pair.fees.percentage;
|
||||
|
||||
Ok((onchain_amount_sat, onchain_amount_sat + fees_total))
|
||||
let temp_recv_amt = onchain_amount_sat;
|
||||
let invoice_amt_minus_service_fee = temp_recv_amt + fees_lockup + fees_claim;
|
||||
let invoice_amount_sat =
|
||||
(invoice_amt_minus_service_fee as f64 * 100.0 / (100.0 - p)).ceil() as u64;
|
||||
|
||||
Ok((onchain_amount_sat, invoice_amount_sat))
|
||||
}
|
||||
(None, Some(invoice_amount_sat)) => {
|
||||
let fees_boltz = lbtc_pair.fees.reverse_boltz(invoice_amount_sat);
|
||||
|
||||
Reference in New Issue
Block a user