How to use the @nomiclabs/ethereumjs-vm/dist/state.StateManager function in @nomiclabs/ethereumjs-vm

To help you get started, we’ve selected a few @nomiclabs/ethereumjs-vm 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 nomiclabs / buidler / packages / buidler-core / src / internal / buidler-evm / provider / node.ts View on Github external
networkId,
        name: networkName,
        genesis: {
          timestamp: `0x${getCurrentTimestamp().toString(16)}`,
          hash: "0x",
          gasLimit: blockGasLimit,
          difficulty: 1,
          nonce: "0x42",
          extraData: "0x1234",
          stateRoot: bufferToHex(stateTrie.root)
        }
      },
      hardfork
    );

    const stateManager = new StateManager({
      common: common as any, // TS error because of a version mismatch
      trie: stateTrie
    });

    const blockchain = new Blockchain();

    const vm = new VM({
      common: common as any, // TS error because of a version mismatch
      activatePrecompiles: true,
      stateManager,
      blockchain: blockchain as any
    });

    const genesisBlock = new Block(null, { common });
    genesisBlock.setGenesisParams();