|
|
@ -18,6 +18,7 @@ package eth |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
|
|
|
|
"encoding/hex" |
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
@ -439,6 +440,16 @@ func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) |
|
|
|
return common.Address{}, err |
|
|
|
return common.Address{}, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) { |
|
|
|
|
|
|
|
hexkey, err := hex.DecodeString(privkey) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return common.Address{}, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
acc, err := s.am.ImportECDSA(crypto.ToECDSA(hexkey), password) |
|
|
|
|
|
|
|
return acc.Address, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UnlockAccount will unlock the account associated with the given address with
|
|
|
|
// UnlockAccount will unlock the account associated with the given address with
|
|
|
|
// the given password for duration seconds. If duration is nil it will use a
|
|
|
|
// the given password for duration seconds. If duration is nil it will use a
|
|
|
|
// default of 300 seconds. It returns an indication if the account was unlocked.
|
|
|
|
// default of 300 seconds. It returns an indication if the account was unlocked.
|
|
|
|