Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (args.length < 1) {
throw new Error('Incorrect number of arguments. Expecting 1')
}
let marbleName = args[0];
console.info('- start getHistoryForMarble: %s\n', marbleName);
let resultsIterator = await stub.getHistoryForKey(marbleName);
let method = thisClass['getAllResults'];
let results = await method(resultsIterator, true);
return Buffer.from(JSON.stringify(results));
}
};
shim.start(new Chaincode());
async getHistoryForMarble(stub, args, thisObject) {
if (args.length !== 1) {
return shim.error('Incorrect number of arguments. Expecting 1');
}
const marbleName = args[0];
console.info('- start getHistoryForMarble: %s\n', marbleName);
const resultsIterator = await stub.getHistoryForKey(marbleName);
const results = await thisObject.getAllResults(resultsIterator, true);
return shim.success(Buffer.from(JSON.stringify(results)));
}
};
shim.start(new Chaincode());
}
return shim.success(v);
}
/*
* Used to return what's in the input for testing purposes
* */
async echo(stub, args) {
logger.info('Echo Response\n');
return shim.success(Buffer.from(args[0]));
}
};
shim.start(new Chaincode());
});
const payload = Buffer.from(JSON.stringify(result));
return shim.success(payload);
}
async echo(stub, args) {
stub.setEvent('echo', Buffer.from('content'));
if (args.length > 0) {
return shim.success(Buffer.from(args[0]));
} else {
return shim.success();
}
}
};
shim.start(new Chaincode());
};
function setEvent(stub, name, payload) {
let bufferedPayload;
if (Buffer.isBuffer(payload)) {
bufferedPayload = payload;
} else {
bufferedPayload = Buffer.from(JSON.stringify(payload));
}
console.log(`Event ${name} created for ${JSON.stringify(payload)}`);
return stub.setEvent(name, bufferedPayload);
}
shim.start(new Chaincode());
await stub.putState(listingKey, Buffer.from(JSON.stringify(listing)));
}
}
console.info('inspecting vehicle: ');
console.info(util.inspect(vehicle, { showHidden: false, depth: null }));
if (highestOffer) {
//update the owner of the vehicle
await stub.putState(listing.vehicle, Buffer.from(JSON.stringify(vehicle)));
} else { throw new Error('offers do not exist: '); }
console.info('============= END : closeBidding ===========');
}
};
shim.start(new Chaincode());
await stub.putState(oldOwner, Buffer.from(JSON.stringify(seller)));
}
}
console.info('inspecting vehicle: ');
console.info(util.inspect(vehicle, {showHidden: false, depth: null}));
if (highestOffer) {
await stub.putState(listing.vehicle, Buffer.from(JSON.stringify(vehicle)));
//update the buyers balance
} else { throw new Error('offers do not exist: '); }
console.info('============= END : closeBidding ===========');
}
};
shim.start(new Chaincode());
const shim = require('fabric-shim');
const {ChaincodeBase, ChaincodeError} = require('@kunstmaan/hyperledger-fabric-node-chaincode-utils');
const ERRORS = require('./common/constants/errors');
const CONSTANTS = require('./common/constants/index');
const YOUR_CHAINCODE_NAME_PASCAL_CASEDChaincode = class extends ChaincodeBase {
constructor() {
super(shim);
}
};
shim.start(new YOUR_CHAINCODE_NAME_PASCAL_CASEDChaincode());
multisigTransferRequest.transaction.toAddress,
contract.walletAddress
]
);
multisigTransferRequest.executed = true;
}
await txHelper.putState(multisigTransferRequest.id, multisigTransferRequest);
return multisigTransferRequest;
}
};
shim.start(new MultisigChaincode(shim));
'details': error.details
});
}
return new ContractWallet({
chaincodeName,
chaincodeFunctions,
address: txHelper.uuid(CONSTANTS.PREFIXES.WALLET),
amount: 0
}).save(txHelper);
}
};
shim.start(new KumaTokenChaincode(shim));