@@ -65,10 +65,10 @@ export const SelectAccounts = ({
65
65
selected [ currentState ] && ! isAccountDisabled ( currentState ) ,
66
66
)
67
67
. map ( Number ) ;
68
- // enable more accounts for existing hw
69
- if ( walletId && existingAccountsIndexes . size > 0 ) {
70
- for ( const accountIndex of accountIndexes ) {
71
- try {
68
+ try {
69
+ // enable more accounts for existing hw
70
+ if ( walletId && existingAccountsIndexes . size > 0 ) {
71
+ for ( const accountIndex of accountIndexes ) {
72
72
await walletRepository . addAccount ( {
73
73
accountIndex,
74
74
extendedAccountPublicKey :
@@ -85,31 +85,27 @@ export const SelectAccounts = ({
85
85
} ,
86
86
walletId,
87
87
} ) ;
88
- } catch ( error : unknown ) {
89
- throw error ;
90
88
}
91
- }
92
- await activateAccount ( { accountIndex : accountIndexes [ 0 ] , walletId } ) ;
93
- } else {
94
- // create new hw
95
- let cardanoWallet : Wallet . CardanoWallet ;
96
- try {
97
- cardanoWallet = await createHardwareWalletRevamped ( {
89
+ await activateAccount ( { accountIndex : accountIndexes [ 0 ] , walletId } ) ;
90
+ } else {
91
+ // create new hw
92
+ const cardanoWallet = await createHardwareWalletRevamped ( {
98
93
connection,
99
94
name : 'Wallet 1' ,
100
95
accountIndexes,
101
96
} ) ;
102
97
await saveHardwareWallet ( cardanoWallet , environmentName ) ;
103
- } catch ( error_ ) {
104
- console . error ( error_ ) ;
105
- setError ( 'An error occured' ) ;
106
98
}
99
+ onConfirm ( ) ;
100
+ void capture ( Events . HWSelectAccountNextClick , {
101
+ numAccounts : accountIndexes . length . toString ( ) ,
102
+ } ) ;
103
+ } catch ( error_ ) {
104
+ console . error ( error_ ) ;
105
+ setError ( 'An error occured' ) ;
106
+ } finally {
107
+ setIsLoading ( false ) ;
107
108
}
108
- onConfirm ( ) ;
109
- void capture ( Events . HWSelectAccountNextClick , {
110
- numAccounts : accountIndexes . length . toString ( ) ,
111
- } ) ;
112
- setIsLoading ( false ) ;
113
109
} ;
114
110
115
111
const isAccountDisabled = useCallback (
0 commit comments