New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@zerodevapp/mock-server

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zerodevapp/mock-server

As a dependency:

0.1.1
Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created

Installing

As a dependency:

npm i @zerodevapp/mock-server

Usage

Hardhat

We maintain an official Hardhat plugin where the deployment of the contracts and starting of the server is done automatically. You can find it here.

Standalone

You will need to deploy some contracts and pass them to the server. Here's what the shape of startMockServer() looks like:

import { type Paymaster, startMockServer } from "@zerodevapp/mock-server";

const paymaster: Paymaster = {
  signer: /* a hardhat-ethers Signer */,
  contractAddress: /* contract address of VerifyingPaymaster.sol */,
}

const entryPoint = /* ethers contract for EntryPoint.sol */;
const provider = /* ethers JsonRpcProvider */;

await startMockServer({
  port: 3030, // default, optional
  paymaster,
  entryPoint,
  provider,
});

Caveats

  • The mock server does not communicate with the production ZeroDev servers, nor does it communicate with any real Authentication services you have installed. It will create a signer for anything you pass it.
  • Keys are issued per-session and not per-user. This means a user will have the same private key until their authentication token changes.

Building

Locally

Here are the steps needed to install as a local package:

npm run build:local
npm pack

The output file will be in ./dist.

Publishing to NPM

npm run build
npm publish

FAQs

Package last updated on 02 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts