aboutsummaryrefslogtreecommitdiffstats
path: root/console/console.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-01 23:45:17 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-09 16:30:17 +0800
commitdb568a61e2a98880ab308bf2224aa34073dc7f39 (patch)
tree97da46661ad3002b6ff9f6dca07e3105da5a9c5a /console/console.go
parent17ce0a37de5a2712a8bf9d58df705e718b3b2cd6 (diff)
downloadgo-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.gz
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.bz2
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.lz
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.xz
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.zst
go-tangerine-db568a61e2a98880ab308bf2224aa34073dc7f39.zip
accounts, console, internal: support trezor hardware wallet
Diffstat (limited to 'console/console.go')
-rw-r--r--console/console.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/console/console.go b/console/console.go
index 389d52858..3cd2ad34b 100644
--- a/console/console.go
+++ b/console/console.go
@@ -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)