trufflesuite / drizzle-legacy

Reactive Ethereum datastore for dapp UIs.
http://truffleframework.com/docs/drizzle/getting-started
MIT License
502 stars 129 forks source link

Handling Metamask's lack of websocket support/Web3 1.0 #10

Closed sprice closed 6 years ago

sprice commented 6 years ago

First of all. This looks super amazing! Thank you!

Using this with Metamask results in Error: The current provider doesn't support subscriptions: MetamaskInpageProvider metamask-extension/2601 & metamask-extension/2350

Does this mean that the subscription parts of Drizzle can't be used with Metamask at the moment?

edit: Note I'm using the drizzle truffle box with Ganache

andytudhope commented 6 years ago

Same error as above for me 👍

Coolpix commented 6 years ago

Same for me!

apanizo commented 6 years ago

The same result using the same environment, but if I disable metamask... I get..

EDIT: That problem was caused because I did not have the latest (beta) version of ganache-cli (see my next comment).

screenshot 2018-02-28 17 09 57

Let me know if I should open a new issue or need something else.

And... congrats! The project looks amazing!

apanizo commented 6 years ago

Sorry! My bad, after reading this and this, I realised I just needed to update my ganache-cli version.

Thanks!

sprice commented 6 years ago

Ah. I'm using the Ganache App (1.0.2). I guess I need to switch over to the CLI and wait for the app to be updated. Thanks.

I'm going to test this out tonight to be sure and then likely close the issue.

apanizo commented 6 years ago

Oh sorry, I just tried to say the ws problem, which only happens if you disable Metamask, was solved after updating the ganache-cli to the beta version, but the error you reported, using Metamask, is still there. We have to wait until Metamask is updated.

In other words, this issue makes sense 👍

jaderiverstokes commented 6 years ago

I'm working on an app using ws with drizzle to load data and metamask to process the transactions. So it is possible, although it's quite messy.

elie222 commented 6 years ago

So seems like Drizzle is mostly unusable right now as MetaMask is the main way to interact with Dapps?

elie222 commented 6 years ago

Would it be possible to use Infura for websockets and MetaMask for everything else?

I see Infura recently added WS support: https://github.com/INFURA/infura/issues/29

davekaj commented 6 years ago

@elie222 yes, i have done that as a solution. you need to keep track of two different web3 instance. it is a hacky solution that works for now

elie222 commented 6 years ago

Would be nice if you could post what you did as an example.

The web3 instance you pass to Drizzle is the infura one I take it? And then separately you do txs with metamask? Doesn't Drizzle also expect txs to be done through it too though?

On 6 Mar 2018 23:30, "David Kajpust" notifications@github.com wrote:

@elie222 https://github.com/elie222 yes, i have done that as a solution. you need to keep track of two different web3 instance. it is a hacky solution that works for now

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trufflesuite/drizzle/issues/10#issuecomment-370935312, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8oX1wTO4MKpVG0OC2UctWE5PzwAX3Vks5tbwABgaJpZM4SOmH9 .

keithpops commented 6 years ago

@cooper-sloan && @davekaj I'm very interested in seeing what methods you've come up with in managing multiple web3 instances to use drizzle with MetaMask. I've also been investigating this and would love to see what other solutions people have come up.

arjunyel commented 6 years ago

If anyone could write up a quick tutorial on the workaround for using Drizzle with metamask that would be a HUGE help to the community :)

davekaj commented 6 years ago

damn, sorry was not paying enough attention, i have not done this with drizzle. i only did it with a normal react project

balasan commented 6 years ago

I got it working with Metamask — using infura rpc for websocket updates and metamask for accounts and transactions: https://github.com/relevant-community/drizzle/blob/master/src/Drizzle.js

It's building on PR #15 but also storing the Metamask instance of web3 and using it for drizzle contract calls.

Beware my fork has some braking changes in the accounts reducer - list of accounts is now stored in ids field to accommodate and additional balances field.

OnlyOneJMJQ commented 6 years ago

Right off the bat I've got to apologize for not hopping in this conversation earlier!

Today, Drizzle supports MetaMask via a fallback to their very own eth-block-tracker package (see release v1.1.4). Release notes for v1.1 are also relevant as it was the first time MetaMask support rolled out.

Hope you'll all give it another shot if you haven't already. 🙂