Skip to content

Commit e3ce652

Browse files
committed
format code
1 parent a2e9bee commit e3ce652

File tree

686 files changed

+83111
-74129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

686 files changed

+83111
-74129
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,5 @@ test-all: test-merit-rpc \
201201
.PHONY: fmt
202202
fmt:
203203
node_modules/.bin/prettier --parser typescript --write "packages/**/*.{ts,js}" || true
204-
node_modules/.bin/prettier --parser scss --write "packages/**/*.{scss,sass}" || true
204+
# node_modules/.bin/prettier --parser scss --write "packages/**/*.{scss,sass}" || true
205205
node_modules/.bin/prettier --parser markdown --write "**/*.md" || true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The lightwallet development environment consists of:
1616

1717
Make sure the following conditions are met
1818

19-
- GNU/Linux x86_32/x86_64, or OSX 64bit _(for meritd distributed binaries)_
19+
- GNU/Linux x86*32/x86_64, or OSX 64bit *(for meritd distributed binaries)\_
2020
- ZeroMQ _(libzmq3-dev for Ubuntu/Debian or zeromq on OSX)_
2121
- GNU Make version 4.2.1
2222
- The lightwallet-stack stably tested on Node.js >= v4.8.4

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"dependencies": {},
1515
"devDependencies": {
1616
"lerna": "^3.4.0",
17-
"prettier": "^1.14.3"
17+
"prettier": "^1.15.3"
1818
}
1919
}

packages/insight-api/lib/addresses.js

Lines changed: 86 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ const COINBASE_MATURITY = meritcore.Block.COINBASE_MATURITY;
1111
function AddressController(node) {
1212
this.node = node;
1313
this.txController = new TxController(node);
14-
this.common = new Common({log: this.node.log});
15-
};
14+
this.common = new Common({ log: this.node.log });
15+
}
1616

