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

eip-1193-accounts-wrapper

v0.1.1

Published

extends eip-1193 provider with accounts

Downloads

92

Readme

eip-1193-accounts-wrapper

Extends EIP-1193 providers with local account handling for signing transactions and messages.

npm version

About

When working with EIP-1193 providers (like those from browser wallets), you sometimes need to add local account capabilities for development, testing, or backend signing. This library wraps any EIP-1193 provider and adds account-related methods using local private keys or mnemonics, powered by viem.

Features

  • Private key accounts – Load accounts from hex-encoded private keys
  • Mnemonic accounts – Derive multiple accounts from a BIP-39 mnemonic phrase
  • Transaction signing – Signs and sends transactions via eth_sendTransaction
  • Message signing – Supports personal_sign, eth_sign, eth_signTypedData, and eth_signTypedData_v4
  • Account impersonation – Impersonate addresses for testing (requires compatible backend like Anvil)
  • Custom handlers – Override any RPC method with your own implementation

Installation

npm install eip-1193-accounts-wrapper
pnpm add eip-1193-accounts-wrapper
yarn add eip-1193-accounts-wrapper

Usage

Basic usage with private keys

import { extendProviderWithAccounts } from 'eip-1193-accounts-wrapper';

// Your existing EIP-1193 provider (e.g., from a JSON-RPC endpoint)
const baseProvider = {
  request: async ({ method, params }) => {
    // Your provider implementation
  }
};

const provider = extendProviderWithAccounts(baseProvider, {
  accounts: {
    privateKeys: [
      '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
    ],
  },
});

// Now you can use account methods
const accounts = await provider.request({ method: 'eth_accounts' });
console.log(accounts); // ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']

Using a mnemonic phrase

const provider = extendProviderWithAccounts(baseProvider, {
  accounts: {
    mnemonic: 'test test test test test test test test test test test junk',
    numAccounts: 5, // optional, defaults to 10
  },
});

Account impersonation

For testing with tools like Anvil that support account impersonation:

import { createTestClient, http } from 'viem';
import { foundry } from 'viem/chains';

const testClient = createTestClient({
  mode: 'anvil',
  chain: foundry,
  transport: http(),
});

const provider = extendProviderWithAccounts(baseProvider, {
  impersonate: {
    impersonator: testClient,
    mode: 'unknown', // 'always' | 'unknown' | 'list'
  },
});

Impersonation modes:

  • always – Always impersonate, even for known accounts
  • unknown – Only impersonate addresses not in the local accounts list
  • list – Only impersonate specific addresses provided in the list array

Custom RPC handlers

const provider = extendProviderWithAccounts(baseProvider, {
  handlers: {
    eth_blockNumber: async () => '0x1',
  },
});

API

extendProviderWithAccounts(provider, options?)

Wraps an EIP-1193 provider with local account capabilities.

Parameters

  • provider – An EIP-1193 compatible provider object
  • options – Optional configuration object:
    • accounts.privateKeys – Array of hex-encoded private keys
    • accounts.mnemonic – BIP-39 mnemonic phrase
    • accounts.numAccounts – Number of accounts to derive from mnemonic (default: 10)
    • impersonate – Impersonation configuration for testing
    • doNotFillMissingFields – If true, requires all transaction fields (gas, nonce, etc.)
    • handlers – Custom RPC method handlers

Returns

An EIP-1193 provider with account methods added.

Supported Methods

The following methods are handled locally when accounts are configured:

| Method | Description | |--------|-------------| | eth_accounts | Returns configured account addresses | | eth_requestAccounts | Returns configured account addresses | | eth_sendTransaction | Signs and sends transactions | | personal_sign | Signs messages with personal prefix | | eth_sign | Signs raw messages | | eth_signTypedData | Signs typed data (EIP-712) | | eth_signTypedData_v4 | Signs typed data v4 (EIP-712) |

All other methods are passed through to the underlying provider.

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Run tests
pnpm test

# Development mode (watch)
pnpm dev

License

See the LICENSE file for details.