Skip to content

Commit

Permalink
Add federation code to list_federations
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Feb 26, 2024
1 parent 60355fb commit add266d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mutiny-core/src/federation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
pub federation_expiry_timestamp: Option<String>,
Expand Down Expand Up @@ -180,6 +181,7 @@ pub struct FedimintBalance {
pub(crate) struct FederationClient<S: MutinyStorage> {
pub(crate) uuid: String,
pub(crate) fedimint_client: ClientArc,
invite_code: InviteCode,
storage: S,
#[allow(dead_code)]
fedimint_storage: FedimintStorage<S>,
Expand Down Expand Up @@ -213,7 +215,7 @@ impl<S: MutinyStorage> FederationClient<S> {

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);
Expand Down Expand Up @@ -308,6 +310,7 @@ impl<S: MutinyStorage> FederationClient<S> {
fedimint_storage,
storage: storage.clone(),
logger,
invite_code: federation_code,
})
}

Expand Down Expand Up @@ -615,6 +618,7 @@ impl<S: MutinyStorage> FederationClient<S> {
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
Expand Down
3 changes: 2 additions & 1 deletion mutiny-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,7 @@ pub(crate) async fn create_new_federation<S: MutinyStorage>(
// 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,
Expand Down Expand Up @@ -2335,6 +2335,7 @@ pub(crate) async fn create_new_federation<S: MutinyStorage>(
Ok(FederationIdentity {
uuid: next_federation_uuid.clone(),
federation_id,
invite_code: federation_code,
federation_name,
federation_expiry_timestamp,
welcome_message,
Expand Down

0 comments on commit add266d

Please sign in to comment.