-1

我想使用sawtooth-sdk和指南代码(https://sawtooth.hyperledger.org/docs/core/releases/latest/_autogen/sdk_submit_tutorial_js.html):

const {createContext, CryptoFactory} = require('sawtooth-sdk/signing')

const context = createContext('secp256k1')
const privateKey = context.newRandomPrivateKey()
const signer = CryptoFactory(context).newSigner(privateKey)

但错误:

TypeError: Class constructor CryptoFactory cannot be invoked without 'new'
4

1 回答 1

1

如错误所述,您应该更改:

const signer = CryptoFactory(context).newSigner(privateKey)

到:

const signer = (new CryptoFactory(context)).newSigner(privateKey)
于 2018-06-12T07:50:46.877 回答