Skip to content

Commit 6610584

Browse files
committed
[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>
1 parent e265cac commit 6610584

File tree

2 files changed

+48
-50
lines changed

2 files changed

+48
-50
lines changed

fabcar/invoke.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ Promise.resolve().then(() => {
7272
console.log(util.format(
7373
'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s", metadata - "%s", endorsement signature: %s',
7474
proposalResponses[0].response.status, proposalResponses[0].response.message,
75-
proposalResponses[0].response.payload, proposalResponses[0].endorsement
76-
.signature));
75+
proposalResponses[0].response.payload, proposalResponses[0].endorsement.signature));
7776
var request = {
7877
proposalResponses: proposalResponses,
7978
proposal: proposal,

fabcar/query.js

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,57 @@ var hfc = require('fabric-client');
88
var path = require('path');
99

1010
var options = {
11-
wallet_path : path.join(__dirname, './network/creds'),
12-
user_id: 'PeerAdmin',
13-
channel_id: 'mychannel',
14-
chaincode_id: 'fabcar',
15-
network_url: 'grpc://localhost:7051',
16-
};
11+
wallet_path: path.join(__dirname, './network/creds'),
12+
user_id: 'PeerAdmin',
13+
channel_id: 'mychannel',
14+
chaincode_id: 'fabcar',
15+
network_url: 'grpc://localhost:7051',
16+
};
1717

1818
var channel = {};
1919
var client = null;
2020

21-
Promise.resolve().then (() => {
22-
console.log("Create a client and set the wallet location");
23-
client = new hfc();
24-
return hfc.newDefaultKeyValueStore({path: options.wallet_path});
21+
Promise.resolve().then(() => {
22+
console.log("Create a client and set the wallet location");
23+
client = new hfc();
24+
return hfc.newDefaultKeyValueStore({ path: options.wallet_path });
2525
}).then((wallet) => {
26-
console.log("Set wallet path, and associate user ",options.user_id," with application");
27-
client.setStateStore(wallet);
28-
return client.getUserContext(options.user_id, true);
29-
}).then ((user) => {
30-
console.log("Check user is enrolled, and set a query URL in the network");
31-
if (user===undefined || user.isEnrolled()===false) {
32-
console.error("User not defined, or not enrolled - error");
33-
}
34-
channel = client.newChannel(options.channel_id);
35-
channel.addPeer(client.newPeer(options.network_url));
36-
return;
37-
}).then (() => {
38-
console.log("Make query");
39-
var transaction_id = client.newTransactionID();
40-
console.log("Assigning transaction_id: ", transaction_id._transaction_id);
26+
console.log("Set wallet path, and associate user ", options.user_id, " with application");
27+
client.setStateStore(wallet);
28+
return client.getUserContext(options.user_id, true);
29+
}).then((user) => {
30+
console.log("Check user is enrolled, and set a query URL in the network");
31+
if (user === undefined || user.isEnrolled() === false) {
32+
console.error("User not defined, or not enrolled - error");
33+
}
34+
channel = client.newChannel(options.channel_id);
35+
channel.addPeer(client.newPeer(options.network_url));
36+
return;
37+
}).then(() => {
38+
console.log("Make query");
39+
var transaction_id = client.newTransactionID();
40+
console.log("Assigning transaction_id: ", transaction_id._transaction_id);
4141

42-
// queryCar - requires 1 argument, ex: args: ['CAR4'],
43-
// queryAllCars - requires no arguments , ex: args: [''],
44-
const request = {
45-
chaincodeId: options.chaincode_id,
46-
txId: transaction_id,
47-
fcn: 'queryAllCars',
48-
args: ['']
49-
};
50-
return channel.queryByChaincode(request);
51-
}).then ((query_responses) => {
52-
console.log("returned from query");
53-
if (!query_responses.length) {
54-
console.log("No payloads were returned from query");
55-
} else {
56-
console.log("Query result count = ", query_responses.length)
57-
}
58-
if (query_responses[0] instanceof Error) {
59-
console.error("error from query = ", query_responses[0]);
60-
}
61-
console.log("Response is ", query_responses[0].toString());
62-
})
63-
.catch ((err) => {
64-
console.error("Caught Error", err);
42+
// queryCar - requires 1 argument, ex: args: ['CAR4'],
43+
// queryAllCars - requires no arguments , ex: args: [''],
44+
const request = {
45+
chaincodeId: options.chaincode_id,
46+
txId: transaction_id,
47+
fcn: 'queryAllCars',
48+
args: ['']
49+
};
50+
return channel.queryByChaincode(request);
51+
}).then((query_responses) => {
52+
console.log("returned from query");
53+
if (!query_responses.length) {
54+
console.log("No payloads were returned from query");
55+
} else {
56+
console.log("Query result count = ", query_responses.length)
57+
}
58+
if (query_responses[0] instanceof Error) {
59+
console.error("error from query = ", query_responses[0]);
60+
}
61+
console.log("Response is ", query_responses[0].toString());
62+
}).catch((err) => {
63+
console.error("Caught Error", err);
6564
});

0 commit comments

Comments
 (0)