accounts, console, internal: support trezor hardware wallet
This commit is contained in:
@ -160,10 +160,15 @@ func (c *Console) init(preload []string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Override the unlockAccount, newAccount and sign methods since these require user interaction.
|
||||
// Assign these method in the Console the original web3 callbacks. These will be called by the jeth.*
|
||||
// methods after they got the password from the user and send the original web3 request to the backend.
|
||||
// Override the openWallet, unlockAccount, newAccount and sign methods since
|
||||
// these require user interaction. Assign these method in the Console the
|
||||
// original web3 callbacks. These will be called by the jeth.* methods after
|
||||
// they got the password from the user and send the original web3 request to
|
||||
// the backend.
|
||||
if obj := personal.Object(); obj != nil { // make sure the personal api is enabled over the interface
|
||||
if _, err = c.jsre.Run(`jeth.openWallet = personal.openWallet;`); err != nil {
|
||||
return fmt.Errorf("personal.openWallet: %v", err)
|
||||
}
|
||||
if _, err = c.jsre.Run(`jeth.unlockAccount = personal.unlockAccount;`); err != nil {
|
||||
return fmt.Errorf("personal.unlockAccount: %v", err)
|
||||
}
|
||||
@ -173,6 +178,7 @@ func (c *Console) init(preload []string) error {
|
||||
if _, err = c.jsre.Run(`jeth.sign = personal.sign;`); err != nil {
|
||||
return fmt.Errorf("personal.sign: %v", err)
|
||||
}
|
||||
obj.Set("openWallet", bridge.OpenWallet)
|
||||
obj.Set("unlockAccount", bridge.UnlockAccount)
|
||||
obj.Set("newAccount", bridge.NewAccount)
|
||||
obj.Set("sign", bridge.Sign)
|
||||
|
Reference in New Issue
Block a user