Trying to connect with web3modal - is it possible? #34
-
I am not sure if it is possible but I would like to have web3Modal as my provider in my nuxt 3 project.
But I am unsure how to proceed since actually web3Modal requires an Ethereum client like so:
I should then call
How would you recommend me to continue? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 10 replies
-
@dataexcess I don't know if this will help you https://docs.walletconnect.com/2.0/web/web3modal/html/wagmi/installation |
Beta Was this translation helpful? Give feedback.
-
Well, yes that is where I have the code from...
With web3Modal You have to use the openModal method like so:
When using this method the useAccount and useDisconnect do not work.
|
Beta Was this translation helpful? Give feedback.
-
I know... the problem is use-wagmi requires the code to be run in a plugin... using useWagmiPlugin, while the web3modal creates the ethereum client like this:
I cannot have both.. if I use this code, then the use-wagmi hooks do not work anymore since the connect() method is not called anymore. the connect method looks now like this (using the web3modal):
while actually, using the use-wagmi API it should look like:
so my question is, is there a way to mix both? currently it either works one way or the other. |
Beta Was this translation helpful? Give feedback.
-
@dataexcess bro look here it's done https://stackblitz.com/edit/nuxt-starter-xpyboe?file=plugins%2Fuse-wagmi.ts |
Beta Was this translation helpful? Give feedback.
-
@unicape I'm sorry but did you test your code? Yes the plugin works, but did you try using it? the plugin:
the frontend code:
The problem remains the same... the connect button will not work with this.. now it complains about:
I think I don't need to use the code
But instead use the web3Modal method: But then the question is how do I access the web3modal in the fronend code from the plugin? Or how do I create the web3modal object in the frontend code without having the rest of the plugin to build it...? |
Beta Was this translation helpful? Give feedback.
-
Bro I fixed it like this 😎 (providing the web3Modal object from the plugin with 'provide'). Plugin:
Then use it in the frontend:
|
Beta Was this translation helpful? Give feedback.
-
Hey 👋 v3 Alpha is out and it's more versatile, could you take a look @unicape ? Might be easier to integrate. |
Beta Was this translation helpful? Give feedback.
-
Hello, I want to integrate this again for a new project. I'm wondering should I do it the way I did before or has anything changed/updated? Thnx! |
Beta Was this translation helpful? Give feedback.
Bro I fixed it like this 😎 (providing the web3Modal object from the plugin with 'provide').
Plugin: