ln-service 57.18.0 → 57.20.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,5 +1,18 @@
1
1
  # Versions
2
2
 
3
+ ## 57.20.0
4
+
5
+ - `payViaPaymentRequest`, `subscribeToPayViaRequest`: Add `index` to response
6
+ for payment offset number in payments set
7
+
8
+ ## 57.19.0
9
+
10
+ - `createInvoice`: add `is_encrypting_routes` to enable blinded paths feature
11
+
12
+ - `pay`, `subscribeToPastPayment`, `subscribeToPayViaDetails`,
13
+ `subscribeToPayViaRequest`, `subscribeToPayments`: Add `is_canceled` for
14
+ when the payment loop was explicitly canceled.
15
+
3
16
  ## 57.18.0
4
17
 
5
18
  - `getMinimumRelayFee`: Add method to get the chain backend minimum relay fee
package/README.md CHANGED
@@ -830,6 +830,7 @@ Requires `address:write`, `invoices:write` permission
830
830
  [description]: <Invoice Description String>
831
831
  [description_hash]: <Hashed Description of Payment Hex String>
832
832
  [expires_at]: <Expires At ISO 8601 Date String>
833
+ [is_encrypting_routes]: <Use Blinded Paths For Inbound Routes Bool>
833
834
  [is_fallback_included]: <Is Fallback Address Included Bool>
834
835
  [is_fallback_nested]: <Is Fallback Address Nested Bool>
835
836
  [is_including_private_channels]: <Invoice Includes Private Channels Bool>
@@ -3792,10 +3793,13 @@ Requires `info:read` permission
3792
3793
  type: <Feature Type String>
3793
3794
  }]
3794
3795
  is_synced_to_chain: <Is Synced To Chain Bool>
3796
+ [is_synced_to_graph]: <Is Synced To Network Graph Bool>
3795
3797
  latest_block_at: <Latest Known Block At Date String>
3796
3798
  peers_count: <Peer Count Number>
3797
3799
  pending_channels_count: <Pending Channels Count Number>
3798
3800
  public_key: <Public Key String>
3801
+ [uris]: [<The URIs of the Node String>]
3802
+ version: <LND Version String>
3799
3803
  }
3800
3804
 
3801
3805
  Example:
@@ -4483,6 +4487,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
4483
4487
  timeout: <First Route Timeout Block Height Number>
4484
4488
  }]
4485
4489
  id: <Payment Hash Hex String>
4490
+ index: <Payment Index Offset Number String>
4486
4491
  mtokens: <Total Millitokens Paid String>
