npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

providers-wtf

v1.0.5

Published

Library for converting between ethers and viem.

Readme

providers-wtf

npm version

This repo contains the code for the providers-wtf npm package. This package is a utility package that allows you to convert easily between viem PublicClient and WalletClient to ethers providers (JsonRpcProvider, Web3Provider and WebsocketProvider).

❓ Why is this even a package

The reason why I created this package is because there are a lot of web3 SDKs (such as Uniswap, Li.Fi, etc.) that currently do not support viem as a signer/provider, and instead they still work using ethers.

Since a lot of the frontend libraries have switched to viem, this package allows you to easily convert between the two without having to duplicate your code, or to lose your mind to do so.

📦 Installation

You can install this package with your favorite package manager:

Using npm:

npm install providers-wtf

Using yarn:

yarn add providers-wtf

Using pnpm:

pnpm add providers-wtf

🔨 Compatibility

Currently this package works with the following versions of the viem and ethers libraries:

  • viem ^1.4.1
  • ethers ^5.7.0

Please note that this package does not support ethers v6 until it will become stable.

📖 Usage

The package exports some useful functions to perform the conversion between the providers, allowing you to have a seamless experience between the two.

These are the currently available methods, with more coming soon:

  • [x] toEthersJsonRpcProvider - converts a PublicClient to a JsonRpcProvider
  • [x] toEthersWeb3Provider - converts a PublicClient to a Web3Provider
  • [x] toEthersWsProvider - converts a PublicClient to a WebsocketProvider
  • [x] toEthersWeb3ProviderWithSigner - converts a WalletClient to a Web3Provider
  • [ ] toViemPublicClient - converts a JsonRpcProvider to a PublicClient
  • [ ] toViemWsPublicClient - converts a WebsocketProvider to a PublicClient

PublicClient to JsonRpcProvider

import { createPublicClient, http } from 'viem'
import { gnosis } from 'viem/chains'
import { toEthersJsonRpcProvider } from 'providers-wtf'

const publicClient = createPublicClient({
    chain: gnosis,
    transport: http(<YOUR_PROVIDER_URL>)
})

const ethersProvider = toEthersJsonRpcProvider(publicClient)

PublicClient to Web3Provider

import { createPublicClient, http } from 'viem'
import { gnosis } from 'viem/chains'
import { toEthersWeb3Provider } from 'providers-wtf'

const publicClient = createPublicClient({
    chain: gnosis,
    transport: http(<YOUR_PROVIDER_URL>)
})

const ethersProvider = toEthersWeb3Provider(publicClient)

PublicClient to WebsocketProvider

import { createPublicClient, websocket } from 'viem'
import { gnosis } from 'viem/chains'
import { toEthersWsProvider } from 'providers-wtf'

const publicClient = createPublicClient({
    chain: gnosis,
    transport: websocket(<YOUR_PROVIDER_URL>)
})

const ethersProvider = toEthersWsProvider(publicClient)

WalletClient to Web3Provider

import { createWalletClient, custom } from "viem";
import { gnosis } from "viem/chains";
import { toEthersWeb3ProviderWithSigner } from "providers-wtf";

const client = createWalletClient({
  chain: gnosis,
  transport: custom(window.ethereum),
});

const provider = toEthersWeb3ProviderWithSigner(client);

JsonRpcProvider to PublicClient

import { providers } from "ethers";
import { toViemPublicClient } from "providers-wtf";

const provider = new providers.JsonRpcProvider(<YOUR_PROVIDER_URL>)
const publicClient = await toViemPublicClient(provider)

WebsocketProvider to PublicClient

import { providers } from "ethers";
import { toViemWsPublicClient } from "providers-wtf";

const provider = new providers.WebsocketProvider(<YOUR_PROVIDER_URL>)
const publicClient = await toViemWsPublicClient(provider)

🤝 Contributing

Please have a look in the CONTRIBUTING.md file for more information.

📝 Code of Conduct

Please have a look in the CODE_OF_CONDUCT.md file for more information.