@@ -116,21 +116,23 @@ async fn get_sns_data(index: u64, sns_canister_ids: DeployedSns) -> anyhow::Resu
116116 . with_arg ( types:: EmptyRecord { } )
117117 . await
118118 . map_err ( ic_cdk:: call:: Error :: from)
119- . and_then ( |resp| resp. candid_tuple :: < ( types:: ListSnsCanistersResponse , ) > ( ) . map_err ( Into :: into) )
119+ . and_then ( |resp| {
120+ resp. candid_tuple :: < ( types:: ListSnsCanistersResponse , ) > ( )
121+ . map_err ( Into :: into)
122+ } )
120123 . map ( |( r, ) | r)
121124 . map_err ( |err| crate :: state:: log ( format ! ( "Call to Root.list_sns_canisters failed: {err:?}" ) ) )
122125 . unwrap_or ( existing_data. list_sns_canisters ) ;
123126
124127 crate :: state:: log ( format ! ( "Getting SNS index {index}... get_metadata" ) ) ;
125- let meta: types:: GetMetadataResponse =
126- ic_cdk:: call:: Call :: unbounded_wait ( governance_canister_id, "get_metadata" )
127- . with_arg ( types:: EmptyRecord { } )
128- . await
129- . map_err ( ic_cdk:: call:: Error :: from)
130- . and_then ( |resp| resp. candid_tuple :: < ( types:: GetMetadataResponse , ) > ( ) . map_err ( Into :: into) )
131- . map ( |( r, ) | r)
132- . map_err ( |err| crate :: state:: log ( format ! ( "Call to SnsGovernance.get_metadata failed: {err:?}" ) ) )
133- . unwrap_or ( existing_data. meta ) ;
128+ let meta: types:: GetMetadataResponse = ic_cdk:: call:: Call :: unbounded_wait ( governance_canister_id, "get_metadata" )
129+ . with_arg ( types:: EmptyRecord { } )
130+ . await
131+ . map_err ( ic_cdk:: call:: Error :: from)
132+ . and_then ( |resp| resp. candid_tuple :: < ( types:: GetMetadataResponse , ) > ( ) . map_err ( Into :: into) )
133+ . map ( |( r, ) | r)
134+ . map_err ( |err| crate :: state:: log ( format ! ( "Call to SnsGovernance.get_metadata failed: {err:?}" ) ) )
135+ . unwrap_or ( existing_data. meta ) ;
134136
135137 crate :: state:: log ( format ! ( "Getting SNS index {index}... list_nervous_system_functions" ) ) ;
136138 let parameters: types:: ListNervousSystemFunctionsResponse =
@@ -220,21 +222,20 @@ async fn get_sns_data(index: u64, sns_canister_ids: DeployedSns) -> anyhow::Resu
220222 }
221223 . or ( existing_data. swap_params ) ;
222224
223- let init_response: Option < GetInitResponse > =
224- match ic_cdk:: call:: Call :: unbounded_wait ( swap_canister_id, "get_init" )
225- . with_arg ( EmptyRecord { } )
226- . await
227- . map_err ( ic_cdk:: call:: Error :: from)
228- . and_then ( |resp| resp. candid_tuple :: < ( GetInitResponse , ) > ( ) . map_err ( Into :: into) )
229- . map ( |( r, ) | r)
230- {
231- Err ( err) => {
232- crate :: state:: log ( format ! ( "Call to Swap.get_init failed: {err:?}" ) ) ;
233- None
234- }
235- Ok ( response) => Some ( response) ,
225+ let init_response: Option < GetInitResponse > = match ic_cdk:: call:: Call :: unbounded_wait ( swap_canister_id, "get_init" )
226+ . with_arg ( EmptyRecord { } )
227+ . await
228+ . map_err ( ic_cdk:: call:: Error :: from)
229+ . and_then ( |resp| resp. candid_tuple :: < ( GetInitResponse , ) > ( ) . map_err ( Into :: into) )
230+ . map ( |( r, ) | r)
231+ {
232+ Err ( err) => {
233+ crate :: state:: log ( format ! ( "Call to Swap.get_init failed: {err:?}" ) ) ;
234+ None
236235 }
237- . or ( existing_data. init ) ;
236+ Ok ( response) => Some ( response) ,
237+ }
238+ . or ( existing_data. init ) ;
238239
239240 let derived_state_response: Option < GetDerivedStateResponse > = get_derived_state ( swap_canister_id)
240241 . await
@@ -329,9 +330,7 @@ pub async fn get_lifecycle(swap_canister_id: Principal) -> CallResult<GetLifecyc
329330}
330331
331332/// Gets the SNS nervous system parameters.
332- pub async fn get_nervous_system_parameters (
333- governance_canister_id : Principal ,
334- ) -> CallResult < NervousSystemParameters > {
333+ pub async fn get_nervous_system_parameters ( governance_canister_id : Principal ) -> CallResult < NervousSystemParameters > {
335334 ic_cdk:: call:: Call :: unbounded_wait ( governance_canister_id, "get_nervous_system_parameters" )
336335 . await
337336 . map_err ( ic_cdk:: call:: Error :: from)
0 commit comments