JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 753
  • Score
    100M100P100Q90206F
  • License Apache-2.0

Hardhat network to spin up for testing

Package Exports

  • ethereum-test-network

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ethereum-test-network) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TypeScript version Node.js version APLv2 Build Status - Travis Build Status - GitHub Actions

Just a wrapper around hardhat-network

NPM

npm i --save-dev ethereum-test-network

Yarn

yarn add --dev ethereum-test-network

Use its

import { TestNetwork } from 'ethereum-test-network';

describe('eth test network', () => {
  let testnetwork: TestNetwork;

  // Act before assertions
  beforeEach(async () => {
    testnetwork = await TestNetwork.init();
  });
  afterEach(async () => {
    await testnetwork.close();
  });

  it('should check block number', async () => {
    const provider = new ethers.providers.JsonRpcProvider(JSON_RPC_PROVIDER);
    const blockNumber = await provider.getBlockNumber();
    expect(blockNumber).toBe(0);
  });
});

Defaults

const DEFAULT_CHAIN_ID = 123;
const DEFAULT_NETWORK_ID = 234;
const DEFAULT_GENESIS_ACCOUNTS = [
  {
    balance: '0x295BE96E64066972000000',
    privateKey:
      '0xa3dac6ca0b1c61f5f0a0b3a0acf93c9a52fd94e8e33d243d3b3a8b8c5dc37f0b', // 0xaaE062157B53077da1414ec3579b4CBdF7a4116f
  },
  {
    balance: '0x295BE96E64066972000000',
    privateKey:
      '0xfc6e27fbc1cc2eb3f04dab6259d926280d4aa8acb8c83f3de506ab9d589d6cc2', // 0xbbDBFf23Df1e064f458aCd943E48179bD3271fA0
  },
  {
    balance: '0x295BE96E64066972000000',
    privateKey:
      '0x735e4ab2cd08798dee1a5fc3a7af4bbdeece90c7dbdf878ceec556c84bd5ec88', // 0xcc5a0dc5152D368D55A10f68f874A05A4dd65bee
  },
];
const DEFAULT_JSON_RPC_PORT = 8545;
const DEFAULT_BLOCK_GAS_LIMIT = 6000000;

Available Scripts

  • clean - remove coverage data, Jest cache and transpiled files,
  • build - transpile TypeScript to ES6,
  • build:watch - interactive watch mode to automatically transpile source files,
  • lint - lint source files and tests,
  • test - run tests,
  • test:watch - interactive watch mode to automatically re-run tests

Additional Informations

License

Licensed under the APLv2. See the LICENSE file for details.