问题描述
我正在使用ethereumjs-wallet
,并且在我的开发节点环境中,对Wallet.fromV3
的调用没有问题。在我的生产安装中,发生错误
TypeError: Wallet.fromV3 is not a function
at extractPrivateKey (/usr/src/app/dist/blockchain/library.js:83:23)
at sendTransaction (/usr/src/app/dist/blockchain/library.js:113:3)
at Object.callback (/usr/src/app/dist/blockchain/library.js:1052:5)
at sendTxCallback (/usr/src/app/node_modules/web3/node_modules/web3-core-method/lib/index.js:533:29)
at /usr/src/app/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:293:9
at XMLHttpRequest.request.onreadystatechange (/usr/src/app/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/src/app/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest._setReadyState (/usr/src/app/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest._onHttpResponseEnd (/usr/src/app/node_modules/xhr2-cookies/xml-http-request.ts:345:8)
at IncomingMessage.<anonymous> (/usr/src/app/node_modules/xhr2-cookies/xml-http-request.ts:311:39)
at IncomingMessage.emit (events.js:198:15)
console.log
在我的开发环境中:
Wallet function Wallet(priv,pub) {
if (priv && pub) {
throw new Error('Cannot supply both a private and a public key to the constructor');
}
if (priv && !ethUtil.isValidPrivate(priv)) {
throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)');
}
if (pub && !ethUtil.isValidPublic(pub)) {
throw new Error('Invalid public key');
}
this._privKey = priv;
this._pubKey = pub;
}
console.log
在生产中
Wallet { hdkey: [Getter],thirdparty: [Getter],default:
{ [Function: Wallet]
generate: [Function],generateVanityAddress: [Function],frompublicKey: [Function],fromExtendedPublicKey: [Function],fromPrivateKey: [Function],fromExtendedPrivateKey: [Function],fromV1: [Function],fromV3: [Function],fromEthSale: [Function] } }
与从Wallet
导出node_modules/ethereumjs-wallet/dist/index.js
的方式有关吗?
exports.default = Wallet;
尽管the recommendation通过Wallet
加载const { Wallet } = require('ethereumjs-wallet')
,但仍以const Wallet = require('ethereumjs-wallet')
的方式加载,因为它在使用前一种语法的开发中无法正常工作。 / p>
ethereumjs-wallet
和truffle-hdwallet-provider
的版本在两种环境下都是一致的。
-- ethereumjs-wallet@1.0.0
-- truffle-hdwallet-provider@1.0.17
您知道我的生产系统上发生了什么吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)