'use strict';// SDK Library to asset with writing the logicimport{Context,Contract,Transaction}from'fabric-contract-api';// Business logic (well just util but still it's general purpose logic)import{Iterators}from'fabric-shim';/** * Support the Updating of values within the SmartContract */exportclassChaincodeAextendsContract{@Transaction()publicasyncinit(ctx: Context){console.info('============= Initialize ChaincodeA ===========');}// when doing Typescript, transaction decorator is required@Transaction()publicasyncrun(ctx: Context){// this chaincode is on the same channel, first argument is chaincode name,// second is arguments: KEEP IN MIND, FIRST IS chaincode name, SECOD is args where args[0] is function name and the third is channel.constchaincodeResponse=awaitctx.stub.invokeChaincode('ChaincodeB',['weatherData'],'ChannelB');// I added console.dir for you to investigate full response and then just a payloadconsole.dir(chaincodeResponse);console.dir(chaincodeResponse.payload.toString('utf8'));returnctx.stub.getTxID();}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.