Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to fedimint 0.6.0 #194

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
490 changes: 288 additions & 202 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions harbor-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ url = "2.5.0"
bitcoin = { version = "0.32.4", features = ["base64"] }
bip39 = "2.0.0"

fedimint-api-client = "0.5.0"
fedimint-client = "0.5.0"
fedimint-core = "0.5.0"
fedimint-wallet-client = "0.5.0"
fedimint-mint-client = "0.5.0"
fedimint-ln-client = "0.5.0"
fedimint-bip39 = "0.5.0"
fedimint-ln-common = "0.5.0"
fedimint-api-client = { version = "0.6.0", features = ["tor"] }
fedimint-client = { version = "0.6.0", features = ["tor"] }
fedimint-core = "0.6.0"
fedimint-wallet-client = "0.6.0"
fedimint-mint-client = "0.6.0"
fedimint-ln-client = "0.6.0"
fedimint-bip39 = "0.6.0"
fedimint-ln-common = "0.6.0"

# BEGIN BLOCK OF KEEP IN SYNC WITH FEDIMINT'S VERSION
arti-client = { version = "0.20.0", default-features = false, features = ["tokio", "rustls"], package = "fedimint-arti-client" }
lnurl-rs = { version = "0.8.0", default-features = false }
hyper = { version = "1.5.0", default-features = false, features = ["client", "http1"] }
lnurl-rs = { version = "0.9.0", default-features = false }
hyper = { version = "1.6.0", default-features = false, features = ["client", "http1"] }
hyper-rustls = { version = "0.27.3", default-features = false }
hyper-util = { version = "0.1.3", default-features = false, features = ["client", "client-legacy", "tokio"] }
http-body-util = { version = "0.1.0", default-features = false }
Expand Down
7 changes: 3 additions & 4 deletions harbor-client/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::db_models::{
use crate::metadata::FederationMeta;
use anyhow::anyhow;
use bip39::{Language, Mnemonic};
use bitcoin::address::NetworkUnchecked;
use bitcoin::{Address, Txid};
use diesel::{
connection::SimpleConnection,
Expand Down Expand Up @@ -149,7 +148,7 @@ pub trait DBConnection {
&self,
operation_id: OperationId,
fedimint_id: FederationId,
address: Address<NetworkUnchecked>,
address: Address,
amount_sats: u64,
fee_sats: u64,
) -> anyhow::Result<()>;
Expand Down Expand Up @@ -368,7 +367,7 @@ impl DBConnection for SQLConnection {
&self,
operation_id: OperationId,
fedimint_id: FederationId,
address: Address<NetworkUnchecked>,
address: Address,
amount_sats: u64,
fee_sats: u64,
) -> anyhow::Result<()> {
Expand Down Expand Up @@ -853,7 +852,7 @@ mod tests {
&mut conn,
operation_id,
FederationId::from_str(FEDERATION_ID).unwrap(),
address.clone(),
address.clone().assume_checked(),
amount,
fee,
)
Expand Down
4 changes: 2 additions & 2 deletions harbor-client/src/db_models/onchain_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ impl OnChainPayment {
conn: &mut SqliteConnection,
operation_id: OperationId,
fedimint_id: FederationId,
address: Address<NetworkUnchecked>,
address: Address,
amount_sats: u64,
fee_sats: u64,
) -> anyhow::Result<()> {
let new = NewOnChainPayment {
operation_id: operation_id.fmt_full().to_string(),
fedimint_id: fedimint_id.to_string(),
address: address.assume_checked().to_string(),
address: address.to_string(),
amount_sats: amount_sats as i64,
fee_sats: fee_sats as i64,
status: PaymentStatus::Pending as i32,
Expand Down
15 changes: 9 additions & 6 deletions harbor-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,12 @@ impl HarborCore {
address: Address<NetworkUnchecked>,
sats: Option<u64>,
) -> anyhow::Result<()> {
let address = address
.require_network(self.network)
.map_err(|_| anyhow!("Address is for wrong network"))?;

log::info!(
"Sending onchain payment to address: {} from federation: {federation_id}",
address.clone().assume_checked()
"Sending onchain payment to address: {address} from federation: {federation_id}",
);
let client = self.get_client(federation_id).await.fedimint_client;
let onchain = client
Expand All @@ -642,7 +645,7 @@ impl HarborCore {
let (fees, amount) = match sats {
Some(sats) => {
let amount = bitcoin::Amount::from_sat(sats);
let fees = onchain.get_withdraw_fees(address.clone(), amount).await?;
let fees = onchain.get_withdraw_fees(&address, amount).await?;
(fees, amount)
}
None => {
Expand All @@ -655,7 +658,7 @@ impl HarborCore {
// get fees for the entire balance
let fees = onchain
.get_withdraw_fees(
address.clone(),
&address,
bitcoin::Amount::from_sat(balance.sats_round_down()),
)
.await?;
Expand All @@ -681,7 +684,7 @@ impl HarborCore {
));
}

let op_id = onchain.withdraw(address.clone(), amount, fees, ()).await?;
let op_id = onchain.withdraw(&address, amount, fees, ()).await?;

self.storage.create_onchain_payment(
op_id,
Expand Down Expand Up @@ -922,7 +925,7 @@ impl HarborCore {
id: c.fedimint_client.federation_id(),
name: c
.fedimint_client
.get_meta("federation_name")
.get_config_meta("federation_name")
.unwrap_or("Unknown".to_string()),
balance: balance.sats_round_down(),
guardians: Some(guardians),
Expand Down
2 changes: 1 addition & 1 deletion harbor-client/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) enum FederationData<'a> {
impl FederationData<'_> {
pub(crate) fn get_meta(&self, str: &str) -> Option<String> {
match self {
FederationData::Client(c) => c.get_meta(str),
FederationData::Client(c) => c.get_config_meta(str),
FederationData::Config(c) => c.meta(str).ok().flatten(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions harbor-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ uuid = { version = "1.8", features = ["v4"] }

bitcoin = { version = "0.32.4", features = ["base64"] }
bip39 = "2.0.0"
fedimint-core = "0.5.0"
fedimint-ln-common = "0.5.0"
fedimint-core = "0.6.0"
fedimint-ln-common = "0.6.0"
opener = { version = "0.7.2", features = ["reveal"] }
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.138"
3 changes: 3 additions & 0 deletions harbor-ui/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ pub fn run_core() -> impl Stream<Item = Message> {
.add_filter_ignore_str("naga")
.add_filter_ignore_str("cosmic_text")
.add_filter_ignore_str("rustls")
// spammy trace logs
.add_filter_ignore_str("calloop")
.add_filter_ignore_str("soketto")
.build();
CombinedLogger::init(vec![
TermLogger::new(
Expand Down
Loading