Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This is a node-js version of example_02.go
const shim = require('fabric-shim');
// An log4js logger instance
const logger = shim.newLogger('example_cc1');
// The logger level can also be set by environment variable 'CORE_CHAINCODE_LOGGING_SHIM'
// to CRITICAL, ERROR, WARNING, DEBUG
logger.level = 'info';
const Chaincode = class {
async Init(stub) {
logger.info('########### example_cc1 Init ###########');
// test the transient map support with chaincode instantiation
return this.testTransient(stub);
}
async Invoke(stub) {
logger.info('########### example_cc1 Invoke ###########');
const ret = stub.getFunctionAndParameters();
const fcn = ret.fcn;
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This is a node-js version of example_02.go
const shim = require('fabric-shim');
// An log4js logger instance
const logger = shim.newLogger('example_cc0');
// The logger level can also be set by environment variable 'CORE_CHAINCODE_LOGGING_SHIM'
// to CRITICAL, ERROR, WARNING, DEBUG
logger.level = 'info';
const Chaincode = class {
async Init(stub) {
logger.info('########### example_cc0 Init ###########');
const ret = stub.getFunctionAndParameters();
let A, B; // Entities
let Aval, Bval; // Asset holdings
const args = ret.params;
if (args.length === 4) {
A = args[0];
B = args[2];
async Init(stub: ChaincodeStub): Promise {
const logger: LoggerInstance = shim.newLogger('init');
return shim.success();
}