ln-service 52.14.1 → 52.15.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Versions
2
2
 
3
- ## 52.14.1
3
+ ## 52.15.0
4
+
5
+ - `getPayment`, `subscribeToPastPayment`: Add `pending` for pending payment details
6
+
7
+ ## 52.14.4
4
8
 
5
9
  - `probeForRoute`, `subscribeToProbeForRoute`, `subscribeToPayViaRoutes`,
6
10
  `payViaRoutes`: When probing (no hash), delete the payment failure record after the probe
package/README.md CHANGED
@@ -9,7 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
- - v0.13.0-beta to v0.13.3-beta
12
+ - v0.13.0-beta to v0.13.4-beta
13
13
  - v0.12.0-beta to v0.12.1-beta
14
14
  - v0.11.0-beta to v0.11.1-beta
15
15
 
@@ -806,7 +806,7 @@ Requires `offchain:write` permission
806
806
 
807
807
  Method not supported on LND 0.12.1 or below
808
808
 
809
- `id` is not supported on LND 0.13.3 or below
809
+ `id` is not supported on LND 0.13.4 or below
810
810
 
811
811
  {
812
812
  [id]: <Delete Only Failed Attempt Records For Payment With Hash Hex String>
@@ -874,7 +874,7 @@ Delete a payment record
874
874
 
875
875
  Requires `offchain:write` permission
876
876
 
877
- Note: this method is not supported on LND 0.13.3 and below
877
+ Note: this method is not supported on LND 0.13.4 and below
878
878
 
879
879
  {
880
880
  id: <Payment Preimage Hash Hex String>
@@ -2324,6 +2324,30 @@ Requires `offchain:read` permission
2324
2324
  timeout: <Expiration Block Height Number>
2325
2325
  tokens: <Total Tokens Paid Number>
2326
2326
  }
2327
+ [pending]: {
2328
+ created_at: <Payment Created At ISO 8601 Date String>
2329
+ destination: <Payment Destination Hex String>
2330
+ id: <Payment Hash Hex String>
2331
+ mtokens: <Total Millitokens Pending String>
2332
+ paths: [{
2333
+ fee_mtokens: <Total Fee Millitokens Paid String>
2334
+ hops: [{
2335
+ channel: <Standard Format Channel Id String>
2336
+ channel_capacity: <Channel Capacity Tokens Number>
2337
+ fee: <Fee Tokens Rounded Down Number>
2338
+ fee_mtokens: <Fee Millitokens String>
2339
+ forward: <Forwarded Tokens Number>
2340
+ forward_mtokens: <Forward Millitokens String>
2341
+ public_key: <Public Key Hex String>
2342
+ timeout: <Timeout Block Height Number>
2343
+ }]
2344
+ mtokens: <Total Millitokens Pending String>
2345
+ }]
2346
+ [request]: <BOLT 11 Encoded Payment Request String>
2347
+ safe_tokens: <Payment Tokens Rounded Up Number>
2348
+ [timeout]: <Expiration Block Height Number>
2349
+ tokens: <Total Tokens Pending Number>
2350
+ }
2327
2351
  }
2328
2352
 
2329
2353
  Example:
@@ -2908,7 +2932,7 @@ Get wallet status.
2908
2932
 
2909
2933
  This method is not supported on LND 0.12.1 and below
2910
2934
 
2911
- `is_ready` is not supported on LND 0.13.3 and below
2935
+ `is_ready` is not supported on LND 0.13.4 and below
2912
2936
 
