Snippets

Beyondi d.o.o. ChaincodeB returns data to ChaincodeA

Created by Beyondi d.o.o.
// test.js
'use strict';
// SDK Library to asset with writing the logic
import { 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
 */
export class ChaincodeB extends Contract {

    @Transaction()
    public async init(ctx: Context) {
        console.info('============= Initialize ChaincodeB ===========');
    }

    @Transaction()
    public async weatherData(ctx: Context) {

        const weatherDataInJSON = await fetchWeatherData();
        return Buffer.from(JSON.stringify(weatherDataInJSON));
    }
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.