0

如何纠正这种类型的错误?这是进行交易的代码,还添加了在终端收到的错误。

var transaction = new EthereumTransaction(rawTransaction)

^TypeError: EthereumTransaction is not a constructor

这是我的代码:

   var privateKeySender = '*************************************'
   var privateKeySenderHex = new Buffer(privateKeySender, 'hex')
   var transaction = new EthereumTransaction(rawTransaction)
   transaction.sign(privateKeySenderHex)


   $ node index.js
   C:\Users\asus\Desktop\projectFolder\index.js:43
   var transaction = new EthereumTransaction(rawTransaction)
                  ^
     TypeError: EthereumTransaction is not a constructor
     at Object.<anonymous> (C:\Users\asus\Desktop\projectFolder\index.js:43:19)
     at Module._compile (internal/modules/cjs/loader.js:778:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
     at Module.load (internal/modules/cjs/loader.js:653:32)
     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
     at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
     at startup (internal/bootstrap/node.js:283:19)
     at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
4

0 回答 0