node.js - 找不到 newEventHub 函数
问题描述
我是超级账本结构的新手。我已经下载了fabric v1.2.0,并尝试从fabric-sample 文件夹中运行fabcar 示例。我对链码的查询很顺利,但是当我尝试调用链码时,我从 cmd 中得到了以下错误。
这是我对链码的要求
var request = {
//targets: let default to the peer assigned to the client
chaincodeId: 'fabcar',
fcn: 'changeCarOwner',
args: ['CAR4', 'Dave'],
chainId: 'mychannel',
txId: tx_id
};
错误:
调用失败 :: TypeError: fabric_client.newEventHub is not a function
当我试图在index.t.ds中找到 newEventHub 时,我找不到该函数。任何人都可以帮我解决这个问题。在此先感谢。
解决方案
我认为他们已经用ChannelEventHub替换了 EventHub 类。
您可以使用以下内容更新 invoke.js 文件:
在第 105 行:
let event_hub = channel.newChannelEventHub('localhost:7051');
// event_hub.setPeerAddr('grpc://localhost:7053');
在第 130 行:
console.log('The transaction has been committed on peer ' + event_hub.getPeerAddr());
那应该解决它。
推荐阅读
- java - 我无法将数据从第一个活动 (MapActivity) 发送到第二个活动 (NewContact)
- symfony - 用一个表单修改多个实体(批量编辑)
- java - 如何为我的 JTextArea 添加 JScrollPane?
- r - 重新排列表格中的值
- javascript - jQuery在分页中全选不起作用
- ajax - Ajax 不适用于 laravel 项目部署
- java - 生成 Hibernate 映射文件时未创建注释
- android - 膨胀类 com.mancj.materialsearchbar.MaterialSearchBar 时出错
- java - 通过 Dagger 将 Presenter 注入到活动中
- linux - 在 Linux Mate / Ubuntu 上以编程方式切换应用程序全屏模式