balanceofsatoshis 24.2.2 → 25.1.0

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.
@@ -0,0 +1,96 @@
1
+ const asyncAuto = require('async/auto');
2
+ const {returnResult} = require('asyncjs-util');
3
+ const {subscribeToPastPayment} = require('ln-service');
4
+
5
+ const isHash = n => !!n && /^[0-9A-F]{64}$/i.test(n);
6
+ const notFound = 404;
7
+
8
+ /** Get the pending paths of an in-flight payment
9
+
10
+ {
11
+ id: <Payment Hash Hex String>
12
+ lnd: <Authenticated LND API Object>
13
+ timeout_ms: <Give Up Waiting For Payment Details After Milliseconds Number>
14
+ }
15
+
16
+ @returns via cbk or Promise
17
+ {
18
+ [created_at]: <Payment Created At ISO 8601 Date String>
19
+ id: <Payment Hash Hex String>
20
+ paths: [{
21
+ fee: <Total Fee Tokens Pending Number>
22
+ hops: [{
23
+ channel: <Standard Format Channel Id String>
24
+ forward: <Forward Tokens Number>
25
+ public_key: <Public Key Hex String>
26
+ }]
27
+ timeout: <Expiration Block Height Number>
28
+ tokens: <Total Tokens Pending Number>
29
+ }]
30
+ }
31
+ */
32
+ module.exports = (args, cbk) => {
33
+ return new Promise((resolve, reject) => {
34
+ return asyncAuto({
35
+ // Check arguments
36
+ validate: cbk => {
37
+ if (!isHash(args.id)) {
38
+ return cbk([400, 'ExpectedPaymentHashToGetPendingPaths']);
39
+ }
40
+
41
+ if (!args.lnd) {
42
+ return cbk([400, 'ExpectedAuthenticatedLndToGetPendingPaths']);
43
+ }
44
+
45
+ if (!args.timeout_ms) {
46
+ return cbk([400, 'ExpectedTimeoutMillisecondsToGetPendingPaths']);
47
+ }
48
+
49
+ return cbk();
50
+ },
51
+
52
+ // Subscribe to the payment to get its current state
53
+ getPaths: ['validate', ({}, cbk) => {
54
+ const sub = subscribeToPastPayment({id: args.id, lnd: args.lnd});
55
+
56
+ // Removing the listeners cancels the subscription to the payment
57
+ const finished = (err, res) => {
58
+ clearTimeout(timeout);
59
+
60
+ sub.removeAllListeners();
61
+
62
+ return cbk(err, res);
63
+ };
64
+
65
+ // Payments that are not in flight have no pending paths
66
+ const noPaths = () => finished(null, {id: args.id, paths: []});
67
+
68
+ const timeout = setTimeout(noPaths, args.timeout_ms);
69
+
70
+ sub.once('confirmed', noPaths);
71
+ sub.once('end', noPaths);
72
+ sub.once('failed', noPaths);
73
+
74
+ sub.once('error', err => {
75
+ // Exit early when the payment is not a known payment
76
+ if (err[0] === notFound) {
77
+ return noPaths();
78
+ }
79
+
80
+ return finished(err);
81
+ });
82
+
83
+ sub.once('paying', pending => {
84
+ return finished(null, {
85
+ created_at: pending.created_at,
86
+ id: args.id,
87
+ paths: pending.paths,
88
+ });
89
+ });
90
+
91
+ return;
92
+ }],
93
+ },
94
+ returnResult({reject, resolve, of: 'getPaths'}, cbk));
95
+ });
96
+ };
package/network/index.js CHANGED
@@ -3,6 +3,7 @@ const executeProbe = require('./execute_probe');
3
3
  const getForwards = require('./get_forwards');
4
4
  const getGraphEntry = require('./get_graph_entry');
5
5
  const getPeers = require('./get_peers');
6
+ const getPending = require('./get_pending');
6
7
  const multiPathPayment = require('./multi_path_payment');
7
8
  const multiPathProbe = require('./multi_path_probe');
8
9
  const networks = require('./networks');
