ln-service 57.17.0 → 57.19.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,9 +1,21 @@
1
1
  # Versions
2
2
 
3
+ ## 57.19.0
4
+
5
+ - `createInvoice`: add `is_encrypting_routes` to enable blinded paths feature
6
+
7
+ - `pay`, `subscribeToPastPayment`, `subscribeToPayViaDetails`,
8
+ `subscribeToPayViaRequest`, `subscribeToPayments`: Add `is_canceled` for
9
+ when the payment loop was explicitly canceled.
10
+
11
+ ## 57.18.0
12
+
13
+ - `getMinimumRelayFee`: Add method to get the chain backend minimum relay fee
14
+
3
15
  ## 57.17.0
4
16
 
5
17
  - `getFeeRates`: Add support for `inbound_base_discount_mtokens`,
6
- 'inbound_rate_discount` for inbound fee policy discounts
18
+ `inbound_rate_discount` for inbound fee policy discounts
7
19
 
8
20
  ## 57.16.0
9
21
 
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>
@@ -2732,6 +2733,25 @@ const allowedMethods = methods.filter(method => {
2732
2733
  });
2733
2734
  ```
2734
2735
 
2736
+ ### getMinimumRelayFee
2737
+
2738
+ Get the current minimum relay fee for the chain backend
2739
+
2740
+ Requires LND built with `walletrpc` tag
2741
+
2742
+ Requires `onchain:read` permission
2743
+
2744
+ This method is not supported on LND 0.18.2 and below
2745
+
2746
+ {
2747
+ lnd: <Authenticated LND API Object>
2748
+ }
2749
+
2750
+ @returns via cbk or Promise
2751
+ {
2752
+ tokens_per_vbyte: <Minimum Relayable Tokens Per Virtual Byte Number>
2753
+ }
2754
+
2735
2755
  ### getNetworkCentrality
2736
2756
 
2737
2757
  Get the graph centrality scores of the nodes on the network
@@ -3773,10 +3793,13 @@ Requires `info:read` permission
3773
3793
  type: <Feature Type String>
3774
3794
  }]
3775
3795
  is_synced_to_chain: <Is Synced To Chain Bool>
3796
+ [is_synced_to_graph]: <Is Synced To Network Graph Bool>
3776
3797
  latest_block_at: <Latest Known Block At Date String>
3777
3798
  peers_count: <Peer Count Number>
3778
3799
  pending_channels_count: <Pending Channels Count Number>
3779
3800
  public_key: <Public Key String>
3801
+ [uris]: [<The URIs of the Node String>]
3802
+ version: <LND Version String>
3780
3803
  }
3781
3804
 
3782
3805
  Example:
@@ -6415,6 +6438,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6415
6438
  @event 'failed'
6416
6439
  {
6417
6440
  id: <Payment Hash Hex String>
6441
+ is_canceled: <Payment Canceled Bool>
6418
6442
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6419
6443
  is_invalid_payment: <Failed Due to Invalid Payment Bool>
6420
6444
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
@@ -6570,6 +6594,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
6570
6594
  @event 'failed'
6571
6595
  {
6572
6596
  id: <Payment Hash Hex String>
6597
+ is_canceled: <Payment Canceled Bool>
6573
6598
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6574
6599
  is_invalid_payment: <Failed Due to Invalid Payment Bool>
6575
6600
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
@@ -6904,6 +6929,7 @@ Note: Method not supported on LND 0.15.5 and below
6904
6929
  @event 'failed'
6905
6930
  {
6906
6931
  id: <Payment Hash Hex String>
6932
+ is_canceled: <Payment Canceled Bool>
6907
6933
  is_insufficient_balance: <Failed Due To Lack of Balance Bool>
6908
6934
  is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
6909
6935
  is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
package/index.js CHANGED
@@ -63,6 +63,7 @@ const {getInvoices} = require('lightning');
63
63
  const {getLockedUtxos} = require('lightning');
64
64
  const {getMasterPublicKeys} = require('lightning');
65
65
  const {getMethods} = require('lightning');
66
+ const {getMinimumRelayFee} = require('lightning');
66
67
  const {getNetworkCentrality} = require('lightning');
67
68
  const {getNetworkGraph} = require('lightning');
68
69
  const {getNetworkInfo} = require('lightning');
@@ -228,6 +229,7 @@ module.exports = {
228
229
  getLockedUtxos,
229
230
  getMasterPublicKeys,
230
231
  getMethods,
232
+ getMinimumRelayFee,
231
233
  getNetworkCentrality,
232
234
  getNetworkGraph,
233
235
  getNetworkInfo,
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.17.0",
12
+ "lightning": "10.19.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.21",
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",
@@ -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.17.0"
77
+ "version": "57.19.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
  });
@@ -0,0 +1,26 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
4
+ const {spawnLightningCluster} = require('ln-docker-daemons');
5
+
6
+ const {getMinimumRelayFee} = require('./../../');
7
+
8
+ // Getting the min chain fee rate should return the min fee rate
9
+ test(`Get minimum chain fee rate`, async () => {
10
+ const [{kill, lnd}] = (await spawnLightningCluster({})).nodes;
11
+
12
+ try {
13
+ const feeRate = await getMinimumRelayFee({lnd});
14
+
15
+ await kill({});
16
+
17
+ // LND 0.18.2 and below do not return a minimum relay fee rate
18
+ if (!!feeRate.tokens_per_vbyte) {
19
+ equal(feeRate.tokens_per_vbyte, 1.012, 'Fee rate is returned');
20
+ }
21
+ } catch (err) {
22
+ equal(null, err, 'Expected no error getting relay fee');
23
+ }
24
+
25
+ return;
26
+ });