From add266da0f9dbb8de13413e0447290672d2438f6 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 26 Feb 2024 21:10:28 +0000 Subject: [PATCH] Add federation code to list_federations --- mutiny-core/src/federation.rs | 6 +++++- mutiny-core/src/lib.rs | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mutiny-core/src/federation.rs b/mutiny-core/src/federation.rs index 847e9108a..cea6767ed 100644 --- a/mutiny-core/src/federation.rs +++ b/mutiny-core/src/federation.rs @@ -145,6 +145,7 @@ pub struct FederationStorage { pub struct FederationIdentity { pub uuid: String, pub federation_id: FederationId, + pub invite_code: InviteCode, // https://github.com/fedimint/fedimint/tree/master/docs/meta_fields pub federation_name: Option, pub federation_expiry_timestamp: Option, @@ -180,6 +181,7 @@ pub struct FedimintBalance { pub(crate) struct FederationClient { pub(crate) uuid: String, pub(crate) fedimint_client: ClientArc, + invite_code: InviteCode, storage: S, #[allow(dead_code)] fedimint_storage: FedimintStorage, @@ -213,7 +215,7 @@ impl FederationClient { if get_config_from_db(&db).await.is_none() { let download = Instant::now(); - let federation_info = FederationInfo::from_invite_code(federation_code) + let federation_info = FederationInfo::from_invite_code(federation_code.clone()) .await .map_err(|e| { log_error!(logger, "Could not parse invite code: {}", e); @@ -308,6 +310,7 @@ impl FederationClient { fedimint_storage, storage: storage.clone(), logger, + invite_code: federation_code, }) } @@ -615,6 +618,7 @@ impl FederationClient { FederationIdentity { uuid: self.uuid.clone(), federation_id: self.fedimint_client.federation_id(), + invite_code: self.invite_code.clone(), federation_name: self.fedimint_client.get_meta("federation_name"), federation_expiry_timestamp: self .fedimint_client diff --git a/mutiny-core/src/lib.rs b/mutiny-core/src/lib.rs index 11f745842..5bcf47ba8 100644 --- a/mutiny-core/src/lib.rs +++ b/mutiny-core/src/lib.rs @@ -2305,7 +2305,7 @@ pub(crate) async fn create_new_federation( // now create the federation process and init it let new_federation = FederationClient::new( next_federation_uuid.clone(), - federation_code, + federation_code.clone(), xprivkey, &storage, network, @@ -2335,6 +2335,7 @@ pub(crate) async fn create_new_federation( Ok(FederationIdentity { uuid: next_federation_uuid.clone(), federation_id, + invite_code: federation_code, federation_name, federation_expiry_timestamp, welcome_message,