@@ -24,6 +25,7 @@ module.exports = {
24
25
  getForwards,
25
26
  getGraphEntry,
26
27
  getPeers,
28
+ getPending,
27
29
  multiPathPayment,
28
30
  multiPathProbe,
29
31
  networks,
package/network/pay.js CHANGED
@@ -3,7 +3,9 @@ const asyncMap = require('async/map');
3
3
  const {formatTokens} = require('ln-sync');
4
4
  const {getChannels} = require('ln-service');
5
5
  const {getIdentity} = require('ln-service');
6
+ const {getOfferInvoice} = require('paid-services');
6
7
  const {getSyntheticOutIgnores} = require('probing');
8
+ const {parseAmount} = require('ln-accounting');
7
9
  const {parsePaymentRequest} = require('ln-service');
8
10
  const {returnResult} = require('asyncjs-util');
9
11
  const {subscribeToMultiPathPay} = require('probing');
@@ -18,13 +20,20 @@ const probeDestination = require('./probe_destination');
18
20
 
19
21
  const cltvDeltaBuffer = 3;
20
22
  const {isArray} = Array;
23
+ const isOffer = n => !!n && /^lno1/i.test(n);
24
+ const isPositive = n => isSafeInteger(n) && n > 0;
25
+ const {isSafeInteger} = Number;
21
26
  const mtokensAsTokens = mtokens => Number(mtokens / BigInt(1e3));
22
27
  const pathTimeoutMs = 1000 * 60 * 5;
23
28
  const singlePath = 1;
29
+ const tokensAsMtokens = tokens => (BigInt(tokens) * BigInt(1e3)).toString();
24
30
  const withTotalFee = ({fee, ...res}) => ({total_fee: fee, ...res});
25
31
 
26
32
  /** Make a payment
27
33
 
34
+ An offer is paid with an invoice that is requested from the offer, and a
35
+ message is sent as the payer note of the invoice request
36
+
28
37
  {
29
38
  avoid: [<Avoid Forwarding Through String>]
30
39
  [fs]: {
@@ -36,10 +45,11 @@ const withTotalFee = ({fee, ...res}) => ({total_fee: fee, ...res});
36
45
  logger: <Winston Logger Object>
37
46
  max_fee: <Max Fee Tokens Number>
38
47
  max_paths: <Maximum Paths Number>
39
- [message]: <Message String>
48
+ [message]: <Message or Offer Payer Note String>
40
49
  out: [<Out Through Peer With Public Key, Alias, or Tag String>]
41
50
  [out_filters]: [<Out Through Peer Filter Formula String>]
42
- request: <BOLT 11 Payment Request String>
51
+ request: <BOLT 11 Payment Request or BOLT 12 Offer String>
52
+ [tokens]: <Amount To Pay An Offer String>
43
53
  }
44
54
  */
45
55
  module.exports = (args, cbk) => {
@@ -75,6 +85,21 @@ module.exports = (args, cbk) => {
75
85
  return cbk([400, 'ExpectedBolt11PaymentRequestToPayPaymentRequest']);
76
86
  }
77
87
 
88
+ // Exit early when paying an offer, which is checked getting an invoice
89
+ if (isOffer(args.request)) {
90
+ // An offer is paid over blinded paths, so a single path is used
91
+ if (args.max_paths !== singlePath) {
92
+ return cbk([501, 'MultiPathPayNotSupportedWithBlindedPaths']);
93
+ }
94
+
95
+ return cbk();
96
+ }
97
+
98
+ // A payment request has its amount, an amount is only for an offer
99
+ if (!!args.tokens) {
100
+ return cbk([400, 'UnexpectedAmountToPayPaymentRequest']);
101
+ }
102
+
78
103
  try {
79
104
  parsePaymentRequest({request: args.request});
80
105
  } catch (err) {
@@ -133,6 +158,28 @@ module.exports = (args, cbk) => {
133
158
  return getTags({fs: args.fs}, cbk);
134
159
  }],
135
160
 
161
+ // Parse the amount to pay an offer
162
+ tokens: ['validate', ({}, cbk) => {
163
+ // Exit early when there is no amount to pay
164
+ if (!args.tokens) {
165
+ return cbk();
166
+ }
167
+
168
+ try {
169
+ parseAmount({amount: args.tokens});
170
+ } catch (err) {
171
+ return cbk([400, err.message]);
172
+ }
173
+
174
+ const {tokens} = parseAmount({amount: args.tokens});
175
+
176
+ if (!isPositive(tokens)) {
177
+ return cbk([400, 'ExpectedPositiveAmountToPayOffer']);
178
+ }
179
+
180
+ return cbk(null, tokens);
181
+ }],
182
+
136
183
  // Get base ignores
137
184
  getBaseIgnores: [
138
185
  'getChannels',
@@ -185,29 +232,57 @@ module.exports = (args, cbk) => {
185
232
  cbk);
186
233
  }],
187
234
 
235
+ // Get an invoice to pay for an offer
236
+ getOfferInvoice: [
237
+ 'getBaseIgnores',
238
+ 'getOuts',
239
+ 'tokens',
240
+ ({tokens}, cbk) =>
241
+ {
242
+ // Exit early when paying a payment request
243
+ if (!isOffer(args.request)) {
244
+ return cbk();
245
+ }
246
+
247
+ args.logger.info({requesting_invoice_for_offer: true});
248
+
249
+ return getOfferInvoice({
250
+ lnd: args.lnd,
251
+ mtokens: !tokens ? undefined : tokensAsMtokens(tokens),
252
+ offer: args.request,
253
+ payer_note: args.message,
254
+ },
255
+ cbk);
256
+ }],
257
+
188
258
  // Make single-path payment
189
259
  singlePathPay: [
190
260
  'getBaseIgnores',
261
+ 'getOfferInvoice',
191
262
  'getOuts',
192
- ({getBaseIgnores, getOuts}, cbk) =>
263
+ ({getBaseIgnores, getOfferInvoice, getOuts}, cbk) =>
193
264
  {
194
265
  // Exit early when doing a multi-path
195
266
  if (args.max_paths !== singlePath) {
196
267
  return cbk();
197
268
  }
198
269
 
270
+ // An offer is paid with its invoice, which has the message as a note
271
+ const isInvoice = !!getOfferInvoice;
272
+
199
273
  return probeDestination({
200
274
  fs: args.fs,
201
275
  ignore: getBaseIgnores.ignore,
202
276
  in_through: args.in_through,
277
+ invoice: getOfferInvoice,
203
278
  is_real_payment: true,
204
279
  is_strict_max_fee: args.is_strict_max_fee,
205
280
  logger: args.logger,
206
281
  lnd: args.lnd,
207
282
  max_fee: args.max_fee,
208
- message: args.message,
283
+ message: isInvoice ? undefined : args.message,
209
284
  out_through: getOuts.public_keys,
210
- request: args.request,
285
+ request: isInvoice ? undefined : args.request,
211
286
  },
212
287
  cbk);
213
288
  }],
@@ -401,9 +476,10 @@ module.exports = (args, cbk) => {
401
476
 
402
477
  // Final payment details
403
478
  payment: [
479
+ 'getOfferInvoice',
404
480
  'multiPathPay',
405
481
  'singlePathPay',
406
- ({multiPathPay, singlePathPay}, cbk) =>
482
+ ({getOfferInvoice, multiPathPay, singlePathPay}, cbk) =>
407
483
  {
408
484
  const payment = singlePathPay || multiPathPay;
409
485
 
@@ -413,7 +489,19 @@ module.exports = (args, cbk) => {
413
489
  }
414
490
 
415
491
  // The fee of a blinded path payment is a total including the path fee
416
- return cbk(null, withTotalFee(payment));
492
+ const paid = withTotalFee(payment);
493
+
494
+ // Exit early when the payment was not for an offer
495
+ if (!getOfferInvoice) {
496
+ return cbk(null, paid);
497
+ }
498
+
499
+ // The invoice and payer key of a paid offer are kept to prove payment
500
+ return cbk(null, {
501
+ ...paid,
502
+ invoice: getOfferInvoice.invoice,
503
+ payer_key_index: getOfferInvoice.payer_key_index,
504
+ });
417
505
  }],
418
506
  },
419
507
  returnResult({reject, resolve, of: 'payment'}, cbk));