1717
AddressController.prototype.show = function(req, res) {
1818
var self = this;
1919
var options = {
20-
noTxList: parseInt(req.query.noTxList)
20+
noTxList: parseInt(req.query.noTxList),
2121
};
2222

2323
if (req.query.from && req.query.to) {
@@ -26,7 +26,7 @@ AddressController.prototype.show = function(req, res) {
2626
}
2727

2828
this.getAddressSummary(req.addr, options, function(err, data) {
29-
if(err) {
29+
if (err) {
3030
return self.common.handleErrors(err, res);
3131
}
3232

@@ -53,7 +53,7 @@ AddressController.prototype.unconfirmedBalance = function(req, res) {
5353
AddressController.prototype.addressSummarySubQuery = function(req, res, param) {
5454
var self = this;
5555
this.getAddressSummary(req.addr, {}, function(err, data) {
56-
if(err) {
56+
if (err) {
5757
return self.common.handleErrors(err, res);
5858
}
5959

@@ -62,9 +62,8 @@ AddressController.prototype.addressSummarySubQuery = function(req, res, param) {
6262
};
6363

6464
AddressController.prototype.getAddressSummary = function(address, options, callback) {
65-
6665
this.node.getAddressSummary(address, options, function(err, summary) {
67-
if(err) {
66+
if (err) {
6867
return callback(err);
6968
}
7069

@@ -80,7 +79,7 @@ AddressController.prototype.getAddressSummary = function(address, options, callb
8079
unconfirmedBalanceMicros: summary.unconfirmedBalance,
8180
unconfirmedTxApperances: summary.unconfirmedAppearances, // misspelling - ew
8281
txApperances: summary.appearances, // yuck
83-
transactions: summary.txids
82+
transactions: summary.txids,
8483
};
8584

8685
callback(null, transformed);
@@ -91,10 +90,13 @@ AddressController.prototype.checkAddr = function(req, res, next) {
9190
req.addr = req.params.addr;
9291

9392
if (this.check(req, res, next, [req.addr])) {
94-
return this.common.handleErrors({
95-
message: 'Must include address',
96-
code: 1
97-
}, res);
93+
return this.common.handleErrors(
94+
{
95+
message: 'Must include address',
96+
code: 1,
97+
},
98+
res,
99+
);
98100
}
99101

100102
next();
@@ -103,57 +105,69 @@ AddressController.prototype.checkAddr = function(req, res, next) {
103105
AddressController.prototype.checkAddrOrAlias = function(req, res, next) {
104106
req.addr = req.params.addr;
105107
if (this.check(req, res, next, [req.addr] || !this.checkAlias(req, res, next, [req.addr]))) {
106-
return this.common.handleErrors({
107-
message: 'Invalid address: ' + + req.addr,
108-
code: 1
109-
}, res);
108+
return this.common.handleErrors(
109+
{
110+
message: 'Invalid address: ' + +req.addr,
111+
code: 1,
112+
},
113+
res,
114+
);
110115
}
111116

112117
next();
113118
};
114119

115120
AddressController.prototype.checkAddrs = function(req, res, next) {
116-
if(req.body.addrs) {
121+
if (req.body.addrs) {
117122
req.addrs = req.body.addrs.split(',');
118123
} else {
119124
req.addrs = req.params.addrs.split(',');
120125
}
121126

122127
if (this.check(req, res, next, req.addrs)) {
123-
return this.common.handleErrors({
124-
message: 'Must include address',
125-
code: 1
126-
}, res);
128+
return this.common.handleErrors(
129+
{
130+
message: 'Must include address',
131+
code: 1,
132+
},
133+
res,
134+
);
127135
}
128136

129137
next();
130138
};
131139

132140
AddressController.prototype.check = function(req, res, next, addresses) {
133141
if (!addresses.length || !addresses[0]) {
134-
return this.common.handleErrors({
135-
message: 'Must include address',
136-
code: 1
137-
}, res);
142+
return this.common.handleErrors(
143+
{
144+
message: 'Must include address',
145+
code: 1,
146+
},
147+
res,
148+
);
138149
}
139150

140151
addresses = _.reject(addresses, _.isEmpty);
141152

142-
for(var i = 0; i < addresses.length; i++) {
153+
for (var i = 0; i < addresses.length; i++) {
143154
try {
144-
new meritcore.Address(addresses[i]);
145-
} catch(e) {
155+
new meritcore.Address(addresses[i]);
156+
} catch (e) {
146157
return false;
147158
}
148159
}
149160
};
150161

151162
AddressController.prototype.checkAlias = function(req, res, next, aliases) {
152-
if(!aliases.length || !aliases[0]) {
153-
return this.common.handleErrors({
154-
message: 'Must include alias',
155-
code: 1
156-
}, res);
163+
if (!aliases.length || !aliases[0]) {
164+
return this.common.handleErrors(
165+
{
166+
message: 'Must include alias',
167+
code: 1,
168+
},
169+
res,
170+
);
157171
}
158172

159173
aliases = _.reject(aliases, _.isEmpty);
@@ -166,11 +180,14 @@ AddressController.prototype.validateAddress = function(req, res) {
166180
const address = req.addr;
167181

168182
this.node.validateAddress(address, function(err, response) {
169-
if (err || !response.result) {
170-
return self.common.handleErrors({
171-
message: 'Invalid address: ' + err.message,
172-
code: 1
173-
}, res);
183+
if (err || !response.result) {
184+
return self.common.handleErrors(
185+
{
186+
message: 'Invalid address: ' + err.message,
187+
code: 1,
188+
},
189+
res,
190+
);
174191
}
175192

176193
const info = response.result;
@@ -181,15 +198,15 @@ AddressController.prototype.validateAddress = function(req, res) {
181198
isValid: !!info.isvalid,
182199
isBeaconed: !!info.isbeaconed,
183200
isConfirmed: !!info.isconfirmed,
184-
});
201+
});
185202
});
186203
};
187204

188205
AddressController.prototype.utxo = function(req, res) {
189206
var self = this;
190207

191208
this.node.getAddressUnspentOutputs(req.addr, {}, function(err, utxos) {
192-
if(err) {
209+
if (err) {
193210
return self.common.handleErrors(err, res);
194211
} else if (!utxos.length) {
195212
return res.jsonp([]);
@@ -200,9 +217,9 @@ AddressController.prototype.utxo = function(req, res) {
200217

201218
AddressController.prototype.multiutxo = function(req, res) {
202219
this.node.getAddressUnspentOutputs(req.addrs, { invites: req.body.invites }, (err, utxos) => {
203-
if(err && err.code === -5) {
220+
if (err && err.code === -5) {
204221
return res.jsonp([]);
205-
} else if(err) {
222+
} else if (err) {
206223
return this.common.handleErrors(err, res);
207224
}
208225

@@ -241,45 +258,44 @@ AddressController.prototype._getTransformOptions = function(req) {
241258
return {
242259
noAsm: parseInt(req.query.noAsm) ? true : false,
243260
noScriptSig: parseInt(req.query.noScriptSig) ? true : false,
244-
noSpent: parseInt(req.query.noSpent) ? true : false
261+
noSpent: parseInt(req.query.noSpent) ? true : false,
245262
};
246263
};
247264

248265
AddressController.prototype.referrals = function(req, res, next) {
249-
var self = this;
250-
251-
var options = {
252-
from: parseInt(req.query.from) || parseInt(req.body.from) || 0
253-
};
266+
var self = this;
254267

255-
options.to = parseInt(req.query.to) || parseInt(req.body.to) || parseInt(options.from) + 10;
268+
var options = {
269+
from: parseInt(req.query.from) || parseInt(req.body.from) || 0,
270+
};
256271

257-
self.node.getAddressReferrals(req.addrs, options, function(err, result) {
258-
if(err) {
259-
return self.common.handleErrors(err, res);
260-
}
272+
options.to = parseInt(req.query.to) || parseInt(req.body.to) || parseInt(options.from) + 10;
261273

262-
return res.jsonp({
263-
totalItems: result.totalCount,
264-
from: options.from,
265-
to: Math.min(options.to, result.totalCount),
266-
items: result.items
267-
});
274+
self.node.getAddressReferrals(req.addrs, options, function(err, result) {
275+
if (err) {
276+
return self.common.handleErrors(err, res);
277+
}
268278

279+
return res.jsonp({
280+
totalItems: result.totalCount,
281+
from: options.from,
282+
to: Math.min(options.to, result.totalCount),
283+
items: result.items,
269284
});
285+
});
270286
};
271287

272288
AddressController.prototype.multitxs = function(req, res, next) {
273289
var self = this;
274290

275291
var options = {
276-
from: parseInt(req.query.from) || parseInt(req.body.from) || 0
292+
from: parseInt(req.query.from) || parseInt(req.body.from) || 0,
277293
};
278294

279295
options.to = parseInt(req.query.to) || parseInt(req.body.to) || parseInt(options.from) + 10;
280296

281297
self.node.getAddressHistory(req.addrs, options, function(err, result) {
282-
if(err) {
298+
if (err) {
283299
return self.common.handleErrors(err, res);
284300
}
285301

@@ -293,28 +309,29 @@ AddressController.prototype.multitxs = function(req, res, next) {
293309
totalItems: result.totalCount,
294310
from: options.from,
295311
to: Math.min(options.to, result.totalCount),
296-
items: items
312+
items: items,
297313
});
298314
});
299-
300315
});
301316
};
302317

303318
AddressController.prototype.transformAddressHistoryForMultiTxs = function(txinfos, options, callback) {
304319
var self = this;
305320

306-
var items = txinfos.map(function(txinfo) {
307-
return txinfo.tx;
308-
}).filter(function(value, index, itemArr) {
309-
return itemArr.indexOf(value) === index;
310-
});
321+
var items = txinfos
322+
.map(function(txinfo) {
323+
return txinfo.tx;
324+
})
325+
.filter(function(value, index, itemArr) {
326+
return itemArr.indexOf(value) === index;
327+
});
311328

312329
async.map(
313330
items,
314331
function(item, next) {
315332
self.txController.transformTransaction(item, options, next);
316333
},
317-
callback
334+
callback,
318335
);
319336
};
320337

0 commit comments

Comments
 (0)