4487
4492
  paths: [{
4488
4493
  fee_mtokens: <Total Fee Millitokens Paid String>
@@ -6434,6 +6439,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6434
6439
  @event 'failed'
6435
6440
  {
6436
6441
  id: <Payment Hash Hex String>
6442
+ is_canceled: <Payment Canceled Bool>
6437
6443
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6438
6444
  is_invalid_payment: <Failed Due to Invalid Payment Bool>
6439
6445
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
@@ -6578,6 +6584,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6578
6584
  timeout: <Timeout Block Height Number>
6579
6585
  }]
6580
6586
  id: <Payment Hash Hex String>
6587
+ index: <Payment Index Offset Number String>
6581
6588
  mtokens: <Total Millitokens Paid String>
6582
6589
  safe_fee: <Payment Forwarding Fee Rounded Up Tokens Number>
6583
6590
  safe_tokens: <Payment Tokens Rounded Up Number>
@@ -6589,6 +6596,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6589
6596
  @event 'failed'
6590
6597
  {
6591
6598
  id: <Payment Hash Hex String>
6599
+ is_canceled: <Payment Canceled Bool>
6592
6600
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6593
6601
  is_invalid_payment: <Failed Due to Invalid Payment Bool>
6594
6602
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
@@ -6619,6 +6627,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6619
6627
  created_at: <Payment Created At ISO 8601 Date String>
6620
6628
  destination: <Payment Destination Hex String>
6621
6629
  id: <Payment Hash Hex String>
6630
+ index: <Payment Index Offset Number String>
6622
6631
  mtokens: <Total Millitokens Pending String>
6623
6632
  paths: [{
6624
6633
  fee: <Total Fee Tokens Pending Number>
@@ -6923,6 +6932,7 @@ Note: Method not supported on LND 0.15.5 and below
6923
6932
  @event 'failed'
6924
6933
  {
6925
6934
  id: <Payment Hash Hex String>
6935
+ is_canceled: <Payment Canceled Bool>
6926
6936
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6927
6937
  is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
6928
6938
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
package/package.json CHANGED
@@ -9,14 +9,14 @@
9
9
  "dependencies": {
10
10
  "bolt07": "1.9.4",
11
11
  "invoices": "3.0.0",
12
- "lightning": "10.18.0",
12
+ "lightning": "10.20.0",
13
13
  "macaroon": "3.0.4"
14
14
  },
15
15
  "description": "Interaction helper for your Lightning Network daemon",
16
16
  "devDependencies": {
17
17
  "@alexbosworth/blockchain": "2.0.0",
18
18
  "@alexbosworth/node-fetch": "2.6.2",
19
- "async": "3.2.5",
19
+ "async": "3.2.6",
20
20
  "asyncjs-util": "1.2.12",
21
21
  "bip32": "4.0.0",
22
22
  "bip66": "2.0.0",
@@ -24,7 +24,7 @@
24
24
  "bn.js": "5.2.1",
25
25
  "bs58check": "4.0.0",
26
26
  "ecpair": "2.1.0",
27
- "ln-docker-daemons": "6.0.22",
27
+ "ln-docker-daemons": "6.0.23",
28
28
  "p2tr": "2.0.0",
29
29
  "portfinder": "1.0.32",
30
30
  "psbt": "3.0.0",
@@ -32,7 +32,7 @@
32
32
  "secp256k1": "5.0.0",
33
33
  "tiny-secp256k1": "2.2.3",
34
34
  "uuid": "10.0.0",
35
- "varuint-bitcoin": "1.1.2"
35
+ "varuint-bitcoin": "2.0.0"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18"
@@ -74,5 +74,5 @@
74
74
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
75
75
  "test": "echo $DOCKER_LND_VERSION && node test/runner"
76
76
  },
77
- "version": "57.18.0"
77
+ "version": "57.20.0"
78
78
  }
@@ -0,0 +1,66 @@
1
+ const asyncRetry = require('async/retry');
2
+ const {strictEqual} = require('node:assert').strict;
3
+ const test = require('node:test');
4
+
5
+ const {setupChannel} = require('ln-docker-daemons');
6
+ const {spawnLightningCluster} = require('ln-docker-daemons');
7
+
8
+ const {addPeer} = require('./../../');
9
+ const {createInvoice} = require('./../../');
10
+ const {decodePaymentRequest} = require('./../../');
11
+ const {getWalletInfo} = require('./../../');
12
+ const {parsePaymentRequest} = require('./../../');
13
+ const {pay} = require('./../../');
14
+
15
+ const count = 100;
16
+ const expiry = () => new Date(Date.now() + (4 * 60 * 60 * 1000)).toISOString();
17
+ const give = 500000;
18
+ const interval = 100;
19
+ const size = 3;
20
+ const times = 10000;
21
+ const tokens = 100;
22
+
23
+ // Paying to an encrypted routes invoice should result in a payment
24
+ test(`Create an invoice`, async () => {
25
+ const {kill, nodes} = await spawnLightningCluster({size});
26
+
27
+ const [{generate, lnd}, target, remote] = nodes;
28
+
29
+ await generate({count});
30
+
31
+ try {
32
+ await setupChannel({generate, lnd, give_tokens: give, to: target});
33
+
34
+ await addPeer({lnd, public_key: remote.id, socket: remote.socket});
35
+
36
+ await setupChannel({
37
+ generate: target.generate,
38
+ give_tokens: give,
39
+ lnd: target.lnd,
40
+ to: remote,
41
+ });
42
+
43
+ await asyncRetry({interval, times}, async () => {
44
+ await generate({});
45
+
46
+ const invoice = await createInvoice({
47
+ lnd,
48
+ tokens,
49
+ expires_at: expiry(),
50
+ is_encrypting_routes: true,
51
+ });
52
+
53
+ await addPeer({lnd, public_key: remote.id, socket: remote.socket});
54
+
55
+ await pay({lnd: remote.lnd, request: invoice.request});
56
+ });
57
+
58
+ await kill({});
59
+ } catch (err) {
60
+ await kill({});
61
+
62
+ strictEqual(err, null, 'Expected no error in create invoice');
63
+ }
64
+
65
+ return;
66
+ });
@@ -114,6 +114,7 @@ test('Get failed payments', async () => {
114
114
  {
115
115
  failed: {
116
116
  id: payment.id,
117
+ is_canceled: false,
117
118
  is_insufficient_balance: false,
118
119
  is_invalid_payment: false,
119
120
  is_pathfinding_timeout: false,
@@ -151,11 +152,13 @@ test('Get failed payments', async () => {
151
152
  deepStrictEqual(payment.safe_tokens, invoice.tokens, 'Safe tokens');
152
153
  deepStrictEqual(payment.tokens, invoice.tokens, 'Failed has tokens');
153
154
  }
155
+
156
+ await kill({});
154
157
  } catch (err) {
158
+ await kill({});
159
+
155
160
  strictEqual(err, null, 'Expected no error');
156
161
  }
157
162
 
158
- await kill({});
159
-
160
163
  return;
161
164
  });
@@ -92,6 +92,7 @@ test(`Pay via payment request`, async () => {
92
92
  equal(paid.fee, 1, 'Fee tokens paid');
93
93
  equal(paid.fee_mtokens, '1000', 'Fee mtokens tokens paid');
94
94
  equal(paid.id, invoice.id, 'Payment hash is equal on both sides');
95
+ equal(paid.index, '2', 'Got payment offset index');
95
96
  equal(paid.mtokens, '101000', 'Paid mtokens');
96
97
  equal(paid.secret, invoice.secret, 'Paid for invoice secret');
97
98