How to use the ganache-core/public-exports.provider function in ganache-core

To help you get started, we’ve selected a few ganache-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / environment / environment.js View on Github external
const web3 = new Web3Shim({
      provider: config.provider,
      networkType: config.networks[config.network].type
    });

    const accounts = await web3.eth.getAccounts();
    const block = await web3.eth.getBlock("latest");

    const upstreamNetwork = config.network;
    const upstreamConfig = config.networks[upstreamNetwork];
    const forkedNetwork = config.network + "-fork";

    config.networks[forkedNetwork] = {
      network_id: config.network_id,
      provider: Ganache.provider({
        fork: config.provider,
        unlocked_accounts: accounts,
        gasLimit: block.gasLimit
      }),
      from: config.from,
      gas: upstreamConfig.gas,
      gasPrice: upstreamConfig.gasPrice
    };
    config.network = forkedNetwork;
  },
github trufflesuite / truffle / packages / environment / environment.js View on Github external
const accounts = await web3.eth.getAccounts();
    const block = await interfaceAdapter.getBlock("latest");

    const upstreamNetwork = config.network;
    const upstreamConfig = config.networks[upstreamNetwork];
    const forkedNetwork = config.network + "-fork";
    const ganacheOptions = {
      fork: config.provider,
      gasLimit: block.gasLimit
    };
    if (accounts.length > 0) ganacheOptions.unlocked_accounts = accounts;

    config.networks[forkedNetwork] = {
      network_id: config.network_id,
      provider: Ganache.provider(ganacheOptions),
      from: config.from,
      gas: upstreamConfig.gas,
      gasPrice: upstreamConfig.gasPrice
    };
    config.network = forkedNetwork;
  },

ganache-core

[![npm Version](https://img.shields.io/npm/v/ganache-core.svg)](https://www.npmjs.com/package/ganache-core) [![npm Downloads](https://img.shields.io/npm/dm/ganache-core.svg)](https://www.npmjs.com/package/ganache-core) [![Build Status](https://travis-ci.o

MIT
Latest version published 3 years ago

Package Health Score

55 / 100
Full package analysis