@@ -45,6 +45,12 @@ fn get_managed_account_by_type<'a>(
4545 collection. identity_topup_not_bound . as_ref ( )
4646 }
4747 AccountType :: IdentityInvitation => collection. identity_invitation . as_ref ( ) ,
48+ AccountType :: IdentityAuthenticationEcdsa {
49+ identity_index,
50+ } => collection. identity_authentication_ecdsa . get ( identity_index) ,
51+ AccountType :: IdentityAuthenticationBls {
52+ identity_index,
53+ } => collection. identity_authentication_bls . get ( identity_index) ,
4854 AccountType :: AssetLockAddressTopUp => collection. asset_lock_address_topup . as_ref ( ) ,
4955 AccountType :: AssetLockShieldedAddressTopUp => {
5056 collection. asset_lock_shielded_address_topup . as_ref ( )
@@ -98,6 +104,12 @@ fn get_managed_account_by_type_mut<'a>(
98104 collection. identity_topup_not_bound . as_mut ( )
99105 }
100106 AccountType :: IdentityInvitation => collection. identity_invitation . as_mut ( ) ,
107+ AccountType :: IdentityAuthenticationEcdsa {
108+ identity_index,
109+ } => collection. identity_authentication_ecdsa . get_mut ( identity_index) ,
110+ AccountType :: IdentityAuthenticationBls {
111+ identity_index,
112+ } => collection. identity_authentication_bls . get_mut ( identity_index) ,
101113 AccountType :: AssetLockAddressTopUp => collection. asset_lock_address_topup . as_mut ( ) ,
102114 AccountType :: AssetLockShieldedAddressTopUp => {
103115 collection. asset_lock_shielded_address_topup . as_mut ( )
@@ -298,7 +310,20 @@ pub unsafe extern "C" fn managed_wallet_get_address_pool_info(
298310 let wrapper = & * managed_wallet;
299311 let managed_wallet = wrapper. inner ( ) ;
300312
301- let account_type_rust = account_type. to_account_type ( account_index) ;
313+ let account_type_rust = match account_type. to_account_type ( account_index) {
314+ Ok ( t) => t,
315+ Err ( mut e) => {
316+ let msg = if e. message . is_null ( ) {
317+ "Invalid account type" . to_string ( )
318+ } else {
319+ let m = std:: ffi:: CStr :: from_ptr ( e. message ) . to_string_lossy ( ) . to_string ( ) ;
320+ e. free_message ( ) ;
321+ m
322+ } ;
323+ FFIError :: set_error ( error, e. code , msg) ;
324+ return false ;
325+ }
326+ } ;
302327
303328 // Get the specific managed account
304329 let managed_account =
@@ -404,7 +429,20 @@ pub unsafe extern "C" fn managed_wallet_set_gap_limit(
404429
405430 let managed_wallet = ( & mut * managed_wallet) . inner_mut ( ) ;
406431
407- let account_type_rust = account_type. to_account_type ( account_index) ;
432+ let account_type_rust = match account_type. to_account_type ( account_index) {
433+ Ok ( t) => t,
434+ Err ( mut e) => {
435+ let msg = if e. message . is_null ( ) {
436+ "Invalid account type" . to_string ( )
437+ } else {
438+ let m = std:: ffi:: CStr :: from_ptr ( e. message ) . to_string_lossy ( ) . to_string ( ) ;
439+ e. free_message ( ) ;
440+ m
441+ } ;
442+ FFIError :: set_error ( error, e. code , msg) ;
443+ return false ;
444+ }
445+ } ;
408446
409447 // Get the specific managed account
410448 let managed_account =
@@ -501,7 +539,20 @@ pub unsafe extern "C" fn managed_wallet_generate_addresses_to_index(
501539 let managed_wallet = ( & mut * managed_wallet) . inner_mut ( ) ;
502540 let wallet = & * wallet;
503541
504- let account_type_rust = account_type. to_account_type ( account_index) ;
542+ let account_type_rust = match account_type. to_account_type ( account_index) {
543+ Ok ( t) => t,
544+ Err ( mut e) => {
545+ let msg = if e. message . is_null ( ) {
546+ "Invalid account type" . to_string ( )
547+ } else {
548+ let m = std:: ffi:: CStr :: from_ptr ( e. message ) . to_string_lossy ( ) . to_string ( ) ;
549+ e. free_message ( ) ;
550+ m
551+ } ;
552+ FFIError :: set_error ( error, e. code , msg) ;
553+ return false ;
554+ }
555+ } ;
505556
506557 let account_type_to_check = match account_type_rust. try_into ( ) {
507558 Ok ( check_type) => check_type,
@@ -746,6 +797,22 @@ pub unsafe extern "C" fn managed_wallet_mark_address_used(
746797 }
747798 }
748799 }
800+ if !found {
801+ for account in collection. identity_authentication_ecdsa . values_mut ( ) {
802+ if account. mark_address_used ( & address) {
803+ found = true ;
804+ break ;
805+ }
806+ }
807+ }
808+ if !found {
809+ for account in collection. identity_authentication_bls . values_mut ( ) {
810+ if account. mark_address_used ( & address) {
811+ found = true ;
812+ break ;
813+ }
814+ }
815+ }
749816 if !found {
750817 if let Some ( account) = & mut collection. asset_lock_address_topup {
751818 if account. mark_address_used ( & address) . 0 {
0 commit comments