Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static getInfoFromContract(modulePath) {
const modPath = path.resolve(process.cwd(), modulePath);
const jsonPath = path.resolve(modPath, 'package.json');
// let's find the package.json file
const json = require(jsonPath);
logger.debug('starting up and reading package.json at %s', jsonPath);
logger.debug('read JSON', json);
const JSONSerializer = require('fabric-contract-api').JSONSerializer;
const defaultSerialization = {
transaction: 'jsonSerializer',
serializers: {
jsonSerializer : JSONSerializer
}
};
if (json.main) {
logger.debug('Using the main entry %s', json.main);
const p = (path.resolve(modPath, json.main));
const r = require(p);
// setup the set of serializers that can be used
let serializers;
if (!r.serializers) {
serializers = defaultSerialization;