Commit a53a391e authored by Guzman Llambias's avatar Guzman Llambias
Browse files

wrap code for clei paper

parent 61e7d9d1
......@@ -37,29 +37,20 @@ class FabricConnector {
}
async listenBlockchainEvents() {
// listen events on fabric blockchain
const network = await this.fabricGateway.getNetwork(config.blockchains.fabric.fabricChannel);
const contract = network.getContract(config.blockchains.fabric.fabricContract);
// listen events on fabric blockchain
const network = await this.fabricGateway.getNetwork(
config.blockchains.fabric.fabricChannel);
const contract = network.getContract(
config.blockchains.fabric.fabricContract);
const remoteEvent = config.blockchains.fabric.fabricRemoteRequestEvent;
/*
await network.addBlockListener('my-block-listener', (err, block) => {
if (err) {
console.error(err);
return;
}
console.log(`Block: ${JSON.stringify(block)}`);
});
*/
await contract.addContractListener('listener', remoteEvent, this.eventReceivedFromFabric.bind(this));
await contract.addContractListener('listener', remoteEvent,
this.eventReceivedFromFabric.bind(this));
}
eventReceivedFromFabric(err, event, blockNumber, transactionId, status) {
this.printLine('Event received from fabric blockchain');
//console.log(blockNumber, transactionId, status);
if (err) {
console.error(err);
} else if (status == 'VALID') {
......@@ -192,4 +183,4 @@ class FabricConnector {
}
}
new FabricConnector();
\ No newline at end of file
new FabricConnector();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment