OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

WEB3 Mock

WEB3 Mock is a JavaScript library that mocks Web3 responses by emulating wallets or blockchain RPC requests, allowing developers to test decentralized applications with controlled provider behaviour.

Independent OpenViST project profile, based on linked sources.

WEB3 Mock — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a dApp test needs controlled wallet or blockchain-provider responses rather than relying on live responses.

Who it is for

  • Developers writing tests for decentralized applications.
  • Teams using Jest, Cypress or Playwright to test wallet and provider interactions.

Documented uses

  • Mock wallet responses in a dApp test.
  • Set predictable results for blockchain RPC or contract requests.
  • Exercise application behaviour against mocked provider responses.
Before you choose

Requirements & limits

  • The README names Jest, Cypress and Playwright and says they should be set up before using the library.
  • Solana examples require explicit provider mocking; the basic EVM example initializes an Ethereum mock directly.
  • The repository specifies the MIT license.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install WEB3 Mock as a development dependency

Add the library to a JavaScript project before configuring a test runner.

Before you start

  • A JavaScript project using Yarn or npm

Steps

  1. Install @depay/web3-mock with Yarn using yarn add @depay/web3-mock --dev, or with npm using the command below.

    Documented command
    npm install --save-dev @depay/web3-mock
  2. Set up Jest, Cypress or Playwright according to the project's guidance before using the library.

Expected outcome

The library is added as a development dependency, and the README identifies the test-runner setup as the next prerequisite.

Guide limitations

  • This covers dependency installation and the stated prerequisite only; it does not provide a complete test-runner setup recipe.
Source-based practical guide

Initialize an Ethereum mock in a test

Set up the README's basic EVM mock example in a test suite.

Before you start

  • WEB3 Mock installed in the JavaScript project
  • Jest, Cypress or Playwright set up before using the library

Steps

  1. Import mock from @depay/web3-mock.

  2. In the test's beforeEach, call mock('ethereum').

  3. In the test, request eth_chainId and net_version from window.ethereum.

Expected outcome

The example shows the mocked requests returning chain ID `0x1` and network version `1`.

Guide limitations

  • The steps describe the README's basic Ethereum example, not a complete test configuration or a guarantee for other setups.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
15 October 2026
Original website title
DePayFi/web3-mock · Official homepage title · retained in its source language