[FAB-4994] Fix formatting of js files

The tab/spaces were inconsistent for the
js files.

Change-Id: I38d57dfc3fe59fa601e304b61d122c05ab1f183e
Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
This commit is contained in:
Gari Singh 2017-06-24 17:31:12 -04:00
parent e265cac69c
commit 6610584c19
2 changed files with 48 additions and 50 deletions

View file

@ -72,8 +72,7 @@ Promise.resolve().then(() => {
console.log(util.format( console.log(util.format(
'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s", metadata - "%s", endorsement signature: %s', 'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s", metadata - "%s", endorsement signature: %s',
proposalResponses[0].response.status, proposalResponses[0].response.message, proposalResponses[0].response.status, proposalResponses[0].response.message,
proposalResponses[0].response.payload, proposalResponses[0].endorsement proposalResponses[0].response.payload, proposalResponses[0].endorsement.signature));
.signature));
var request = { var request = {
proposalResponses: proposalResponses, proposalResponses: proposalResponses,
proposal: proposal, proposal: proposal,

View file

@ -8,58 +8,57 @@ var hfc = require('fabric-client');
var path = require('path'); var path = require('path');
var options = { var options = {
wallet_path : path.join(__dirname, './network/creds'), wallet_path: path.join(__dirname, './network/creds'),
user_id: 'PeerAdmin', user_id: 'PeerAdmin',
channel_id: 'mychannel', channel_id: 'mychannel',
chaincode_id: 'fabcar', chaincode_id: 'fabcar',
network_url: 'grpc://localhost:7051', network_url: 'grpc://localhost:7051',
}; };
var channel = {}; var channel = {};
var client = null; var client = null;
Promise.resolve().then (() => { Promise.resolve().then(() => {
console.log("Create a client and set the wallet location"); console.log("Create a client and set the wallet location");
client = new hfc(); client = new hfc();
return hfc.newDefaultKeyValueStore({path: options.wallet_path}); return hfc.newDefaultKeyValueStore({ path: options.wallet_path });
}).then((wallet) => { }).then((wallet) => {
console.log("Set wallet path, and associate user ",options.user_id," with application"); console.log("Set wallet path, and associate user ", options.user_id, " with application");
client.setStateStore(wallet); client.setStateStore(wallet);
return client.getUserContext(options.user_id, true); return client.getUserContext(options.user_id, true);
}).then ((user) => { }).then((user) => {
console.log("Check user is enrolled, and set a query URL in the network"); console.log("Check user is enrolled, and set a query URL in the network");
if (user===undefined || user.isEnrolled()===false) { if (user === undefined || user.isEnrolled() === false) {
console.error("User not defined, or not enrolled - error"); console.error("User not defined, or not enrolled - error");
} }
channel = client.newChannel(options.channel_id); channel = client.newChannel(options.channel_id);
channel.addPeer(client.newPeer(options.network_url)); channel.addPeer(client.newPeer(options.network_url));
return; return;
}).then (() => { }).then(() => {
console.log("Make query"); console.log("Make query");
var transaction_id = client.newTransactionID(); var transaction_id = client.newTransactionID();
console.log("Assigning transaction_id: ", transaction_id._transaction_id); console.log("Assigning transaction_id: ", transaction_id._transaction_id);
// queryCar - requires 1 argument, ex: args: ['CAR4'], // queryCar - requires 1 argument, ex: args: ['CAR4'],
// queryAllCars - requires no arguments , ex: args: [''], // queryAllCars - requires no arguments , ex: args: [''],
const request = { const request = {
chaincodeId: options.chaincode_id, chaincodeId: options.chaincode_id,
txId: transaction_id, txId: transaction_id,
fcn: 'queryAllCars', fcn: 'queryAllCars',
args: [''] args: ['']
}; };
return channel.queryByChaincode(request); return channel.queryByChaincode(request);
}).then ((query_responses) => { }).then((query_responses) => {
console.log("returned from query"); console.log("returned from query");
if (!query_responses.length) { if (!query_responses.length) {
console.log("No payloads were returned from query"); console.log("No payloads were returned from query");
} else { } else {
console.log("Query result count = ", query_responses.length) console.log("Query result count = ", query_responses.length)
} }
if (query_responses[0] instanceof Error) { if (query_responses[0] instanceof Error) {
console.error("error from query = ", query_responses[0]); console.error("error from query = ", query_responses[0]);
} }
console.log("Response is ", query_responses[0].toString()); console.log("Response is ", query_responses[0].toString());
}) }).catch((err) => {
.catch ((err) => { console.error("Caught Error", err);
console.error("Caught Error", err);
}); });