ethereumjs / ethereumjs-tx

Project is in active development and has been moved to the EthereumJS VM monorepo.
https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/tx
Mozilla Public License 2.0
779 stars 235 forks source link

TypeError: Common.forCustomChain is not a function #180

Closed parin13 closed 4 years ago

parin13 commented 4 years ago

Trying to connect to custom chain cause problem:

My code snippet:

const createRawTransaction = require('ethereumjs-tx').Transaction;
const Common = require('ethereumjs-common');

 const customCommon = await Common.forCustomChain(
        'mainnet',
        {
          name: 'truffle',
          networkId: 5777
        },
        'petersburg',
      )
const rawTx = new createRawTransaction(raw, {common: customCommon});

error:

TypeError: Common.forCustomChain is not a function
parin13 commented 4 years ago

for Nodejs its const Common = require('ethereumjs-common').default;