@@ -0,0 +1,105 @@
1
+ const flatten = arr => [].concat(...arr);
2
+
3
+ /** Derive pending forwarding and sending HTLCs from channels
4
+
5
+ {
6
+ channels: [{
7
+ id: <Channel Id String>
8
+ partner_public_key: <Peer Public Key Hex String>
9
+ pending_payments: [{
10
+ id: <Payment Preimage Hash Hex String>
11
+ [in_channel]: <Forward Inbound From Channel Id String>
12
+ [in_payment]: <Payment Index on Inbound Channel Number>
13
+ [is_forward]: <Payment is a Forward Bool>
14
+ is_outgoing: <Payment Is Outgoing Bool>
15
+ [out_channel]: <Forward Outbound To Channel Id String>
16
+ [out_payment]: <Payment Index on Outbound Channel Number>
17
+ [payment]: <Payment Attempt Id Number>
18
+ timeout: <Chain Height Expiration Number>
19
+ tokens: <Payment Tokens Number>
20
+ }]
21
+ }]
22
+ }
23
+
24
+ @returns
25
+ {
26
+ forwarding: [{
27
+ fee: <Routing Fee Tokens Number>
28
+ in_peer: <Forwarding From Peer Public Key Hex String>
29
+ out_peer: <Forwarding To Peer Public Key Hex String>
30
+ payment: <Forwarding Payment Hash Hex String>
31
+ timeout: <Chain Height Expiration Number>
32
+ tokens: <Forwarding Tokens Amount Number>
33
+ }]
34
+ sending: [{
35
+ id: <Sending Payment Hash Hex String>
36
+ out_channel: <Sending Out Channel Id String>
37
+ out_peer: <Sending Out Peer Public Key Hex String>
38
+ timeout: <Sending Timeout Block Height Number>
39
+ tokens: <Sending Tokens Amount Number>
40
+ }]
41
+ }
42
+ */
43
+ module.exports = ({channels}) => {
44
+ // Outgoing HTLCs that are not forwards are payments or probes being sent
45
+ const sending = flatten(channels.map(channel => {
46
+ return channel.pending_payments
47
+ .filter(n => !n.is_forward && !!n.is_outgoing)
48
+ .map(payment => ({
49
+ id: payment.id,
50
+ out_channel: channel.id,
51
+ out_peer: channel.partner_public_key,
52
+ timeout: payment.timeout,
53
+ tokens: payment.tokens,
54
+ }));
55
+ }));
56
+
57
+ // Outgoing forward HTLCs reference the inbound HTLC that they are relaying
58
+ const outbound = flatten(channels.map(channel => {
59
+ return channel.pending_payments
60
+ .filter(n => !!n.is_forward && !!n.is_outgoing && !!n.in_channel)
61
+ .map(payment => ({
62
+ id: payment.id,
63
+ in_channel: payment.in_channel,
64
+ in_payment: payment.in_payment,
65
+ out_channel: channel.id,
66
+ out_peer: channel.partner_public_key,
67
+ tokens: payment.tokens,
68
+ }));
69
+ }));
70
+
71
+ // Pair up outgoing forward HTLCs with the inbound HTLCs they are relaying
72
+ const forwarding = outbound.map(htlc => {
73
+ const inboundChannel = channels.find(n => n.id === htlc.in_channel);
74
+
75
+ // Exit early when the inbound channel is not a known channel
76
+ if (!inboundChannel) {
77
+ return;
78
+ }
79
+
80
+ // The inbound HTLC is the one forwarding to the outbound channel
81
+ const inbound = inboundChannel.pending_payments.find(payment => {
82
+ const isForwardIn = !payment.is_outgoing && !!payment.is_forward;
83
+ const isSameIndex = payment.payment === htlc.in_payment;
84
+ const isToOutChannel = payment.out_channel === htlc.out_channel;
85
+
86
+ return isForwardIn && isToOutChannel && isSameIndex;
87
+ });
88
+
89
+ // Exit early when the inbound HTLC is not present on the inbound channel
90
+ if (!inbound) {
91
+ return;
92
+ }
93
+
94
+ return {
95
+ fee: inbound.tokens - htlc.tokens,
96
+ in_peer: inboundChannel.partner_public_key,
97
+ out_peer: htlc.out_peer,
98
+ payment: htlc.id,
99
+ timeout: inbound.timeout,
100
+ tokens: htlc.tokens,
101
+ };
102
+ });
103
+
104
+ return {sending, forwarding: forwarding.filter(n => !!n)};
105
+ };
@@ -0,0 +1,209 @@
1
+ const {bold} = require('colorette');
2
+ const {formatTokens} = require('ln-sync');
3
+
4
+ const {formatDuration} = require('./../display');
5
+
6
+ const blocksAsMs = blocks => blocks * 1000 * 60 * 10;
7
+ const flatten = arr => [].concat(...arr);
8
+ const isEmoji = /[^\p{L}\p{N}\p{P}\p{Z}{\^\$}]/gu;
9
+ const joinLines = lines => lines.join('\n');
10
+ const joinPath = hops => hops.join(' → ');
11
+ const joinSections = sections => sections.join('\n\n');
12
+ const moreHops = count => `...${count} more...`;
13
+ const nothingPending = 'No pending payments or channels';
14
+ const shortKey = key => key.substring(0, 8);
15
+
16
+ /** Summarize the pending channels and in-flight HTLCs of nodes
17
+
18
+ {
19
+ [is_monochrome]: <Mute Colors Bool>
20
+ [max_relays]: <Maximum Relaying Peers of a Path to Show Number>
21
+ nodes: [{
22
+ closing: [{
23
+ [blocks_until_recovery]: <Blocks Until Pending Balance Recovers Number>
24
+ [close_transaction_id]: <Closing Transaction Id Hex String>
25
+ [peer_alias]: <Peer Alias String>
26
+ peer_public_key: <Peer Public Key Hex String>
27
+ [pending_balance]: <Pending Recovery Tokens Number>
28
+ }]
29
+ forwarding: [{
30
+ fee: <Routing Fee Tokens Number>
31
+ [in_peer_alias]: <Inbound Peer Alias String>
32
+ in_peer_public_key: <Inbound Peer Public Key Hex String>
33
+ [out_peer_alias]: <Outbound Peer Alias String>
34
+ out_peer_public_key: <Outbound Peer Public Key Hex String>
35
+ tokens: <Forwarding Tokens Number>
36
+ }]
37
+ opening: [{
38
+ capacity: <Channel Capacity Tokens Number>
39
+ is_partner_initiated: <Peer Is Opening The Channel Bool>
40
+ [peer_alias]: <Peer Alias String>
41
+ peer_public_key: <Peer Public Key Hex String>
42
+ transaction_id: <Funding Transaction Id Hex String>
43
+ }]
44
+ sending: [{
45
+ [fee]: <Routing Fee Tokens Number>
46
+ hops: [{
47
+ [alias]: <Hop Node Alias String>
48
+ public_key: <Hop Node Public Key Hex String>
49
+ }]
50
+ is_rebalance: <Payment Is Going Back To The Node Itself Bool>
51
+ tokens: <Sending Tokens Number>
52
+ }]
53
+ [alias]: <Node Alias String>
54
+ public_key: <Node Identity Public Key Hex String>
55
+ }]
56
+ [tagged]: [{
57
+ icons: [<Icon String>]
58
+ public_key: <Public Key Hex String>
59
+ }]
60
+ }
61
+
62
+ @returns
63
+ {
64
+ summary: <Pending Items Summary String>
65
+ }
66
+ */
67
+ module.exports = args => {
68
+ // Zero or absent tokens have no amount to display
69
+ const amount = tokens => {
70
+ const {display} = formatTokens({
71
+ tokens,
72
+ is_monochrome: args.is_monochrome,
73
+ });
74
+
75
+ return display.trim();
76
+ };
77
+
78
+ // Paths may collapse their relaying peers to keep the path short
79
+ const path = hops => {
80
+ const [first, ...others] = hops;
81
+
82
+ const [last, ...reversedRelays] = others.slice().reverse();
83
+
84
+ const relays = reversedRelays.reverse();
85
+
86
+ // Exit early when there is no limit or the relays are within the limit
87
+ if (args.max_relays === undefined || !others.length) {
88
+ return joinPath(hops);
89
+ }
90
+
91
+ if (relays.length <= args.max_relays) {
92
+ return joinPath(hops);
93
+ }
94
+
95
+ const shown = relays.slice(Number(), args.max_relays);
96
+
97
+ const hidden = [moreHops(relays.length - shown.length)];
98
+
99
+ return joinPath([first].concat(shown).concat(hidden).concat(last));
100
+ };
101
+
102
+ // Nodes are named with their alias and a short key
103
+ const named = (alias, key) => {
104
+ return [alias, shortKey(key)].filter(n => !!n).join(' ');
105
+ };
106
+
107
+ // Other nodes are named with their tag icons and no emojis of their own
108
+ const peer = (alias, key) => {
109
+ const regularAlias = (alias || String()).replace(isEmoji, String()).trim();
110
+ const tags = (args.tagged || []).find(n => n.public_key === key);
111
+
112
+ const icons = !tags ? [] : tags.icons;
113
+
114
+ return [].concat(icons).concat(named(regularAlias, key)).join(' ');
115
+ };
116
+
117
+ const sections = args.nodes.map(node => {
118
+ // Channels that are waiting for their funding transaction to confirm
119
+ const opening = node.opening.map(channel => {
120
+ const direction = !channel.is_partner_initiated ? 'outbound' : 'inbound';
121
+ const size = amount(channel.capacity);
122
+ const tx = channel.transaction_id;
123
+ const withPeer = peer(channel.peer_alias, channel.peer_public_key);
124
+
125
+ const action = `${direction} ${size} channel with ${withPeer}`;
126
+
127
+ return `Waiting for ${action} to confirm: ${tx}`;
128
+ });
129
+
130
+ // Channels that are closing, waiting on a timelock or on confirmation
131
+ const closing = node.closing.map(channel => {
132
+ const blocks = channel.blocks_until_recovery;
133
+ const funds = amount(channel.pending_balance);
134
+ const tx = channel.close_transaction_id;
135
+ const withPeer = peer(channel.peer_alias, channel.peer_public_key);
136
+
137
+ // Exit early when the funds are timelocked for some blocks
138
+ if (!!blocks && !!funds) {
139
+ const wait = formatDuration({ms: blocksAsMs(blocks)}).display;
140
+
141
+ const action = `recover ${funds} in ${wait} from closing channel`;
142
+
143
+ return `Waiting to ${action} with ${withPeer}`;
144
+ }
145
+
146
+ const confirm = !tx ? String() : `: ${tx}`;
147
+ const recover = `recover ${funds} from closing channel`;
148
+
149
+ const action = !funds ? 'close channel' : recover;
150
+
151
+ return `Waiting to ${action} with ${withPeer}${confirm}`;
152
+ });
153
+
154
+ // HTLCs that are being relayed from one peer to another
155
+ const forwarding = node.forwarding.map(forward => {
156
+ const fee = !forward.fee ? String() : ` for ${amount(forward.fee)} fee`;
157
+ const from = peer(forward.in_peer_alias, forward.in_peer_public_key);
158
+ const to = peer(forward.out_peer_alias, forward.out_peer_public_key);
159
+ const tokens = amount(forward.tokens);
160
+
161
+ return `Forwarding ${tokens}${fee} from ${from} to ${to}`;
162
+ });
163
+
164
+ // Payments or probes that are going out along a path of peers
165
+ const sending = node.sending.map(payment => {
166
+ const fee = !payment.fee ? String() : ` for ${amount(payment.fee)} fee`;
167
+ const hops = payment.hops.map(hop => peer(hop.alias, hop.public_key));
168
+ const tokens = amount(payment.tokens);
169
+
170
+ // Exit early when the payment is a rebalance that comes back to self
171
+ if (!!payment.is_rebalance) {
172
+ // The final hop of a rebalance is the node itself and not a peer
173
+ const [ownNode, ...route] = hops.slice().reverse();
174
+
175
+ return `Rebalancing ${tokens}${fee} out ${path(route.reverse())}`;
176
+ }
177
+
178
+ return `Probing ${tokens}${fee} out ${path(hops)}`;
179
+ });
180
+
181
+ // Sections go from the slowest to change to the fastest to change
182
+ return {
183
+ lines: flatten([closing, opening, forwarding, sending]),
184
+ title: named(node.alias, node.public_key),
185
+ };
186
+ });
187
+
188
+ const pending = sections.filter(n => !!n.lines.length);
189
+
190
+ // Exit early when there is nothing pending on any node
191
+ if (!pending.length) {
192
+ return {summary: nothingPending};
193
+ }
194
+
195
+ // Exit early when there is a single node, there is no need for a title
196
+ if (args.nodes.length === [args.nodes].length) {
197
+ const [node] = pending;
198
+
199
+ return {summary: joinLines(node.lines)};
200
+ }
201
+
202
+ const titled = pending.map(node => {
203
+ const title = !!args.is_monochrome ? node.title : bold(node.title);
204
+
205
+ return joinLines([title].concat(node.lines));
206
+ });
207
+
208
+ return {summary: joinSections(titled)};
209
+ };