File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed
src/modules/select/wallets Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,6 @@ import * as EthereumTx from 'ethereumjs-tx'
14
14
15
15
import buffer from 'buffer'
16
16
17
- let transport : any
18
- let eth : any
19
-
20
17
function ledger ( options : LedgerOptions & CommonWalletOptions ) : WalletModule {
21
18
const {
22
19
rpcUrl,
@@ -48,7 +45,7 @@ function ledger(options: LedgerOptions & CommonWalletOptions): WalletModule {
48
45
interface : {
49
46
name : 'Ledger' ,
50
47
connect : provider . enable ,
51
- disconnect : ( ) => provider . stop ( ) ,
48
+ disconnect : provider . disconnect ,
52
49
address : {
53
50
get : async ( ) => provider . getPrimaryAddress ( )
54
51
} ,
@@ -105,19 +102,21 @@ async function ledgerProvider(options: {
105
102
provider . send = provider . sendAsync
106
103
provider . disconnect = disconnect
107
104
108
- if ( ! eth ) {
109
- try {
110
- transport = LedgerTransport
111
- ? await LedgerTransport . create ( )
112
- : await TransportU2F . create ( )
105
+ let transport : any
106
+ let eth : any
113
107
114
- eth = new Eth ( transport )
115
- } catch ( error ) {
116
- throw new Error ( 'Error connecting to Ledger wallet' )
117
- }
108
+ try {
109
+ transport = LedgerTransport
110
+ ? await LedgerTransport . create ( )
111
+ : await TransportU2F . create ( )
112
+
113
+ eth = new Eth ( transport )
114
+ } catch ( error ) {
115
+ throw new Error ( 'Error connecting to Ledger wallet' )
118
116
}
119
117
120
118
function disconnect ( ) {
119
+ transport . close ( )
121
120
addressToPath = new Map ( )
122
121
enabled = false
123
122
provider . stop ( )
You can’t perform that action at this time.
0 commit comments