You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{typeConfig,getClient}from'@wagmi/core'import{FallbackProvider,JsonRpcProvider}from'ethers'importtype{Client,Chain,Transport}from'viem'exportfunctionclientToProvider(client: Client<Transport,Chain>){const{ chain, transport }=clientconstnetwork={chainId: chain.id,name: chain.name,ensAddress: chain.contracts?.ensRegistry?.address,}if(transport.type==='fallback'){constproviders=(transport.transportsasReturnType<Transport>[]).map(({ value })=>newJsonRpcProvider(value?.url,network),)if(providers.length===1)returnproviders[0]returnnewFallbackProvider(providers)}returnnewJsonRpcProvider(transport.url,network)}/** Action to convert a viem Client to an ethers.js Provider. */exportfunctiongetEthersProvider(config: Config,{ chainId }: {chainId?: number}={},){constclient=getClient(config,{ chainId })returnclientToProvider(client)}
Provides a typescript error,
It definitely fixed the warning per gitroll, but thats an error.
Link to Minimal Reproducible Example
No response
Steps To Reproduce
No response
Wagmi Version
latest
Viem Version
latest
TypeScript Version
^5.4.5
Check existing issues
I checked there isn't already an issue for the bug I encountered.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
exportfunctionuseEthersProvider({ chainId }: {chainId?: number}={}){constclient=useClient<Config>({ chainId });// Define the provider outside of the conditional statementconstprovider=useMemo(()=>{if(client){returnclientToProvider(client);}},[client]);returnprovider
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Wagmi version. If you have any questions or comments you can create a new discussion thread.
Describe the bug
Code from https://wagmi.sh/core/guides/ethers
Provides a typescript error,
It definitely fixed the warning per gitroll, but thats an error.
Link to Minimal Reproducible Example
No response
Steps To Reproduce
No response
Wagmi Version
latest
Viem Version
latest
TypeScript Version
^5.4.5
Check existing issues
Anything else?
No response
The text was updated successfully, but these errors were encountered: