paid-services 3.14.0 → 3.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Versions
2
2
 
3
- ## Version 3.14.0
3
+ ## Version 3.14.3
4
+
5
+ - `manageTrades`: Fix listing of trades that have fiat-pricing
6
+
7
+ ## Version 3.14.1
4
8
 
5
9
  - `manageTrades`: Add support for dynamic fiat-priced trades
6
10
 
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "integration-tests": "tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 180 test/integration/*.js",
44
44
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/actions/*.js test/balanced/*.js test/capacity/*.js test/client/*.js test/config/*.js test/p2p/*.js test/records/*.js test/respond/*.js test/server/*.js test/server/*.js test/services/*.js test/trades/*.js"
45
45
  },
46
- "version": "3.14.0"
46
+ "version": "3.14.3"
47
47
  }
@@ -85,7 +85,7 @@ module.exports = ({ask, id, lnd, logger, nodes}, cbk) => {
85
85
  return cbk();
86
86
  }
87
87
 
88
- return requestTradeById({action, id, lnd, to}, cbk);
88
+ return requestTradeById({id, lnd, to}, cbk);
89
89
  })],
90
90
 
91
91
  // Request an inventory of trades
@@ -200,11 +200,14 @@ module.exports = ({ask, lnd, logger, request, separator}, cbk) => {
200
200
  return cbk([404, 'NoTradesCurrentlyOpen']);
201
201
  }
202
202
 
203
+ const trades = getTrades.filter(n => !!n.secret && !!n.description);
204
+
203
205
  return ask({
204
- choices: getTrades.filter(n => !!n.secret).map(trade => ({
205
- name: `${tokensAsBigUnit(trade.tokens)} ${trade.description}`,
206
- value: trade.id,
207
- })),
206
+ choices: trades.map(({description, id, price, tokens}) => {
207
+ const charging = !!tokens ? tokensAsBigUnit(tokens) : price;
208
+
209
+ return {name: `${charging} ${description}`, value: id};
210
+ }),
208
211
  message: 'Trade?',
209
212
  name: 'manage',
210
213
  type: 'list',
@@ -258,6 +261,7 @@ module.exports = ({ask, lnd, logger, request, separator}, cbk) => {
258
261
  expires_at: trade.expires_at,
259
262
  id: trade.id,
260
263
  network: getNetwork.network,
264
+ price: trade.price,
261
265
  public_key: getIdentity.public_key,
262
266
  secret: trade.secret,
263
267
  tokens: trade.tokens,
@@ -311,8 +315,10 @@ module.exports = ({ask, lnd, logger, request, separator}, cbk) => {
311
315
  return logger.info(`sold: ${tokensAsBigUnit(tokens)} ${item}`);
312
316
  });
313
317
 
314
- sub.on('start', ({description, tokens}) => {
315
- const trade = `${tokensAsBigUnit(tokens)} ${description}`;
318
+ sub.on('start', ({description, price, tokens}) => {
319
+ const amount = !!tokens ? tokensAsBigUnit(tokens) : price;
320
+
321
+ const trade = `${amount} ${description}`;
316
322
 
317
323
  return logger.info(`open: ${trade}`);
318
324
  });
@@ -32,7 +32,7 @@ module.exports = args => {
32
32
  return {};
33
33
  }
34
34
 
35
- if (!!args.is_push || !args.tokens) {
35
+ if (!!args.is_push) {
36
36
  return {};
37
37
  }
38
38