LedgerSigner.connect always throws an error
See original GitHub issueDescribe the bug
calling connect
on a LedgerSigner
instance throws an error
Likely related to the underlying HID transport holding the device, and the new signer making a second acquisition attempt that fails
Reproduction steps
import { LedgerSigner } from '@ethersproject/hardware-wallets'
import * as ethers from 'ethers'
const provider = ethers.providers.getDefaultProvider()
const signer = new LedgerSigner()
signer.connect(provider)
/// Error: cannot open device with path
Environment
ts-node
w/ node@16.6.2 on an M1 macbook
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Create LedgerSigner instances form a Ledger wallet
I want to create Ledger signer instances from ledger wallet. However, I always got an error that says "cannot open device".
Read more >Error: invalid object key - from - using Ledger Signer #936
Hi, I have noticed there is a similar issue to #862 when using the LedgerSigner. "@ethersproject/hardware-wallets": "^5.0.1", ...
Read more >Documentation - Ethers.js
signer.connect( provider ) ⇒ Signer. Sub-classes must implement this, however they may simply throw an error if changing providers is not supported.
Read more >@ethersproject/wallet | Yarn - Package Manager
A complete Ethereum wallet implementation and utilities in JavaScript (and TypeScript). Features: Keep your private keys in your client, safe and sound; Import ......
Read more >Sorry, connection failed - error message in Ledger Live
This might be a simple troubleshooting step but can sometimes be the solution to connecting here. For Windows users only - always run...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@prestwich thanks! I had issues with the 5.5.0 version as well, and your version seems to work for me. I was thinking of doing something similar after spending a while digging into the
@ledgerhq
code, so I appreciate it!Can a contributor get this change added?
I fixed the issue in Node. This makes ledger
Eth
objects into singletons, so they are reused byLedgerSigner
. This allows instantiation of multipleLedgerSigners
, as well as using theSigner.connect()
function without error.I have not yet tested these changes in browser, as that would require updating u2f. Tried to design
eth.ts
it such that a build system could simply swap outledger-transport.ts
forbrowser-ledger-transport.ts
at build time without issues, and such that we could add more transports easilyUploading as a zip file, as I can’t find contributor documentation on build/formatting/lint systems. This is intended for
packages/hardware-wallets/src.ts
src.ts.zip