aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/ethapi/api.go16
-rw-r--r--internal/web3ext/web3ext.go5
2 files changed, 21 insertions, 0 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 7874b7101..6b9c151cf 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -246,6 +246,22 @@ func (s *PrivateAccountAPI) ListWallets() []rawWallet {
return wallets
}
+// OpenWallet initiates a hardware wallet opening procedure, establishing a USB
+// connection and attempting to authenticate via the provided passphrase. Note,
+// the method may return an extra challenge requiring a second open (e.g. the
+// Trezor PIN matrix challenge).
+func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error {
+ wallet, err := s.am.Wallet(url)
+ if err != nil {
+ return err
+ }
+ pass := ""
+ if passphrase != nil {
+ pass = *passphrase
+ }
+ return wallet.Open(pass)
+}
+
// DeriveAccount requests a HD wallet to derive a new account, optionally pinning
// it for later reuse.
func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) {
diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go
index 44fabd6ab..bf1db8819 100644
--- a/internal/web3ext/web3ext.go
+++ b/internal/web3ext/web3ext.go
@@ -493,6 +493,11 @@ web3._extend({
params: 2
}),
new web3._extend.Method({
+ name: 'openWallet',
+ call: 'personal_openWallet',
+ params: 2
+ }),
+ new web3._extend.Method({
name: 'deriveAccount',
call: 'personal_deriveAccount',
params: 3