@@ -144,6 +144,30 @@ pub struct FederationIdentity {
144144 pub federation_expiry_timestamp : Option < String > ,
145145 pub welcome_message : Option < String > ,
146146 pub gateway_fees : Option < GatewayFees > ,
147+ // undocumented parameters that fedi uses: https://meta.dev.fedibtc.com/meta.json
148+ pub default_currency : Option < String > ,
149+ pub federation_icon_url : Option < String > ,
150+ pub max_balance_msats : Option < u32 > ,
151+ pub max_invoice_msats : Option < u32 > ,
152+ pub meta_external_url : Option < String > ,
153+ pub onchain_deposits_disabled : Option < bool > ,
154+ pub preview_message : Option < String > ,
155+ pub sites : Option < Site > ,
156+ pub public : Option < bool > ,
157+ pub tos_url : Option < String > ,
158+ pub popup_end_timestamp : Option < u32 > ,
159+ pub popup_countdown_message : Option < String > ,
160+ pub invite_codes_disabled : Option < bool > ,
161+ pub stability_pool_disabled : Option < bool > ,
162+ pub social_recovery_disabled : Option < bool > ,
163+ }
164+
165+ #[ derive( Default , Debug , Clone , Eq , PartialEq , Serialize , Deserialize ) ]
166+ pub struct Site {
167+ pub id : Option < String > ,
168+ pub url : Option < String > ,
169+ pub title : Option < String > ,
170+ pub image_url : Option < String > ,
147171}
148172
149173#[ derive( Debug , Serialize , Deserialize , PartialEq , Eq , Clone , Default ) ]
@@ -658,18 +682,12 @@ impl<S: MutinyStorage> FederationClient<S> {
658682
659683 pub async fn get_mutiny_federation_identity ( & self ) -> FederationIdentity {
660684 let gateway_fees = self . gateway_fee ( ) . await . ok ( ) ;
661-
662- FederationIdentity {
663- uuid : self . uuid . clone ( ) ,
664- federation_id : self . fedimint_client . federation_id ( ) ,
665- invite_code : self . invite_code . clone ( ) ,
666- federation_name : self . fedimint_client . get_meta ( "federation_name" ) ,
667- federation_expiry_timestamp : self
668- . fedimint_client
669- . get_meta ( "federation_expiry_timestamp" ) ,
670- welcome_message : self . fedimint_client . get_meta ( "welcome_message" ) ,
685+ get_federation_identity (
686+ self . uuid . clone ( ) ,
687+ self . fedimint_client . clone ( ) ,
688+ self . invite_code . clone ( ) ,
671689 gateway_fees,
672- }
690+ )
673691 }
674692
675693 // delete_fedimint_storage is not suggested at the moment due to the lack of easy restores
@@ -679,6 +697,56 @@ impl<S: MutinyStorage> FederationClient<S> {
679697 }
680698}
681699
700+ pub ( crate ) fn get_federation_identity (
701+ uuid : String ,
702+ fedimint_client : ClientHandleArc ,
703+ invite_code : InviteCode ,
704+ gateway_fees : Option < GatewayFees > ,
705+ ) -> FederationIdentity {
706+ FederationIdentity {
707+ uuid : uuid. clone ( ) ,
708+ federation_id : fedimint_client. federation_id ( ) ,
709+ invite_code : invite_code. clone ( ) ,
710+ federation_name : fedimint_client. get_meta ( "federation_name" ) ,
711+ federation_expiry_timestamp : fedimint_client. get_meta ( "federation_expiry_timestamp" ) ,
712+ welcome_message : fedimint_client. get_meta ( "welcome_message" ) ,
713+ gateway_fees,
714+ default_currency : fedimint_client. get_meta ( "default_currency" ) ,
715+ federation_icon_url : fedimint_client. get_meta ( "federation_icon_url" ) ,
716+ max_balance_msats : fedimint_client
717+ . get_meta ( "max_balance_msats" )
718+ . map ( |v| v. parse ( ) . unwrap_or ( 0 ) ) ,
719+ max_invoice_msats : fedimint_client
720+ . get_meta ( "max_invoice_msats" )
721+ . map ( |v| v. parse ( ) . unwrap_or ( 0 ) ) ,
722+ meta_external_url : fedimint_client. get_meta ( "meta_external_url" ) ,
723+ onchain_deposits_disabled : fedimint_client
724+ . get_meta ( "onchain_deposits_disabled" )
725+ . map ( |v| v. parse ( ) . unwrap_or ( false ) ) ,
726+ preview_message : fedimint_client. get_meta ( "preview_message" ) ,
727+ sites : fedimint_client
728+ . get_meta ( "sites" )
729+ . map ( |v| serde_json:: from_str ( & v) . unwrap_or_default ( ) ) ,
730+ public : fedimint_client
731+ . get_meta ( "public" )
732+ . map ( |v| v. parse ( ) . unwrap_or ( false ) ) ,
733+ tos_url : fedimint_client. get_meta ( "tos_url" ) ,
734+ popup_end_timestamp : fedimint_client
735+ . get_meta ( "popup_end_timestamp" )
736+ . map ( |v| v. parse ( ) . unwrap_or ( 0 ) ) ,
737+ popup_countdown_message : fedimint_client. get_meta ( "popup_countdown_message" ) ,
738+ invite_codes_disabled : fedimint_client
739+ . get_meta ( "invite_codes_disabled" )
740+ . map ( |v| v. parse ( ) . unwrap_or ( false ) ) ,
741+ stability_pool_disabled : fedimint_client
742+ . get_meta ( "stability_pool_disabled" )
743+ . map ( |v| v. parse ( ) . unwrap_or ( false ) ) ,
744+ social_recovery_disabled : fedimint_client
745+ . get_meta ( "social_recovery_disabled" )
746+ . map ( |v| v. parse ( ) . unwrap_or ( false ) ) ,
747+ }
748+ }
749+
682750fn subscribe_operation_ext < S : MutinyStorage > (
683751 entry : OperationLogEntry ,
684752 hash : [ u8 ; 32 ] ,
0 commit comments