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

@rocketh/viem

v0.19.15

Published

Use viem clients and contract helpers inside rocketh deploy scripts.

Readme

@rocketh/viem

viem clients and contract objects built from your rocketh deployments. Call viem(env) and you get a publicClient, a walletClient, and getContract(name) / getWritableContract(name) that resolve a deployment by name into a fully typed viem contract.

Use this when you want viem's own API (its multicall, its event log handling, its simulation) rather than rocketh's read/execute. Both operate on the same deployments and the same EIP-1193 provider.

Installation

# Using pnpm
pnpm add @rocketh/viem

# Using npm
npm install @rocketh/viem

# Using yarn
yarn add @rocketh/viem

viem is a peer dependency, so you supply the version.

Wiring it up

@rocketh/viem is an extension: spread its namespace into extensions in rocketh/config.ts.

// rocketh/config.ts
import * as deployExtension from '@rocketh/deploy';
import * as viemExtension from '@rocketh/viem';

const extensions = {
	...deployExtension,
	...viemExtension,
};
export {extensions};

Usage

import {deployScript, artifacts} from '../rocketh/deploy.js';

export default deployScript(
	async ({deploy, viem, namedAccounts}) => {
		const {deployer} = namedAccounts;

		await deploy('Token', {account: deployer, artifact: artifacts.Token, args: ['Token', 'TKN']});

		const {publicClient, getContract, getWritableContract} = viem();

		// read-only contract, typed from the deployment's ABI
		const token = getContract('Token');
		const supply = await token.read.totalSupply();

		// writable contract, sending from a chosen account
		const writable = getWritableContract('Token', {account: deployer});
		await writable.write.mint([deployer, 1000n]);

		// or use the clients directly
		const block = await publicClient.getBlockNumber();
	},
	{tags: ['Token']},
);

API

viem(env) returns a ViemHandle:

| Member | Description | | --------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | publicClient | A viem PublicClient on the environment's chain and provider. | | walletClient | A viem WalletClient on the same transport. | | getContract(nameOrDeployment) | A read-only viem contract. Accepts a deployment name or a deployment object. | | getWritableContract(nameOrDeployment, {account?}) | A writable viem contract. account sets the sender; omit it to use the default wallet client. |

Both clients use viem's custom transport over env.network.provider, so they talk to exactly the same provider as the rest of the deployment, including any in-memory or forked chain.

Types ViemContract<TAbi> and ViemWritableContract<TAbi> are exported for annotating variables.

Transactions here bypass rocketh's broadcast path

This is the trade-off to understand. Writing through a viem contract sends the transaction through viem's wallet client, not through rocketh's broadcast choke point. That means such a transaction does not get:

  • the unknown-signer handling (an unsignable from will fail as a provider error, not as an UnknownSignerError you can catch with catchUnknownSigner)
  • rocketh's gas reporting and transaction messages

For contract calls that are part of a deployment, prefer @rocketh/read-execute. Reach for getWritableContract when you specifically need viem's write API and the account is one you can definitely sign for.

Reads have no such caveat: getContract(...).read and publicClient are free of it.

Related packages

For full documentation, visit rocketh.dev.

For hardhat-deploy documentation, see rocketh.dev/hardhat-deploy/.