@@ -73,8 +73,9 @@ type rawWallet struct {
7373// Example call
7474// {"jsonrpc":"2.0","method":"clef_listWallets","params":[], "id":5}
7575func (api * UIServerAPI ) ListWallets () []rawWallet {
76- wallets := make ([]rawWallet , 0 ) // return [] instead of nil if empty
77- for _ , wallet := range api .am .Wallets () {
76+ allWallets := api .am .Wallets ()
77+ wallets := make ([]rawWallet , 0 , len (allWallets )) // return [] instead of nil if empty
78+ for _ , wallet := range allWallets {
7879 status , failure := wallet .Status ()
7980
8081 raw := rawWallet {
@@ -130,8 +131,12 @@ func (api *UIServerAPI) ImportRawKey(privkey string, password string) (accounts.
130131 if err := ValidatePasswordFormat (password ); err != nil {
131132 return accounts.Account {}, fmt .Errorf ("password requirements not met: %v" , err )
132133 }
134+ ks := fetchKeystore (api .am )
135+ if ks == nil {
136+ return accounts.Account {}, errors .New ("password based accounts not supported" )
137+ }
133138 // No error
134- return fetchKeystore ( api . am ) .ImportECDSA (key , password )
139+ return ks .ImportECDSA (key , password )
135140}
136141
137142// OpenWallet initiates a hardware wallet opening procedure, establishing a USB
0 commit comments