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

Add federation code to list_federations #1053

Merged
merged 1 commit into from
Feb 26, 2024
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
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 @@ -2524,7 +2524,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 @@ -2554,6 +2554,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
Loading