How to use the fabric-shim.contractapi function in fabric-shim

To help you get started, we’ve selected a few fabric-shim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ampretia / fabric-application-examples / removevalues.js View on Github external
'use strict';

// SDK Library to asset with writing the logic

// imaginee the next line to be
// const SmartContract = require('fabric-contract-api').SmartContract;
const SmartContract = require('fabric-shim').contractapi.SmartContract;

// Business logic (well just util but still it's general purpose logic)
// const util = require('util');

/**
 * Support the Updating of values within the SmartContract
 */
class RemoveValues extends SmartContract {

	constructor() {
		super('org.mynamespace.removes');

		// going to leave the default 'not known function' handling alone
	}

	async quarterAssetValue(api) {
github ampretia / fabric-application-examples / updatevalues.js View on Github external
'use strict';

// SDK Library to asset with writing the logic

// imaginee the next line to be
// const SmartContract = require('fabric-contract-api').SmartContract;
const SmartContract = require('fabric-shim').contractapi.SmartContract;

// Business logic (well just util but still it's general purpose logic)
const util = require('util');

/**
 * Support the Updating of values within the SmartContract
 */
class UpdateValues extends SmartContract {

	/** 
	 * Sets a namespace so that the functions in this particular class can 
	 * be separated from others.
	 */
	constructor() {
		super('org.mynamespace.updates');
		this.$setUnkownFn(this.unkownFn);