Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Support hardware wallets #137

Closed
adrianmcli opened this issue Oct 25, 2018 · 7 comments
Closed

Support hardware wallets #137

adrianmcli opened this issue Oct 25, 2018 · 7 comments

Comments

@adrianmcli
Copy link
Contributor

n/t

Ledger seems to already provide a Web3 provider, so it shouldn't be too hard?

Wallets we would like to support: Ledger, Trezor, Keepkey

@soundyogi
Copy link
Contributor

metamask supports ledger and trezor now

@adrianmcli
Copy link
Contributor Author

@soundyogi Yea, we're aware of this too. Just need to test it and make any necessary tweaks. Are you saying that it already works now (with the current Drizzle)?

@soundyogi
Copy link
Contributor

soundyogi commented Oct 29, 2018

I am upgrading our dapp to drizzle and the new metamask provider.enable() system.
So I cant report until I got it to work.

But I succesfully used my ledger via metamask using the old standard web3/metamask provider combo.
So I dont see why it should not work (via metamask at least) since metamask abstracts the ledger away using its provider.

Of course pure ledger support without metamask is something different, but should be as you said very possible.

Sorry for this half-assed input :_D

I havent tried to use the ledger with using drizzle only. But will try to test it this week.

@soundyogi
Copy link
Contributor

This looks quite helpful but also outdated:
https://gist.github.com/gre/93fc39242c31a23c0570e71cc33bed5a

there are a few third party libs on npm. I will look into it further this week.

@joshma91
Copy link
Contributor

I've been trying to make Drizzle work purely with Ledger for the past few days but there's issues with Ganache that won't allow clean Ledger integration with Drizzle.

I adapted the gist that @soundyogi linked to into web3Saga.js within the initializeWeb3 function and I'm able to hand Drizzle the web3 that the Ledger provides. I'm able to access the full drizzle and drizzleState instances and can sign transactions issued through this.props.drizzle.web3.eth.sendRawTransaction in child components as well:

    try {
      const result = yield eth.getAddress("m/44'/60'/0'/0/0")
      console.log("I'm inside Drizzle!")
      if (result !== null) {
        const engine = new ProviderEngine()
        const getTransport = () => Transport.create()
        const ledger = createLedgerSubprovider(getTransport, {
          networkId,
          accountsLength: 5
        })
        console.log(ledger)
        engine.addProvider(ledger)
        engine.addProvider(new FetchSubprovider({ rpcUrl }))
        engine.start()
        return new Web3(engine)
      }
    } catch (error) {
      console.log(error)
    }

The issue comes when a new block arrives in Ganache. Ganache will crash with the following error:

TypeError: Cannot read property 'connection' of undefined
    at c._updateSubscriptions (/home/josh/.npm-packages/lib/node_modules/ganache-cli/build/cli.node.js:65:5443)
    at l.<anonymous> (/home/josh/.npm-packages/lib/node_modules/ganache-cli/build/cli.node.js:65:3860)
    at emitTwo (events.js:126:13)
    at l.emit (events.js:214:7)
    at o.<anonymous> (/home/josh/.npm-packages/lib/node_modules/ganache-cli/build/cli.node.js:37:29806)
    at emitTwo (events.js:126:13)
    at o.emit (events.js:214:7)
    at o._notificationHandler (/home/josh/.npm-packages/lib/node_modules/ganache-cli/build/cli.node.js:149:96040)

So I'm only able to have the things above working when I initialize Ganache with a really long block time (e.g. ganache-cli -b 200) since the arrival of a new block breaks everything. I'm going to raise an issue with Ganache as well, and I wonder if it's at all linked to this issue. What's curious is that Ledger and Drizzle have individually worked with Ganache for me. It's only once I bring all 3 in together that things break.

@stale
Copy link

stale bot commented Mar 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 26, 2019
@stale
Copy link

stale bot commented Apr 2, 2019

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if there is no reply to further comments.

@stale stale bot closed this as completed Apr 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants