How to combine different public clients with useWagmiPlugin? #56
Replies: 4 comments
-
@dataexcess If you can suggest you implement your own |
Beta Was this translation helpful? Give feedback.
-
Yes I can use a composable like this:
But it would be nice if use-wagmi or wagmi can select what publicClient to use for the usereadContracts.. but I think this is done 'behind-the-scenes' with the useWagmiPlugin... is there any way to specify the client used by a wagmi-hook? |
Beta Was this translation helpful? Give feedback.
-
@dataexcess useConfig is implemented using |
Beta Was this translation helpful? Give feedback.
-
Ok I fixed it by making a separate viem publicClient to fetch the data without user wallet connection. |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Package Version
0.3.7
Current Behavior
Hello!
I am using web3Modal as my connector inside the use-wagmi.ts plugin:
The problem is that, using the web3modal connection, I cannot query any data from the blockchain before the user connects the wallet. The public client relies on the connection made by the wallet. But I want to be able to execute readContract before the user connects (to display all tokens of my nft collection...). How can I accomplish this? Do I need to make a separate publicClient (that simply uses Public or infura provider)? But how can I switch it sothat it uses the UseWagmiPlugin? What would you recommend?
Thank you for the help!
Expected Behavior
No response
Steps To Reproduce
No response
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
No response
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions