wevm / wevm/prool

Add usage example with `viem` test client

Open
#28 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
141
Forks
26
Avg merge
2d 6h
Merged PRs (30d)
6

Description

What is the type of issue?

Documentation is missing

What is the issue?

There is no usage example with viem test client

Where did you find it?
Problem

Following the the example from README I created a prool server:

import { createServer } from 'prool'
import { anvil } from 'prool/instances'

const server = createServer({
  instance: anvil(),
})
await server.start()

After that following viem docs I created a test client:

import { createTestClient, http } from 'viem'
import { foundry } from 'viem/chains'
 
const client = createTestClient({
  chain: foundry,
  mode: 'anvil',
  transport: http(), 
})

After calling client.mine({ blocks: 1 }) I expected my transaction to be mined. Instead I received ECONNREFUSED error.

Solution

After some investigation I managed to make this set up working by explicitly starting anvil instance:

import { createServer } from 'prool'
import { anvil } from 'prool/instances'

const instance = anvil()
await instance.start()
const server = createServer({ instance })
await server.start()

This way client.mine works as expected.

Versions

viem: 2.21.1
prool: 0.0.16

Resolution

I believe usage example with viem test client should be either added to prool README or to viem docs.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/README.md and compare its existing prool server example with the viem test-client documentation. Add a working example that explicitly starts the anvil instance before creating the server, then demonstrate client.mine({ blocks: 1 }) succeeding; the README should explain this setup clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.