旧版本的hyperledger支持下面的方法。但最新的不是
const generateReport = getFactory().newTransaction('org.cusat.hospital', 'GenerateReport');
虽然在新版本中测试显示错误
Error: No valid responses from any peers. Response from attempted peer comms was an error: Error: transaction returned with failure: TypeError: getFactory(...).newTransaction is not a function
请建议替代方法。
我发现了一种从javascript调用事务的方法。看看这是否有帮助。
const TransactionSubmit = require('composer-cli')。Transaction.Submit;
let options = {card:'admin @ tutorial-network',data:'{“$ class”:“net.biz.digitalPropertyNetwork.RegisterPropertyForSale”,“transactionId”:“TRANSACTION_001”,“sell”:“mae @ biznet。 org“,”title“:”TITLE_001“}'};
TransactionSubmit.handler(选项);