2913
2937
  {
2914
2938
  lnd: <Unauthenticated LND API Object>
@@ -4066,7 +4090,7 @@ If specified, message type is expected to be between 32768 and 65535
4066
4090
 
4067
4091
  Message data should not be larger than 65533 bytes
4068
4092
 
4069
- Note: this method is not supported in LND versions 0.13.3 and below
4093
+ Note: this method is not supported in LND versions 0.13.4 and below
4070
4094
 
4071
4095
  Requires `offchain:write` permission
4072
4096
 
@@ -4736,7 +4760,7 @@ Subscribe to HTLC events
4736
4760
 
4737
4761
  Requires `offchain:read` permission
4738
4762
 
4739
- Note: LND 0.13.3 and below do not return `secret` for forwards
4763
+ Note: LND 0.13.4 and below do not return `secret` for forwards
4740
4764
 
4741
4765
  {
4742
4766
  lnd: <Authenticated LND API Object>
@@ -5138,7 +5162,34 @@ Requires `offchain:read` permission
5138
5162
  }
5139
5163
 
5140
5164
  @event 'paying'
5141
- {}
5165
+ {
5166
+ created_at: <Payment Created At ISO 8601 Date String>
5167
+ destination: <Payment Destination Hex String>
5168
+ id: <Payment Hash Hex String>
5169
+ mtokens: <Total Millitokens Pending String>
5170
+ paths: [{
5171
+ fee: <Total Fee Tokens Pending Number>
5172
+ fee_mtokens: <Total Fee Millitokens Pending String>
5173
+ hops: [{
5174
+ channel: <Standard Format Channel Id String>
5175
+ channel_capacity: <Channel Capacity Tokens Number>
5176
+ fee: <Fee Tokens Rounded Down Number>
5177
+ fee_mtokens: <Fee Millitokens String>
5178
+ forward: <Forward Tokens Number>
5179
+ forward_mtokens: <Forward Millitokens String>
5180
+ public_key: <Public Key Hex String>
5181
+ timeout: <Timeout Block Height Number>
5182
+ }]
5183
+ mtokens: <Total Millitokens Pending String>
5184
+ safe_fee: <Total Fee Tokens Pending Rounded Up Number>
5185
+ safe_tokens: <Total Tokens Pending, Rounded Up Number>
5186
+ timeout: <Expiration Block Height Number>
5187
+ }]
5188
+ [request]: <BOLT 11 Encoded Payment Request String>
5189
+ safe_tokens: <Total Tokens Pending, Rounded Up Number>
5190
+ [timeout]: <Expiration Block Height Number>
5191
+ tokens: <Total Tokens Pending Rounded Down Number>
5192
+ }
5142
5193
 
5143
5194
  Example:
5144
5195
 
@@ -5156,7 +5207,7 @@ Subscribe to successful outgoing payments
5156
5207
 
5157
5208
  Requires `offchain:read` permission
5158
5209
 
5159
- Note: Method not supported on LND 0.13.3 and below
5210
+ Note: Method not supported on LND 0.13.4 and below
5160
5211
 
5161
5212
  {
5162
5213
  lnd: <Authenticated LND API Object>
@@ -5605,7 +5656,7 @@ Subscribe to incoming peer messages
5605
5656
 
5606
5657
  Requires `offchain:read` permission
5607
5658
 
5608
- This method is not supported in LND 0.13.3 and below
5659
+ This method is not supported in LND 0.13.4 and below
5609
5660
 
5610
5661
  {
5611
5662
  lnd: <Authenticated LND API Object>
@@ -5851,7 +5902,7 @@ Requires `macaroon:write` permission
5851
5902
 
5852
5903
  LND must be running with "RPC middleware" enabled: `rpcmiddleware.enable=1`
5853
5904
 
5854
- This method is not supported in LND 0.13.3 and below
5905
+ This method is not supported in LND 0.13.4 and below
5855
5906
 
5856
5907
  {
5857
5908
  [id]: <RPC Middleware Interception Name String>
@@ -5870,7 +5921,7 @@ This method is not supported in LND 0.13.3 and below
5870
5921
  @event 'close_channel_request'
5871
5922
  {
5872
5923
  accept: ({}, [cbk]) => {}
5873
- id: <Request Id Number>
5924
+ id: <Message Id Number>
5874
5925
  macaroon: <Base64 Encoded Macaroon String>
5875
5926
  reject: ({message: <Rejection String>}, [cbk]) => {}
5876
5927
  request: {
@@ -5888,7 +5939,7 @@ This method is not supported in LND 0.13.3 and below
5888
5939
  @event 'open_channel_request'
5889
5940
  {
5890
5941
  accept: ({}, [cbk]) => {}
5891
- id: <Request Id Number>
5942
+ id: <Message Id Number>
5892
5943
  macaroon: <Base64 Encoded Macaroon String>
5893
5944
  reject: ({message: <Rejection String>}, [cbk]) => {}
5894
5945
  request: {
@@ -5909,7 +5960,7 @@ This method is not supported in LND 0.13.3 and below
5909
5960
  @event 'pay_via_route_request'
5910
5961
  {
5911
5962
  accept: ({}, [cbk]) => {}
5912
- id: <Request Id Number>
5963
+ id: <Message Id Number>
5913
5964
  macaroon: <Base64 Encoded Macaroon String>
5914
5965
  reject: ({message: <Rejection String>}, [cbk]) => {}
5915
5966
  request: {
@@ -5939,14 +5990,16 @@ This method is not supported in LND 0.13.3 and below
5939
5990
 
5940
5991
  @event 'request'
5941
5992
  {
5942
- id: <Request Id Number>
5993
+ call: <Call Identifier Number>
5994
+ id: <Message Id Number>
5943
5995
  [macaroon]: <Base64 Encoded Macaroon String>
5944
5996
  [uri]: <RPC URI String>
5945
5997
  }
5946
5998
 
5947
5999
  @event 'response'
5948
6000
  {
5949
- id: <Request Id Number>
6001
+ call: <Call Identifier Number>
6002
+ id: <Message Id Number>
5950
6003
  [macaroon]: <Base64 Encoded Macaroon String>
5951
6004
  [uri]: <RPC URI String>
5952
6005
  }
@@ -6016,7 +6069,7 @@ Subscribe to wallet status events
6016
6069
 
6017
6070
  This method is not supported on LND 0.12.1 and below
6018
6071
 
6019
- `ready` is not supported on LND 0.13.3 and below
6072
+ `ready` is not supported on LND 0.13.4 and below
6020
6073
 
6021
6074
  {
6022
6075
  lnd: <Unauthenticated LND API Object>
@@ -6256,7 +6309,7 @@ Setting both `base_fee_tokens` and `base_fee_mtokens` is not supported
6256
6309
 
6257
6310
  Requires `offchain:write` permission
6258
6311
 
6259
- `failures` are not returned on LND 0.13.3 and below
6312
+ `failures` are not returned on LND 0.13.4 and below
6260
6313
 
6261
6314
  {
6262
6315
  [base_fee_mtokens]: <Base Fee Millitokens Charged String>
@@ -6293,7 +6346,7 @@ await updateRoutingFees({lnd, fee_rate: 2500});
6293
6346
 
6294
6347
  Verify an access token has a given set of permissions
6295
6348
 
6296
- Note: this method is not supported in LND versions 0.13.3 and below
6349
+ Note: this method is not supported in LND versions 0.13.4 and below
6297
6350
 
6298
6351
  Requires `macaroon:read` permission
6299
6352
 
package/package.json CHANGED
@@ -10,8 +10,8 @@
10
10
  "bolt07": "1.7.4",
11
11
  "cors": "2.8.5",
12
12
  "express": "4.17.1",
13
- "invoices": "2.0.0",
14
- "lightning": "4.12.1",
13
+ "invoices": "2.0.1",
14
+ "lightning": "4.14.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.2.3"
@@ -21,7 +21,7 @@
21
21
  "@alexbosworth/tap": "15.0.10",
22
22
  "@alexbosworth/node-fetch": "2.6.2",
23
23
  "async": "3.2.2",
24
- "asyncjs-util": "1.2.6",
24
+ "asyncjs-util": "1.2.7",
25
25
  "bip66": "1.1.5",
26
26
  "bitcoinjs-lib": "5.2.0",
27
27
  "bn.js": "5.2.0",
@@ -61,5 +61,5 @@
61
61
  "tower_server-integration-tests": "tap --no-coverage test/tower_serverrpc-integration/*.js",
62
62
  "wallet-integration-tests": "tap --no-coverage test/walletrpc-integration/*.js"
63
63
  },
64
- "version": "52.14.1"
64
+ "version": "52.15.0"
65
65
  }
@@ -33,7 +33,7 @@ test('Delete payment', async ({afterEach, fail, end, equal, strictSame}) => {
33
33
 
34
34
  const priorLength = (await getPayments({lnd})).payments.length;
35
35
 
36
- // LND 0.13.3 and below do not support deletePayment
36
+ // LND 0.13.4 and below do not support deletePayment
37
37
  try {
38
38
  await deletePayment({lnd, id: invoice.id});
39
39
  } catch (err) {
@@ -123,6 +123,7 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
123
123
  is_failed: true,
124
124
  is_pending: false,
125
125
  payment: undefined,
126
+ pending: undefined,
126
127
  },
127
128
  'Got failed state'
128
129
  );
@@ -15,7 +15,6 @@ test(`Get network info`, async ({end, equal}) => {
15
15
  equal(result.max_channel_size, 0, 'Maximum channel size');
16
16
  equal(result.median_channel_size, 0, 'Median channel size');
17
17
  equal(result.min_channel_size, 0, 'Minimum channel size');
18
- equal(result.node_count, 1, 'Node count');
19
18
  equal(result.not_recently_updated_policy_count, 0, 'Not updated count');
20
19
  equal(result.total_capacity, 0, 'Total capacity');
21
20
 
@@ -60,7 +60,6 @@ test(`Pay private invoice`, async ({end, equal, strictSame}) => {
60
60
  to: cluster.remote,
61
61
  });
62
62
 
63
-
64
63
  await addPeer({
65
64
  lnd,
66
65
  public_key: cluster.remote.public_key,
@@ -23,7 +23,7 @@ test(`Send peer message`, async ({end, equal, strictSame}) => {
23
23
  } catch (err) {
24
24
  const [code] = err;
25
25
 
26
- // Send message to peer is not supported on LND 0.13.3 or lower
26
+ // Send message to peer is not supported on LND 0.13.4 or lower
27
27
  if (code === 501) {
28
28
  await cluster.kill({});
29
29
 
@@ -23,7 +23,7 @@ test(`Subscribe to peer messages`, async ({end, equal, strictSame}) => {
23
23
  } catch (err) {
24
24
  const [code] = err;
25
25
 
26
- // Send message to peer is not supported on LND 0.13.3 or lower
26
+ // Send message to peer is not supported on LND 0.13.4 or lower
27
27
  if (code === 501) {
28
28
  await cluster.kill({});
29
29
 
@@ -23,7 +23,7 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
23
23
  }
24
24
  })();
25
25
 
26
- // LND 0.13.3 and below do not support rpc interception
26
+ // LND 0.13.4 and below do not support rpc interception
27
27
  if (!spawned) {
28
28
  return end();
29
29
  }
@@ -71,7 +71,7 @@ test(`Update routing fees`, async ({end, equal, strictSame}) => {
71
71
  transaction_vout: 1,
72
72
  }];
73
73
 
74
- // Failures is not supported on LND 0.13.3 and below
74
+ // Failures is not supported on LND 0.13.4 and below
75
75
  if (!!failures.length) {
76
76
  strictSame(failures, expectedFailures, 'Got expected failures');
77
77
  }
@@ -16,7 +16,7 @@ test(`Verify access`, async ({end, equal, rejects, strictSame}) => {
16
16
 
17
17
  const {macaroon} = await grantAccess({lnd, permissions});
18
18
 
19
- // verifyAccess is not supported on LND 0.13.3 and below
19
+ // verifyAccess is not supported on LND 0.13.4 and below
20
20
  try {
21
21
  const validity = await verifyAccess({lnd, macaroon, permissions});
22
22
 
@@ -86,13 +86,18 @@ test(`Get sweep transactions`, async ({end, equal}) => {
86
86
  equal(!!transaction.confirmation_count, true, 'Sweep confirm count');
87
87
  equal(!!transaction.confirmation_height, true, 'Sweep confirm height');
88
88
  equal(!!transaction.created_at, true, 'Sweep creation date');
89
- equal(transaction.description, undefined, 'Sweep has description');
90
89
  equal(transaction.fee, undefined, 'Sweep fee is undefined');
91
90
  equal(transaction.id.length, 64, 'Sweep has transaction id');
92
91
  equal(transaction.is_confirmed, true, 'Sweep is confirmed');
93
92
  equal(transaction.output_addresses.length, 1, 'Sweep has out address');
94
93
  equal(!!transaction.transaction.length, true, 'Sweep has transaction');
95
94
 
95
+ if (!!transaction.description) {
96
+ equal(transaction.description, '0:sweep', 'Sweep has description');
97
+ } else {
98
+ equal(transaction.description, undefined, 'Sweep has description');
99
+ }
100
+
96
101
  await cluster.kill({});
97
102
 
98
103
  return end();
@@ -6,6 +6,7 @@ const {createInvoice} = require('./../../');
6
6
  const {deleteForwardingReputations} = require('./../../');
7
7
  const {getHeight} = require('./../../');
8
8
  const {getInvoice} = require('./../../');
9
+ const {getPayment} = require('./../../');
9
10
  const {getWalletVersion} = require('./../../');
10
11
  const {payViaPaymentRequest} = require('./../../');
11
12
  const {subscribeToForwardRequests} = require('./../../');
@@ -15,7 +16,7 @@ const {waitForRoute} = require('./../macros');
15
16
  const tokens = 100;
16
17
 
17
18
  // Paying an invoice should settle the invoice
18
- test(`Pay via payment request`, async ({end, equal, rejects}) => {
19
+ test(`Pay via payment request`, async ({end, equal, rejects, strictSame}) => {
19
20
  const cluster = await createCluster({});
20
21
 
21
22
  const {lnd} = cluster.control;
@@ -71,6 +72,53 @@ test(`Pay via payment request`, async ({end, equal, rejects}) => {
71
72
  const sub = subscribeToForwardRequests({lnd: cluster.target.lnd});
72
73
 
73
74
  sub.once('forward_request', async forward => {
75
+ const {pending} = await getPayment({lnd, id: invoice.id});
76
+
77
+ equal(pending.destination, cluster.remote.public_key, 'Pending remote');
78
+ equal(!!pending.created_at, true, 'Has creation date');
79
+ equal(pending.id, invoice.id, 'Payment id is present');
80
+ equal(pending.mtokens, invoice.mtokens, 'Pending payment mtokens');
81
+
82
+ strictSame(
83
+ pending.paths,
84
+ [{
85
+ fee: 1,
86
+ fee_mtokens: '1000',
87
+ hops: [
88
+ {
89
+ channel: forward.in_channel,
90
+ channel_capacity: 1e6,
91
+ fee: 1,
92
+ fee_mtokens: '1000',
93
+ forward: 100,
94
+ forward_mtokens: '100000',
95
+ public_key: cluster.target.public_key,
96
+ timeout: 497,
97
+ },
98
+ {
99
+ channel: forward.out_channel,
100
+ channel_capacity: 1e6,
101
+ fee: 0,
102
+ fee_mtokens: '0',
103
+ forward: 100,
104
+ forward_mtokens: '100000',
105
+ public_key: cluster.remote.public_key,
106
+ timeout: 497,
107
+ },
108
+ ],
109
+ mtokens: '101000',
110
+ payment: invoice.payment,
111
+ timeout: 537,
112
+ tokens: 101,
113
+ total_mtokens: '100000',
114
+ }],
115
+ 'Paths are present'
116
+ );
117
+
118
+ equal(pending.request, invoice.request, 'Pending pay of request');
119
+ equal(pending.timeout, 537, 'Pending timeout');
120
+ equal(pending.tokens, invoice.tokens, 'Pending pay of invoice tokens');
121
+
74
122
  const info = await getHeight({lnd: cluster.target.lnd});
75
123
 
76
124
  equal(forward.cltv_delta, 40, 'Forward has CLTV delta');
@@ -54,7 +54,7 @@ test(`Subscribe to past payment`, async ({end, rejects, strictSame}) => {
54
54
 
55
55
  [sub, sub2].forEach(n => n.removeAllListeners());
56
56
 
57
- // LND 0.13.3 and below do not support preimages in forward notifications
57
+ // LND 0.13.4 and below do not support preimages in forward notifications
58
58
  if (!!sent && !!sent.secret) {
59
59
  strictSame(got, payment, 'Payment subscription notifies of payment');
60
60
  }