1.1.0 • Published 4 years ago
fabric-network-simple v1.1.0
fabric-network-simple
A simplified wrapper for fabric-network. Typescript usage is recommended for auto config checks.
Installation
npm install fabric-network-simple
yarn add fabric-network-simple
##Include
import fabricNetworkSimple from "fabric-network-simple";
Configuration
fabric-network-simple reads configurations from a config object as an argument in function initGateway
Usage
Say we have a query function "set", and invoke function "get" that gets/sets a number to a variable on the chaincode
//constructor
const fabricNetwork =
new fabricNetworkSimple(
config //config object, see example config section
);
//sets variable to 5
const invokeResult =
await fabricNetwork.invokeChaincode(
'set', //chaincode method
[5], //arguments
{} //transient data
);
//gets variable from ledger
const queryResult =
await fabricNetwork.queryChaincode(
'get', //chaincode method
[] //arguments
);
console.log('queryResult'); //prints 5